/* Intumwa — "the messenger". Postal-inspired: paper, ink navy, stamp gold. */
:root {
  --ink: #14213D;
  --ink-soft: #3C466B;
  --paper: #F8F7F2;
  --surface: #FFFFFF;
  --blue: #2B4C9B;
  --blue-dark: #223C7C;
  --gold: #F4B942;
  --green: #2E7D5B;
  --red: #C6432F;
  --line: #DDD9CD;
  --muted: #6B7280;
  --radius: 10px;
  --sidebar: var(--ink);
  --font-head: "Plus Jakarta Sans", sans-serif;
  --font-body: "Inter", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14.5px;
  background: var(--paper);
  color: var(--ink);
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--blue); }

/* ── Perforated stamp edge: the signature motif ── */
.perf {
  position: relative;
}
.perf::before {
  content: "";
  position: absolute; top: 0; left: 18px; right: 18px; height: 5px;
  background: radial-gradient(circle at 5px 0, transparent 3.5px, var(--gold) 4px) repeat-x;
  background-size: 12px 5px;
}

/* ── Login ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; max-width: 400px; padding: 44px 40px;
}
.logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
}
.logo .mark {
  width: 44px; height: 44px; flex: none;
  background: var(--ink); color: var(--gold);
  font-family: var(--font-head); font-weight: 700; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.logo .mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo .name {
  font-family: var(--font-head); font-weight: 700; font-size: 24px; letter-spacing: -0.02em;
}
.logo .tag { font-size: 12px; color: var(--muted); display: block; margin-top: 1px; }

/* ── App shell ── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex: none; background: var(--sidebar); color: #E8EAF2;
  display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo { padding: 0 10px 20px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 16px; }
.sidebar .logo .name { color: #fff; font-size: 20px; }
.sidebar .logo .tag { color: #9AA3C0; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 3px;
  background: none; border: none; border-radius: 7px;
  color: #C6CCE0; font-size: 14px; font-weight: 500;
}
.nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-btn.active { background: var(--blue); color: #fff; }
.nav-btn .ic { width: 18px; text-align: center; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: #6B7394; text-transform: uppercase; padding: 16px 12px 6px; }
.nav-section:first-of-type { padding-top: 4px; }
.sidebar .spacer { flex: 1; }
.sidebar .out { color: #9AA3C0; font-size: 13px; }

.main { flex: 1; padding: 30px 36px 60px; max-width: 1120px; }
.view-title {
  font-family: var(--font-head); font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
}
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.view-sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }

/* ── Cards & stats ── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; overflow: hidden;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding-top: 24px; }
.stat .n { font-family: var(--font-body); font-size: 30px; font-weight: 700; color: var(--ink); }
.stat .l { color: var(--muted); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* ── Typography system (matches rne.sdms.gov.rw's results-page hierarchy) ──
   Inter for everything except headline/display moments (Plus Jakarta Sans),
   applied via reusable classes rather than one-off inline styles so any new
   screen can match this hierarchy exactly by using the right class. */
.type-success-title {
  font-family: var(--font-head); font-weight: 700; font-size: 1.65rem; line-height: 1.25;
  color: #14B8A6;
}
.type-section-header {
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink);
}
.type-stat-lg {
  font-family: var(--font-body); font-weight: 700; font-size: 2.1rem; line-height: 1.1; color: var(--ink);
}
.type-label {
  font-family: var(--font-body); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.type-value {
  font-family: var(--font-body); font-weight: 600; font-size: 15px; color: var(--ink);
}
.type-status-pass {
  font-family: var(--font-body); font-weight: 700; font-size: 14px; color: #16A34A;
}
.type-btn {
  font-family: var(--font-body); font-weight: 600; font-size: 14px; color: #fff;
}
/* A ready-made label/value row, matching the "STUDENT CODE ―――― 281006230282" pattern */
.type-field-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.type-field-row:last-child { border-bottom: none; }

/* Simple bar chart */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.chart .bar { flex: 1; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart .bar:hover { background: var(--gold); }
.chart .bar:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 5px; white-space: nowrap; margin-bottom: 5px;
}

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
     padding: 10px 12px; border-bottom: 1.5px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid #EDEBE2; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FBFAF6; }

/* Tag chips styled like little stamps */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink);
  background: #FDF3DC; border: 1px dashed var(--gold);
  padding: 2px 8px; border-radius: 4px; margin: 1px 3px 1px 0;
}
.chip .x { border: none; background: none; color: var(--muted); font-size: 13px; padding: 0; line-height: 1; }
.chip .x:hover { color: var(--red); }

.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.badge.active, .badge.sent { background: #E2F0E9; color: var(--green); }
.badge.unsubscribed, .badge.stopped { background: #F6E4E0; color: var(--red); }
.badge.draft { background: #ECEDF3; color: var(--ink-soft); }
.badge.sending { background: #FDF3DC; color: #94690A; }

/* ── Buttons & inputs ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 13.5px;
  background: var(--blue); color: #fff;
}
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-soft); }
.btn.danger { background: none; border: none; color: var(--red); padding: 4px 8px; font-weight: 500; }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.6); }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.gold:hover { background: #E3A82F; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
textarea { min-height: 160px; resize: vertical; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; line-height: 1.5; }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }

/* ── Modal ── */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,33,61,.5); display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 580px;
  padding: 30px 30px 26px;
}
.modal h2 { font-family: var(--font-head); font-size: 20px; margin-bottom: 4px; padding-top: 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* Code snippet box */
.code {
  background: var(--ink); color: #DCE2F5; font-family: ui-monospace, monospace; font-size: 12px;
  padding: 14px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; line-height: 1.5;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(20,33,61,.3);
}
.toast.err { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }

.hidden { display: none !important; }

/* ── Collapsible menu: topbar + slide-in drawer on mobile ── */
.topbar { display: none; }
.card { overflow-x: auto; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 45;
            background: var(--sidebar); color: #fff; padding: 10px 14px calc(10px);
            padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar .name { color: #fff; }
  .burger { background: none; border: none; color: #fff; font-size: 22px; padding: 4px 8px; cursor: pointer; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 250px; z-index: 70; height: 100vh;
             transform: translateX(-100%); transition: transform .22s ease-out; box-shadow: 8px 0 30px rgba(20,33,61,.35);
             overflow-y: auto; padding-top: calc(22px + env(safe-area-inset-top)); }
  .sidebar.open { transform: translateX(0); }
  .drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(20,33,61,.5); z-index: 65; }
  .drawer-overlay.show { display: block; }
  .main { padding: 18px 14px 60px; }
  .row2 { grid-template-columns: 1fr; }
  .view-title { font-size: 22px; }
  .toolbar .btn { padding: 8px 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: pop .18s ease-out; }
  @keyframes pop { from { transform: translateY(8px); opacity: 0; } }
}

/* ── SaaS additions: auth tabs, pricing strip, plan banner ── */
.tabs { display: flex; gap: 6px; margin: 22px 0 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 4px; }
.tab { flex: 1; padding: 8px; border: none; border-radius: 6px; background: none; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20,33,61,.12); }

.pricing-strip { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; max-width: 440px; }
.price-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 12px 16px; text-align: center; flex: 1; min-width: 110px; }
.price-card .pn { font-weight: 700; font-size: 13px; }
.price-card .pp { font-family: var(--font-head); font-weight: 700; font-size: 17px; margin-top: 2px; }
.price-card .pl { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.banner { border-radius: 9px; padding: 12px 16px; margin-bottom: 20px; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.banner.trial { background: #FDF3DC; border: 1px solid var(--gold); }
.banner.expired { background: #F6E4E0; border: 1px solid var(--red); color: #7C2A1B; }

.file-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #EDEBE2; font-size: 13.5px; }

/* Product management grid */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

/* ── CRM pipeline board ── */
.pipe { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; -webkit-overflow-scrolling: touch; }
.pipe-col { flex: 0 0 240px; background: #EFEDE4; border-radius: 12px; padding: 10px; }
.pipe-col h3 { font-family: var(--font-head); font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
               color: var(--ink-soft); padding: 2px 4px 8px; display: flex; justify-content: space-between; }
.pipe-col h3 .sum { color: var(--muted); font-weight: 600; }
.deal { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.deal:hover { border-color: var(--blue); }
.deal .t { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.deal .m { color: var(--muted); font-size: 12px; margin-top: 3px; }
.deal .v { font-family: var(--font-head); font-weight: 700; font-size: 13px; margin-top: 4px; }
.deal .mv { display: flex; justify-content: space-between; margin-top: 8px; }
.deal .mv button { border: 1px solid var(--line); background: var(--paper); border-radius: 6px; width: 30px; height: 26px; cursor: pointer; font-size: 13px; }
.deal .mv button:hover { background: var(--gold); border-color: var(--gold); }
.fu-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #EDEBE2; font-size: 13.5px; flex-wrap: wrap; }
.fu-row.overdue .due { color: var(--red); font-weight: 700; }
.fu-row .due { color: var(--muted); font-size: 12px; min-width: 84px; }
.note { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin-top: 8px; font-size: 13.5px; }
.note .when { color: var(--muted); font-size: 11.5px; margin-top: 4px; }


/* ════════ Platform themes (set by the super admin) ════════ */

/* US government — USWDS-inspired: flat, square, Public Sans, federal blue & gold */
body[data-theme="usgov"] {
  --sidebar: #162E51;
  --ink: #1B1B1B;
  --ink-soft: #3D4551;
  --paper: #F0F0F0;
  --blue: #005EA2;
  --blue-dark: #1A4480;
  --gold: #FFBE2E;
  --green: #00A91C;
  --red: #D83933;
  --line: #DFE1E2;
  --muted: #565C65;
  --radius: 4px;
  --font-head: "Public Sans", sans-serif;
  --font-body: "Public Sans", sans-serif;
}
body[data-theme="usgov"] .perf::before { display: none; }
body[data-theme="usgov"] .btn { border-radius: 4px; font-weight: 700; }

/* Rwanda government — flag palette: sky blue, sun yellow, land green */
body[data-theme="rwgov"] {
  --sidebar: #20603D;
  --ink: #17323F;
  --ink-soft: #33555F;
  --paper: #F7FAF8;
  --blue: #00A1DE;
  --blue-dark: #0081B2;
  --gold: #FAD201;
  --green: #20603D;
  --red: #C6432F;
  --line: #DCE6E0;
  --muted: #5C6E66;
  --radius: 6px;
  --font-head: "Public Sans", sans-serif;
  --font-body: "Public Sans", sans-serif;
}
body[data-theme="rwgov"] .perf::before {
  background: linear-gradient(90deg, #00A1DE 33%, #FAD201 33% 66%, #20603D 66%);
  height: 4px; border-radius: 2px;
}

/* ClickFunnels-style — bold marketing SaaS: dark navy, action orange, big radius */
body[data-theme="clickfunnels"] {
  --sidebar: #171E33;
  --ink: #1E2432;
  --ink-soft: #454E63;
  --paper: #F4F6FB;
  --blue: #F7761F;
  --blue-dark: #DD6210;
  --gold: #FFC43D;
  --green: #23A566;
  --red: #E64545;
  --line: #E3E7F0;
  --muted: #6E7891;
  --radius: 12px;
  --font-head: "Montserrat", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}
body[data-theme="clickfunnels"] .perf::before { display: none; }
body[data-theme="clickfunnels"] .btn { font-weight: 700; border-radius: 10px; }
body[data-theme="clickfunnels"] .card { box-shadow: 0 4px 18px rgba(23, 30, 51, 0.06); border-color: transparent; }

/* ── Global search ── */
.gsearch { margin: 14px 0 4px; position: relative; }
.gsearch input { width: 100%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px; padding: 8px 12px 8px 32px; color: #fff; font-size: 13px; }
.gsearch input::placeholder { color: rgba(255,255,255,.45); }
.gsearch .gi { position: absolute; left: 10px; top: 8px; opacity: .55; font-size: 13px; }
.sres { max-height: 55vh; overflow-y: auto; margin-top: 8px; }
.sres .hitgroup { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 4px; }
.sres .hit { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.sres .hit:hover { background: var(--paper); }
.sres .hit .ty { font-size: 11px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; color: var(--ink-soft); flex: none; }

/* ── Rich email composer ── */
.rte-bar { display: flex; gap: 4px; flex-wrap: wrap; border: 1px solid var(--line); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 6px; background: var(--paper); }
.rte-bar button { border: 1px solid transparent; background: none; border-radius: 6px; min-width: 30px; height: 30px;
  font-size: 13.5px; color: var(--ink); }
.rte-bar button:hover { background: #fff; border-color: var(--line); }
.rte { border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: #fff; min-height: 200px; max-height: 46vh;
  overflow-y: auto; padding: 14px; font-size: 14.5px; line-height: 1.6; outline: none; }
.rte:focus { border-color: var(--blue); }
.rte.dragover { border-color: var(--gold); background: #FFFDF4; }
.rte img { max-width: 100%; border-radius: 8px; }
.rte a { color: var(--blue); }
.email-preview { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 20px; max-height: 60vh; overflow-y: auto; }
.email-preview img { max-width: 100%; }

/* ── The Vault ── */
.vault { background: linear-gradient(145deg, #23272F 0%, #14171D 55%, #1B1F27 100%); border-radius: 16px;
  padding: 22px; color: #E8EAF2; position: relative; overflow: hidden; border: 1px solid #3A4150;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 10px 34px rgba(0,0,0,.35); margin-bottom: 18px; }
.vault::before { content: ""; position: absolute; inset: 10px; border: 2px solid rgba(244,185,66,.22);
  border-radius: 12px; pointer-events: none; }
.vault::after { content: "● ● ●   ● ● ●"; position: absolute; top: 16px; right: 22px; color: #454C5B;
  font-size: 9px; letter-spacing: 3px; }
.vault h3 { font-family: var(--font-head); display: flex; align-items: center; gap: 12px; margin-bottom: 4px; font-size: 19px; }
.vault .dial { width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #F8D477, #B98A1F 62%, #7A5A12);
  box-shadow: 0 2px 8px rgba(0,0,0,.5), inset 0 -2px 5px rgba(0,0,0,.35); position: relative; }
.vault .dial::before { content: ""; position: absolute; inset: 9px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2C313B, #14171D); border: 1.5px solid #F4B942; }
.vault .dial::after { content: ""; position: absolute; top: 5px; left: 50%; width: 2px; height: 9px;
  background: #F4B942; transform: translateX(-50%); }
.vault .vtotal { color: #9AA3B5; font-size: 13px; margin-bottom: 14px; }
.vault .vtotal b { color: #F4B942; font-family: var(--font-head); font-size: 16px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.vbox { background: linear-gradient(160deg, #2A2F3A, #1D212A); border: 1px solid #3C4350; border-radius: 12px; padding: 14px; }
.vbox .vk { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8D96A8; }
.vbox .vn { font-weight: 700; margin: 2px 0 8px; display: flex; align-items: center; gap: 7px; }
.vbox .vb { font-family: var(--font-head); font-size: 21px; font-weight: 700; color: #F4B942; }
.vbox .vsub { color: #8D96A8; font-size: 12px; margin-top: 2px; }
.vbox .vmoves { margin-top: 8px; border-top: 1px dashed #3C4350; padding-top: 6px; }
.vbox .vmoves div { font-size: 11.5px; color: #A7AFC0; display: flex; justify-content: space-between; padding: 2px 0; }
.vbox .toolbar { margin-top: 10px; }
.vbox .btn.ghost { border-color: #4A5364; color: #E8EAF2; background: transparent; }
.vbox .btn.ghost:hover { background: #313746; }


/* ── Accounting statements ── */
.stmt { max-width: 640px; }
.stmt table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.stmt td { padding: 7px 4px; font-size: 13.8px; border-bottom: 1px solid #F0EEE6; }
.stmt td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.stmt tr.sec td { font-weight: 700; color: var(--ink-soft); border-bottom: 1.5px solid var(--line); padding-top: 14px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.stmt tr.tot td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); font-size: 14.5px; }
.stmt tr.sub td { color: var(--muted); }
.pos { color: #2E7D5B; } .neg { color: var(--red); }
.acc-periods .btn.active-p { background: var(--ink); color: #fff; border-color: var(--ink); }
@media print {
  .sidebar, .topbar, .drawer-overlay, .toolbar, .acc-periods, .btn, .nav-btn { display: none !important; }
  .main { padding: 0 !important; } body { background: #fff; }
  .card { border: none; box-shadow: none; page-break-inside: avoid; }
}

/* ── Buffett Brain ── */
.wb { background: linear-gradient(150deg, #1E3A2F 0%, #12241C 60%, #1A3129 100%); border-radius: 16px; padding: 22px;
  color: #E9F2EC; border: 1px solid #2E5442; margin-bottom: 18px; position: relative; overflow: hidden; }
.wb::before { content: "$"; position: absolute; right: -14px; top: -34px; font-family: var(--font-head);
  font-size: 150px; color: rgba(244,185,66,.07); font-weight: 700; }
.wb h3 { font-family: var(--font-head); font-size: 19px; display: flex; gap: 10px; align-items: center; }
.wb .quote { font-style: italic; color: #A8C4B3; font-size: 13.5px; margin: 6px 0 16px; }
.wb .bar { background: #0D1A14; border-radius: 20px; height: 26px; overflow: hidden; position: relative; border: 1px solid #2E5442; }
.wb .bar .fill { height: 100%; background: linear-gradient(90deg, #F4B942, #E8A020); border-radius: 20px;
  min-width: 8px; transition: width .6s; display: flex; align-items: center; justify-content: flex-end; }
.wb .bar .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 13px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.wb .mrow { display: flex; justify-content: space-between; font-size: 12px; color: #A8C4B3; margin-top: 6px; }
.wb .stat { font-family: var(--font-head); font-size: 24px; font-weight: 700; color: #F4B942; }
.wb .idea { background: rgba(255,255,255,.05); border: 1px solid #2E5442; border-radius: 10px; padding: 12px 14px; margin-top: 9px; }
.wb .idea .it { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #F4B942; }
.wb .idea b { display: block; margin: 3px 0 4px; font-size: 14.5px; color: #fff; }
.wb .idea p { font-size: 12.8px; color: #B9CFC2; line-height: 1.55; }
.wb .btn.ghost { border-color: #3E6B54; color: #E9F2EC; background: transparent; }
.wb input, .wb select { background: #0D1A14; border: 1px solid #2E5442; color: #E9F2EC; border-radius: 8px; padding: 9px 12px; font-family: inherit; }
.wb .ladder { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.wb .rung { flex: 1; min-width: 54px; text-align: center; font-size: 9.5px; color: #7FA08D; padding-top: 6px; border-top: 3px solid #2E5442; }
.wb .rung.done { border-top-color: #F4B942; color: #F4B942; font-weight: 700; }

/* ── Coach chat ── */
.coach-chat { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.coach { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.coach.typing { color: var(--muted); font-style: italic; }
.chat-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-row input { flex: 1; }
.starters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.starters .btn { font-size: 12.5px; }

/* ── Global typography override (admin-controlled) ──
   Deliberately placed at the very end of this file. body[data-theme="x"]
   and body[data-force-typography="1"] are both single-attribute selectors
   on body — equal specificity — so in a tie, whichever rule is LATER in the
   cascade wins. Placing this last guarantees it overrides every theme block
   above it, regardless of which theme (if any) is active. */
body[data-force-typography="1"] {
  --font-head: "Plus Jakarta Sans", sans-serif;
  --font-body: "Inter", sans-serif;
}
