:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #131a2a;
  --muted: #616a7d;
  --line: #e2e5ef;
  --brand: #3a4fe0;
  --brand-dark: #2637b8;
  --brand-soft: #eef1ff;
  --green: #0d8057;
  --green-soft: #e7f7ef;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #8a5a00;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(19, 26, 42, .04), 0 10px 30px rgba(19, 26, 42, .06);
  --shadow-lg: 0 24px 60px rgba(24, 34, 82, .16);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 88% -12%, #e6eaff 0%, rgba(230, 234, 255, 0) 62%),
    radial-gradient(900px 520px at -8% 6%, #eaf6ff 0%, rgba(234, 246, 255, 0) 58%),
    var(--bg);
  font: 16px/1.55 "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: var(--brand); }

code {
  font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 2px 6px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(226, 229, 239, .85);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  letter-spacing: -.015em;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #5a6cff, var(--brand) 55%, var(--brand-dark));
  box-shadow: 0 6px 14px rgba(58, 79, 224, .28);
}

.brand-name { font-size: 15px; }

.nav { display: flex; gap: 4px; }

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 650;
  padding: 8px 13px;
  border-radius: 9px;
}
.nav a:hover { color: var(--ink); background: var(--brand-soft); }
.nav a.active { color: var(--brand-dark); background: var(--brand-soft); }

.wrap {
  width: min(1200px, 100% - 32px);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 48px) 0 72px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 26px clamp(16px, 4vw, 48px) 44px;
  color: var(--muted);
  font-size: 13px;
}
.footer-inner { width: min(1200px, 100%); margin: 0 auto; }
.footer p { margin: 0 0 5px; }

/* ---------- Typography & shared ---------- */

h1, h2, h3 { line-height: 1.15; letter-spacing: -.025em; margin: 0; }
h1 { font-size: clamp(32px, 4.6vw, 52px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand);
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(58, 79, 224, .12);
}

.lede { margin: 0; color: var(--muted); font-size: clamp(16px, 1.9vw, 19px); }
.lede.small { font-size: 15.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.neg { color: var(--red); }

.gradient-text {
  background: linear-gradient(100deg, var(--brand) 0%, #7a5cff 55%, #0ea5a5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f1f3f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  padding: clamp(8px, 2vw, 20px) 0 clamp(28px, 4vw, 44px);
}

.hero-copy h1 { margin-bottom: 16px; }
.hero-copy .lede { max-width: 54ch; }

.hero-stats {
  display: flex;
  gap: 28px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 24px; letter-spacing: -.03em; }
.hero-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }

.hero-art { display: flex; justify-content: flex-end; }
.art-card {
  position: relative;
  width: min(360px, 100%);
  padding: 24px;
  border-radius: 22px;
  background:
    radial-gradient(300px 180px at 90% 0%, rgba(122, 92, 255, .55), transparent 70%),
    linear-gradient(155deg, #17204a, #0f1730 70%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  transform: rotate(-2deg);
}
.art-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  pointer-events: none;
}
.art-label { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #aab6e8; font-weight: 700; }
.art-amount { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 2px; }
.art-meta { font-size: 13px; color: #c5cdf0; }
.art-bars { display: flex; align-items: flex-end; gap: 7px; height: 92px; margin: 20px 0 16px; }
.art-bars span {
  flex: 1;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #8fa0ff, #5567f0);
  opacity: .9;
}
.art-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 128, 87, .18);
  border: 1px solid rgba(74, 222, 165, .35);
  color: #8ff0c8;
  font-size: 11.5px;
  font-weight: 700;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2.5vw, 28px);
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title { font-size: 19px; margin: 0; }
.sub-title {
  margin: 22px 0 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
}

/* ---------- Upload ---------- */

.upload-card { padding: clamp(18px, 3vw, 32px); }

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 24px;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.pane-head h2 { font-size: 16px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 216px;
  padding: 28px 20px;
  border: 1.5px dashed #c7cee2;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfcff, #f5f7ff);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f2f5ff, #e9edff);
  transform: translateY(-1px);
}
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 4px;
}
.dropzone-title { font-weight: 700; font-size: 15px; }
.dropzone-hint { color: var(--muted); font-size: 12.5px; max-width: 30ch; }
.file-name { margin-top: 6px; font-size: 12.5px; color: var(--green); font-weight: 700; word-break: break-all; }

.sample-pane .select { margin-bottom: 14px; }

.select, .input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccd2e2;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.select:focus, .input:focus, .btn:focus-visible, .chip:focus-visible, .section-nav a:focus-visible {
  outline: 3px solid rgba(58, 79, 224, .2);
  outline-offset: 1px;
  border-color: var(--brand);
}
.input-small { width: 84px; }

.sample-groups { display: grid; gap: 12px; }
.sample-group { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; align-items: start; }
.sample-provider {
  display: inline-flex;
  justify-content: center;
  margin-top: 5px;
  padding: 3px 0;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  background: #f1f3f9;
  color: var(--muted);
}
.provider-ke { background: #fff1e8; color: #a34a00; }
.provider-lesco { background: #e9f2ff; color: #1f4fa8; }
.provider-iesco { background: #e9f7f1; color: #0d6b4a; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sample-group .chips { gap: 6px; }

.chip {
  border: 1px solid #d3d8e6;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.chip:hover, .chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.chip-question { border-radius: 10px; padding: 8px 12px; text-align: left; font-weight: 600; }

.upload-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.upload-actions .btn { min-width: 240px; }
.upload-actions p { margin: 0; flex: 1; min-width: 220px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #4a5ef0, var(--brand));
  color: #fff;
  box-shadow: 0 8px 18px rgba(58, 79, 224, .22);
}
.btn-primary:hover { background: linear-gradient(180deg, #4054e6, var(--brand-dark)); }
.btn-primary:disabled { opacity: .62; cursor: progress; box-shadow: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #bfc8e0; background: #fafbff; }
.btn-lg { padding: 14px 20px; font-size: 15px; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-arrow { transition: transform .15s ease; }
.btn:hover .btn-arrow { transform: translateX(2px); }

/* ---------- Steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.step {
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.step-icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}
.step h2 { margin: 13px 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Alerts ---------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert-error { background: var(--red-soft); color: #7a1a12; border-color: #f3c7c2; }
.alert-icon {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(180, 35, 24, .12);
  color: var(--red);
  font-weight: 800; font-size: 12px;
}

/* ---------- Page heads ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.page-title h1 { margin: 0 0 10px; font-size: clamp(27px, 3.6vw, 38px); }
.head-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .03em;
}
.badge-soft { background: #f1f3f9; color: #4b5568; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-provider { background: var(--brand-soft); color: var(--brand-dark); }
.badge-provider.provider-ke { background: #fff1e8; color: #a34a00; }
.badge-provider.provider-lesco { background: #e9f2ff; color: #1f4fa8; }
.badge-provider.provider-iesco { background: #e9f7f1; color: #0d6b4a; }

/* ---------- Section nav ---------- */

.section-nav {
  position: sticky;
  top: 59px;
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 7px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  overflow-x: auto;
}
.section-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.section-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Result layout ---------- */

.result-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.bill-pane { position: sticky; top: 130px; }
.bill-image-link { position: relative; display: block; border-radius: 14px; overflow: hidden; }
.bill-image {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.image-hint {
  position: absolute;
  right: 10px; bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 45, .82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.bill-image-link:hover .image-hint { opacity: 1; transform: translateY(0); }
.image-caption { margin: 8px 2px 0; word-break: break-all; }

.detail-pane { min-width: 0; }
#details, #charges, #history, #ask, #summary { scroll-margin-top: 130px; }

/* ---------- Bill hero ---------- */

.bill-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, .75fr);
  gap: 22px;
  padding: clamp(22px, 3vw, 32px);
  border: 0;
  color: #fff;
  background:
    radial-gradient(500px 260px at 92% -10%, rgba(122, 92, 255, .55), transparent 65%),
    linear-gradient(135deg, #1a2450 0%, #141c3a 60%, #101731 100%);
  box-shadow: var(--shadow-lg);
}
.hero-kicker { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #aab6e8; }
.hero-amount {
  font-size: clamp(36px, 4.6vw, 54px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
  margin: 6px 0 8px;
}
.hero-amount.credit { color: #8ff0c8; }
.hero-sub { margin: 0; color: #c8d0ee; font-size: 14.5px; }
.hero-sub strong { color: #fff; }
.hero-side { display: grid; gap: 8px; align-content: center; }
.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
}
.hero-stat span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #aab6e8; }
.hero-stat strong { font-size: 17px; letter-spacing: -.01em; }
.hero-stat .neg { color: #ffb4ad; }

/* ---------- Summary / stats ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcff;
}
.stat-label { font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-value { font-size: 15.5px; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.meter-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding: 14px 16px;
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-wrap: wrap;
}
.meter-cell { display: flex; flex-direction: column; gap: 2px; }
.meter-arrow { font-size: 19px; color: var(--muted); }
.meter-units { margin-left: auto; padding-left: 18px; border-left: 1px solid var(--line); }

/* ---------- Money panels ---------- */

.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.money-panel { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #fff; }
.money-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #fafbff;
  border-bottom: 1px solid var(--line);
}
.money-panel-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.money-total { font-weight: 800; font-variant-numeric: tabular-nums; }
.money-panel .table { font-size: 13.5px; }
.money-panel .table th, .money-panel .table td { padding: 8px 12px; }
.empty-note { padding: 16px 14px; color: var(--muted); font-size: 13.5px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 750; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th { border-top: 1px solid var(--line); border-bottom: 0; font-size: 13px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact th, .table-compact td { padding: 7px 8px; }

/* ---------- Chart ---------- */

.chart-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.chart-stats div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 9px;
  background: #fbfcff;
  border: 1px solid var(--line);
  min-width: 104px;
}
.chart-stats span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 750; }
.chart-stats strong { font-size: 14px; font-variant-numeric: tabular-nums; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 256px;
  padding: 28px 2px 48px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.bar-col {
  flex: 1 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.bar-track { display: flex; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar {
  width: 68%;
  max-width: 26px;
  min-height: 4px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #8fa0ff, var(--brand));
  transition: filter .12s ease;
}
.bar-col:hover .bar { filter: brightness(1.08); }
.bar-neg { background: linear-gradient(180deg, #ef8f86, var(--red)); }
.bar-peak { background: linear-gradient(180deg, #7a5cff, #4a3bd8); box-shadow: 0 0 0 2px rgba(122, 92, 255, .16); }
.bar-current { outline: 2px solid rgba(58, 79, 224, .28); outline-offset: 2px; }
.bar-value { position: absolute; top: -2px; font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
.bar-value.neg { color: var(--red); }
.bar-label {
  position: absolute;
  bottom: -42px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  transform: rotate(-45deg);
  transform-origin: top center;
}
.chart-note { margin: 44px 0 0; }

/* ---------- Ask ---------- */

.ask-card { background: linear-gradient(180deg, #fff, #fbfcff); }
.suggestion-chips { margin: 12px 0 14px; }
.ask-form { display: flex; gap: 9px; }
.ask-form .input { flex: 1; }
.ask-form .btn { min-width: 92px; }

.answer {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 13px;
  background: linear-gradient(180deg, #f1f4ff, #eef1ff);
  border: 1px solid #d5dcff;
}
.answer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.answer-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-dark); }
.answer-body { font-size: 15px; line-height: 1.6; }
.answer-body > :first-child { margin-top: 0; }
.answer-body > :last-child { margin-bottom: 0; }
.answer-body p { margin: 0 0 .55em; }
.answer-body ul, .answer-body ol { margin: .35em 0 .6em; padding-left: 1.35em; }
.answer-body li { margin: .15em 0; }
.answer-body strong, .answer-body b { font-weight: 750; }
.answer-body code {
  font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(47, 75, 216, .09);
  color: var(--brand-dark);
  padding: 1px 5px;
  border-radius: 5px;
}
.answer-body pre { margin: .5em 0; padding: 10px 12px; border-radius: 9px; background: #101a33; color: #e6ecff; overflow-x: auto; }
.answer-body pre code { background: none; color: inherit; padding: 0; }
.answer-body blockquote { margin: .4em 0; padding: 2px 0 2px 12px; border-left: 3px solid #c9d3ff; color: var(--muted); }
.answer-body a { color: var(--brand-dark); text-decoration: underline; }
.answer-body table { border-collapse: collapse; margin: .4em 0; font-size: .95em; }
.answer-body th, .answer-body td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }

/* ---------- Details / warnings ---------- */

.details summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--brand-dark); }
.details[open] summary { margin-bottom: 10px; }
.warnings { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
.data-checks { margin-top: 2px; }

/* ---------- Generate ---------- */

.generate-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 18px; align-items: start; }
.generate-card .section-head { margin-bottom: 14px; }
.inline-form { display: flex; gap: 9px; align-items: center; margin: 10px 0 14px; }
.command { display: block; padding: 10px 12px; border-radius: 8px; font-size: 12px; overflow-x: auto; background: #f6f7fc; color: var(--brand-dark); }
.generate-status { display: flex; align-items: center; gap: 9px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid #d6dcf5;
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.output-card { background: linear-gradient(180deg, #fff, #fbfcff); }
.file-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 9px;
  background: #fff;
}
.file-row strong { font-size: 14px; }
.file-row p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.file-icon {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}

.result-card { border-color: #cdd7ff; background: linear-gradient(180deg, #fff, #f8faff); }
.result-banner { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.result-check {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 19px;
  font-weight: 800;
}
.download-row { display: flex; gap: 9px; flex-wrap: wrap; margin: 14px 0; }

/* ---------- Animations ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-copy, .upload-card, .steps, .bill-hero, .card { animation: rise .45s ease both; }
  .steps .step:nth-child(2) { animation-delay: .05s; }
  .steps .step:nth-child(3) { animation-delay: .1s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { justify-content: flex-start; }
  .art-card { transform: none; }
  .result-layout { grid-template-columns: 1fr; }
  .bill-pane { position: static; }
  .bill-image { max-height: 70vh; object-fit: contain; }
  .money-grid { grid-template-columns: 1fr; }
  .generate-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .upload-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .bill-hero { grid-template-columns: 1fr; }
  .hero-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-head { flex-direction: column; align-items: flex-start; }
  .section-nav { top: 56px; }
}

@media (max-width: 560px) {
  .topbar { padding: 9px 14px; gap: 8px; }
  .brand-name {
    font-size: 12.5px;
    white-space: nowrap;
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav a { padding: 6px 7px; font-size: 12px; white-space: nowrap; }
  .chart { gap: 3px; height: 232px; padding: 26px 0 44px; }
  .bar-col { flex: 1 0 22px; }
  .bar-value { font-size: 9px; }
  .bar-label { font-size: 9px; }
  .chart-note { font-size: 11px; }
  .wrap { width: min(100% - 22px, 1200px); }
  .hero-copy h1 { font-size: 34px; }
  .hero-stats { gap: 18px; }
  .hero-side { grid-template-columns: 1fr; }
  .ask-form { flex-direction: column; }
  .ask-form .btn { width: 100%; }
  .meter-units { margin-left: 0; padding-left: 0; border-left: 0; }
  .section-nav { padding: 5px; }
  .section-nav a { padding: 6px 9px; }
  .upload-actions { align-items: stretch; }
  .upload-actions .btn { width: 100%; }
  .sample-group { grid-template-columns: 50px minmax(0, 1fr); }
}

/* ---------- Theme toggle ---------- */

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--ink); background: var(--brand-soft); border-color: transparent; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Sample radio pills ---------- */

.chip-sample { position: relative; display: inline-flex; align-items: center; }
.chip-sample input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.chip-sample:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: 0 0 0 2px rgba(58, 79, 224, .12);
}
.chip-sample:has(input:focus-visible) {
  outline: 3px solid rgba(58, 79, 224, .25);
  outline-offset: 1px;
}

/* ---------- Dark theme (default) ---------- */

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1e;
  --card: #121829;
  --ink: #e9edf7;
  --muted: #96a0b8;
  --line: #25304a;
  --brand: #7b88ff;
  --brand-dark: #b9c2ff;
  --brand-soft: rgba(123, 136, 255, .15);
  --green: #4ade9f;
  --green-soft: rgba(74, 222, 159, .12);
  --red: #ff8f86;
  --red-soft: rgba(255, 143, 134, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 40px rgba(0, 0, 0, .32);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .55);
}

[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 88% -12%, rgba(78, 96, 255, .18), rgba(78, 96, 255, 0) 62%),
    radial-gradient(900px 520px at -8% 6%, rgba(14, 165, 165, .09), rgba(14, 165, 165, 0) 58%),
    var(--bg);
}

[data-theme="dark"] .topbar { background: rgba(10, 15, 30, .82); border-bottom-color: var(--line); }
[data-theme="dark"] .nav a:hover, [data-theme="dark"] .nav a.active { color: #dfe4ff; }
[data-theme="dark"] .theme-toggle { border-color: var(--line); }

[data-theme="dark"] .pill { background: #1a2238; color: #aab4cc; }
[data-theme="dark"] .dropzone {
  border-color: #2b3654;
  background: linear-gradient(180deg, #101728, #0d1322);
}
[data-theme="dark"] .dropzone:hover, [data-theme="dark"] .dropzone.dragging {
  border-color: var(--brand);
  background: linear-gradient(180deg, #141d33, #111a2e);
}
[data-theme="dark"] .dropzone-icon { background: var(--brand-soft); color: var(--brand-dark); }
[data-theme="dark"] .select, [data-theme="dark"] .input {
  background: #0e1424;
  border-color: #2b3654;
  color: var(--ink);
}
[data-theme="dark"] .select option, [data-theme="dark"] .select optgroup { background: #0e1424; color: var(--ink); }
[data-theme="dark"] .sample-provider { background: #1a2238; color: #aab4cc; }
[data-theme="dark"] .provider-ke { background: rgba(255, 154, 74, .14); color: #ffb27a; }
[data-theme="dark"] .provider-lesco { background: rgba(96, 156, 255, .15); color: #9cc0ff; }
[data-theme="dark"] .provider-iesco { background: rgba(74, 222, 159, .13); color: #7fe8b8; }
[data-theme="dark"] .chip { background: #141b2e; border-color: #2b3654; color: var(--ink); }
[data-theme="dark"] .chip:hover, [data-theme="dark"] .chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
[data-theme="dark"] .chip-sample:has(input:checked) { color: var(--brand-dark); box-shadow: 0 0 0 2px rgba(123, 136, 255, .18); }

[data-theme="dark"] .btn-ghost { background: #141b2e; border-color: #2b3654; color: var(--ink); }
[data-theme="dark"] .btn-ghost:hover { background: #1a233a; border-color: #3a4768; }
[data-theme="dark"] .btn-primary { background: linear-gradient(180deg, #5b6cff, #3a4fe0); box-shadow: 0 8px 20px rgba(58, 79, 224, .3); }
[data-theme="dark"] .btn-primary:hover { background: linear-gradient(180deg, #4f61f5, #2f43d0); }

[data-theme="dark"] .step { background: rgba(18, 24, 41, .72); border-color: var(--line); }
[data-theme="dark"] .badge-soft { background: #1a2238; color: #b7c0d8; }
[data-theme="dark"] .badge-green { background: var(--green-soft); color: var(--green); }
[data-theme="dark"] .badge-provider { background: var(--brand-soft); color: var(--brand-dark); }
[data-theme="dark"] .badge-provider.provider-ke { background: rgba(255, 154, 74, .14); color: #ffb27a; }
[data-theme="dark"] .badge-provider.provider-lesco { background: rgba(96, 156, 255, .15); color: #9cc0ff; }
[data-theme="dark"] .badge-provider.provider-iesco { background: rgba(74, 222, 159, .13); color: #7fe8b8; }

[data-theme="dark"] .section-nav { background: rgba(15, 21, 38, .9); border-color: var(--line); }
[data-theme="dark"] .section-nav a { color: var(--muted); }
[data-theme="dark"] .section-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }

[data-theme="dark"] .stat, [data-theme="dark"] .meter-row, [data-theme="dark"] .chart-stats div {
  background: #0f1526;
  border-color: var(--line);
}
[data-theme="dark"] .money-panel { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .money-panel-head { background: #0f1526; border-bottom-color: var(--line); }
[data-theme="dark"] .table th, [data-theme="dark"] .table td { border-bottom-color: var(--line); }
[data-theme="dark"] .table tfoot th { border-top-color: var(--line); }
[data-theme="dark"] .table-compact { color: var(--ink); }
[data-theme="dark"] .chart-stats div { background: #0f1526; }

[data-theme="dark"] .bill-image { border-color: var(--line); }
[data-theme="dark"] .image-hint { background: rgba(5, 9, 20, .86); }

[data-theme="dark"] .answer {
  background: linear-gradient(180deg, #141c33, #101728);
  border-color: #2c3860;
}
[data-theme="dark"] .answer-body code { background: rgba(123, 136, 255, .16); color: #cfd5ff; }
[data-theme="dark"] .answer-body pre { background: #060a13; }
[data-theme="dark"] .answer-body blockquote { border-left-color: #3b4a7a; }

[data-theme="dark"] .details summary { color: var(--brand-dark); }
[data-theme="dark"] .warnings { color: #aab4cc; }

[data-theme="dark"] .file-row { background: #0f1526; border-color: var(--line); }
[data-theme="dark"] .output-card { background: linear-gradient(180deg, #121829, #0f1526); }
[data-theme="dark"] .command { background: #0e1424; color: #c3caff; }
[data-theme="dark"] .generate-status { color: var(--muted); }
[data-theme="dark"] .spinner { border-color: #2b3654; border-top-color: var(--brand); }

[data-theme="dark"] .result-card { background: linear-gradient(180deg, #121829, #0f1526); border-color: #2c3860; }
[data-theme="dark"] .result-check { background: var(--green-soft); color: var(--green); }
[data-theme="dark"] .alert-error { background: rgba(180, 35, 24, .18); color: #ffb4ad; border-color: rgba(255, 143, 134, .25); }
[data-theme="dark"] .alert-icon { background: rgba(255, 143, 134, .18); color: var(--red); }

[data-theme="dark"] .footer { border-top-color: var(--line); color: var(--muted); }
[data-theme="dark"] .skip-link { background: #e9edf7; color: #0a0f1e; }
[data-theme="dark"] .file-icon { background: var(--green-soft); color: var(--green); }
[data-theme="dark"] .bar-current { outline-color: rgba(123, 136, 255, .35); }

[data-theme="dark"] .ask-card { background: linear-gradient(180deg, #121829, #0f1526); }
[data-theme="dark"] .ask-card .section-title { color: var(--ink); }
[data-theme="dark"] .ask-card .muted { color: var(--muted); }
[data-theme="dark"] .data-checks { background: var(--card); }

/* ---------- Glossary ---------- */

.glossary { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.glossary summary { cursor: pointer; color: var(--brand-dark); font-weight: 700; font-size: 13.5px; }
.glossary[open] summary { margin-bottom: 10px; }
.glossary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.glossary-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcff; }
.glossary-kind { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.glossary-item strong { display: block; margin: 2px 0 4px; font-size: 13.5px; }
.glossary-item p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.glossary-item .urdu { margin-top: 6px; font-size: 12.5px; color: #7b86a0; }
[data-theme="dark"] .glossary-item { background: #0f1526; border-color: var(--line); }
[data-theme="dark"] .glossary-item .urdu { color: #9aa4bb; }

/* ---------- Print ---------- */

@media print {
  @page { margin: 12mm; }
  .topbar, .footer, .section-nav, .page-actions, .ask-card, .data-checks,
  .bill-pane, .glossary, .image-hint { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .wrap { width: 100%; padding: 0; }
  .card, .output-card, .result-card, .ask-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    color: #000 !important;
    break-inside: avoid;
  }
  .bill-hero { background: #fff !important; color: #000 !important; border: 1px solid #ddd !important; }
  .hero-kicker, .hero-sub, .hero-stat span, .stat-label, .muted, .chart-note { color: #444 !important; }
  .hero-sub strong, .hero-stat strong, .hero-amount { color: #000 !important; }
  .hero-stat, .stat, .meter-row, .money-panel, .money-panel-head, .chart-stats div,
  .answer, .file-row { background: #fff !important; border-color: #ddd !important; }
  .table th, .table td, .meter-units { border-color: #ddd !important; }
  .result-layout { grid-template-columns: 1fr; }
  .chart { height: 200px; }
  .answer-body pre { background: #f4f4f4 !important; color: #000 !important; }
  #summary, #details, #charges, #history, #ask { scroll-margin: 0; }
}

/* ---------- Answer evidence ---------- */

.evidence {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid rgba(58, 79, 224, .18);
}
.evidence-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.evidence ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.evidence li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(58, 79, 224, .1);
}
.evidence li:last-child { border-bottom: 0; padding-bottom: 0; }
[data-theme="dark"] .evidence li { border-bottom-color: rgba(123, 136, 255, .12); }
.evidence-key { color: var(--muted); }
.evidence-value { font-weight: 700; text-align: right; }
.evidence-value a { color: var(--brand-dark); text-decoration: none; border-bottom: 1px dotted currentColor; }
[data-theme="dark"] .evidence { border-top-color: rgba(123, 136, 255, .22); }
[data-theme="dark"] .evidence-value a { color: var(--brand-dark); }
