:root {
  --bg: #0f1419; --panel: #1a2029; --line: #2a3340; --fg: #e6edf3;
  --muted: #8b98a5; --buy: #2ea043; --sell: #f85149; --accent: #58a6ff;
  --rev-q: #d29922;   /* single-quarter revenue series (amber; CVD-safe vs accent) */
  --head-h: 53px;     /* sticky header height (top-bar 52 + border) —
                         table `th { top }` depends on it; keep the two in sync */
  --side-w: 232px;    /* left menu rail width (desktop) */
  --pad-x: 20px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }

/* ---- sticky one-row header: brand + search + menu button ---- */
header.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-bar {
  display: flex; align-items: center; gap: 14px; height: 52px;
  padding-left: max(var(--pad-x), env(safe-area-inset-left));
  padding-right: max(var(--pad-x), env(safe-area-inset-right));
}
.brand { font-size: 16px; margin: 0; font-weight: 600; white-space: nowrap; }
.brand a { color: inherit; }
.tagline { font-size: 12px; white-space: nowrap; }

/* ---- left menu panel (.side) ----
   Desktop (≥1100px): fixed full-height rail; .app reserves its width.
   Below that: off-canvas drawer sliding in from the left over a scrim. */
.side {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w);
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 30;
  padding-left: env(safe-area-inset-left);
}
.side-head {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  height: var(--head-h); padding: 0 14px; border-bottom: 1px solid var(--line);
}
.side-title { font-weight: 600; }
.side-close { background: none; border: none; color: var(--muted); font-size: 16px;
  cursor: pointer; padding: 4px 6px; }
.side-close:hover { color: var(--fg); }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.side-sec { color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; margin: 14px 6px 5px; }
.side-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 6px; color: var(--fg); font-size: 13.5px; }
.side-ic { flex: none; width: 18px; text-align: center; }
.side-link:hover { background: rgba(88,166,255,.08); color: var(--accent); }
.side-link.active { background: rgba(88,166,255,.15); color: var(--accent); font-weight: 600; }
.side-link.sub { padding: 6px 10px 6px 37px; font-size: 13px; color: var(--muted); }
.side-link.sub:hover, .side-link.sub.active { color: var(--accent); }
.side-foot {
  flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--line);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.side-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.side-foot-l { font-size: 12px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-user-mail { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-out { font-size: 12px; flex: none; }
.menu-btn { flex: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; color: var(--fg); width: 38px; height: 32px; font-size: 16px;
  line-height: 1; cursor: pointer; padding: 0; }
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 29;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.scrim.show { opacity: 1; pointer-events: auto; }
body.no-scroll { overflow: hidden; }
@media (min-width: 1100px) {
  .app { padding-left: var(--side-w); }
  .menu-btn, .scrim, .side-close { display: none; }
}
@media (max-width: 1099.98px) {
  .side {
    width: min(320px, 86vw); box-shadow: 12px 0 32px rgba(0,0,0,.5);
    transform: translateX(-103%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  .side.open { transform: none; visibility: visible; transition: transform .22s ease; }
}
@media (prefers-reduced-motion: reduce) { .side, .scrim { transition: none; } }
.wrap {
  max-width: 1200px; margin: 0 auto; padding: 18px var(--pad-x);
  padding-left: max(var(--pad-x), env(safe-area-inset-left));
  padding-right: max(var(--pad-x), env(safe-area-inset-right));
}
.tabs { display: flex; gap: 8px; }
.tab, .ctrl {
  background: var(--panel); border: 1px solid var(--line); color: var(--fg);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.tab.active { border-color: var(--accent); color: var(--accent); }
.tab.sell.active { border-color: var(--sell); color: var(--sell); }
.tab.buy.active  { border-color: var(--buy);  color: var(--buy); }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.controls label { color: var(--muted); font-size: 12px; }
input.ctrl { width: 120px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; text-align: right; cursor: default; position: sticky; top: var(--head-h); background: var(--bg); }
th.l, td.l { text-align: left; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel); }
.tk { font-weight: 600; color: var(--accent); }
.name { color: var(--muted); font-size: 12px; }
.pos { color: var(--buy); } .neg { color: var(--sell); }
.badge { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.buy { background: rgba(46,160,67,.15); color: var(--buy); }
.badge.sell { background: rgba(248,81,73,.15); color: var(--sell); }
.badge.other { background: rgba(139,152,165,.15); color: var(--muted); }
.badge.warn { background: rgba(210,153,34,.18); color: #d29922; }
.badge.info { background: rgba(88,166,255,.15); color: var(--accent); }
.warn-t { color: #d29922; }
.muted { color: var(--muted); }
.kpis { display: flex; flex-wrap: wrap; gap: 24px; margin: 8px 0 20px; }
.kpi small { color: var(--muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kpi b { font-size: 18px; font-weight: 600; }
.section-h { margin: 26px 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.empty, .err { padding: 40px; text-align: center; color: var(--muted); }
.err { color: var(--sell); }
.back { font-size: 13px; }
/* dashboard */
/* min(320px, 100%) lets cards shrink below 320px on very narrow phones
   instead of overflowing the viewport */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px 0 6px; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.card-h a { font-size: 12px; font-weight: 400; }
.card-h-r { display: flex; align-items: center; gap: 10px; }
/* segmented period switch */
.pswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.pbtn { background: var(--panel); border: 0; border-left: 1px solid var(--line);
  color: var(--muted); padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pbtn:first-child { border-left: 0; }
.pbtn:hover { color: var(--fg); }
.pbtn.active { background: var(--accent); color: #0b1220; }
.card table { font-size: 13px; }
.card th { position: static; top: auto; }
.card td, .card th { padding: 6px 14px; }
/* pipeline monitoring */
.card.mon { margin-top: 16px; }
.mon-chips { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 14px; }
.mon-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; min-width: 200px; }
.mon-dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.mon-chip.ok    .mon-dot { background: var(--buy); box-shadow: 0 0 6px rgba(46,160,67,.6); }
.mon-chip.stale .mon-dot { background: #d29922; }
.mon-chip.bad   .mon-dot { background: var(--sell); box-shadow: 0 0 6px rgba(248,81,73,.6); }
.mon-chip.bad { border-color: rgba(248,81,73,.4); }
.mon-job { font-weight: 600; font-size: 13px; }
.mon-sub { font-size: 12px; }
.card.mon table { font-size: 12px; }
.card.mon .empty code { color: var(--accent); }
/* nav */
.nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.navlink { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 13px; }
.navlink.active { border-color: var(--accent); color: var(--accent); }
/* finviz-style summary */
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.metric { display: flex; justify-content: space-between; gap: 8px; padding: 7px 11px; background: var(--panel); }
.m-l { color: var(--muted); font-size: 12px; }
.m-v { font-weight: 600; font-size: 13px; }
/* revenue trend chart */
.chart-wrap { position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px 4px; margin: 4px 0 6px; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-bar { fill: var(--accent); transition: fill .12s; }
.chart-bar.hi { fill: #79b8ff; }
.chart-base { stroke: var(--line); stroke-width: 1; }
.chart-x, .chart-gval { fill: var(--muted); font-size: 10px; }
.chart-last { fill: var(--fg); font-size: 11px; font-weight: 600; }
.chart-hit { fill: transparent; cursor: default; }
.chart-legend { display: flex; gap: 16px; justify-content: flex-end; padding: 0 2px 4px; }
.chart-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.chart-leg i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.chart-tip { position: absolute; top: 6px; transform: translateX(-50%);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
  pointer-events: none; z-index: 3; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.chart-tip b { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 3px; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip-row i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-tip-v { margin-left: auto; padding-left: 14px; }
.chart-tip-yoy { color: var(--muted); font-weight: 400; margin-top: 2px; }

/* macro scenario map (#/scenarios) */
.sc-head { margin-bottom: 14px; }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 480px) { .sc-grid { grid-template-columns: 1fr; } }
.sc-card { display: flex; flex-direction: column; }
.sc-card .card-h { gap: 10px; }
.sc-card .card-h > span:first-child { display: flex; align-items: baseline; gap: 9px; }
.sc-card .card-h .badge { flex: none; white-space: nowrap; }
.sc-num {
  flex: none; align-self: center; width: 22px; height: 22px; border-radius: 999px;
  background: rgba(88,166,255,.15); color: var(--accent);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.sc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.sc-thesis { margin: 0 0 12px; font-size: 13px; line-height: 1.55; }
.sc-sub { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.sc-metrics { margin: 0 0 12px; padding-left: 18px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.sc-metrics li { margin: 3px 0; }
.sc-metrics li::marker { color: var(--accent); }
.sc-call { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.45; margin-top: 7px; }
.sc-metrics + .sc-call { margin-top: auto; padding-top: 7px; }
.sc-call .badge { flex: none; margin-top: 1px; }
/* the causal-spine widget */
.spine-body { padding: 12px 14px 14px; }
.spine-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 12px; }
.spine-step {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 12.5px; font-weight: 600;
}
.spine-arrow { color: var(--muted); font-size: 13px; }
.spine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 8px; }
.spine-l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-right: 3px; }
.spine-chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--fg);
  padding: 3px 9px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.spine-chip:hover { border-color: var(--accent); color: var(--accent); }
.spine-chip:hover .muted { color: var(--accent); }
/* allow the long trigger column to wrap instead of forcing a wide table */
td.sc-wrap { white-space: normal; min-width: 260px; line-height: 1.45; }
/* live signal chips (macro_series data) */
.sig-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.sig { background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px 3px; min-width: 148px; }
.sig-t { display: flex; align-items: baseline; gap: 7px; margin-bottom: 1px; }
.sig-l { color: var(--muted); font-size: 11px; }
.sig-v { font-weight: 600; font-size: 13px; margin-left: auto; }
.sig-d { color: var(--muted); font-size: 11px; }
.spark { display: block; }
/* regime monitor (#/regimes) */
.rm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-chip { border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600;
  white-space: nowrap; color: var(--muted); background: rgba(139,152,165,.12); }
.rm-chip.met { color: #56d364; background: rgba(46,160,67,.22); }
.rm-chip.unmet { color: #ff7b72; background: rgba(248,81,73,.20); }
.rm-score { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.rm-score b { font-size: 17px; }
.rm-gates { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rm-gate { background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 9px; font-size: 12px; }
.rm-readout { margin-top: 12px; padding: 9px 11px; border-left: 3px solid var(--line);
  color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.sc-card table { font-size: 12.5px; }
.sc-card td, .sc-card th { padding: 6px 8px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .8; }
.spark-dot { fill: var(--accent); }
/* global metrics (#/scenarios) — full-size line charts */
.gm-body { padding: 12px 16px 16px; display: grid; gap: 22px; }
.gm-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.gm-h .pswitch { margin-left: auto; }
.gm-h .pbtn { padding: 3px 9px; font-size: 11px; }
.gm-l { font-weight: 600; font-size: 13px; }
.gm-v { font-weight: 600; font-size: 14px; }
.gm-desc { color: var(--muted); font-size: 12px; margin-top: 6px; max-width: 900px; line-height: 1.5; }
.gm-plot { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 2px; }
.gm-plot svg { display: block; width: 100%; height: auto; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart-grid { stroke: var(--line); stroke-width: 1; opacity: .55; }
.chart-cross { stroke: var(--muted); stroke-width: 1; opacity: .7; }

.search { position: relative; margin-left: auto; flex: 0 1 300px; min-width: 0; }
.search-in {
  background: var(--panel); border: 1px solid var(--line); color: var(--fg);
  padding: 7px 12px; border-radius: 6px; font-size: 16px; width: 100%; outline: none;
}
/* 16px input font stops iOS Safari from zooming the page on focus; render at 13px elsewhere */
@media (min-width: 641px) { .search-in { font-size: 13px; } }
.search-in:focus { border-color: var(--accent); }
.search-pop {
  position: absolute; right: 0; top: 38px; width: 340px; max-width: 88vw;
  max-height: 360px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.search-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.search-row.hi, .search-row:hover { background: var(--bg); }
.search-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* ---- HARSI screener / price+HARSI panel (TradingView Lightweight Charts) ---- */
.tv-card { margin: 14px 0; }
.tv-card .card-h .chart-legend { padding: 0; }
.tv-chart { height: 430px; padding: 4px 6px 6px; }
.ctrl-check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; cursor: pointer; }
.ctrl-check input { accent-color: var(--accent); }

/* ---- theme strength (#/themes) ---- */
.tsbar { display: inline-flex; align-items: center; gap: 7px; justify-content: flex-end; }
.tsbar i { width: 46px; height: 6px; border-radius: 3px; background: var(--line); position: relative; display: inline-block; }
.tsbar i b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.tsbar i.buy b { background: var(--buy); }
.tsbar i.sell b { background: var(--sell); }
.tsbar i.mid b { background: var(--accent); opacity: .75; }

/* ---- confirmed insider-buy badges (asset page) ---- */
.sigb-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.sigb { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }

/* ---- themes: sortable headers + legend ---- */
.sorth { cursor: pointer; user-select: none; white-space: nowrap; }
.sorth:hover, .sorth.active { color: var(--accent); }
.legend { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; padding: 12px 16px; font-size: 12px; }
.legend b { white-space: nowrap; }
.legend span { color: var(--muted); }
@media (max-width: 640px) { .legend { grid-template-columns: 1fr; gap: 2px; } .legend span { margin-bottom: 6px; } }

/* ---- AI market summary card ---- */
.ai-body { max-height: 300px; overflow: hidden; padding: 6px 16px 0; position: relative; font-size: 13px; }
.ai-body:not(.open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 70px;
  background: linear-gradient(transparent, var(--panel)); }
.ai-body.open { max-height: none; }
.ai-h { font-weight: 600; margin: 12px 0 6px; }
.ai-li { margin: 3px 0 3px 14px; }
.ai-p { margin: 7px 0; }
.ai-more { display: block; width: 100%; background: none; border: none; border-top: 1px solid var(--line);
  color: var(--accent); padding: 9px; cursor: pointer; font: inherit; font-size: 12px; margin-top: 6px; }
.ai-more:hover { color: var(--fg); }
.ai-hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.ai-cite { font-size: 10px; vertical-align: super; margin: 0 1px; text-decoration: none; }
.ai-body a { word-break: break-all; }

/* ---- SSL chart markers ---- */
.ssl-ct { fill: var(--buy); stroke: var(--bg); stroke-width: 1; }
.ssl-r3 { fill: none; stroke: var(--buy); stroke-width: 2.5; }
.card .kpis { padding: 0 16px; margin-bottom: 10px; }

/* ---- estimates scorecard (asset page + screener) ---- */
.est-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; font-size: 13px; }
.est-total { font-weight: 700; font-size: 16px; padding: 2px 10px; border-radius: 6px; }
.est-total.green { background: rgba(46,160,67,.18); color: var(--buy); }
.est-total.olive { background: rgba(210,153,34,.18); color: #d29922; }
.est-total.red   { background: rgba(248,81,73,.18); color: var(--sell); }
.est-total.na    { background: rgba(139,152,165,.15); color: var(--muted); }
.est-total.dim   { font-size: 13px; font-weight: 600; padding: 1px 8px; }
.est-stars { color: #d29922; letter-spacing: 2px; }
.est-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px; }
.est-block { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; }
.est-bh { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 12px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.est-bh.green { background: rgba(46,160,67,.22); color: var(--buy); }
.est-bh.olive { background: rgba(210,153,34,.20); color: #d29922; }
.est-bh.red   { background: rgba(248,81,73,.20); color: var(--sell); }
.est-bh.na    { background: rgba(139,152,165,.15); color: var(--muted); }
.est-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px;
  border-top: 1px solid var(--line); font-size: 13px; }
.est-l { color: var(--muted); font-size: 12px; flex: 1; white-space: nowrap; }
.est-v { font-weight: 600; margin-left: auto; white-space: nowrap; }
.est-s { flex: none; width: 18px; text-align: center; border-radius: 4px; font-size: 12px;
  font-weight: 700; }
.est-s.s4 { background: rgba(46,160,67,.30); color: var(--buy); }
.est-s.s3 { background: rgba(46,160,67,.15); color: var(--buy); }
.est-s.s2 { background: rgba(210,153,34,.18); color: #d29922; }
.est-s.s1 { background: rgba(248,81,73,.14); color: var(--sell); }
.est-s.s0 { background: rgba(248,81,73,.28); color: var(--sell); }
.est-s.sna { color: var(--muted); }
.est-b { font-weight: 600; }
.est-b.green { color: var(--buy); }
.est-b.olive { color: #d29922; }
.est-b.red   { color: var(--sell); }

/* ---- responsive (phone) layer ---- */
/* Every Table renders inside .tbl; on desktop it is a plain block (so sticky
   column headers keep working), on phones it scrolls horizontally. */
.tbl { min-width: 0; }
@media (max-width: 720px) {
  :root { --pad-x: 12px; }
  .wrap { padding-top: 12px; }
  .tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl th { position: static; }        /* sticky can't escape a scroll container */
  th, td { padding: 7px 8px; }
  .card td, .card th { padding: 6px 10px; }
  h2 { font-size: 17px; }
  .top-bar { gap: 10px; }
  .brand { font-size: 15px; }
  .controls { gap: 8px; }
  input.ctrl { width: 96px; }
  .kpis { gap: 14px 18px; }
  .kpi b { font-size: 16px; }
  .tv-chart { height: 320px; }
  .mon-chip { min-width: 0; flex: 1 1 46%; }
  .summary { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .est-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ---- auth pages (landing / awaiting-approval / denied) ---- */
.auth-page {
  min-height: 100vh; position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 40px max(var(--pad-x), env(safe-area-inset-left));
}
.auth-lang { position: absolute; top: 14px; right: max(14px, env(safe-area-inset-right)); }
.auth-logo { font-size: 46px; line-height: 1; }
.auth-page h1 { margin: 14px 0 4px; font-size: 26px; }
.auth-tag { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.auth-feats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-width: 480px; margin-bottom: 18px; }
.auth-feat { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  font-size: 12.5px; }
.auth-desc { max-width: 460px; color: var(--muted); font-size: 14px; line-height: 1.65;
  margin: 0 0 22px; }
.auth-desc b { color: var(--fg); }
.auth-about { max-width: 580px; font-size: 14px; line-height: 1.65; margin: 0 0 14px; }
.auth-about p { margin: 0 0 10px; }
.auth-disc { max-width: 580px; text-align: left; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  margin: 0 0 22px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.auth-disc b { display: block; color: var(--fg); font-size: 13px; margin-bottom: 6px; }
.auth-disc p { margin: 0 0 8px; }
.auth-disc p:last-child { margin-bottom: 0; }
.auth-disc .auth-accept { color: var(--fg); font-weight: 600; }
.btn-primary { background: var(--accent); color: #0b1220; border: none; border-radius: 8px;
  padding: 10px 28px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-primary:hover { filter: brightness(1.12); }
.auth-note { font-size: 12px; margin-top: 16px; }
.auth-setup { margin-top: 14px; font-size: 13px; padding: 0; }
.auth-actions { display: flex; gap: 10px; align-items: center; }
.auth-out { line-height: 1.5; }
.user-actions { display: inline-flex; gap: 6px; }
.user-actions .ctrl { padding: 3px 10px; font-size: 12px; }

/* ---- language switcher (side-panel footer) ---- */
.lang-sw { flex: none; }
.lang-sw .pbtn { padding: 4px 8px; font-size: 11px; letter-spacing: .03em; }

/* master-matrix regime name/description column: wrap the long tag so the
   Signature and Status columns stay in view */
td.rm-name { max-width: 400px; }
@media (max-width: 720px) { td.rm-name { min-width: 200px; max-width: 260px; } }

/* tactical table (scenarios): wrap the Call column so Now/Signal/Level-trigger
   stay in view; the trigger column already wraps via sc-wrap */
td.tac-call { min-width: 170px; max-width: 240px; }
