/* SIGNAL ROOM 2.1 — "night desk" design system.
   One family (Archivo) driven by its width axis: expanded for the room's voice, condensed for dense data.
   Amber is the room speaking (brand, live, AI); mint/coral only ever mean long/short. */
:root {
  --bg: #0e1726; --bg2: #111c2e; --panel: #152238; --panel2: #1b2b45; --line: #22344f; --line2: #2c4263;
  --text: #e8eef7; --muted: #8fa3bf; --dim: #5d718e;
  --long: #3ddc97; --long-d: rgba(61,220,151,.13); --short: #ff6b6b; --short-d: rgba(255,107,107,.13);
  --warn: #f2b33d; --warn-d: rgba(242,179,61,.14); --info: #7cb7ff; --info-d: rgba(124,183,255,.12);
  --amber: #f2b33d; --violet: #b49cff; --violet-d: rgba(180,156,255,.1);
  --on-accent: #0e1726; --shadow: 0 18px 50px rgba(3,8,18,.55);
  --m-rollover: #5fd3c6; --m-breakfast: #ff9f5a; --m-breakthrough: #ff7eb6; --m-daily-target: #a3b8ff;
  --r-lg: 16px; --r: 10px; --r-sm: 6px; --radius: 10px;
  --sans: "Archivo", system-ui, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 232px; --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--amber);
  color-scheme: dark;
}
:root[data-theme="day"] {
  --bg: #eef2f7; --bg2: #e4eaf2; --panel: #ffffff; --panel2: #f3f6fa; --line: #dbe3ee; --line2: #c8d4e3;
  --text: #0f1b2d; --muted: #52637c; --dim: #8394ab;
  --long: #0b9466; --long-d: rgba(11,148,102,.1); --short: #d63c3c; --short-d: rgba(214,60,60,.09);
  --warn: #b7791f; --warn-d: rgba(183,121,31,.12); --info: #2563c9; --info-d: rgba(37,99,201,.08);
  --amber: #b7791f; --violet: #6b4fd8; --violet-d: rgba(107,79,216,.07);
  --on-accent: #ffffff; --shadow: 0 18px 50px rgba(15,27,45,.16);
  --m-rollover: #0f8a7e; --m-breakfast: #c25e12; --m-breakthrough: #c2266e; --m-daily-target: #3f5bd4;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--sans); font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
body { overflow-x: hidden; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--long); } .down { color: var(--short); } .warn { color: var(--warn); } .info { color: var(--info); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 750; font-variation-settings: "wdth" 112; letter-spacing: -.02em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 600; color: var(--muted); }

/* brand ------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; font-size: 16px; font-weight: 800;
  font-variation-settings: "wdth" 125; letter-spacing: -.01em; }
.brand b { color: var(--amber); font-weight: 800; }
.brand.big { font-size: 24px; padding: 0 0 4px; justify-content: center; }
.brand-mark { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--amber); }
.brand-mark::after { content: ""; width: 14px; height: 9px; border-left: 2.5px solid var(--on-accent); border-bottom: 2.5px solid var(--on-accent);
  transform: skewX(-18deg); clip-path: polygon(0 0, 35% 60%, 60% 25%, 100% 70%, 100% 100%, 0 100%); }

/* shell ------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-group { margin: 14px 10px 4px; font-size: 11.5px; color: var(--dim); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 520; user-select: none; }
.nav-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--panel2); color: var(--text); font-weight: 650; }
.nav-item.active .ico { color: var(--amber); }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge { margin-left: auto; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conn { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.conn.ok .dot { background: var(--long); animation: breathe 2.6s ease-in-out infinite; }
.conn.bad .dot { background: var(--short); }
@keyframes breathe { 50% { box-shadow: 0 0 0 5px transparent, 0 0 0 0 var(--long-d); opacity: .55; } }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.view { padding: 24px; max-width: 1480px; width: 100%; }
.banner { margin: 14px 24px 0; padding: 11px 14px; border-radius: var(--r); background: var(--short-d); border: 1px solid color-mix(in srgb, var(--short) 45%, transparent); color: var(--text); }
.banner.warnb { background: var(--warn-d); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.tabbar { display: none; }
.only-mobile { display: none !important; }

/* chips & status ------------------------------------------------------ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2);
  background: var(--panel); font-size: 12px; white-space: nowrap; color: var(--muted); }
.pill b { font-weight: 650; color: var(--text); }
.pill.long { border-color: color-mix(in srgb, var(--long) 40%, transparent); color: var(--long); background: var(--long-d); }
.pill.short { border-color: color-mix(in srgb, var(--short) 40%, transparent); color: var(--short); background: var(--short-d); }
.pill.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); background: var(--warn-d); }
.pill.info { border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); background: var(--info-d); }
.pill.long b, .pill.short b, .pill.warn b, .pill.info b { color: inherit; }
.pill .live { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: breathe 2.6s ease-in-out infinite; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; text-align: center; background: var(--panel2); border: 1px solid var(--line2); }
.grade { display: inline-grid; place-items: center; min-width: 32px; height: 24px; padding: 0 7px; border-radius: 7px; font-size: 12.5px; font-weight: 800; font-variation-settings: "wdth" 115; }
.grade.gAp { background: var(--amber); color: var(--on-accent); }
.grade.gA { background: var(--warn-d); color: var(--amber); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 45%, transparent); }
.grade.gB { background: var(--info-d); color: var(--info); } .grade.gC { background: var(--panel2); color: var(--muted); }
.side-tag { font-size: 11px; font-weight: 750; padding: 2px 7px; border-radius: 5px; font-variation-settings: "wdth" 110; }
.side-tag.long { background: var(--long-d); color: var(--long); } .side-tag.short { background: var(--short-d); color: var(--short); }
.status { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.status.win, .status.active, .status.target_hit, .status.pass { background: var(--long-d); color: var(--long); }
.status.loss, .status.stopped, .status.fail, .status.frozen { background: var(--short-d); color: var(--short); }
.status.open { background: var(--info-d); color: var(--info); }
.status.expired { background: var(--warn-d); color: var(--warn); }

/* controls ------------------------------------------------------------ */
.btn { font: 600 13px var(--sans); color: var(--text); background: var(--panel2); border: 1px solid var(--line2); padding: 8px 14px; border-radius: 9px;
  cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--dim); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--amber); color: var(--on-accent); border-color: var(--amber); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { border-color: color-mix(in srgb, var(--short) 50%, transparent); color: var(--short); background: var(--short-d); }
.btn.danger.on { background: var(--short); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.icon-btn { background: var(--panel); border: 1px solid var(--line2); color: var(--text); border-radius: 9px; width: 36px; height: 34px; font-size: 16px; cursor: pointer; display: inline-grid; place-items: center; }
input, select, textarea { font: 14px var(--sans); color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--warn-d); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 520; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text); flex-direction: row; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .sw { width: 36px; height: 20px; border-radius: 99px; background: var(--line2); position: relative; transition: .2s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .2s; }
.toggle input:checked + .sw { background: var(--long-d); box-shadow: inset 0 0 0 1px var(--long); }
.toggle input:checked + .sw::after { left: 18px; background: var(--long); }
.toggle input:focus-visible + .sw { box-shadow: var(--focus); }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 5px 12px; cursor: pointer; font: 600 12.5px var(--sans); border-radius: 7px; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 var(--line2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12.5px; cursor: pointer; color: var(--muted); user-select: none; }
.chip.on { border-color: var(--amber); color: var(--amber); background: var(--warn-d); }

/* surfaces ------------------------------------------------------------ */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.quiet { background: transparent; border-style: dashed; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card.flush .card-head { padding: 16px 18px 4px; margin-bottom: 6px; }
.card-head a { font-size: 12.5px; font-weight: 600; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 72ch; }
/* KPI strip: one surface divided into cells, not a row of identical cards */
.kpis { display: grid; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpis .kpi { border: 0; border-radius: 0; background: transparent; border-left: 1px solid var(--line); }
.kpis .kpi:first-child { border-left: 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px 18px; min-width: 0; }
.kpi .k { font-size: 12.5px; color: var(--muted); font-weight: 560; }
.kpi .v { font-size: 23px; font-weight: 720; font-variation-settings: "wdth" 108; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.sep { height: 1px; background: var(--line); margin: 16px 0; }

/* the room's voice: regime hero -------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; }
.hero-regime { padding: 22px 26px 24px; position: relative; overflow: hidden; }
.hero-regime .lbl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 560; }
.hero-regime .lbl .live { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); animation: breathe 2.6s ease-in-out infinite; }
.regime-word { margin: 4px 0 6px; font-size: clamp(44px, 7.4vw, 104px); line-height: .9; font-weight: 880; font-variation-settings: "wdth" 125;
  letter-spacing: -.035em; color: var(--rc, var(--text)); }
.regime-notes { color: var(--muted); max-width: 62ch; font-size: 13.5px; }
.regime-meter { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.regime-meter b { color: var(--text); font-weight: 680; font-size: 15px; display: block; }
.hero-book { padding: 22px 24px; border-left: 1px solid var(--line); background: var(--panel2); display: flex; flex-direction: column; gap: 14px; }
.hero-book .big { font-size: clamp(30px, 3.4vw, 42px); font-weight: 780; font-variation-settings: "wdth" 112; letter-spacing: -.02em; line-height: 1; }
.hero-book .sub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 12.5px; color: var(--muted); }
.hero-book .sub b { display: block; color: var(--text); font-size: 15px; font-weight: 680; }

/* tables -------------------------------------------------------------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; background: var(--panel); font-variation-settings: "wdth" 92; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
tr.click { cursor: pointer; }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
td.sym, .sym { font-weight: 680; font-variation-settings: "wdth" 104; }

/* signal feed ----------------------------------------------------------- */
.feed { display: flex; flex-direction: column; }
.sig { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.sig:hover { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
.sig.fresh { animation: flash 2.8s ease-out; }
@keyframes flash { 0% { background: var(--warn-d); } 100% { background: transparent; } }
.sig .sym { font-size: 15.5px; }
.sig .conf { font-weight: 720; font-size: 15px; }
.sig .meta { font-size: 12px; color: var(--muted); grid-column: 2 / 4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig .why { grid-column: 2 / 4; font-size: 12.5px; color: var(--text); opacity: .82; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* heat ------------------------------------------------------------------ */
.heat { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--line2); position: relative; vertical-align: middle; overflow: hidden; }
.heat i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--amber); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.tile { border-radius: 10px; padding: 9px 11px; border: 1px solid var(--line); cursor: pointer; min-width: 0; }
.tile .t1 { font-weight: 720; font-size: 13px; font-variation-settings: "wdth" 104; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t2 { font-size: 11.5px; opacity: .9; }

/* bars ------------------------------------------------------------------ */
.bar { height: 8px; border-radius: 4px; background: var(--line2); position: relative; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.bar .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--dim); z-index: 1; }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 12px; font-size: 13px; }
.meter-row .bar { grid-column: 1 / 3; }

/* modes: one strip of four lanes on Command, full cards on Modes ---------- */
.lanes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; }
.lane { padding: 15px 18px; border-left: 1px solid var(--line); color: inherit; text-decoration: none !important; display: block; min-width: 0; }
.lane:first-child { border-left: 0; }
.lane:hover { background: var(--panel2); }
.lane .name { font-weight: 780; font-variation-settings: "wdth" 118; color: var(--accent); font-size: 14px; letter-spacing: .01em; }
.lane .bal { font-size: 19px; font-weight: 700; margin-top: 6px; }
.mode-card { position: relative; overflow: hidden; border-top: 3px solid var(--accent, var(--amber)); }
.mode-card .title { font-size: 21px; font-weight: 840; font-variation-settings: "wdth" 122; letter-spacing: -.01em; }
.mode-card .tag { color: var(--muted); font-size: 13px; margin-top: 2px; }
.checks { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.check .ic { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: none; font-weight: 800; }
.check.ok .ic { background: var(--long-d); color: var(--long); } .check.no .ic { background: var(--short-d); color: var(--short); }
.check .val { margin-left: auto; color: var(--muted); }

/* DEX safety ----------------------------------------------------------- */
.shield { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; }
.shield.ok { background: var(--long-d); color: var(--long); } .shield.mid { background: var(--warn-d); color: var(--warn); }
.shield.bad { background: var(--short-d); color: var(--short); } .shield.none { background: var(--panel2); color: var(--muted); }
.streak { display: inline-flex; gap: 2px; vertical-align: middle; }
.streak i { width: 5px; height: 12px; border-radius: 2px; background: var(--line2); }
.streak i.on { background: var(--long); }

/* drawer & modal ------------------------------------------------------- */
.drawer-back, .modal-back { position: fixed; inset: 0; background: rgba(5,10,20,.6); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(740px, 100vw); background: var(--bg2); border-left: 1px solid var(--line2); z-index: 41;
  overflow-y: auto; padding: 20px 22px 44px; animation: slidein .22s ease-out; box-shadow: var(--shadow); }
@keyframes slidein { from { transform: translateX(28px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-back { display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.modal h2 { font-size: 18px; margin-bottom: 6px; }
.chart { height: 340px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.chart.small { height: 220px; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.level { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.level .k { font-size: 12px; color: var(--muted); }
.level .v { font-weight: 700; font-size: 15px; }
.reasons { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.reasons li::marker { color: var(--long); }
.reasons.w li::marker { color: var(--warn); }
.brief { background: var(--violet-d); border: 1px solid color-mix(in srgb, var(--violet) 35%, transparent); border-radius: var(--r); padding: 13px 15px; }
.brief .lbl { font-size: 12.5px; font-weight: 700; color: var(--violet); margin-bottom: 4px; }
.feat { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 16px; font-size: 12.5px; }
.feat div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 3px 0; gap: 8px; }
.feat span:first-child { color: var(--muted); }

/* analyst --------------------------------------------------------------- */
.md p { margin: 0 0 8px; } .md ul { margin: 0 0 8px; padding-left: 18px; } .md h4 { margin: 12px 0 4px; font-size: 13.5px; color: var(--amber); }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.msg { padding: 10px 13px; border-radius: 12px; max-width: 92%; }
.msg.u { align-self: flex-end; background: var(--panel2); border: 1px solid var(--line2); }
.msg.a { align-self: flex-start; background: var(--violet-d); border: 1px solid color-mix(in srgb, var(--violet) 30%, transparent); }
.usage { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.usage .bar { flex: 1; min-width: 140px; }

/* toasts ---------------------------------------------------------------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--info); border-radius: 11px; padding: 11px 14px; font-size: 13px;
  box-shadow: var(--shadow); animation: slidein .2s; cursor: pointer; }
.toast.long { border-left-color: var(--long); } .toast.short, .toast.error { border-left-color: var(--short); } .toast.warn { border-left-color: var(--warn); }

/* login ----------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 20px; padding: 30px 26px; box-shadow: var(--shadow); }
.login-card p { margin: 0; text-align: center; font-size: 13.5px; }
.err { color: var(--short); min-height: 18px; font-size: 13px; text-align: center; }

/* responsive ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main, .g3 { grid-template-columns: 1fr; }
  .kpis.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.g4 .kpi:nth-child(3) { border-left: 0; } .kpis.g4 .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lane:nth-child(3) { border-left: 0; } .lane:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .hero-book { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .top-actions .btn { padding: 5px 9px; font-size: 12px; }
  .pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .view { padding: 16px 12px 96px; }
  h1 { font-size: 23px; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .kpi { padding: 12px 14px; } .kpi .v { font-size: 19px; }
  .hero-regime { padding: 18px 18px 20px; } .hero-book { padding: 18px; }
  .regime-word { font-size: clamp(40px, 14vw, 64px); }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: color-mix(in srgb, var(--bg2) 96%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; text-decoration: none; }
  .tabbar a .ico { font-size: 17px; }
  .tabbar a.active { color: var(--amber); }
  .chart { height: 260px; }
  .drawer { padding: 16px 14px 44px; }
  .toasts { left: 12px; right: 12px; bottom: 78px; max-width: none; }
  .banner { margin: 10px 12px 0; }
  .sig { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

details.fold > summary { cursor: pointer; padding: 14px 18px; font-weight: 650; color: var(--muted); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; display: inline-block; margin-right: 8px; transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
td .sub { display: block; font-size: 11.5px; color: var(--dim); font-weight: 450; }
