/* ==========================================================================
   AgriVest — Institutional Terminal. Three-column shell (nav / main / live
   ledger), deep-space palette, emerald primary, mono numerals. CSP-strict:
   local fonts, no CDNs, charts are hand-rolled SVG.
   ========================================================================== */

:root {
  /* Institutional RWA terminal: deep-slate void, obsidian surfaces, razor
     borders, Institutional Emerald. Sharp edges signal precision. */
  --bg-main: #030712;
  --bg-surface: #0A101E;
  --bg-surface-hover: #111827;
  --border-color: #1F2937;
  --border-strong: #374151;

  --primary: #10B981;
  --primary-hover: #059669;
  --primary-ink: #021710;
  --primary-glow: rgba(16, 185, 129, 0.15);
  --primary-dim: rgba(16, 185, 129, 0.1);

  --accent-blue: #3B82F6;
  --accent-orange: #F5A623;
  --accent-purple: #8B5CF6;
  --accent-red: #EF4444;

  --ok-bg: rgba(0, 230, 118, 0.1);
  --warn-bg: rgba(245, 166, 35, 0.12);
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info-bg: rgba(59, 130, 246, 0.12);

  --text-main: #FFFFFF;
  --text-muted: #888888;
  --text-dim: #5A5A5A;

  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "JetBrains Mono", monospace;
  --radius-md: 4px;
  --radius-lg: 6px;
}

/* Dual-pane admin architecture: the outer shell (nav sidebar + syslog rail)
   stays pitch-black to frame the app; ONLY the admin workspace pane flips to
   an ultra-crisp enterprise light mode (Stripe-Treasury style). Token
   variables are re-scoped on <main>, so every component reskins itself. */
body.admin-light main {
  --bg-main: #F3F4F6;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F9FAFB;
  --border-color: #E5E7EB;
  --border-strong: #D1D5DB;

  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-ink: #FFFFFF;
  --primary-glow: rgba(37, 99, 235, 0.15);
  --primary-dim: rgba(37, 99, 235, 0.07);

  --accent-red: #DC2626;
  --ok-bg: #ECFDF5;
  --warn-bg: #FFFBEB;
  --danger-bg: #FEF2F2;
  --info-bg: #EFF6FF;

  --text-main: #111827;
  --text-muted: #6B7280;
  --text-dim: #9CA3AF;
}
body.admin-light main .badge { color: #065F46; }
body.admin-light main .badge.status-funded, body.admin-light main .badge.status-active { color: #92400E; }
body.admin-light main .badge.status-completed { color: #1D4ED8; }
body.admin-light main .badge.status-pending { color: #6B7280; }
body.admin-light main .badge.status-rejected, body.admin-light main .badge.status-cancelled,
body.admin-light main .badge.status-defaulted { color: #991B1B; }
body.admin-light main .amount-pos { color: #059669; }
body.admin-light main .stat-card .sub { color: #059669; }
body.admin-light main th { background: #F9FAFB; }
body.admin-light main tbody tr:hover td { background: #F3F4F6; }
body.admin-light main .panel, body.admin-light main .card, body.admin-light main .stat-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

h1, h2, h3 { letter-spacing: -0.3px; line-height: 1.25; color: var(--text-main); }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 0.95rem; font-weight: 700; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------------------
   Shell: left nav / main / right ledger feed
   -------------------------------------------------------------------------- */
aside.sidebar {
  width: 240px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  z-index: 40;
  flex: none;
  overflow-y: auto;
}

.main-wrapper { flex: 1; display: flex; overflow: hidden; }

main {
  flex: 1;
  padding: 28px 32px 48px;
  overflow-y: auto;
  scroll-behavior: smooth;
  position: relative;
  animation: fadeIn 0.25s ease-out;
  background: var(--bg-main);
  color: var(--text-main);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.right-sidebar {
  width: 320px;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex: none;
}
body.no-feed .right-sidebar { display: none; }
@media (max-width: 1250px) { .right-sidebar { display: none; } }

/* Brand + nav */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; text-decoration: none; padding: 4px 8px; }
.brand-icon {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  box-shadow: 0 0 12px var(--primary-glow);
  flex: none;
}
.brand-title { font-size: 15px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-main); }

.nav-list { list-style: none; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-list a, .nav-list button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px; font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none; background: none; cursor: pointer;
  transition: 0.15s;
  text-align: left;
}
.nav-list a, .nav-list button { border-left: 2px solid transparent; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.nav-list a:hover, .nav-list button:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }
.nav-list a.active { background-color: var(--bg-surface-hover); color: var(--text-main); border-left-color: var(--primary); }
.nav-list .nav-cta { background: var(--primary); color: var(--primary-ink); font-weight: 700; justify-content: center; }
.nav-list .nav-cta:hover { background: var(--primary-hover); color: var(--primary-ink); }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-color); }
.user-profile { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-surface-hover);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  color: var(--primary);
  border: 1px solid var(--border-color);
  flex: none;
}
.user-profile .who { font-size: 13px; font-weight: 600; color: var(--text-main); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-profile .role { font-size: 11px; color: var(--text-dim); text-transform: capitalize; }

/* Mobile drawer */
.mobile-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}
.nav-toggle {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 15px;
  cursor: pointer;
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(4, 7, 11, 0.75); z-index: 35; }

@media (max-width: 920px) {
  body { display: block; height: auto; overflow: auto; }
  aside.sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform 0.2s ease; height: 100vh; }
  body.nav-open aside.sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; }
  .mobile-bar { display: flex; }
  .main-wrapper { display: block; overflow: visible; }
  main { padding-top: 76px; overflow: visible; }
}

/* --------------------------------------------------------------------------
   Header & buttons
   -------------------------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.page-head h2 { font-size: 22px; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cmd-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
}
.cmd-hint:hover { color: var(--primary); border-color: var(--primary); }

.btn {
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 800; font-size: 12px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: 0.15s;
  margin-top: 1rem;
}
.btn:hover { background: var(--primary-hover); box-shadow: 0 0 15px var(--primary-glow); color: var(--primary-ink); }
.btn.secondary { background: var(--bg-surface); color: var(--text-main); border-color: var(--border-color); box-shadow: none; }
.btn.secondary:hover { background: var(--bg-surface-hover); border-color: var(--text-muted); color: var(--text-main); }
.btn.danger { background: var(--accent-red); color: var(--text-main); box-shadow: none; }
.btn.danger:hover { background: #DC2626; color: var(--text-main); }
.btn.small { padding: 6px 12px; font-size: 12px; margin-top: 0; border-radius: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* --------------------------------------------------------------------------
   Stats, panels, analytics
   -------------------------------------------------------------------------- */
/* Seamed grid: 1px border-color gaps read as engraved rules, not cards. */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px; background: var(--border-color);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 22px;
}
.stat-card { background: var(--bg-surface); padding: 20px 22px; }
.stat-card .lbl { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-card .num { font-size: 26px; font-weight: 600; font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.5px; margin: 8px 0 4px; color: var(--text-main); }
.stat-card .sub { font-size: 12px; color: var(--primary); font-weight: 600; }

.panel { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px; }
.panel-header { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); }
.panel-header .ph-note { font-size: 11px; color: var(--text-muted); font-weight: 600; }

.analytics-row { display: grid; grid-template-columns: 2fr 1.2fr; gap: 14px; margin-bottom: 26px; }
@media (max-width: 1050px) { .analytics-row { grid-template-columns: 1fr; } }

.chart-svg { width: 100%; height: 190px; display: block; }
.chart-svg text { font-family: var(--font-mono); font-size: 10px; fill: var(--text-muted); }

.geo-matrix { display: flex; flex-direction: column; gap: 10px; }
.geo-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-main); }
.geo-row .geo-name { min-width: 40%; }
.geo-bar-bg { flex: 1; height: 6px; background: var(--bg-main); border-radius: 3px; margin: 0 12px; overflow: hidden; }
.geo-bar-fill { height: 100%; border-radius: 3px; }
.geo-row .geo-pct { font-family: var(--font-mono); color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Marketplace cards (terminal-compact)
   -------------------------------------------------------------------------- */
.section-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; margin: 26px 0 16px; }
.section-header .st { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-main); }

/* Strict tabular numerals everywhere money appears — no decimal jitter. */
td, .mono, .l-amount, .amount-pos, .amount-neg, .p-stats, .detail-val,
.hero-stats .num, .vb-num, .geo-pct, .progress-stats, .stat-row strong {
  font-variant-numeric: tabular-nums;
}

.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.filter-tab {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 13px; font-weight: 600; font-family: inherit;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer; transition: 0.15s;
}
.filter-tab.active, .filter-tab:hover { background: var(--bg-surface-hover); color: var(--primary); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: 0.2s;
  display: flex;
  flex-direction: column;
}
.project-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); }

.p-category {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 10px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  align-self: flex-start;
}
.p-title { font-size: 14px; font-weight: 700; color: var(--text-main); margin-bottom: 3px; line-height: 1.3; }
.p-farmer { font-size: 11.5px; color: var(--text-muted); margin-bottom: 12px; }
.p-bar-bg { height: 4px; background: var(--bg-main); border-radius: 2px; margin-bottom: 8px; overflow: hidden; }
.p-bar-fill { height: 100%; border-radius: 2px; transition: width 300ms ease; }
.p-stats { display: flex; justify-content: space-between; font-size: 11px; font-family: var(--font-mono); margin-bottom: 14px; color: var(--text-muted); }
.p-stats .raised { color: var(--text-main); font-weight: 700; }
.p-btn {
  width: 100%;
  background: var(--bg-main); color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px; border-radius: var(--radius-md);
  font-weight: 600; font-size: 12px; font-family: inherit;
  cursor: pointer; transition: 0.15s;
  margin-top: auto;
  text-align: center; text-decoration: none; display: block;
}
.p-btn:hover { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 20px;
  background: var(--ok-bg); color: var(--primary);
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.status-funded, .badge.status-active { background: var(--warn-bg); color: var(--accent-orange); }
.badge.status-completed { background: var(--info-bg); color: var(--accent-blue); }
.badge.status-pending { background: var(--bg-surface-hover); color: var(--text-muted); }
.badge.status-rejected, .badge.status-cancelled, .badge.status-defaulted { background: var(--danger-bg); color: var(--accent-red); }

/* --------------------------------------------------------------------------
   OTC table & vault
   -------------------------------------------------------------------------- */
.otc-note { border-color: var(--accent-purple); margin-bottom: 20px; }
.otc-note .on-title { color: var(--accent-purple); font-weight: 700; margin-bottom: 6px; font-size: 13px; }
.otc-note .on-body { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: 13px 12px; border-bottom: 1px solid var(--border-color); font-family: var(--font-mono); font-size: 12.5px; vertical-align: middle; }
td .sans { font-family: var(--font-sans); }
tbody tr:hover { background: var(--bg-surface-hover); }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.vault-card {
  background: linear-gradient(145deg, #0A0F18, #111A2B);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.05);
}
.vault-balance {
  display: inline-block;
  background: var(--bg-main);
  padding: 20px 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-align: left;
  margin: 20px 0;
}
.vault-balance .vb-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.vault-balance .vb-num { font-size: 30px; font-weight: 800; font-family: var(--font-mono); color: var(--text-main); }

/* --------------------------------------------------------------------------
   Milestone timeline
   -------------------------------------------------------------------------- */
.timeline { border-left: 2px solid var(--border-color); margin: 16px 0 4px 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 18px; }
.tl-item { position: relative; }
.tl-dot {
  position: absolute; left: -27px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
}
.tl-item.done .tl-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 8px var(--primary); }
.tl-item.active .tl-dot { background: var(--accent-orange); border-color: var(--accent-orange); animation: blink 2s infinite; }
.tl-item.cancelled .tl-dot { background: var(--accent-red); border-color: var(--accent-red); }
.tl-title { font-size: 13.5px; font-weight: 700; color: var(--text-main); margin-bottom: 2px; }
.tl-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

/* --------------------------------------------------------------------------
   Live ledger feed (right sidebar)
   -------------------------------------------------------------------------- */
.ledger-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-main);
}
.pulse { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 8px var(--primary); animation: blink 2s infinite; }
.ledger-live { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.ledger-feed { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ledger-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  font-size: 12px;
  border-left: 3px solid var(--border-color);
  animation: fadeIn 0.3s;
  color: var(--text-muted);
}
.ledger-item.self { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.l-top { display: flex; justify-content: space-between; color: var(--text-dim); margin-bottom: 5px; font-size: 10.5px; font-family: var(--font-mono); }
.l-top .l-actor { color: var(--text-muted); font-weight: 700; }
.l-amount { font-family: var(--font-mono); font-weight: 700; color: var(--text-main); }
.type-invest { border-left-color: var(--accent-blue); }
.type-deposit { border-left-color: var(--primary); }
.type-withdraw { border-left-color: var(--accent-orange); }
.type-payout { border-left-color: var(--accent-purple); }
.type-otc_buy { border-left-color: var(--accent-purple); }
.type-release { border-left-color: var(--accent-orange); }

/* --------------------------------------------------------------------------
   Command palette (Ctrl+K)
   -------------------------------------------------------------------------- */
.cmd-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
  z-index: 9999;
}
.cmd-palette {
  width: 100%; max-width: 560px;
  background: var(--bg-surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  margin: 0 16px;
}
.cmd-input {
  width: 100%; background: transparent; border: none;
  padding: 18px 20px;
  font-size: 16px; color: var(--text-main);
  font-family: var(--font-mono);
  outline: none;
}
.cmd-results { border-top: 1px solid var(--border-color); padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; }
.cmd-item {
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; justify-content: space-between; gap: 12px;
  border: none; background: none; font-family: inherit; width: 100%; text-align: left;
}
.cmd-item .ck { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.cmd-item.sel, .cmd-item:hover { background: var(--bg-surface-hover); color: var(--primary); }

/* --------------------------------------------------------------------------
   Forms, alerts, modal, toast
   -------------------------------------------------------------------------- */
form.panel, .panel.form { max-width: 420px; margin: 0 auto; padding: 28px; }
.panel.wide { max-width: none; }

label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin: 16px 0 7px; color: var(--text-muted); }
input, select, textarea {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px; font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input[type="number"] { font-family: var(--font-mono); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
textarea { min-height: 100px; resize: vertical; }
select option { background: var(--bg-surface); }
.hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; text-transform: none; letter-spacing: 0; }

.totp-grid { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; }
.totp-box {
  width: 44px; height: 50px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 22px; text-align: center;
  color: var(--text-main); font-family: var(--font-mono); font-weight: 700;
  outline: none; transition: 0.15s;
  padding: 0;
}
.totp-box:focus { border-color: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }

.pw-meter { height: 4px; border-radius: 3px; background: var(--bg-main); margin-top: 8px; overflow: hidden; }
.pw-meter > div { height: 100%; border-radius: 3px; transition: width 200ms ease; }
.pw-label { font-size: 11.5px; margin-top: 5px; font-weight: 650; }
.pw-weak > div { background: var(--accent-red); } .pw-weak + .pw-label { color: var(--accent-red); }
.pw-fair > div { background: var(--accent-orange); } .pw-fair + .pw-label { color: var(--accent-orange); }
.pw-strong > div { background: var(--primary); } .pw-strong + .pw-label { color: var(--primary); }

.error-box, .success-box, .info-box { border-radius: 8px; padding: 11px 14px; font-size: 13px; margin-top: 14px; border: 1px solid transparent; }
.error-box { background: var(--danger-bg); color: #FCA5A5; border-color: rgba(239, 68, 68, 0.3); }
.success-box { background: var(--ok-bg); color: #6EE7B7; border-color: rgba(16, 185, 129, 0.3); }
.info-box { background: var(--info-bg); color: #93C5FD; border-color: rgba(59, 130, 246, 0.3); }

.toast[hidden] { display: none; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  z-index: 10000;
  max-width: min(92vw, 34rem);
  animation: fadeIn 200ms ease;
}
.toast.success { border-color: rgba(16, 185, 129, 0.5); color: #6EE7B7; }
.toast.error { border-color: rgba(239, 68, 68, 0.5); color: #FCA5A5; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 7, 11, 0.9);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%; max-width: 410px;
  padding: 26px;
  position: relative;
  max-height: 90vh; overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 6px; color: var(--text-main); }
.modal-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.4; }
.close-modal { position: absolute; top: 16px; right: 18px; background: none; border: none; color: var(--text-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.close-modal:hover { color: var(--text-main); }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.mono { font-family: var(--font-mono); word-break: break-all; font-size: 0.9em; }
.amount-pos { color: var(--primary); font-weight: 700; font-family: var(--font-mono); }
.amount-neg { color: var(--accent-red); font-weight: 700; font-family: var(--font-mono); }

.secure-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text-dim); margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border-color); }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px; }
.card .meta { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-icon { display: none; }
.stat-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-muted); }
.stat-row strong { color: var(--text-main); font-family: var(--font-mono); }
.meter { height: 6px; background: var(--bg-main); border-radius: 3px; overflow: hidden; margin: 10px 0 6px; }
.meter > div { height: 100%; background: linear-gradient(90deg, #10B981, #3B82F6); border-radius: 3px; min-width: 0; }

.hero {
  background:
    radial-gradient(46rem 20rem at 110% -10%, rgba(16, 185, 129, 0.12), transparent 60%),
    radial-gradient(34rem 16rem at -10% 110%, rgba(59, 130, 246, 0.1), transparent 60%),
    var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(26px, 5vw, 52px);
  margin-bottom: 28px;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-dim);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px; padding: 5px 12px; margin-bottom: 16px;
}
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; max-width: 38rem; margin-bottom: 10px; letter-spacing: -1px; }
.hero p { max-width: 40rem; color: var(--text-muted); margin-bottom: 20px; font-size: 15px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn { margin-top: 0; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 40px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.hero-stats .hs .num { font-size: 20px; font-weight: 800; font-family: var(--font-mono); color: var(--text-main); }
.hero-stats .hs .lbl { font-size: 11.5px; color: var(--text-dim); }

.empty { text-align: center; color: var(--text-muted); padding: 44px 16px; background: var(--bg-surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }
.empty .empty-icon { font-size: 28px; display: block; margin-bottom: 6px; }

.skeleton { border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-color); padding: 18px; }
.sk-line { height: 12px; border-radius: 6px; margin: 9px 0; background: linear-gradient(90deg, var(--bg-surface-hover) 25%, var(--border-color) 50%, var(--bg-surface-hover) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.section-title { margin: 28px 0 14px; display: flex; align-items: center; gap: 12px; }
.section-title h2 { font-size: 16px; }
.section-title .rule { flex: 1; height: 1px; background: var(--border-color); }

.footer-note { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--border-color); font-size: 11.5px; color: var(--text-dim); max-width: 60rem; }

/* --------------------------------------------------------------------------
   Inline lucide-style icons (CSP-safe: embedded SVG, no CDN)
   -------------------------------------------------------------------------- */
.lucide { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-list .lucide { width: 15px; height: 15px; opacity: 0.9; }
.tabbar .lucide { width: 18px; height: 18px; }
.empty .lucide { width: 28px; height: 28px; display: block; margin: 0 auto 8px; opacity: 0.6; }
.brand-icon .lucide { width: 17px; height: 17px; stroke: var(--primary); }

/* --------------------------------------------------------------------------
   Split-screen institutional auth (form left, manifesto right)
   -------------------------------------------------------------------------- */
.auth-split {
  display: grid;
  grid-template-columns: minmax(340px, 440px) 1fr;
  gap: 40px;
  align-items: stretch;
  min-height: 72vh;
}
.auth-split .panel { margin: auto 0; width: 100%; }
.auth-side {
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    radial-gradient(42rem 22rem at 110% -10%, rgba(16, 185, 129, 0.12), transparent 60%),
    linear-gradient(160deg, #050B16 0%, #0A101E 100%);
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-side::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255, 255, 255, 0.025) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255, 255, 255, 0.025) 40px);
  pointer-events: none;
}
.auth-side > * { position: relative; }
.auth-side .as-eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--primary); font-family: var(--font-mono); margin-bottom: 18px;
}
.auth-side h2 { font-size: clamp(22px, 2.6vw, 32px); font-weight: 800; letter-spacing: -0.5px; max-width: 30rem; margin-bottom: 14px; }
.auth-side .as-sub { color: var(--text-muted); font-size: 14px; max-width: 32rem; line-height: 1.6; margin-bottom: 28px; }
.auth-side .as-tick { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; font-size: 13px; color: var(--text-main); }
.auth-side .as-tick .lucide { color: var(--primary); margin-top: 1px; }
.auth-side .as-tick .t-sub { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.auth-side .as-proof {
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border-color);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); line-height: 1.8;
}
.auth-side .as-proof strong { color: var(--text-muted); }
@media (max-width: 980px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-side { display: none; }
}

/* ==========================================================================
   ADMIN CONTROL PLANE — reference-exact skin (Stripe Treasury × Linear).
   Dark #030712 shell frames an ultra-crisp light workspace.
   ========================================================================== */
body.admin-light aside.sidebar,
body.admin-light .right-sidebar { background: #030712; border-color: #1F2937; }
body.admin-light .sidebar-footer,
body.admin-light .brand-sep { border-color: #1F2937; }
body.admin-light .ledger-header { border-color: #1F2937; color: #9CA3AF; }

/* Grouped nav with count badges (reference sidebar) */
.nav-label { display: none; }
body.admin-light .nav-label {
  display: block;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: #4B5563; font-weight: 700;
  padding: 12px 12px 4px; margin-top: 8px;
}
.nav-count {
  margin-left: auto;
  background: #374151; color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 12px;
  font-weight: 700; font-family: var(--font-mono);
}
.nav-count.warn { background: #F59E0B; color: #000; }
.nav-count.danger { background: #EF4444; color: #fff; }
body.admin-light .nav-list a, body.admin-light .nav-list button {
  border-left: none; border-radius: 6px; color: #9CA3AF; font-weight: 500;
}
body.admin-light .nav-list a:hover, body.admin-light .nav-list button:hover { background: #1F2937; color: #fff; }
body.admin-light .nav-list a.active { background: #2563EB; color: #fff; }
body.admin-light .nav-list a.active .nav-count { background: rgba(255, 255, 255, 0.2); color: #fff; }
body.admin-light .user-profile .who { color: #fff; }
body.admin-light .user-profile .role { color: #9CA3AF; font-family: var(--font-mono); text-transform: none; }
body.admin-light .avatar { background: #374151; color: #fff; border-color: #1F2937; }
body.admin-light .brand-icon { background: #fff; color: #000; border: none; box-shadow: none; border-radius: 4px; font-family: var(--font-mono); font-weight: 700; }

/* Workspace frame: sticky white header + centered content column */
body.admin-light main { padding: 0; }
body.admin-light main > .grid { padding: 32px 40px; } /* loading skeleton guard */
body.admin-light main > .footer-note { display: none; }
.ac-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 24px 40px 0;
  position: sticky; top: 0; z-index: 5;
}
.ac-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ac-h-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: 0; }
.ac-h-sub { font-size: 13px; color: var(--text-muted); }
.ac-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-family: var(--font-mono); color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 8px 12px; border-radius: 4px;
  white-space: nowrap;
}
.ac-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #10B981; }
.ac-pill .dot.bad { background: #EF4444; }
.ac-tabs { display: flex; gap: 32px; margin-top: 24px; overflow-x: auto; }
.ac-tab {
  padding: 0 0 16px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border: none; background: none; font-family: inherit;
  border-bottom: 2px solid transparent;
  white-space: nowrap; transition: 0.2s;
}
.ac-tab:hover { color: var(--text-main); }
.ac-tab.active { color: #2563EB; border-bottom-color: #2563EB; font-weight: 600; }
.ac-content { padding: 32px 40px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* Stat cards: separate elevated cards (not the seamed grid) */
body.admin-light main .stats-grid {
  gap: 16px; background: transparent; border: none;
  border-radius: 0; overflow: visible; margin-bottom: 32px;
}
body.admin-light main .stat-card { border: 1px solid var(--border-color); border-radius: 8px; padding: 20px; }
body.admin-light main .stat-card .num { font-size: 24px; }
body.admin-light main .stat-card .lbl { letter-spacing: 0.5px; margin-bottom: 2px; }

/* High-density data cards with grey header strips */
.c-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin-bottom: 32px;
}
.c-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-surface-hover);
  gap: 12px; flex-wrap: wrap;
}
.c-title { font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-main); }
.ac-search {
  padding: 8px 12px;
  border: 1px solid var(--border-color); border-radius: 4px;
  font-size: 13px; font-family: var(--font-sans);
  width: 280px; max-width: 100%;
  background: var(--bg-surface); color: var(--text-main);
}
.ac-search:focus { border-color: #2563EB; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1); outline: none; }

body.admin-light main th { padding: 12px 24px; background: #F9FAFB; letter-spacing: 0.5px; }
body.admin-light main td { padding: 16px 24px; }
body.admin-light main td .hint { font-family: var(--font-mono); font-size: 11px; }
body.admin-light main .badge { border-radius: 4px; font-family: var(--font-mono); letter-spacing: 0.5px; }

/* Buttons: near-black primary, quiet bordered secondary (reference) */
body.admin-light main .btn {
  background: #111827; color: #fff; border: 1px solid #111827;
  font-family: var(--font-sans); text-transform: none; letter-spacing: 0;
  font-weight: 500; font-size: 13px; padding: 8px 16px; border-radius: 4px;
}
body.admin-light main .btn:hover { background: #000; color: #fff; box-shadow: none; }
body.admin-light main .btn.secondary {
  background: var(--bg-surface); color: var(--text-main); border-color: var(--border-color);
  font-size: 12px; padding: 6px 12px;
}
body.admin-light main .btn.secondary:hover { border-color: var(--text-muted); background: var(--bg-main); color: var(--text-main); }
body.admin-light main .btn.danger { background: #DC2626; border-color: #DC2626; color: #fff; }

body.admin-light main .prog-bg { background: var(--bg-main); border: none; }
body.admin-light main .prog-fill { background: #2563EB; }
body.admin-light main .settings-row:nth-of-type(even) { background: #F9FAFB; }

/* Server Syslog rail (reference right sidebar) */
body.admin-light .ledger-feed { gap: 12px; padding: 16px; }
body.admin-light .ledger-item {
  background: #0A0A0A;
  border: 1px solid #1F2937;
  border-left: 2px solid #1F2937;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px; line-height: 1.5;
  color: #9CA3AF;
}
body.admin-light .ledger-item.self { box-shadow: none; border-left-color: #2563EB; }
.sys-time { color: #9CA3AF; display: block; font-size: 10px; margin-bottom: 4px; }
.sys-id { color: #2563EB; }
.sys-ok { color: #10B981; }
.sys-amt { color: #fff; font-weight: 700; }

/* --------------------------------------------------------------------------
   Safe action menus: destructive operations hide behind a ••• kebab so a
   mouse-slip can never move money or erase a person.
   -------------------------------------------------------------------------- */
.action-wrap { position: relative; display: inline-block; }
.kebab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 4px;
  font-weight: 700; font-size: 14px; letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
}
.kebab:hover, .kebab[aria-expanded="true"] { background: var(--bg-surface-hover); color: var(--text-main); border-color: var(--border-color); }
.kebab-pop {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 60;
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.kebab-pop button {
  background: none; border: none;
  text-align: left;
  padding: 9px 12px;
  font-size: 12.5px; font-weight: 550; font-family: inherit;
  color: var(--text-main);
  border-radius: 4px;
  cursor: pointer;
}
.kebab-pop button:hover { background: var(--bg-surface-hover); }
.kebab-pop button.destructive { color: var(--accent-red); }
.kebab-pop button.destructive:hover { background: var(--danger-bg); }
.kebab-pop .kebab-sep { height: 1px; background: var(--border-color); margin: 4px 8px; }

/* Settings: explain-left / configure-right rows — no more full-width inputs. */
.settings-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  padding: 28px 24px;
  border-bottom: 1px solid var(--border-color);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .s-desc h3 { font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.settings-row .s-desc p { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.settings-row input, .settings-row select { max-width: 380px; }
.settings-row textarea { max-width: 520px; }
.settings-row label:first-of-type { margin-top: 0; }
@media (max-width: 960px) { .settings-row { grid-template-columns: 1fr; gap: 14px; } }

/* Inline funding-velocity bars for admin tables. */
.prog-wrap { width: 130px; }
.prog-bg { width: 100%; height: 6px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 3px; overflow: hidden; margin-bottom: 5px; }
.prog-fill { height: 100%; background: var(--primary); border-radius: 3px; min-width: 0; }
.prog-label { font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono); }

/* Privacy mode: blur every money figure for safe use in public spaces. */
body.privacy .stat-card .num,
body.privacy .vb-num,
body.privacy .amount-pos,
body.privacy .amount-neg,
body.privacy .hero-stats .num,
body.privacy .l-amount,
body.privacy .amount-raised { filter: blur(9px); transition: filter 0.15s; }
.privacy-toggle {
  background: none; border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 8px 12px; font-size: 14px; cursor: pointer;
}
.privacy-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* Farm feed (update broadcaster) */
.update-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 13px;
}
.update-item .u-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-bottom: 5px; font-family: var(--font-mono); }
.update-item .u-body { color: var(--text-main); white-space: pre-wrap; line-height: 1.5; }

/* Mobile bottom tab bar — thumb-first navigation (no hamburger hunting). */
.tabbar { display: none; }
@media (max-width: 920px) {
  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 10px; font-weight: 600;
    padding: 4px 2px;
    border-radius: var(--radius-md);
  }
  .tabbar a .ti { font-size: 18px; }
  .tabbar a.active { color: var(--primary); }
  main { padding-bottom: 90px; }
}

/* Toggle switch (DRIP etc.) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row .sw-text { font-size: 13px; }
.switch-row .sw-sub { font-size: 11.5px; color: var(--text-dim); }
