/* Scoped, theme-proof styles */
.afps-wrap { 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; 
  color:#0f172a; 
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
@media (max-width: 1440px) {
  .afps-wrap { padding: 0 16px; }
}
.afps-header { border:1px solid #e5e7eb; background:#fafafa; border-radius:14px; padding:20px 24px; margin: 0 0 18px 0; }
.afps-h2 { margin:0 0 8px 0; font-size: 26px; line-height: 1.3; font-weight: 700; }
.afps-subtitle { margin:0; color:#475569; font-size: 15px; }

.afps-card { 
  border:1px solid #e5e7eb; 
  background:#ffffff; 
  border-radius:16px; 
  padding:24px 28px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.06); 
  margin-bottom:24px;
  clear: both;
}
.afps-card--soft { background:#fafafa; }
.afps-card--chart { 
  padding: 24px 28px; 
  margin-bottom: 28px;
  clear: both;
  overflow: hidden;
}
.afps-row { display:flex; gap:14px; flex-wrap:wrap; align-items:center; }
.afps-grid { 
  display:grid; 
  gap:20px; 
}
.afps-grid-2 { 
  grid-template-columns: repeat(2, minmax(0, 1fr)); 
  gap: 20px;
}
@media (max-width: 760px) { 
  .afps-grid-2 { 
    grid-template-columns: 1fr; 
    gap: 18px;
  }
  .afps-wrap { padding: 0 12px; }
  .afps-card { padding: 18px 20px; }
  .afps-header { padding: 18px 20px; }
  .afps-section-title { font-size: 20px; }
}

.afps-group-title { 
  font-weight:800; 
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 16px 0; 
  color: #0f172a;
  letter-spacing: -0.01em;
}
.afps-section-title {
  font-weight: 800;
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 20px 0;
  color: #0f172a;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.afps-label { 
  display:block; 
  font-size: 14px; 
  font-weight: 600;
  color:#1e293b; 
  margin-bottom:8px;
  line-height: 1.4;
}
.afps-field { 
  width:100%; 
  border:2px solid #d1d5db; 
  border-radius:10px; 
  padding:10px 14px; 
  font-size:15px; 
  background:#fff; 
  color:#111827;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
.afps-field:focus { 
  outline: none;
  border-color:#2563eb; 
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.afps-btn { border:1px solid #d1d5db; background:#ffffff; color:#111827; border-radius:10px; padding:9px 16px; cursor:pointer; font-weight:600; font-size:14px; transition: all 0.2s ease; }
.afps-btn:hover { background:#f8fafc; color:#111827; border-color:#93c5fd; }
.afps-btn:active { transform: translateY(1px); }
.afps-btn--primary { background:#2563eb; border-color:#2563eb; color:#ffffff; }
.afps-btn--primary:hover { background:#1e4fd6; border-color:#1e4fd6; color:#ffffff; }

/* Download CSV – prominent CTA with MailerLite popup */
.afps-csv-cta {
  border-top: 3px solid #2563eb;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
  padding: 28px 24px !important;
  text-align: center;
  margin-bottom: 24px;
}
.afps-csv-cta-inner { display: flex; justify-content: center; align-items: center; }
.afps-btn--csv-cta {
  background: #2563eb;
  border: 3px solid #2563eb;
  color: #fff;
  padding: 18px 36px;
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: 14px;
  min-height: 56px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.afps-btn--csv-cta:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,0.4); }
.afps-btn--csv-cta:active { transform: translateY(0); }

.afps-inst { 
  background:#f0f9ff; 
  border:2px solid #bae6fd; 
  border-radius:12px; 
  padding:14px 16px; 
  font-size:14px; 
  color:#0c4a6e; 
  margin-bottom: 20px;
  line-height: 1.6;
  font-weight: 500;
}

.afps-steps { display:flex; gap:10px; flex-wrap:wrap; margin-bottom: 10px; }
.afps-step-pill { border:1px solid #e5e7eb; border-radius:999px; padding:6px 10px; font-size:13px; color:#334155; background:#fff; cursor:pointer; }
.afps-step-pill.is-active { border-color:#2563eb; background:#eff6ff; color:#1d4ed8; font-weight:700; }

.afps-kpis { display:grid; gap:12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .afps-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .afps-kpis { grid-template-columns: 1fr; } }
.afps-kpi { 
  border:2px dashed #d1d5db; 
  border-radius:14px; 
  padding:16px; 
  background:#fff;
  transition: all 0.2s ease;
}
.afps-kpi:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.afps-kpi .k { 
  font-size:13px; 
  font-weight: 600;
  color:#64748b; 
  margin-bottom:6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.afps-kpi .v { 
  font-size:22px; 
  font-weight:800; 
  color:#0f172a;
  line-height: 1.2;
  margin: 4px 0;
}
.afps-kpi .s { 
  font-size:13px; 
  color:#475569; 
  margin-top:6px;
  line-height: 1.4;
}

.afps-badges { display:flex; gap:10px; flex-wrap:wrap; }
.afps-badge { 
  padding:8px 14px; 
  border-radius:999px; 
  font-size:13px; 
  font-weight:700; 
  border:2px solid #e5e7eb; 
  background:#fff; 
  color:#0f172a;
  line-height: 1.4;
}
.afps-badge.ok { border-color:#86efac; background:#f0fdf4; color:#166534; }
.afps-badge.bad { border-color:#fecaca; background:#fef2f2; color:#991b1b; }
.afps-badge.warn { border-color:#fde68a; background:#fffbeb; color:#92400e; }

.afps-table-wrap { overflow:auto; border:1px solid #e5e7eb; border-radius:14px; }
.afps-table { width:100%; border-collapse:collapse; min-width: 880px; }
.afps-table th, .afps-table td { padding:10px 10px; border-bottom:1px solid #eef2f7; text-align:left; font-size:13px; }
.afps-table th { background:#EBF2F4; color:#083141; position:sticky; top:0; z-index:1; }
.afps-table tr:hover td { background:#f8fafc; }

.afps-muted { 
  color:#64748b; 
  font-size:14px; 
  line-height: 1.6;
}
.afps-hr { 
  height:2px; 
  background:linear-gradient(to right, #e5e7eb, transparent); 
  margin: 20px 0; 
  border:0; 
}

.afps-mini { 
  font-size:13px; 
  color:#64748b; 
  line-height: 1.5;
}
.afps-field-hint {
  font-size: 13px;
  color: #64748b;
  margin-top: 8px;
  line-height: 1.6;
  padding-left: 2px;
}
.afps-card > div:first-child {
  margin-bottom: 20px;
}
.afps-right { margin-left:auto; }

/* Chart containers */
.afps-chart-container { 
  position: relative; 
  width: 100%; 
  height: 400px; 
  margin: 16px 0;
  clear: both;
}
.afps-chart-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
@media (max-width: 760px) {
  .afps-chart-container { height: 300px; }
}
.afps-chart-title { 
  font-size: 18px; 
  font-weight: 700; 
  color: #0f172a; 
  margin-bottom: 10px;
  line-height: 1.3;
}
.afps-chart-subtitle { 
  font-size: 14px; 
  color: #64748b; 
  margin-bottom: 18px;
  line-height: 1.5;
}
.afps-chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; }
.afps-chart-legend-item { display: flex; align-items: center; gap: 6px; }
.afps-chart-legend-color { width: 12px; height: 12px; border-radius: 2px; }

/* Scheme comparison */
.afps-scheme-comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 760px) {
  .afps-scheme-comparison { grid-template-columns: 1fr; }
}
.afps-scheme-card { border: 2px solid #e5e7eb; border-radius: 12px; padding: 16px; background: #fff; transition: all 0.2s ease; }
.afps-scheme-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.afps-scheme-card.active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 2px 8px rgba(37,99,235,0.15); }
.afps-scheme-card h4 { margin: 0 0 8px 0; font-size: 16px; font-weight: 700; }
.afps-scheme-card .scheme-value { font-size: 20px; font-weight: 800; color: #0f172a; margin: 8px 0; }
.afps-scheme-card .scheme-label { font-size: 12px; color: #64748b; }

/* Enhanced grid layouts */
.afps-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .afps-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .afps-grid-3 { grid-template-columns: 1fr; } }

@media print {
  body * { visibility:hidden; }
  .afps-wrap, .afps-wrap * { visibility:visible; }
  .afps-header { box-shadow:none; }
  .afps-no-print { display:none !important; }
  .afps-card { box-shadow:none; }
  @page { size: A4; margin: 12mm; }
}
