/* ============================================================
   KOREVRA REAL+ — "Groundwork" design system
   Trust you can stand on. Warm earth, institutional calm.
   Fonts: Fraunces (display) · Manrope (UI) · IBM Plex Mono (money)
   Theme: data-theme="light|dark" on <html>. Tokens only — no raw hex
   in modules. Surface classes: body.surface-paper | body.surface-ops
   ============================================================ */

:root, html[data-theme="light"] {
  --bg: #F5F2EA;            /* warm paper */
  --bg2: #EDE9DE;
  --card: #FFFFFF;
  --card2: #FAF8F2;
  --line: #E3DED2;
  --line2: #D3CCBC;
  --ink: #1B231F;
  --mut: #5A6660;           /* AA on card */
  --faint: #5D6862;         /* AA even at .xs on bg2 — hierarchy via size, not gray */
  --brand: #123D2E;         /* deep forest */
  --brand-ink: #FFFFFF;
  --brand-soft: #E3EEE7;
  --ok: #1B7A4E;            /* Korevra Verified green */
  --ok-soft: #DFF0E6;
  --clay: #A84B24;          /* terracotta */
  --clay-soft: #F6E4D9;
  --gold: #7A5A15;          /* brass, deepened for AA on gold-soft */
  --gold-soft: #F3EAD2;
  --sea: #175E6E;           /* diaspora teal */
  --sea-soft: #DDEDF1;
  --err: #B3362B;
  --err-soft: #F7E0DD;
  --warn: #8F5B12;
  --warn-soft: #F6EAD4;
  --violet: #5B4B8A;
  --violet-soft: #E9E4F5;
  --shadow: 0 1px 2px rgba(27,35,31,.05), 0 8px 28px -12px rgba(27,35,31,.14);
  --shadow-lg: 0 2px 6px rgba(27,35,31,.07), 0 24px 60px -20px rgba(27,35,31,.25);
  --topbar-h: 54px;
  --side-w: 218px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0F1613;
  --bg2: #0B110E;
  --card: #17211C;
  --card2: #1C2721;
  --line: #26332C;
  --line2: #33423A;
  --ink: #ECF2EE;
  --mut: #A4B2AA;
  --faint: #8FA097;
  --brand: #DCEDE3;
  --brand-ink: #10241B;
  --brand-soft: #1D2E26;
  --ok: #45C08A;
  --ok-soft: #173427;
  --clay: #E08B5F;
  --clay-soft: #3A241A;
  --gold: #D9B25C;
  --gold-soft: #33290F;
  --sea: #5FB9CD;
  --sea-soft: #12313A;
  --err: #E88075;
  --err-soft: #3D1F1C;
  --warn: #DBA84E;
  --warn-soft: #362A13;
  --violet: #B0A2DC;
  --violet-soft: #292244;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px -12px rgba(0,0,0,.5);
  --shadow-lg: 0 2px 8px rgba(0,0,0,.4), 0 28px 70px -20px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 400 14.5px/1.55 Manrope, system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img, svg { display: inline-block; vertical-align: middle; max-width: 100%; }
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ok); outline-offset: 1px; border-color: var(--ok); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--ok); }
label { font-size: 12.5px; font-weight: 600; color: var(--mut); display: block; margin: 10px 0 5px; }
::placeholder { color: var(--faint); }
:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
code, .mono, .num { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

h1,h2,h3,h4,.h1,.h2,.h3 { line-height: 1.22; }
.h1 { font: 600 30px/1.15 Fraunces, serif; letter-spacing: -.015em; }
.h2 { font: 600 22px/1.2 Fraunces, serif; letter-spacing: -.01em; }
.h3 { font: 700 16.5px/1.3 Manrope, sans-serif; }
.sm { font-size: 12.5px; } .xs { font-size: 11px; }
.mut { color: var(--mut); } .faint { color: var(--faint); }
.bold { font-weight: 700; } .semi { font-weight: 600; }
.ok-t { color: var(--ok); } .err-t { color: var(--err); } .warn-t { color: var(--warn); }
.gold-t { color: var(--gold); } .clay-t { color: var(--clay); } .sea-t { color: var(--sea); }
.right { text-align: right; } .center { text-align: center; }
.up { text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; font-weight: 700; }

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
.split-l { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; align-items: start; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap-r { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.gap6 { gap: 6px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; }
.mb8 { margin-bottom: 8px; } .mb14 { margin-bottom: 14px; }
@media (max-width: 1080px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .split, .split-l { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .wrap { padding: 0 14px; }
}

/* ---------- shell chrome ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 60; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .logo { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.topbar .logo .lg-mark { width: 28px; height: 28px; }
.topbar .logo .lg-name { font: 600 17px Fraunces, serif; letter-spacing: -.01em; }
.topbar .logo .lg-name b { color: var(--ok); font-weight: 700; }
.top-portal {
  display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--ink); font-weight: 700; font-size: 12.5px;
  border: 1px solid var(--line);
}
.top-clock { margin-left: auto; font-size: 11.5px; color: var(--mut); }
.top-ico {
  position: relative; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: var(--mut); border: 1px solid transparent;
}
.top-ico:hover { background: var(--bg2); color: var(--ink); }
.top-ico .dot {
  position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 99px;
  background: var(--clay); border: 2px solid var(--card);
}
.persona-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.main { flex: 1; display: flex; min-height: 0; }
.side {
  width: var(--side-w); flex: 0 0 auto; padding: 14px 10px; border-right: 1px solid var(--line);
  background: var(--card); position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.side .s-head { padding: 2px 10px 10px; }
.side .s-head .up { color: var(--faint); }
.snav {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: 10px; color: var(--mut); font-weight: 600; font-size: 13.5px;
  margin-bottom: 2px;
}
.snav svg { flex: 0 0 auto; opacity: .85; }
.snav:hover { background: var(--bg2); color: var(--ink); }
.snav.on { background: var(--brand); color: var(--brand-ink); }
html[data-theme="dark"] .snav.on { background: var(--brand-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }
.content { flex: 1; min-width: 0; padding: 20px 22px 60px; }
.content > .screen { max-width: 1180px; margin: 0 auto; }
.pg-head { margin-bottom: 16px; }
.pg-head .h1 { font-size: 26px; }
.pg-head .sub { color: var(--mut); margin-top: 3px; }
@media (max-width: 900px) {
  .side { position: fixed; left: 0; z-index: 55; transform: translateX(-102%); transition: transform .22s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .content { padding: 16px 14px 60px; }
}
.burger { display: none; }
@media (max-width: 900px) { .burger { display: grid; } }

/* ---------- cards & stats ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow);
}
.card.pad0 { padding: 0; overflow: hidden; }
.card.flat { box-shadow: none; }
.card.wash { background: var(--card2); }
.c-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.c-head .h3 { display: flex; align-items: center; gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow); }
.stat .s-l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.stat .s-v { font: 600 23px/1.15 Fraunces, serif; margin-top: 4px; }
.stat .s-v.num { font: 600 21px/1.2 "IBM Plex Mono", monospace; letter-spacing: -.03em; }
.stat .s-s { font-size: 11.5px; color: var(--mut); margin-top: 3px; }
.stat.tone-ok { border-left: 3px solid var(--ok); }
.stat.tone-err { border-left: 3px solid var(--err); }
.stat.tone-warn { border-left: 3px solid var(--warn); }
.stat.tone-gold { border-left: 3px solid var(--gold); }
.stat.tone-sea { border-left: 3px solid var(--sea); }
.stat.tone-clay { border-left: 3px solid var(--clay); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; font-weight: 700; font-size: 13px;
  border: 1px solid var(--line2); background: var(--card); color: var(--ink);
  transition: transform .05s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
html[data-theme="dark"] .btn.pri { background: var(--ok); color: #08130D; border-color: var(--ok); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
html[data-theme="dark"] .btn.ok { color: #08130D; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--line2)); }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 14.5px; border-radius: 12px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- badges / chips / tiers ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
}
.badge.t-ok { background: var(--ok-soft); color: var(--ok); }
.badge.t-err { background: var(--err-soft); color: var(--err); }
.badge.t-warn { background: var(--warn-soft); color: var(--warn); }
.badge.t-info { background: var(--sea-soft); color: var(--sea); }
.badge.t-gold { background: var(--gold-soft); color: var(--gold); }
.badge.t-clay { background: var(--clay-soft); color: var(--clay); }
.badge.t-violet { background: var(--violet-soft); color: var(--violet); }
.badge.t-mute { background: var(--bg2); color: var(--mut); }
.badge.t-brand { background: var(--brand); color: var(--brand-ink); }
html[data-theme="dark"] .badge.t-brand { background: var(--brand-soft); color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--card); color: var(--ink);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
html[data-theme="dark"] .chip.on { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.tier { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.tier-basic { background: var(--bg2); color: var(--mut); }
.tier-verified { background: var(--ok-soft); color: var(--ok); }
.tier-premium { background: var(--brand); color: var(--brand-ink); }
html[data-theme="dark"] .tier-premium { background: var(--ok); color: #08130D; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line2);
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--card2); }
.tbl .num, .tbl td.r { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.rowlink { cursor: pointer; }

/* ---------- kv ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; font-size: 13px; }
.kv > div { padding: 7px 2px; border-bottom: 1px dashed var(--line); }
.kv > div:nth-child(odd) { color: var(--mut); font-weight: 600; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line2); margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-weight: 700; font-size: 13px; color: var(--mut);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ok); }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line2); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 99px;
  background: var(--card); border: 3px solid var(--faint);
}
.tl-item.ok::before { border-color: var(--ok); background: var(--ok); }
.tl-item.warn::before { border-color: var(--warn); }
.tl-item.err::before { border-color: var(--err); }
.tl-item.now::before { border-color: var(--ok); }
.tl-item .tl-t { font-weight: 700; font-size: 13px; }
.tl-item .tl-s { color: var(--mut); font-size: 12px; margin-top: 1px; }
.tl-item .tl-when { color: var(--faint); font-size: 11px; margin-top: 2px; }

/* ---------- progress / gauge ---------- */
.prog { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.prog > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .4s; }
.prog.warn > i { background: var(--warn); } .prog.err > i { background: var(--err); }
.prog.gold > i { background: var(--gold); } .prog.sea > i { background: var(--sea); }
.prog.clay > i { background: var(--clay); }

/* ---------- avatar ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 99px; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: var(--brand-ink); background: var(--brand); flex: 0 0 auto;
}
html[data-theme="dark"] .avatar { background: var(--brand-soft); color: var(--ink); border: 1px solid var(--line2); }
.avatar.lg { width: 46px; height: 46px; font-size: 15px; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 34px 18px; color: var(--mut); }
.empty .e-ico { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty .e-t { font-weight: 700; color: var(--ink); font-size: 14.5px; }
.empty .e-s { font-size: 12.5px; margin-top: 3px; }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 12px; background: var(--ink); color: var(--bg);
  font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg); max-width: min(92vw, 520px);
  display: flex; gap: 9px; align-items: center; animation: t-in .25s cubic-bezier(.2,.9,.3,1.2);
}
.toast .t-dot { width: 9px; height: 9px; border-radius: 99px; flex: 0 0 auto; }
.toast.ok .t-dot { background: var(--ok); } .toast.err .t-dot { background: var(--err); }
.toast.warn .t-dot { background: var(--warn); } .toast.info .t-dot { background: var(--sea); }
@keyframes t-in { from { opacity: 0; transform: translateY(12px); } }
.toast.out { animation: t-out .3s forwards; }
@keyframes t-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- modal / sheet / drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 150; background: rgba(15,22,19,.45);
  display: grid; place-items: center; padding: 20px; animation: o-in .18s;
  backdrop-filter: blur(3px);
}
@keyframes o-in { from { opacity: 0; } }
.modal {
  width: min(620px, 96vw); max-height: 88vh; overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: m-in .22s cubic-bezier(.2,.9,.3,1.1);
}
.modal.lg { width: min(880px, 96vw); }
.modal.sm { width: min(440px, 96vw); }
@keyframes m-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 2; border-radius: 16px 16px 0 0; }
.m-head .h3 { font-size: 15.5px; }
.m-x { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--mut); font-size: 17px; }
.m-x:hover { background: var(--bg2); color: var(--ink); }
.m-body { padding: 16px 18px; }
.m-foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); border-radius: 0 0 16px 16px; }
.overlay.sheet-ov { place-items: end center; padding: 0; }
.sheet {
  width: min(430px, 100vw); max-height: 86vh; overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
  animation: s-in .25s cubic-bezier(.2,.9,.3,1.05); padding-bottom: 8px;
}
@keyframes s-in { from { transform: translateY(60%); opacity: .4; } }
.sheet .grab { width: 42px; height: 4px; border-radius: 99px; background: var(--line2); margin: 9px auto 2px; }
.drawer-ov { place-items: stretch end; padding: 0; }
.drawer { width: min(460px, 94vw); height: 100vh; overflow-y: auto; background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: d-in .22s; }
@keyframes d-in { from { transform: translateX(40px); opacity: .5; } }

/* ---------- wizard ---------- */
.wiz-steps { display: flex; gap: 6px; margin-bottom: 16px; }
.wiz-steps .ws { flex: 1; height: 5px; border-radius: 99px; background: var(--bg2); }
.wiz-steps .ws.done { background: var(--ok); }
.wiz-steps .ws.now { background: var(--brand); }
html[data-theme="dark"] .wiz-steps .ws.now { background: var(--ok); opacity: .6; }

/* ---------- score ring / gauge ---------- */
.gauge-wrap { display: flex; align-items: center; gap: 14px; }
.factor { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 12.5px; }
.factor .f-l { flex: 0 0 44%; color: var(--mut); font-weight: 600; }
.factor .prog { flex: 1; }
.factor .f-v { flex: 0 0 34px; text-align: right; font-weight: 700; }

/* ---------- phone frame ---------- */
.phone-stage { display: grid; place-items: start center; padding: 26px 12px 60px; }
.phone {
  width: 390px; max-width: 100vw; height: 780px; max-height: calc(100vh - 130px);
  background: var(--bg); border-radius: 38px; border: 1px solid var(--line2);
  box-shadow: var(--shadow-lg), 0 0 0 9px var(--ink), 0 0 0 10.5px var(--line2);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
}
@media (max-width: 500px) {
  .phone-stage { padding: 0; }
  .phone { width: 100vw; height: calc(100vh - var(--topbar-h)); max-height: none; border-radius: 0; box-shadow: none; border: 0; }
}
.ph-status {
  height: 34px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; font-size: 11.5px; font-weight: 700; flex: 0 0 auto;
}
.ph-head { padding: 4px 18px 12px; flex: 0 0 auto; }
.ph-body { flex: 1; overflow-y: auto; padding: 2px 14px 18px; -webkit-overflow-scrolling: touch; }
.ph-tabs {
  flex: 0 0 auto; display: flex; border-top: 1px solid var(--line);
  background: var(--card); padding: 6px 4px calc(10px + env(safe-area-inset-bottom, 6px));
}
.ph-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; font-size: 10px; font-weight: 700; color: var(--faint); border-radius: 10px; }
.ph-tab.on { color: var(--ok); }
.ph-tab svg { width: 21px; height: 21px; }
.ph-hero {
  margin: 4px 0 12px; padding: 16px; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, #0E3123, #17503A 60%, #1B6743);
  box-shadow: var(--shadow);
}
.ph-hero .mut, .ph-hero .faint { color: rgba(255,255,255,.78); }

/* ---------- landing ---------- */
.land-hero {
  position: relative; overflow: hidden; color: #F3F7F1;
  background:
    radial-gradient(1100px 480px at 80% -10%, rgba(69,192,138,.22), transparent 60%),
    radial-gradient(700px 420px at 12% 110%, rgba(180,85,45,.25), transparent 55%),
    linear-gradient(160deg, #0D2A20 0%, #123D2E 55%, #14462F 100%);
  border-bottom: 1px solid var(--line);
}
.land-hero .wrap { padding: 74px 22px 66px; position: relative; z-index: 2; }
.land-hero .k-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.land-hero h1 { font: 600 52px/1.08 Fraunces, serif; letter-spacing: -.02em; margin: 22px 0 14px; max-width: 820px; }
.land-hero h1 em { font-style: italic; color: #7ADBAA; }
.land-hero .lede { font-size: 17px; color: rgba(243,247,241,.82); max-width: 640px; line-height: 1.6; }
.land-grid-bg { position: absolute; inset: 0; opacity: .5; z-index: 1; pointer-events: none; }
@media (max-width: 720px) { .land-hero h1 { font-size: 34px; } .land-hero .wrap { padding: 46px 16px 42px; } }
.land-sec { padding: 54px 0; }
.land-sec.alt { background: var(--card); border-block: 1px solid var(--line); }
.sec-eyebrow { color: var(--clay); font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; }
.sec-title { font: 600 32px/1.15 Fraunces, serif; letter-spacing: -.015em; margin: 8px 0 10px; }
.sec-lede { color: var(--mut); max-width: 640px; font-size: 15px; }
.mod-card { position: relative; transition: transform .18s, box-shadow .18s; cursor: pointer; overflow: hidden; }
.mod-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.mod-card .m-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 11px; }
.portal-card { display: flex; gap: 12px; align-items: center; padding: 13px 15px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.portal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.portal-card .p-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; }
.marquee { overflow: hidden; white-space: nowrap; border-block: 1px solid var(--line); background: var(--card); padding: 11px 0; }
.marquee .mq-track { display: inline-block; animation: mq 40s linear infinite; }
@keyframes mq { to { transform: translateX(-50%); } }
.mq-item { display: inline-flex; align-items: center; gap: 8px; margin: 0 26px; color: var(--mut); font-weight: 700; font-size: 12.5px; }

/* ---------- listing cards / prop art ---------- */
.list-card { overflow: hidden; padding: 0; cursor: pointer; transition: transform .16s, box-shadow .16s; }
.list-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.list-card .lc-art { position: relative; }
.list-card .lc-art .tier { position: absolute; top: 10px; left: 10px; }
.list-card .lc-art .lc-price { position: absolute; bottom: 10px; left: 10px; background: rgba(13,26,20,.78); color: #fff; padding: 4px 11px; border-radius: 9px; font-weight: 700; backdrop-filter: blur(3px); }
.list-card .lc-body { padding: 12px 14px 14px; }

/* ---------- map ---------- */
.map-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); position: relative; background: #DDE8DF; }
html[data-theme="dark"] .map-wrap { background: #14231C; }
.map-pin { cursor: pointer; }
.map-pin:hover circle:last-of-type { r: 7; }

/* ---------- chat (WhatsApp-ish) ---------- */
.chat-scroll { display: flex; flex-direction: column; gap: 7px; padding: 10px 4px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45; box-shadow: var(--shadow); position: relative; white-space: pre-wrap; word-break: break-word; }
.bubble.me { align-self: flex-end; background: #D7F2E3; color: #10241B; border-bottom-right-radius: 4px; }
html[data-theme="dark"] .bubble.me { background: #1E4D37; color: #E7F5EC; }
.bubble.them { align-self: flex-start; background: var(--card); border-bottom-left-radius: 4px; }
.bubble .b-when { display: block; font-size: 9.5px; color: var(--faint); text-align: right; margin-top: 3px; }
.bubble.me .b-when { color: #3E6B53; }
html[data-theme="dark"] .bubble.me .b-when { color: #A9D8BC; }
.bubble.sys { align-self: center; background: var(--gold-soft); color: var(--gold); font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 999px; box-shadow: none; }
.chat-input { display: flex; gap: 8px; padding: 8px 0 0; }
.chat-input input { border-radius: 999px; }

/* ---------- ussd ---------- */
.ussd-screen { background: #0E1A13; color: #C9E8CF; font-family: "IBM Plex Mono", monospace; font-size: 13px; border-radius: 12px; padding: 16px; min-height: 210px; white-space: pre-wrap; border: 1px solid var(--line2); }

/* ---------- receipt ---------- */
.rcpt { font-size: 12.5px; }
.rcpt .rc-head { text-align: center; padding: 6px 0 12px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.rcpt .rc-head .h2 { font-size: 18px; }
.rcpt .rc-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.rcpt .rc-row.big { font-size: 16px; font-weight: 800; border-bottom: 2px solid var(--ink); padding: 9px 0; }
.rcpt .rc-qr { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.rcpt .rc-qrn { font-size: 10.5px; color: var(--mut); }
.rcpt .rc-legal { font-size: 10px; color: var(--faint); margin-top: 10px; line-height: 1.5; }

/* ---------- fraud graph ---------- */
.fgraph { background: var(--card2); border-radius: 14px; border: 1px solid var(--line); }
.fnode { cursor: pointer; }
.fnode text { font-size: 9.5px; font-weight: 700; fill: var(--ink); }

/* ---------- doc paper ---------- */
.docpaper {
  background: var(--card); border: 1px solid var(--line2); border-radius: 4px; padding: 26px 30px;
  font-family: Georgia, "Times New Roman", serif; font-size: 13.5px; line-height: 1.7; box-shadow: var(--shadow);
  max-height: 60vh; overflow-y: auto;
}
.docpaper h3 { text-align: center; font-size: 15px; letter-spacing: .04em; margin-bottom: 14px; text-transform: uppercase; }
.docpaper .sig { margin-top: 26px; display: flex; justify-content: space-between; gap: 20px; }
.docpaper .sigline { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 11px; width: 42%; }
.stampline { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--mut); background: var(--bg2); border-radius: 8px; padding: 7px 10px; word-break: break-all; }

/* ---------- misc ---------- */
.searchbar { display: flex; gap: 8px; align-items: center; }
.searchbar input { border-radius: 999px; padding-left: 38px; }
.searchbar .s-ico { position: absolute; margin-left: 13px; color: var(--faint); pointer-events: none; }
.kbd { font: 600 10.5px "IBM Plex Mono", monospace; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--mut); background: var(--card); }
.divider-v { width: 1px; align-self: stretch; background: var(--line); }
.scroll-x { overflow-x: auto; display: flex; gap: 10px; padding-bottom: 6px; scrollbar-width: thin; }
.notif-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.notif-item:hover { background: var(--card2); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; font-size: 11px; }
.cal .cal-d { aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center; background: var(--bg2); position: relative; font-weight: 600; }
.cal .cal-h { aspect-ratio: auto; padding: 3px 0; background: none; color: var(--faint); font-weight: 800; font-size: 9.5px; text-transform: uppercase; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--mut); }
.legend .lg-i { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.legend .lg-dot { width: 9px; height: 9px; border-radius: 3px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.fade-in { animation: fade .3s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.copilot-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 52px; height: 52px; border-radius: 18px;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: var(--shadow-lg);
  transition: transform .15s;
}
html[data-theme="dark"] .copilot-fab { background: var(--ok); color: #08130D; }
.copilot-fab:hover { transform: scale(1.06); }
.copilot-panel {
  position: fixed; right: 20px; bottom: 82px; z-index: 95; width: min(390px, calc(100vw - 30px));
  height: min(560px, calc(100vh - 120px)); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: m-in .2s;
}
.copilot-panel .cp-head { padding: 12px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 9px; background: var(--brand); color: var(--brand-ink); }
html[data-theme="dark"] .copilot-panel .cp-head { background: var(--card2); color: var(--ink); }
.copilot-panel .cp-body { flex: 1; overflow-y: auto; padding: 12px; }
.copilot-panel .cp-foot { padding: 10px 12px; border-top: 1px solid var(--line); }
.suggest-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* ---------- boot splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
  background:
    radial-gradient(900px 420px at 78% -8%, rgba(69,192,138,.16), transparent 60%),
    radial-gradient(620px 380px at 14% 108%, rgba(180,85,45,.18), transparent 55%),
    linear-gradient(160deg, #0D2A20 0%, #123D2E 55%, #14462F 100%);
  transition: opacity .45s, visibility .45s;
}
#splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.sp-inner { text-align: center; color: #F3F7F1; animation: sp-in .6s cubic-bezier(.2,.9,.3,1.1); }
@keyframes sp-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.sp-mark { filter: drop-shadow(0 14px 34px rgba(0,0,0,.35)); animation: sp-float 3.2s ease-in-out infinite; }
@keyframes sp-float { 50% { transform: translateY(-6px); } }
.sp-seal { transform-origin: 35px 13px; animation: sp-pulse 2.2s ease-in-out infinite; }
@keyframes sp-pulse { 50% { transform: scale(1.14); } }
.sp-name { font: 600 27px Fraunces, serif; margin-top: 14px; letter-spacing: -.01em; }
.sp-name b { color: #7ADBAA; }
.sp-tag { font: 600 12px Manrope, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: rgba(243,247,241,.55); margin-top: 5px; }
.sp-bar { width: 230px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.14); margin: 22px auto 10px; overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 8%; border-radius: 99px; background: linear-gradient(90deg, #45C08A, #7ADBAA); transition: width .5s cubic-bezier(.2,.9,.3,1); }
.sp-msg { font: 600 12px Manrope, sans-serif; color: rgba(243,247,241,.75); min-height: 17px; }

@media print {
  .topbar, .side, .copilot-fab, .copilot-panel, .btn, .ph-tabs, #toasts { display: none !important; }
  body { background: #fff; }
}
