/* ============================================================================
   Korevra Coop+ — Design System
   "Ledger-grade meets indigenous warmth"
   Single source of truth · live-themeable CSS variables · light & dark
   ============================================================================ */

/* Self-hosted: a strict `style-src 'self'` blocks fonts.googleapis.com outright,
   and the market rail should not need a third party to render a balance. */
@import url('fonts/fonts.css');

:root {
  --brand: #0C5B52;
  --brand-deep: #083D37;
  --brand-soft: #E2F0EC;
  --accent: #C99B2E;
  --accent-soft: #FBF0D8;
  /* gold used as TEXT on the deep-teal hero/splash panels. --accent itself is a
     FILL (logo mark, gold button) and measured only 2.34 on the radial's inner
     stop, so the text usages get their own lifted ink. Same value in dark. */
  --accent-on-deep: #EACC7C;

  /* warm paper base, cool-neutral surfaces so data reads crisp on warmth */
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #FAF9F5;
  --ink: #14251F;
  --ink-2: #3E514A;
  --muted: #5E6E67;
  --line: #E5E2D8;
  --line-2: #F0EDE4;

  /* ---- hue system: every hue ships solid (graphics) · tint (fills) · ink (text on tint)
         Every ink/tint pair is ≥4.5:1. Never put a --h-* solid on a tint as text. ---- */
  --h-brand: #0C5B52;  --h-brand-t: #E2F0EC;  --h-brand-i: #08453E;
  --h-gold:  #B8860B;  --h-gold-t:  #FBF0D8;  --h-gold-i:  #7A5A08;
  --h-ok:    #1F8A4C;  --h-ok-t:    #E4F4E9;  --h-ok-i:    #146236;
  --h-moss:  #4A7A2C;  --h-moss-t:  #EBF3E2;  --h-moss-i:  #33561D;
  --h-warn:  #B5650A;  --h-warn-t:  #FBEEDC;  --h-warn-i:  #7C4406;
  --h-danger:#C4392B;  --h-danger-t:#FBE7E4;  --h-danger-i:#8C2418;
  --h-info:  #1F6FEB;  --h-info-t:  #E6EFFD;  --h-info-i:  #12459B;
  --h-plum:  #7C4DBE;  --h-plum-t:  #F1E9FB;  --h-plum-i:  #54308A;
  --h-rose:  #B93A6B;  --h-rose-t:  #FBE7EF;  --h-rose-i:  #85224A;
  --h-indigo:#3C4CA8;  --h-indigo-t:#E9EBF8;  --h-indigo-i:#293677;
  --h-teal:  #0E7C7B;  --h-teal-t:  #E0F2F1;  --h-teal-i:  #0A5655;
  --h-ink:   #14251F;  --h-ink-t:   #E9ECEA;  --h-ink-i:   #14251F;
  --h-muted: #6B7A73;  --h-muted-t: #F0F1EE;  --h-muted-i: #4E5A55;

  /* ---- FILL scale: solid backgrounds that carry white text. Deliberately NOT
         redefined in dark mode — a filled button must stay dark so its white
         label survives. (--brand/--h-* legitimately lighten in dark for TEXT.) ---- */
  --on-fill: #FFFFFF;
  --fill-brand: #0C5B52; --fill-gold: #7A5A08; --fill-ok: #146236; --fill-moss: #33561D;
  --fill-warn: #7C4406; --fill-danger: #8C2418; --fill-info: #12459B; --fill-plum: #54308A;
  --fill-rose: #85224A; --fill-indigo: #293677; --fill-teal: #0A5655; --fill-ink: #14251F;
  --fill-muted: #4E5A55;

  /* legacy tone aliases → solids (icons, borders, charts) */
  --tone-brand: var(--h-brand);
  --tone-gold: var(--h-gold);
  --tone-ok: var(--h-ok);
  --tone-warn: var(--h-warn);
  --tone-danger: var(--h-danger);
  --tone-info: var(--h-info);
  --tone-plum: var(--h-plum);
  --tone-moss: var(--h-moss);
  --tone-rose: var(--h-rose);
  --tone-indigo: var(--h-indigo);
  --tone-teal: var(--h-teal);
  --tone-ink: var(--h-ink);
  --tone-muted: var(--h-muted);

  --ch1: #0C5B52; --ch2: #B8860B; --ch3: #4A7A2C; --ch4: #1F6FEB; --ch5: #7C4DBE; --ch6: #C4392B;
  --ch7: #0E7C7B; --ch8: #B93A6B;

  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(16,38,33,.05), 0 8px 24px -12px rgba(16,38,33,.16);
  --shadow-lg: 0 24px 64px -16px rgba(10,30,25,.35);
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;

  --sidebar-w: 248px;
  --topbar-h: 62px;
  --pat: url("data:image/svg+xml,%3Csvg width='84' height='84' viewBox='0 0 84 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07'%3E%3Ccircle cx='42' cy='42' r='34'/%3E%3Ccircle cx='42' cy='42' r='22'/%3E%3Ccircle cx='42' cy='42' r='10'/%3E%3Cpath d='M0 0h84M0 84h84' /%3E%3C/g%3E%3C/svg%3E");
  --pat-ink: url("data:image/svg+xml,%3Csvg width='84' height='84' viewBox='0 0 84 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%230C5B52' stroke-opacity='.05'%3E%3Ccircle cx='42' cy='42' r='34'/%3E%3Ccircle cx='42' cy='42' r='22'/%3E%3Ccircle cx='42' cy='42' r='10'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="dark"] {
  --bg: #0E1A16;
  --surface: #16241F;
  --surface-2: #1A2B25;
  --ink: #E9EFEA;
  --ink-2: #B7C6BF;
  --muted: #94A39C;
  --line: #24382F;
  --line-2: #1D2F28;
  --brand: #3FB3A2;            /* readable teal on dark surfaces (tabs, links, buttons) */
  --brand-soft: #12332E;
  --accent-soft: #33290F;

  /* dark hue system — solids lift, tints darken, inks stay legible (all ≥4.5:1) */
  --h-brand: #3FB3A2;  --h-brand-t: #12332E;  --h-brand-i: #7FD3C4;
  --h-gold:  #E0BC62;  --h-gold-t:  #33290F;  --h-gold-i:  #E9CE86;
  --h-ok:    #5BBF86;  --h-ok-t:    #12321F;  --h-ok-i:    #8AD8A9;
  --h-moss:  #9CC97A;  --h-moss-t:  #1D2C14;  --h-moss-i:  #B6D89C;
  --h-warn:  #E2B15C;  --h-warn-t:  #332512;  --h-warn-i:  #EAC684;
  --h-danger:#EE8B7F;  --h-danger-t:#33191A;  --h-danger-i:#F2A69C;
  --h-info:  #8FAFF5;  --h-info-t:  #161F33;  --h-info-i:  #AFC6F8;
  --h-plum:  #C4A5EE;  --h-plum-t:  #231933;  --h-plum-i:  #D3BCF2;
  --h-rose:  #EE8FB4;  --h-rose-t:  #331924;  --h-rose-i:  #F2ABC7;
  --h-indigo:#98A5EA;  --h-indigo-t:#1A1E33;  --h-indigo-i:#B4BDF0;
  --h-teal:  #5FC7C5;  --h-teal-t:  #0F2E2E;  --h-teal-i:  #8ADAD8;
  --h-ink:   #E9EFEA;  --h-ink-t:   #26332E;  --h-ink-i:   #E9EFEA;
  --h-muted: #94A39C;  --h-muted-t: #1E2724;  --h-muted-i: #B0BCB6;

  --ch1: #3FB3A2; --ch2: #E0BC62; --ch3: #9CC97A; --ch4: #8FAFF5; --ch5: #C4A5EE; --ch6: #EE8B7F;
  --ch7: #5FC7C5; --ch8: #EE8FB4;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.5);
  --pat-ink: url("data:image/svg+xml,%3Csvg width='84' height='84' viewBox='0 0 84 84' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.04'%3E%3Ccircle cx='42' cy='42' r='34'/%3E%3Ccircle cx='42' cy='42' r='22'/%3E%3Ccircle cx='42' cy='42' r='10'/%3E%3C/g%3E%3C/svg%3E");
}
[data-density="compact"] { --radius: 10px; }
[data-density="compact"] .card-body { padding: 12px 14px; }
[data-density="compact"] .tbl td { padding: 6px 10px; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 13.5px;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: rgba(201,155,46,.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: var(--brand); text-decoration: none; }
b, strong { font-weight: 650; }
.num, .kpi-value, .tbl td.r, .statrow b { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(122,138,131,.35); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ================================================================ SPLASH == */
#cp-splash {
  position: fixed; inset: 0; z-index: 200;
  /* Opaque backing under the gradient, set to the ramp's LIGHTEST stop: without
     it a gradient-only panel has background-color:transparent, so translucent
     white text composites against the light page canvas and scores as if it
     were opaque white. The lightest stop is the worst case for a light ink. */
  background-color: var(--brand);
  background-image: radial-gradient(1200px 700px at 20% 10%, #0C5B52 0%, var(--brand-deep) 55%, #052722 100%);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: #fff; transition: opacity .6s ease, visibility .6s;
}
#cp-splash::before { content: ''; position: absolute; inset: 0; background: var(--pat); opacity: .9; }
#cp-splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-mark { position: relative; width: 110px; height: 110px; margin-bottom: 26px; }
.splash-mark svg { width: 100%; height: 100%; }
.splash-mark .ring { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 1.6s .2s ease forwards; }
.splash-mark .ring2 { stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw 1.4s .7s ease forwards; }
.splash-mark .naira { opacity: 0; animation: fadeup 0.8s 1.3s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.splash-word { position: relative; font-family: var(--font-display); font-size: 44px; font-weight: 600; letter-spacing: .5px; opacity: 0; animation: fadeup .8s 1.5s ease forwards; }
.splash-word .plus { color: var(--accent-on-deep); }   /* was --accent #C99B2E: 2.34 on the radial's inner stop */
.splash-tag { position: relative; margin-top: 10px; font-size: 13px; letter-spacing: 3.5px; text-transform: uppercase; color: rgba(255,255,255,.75); opacity: 0; animation: fadeup .8s 1.8s ease forwards; }
.splash-bar { position: relative; width: 240px; height: 3px; background: rgba(255,255,255,.18); border-radius: 3px; margin-top: 38px; overflow: hidden; opacity: 0; animation: fadeup .5s 2s ease forwards; }
.splash-bar i { position: absolute; inset: 0; width: 0; background: var(--accent); border-radius: 3px; transition: width .5s ease; }
.splash-sub { position: relative; margin-top: 14px; font-size: 12px; color: rgba(255,255,255,.7); min-height: 16px; opacity: 0; animation: fadeup .5s 2.1s ease forwards; }   /* .6 -> .7: was 3.98 on the ramp's lightest stop */
.splash-foot { position: absolute; bottom: 26px; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: rgba(255,255,255,.7); }   /* .45 -> .7: was 2.92 */

/* ================================================================= LOGIN == */
#cp-login { position: fixed; inset: 0; z-index: 150; display: none; grid-template-columns: minmax(380px, 44%) 1fr; background: var(--bg); }
#cp-login.show { display: grid; }
.login-left {
  position: relative; overflow: hidden; color: #fff; padding: 48px 52px;
  /* inner stop deepened #11705f -> --brand #0C5B52 so the gold hero text clears
     AA (gold on #11705f measured 2.34); opaque backing added, see #cp-splash. */
  background-color: var(--brand);
  background-image: radial-gradient(900px 600px at 15% 8%, #0C5B52 0%, var(--brand-deep) 60%, #052722 100%);
  display: flex; flex-direction: column;
}
.login-left::before { content: ''; position: absolute; inset: 0; background: var(--pat); }
.login-brandrow { position: relative; display: flex; align-items: center; gap: 12px; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), #E0BC62); color: #17301F; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 21px; box-shadow: 0 6px 18px -6px rgba(0,0,0,.5); }
.login-brandrow .w { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.login-brandrow .w .plus { color: var(--accent-on-deep); }   /* was --accent: 2.34 */
.login-brandrow .by { font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,.7); display: block; margin-top: 2px; }   /* .6 -> .7: was 3.98 */
.login-hero { position: relative; margin-top: 9vh; }
.login-hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; }
.login-hero h1 em { color: var(--accent-on-deep); font-style: normal; }   /* was --accent: 2.34 */
.login-hero p { margin-top: 16px; max-width: 46ch; color: rgba(255,255,255,.78); font-size: 14px; line-height: 1.65; }
.login-points { position: relative; margin-top: 34px; display: grid; gap: 13px; }
.login-points div { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: rgba(255,255,255,.85); }
.login-points .ic { color: var(--accent-on-deep); flex: none; margin-top: 1px; }   /* match the hero gold */
.login-stats { position: relative; margin-top: auto; display: flex; gap: 30px; padding-top: 30px; border-top: 1px solid rgba(255,255,255,.14); }
.login-stats b { display: block; font-family: var(--font-display); font-size: 22px; color: #fff; }
.login-stats span { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: rgba(255,255,255,.7); }   /* .55 -> .7: was 3.60 */
.login-right { overflow-y: auto; padding: 36px 48px 28px; background: var(--bg); background-image: var(--pat-ink); }
.login-right h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.login-right .sub { color: var(--ink-2); margin-top: 6px; font-size: 13px; }
.portal-group { margin-top: 18px; }
.portal-group-t { font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.portal-group-t::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.personas { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.persona {
  display: flex; gap: 11px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 11px 12px; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
  font: inherit; color: inherit; width: 100%; min-height: 84px;
}
.persona:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.persona .avatar { flex: none; }
.persona b { display: block; font-size: 13px; }
.persona span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.login-foot { margin-top: 34px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }

/* ================================================================== APP === */
#cp-app { position: fixed; inset: 0; display: none; }
#cp-app.show { display: block; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100%; }

/* ------------------------------------------------------------- sidebar --- */
.sidebar {
  /* opaque backing under the gradient. `background:` alone leaves
     background-color transparent, so .nav-do's translucent gold pill had no
     dark backdrop to composite against and its white label scored 1.17 against
     the page canvas. Over the real backing it is 8.80. */
  background-color: var(--brand-deep);
  background-image: linear-gradient(180deg, var(--brand-deep) 0%, #062A25 100%);
  color: #CFE0DA; display: flex; flex-direction: column; position: relative; z-index: 30;
}
.sidebar::before { content: ''; position: absolute; inset: 0; background: var(--pat); opacity: .5; pointer-events: none; }
.sb-brand { position: relative; display: flex; align-items: center; gap: 10px; padding: 15px 16px 13px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-brand .w { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: #fff; }
.sb-brand .w .plus { color: var(--accent); }
.sb-brand .org { font-size: 10.5px; color: rgba(255,255,255,.55); display: block; margin-top: 1px; letter-spacing: .4px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav { position: relative; flex: 1; overflow-y: auto; padding: 10px 10px 18px; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.nav-group { position: relative; }
.nav-sec { font-size: 10px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase; color: var(--navh, rgba(255,255,255,.62)); padding: 15px 8px 6px; display: flex; align-items: center; gap: 7px; }   /* fallback .5 -> .62 on --brand-deep: was 4.23 */
.nav-sec::before { content: ''; width: 12px; height: 3px; border-radius: 3px; background: var(--navh, rgba(255,255,255,.4)); flex: none; }
.nav-group .nav-item .ic { color: var(--navh, currentColor); opacity: .85; }
.nav-group .nav-item.on .ic { opacity: 1; }
.nav-group .nav-item.on { background: color-mix(in srgb, var(--navh) 16%, transparent); }
.nav-group .nav-item.on::before { background: var(--navh, var(--accent)); }
.nav-group .nav-item:hover { background: color-mix(in srgb, var(--navh) 10%, rgba(255,255,255,.05)); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 9px; cursor: pointer; border: none; background: none;
  color: #C4D6CF; font: inherit; font-size: 13px; font-weight: 500; text-align: left;
  transition: background .14s, color .14s; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav-item.on::before { content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item .ic { flex: none; opacity: .9; }
.nav-item .nav-n { margin-left: auto; background: var(--accent); color: var(--fill-ink); font-size: 10px; font-weight: 700; border-radius: 8px; padding: 1px 6px; }
.sb-foot { position: relative; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 10.5px; color: rgba(255,255,255,.62); display: flex; align-items: center; gap: 8px; }   /* .5 -> .62: was 4.23 */
.sb-foot .k { color: var(--accent); font-weight: 700; letter-spacing: .5px; }

/* -------------------------------------------------------------- topbar --- */
.main { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); z-index: 20;
}
.tb-title { min-width: 0; }
.tb-title h1 { font-family: var(--font-display); font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title .crumb { font-size: 11px; color: var(--muted); }
.tb-spacer { flex: 1; }
.tb-search {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 12px; width: 300px; color: var(--muted); cursor: pointer; transition: border-color .15s;
}
.tb-search:hover { border-color: var(--brand); }
.tb-search span { font-size: 12.5px; }
.tb-search kbd { margin-left: auto; font-family: inherit; font-size: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.clockchip {
  display: flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--brand);
  padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
}
.clockchip:hover { border-color: var(--brand); }
.clockchip .live { width: 7px; height: 7px; border-radius: 50%; background: var(--tone-ok); animation: blink 1.6s infinite; }
.clockchip.paused .live { background: var(--tone-warn); animation: none; }
@keyframes blink { 50% { opacity: .35; } }
.iconbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); cursor: pointer; transition: all .14s; flex: none;
}
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }
.iconbtn .bubble { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--fill-danger); color: var(--on-fill); font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.userchip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.userchip:hover { border-color: var(--brand); }
.userchip b { font-size: 12.5px; display: block; }
.userchip span { font-size: 10.5px; color: var(--muted); display: block; }

/* ------------------------------------------------------------- content --- */
.content { flex: 1; overflow-y: auto; padding: 22px 24px 60px; scroll-behavior: smooth; }
.content > .screen { max-width: 1460px; margin: 0 auto; animation: screenin .28s ease; }
@keyframes screenin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
/* the technical module name, demoted so the plain word leads */
.pagetag { display: block; font-family: var(--font-ui); font-size: 10.5px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.page-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 4px; max-width: 78ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================================================ ATOMS === */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--fill-brand), #10756A); border-color: transparent; color: var(--on-fill); box-shadow: 0 8px 20px -10px rgba(12,91,82,.7); }
.btn-primary:hover { color: var(--on-fill); filter: brightness(1.07); }
.btn-gold { background: linear-gradient(135deg, var(--accent), #DDB958); border-color: transparent; color: #2A2208; }
.btn-gold:hover { color: #2A2208; filter: brightness(1.05); }
.btn-danger { background: var(--fill-danger); border-color: transparent; color: var(--on-fill); }
.btn-danger:hover { color: var(--on-fill); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; }
.badge-ok { background: var(--h-ok-t); color: var(--h-ok-i); }
.badge-warn { background: var(--h-warn-t); color: var(--h-warn-i); }
.badge-danger { background: var(--h-danger-t); color: var(--h-danger-i); }
.badge-info { background: var(--h-info-t); color: var(--h-info-i); }
.badge-brand { background: var(--h-brand-t); color: var(--h-brand-i); }
.badge-gold { background: var(--h-gold-t); color: var(--h-gold-i); }
.badge-plum { background: var(--h-plum-t); color: var(--h-plum-i); }
.badge-moss { background: var(--h-moss-t); color: var(--h-moss-i); }
.badge-rose { background: var(--h-rose-t); color: var(--h-rose-i); }
.badge-indigo { background: var(--h-indigo-t); color: var(--h-indigo-i); }
.badge-teal { background: var(--h-teal-t); color: var(--h-teal-i); }
.badge-muted { background: var(--h-muted-t); color: var(--h-muted-i); border: 1px solid var(--line); }

.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.pill-info { color: var(--h-info-i); border-color: color-mix(in srgb, var(--h-info) 32%, var(--line)); background: var(--h-info-t); }
.pill-ok { color: var(--h-ok-i); border-color: color-mix(in srgb, var(--h-ok) 32%, var(--line)); background: var(--h-ok-t); }
.pill-warn { color: var(--h-warn-i); border-color: color-mix(in srgb, var(--h-warn) 32%, var(--line)); background: var(--h-warn-t); }
.pill-brand { color: var(--h-brand-i); border-color: color-mix(in srgb, var(--h-brand) 32%, var(--line)); background: var(--h-brand-t); }

/* Doubled class (0,2,0) so the initials outrank any ancestor `.x span` (0,1,1)
   rule. The disc behind them is a fixed dark fill, so the label must stay white. */
.avatar, .avatar.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--av, var(--fill-brand)); color: var(--on-fill); font-size: 12px; font-weight: 700; letter-spacing: .5px; flex: none;
}
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }
.avatar-sm { width: 26px; height: 26px; font-size: 9.5px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.prog { height: 7px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.prog-bar { height: 100%; border-radius: 6px; transition: width .5s ease; }
.hr { border: none; height: 1px; background: var(--line); margin: 14px 0; }
.delta { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.delta.up { color: var(--h-ok-i); background: var(--h-ok-t); }
.delta.down { color: var(--h-danger-i); background: var(--h-danger-t); }
.t-ok { color: var(--h-ok-i); } .t-warn { color: var(--h-warn-i); } .t-danger { color: var(--h-danger-i); }
.t-info { color: var(--h-info-i); } .t-brand { color: var(--h-brand-i); } .t-gold { color: var(--h-gold-i); } .t-muted { color: var(--muted); }

/* tone-* = a soft tinted chip with its own AA-safe ink. Used for icon squares. */
.tone-brand { color: var(--h-brand-i); background: var(--h-brand-t); }
.tone-gold { color: var(--h-gold-i); background: var(--h-gold-t); }
.tone-ok { color: var(--h-ok-i); background: var(--h-ok-t); }
.tone-warn { color: var(--h-warn-i); background: var(--h-warn-t); }
.tone-danger { color: var(--h-danger-i); background: var(--h-danger-t); }
.tone-info { color: var(--h-info-i); background: var(--h-info-t); }
.tone-plum { color: var(--h-plum-i); background: var(--h-plum-t); }
.tone-moss { color: var(--h-moss-i); background: var(--h-moss-t); }
.tone-rose { color: var(--h-rose-i); background: var(--h-rose-t); }
.tone-indigo { color: var(--h-indigo-i); background: var(--h-indigo-t); }
.tone-teal { color: var(--h-teal-i); background: var(--h-teal-t); }
.tone-ink { color: var(--surface); background: var(--ink); }
.tone-muted { color: var(--h-muted-i); background: var(--h-muted-t); }

/* ================================================================ CARDS === */
.grid { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.card-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.card-body { padding: 15px 16px; }
.card-body.flush { padding: 0; }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
/* ---- per-metric tint: the card is colour-coded by what it measures ---- */
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kpi-hue, var(--brand)); }
.kpi.k-brand  { --kpi-hue: var(--h-brand);  background: linear-gradient(150deg, var(--h-brand-t) 0%, var(--surface) 62%); }
.kpi.k-gold   { --kpi-hue: var(--h-gold);   background: linear-gradient(150deg, var(--h-gold-t) 0%, var(--surface) 62%); }
.kpi.k-ok     { --kpi-hue: var(--h-ok);     background: linear-gradient(150deg, var(--h-ok-t) 0%, var(--surface) 62%); }
.kpi.k-moss   { --kpi-hue: var(--h-moss);   background: linear-gradient(150deg, var(--h-moss-t) 0%, var(--surface) 62%); }
.kpi.k-warn   { --kpi-hue: var(--h-warn);   background: linear-gradient(150deg, var(--h-warn-t) 0%, var(--surface) 62%); }
.kpi.k-danger { --kpi-hue: var(--h-danger); background: linear-gradient(150deg, var(--h-danger-t) 0%, var(--surface) 62%); }
.kpi.k-info   { --kpi-hue: var(--h-info);   background: linear-gradient(150deg, var(--h-info-t) 0%, var(--surface) 62%); }
.kpi.k-plum   { --kpi-hue: var(--h-plum);   background: linear-gradient(150deg, var(--h-plum-t) 0%, var(--surface) 62%); }
.kpi.k-rose   { --kpi-hue: var(--h-rose);   background: linear-gradient(150deg, var(--h-rose-t) 0%, var(--surface) 62%); }
.kpi.k-indigo { --kpi-hue: var(--h-indigo); background: linear-gradient(150deg, var(--h-indigo-t) 0%, var(--surface) 62%); }
.kpi.k-teal   { --kpi-hue: var(--h-teal);   background: linear-gradient(150deg, var(--h-teal-t) 0%, var(--surface) 62%); }
.kpi.k-muted  { --kpi-hue: var(--h-muted);  background: linear-gradient(150deg, var(--h-muted-t) 0%, var(--surface) 62%); }
.kpi-click { cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.kpi-click:hover { transform: translateY(-2px); border-color: var(--kpi-hue, var(--brand)); box-shadow: 0 12px 26px -14px var(--kpi-hue, var(--brand)); }
.kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.kpi-ic { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: .3px; color: var(--ink-2); text-transform: uppercase; }
.kpi-value { font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: .2px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 18px; flex-wrap: wrap; }
.kpi-sub { font-size: 11.5px; color: var(--muted); }
.kpi-spark { position: absolute; right: 10px; bottom: 8px; width: 96px; opacity: .9; }

.statrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 12.5px; }
.statrow:last-child { border-bottom: none; }
.statrow span { color: var(--ink-2); }
.statrow.strong { font-weight: 700; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ic { opacity: .5; }
.empty-t { font-weight: 700; color: var(--ink-2); margin-top: 10px; font-size: 13.5px; }
.empty-s { font-size: 12px; margin-top: 4px; }

/* ================================================================= TABS === */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; margin-bottom: 16px; width: fit-content; max-width: 100%; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9px; border: none; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .14s; }
.tab:hover { color: var(--brand); }
.tab.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(16,38,33,.12); }
.tab-n { background: var(--brand-soft); color: var(--brand); border-radius: 8px; font-size: 10px; padding: 1px 6px; font-weight: 700; }
.tab.on .tab-n { background: var(--fill-brand); color: var(--on-fill); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-b { border: none; background: none; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-2); padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.seg-b.on { background: var(--fill-brand); color: var(--on-fill); }

/* ================================================================ TABLE === */
.tablewrap { min-width: 0; }
.tbl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tbl-search { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; color: var(--muted); flex: 0 1 280px; }
.tbl-search input { border: none; outline: none; background: none; font: inherit; font-size: 12.5px; color: var(--ink); width: 100%; }
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--brand); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.rowlink { cursor: pointer; transition: background .12s; }
.tbl tbody tr.rowlink:hover { background: var(--brand-soft); }
.tbl.dense td { padding: 6px 10px; font-size: 12px; }
.tbl-pager { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; font-size: 11.5px; color: var(--muted); }
.tbl-pager > div { display: flex; align-items: center; gap: 8px; }
.pager-n { font-weight: 600; color: var(--ink-2); }
.cellmain { font-weight: 600; }
.cellsub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.cellwho { display: flex; align-items: center; gap: 9px; }

/* ================================================================ FORMS === */
.field { display: block; margin-bottom: 13px; }
.field-l { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .4px; color: var(--ink-2); margin-bottom: 5px; text-transform: uppercase; }
.field-hint { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.in {
  width: 100%; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,91,82,.13); }
textarea.in { resize: vertical; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.checkline { display: flex; gap: 9px; align-items: center; font-size: 13px; padding: 6px 0; cursor: pointer; }
.checkline input { accent-color: var(--brand); width: 15px; height: 15px; }

/* ================================================================ MODAL === */
#cp-modal, #cp-drawer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
#cp-modal.open, #cp-drawer.open { pointer-events: auto; }
.overlay { position: absolute; inset: 0; background: rgba(8,25,21,.55); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.overlay.in { opacity: 1; }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -47%);
  width: min(560px, calc(100vw - 40px)); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  animation: modalin .22s ease;
}
@keyframes modalin { from { opacity: 0; transform: translate(-50%, -44%) scale(.98); } to { opacity: 1; transform: translate(-50%, -47%) scale(1); } }
.modal-wide { width: min(880px, calc(100vw - 40px)); }
.modal-tall { height: 86vh; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 13px; border-bottom: 1px solid var(--line-2); }
.modal-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.modal-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.confirm-msg { font-size: 13.5px; line-height: 1.6; }

.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 94vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: drawerin .24s ease;
}
@keyframes drawerin { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-wide { width: min(660px, 96vw); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 13px; border-bottom: 1px solid var(--line-2); }
.drawer-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.drawer-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); }

/* ================================================================ TOAST === */
#cp-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 130; display: flex; flex-direction: column; gap: 9px; max-width: 360px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; background: var(--ink); color: #F2F6F3;
  border-radius: 12px; padding: 11px 14px; font-size: 12.5px; box-shadow: var(--shadow-lg);
  transform: translateX(24px); opacity: 0; transition: all .3s ease; border-left: 3px solid var(--tone-info);
}
[data-theme="dark"] .toast { background: #223A31; }
.toast.in { transform: none; opacity: 1; }
.toast-ok { border-left-color: var(--tone-ok); } .toast-warn { border-left-color: var(--tone-warn); } .toast-danger { border-left-color: var(--tone-danger); }
.toast-ic { flex: none; margin-top: 1px; opacity: .9; }

/* =============================================================== PANELS === */
.panel {
  position: fixed; top: calc(var(--topbar-h) + 8px); right: 14px; width: 380px; max-height: calc(100vh - var(--topbar-h) - 26px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; z-index: 90; overflow: hidden; animation: modalin .18s ease;
}
.panel.open { display: flex; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line-2); font-weight: 700; font-size: 13.5px; }
.panel-body { overflow-y: auto; }
.notif { display: flex; gap: 11px; padding: 11px 15px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .12s; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--brand-soft); }
.notif.unread:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--surface)); }
.notif-ic { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.notif-t { font-weight: 650; font-size: 12.5px; }
.notif-b { font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.notif-time { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* AI drawer */
.ai-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: none; flex-direction: column; z-index: 95; }
.ai-drawer.open { display: flex; animation: drawerin .22s ease; }
.ai-head { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; background-color: var(--fill-brand); background-image: linear-gradient(135deg, var(--brand-deep), var(--fill-brand)); color: var(--on-fill); }
.ai-head .logo-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
.ai-head b { font-size: 14px; display: block; }
.ai-head span { font-size: 11px; opacity: .75; display: block; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; }
.msg.me { align-self: flex-end; }
.msg-who { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.msg-b { background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px 13px 13px 4px; padding: 9px 12px; font-size: 12.5px; line-height: 1.55; }
.msg.me .msg-b { background: var(--fill-brand); border-color: transparent; color: var(--on-fill); border-radius: 13px 13px 4px 13px; }
.msg-t { font-size: 10px; color: var(--muted); margin-top: 3px; }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.ai-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.chip { font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer; color: var(--ink-2); transition: all .13s; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.ai-foot { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line-2); }
.ai-foot .in { flex: 1; }
.ai-typing { display: inline-flex; gap: 4px; padding: 10px 14px; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 1.1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .18s; } .ai-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* command palette */
.cmdk { position: fixed; inset: 0; z-index: 120; display: none; }
.cmdk.open { display: block; }
.cmdk-box { position: absolute; left: 50%; top: 14vh; transform: translateX(-50%); width: min(600px, calc(100vw - 40px)); background: var(--surface); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; animation: modalin .16s ease; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); color: var(--muted); }
.cmdk-in input { flex: 1; border: none; outline: none; background: none; font: inherit; font-size: 14.5px; color: var(--ink); }
.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 7px; }
.cmdk-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.cmdk-item:hover, .cmdk-item.sel { background: var(--brand-soft); color: var(--brand); }
.cmdk-item .k { margin-left: auto; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ================================================================ CHART === */
.chart svg { display: block; }
.chgrid, line.chgrid { stroke: var(--line-2); stroke-width: 1; }
.axis { font-size: 9.5px; fill: var(--muted); font-family: var(--font-ui); }
.ch-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); margin-bottom: 6px; }
.ch-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.donutwrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-c { font-family: var(--font-display); font-size: 19px; font-weight: 600; fill: var(--ink); }
.donut-s { font-size: 9.5px; fill: var(--muted); }
.donut-legend { display: grid; gap: 7px; font-size: 12px; min-width: 150px; flex: 1; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.spark { display: block; width: 100%; }

/* ============================================================== TIMELINE == */
.tl { position: relative; padding-left: 4px; }
.tl-item { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; z-index: 1; }
.tl-t { font-size: 12.5px; font-weight: 600; }
.tl-s { font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.tl-time { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

.feed { display: flex; flex-direction: column; }
.feed-i { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line-2); align-items: flex-start; }
.feed-i:last-child { border-bottom: none; }
.feed-i.rowlink { cursor: pointer; }
.feed-i.rowlink:hover { background: var(--surface-2); }
.feed-ic { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.feed-b { font-size: 12.5px; line-height: 1.45; }
.feed-t { font-size: 10.5px; color: var(--muted); }

/* ================================================================ KANBAN == */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(clamp(190px, 18vw, 240px), 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kan-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 10px; min-width: 0; }
.kan-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-2); padding: 2px 4px 10px; }
.kan-n { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font-size: 10.5px; }
.kan-cards { display: flex; flex-direction: column; gap: 8px; min-height: 30px; }
.kan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; font-size: 12.5px; box-shadow: 0 1px 3px rgba(16,38,33,.06); position: relative; }
.kan-card .kan-move { display: none; gap: 4px; margin-top: 9px; flex-wrap: wrap; }
.kan-card:hover .kan-move { display: flex; }
.kan-mv { font-size: 10px; font-weight: 700; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 6px; padding: 2px 7px; cursor: pointer; }
.kan-mv:hover { border-color: var(--brand); color: var(--brand); }
.kan-empty { text-align: center; color: var(--muted); font-size: 11px; padding: 10px; }

/* =============================================================== ORG ===== */
.orgchart { overflow-x: auto; padding: 10px 4px 18px; }
.org-node-wrap { display: flex; flex-direction: column; align-items: center; position: relative; }
.org-node { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; box-shadow: var(--shadow); white-space: nowrap; }
.org-node.root { border-color: var(--brand); background: var(--brand-soft); }
.org-name { font-size: 12.5px; font-weight: 700; }
.org-role { font-size: 11px; color: var(--muted); }
.org-kids { display: flex; gap: 18px; margin-top: 26px; position: relative; align-items: flex-start; }
.org-kids::before { content: ''; position: absolute; top: -26px; left: 50%; width: 2px; height: 13px; background: var(--line); }
.org-kids > .org-node-wrap::before { content: ''; position: absolute; top: -13px; left: 50%; width: 2px; height: 13px; background: var(--line); }
.org-kids > .org-node-wrap:not(:only-child)::after { content: ''; position: absolute; top: -13px; height: 2px; background: var(--line); left: 0; right: 0; }
.org-kids > .org-node-wrap:first-child:not(:only-child)::after { left: 50%; }
.org-kids > .org-node-wrap:last-child:not(:only-child)::after { right: 50%; }

/* ============================================================== CALENDAR == */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 0 2px 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 76px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 5px 6px; font-size: 11px; }
.cal-cell.off { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-d { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.cal-cell.today .cal-d { color: var(--brand); }
.cal-ev { margin-top: 3px; border-radius: 5px; padding: 2px 6px; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-more { font-size: 9.5px; color: var(--muted); margin-top: 2px; }

/* ================================================================ WIZARD == */
.wiz-steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.wiz-step { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.wiz-step i { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 9.5px; font-style: normal; }
.wiz-step.on { color: var(--brand); }
.wiz-step.on i { background: var(--brand); border-color: var(--brand); color: #fff; }
.wiz-step.done { color: var(--h-ok-i); }
.wiz-step.done i { background: var(--h-ok-t); border-color: color-mix(in srgb, var(--h-ok) 34%, var(--line)); color: var(--h-ok-i); }
.wiz-line { flex: none; width: 18px; height: 1px; background: var(--line); }

/* ================================================================ PHONE === */
.phone {
  width: 320px; height: 660px; background: #060D0B; border-radius: 42px; padding: 10px;
  box-shadow: 0 30px 70px -22px rgba(8,25,21,.6), inset 0 0 0 2px #23332D; position: relative; flex: none;
}
.phone-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 96px; height: 22px; background: #060D0B; border-radius: 12px; z-index: 5; }
.phone-status { position: absolute; top: 16px; left: 26px; right: 26px; display: flex; justify-content: space-between; font-size: 10.5px; color: #fff; z-index: 4; font-weight: 600; }
.phone-screen { width: 100%; height: 100%; border-radius: 34px; overflow: hidden; background: var(--bg); position: relative; display: flex; flex-direction: column; }
.phone-homebar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); width: 110px; height: 4px; border-radius: 3px; background: rgba(255,255,255,.7); z-index: 5; }

/* Mobile app internals (member/agent/exec apps).
   This is a picture of a phone, not part of the desktop chrome — a screenshot of
   a handset doesn't invert because the operator dimmed their monitor. So the mock
   re-declares the light palette locally; descendants using var(--brand)/var(--ink-2)
   resolve against these, not against the dark [data-theme] root. */
.mapp {
  --brand: #0C5B52; --brand-deep: #083D37; --brand-soft: #E2F0EC;
  --accent: #C99B2E; --accent-soft: #FBF0D8;
  --bg: #F6F4EE; --surface: #FFFFFF; --surface-2: #FAF9F5;
  --ink: #14251F; --ink-2: #3E514A; --muted: #5E6E67;
  --line: #E5E2D8; --line-2: #F0EDE4;
  --h-brand: #0C5B52; --h-brand-t: #E2F0EC; --h-brand-i: #08453E;
  --h-gold:  #B8860B; --h-gold-t:  #FBF0D8; --h-gold-i:  #7A5A08;
  --h-ok:    #1F8A4C; --h-ok-t:    #E4F4E9; --h-ok-i:    #146236;
  --h-moss:  #4A7A2C; --h-moss-t:  #EBF3E2; --h-moss-i:  #33561D;
  --h-warn:  #B5650A; --h-warn-t:  #FBEEDC; --h-warn-i:  #7C4406;
  --h-danger:#C4392B; --h-danger-t:#FBE7E4; --h-danger-i:#8C2418;
  --h-info:  #1F6FEB; --h-info-t:  #E6EFFD; --h-info-i:  #12459B;
  --h-plum:  #7C4DBE; --h-plum-t:  #F1E9FB; --h-plum-i:  #54308A;
  --h-rose:  #B93A6B; --h-rose-t:  #FBE7EF; --h-rose-i:  #85224A;
  --h-indigo:#3C4CA8; --h-indigo-t:#E9EBF8; --h-indigo-i:#293677;
  --h-teal:  #0E7C7B; --h-teal-t:  #E0F2F1; --h-teal-i:  #0A5655;
  --h-ink:   #14251F; --h-ink-t:   #E9ECEA; --h-ink-i:   #14251F;
  --h-muted: #6B7A73; --h-muted-t: #F0F1EE; --h-muted-i: #4E5A55;
  --tone-brand: #0C5B52; --tone-gold: #B8860B; --tone-ok: #1F8A4C; --tone-moss: #4A7A2C;
  --tone-warn: #B5650A; --tone-danger: #C4392B; --tone-info: #1F6FEB; --tone-plum: #7C4DBE;
  --tone-rose: #B93A6B; --tone-indigo: #3C4CA8; --tone-teal: #0E7C7B; --tone-muted: #6B7A73;
  display: flex; flex-direction: column; height: 100%; background: var(--bg); color: var(--ink); font-size: 13px;
}
.mapp-head { background-color: var(--brand); background-image: linear-gradient(135deg, var(--brand-deep), var(--brand)); color: #fff; padding: 42px 18px 16px; position: relative; overflow: hidden; flex: none; }
.mapp-head::before { content: ''; position: absolute; inset: 0; background: var(--pat); }
.mapp-body { flex: 1; overflow-y: auto; padding: 14px 14px 84px; }
.mapp-nav { position: absolute; bottom: 0; left: 0; right: 0; display: flex; background: #fff; border-top: 1px solid #E4E1D5; padding: 8px 6px 20px; z-index: 3; }
.mapp-nav button { flex: 1; border: none; background: none; font: inherit; font-size: 9.5px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.mapp-nav button.on { color: var(--brand); }
.mcard { background: #fff; border: 1px solid #E7E4D9; border-radius: 15px; padding: 13px 14px; margin-bottom: 11px; box-shadow: 0 1px 3px rgba(16,38,33,.05); }
.mrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #EFECE1; font-size: 12.5px; }
.mrow:last-child { border: none; }
.mact { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mact button { border: none; background: #fff; border: 1px solid #E7E4D9; border-radius: 13px; padding: 10px 4px; font: inherit; font-size: 10px; font-weight: 600; color: #43564F; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: all .14s; }
.mact button:hover { border-color: var(--brand); color: var(--brand); }
.mact .ic { color: var(--brand); }

/* ============================================================== SPECIALS == */
.hero-strip {
  border-radius: var(--radius); padding: 18px 20px; color: #fff; position: relative; overflow: hidden;
  background-color: #11705F;   /* backing = the ramp's lightest stop, see #cp-splash */
  background-image: linear-gradient(120deg, var(--brand-deep) 0%, var(--fill-brand) 62%, #11705F 100%);
  box-shadow: var(--shadow);
}
.hero-strip::before { content: ''; position: absolute; inset: 0; background: var(--pat); }
.hero-strip h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; position: relative; }
.hero-strip p { position: relative; font-size: 12.5px; opacity: .85; margin-top: 5px; max-width: 90ch; line-height: 1.55; }
.hero-strip .btn { position: relative; }
.identity-proof { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.identity-node { flex: 1 1 84px; min-width: 84px; text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; }
.identity-node b { font-family: var(--font-display); font-size: clamp(13px, 1.05vw, 16px); display: block; white-space: nowrap; }
.identity-node span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.identity-eq { font-size: 20px; font-weight: 700; color: var(--h-ok-i); }
.identity-eq.bad { color: var(--h-danger-i); }

.rail-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .6px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); text-transform: uppercase; }

/* plain-language glossary term — dotted underline, explains itself on click */
.term { border-bottom: 1.5px dotted var(--accent); cursor: help; }
.term::after { content: '?'; font-size: .72em; vertical-align: super; color: var(--accent); font-weight: 700; margin-left: 1px; }

/* plain-language task launcher */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.task-tile { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; cursor: pointer; transition: transform .14s, border-color .14s, box-shadow .14s; font: inherit; color: inherit; }
.task-tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); }
.task-ic { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.task-tile b { display: block; font-size: 13px; }
.task-tile span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
#tl-q { border: none; outline: none; background: none; font: inherit; font-size: 13.5px; color: var(--ink); width: 100%; }
/* loan "what happens next" guidance banner */
.nextstep { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.nextstep .ns-ic { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.nextstep.tone-warn .ns-ic { background: var(--h-warn-t); color: var(--h-warn-i); } .nextstep.tone-info .ns-ic { background: var(--h-info-t); color: var(--h-info-i); }
.nextstep.tone-ok .ns-ic { background: var(--h-ok-t); color: var(--h-ok-i); } .nextstep.tone-danger .ns-ic { background: var(--h-danger-t); color: var(--h-danger-i); }
.nextstep.tone-brand .ns-ic { background: var(--brand-soft); color: var(--brand); } .nextstep.tone-muted .ns-ic { background: var(--surface-2); color: var(--muted); }
.nextstep .ns-body { flex: 1; min-width: 0; }
.nextstep .ns-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.nextstep .ns-text { font-size: 13px; color: var(--ink); margin-top: 2px; line-height: 1.5; }
[data-theme="dark"] .nextstep .ns-ic { background: var(--surface-2); }

.nav-item.nav-do { background: linear-gradient(135deg, rgba(201,155,46,.22), rgba(201,155,46,.08)); color: #fff; font-weight: 700; margin-bottom: 8px; border: 1px solid rgba(201,155,46,.4); }
.nav-item.nav-do:hover { background: linear-gradient(135deg, rgba(201,155,46,.34), rgba(201,155,46,.14)); }
#cp-dobtn span { font-size: 12.5px; }
@media (max-width: 980px) { #cp-dobtn span { display: none; } }

.score-ring { position: relative; width: 118px; height: 118px; }
.score-ring svg { transform: rotate(-90deg); }
.score-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num b { font-family: var(--font-display); font-size: 26px; }
.score-num span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.searchhit { display: flex; align-items: center; gap: 10px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--line-2) 25%, var(--surface-2) 50%, var(--line-2) 75%); background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: 8px; }
@keyframes skel { to { background-position: -200% 0; } }

/* print */
@media print { .sidebar, .topbar, #cp-toasts, .panel, .ai-drawer { display: none !important; } .content { overflow: visible; } }

/* responsive */
@media (max-width: 1180px) {
  :root { --sidebar-w: 210px; }
  .tb-search { width: 200px; }
}
@media (max-width: 980px) {
  #cp-login { grid-template-columns: 1fr; }
  .login-left { display: none; }
  :root { --sidebar-w: 62px; }
  .sb-brand .w, .sb-brand .org, .nav-item span, .nav-sec, .sb-foot { display: none; }
  .nav-item { justify-content: center; }
  .nav-item .nav-n { position: absolute; top: 2px; right: 2px; }
  .tb-search span, .tb-search kbd { display: none; }
  .userchip div { display: none; }
}
