/* Theme modelled on coinbase.com (Coinbase Design System): white canvas, Coinbase blue
   (#0052FF) for primary actions and focus, near-black text, cool grays, green for
   gains/OK and red for losses/critical, pill buttons. Day is the default; Night matches
   Coinbase's dark mode. Chosen in the Display menu (Auto follows the OS); --fs scales fonts. */
:root {
  color-scheme: light;
  --void: #FFFFFF;
  --surface: #FFFFFF;
  --raised: #F7F8F9;
  --elevated: #EEF0F3;
  --rim: #E3E5E8;
  --rim-bright: #CED2D9;

  --signal: #0045D9;
  --signal-dim: #0052FF;
  --signal-glow: rgba(0,82,255,0.08);
  --on-signal: #FFFFFF;

  --ok: #098551;
  --ok-glow: #E6F4EC;
  --blue: #0052FF;
  --blue-glow: #EBF0FF;
  --govern: #6E3FD9;
  --govern-glow: #F1ECFC;
  --cold: #0A7EA4;
  --cold-glow: #E6F4F8;
  --warn: #A35A00;
  --warn-glow: #FEF6E6;
  --critical: #CF202F;
  --crit-glow: #FCEBEC;

  --text: #0A0B0D;
  --text-dim: #5B616E;
  --text-muted: #8A919E;
  --shadow: rgba(10,11,13,.08);
  --backdrop: rgba(10,11,13,.48);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-rounded: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  --sidebar-w: 220px;
  --topbar-h: 56px;
  --fs: 1;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --void: #0A0B0D;
  --surface: #141519;
  --raised: #1A1C21;
  --elevated: #1E2025;
  --rim: #2A2D33;
  --rim-bright: #3C4049;

  --signal: #578BFA;
  --signal-dim: #3773F5;
  --signal-glow: rgba(87,139,250,0.14);
  --on-signal: #FFFFFF;

  --ok: #27AD75;
  --ok-glow: rgba(39,173,117,0.14);
  --blue: #578BFA;
  --blue-glow: rgba(87,139,250,0.14);
  --govern: #9E7BF0;
  --govern-glow: rgba(158,123,240,0.14);
  --cold: #3FB4D9;
  --cold-glow: rgba(63,180,217,0.14);
  --warn: #F5A623;
  --warn-glow: rgba(245,166,35,0.14);
  --critical: #F0616D;
  --crit-glow: rgba(240,97,109,0.14);

  --text: #FFFFFF;
  --text-dim: #A6ACB8;
  --text-muted: #8A919E;
  --shadow: rgba(0,0,0,.5);
  --backdrop: rgba(0,0,0,.65);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
  color-scheme: dark;
  --void: #0A0B0D;
  --surface: #141519;
  --raised: #1A1C21;
  --elevated: #1E2025;
  --rim: #2A2D33;
  --rim-bright: #3C4049;

  --signal: #578BFA;
  --signal-dim: #3773F5;
  --signal-glow: rgba(87,139,250,0.14);
  --on-signal: #FFFFFF;

  --ok: #27AD75;
  --ok-glow: rgba(39,173,117,0.14);
  --blue: #578BFA;
  --blue-glow: rgba(87,139,250,0.14);
  --govern: #9E7BF0;
  --govern-glow: rgba(158,123,240,0.14);
  --cold: #3FB4D9;
  --cold-glow: rgba(63,180,217,0.14);
  --warn: #F5A623;
  --warn-glow: rgba(245,166,35,0.14);
  --critical: #F0616D;
  --crit-glow: rgba(240,97,109,0.14);

  --text: #FFFFFF;
  --text-dim: #A6ACB8;
  --text-muted: #8A919E;
  --shadow: rgba(0,0,0,.5);
  --backdrop: rgba(0,0,0,.65);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: calc(13px * var(--fs));
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Shell ── */
.shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--rim);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}
.logo-mark {
  font-family: var(--font-ui);
  font-size: calc(18px * var(--fs));
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--signal-dim);
}
.logo-sub {
  font-size: calc(9px * var(--fs));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.topbar-divider { width: 1px; height: 22px; background: var(--rim); flex-shrink: 0; }
.topbar-pills { display: flex; gap: 8px; flex: 1; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: calc(10px * var(--fs));
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  border: 1px solid;
}
.pill-ok  { color: var(--ok); border-color: var(--ok); background: var(--ok-glow); }
.pill-info{ color: var(--blue);   border-color: var(--blue);       background: var(--blue-glow);   }
.pill-cold{ color: var(--cold);   border-color: var(--cold);       background: var(--cold-glow);   }
.pill-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-clock { font-family: var(--font-mono); font-size: calc(11px * var(--fs)); color: var(--text-dim); letter-spacing: 0.06em; }
.notif-btn {
  position: relative;
  background: none;
  border: 1px solid var(--rim);
  border-radius: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
  transition: border-color 150ms, color 150ms;
}
.notif-btn:hover { border-color: var(--rim-bright); color: var(--text); }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--critical);
  color: #fff;
  font-size: calc(9px * var(--fs));
  font-weight: 700;
  width: 14px; height: 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--void);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--rim);
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 150ms;
}
.user-chip:hover { border-color: var(--rim-bright); }
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--signal);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(10px * var(--fs));
  font-weight: 700;
  color: var(--on-signal);
  font-family: var(--font-mono);
}
.user-name { font-size: calc(11px * var(--fs)); font-weight: 600; color: var(--text-dim); }

/* ── Body ── */
.body-wrap { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--rim);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 0;
}
.nav-section-label {
  font-size: calc(9px * var(--fs));
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 18px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 10px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  color: var(--text-dim);
  font-size: calc(13px * var(--fs));
  font-weight: 500;
  user-select: none;
}
.nav-item:hover { background: var(--signal-glow); color: var(--text); }
.nav-item.active {
  background: var(--signal-glow);
  color: var(--signal);
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--warn-glow);
  color: var(--warn);
  border: 1px solid var(--warn);
  font-size: calc(9px * var(--fs));
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 10px;
}
.nav-badge-crit { background: var(--crit-glow); color: var(--critical); border-color: var(--critical); }
.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--rim);
  font-size: calc(10px * var(--fs));
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.sidebar-footer span { color: var(--signal); }

/* ── Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--void);
}

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }
.view-header { margin-bottom: 22px; }
.view-title { font-family: var(--font-rounded); font-size: calc(20px * var(--fs)); font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.view-sub { font-size: calc(11px * var(--fs)); color: var(--text-muted); margin-top: 3px; font-family: var(--font-mono); letter-spacing: 0.06em; }

/* ── Stat grid ── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--rim);
  border-radius: 16px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.signal::before { background: linear-gradient(90deg, var(--signal), transparent); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--blue), transparent); }
.stat-card.warn::before   { background: linear-gradient(90deg, var(--warn), transparent); }
.stat-card.govern::before { background: linear-gradient(90deg, var(--govern), transparent); }
.stat-card.cold::before   { background: linear-gradient(90deg, var(--cold), transparent); }
.stat-label {
  font-size: calc(9px * var(--fs));
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-size: calc(26px * var(--fs));
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}
.stat-value.signal { color: var(--signal); }
.stat-value.warn   { color: var(--warn); }
.stat-meta { font-size: calc(10px * var(--fs)); color: var(--text-dim); margin-top: 6px; }
.stat-delta {
  font-size: calc(10px * var(--fs));
  font-family: var(--font-mono);
  margin-top: 4px;
}
.delta-up   { color: var(--ok); }
.delta-warn { color: var(--warn); }

/* ── Two-col grid ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--rim);
  border-radius: 16px;
  padding: 18px;
}
.card-title {
  font-size: calc(10px * var(--fs));
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title-row .card-title { margin-bottom: 0; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: calc(9px * var(--fs));
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--rim);
  white-space: nowrap;
}
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--rim);
  font-size: calc(12px * var(--fs));
  color: var(--text-dim);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--raised); }
.mono { font-family: var(--font-mono); font-size: calc(11px * var(--fs)); }
.fw { font-weight: 600; color: var(--text); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: calc(11px * var(--fs));
  font-weight: 500;
  font-family: var(--font-ui);
  letter-spacing: 0;
  white-space: nowrap;
}
.badge-ok      { background: var(--ok-glow); color: var(--ok); border: 1px solid transparent; }
.badge-warn    { background: var(--warn-glow);   color: var(--warn);   border: 1px solid transparent; }
.badge-crit    { background: var(--crit-glow);   color: var(--critical); border: 1px solid transparent; }
.badge-blue    { background: var(--blue-glow);   color: var(--blue);   border: 1px solid transparent; }
.badge-govern  { background: var(--govern-glow); color: var(--govern); border: 1px solid transparent; }
.badge-cold    { background: var(--cold-glow);   color: var(--cold);   border: 1px solid transparent; }
.badge-muted   { background: var(--elevated); color: var(--text-dim); border: 1px solid transparent; }

/* ── Chain chip ── */
.chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: calc(11px * var(--fs));
  font-family: var(--font-mono);
  color: var(--text-dim);
}
.chain-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(9px * var(--fs));
  font-weight: 800;
  flex-shrink: 0;
}
.chain-btc  { background: var(--signal-glow); color: var(--text); }
.chain-eth  { background: var(--signal-glow); color: var(--text); }
.chain-l2   { background: var(--signal-glow); color: var(--text-dim); }
.chain-hyp  { background: var(--signal-glow); color: var(--text-dim); }
.chain-moo  { background: var(--signal-glow); color: var(--text); }
.chain-usdc { background: var(--signal-glow); color: var(--text); }
.chain-oth  { background: var(--elevated); color: var(--text-muted); }

/* ── MPC dots ── */
.mpc-wrap { display: flex; align-items: center; gap: 10px; }
.mpc-dots { display: flex; gap: 4px; }
.mpc-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--rim-bright);
  background: transparent;
  transition: all 150ms;
}
.mpc-dot.filled { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 6px var(--signal-glow); }
.mpc-dot.partial { background: var(--warn); border-color: var(--warn); }
.mpc-ratio { font-family: var(--font-mono); font-size: calc(11px * var(--fs)); color: var(--text-dim); }

/* ── Signing queue ── */
.queue-list { display: flex; flex-direction: column; gap: 12px; }
.queue-item {
  background: var(--raised);
  border: 1px solid var(--rim);
  border-radius: 8px;
  padding: 13px 15px;
  transition: border-color 150ms;
}
.queue-item:hover { border-color: var(--rim-bright); }
.queue-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.queue-item-id { font-family: var(--font-mono); font-size: calc(10px * var(--fs)); color: var(--text-muted); flex: 1; }
.queue-item-val { font-family: var(--font-mono); font-size: calc(13px * var(--fs)); font-weight: 700; color: var(--text); margin-left: auto; }
.queue-item-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.queue-item-time { font-size: calc(10px * var(--fs)); color: var(--text-muted); font-family: var(--font-mono); margin-left: auto; }
.queue-approve-btn {
  background: var(--signal-glow);
  color: var(--signal);
  border: 1px solid var(--signal-dim);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: calc(10px * var(--fs));
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 150ms;
}
.queue-approve-btn:hover { background: var(--signal-glow); }

/* ── Donut chart ── */
.chart-wrap {
  display: flex;
  gap: 20px;
  align-items: center;
}
.chart-canvas-wrap { position: relative; flex-shrink: 0; }
.chart-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-label { font-size: calc(11px * var(--fs)); color: var(--text-dim); flex: 1; }
.legend-pct { font-family: var(--font-mono); font-size: calc(11px * var(--fs)); color: var(--text); font-weight: 600; }
.legend-val { font-family: var(--font-mono); font-size: calc(10px * var(--fs)); color: var(--text-muted); }

/* ── Workflow ── */
.workflow { display: flex; align-items: center; gap: 0; overflow-x: auto; padding-bottom: 4px; }
.wf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 90px;
}
.wf-node {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--rim-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--raised);
  font-size: calc(14px * var(--fs));
  transition: all 200ms;
}
.wf-step.done .wf-node   { border-color: var(--signal); background: var(--signal-glow); }
.wf-step.active .wf-node { border-color: var(--warn); background: var(--warn-glow); box-shadow: 0 0 14px var(--warn-glow); animation: pulse-warn 2s ease-in-out infinite; }
@keyframes pulse-warn { 0%,100%{box-shadow:0 0 10px var(--warn-glow)} 50%{box-shadow:0 0 20px var(--warn-glow)} }
.wf-label { font-size: calc(10px * var(--fs)); font-family: var(--font-mono); color: var(--text-muted); text-align: center; }
.wf-step.done .wf-label   { color: var(--signal); }
.wf-step.active .wf-label { color: var(--warn); }
.wf-connector { flex: 1; height: 2px; background: var(--rim); min-width: 24px; margin-top: -22px; }
.wf-connector.done { background: var(--signal-dim); }

/* ── Policy card ── */
.policy-list { display: flex; flex-direction: column; gap: 10px; }
.policy-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--raised);
  border: 1px solid var(--rim);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}
.policy-item:hover { border-color: var(--rim-bright); background: var(--elevated); }
.policy-item.active-policy { border-color: var(--govern); background: var(--govern-glow); }
.policy-name { font-weight: 600; font-size: calc(12px * var(--fs)); color: var(--text); flex: 1; }
.policy-desc { font-size: calc(11px * var(--fs)); color: var(--text-muted); margin-top: 2px; }
.policy-icon { font-size: calc(18px * var(--fs)); flex-shrink: 0; }

/* ── Compliance gauge ── */
.compliance-main { display: flex; gap: 24px; align-items: center; margin-bottom: 16px; }
.gauge-wrap { flex-shrink: 0; position: relative; width: 120px; height: 120px; }
.gauge-bg, .gauge-fg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; }
.gauge-bg { background: var(--elevated); }
.gauge-fg { background: conic-gradient(var(--signal) 0% calc(var(--pct) * 1%), var(--rim) calc(var(--pct) * 1%) 100%); }
.gauge-inner {
  position: absolute;
  top: 16px; left: 16px; right: 16px; bottom: 16px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-score { font-family: var(--font-mono); font-size: calc(20px * var(--fs)); font-weight: 700; color: var(--signal); line-height: 1; }
.gauge-unit  { font-family: var(--font-mono); font-size: calc(9px * var(--fs)); color: var(--text-muted); margin-top: 2px; letter-spacing: 0.08em; }
.compliance-stats { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.comp-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--raised); border-radius: 6px; border: 1px solid var(--rim); }
.comp-stat-label { font-size: calc(11px * var(--fs)); color: var(--text-dim); }
.comp-stat-value { font-family: var(--font-mono); font-size: calc(12px * var(--fs)); font-weight: 700; color: var(--text); }

/* ── Offline signing panel ── */
.oso-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--raised);
  border: 1px solid var(--cold);
  border-radius: 10px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.oso-status::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, var(--cold-glow) 0%, transparent 60%);
  pointer-events: none;
}
.oso-pulse {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--cold);
  box-shadow: 0 0 0 0 var(--cold-glow);
  animation: oso-pulse 3s ease-out infinite;
  flex-shrink: 0;
}
@keyframes oso-pulse {
  0%  { box-shadow: 0 0 0 0 rgba(128,128,128,.5); }
  70% { box-shadow: 0 0 0 10px rgba(128,128,128,0); }
  100%{ box-shadow: 0 0 0 0 rgba(128,128,128,0); }
}
.oso-text { flex: 1; }
.oso-label { font-family: var(--font-mono); font-size: calc(12px * var(--fs)); font-weight: 700; color: var(--cold); letter-spacing: 0.08em; text-transform: uppercase; }
.oso-sublabel { font-size: calc(11px * var(--fs)); color: var(--text-muted); margin-top: 3px; }
.oso-meta { font-family: var(--font-mono); font-size: calc(10px * var(--fs)); color: var(--cold); text-align: right; }
.oso-meta-dim { color: var(--text-muted); font-size: calc(9px * var(--fs)); margin-top: 2px; }

/* ── Vault grid ── */
.vault-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.vault-item {
  background: var(--raised);
  border: 1px solid var(--rim);
  border-radius: 8px;
  padding: 14px 16px;
}
.vault-chain { font-size: calc(10px * var(--fs)); font-family: var(--font-mono); color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.vault-amount { font-family: var(--font-mono); font-size: calc(16px * var(--fs)); font-weight: 700; color: var(--cold); }
.vault-usd { font-size: calc(10px * var(--fs)); color: var(--text-muted); margin-top: 3px; font-family: var(--font-mono); }
.vault-pct { font-size: calc(10px * var(--fs)); color: var(--text-dim); margin-top: 6px; }
.vault-bar { height: 3px; background: var(--rim); border-radius: 2px; margin-top: 6px; }
.vault-bar-fill { height: 100%; background: var(--cold); border-radius: 2px; }

/* ── Ceremony log ── */
.ceremony-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rim);
}
.ceremony-item:last-child { border-bottom: none; }
.ceremony-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.ceremony-dot.pending { background: var(--warn); animation: blink 1.5s ease-in-out infinite; }
.ceremony-text { flex: 1; font-size: calc(11px * var(--fs)); color: var(--text-dim); }
.ceremony-time { font-family: var(--font-mono); font-size: calc(10px * var(--fs)); color: var(--text-muted); }

/* ── Route health ── */
.route-health { display: flex; flex-direction: column; gap: 8px; }
.rh-item { display: flex; align-items: center; gap: 10px; padding: 10px 13px; background: var(--raised); border-radius: 6px; border: 1px solid var(--rim); }
.rh-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.rh-dot.ok   { background: var(--ok); }
.rh-dot.warn { background: var(--warn); }
.rh-label { font-size: calc(11px * var(--fs)); color: var(--text-dim); flex: 1; }
.rh-latency { font-family: var(--font-mono); font-size: calc(10px * var(--fs)); color: var(--text-muted); }

/* ── Util ── */
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-signal { color: var(--ok); }
.text-warn   { color: var(--warn); }
.text-crit   { color: var(--critical); }
.text-cold   { color: var(--cold); }
.text-blue   { color: var(--blue); }
.text-govern { color: var(--govern); }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--rim-bright); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .stat-row { grid-template-columns: repeat(2,1fr); }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .vault-grid { grid-template-columns: repeat(2,1fr); }
  .topbar-pills { display: none; }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { padding: 14px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .logo-sub { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Platform additions (forms, dialogs, auth portal, live states)
   ════════════════════════════════════════════════════════════════════════════ */

html, body { background: var(--void); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Status pills — live variants */
.pill-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-glow); }
.pill-crit { color: var(--critical); border-color: var(--critical); background: var(--crit-glow); }
.pill-muted { color: var(--text-dim); border-color: var(--rim); background: transparent; }
.pill-muted .pill-dot { animation: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--elevated); color: var(--text); font-size: calc(13px * var(--fs)); font-weight: 600;
  cursor: pointer; transition: background 150ms, border-color 150ms; white-space: nowrap;
}
.btn:hover { background: var(--rim); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--signal-dim); border-color: var(--signal-dim); color: var(--on-signal); }
.btn-primary:hover { background: var(--signal); }
.btn-secondary { background: var(--elevated); }
.btn-danger { background: var(--critical); border-color: var(--critical); color: #FFFFFF; }
.btn-danger:hover { filter: brightness(.92); }
.btn-sm { padding: 4px 12px; font-size: calc(12px * var(--fs)); border-radius: 999px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.queue-approve-btn:disabled { opacity: .4; cursor: default; }
.queue-reject-btn { background: transparent; color: var(--text-dim); border: 1px solid var(--rim); border-radius: 999px; padding: 5px 10px; font-size: calc(10px * var(--fs)); font-weight: 700; font-family: var(--font-mono); cursor: pointer; }
.queue-reject-btn:hover { color: var(--critical); border-color: var(--critical); }
.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; font-size: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: calc(10px * var(--fs)); font-family: var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); display: flex; justify-content: space-between; }
.field .hint { font-size: calc(11px * var(--fs)); color: var(--text-muted); }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--rim-bright); border-radius: 12px; color: var(--text);
  padding: 9px 13px; font-size: calc(13px * var(--fs)); font-family: inherit; width: 100%;
}
textarea { min-height: 80px; resize: vertical; font-family: var(--font-mono); font-size: calc(11px * var(--fs)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal-dim); box-shadow: 0 0 0 3px var(--signal-glow); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.check { display: flex; align-items: center; gap: 7px; font-size: calc(12px * var(--fs)); color: var(--text-dim); text-transform: none; letter-spacing: 0; font-family: var(--font-ui); cursor: pointer; }
.check input { width: auto; accent-color: var(--signal); }
.code-input { font-family: var(--font-mono); font-size: calc(20px * var(--fs)); letter-spacing: .4em; text-align: center; }
.label-link { font-size: calc(10px * var(--fs)); text-transform: none; letter-spacing: 0; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 12px; font-size: calc(12px * var(--fs)); margin-bottom: 14px; border: 1px solid; }
.alert-error { color: var(--critical); background: var(--crit-glow); border-color: var(--critical); }
.alert-info  { color: var(--blue); background: var(--blue-glow); border-color: var(--blue); }
.alert-ok    { color: var(--ok); background: var(--ok-glow); border-color: transparent; }
.alert-warn  { color: var(--warn); background: var(--warn-glow); border-color: var(--warn); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--rim); border-radius: 24px; padding: 22px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px var(--shadow); }
.modal-wide { max-width: 760px; }
.modal h3 { font-size: calc(15px * var(--fs)); color: var(--text); margin-bottom: 16px; }
.modal-text { color: var(--text-dim); font-size: calc(13px * var(--fs)); margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-result { color: var(--text-dim); font-size: calc(13px * var(--fs)); }
.dialog-result code, .mono-box { display: block; background: var(--void); border: 1px solid var(--rim); border-radius: 7px; padding: 10px; font-family: var(--font-mono); font-size: calc(11px * var(--fs)); color: var(--text); word-break: break-all; margin: 8px 0; white-space: pre-wrap; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--elevated); border: 1px solid var(--signal-dim); color: var(--text); padding: 10px 18px; border-radius: 8px; font-size: calc(12px * var(--fs)); opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms; z-index: 200; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--critical); color: var(--critical); }

/* Notifications panel */
.notif-wrap { position: relative; }
.notif-panel { position: absolute; right: 0; top: 40px; width: 360px; max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--rim-bright); border-radius: 10px; box-shadow: 0 14px 40px var(--shadow); z-index: 50; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--rim); font-size: calc(11px * var(--fs)); color: var(--text-dim); }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--rim); cursor: pointer; display: flex; gap: 10px; }
.notif-item:hover { background: var(--raised); }
.notif-item.unread .notif-title { color: var(--text); font-weight: 600; }
.notif-sev { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--blue); }
.notif-sev.warn { background: var(--warn); }
.notif-sev.critical { background: var(--critical); }
.notif-title { font-size: calc(12px * var(--fs)); color: var(--text-dim); }
.notif-body { font-size: calc(11px * var(--fs)); color: var(--text-muted); margin-top: 2px; }
.notif-time { font-size: calc(10px * var(--fs)); color: var(--text-muted); font-family: var(--font-mono); margin-top: 3px; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: calc(12px * var(--fs)); }

/* User menu */
.user-wrap { position: relative; }
.user-menu { position: absolute; right: 0; top: 40px; min-width: 220px; background: var(--surface); border: 1px solid var(--rim-bright); border-radius: 10px; padding: 6px; z-index: 50; box-shadow: 0 14px 40px var(--shadow); }
.user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--rim); margin-bottom: 4px; }
.user-menu-head .n { color: var(--text); font-weight: 600; font-size: calc(12px * var(--fs)); }
.user-menu-head .r { color: var(--text-muted); font-size: calc(10px * var(--fs)); font-family: var(--font-mono); margin-top: 2px; }
.user-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text-dim); padding: 8px 10px; border-radius: 6px; font-size: calc(12px * var(--fs)); cursor: pointer; }
.user-menu button:hover { background: var(--raised); color: var(--text); }

/* Banners */
.banner { padding: 10px 20px; font-size: calc(12px * var(--fs)); display: flex; gap: 10px; align-items: center; border-bottom: 1px solid; }
.banner-crit { background: var(--crit-glow); color: var(--critical); border-color: var(--critical); }
.banner-warn { background: var(--warn-glow); color: var(--warn); border-color: var(--warn); }

/* Mobile nav */
.nav-toggle { display: none; background: none; border: 1px solid var(--rim); color: var(--text-dim); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; }
@media (max-width: 640px) {
  .nav-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar.open { display: flex; position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 240px; z-index: 40; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-clock, .user-name { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .chart-wrap { flex-direction: column; align-items: stretch; }
}

/* Views: toolbars, empty states, tabs */
.view-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.view-header-row .view-header { margin-bottom: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; padding: 6px 10px; font-size: calc(12px * var(--fs)); }
.empty { padding: 26px 10px; text-align: center; color: var(--text-muted); font-size: calc(12px * var(--fs)); }
.loading { padding: 30px; text-align: center; color: var(--text-muted); font-family: var(--font-mono); font-size: calc(11px * var(--fs)); letter-spacing: .1em; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rim); margin-bottom: 16px; flex-wrap: wrap; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim); padding: 8px 12px; font-size: calc(12px * var(--fs)); font-weight: 600; cursor: pointer; }
.tab.active { color: var(--text); border-bottom-color: var(--signal); }
.clickable { cursor: pointer; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.small { font-size: calc(11px * var(--fs)); }
.addr { font-family: var(--font-mono); font-size: calc(10px * var(--fs)); color: var(--text-muted); }
.right { text-align: right; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.stat-row-3 { grid-template-columns: repeat(3, 1fr); }
.vault-grid-2 { grid-template-columns: 1fr 1fr; }
.gauge-fg { --pct: 0; }
.queue-item.mine { border-color: var(--signal-dim); }
.queue-item-note { font-size: calc(11px * var(--fs)); color: var(--text-muted); margin-top: 8px; }
.queue-item-note.warn { color: var(--warn); }
.mpc-dot.countersign { border-color: var(--govern); }
.wf-step.rejected .wf-node { border-color: var(--critical); background: var(--crit-glow); }
.wf-step.rejected .wf-label { color: var(--critical); }
.policy-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: calc(12px * var(--fs)); }
.kv dt { color: var(--text-muted); font-family: var(--font-mono); font-size: calc(10px * var(--fs)); letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.kv dd { color: var(--text); word-break: break-word; }
.trail { margin-top: 10px; }
.trail-item { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rim); font-size: calc(11px * var(--fs)); }
.trail-item:last-child { border-bottom: none; }
.trail-time { font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; }
.trail-what { color: var(--text-dim); }
.legend-dot.swatch { display: inline-block; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--elevated); color: var(--text-dim); font-size: calc(10px * var(--fs)); font-family: var(--font-mono); margin: 1px 2px 1px 0; }
.qr { background: #fff; padding: 10px; border-radius: 8px; width: 180px; height: 180px; display: block; margin: 0 auto 12px; }
.secret { font-family: var(--font-mono); font-size: calc(12px * var(--fs)); text-align: center; color: var(--text-dim); word-break: break-all; margin-bottom: 14px; }
@media (max-width: 900px) { .stat-row-3 { grid-template-columns: 1fr 1fr; } .kv { grid-template-columns: 1fr; } }

/* ── Auth portal ── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; }
.auth-aside { background: var(--surface); border-right: 1px solid var(--rim); padding: 40px 36px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.auth-aside h2 { font-size: calc(22px * var(--fs)); color: var(--text); line-height: 1.3; letter-spacing: -.01em; margin: 26px 0 12px; }
.auth-aside p { color: var(--text-dim); font-size: calc(13px * var(--fs)); }
.auth-aside ul { list-style: none; margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.auth-aside li { font-size: calc(12px * var(--fs)); color: var(--text-dim); display: flex; gap: 9px; align-items: flex-start; }
.auth-aside li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); margin-top: 6px; flex-shrink: 0; }
.auth-aside small { color: var(--text-muted); font-family: var(--font-mono); font-size: calc(10px * var(--fs)); letter-spacing: .05em; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: calc(22px * var(--fs)); color: var(--text); letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card .lede { color: var(--text-dim); font-size: calc(13px * var(--fs)); margin-bottom: 22px; }
.auth-card .switch { text-align: center; margin-top: 16px; font-size: calc(12px * var(--fs)); color: var(--text-muted); }
.auth-legal { text-align: center; margin-top: 26px; font-size: calc(10px * var(--fs)); color: var(--text-muted); font-family: var(--font-mono); }
.brand-mobile { display: none; margin-bottom: 22px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 3px; background: var(--rim); border-radius: 2px; }
.steps span.on { background: var(--signal); }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .brand-mobile { display: block; }
}

/* Day theme refinements */

:root[data-theme="light"] .badge-muted { background: var(--raised); }
:root[data-theme="light"] .mpc-dot.filled { box-shadow: none; }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: var(--surface); }
:root[data-theme="light"] .modal-backdrop { backdrop-filter: blur(2px); }

/* Display controls (theme + text size) */
.display-wrap { position: relative; }
.display-btn { background: none; border: 1px solid var(--rim); border-radius: 8px; height: 32px; min-width: 32px; padding: 0 8px; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 700; font-size: calc(12px * var(--fs)); font-family: var(--font-ui); }
.display-btn:hover { border-color: var(--rim-bright); color: var(--text); }
.display-panel { position: absolute; right: 0; top: 40px; width: 270px; background: var(--surface); border: 1px solid var(--rim-bright); border-radius: 10px; padding: 14px; z-index: 60; box-shadow: 0 14px 40px var(--shadow); }
.display-group + .display-group { margin-top: 14px; }
.display-label { font-size: calc(9px * var(--fs)); font-family: var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 7px; display: flex; justify-content: space-between; }
.seg { display: flex; border: 1px solid var(--rim-bright); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; background: transparent; border: none; border-right: 1px solid var(--rim); color: var(--text-dim); padding: 7px 4px; cursor: pointer; font-size: calc(11px * var(--fs)); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; }
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--raised); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--signal-glow); color: var(--signal); }
.seg .sz { font-family: var(--font-ui); line-height: 1; }
.display-preview { margin-top: 10px; font-size: calc(12px * var(--fs)); color: var(--text-dim); }
.display-fab { position: fixed; top: 14px; right: 14px; z-index: 30; }
.display-card .seg { max-width: 420px; }
/* Keep the top bar on one line at large text sizes */
.pill { white-space: nowrap; }
.topbar-pills { min-width: 0; overflow: hidden; }
.topbar-logo, .topbar-right { white-space: nowrap; }
:root[data-text-size="125"] .topbar .logo-sub, :root[data-text-size="150"] .topbar .logo-sub, :root[data-text-size="150"] .topbar-clock { display: none; }

/* ════════ Typography ════════
   Plain sans-serif labels in sentence case instead of spaced monospace capitals,
   pill controls, and no coloured accent bars. */
.stat-label, .card-title, .nav-section-label, th, .field label, .logo-sub, .pill, .queue-approve-btn {
  font-family: var(--font-ui); text-transform: none; letter-spacing: 0;
}
.stat-label { font-size: calc(12px * var(--fs)); font-weight: 500; color: var(--text-dim); }
.card-title { font-size: calc(14px * var(--fs)); font-weight: 600; color: var(--text); }
.nav-section-label { font-size: calc(11px * var(--fs)); font-weight: 500; color: var(--text-muted); }
th { font-size: calc(12px * var(--fs)); font-weight: 500; color: var(--text-muted); }
.field label { font-size: calc(12px * var(--fs)); font-weight: 500; color: var(--text-dim); }
.logo-sub { font-size: calc(12px * var(--fs)); color: var(--text-muted); }
.view-sub { font-family: var(--font-ui); font-size: calc(11px * var(--fs)); letter-spacing: .04em; }
.stat-value { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.02em; }
.stat-card::before { display: none; }
.pill { font-size: calc(11px * var(--fs)); font-weight: 500; }
.queue-item { border-radius: 14px; }
.queue-approve-btn { border-radius: 999px; font-size: calc(12px * var(--fs)); font-weight: 500; padding-left: 14px; padding-right: 14px; }
