/* Bingwa Control Room — "signal" design system (dark first; light in cloud.css).
   Self-hosted fonts only: the CSP allows nothing from outside. */
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-500.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }

:root {
  --ink: #070b10;          /* page */
  --side: #090e14;         /* sidebar */
  --panel: #0e151c;        /* card */
  --panel-2: #121b25;      /* raised / hover */
  --well: #0a1117;         /* inset tiles */
  --line: #1c2733;
  --line-2: #26333f;
  --text: #e8eef5;
  --text-2: #c9d4e0;
  --muted: #93a1b3;
  --faint: #7d8b9d;
  --signal: #34d399;       /* accent */
  --signal-2: #a3e635;     /* accent gradient end */
  --signal-ink: #04140d;   /* text on accent */
  --signal-soft: rgba(52, 211, 153, .14);
  --signal-dim: #1c6b47;
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .14);
  --coral: #f87171;
  --coral-soft: rgba(248, 113, 113, .14);
  --sky: #60a5fa;
  --sky-soft: rgba(96, 165, 250, .14);
  --violet: #c4b5fd;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .45);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side-w: 256px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1000px 520px at 78% -12%, rgba(52, 211, 153, .09), transparent 60%),
    radial-gradient(760px 420px at 0% 110%, rgba(96, 165, 250, .06), transparent 60%),
    var(--ink);
  background-attachment: fixed;
  color: var(--text);
  font: 14.5px/1.5 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 650; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--signal); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sec-note { margin: 10px 0 0; }
.lic-row { margin-top: 12px; }
code { font-family: var(--mono); font-size: .92em; }
kbd { font-family: var(--mono); font-size: 11px; color: var(--text-2); padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel-2); }
svg { flex: none; }
.ico { display: inline-flex; align-items: center; justify-content: center; }
.ico svg { width: 18px; height: 18px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ── Buttons & inputs ─────────────────────────────────────────────── */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  min-height: 40px; padding: 8px 14px; border-radius: 11px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .2s, border-color .2s, color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--line-2); background: #172230; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { background: var(--signal); color: var(--signal-ink); border-color: transparent; }
.btn.primary:hover { background: #5ee9b0; }
.btn.danger { color: var(--coral); border-color: rgba(248, 113, 113, .35); background: transparent; }
.btn.danger:hover { background: var(--coral-soft); }
.btn.warn { color: var(--amber); border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .06); }
.btn.warn:hover { background: var(--amber-soft); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; padding: 13px; margin-top: 16px; }
.small-btn { min-height: 32px; padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn.on { border-color: var(--signal); color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 12.5px; padding: 0; }
.linkbtn.strong { color: var(--signal); text-decoration: none; font-weight: 650; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }
input, textarea, select {
  width: 100%; background: var(--well); color: var(--text); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; font: inherit; outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 14px; font-weight: 500; margin: 12px 0 0; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--signal); }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--text-2); border-radius: 999px;
  min-height: 32px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); }
.chip.on { color: var(--ink); background: var(--text); border-color: var(--text); font-weight: 700; }
.chip .n { color: var(--faint); font-variant-numeric: tabular-nums; }
.chip.on .n { color: inherit; opacity: .7; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--well); border: 1px solid var(--line); }
.seg-btn { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 650; padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.seg-btn.on { background: var(--line); color: var(--text); }
.search-sm { width: 260px; max-width: 100%; padding: 8px 12px; }

/* ── Brand ────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 16px; letter-spacing: -.01em; }
.brand b { font-weight: 800; }
.login .brand b { color: var(--signal); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--signal), var(--signal-2));
  -webkit-mask: none; position: relative; box-shadow: 0 0 24px rgba(52, 211, 153, .25);
}
.logo::after {
  content: ""; position: absolute; inset: 0; background: var(--signal-ink);
  -webkit-mask: url("mark.svg") center / 64% no-repeat; mask: url("mark.svg") center / 64% no-repeat;
}

/* ── Login ────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px; }
.login-glow {
  position: absolute; width: min(110vmin, 1000px); aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(52, 211, 153, .18), transparent 25%, transparent 60%, rgba(96, 165, 250, .12), transparent 85%);
  filter: blur(40px); animation: spin 18s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-card {
  position: relative; width: min(420px, 100%); background: rgba(14, 21, 28, .88); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 24px; padding: 30px; box-shadow: var(--shadow);
}
.login-card .muted { margin: 10px 0 4px; }
.msg { color: var(--coral); min-height: 1.4em; margin: 12px 0 0; font-size: 14px; }
.forgot { display: block; margin: 14px auto 0; }
.login-hint { margin-top: 14px; }
.info-body { margin: 14px 0 4px; color: var(--muted); }
.info-body code { display: block; background: var(--well); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--text); white-space: pre-wrap; word-break: break-all; margin: 10px 0; }

/* ── App shell ────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 12px 14px; background: rgba(9, 14, 20, .92); border-right: 1px solid #141e28; overflow-y: auto;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.mode { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 650; font-size: 13px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.mode.on { background: var(--text); color: var(--ink); font-weight: 750; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-h { font-size: 10.5px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 10px; border-radius: 10px; border: 0; background: none;
  color: #aebbca; font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer; text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; opacity: .9; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.on { background: linear-gradient(90deg, rgba(52, 211, 153, .16), rgba(52, 211, 153, .02)); color: var(--text); box-shadow: inset 2px 0 0 var(--signal); }
.nav-item.on svg { color: var(--signal); }
.nav-item .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-card { padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.side-card .t { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); font-size: 13.5px; }
.side-card.tip { flex-direction: row; gap: 10px; align-items: flex-start; }
.side-card.tip svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.me-row { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid #141e28; }
.me-row .icon-btn { width: 36px; height: 36px; margin-left: auto; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: 12px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 11px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px; color: var(--text); background: #1b2a3a; letter-spacing: .02em;
}
.avatar.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 17px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center; padding: 14px 26px;
  background: rgba(7, 11, 16, .8); backdrop-filter: blur(14px); border-bottom: 1px solid #121b25;
}
.page-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; margin-right: 6px; }
.page-title small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.search-trigger {
  flex: 1 1 320px; max-width: 480px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 13px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
}
.search-trigger:hover { border-color: #33465a; color: var(--text-2); }
.search-trigger .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 10px; height: 32px; border-radius: 999px; border: 1px solid var(--line); }
.live-dot span { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.live-dot.on { color: var(--signal); border-color: rgba(52, 211, 153, .3); background: var(--signal-soft); }
.live-dot.on span { background: var(--signal); animation: ping 2s infinite; }
.live-dot em { font-style: normal; font-weight: 600; }
.live-mini { font-size: 12px; color: var(--signal); font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
.live-mini::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } }
.only-mobile { display: none; }
.tabbar { display: none; }
.page { padding: 20px 26px 48px; display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 1640px; }
.phone-pick { display: flex; gap: 8px; padding: 16px 26px 0; flex-wrap: wrap; }

/* ── Grid & cards ─────────────────────────────────────────────────── */
.g { display: grid; gap: 16px; min-width: 0; }
.g-hero { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.card {
  background: linear-gradient(180deg, #101820, var(--panel)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; min-width: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025); display: flex; flex-direction: column; gap: 14px;
}
.card.flush { padding: 16px 0 6px; }
.card.flush .table-wrap { padding: 0 6px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head.pad, .toolbar.pad { padding: 0 20px; }
.card-head.spaced { margin-top: 10px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; padding: 44px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.note-box { padding: 12px 14px; border-radius: 12px; background: var(--well); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); line-height: 1.5; }
.note-box.warn { background: #1a160b; border-color: #3a2e12; color: #fde68a; }
.note-box.bad { background: #1d1012; border-color: #45202a; color: #fecaca; }
.banner { padding: 10px 14px; border-radius: 12px; }
.banner.warn { background: var(--amber-soft); color: var(--amber); }

/* KPI tiles (also the existing "ticker" tiles) */
.kpis { display: grid; gap: 14px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ticker, .kpis > div {
  background: linear-gradient(180deg, #101820, var(--panel)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; min-width: 0; position: relative; overflow: hidden;
}
.ticker small, .kpis > div > small { display: block; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; }
.ticker strong, .kpis > div > b { display: block; font: 700 26px/1.2 var(--mono); letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticker .sub, .kpis > div > span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ticker.attention strong { color: var(--amber); }
.ticker.attention.calm strong { color: var(--signal); }
.trend { font-weight: 700; font-size: 12px; }
.trend.up { color: var(--signal); } .trend.down { color: var(--coral); }

/* ── Command center ───────────────────────────────────────────────── */
.hero-card {
  background-color: #0e1a15; border-color: #1d3a30; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 22px;
  background-image: radial-gradient(rgba(148, 163, 184, .1) 1px, transparent 1px), linear-gradient(160deg, rgba(52, 211, 153, .08), transparent 60%);
  background-size: 14px 14px, auto;
}
.hero-main { flex: 1 1 300px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-label { display: flex; align-items: center; gap: 10px; }
.hero-label h2 { color: #a7cdbc; }
.hero-big { font: 700 clamp(38px, 4.4vw, 58px)/1 var(--mono); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.hero-big small { font-size: .42em; letter-spacing: 0; color: #a7cdbc; margin-right: 8px; font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-soft { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: rgba(255, 255, 255, .05); color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.pill-soft.good { background: var(--signal-soft); color: #a7f3d0; }
.pill-soft.warn { background: var(--amber-soft); color: #fde68a; }
.pill-soft.bad { background: var(--coral-soft); color: #fecaca; }
.pill-soft svg { width: 13px; height: 13px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini-stats > div { padding: 10px 12px; border-radius: 12px; background: rgba(7, 11, 16, .55); border: 1px solid rgba(255, 255, 255, .05); min-width: 0; }
.mini-stats b { display: block; font: 700 19px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 11.5px; color: #a3b1c2; }
.goal { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { display: block; }
.ring .track { fill: none; stroke: rgba(255, 255, 255, .08); }
.ring .bar { fill: none; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring .bar.good { stroke: url(#ringGrad); }
.ring .bar.amber { stroke: var(--amber); }
.ring .bar.coral { stroke: var(--coral); }
.ring .bar.sky { stroke: var(--sky); }
.ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.ring-in b { font: 700 28px var(--mono); }
.ring-in span { font-size: 11px; color: #a3b1c2; }
.ring.sm .ring-in b { font-size: 16px; }
.ring.sm .ring-in span { font-size: 10px; }
.goal p { margin: 0; font-size: 12.5px; color: var(--text-2); }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 20px 1fr; gap: 12px; }
.steps .mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; }
.steps .mark svg { width: 11px; height: 11px; color: var(--signal-ink); }
.steps .done .mark { background: var(--signal); border-color: var(--signal); }
.steps .now .mark { border-color: var(--amber); animation: ping-amber 1.6s infinite; }
@keyframes ping-amber { 0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .5); } 80%, 100% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); } }
.steps .line { width: 2px; height: 16px; background: var(--line-2); margin: 0 auto; }
.steps .done .line { background: var(--signal); }
.steps .t { font-size: 13px; font-weight: 600; }
.steps .now .t { color: var(--amber); }
.steps .d { font: 11px var(--mono); color: var(--faint); }
.quad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quad > div { padding: 9px 11px; border-radius: 11px; background: var(--well); border: 1px solid #17212c; min-width: 0; }
.quad b { display: block; font: 700 16px var(--mono); font-variant-numeric: tabular-nums; }
.quad span { font-size: 11px; color: var(--muted); }
.sending-title { font-size: 15.5px; font-weight: 700; }
.sending-sub { font: 12px var(--mono); color: var(--muted); }

/* Phone cockpit */
.cockpit-head { display: flex; align-items: center; gap: 10px; }
.cockpit-head h3 { font-size: 17px; }
.st-id { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pill {
  --tone: var(--signal); display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 750; letter-spacing: .08em;
  text-transform: uppercase; padding: 5px 10px; border-radius: 999px; color: var(--tone);
  background: color-mix(in srgb, var(--tone) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.tone-live { --tone: var(--signal); }
.tone-warn { --tone: var(--amber); }
.tone-bad { --tone: var(--coral); }
.tone-off { --tone: #5b6a7d; }
.tone-dry { --tone: var(--sky); }
.ecg { height: 38px; position: relative; overflow: hidden; margin: 0 -20px; }
.ecg svg { position: absolute; left: 0; top: 0; height: 100%; width: 200%; animation: scroll 3.2s linear infinite; }
.ecg path { fill: none; stroke: var(--tone, var(--signal)); stroke-width: 2; stroke-linejoin: round; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--tone, var(--signal)) 60%, transparent)); }
.ecg.flat svg { animation: none; }
@keyframes scroll { to { transform: translateX(-50%); } }
.cockpit { display: flex; gap: 14px; align-items: center; }
.tiles { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.tiles.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { padding: 8px 10px; border-radius: 10px; background: var(--well); border: 1px solid #17212c; min-width: 0; }
.tile small { display: block; font-size: 11px; color: var(--muted); }
.tile b { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--signal)); }
.tile.bad b { --dot: var(--coral); color: var(--coral); }
.tile.warn b { --dot: var(--amber); }
.tile.off b { --dot: #5b6a7d; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.controls .btn { min-height: 42px; }
.bar-line { display: flex; flex-direction: column; gap: 6px; }
.bar-line .top-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.meter { height: 6px; border-radius: 4px; background: #17212c; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--signal); border-radius: 4px; transition: width .6s ease; }
.meter.amber > span { background: var(--amber); }
.meter.coral > span { background: var(--coral); }
.meter.sky > span { background: var(--sky); }
.meter.grad > span { background: linear-gradient(90deg, var(--signal), var(--signal-2)); }
.meter.lg { height: 9px; }

/* Smart tips */
.tips { border-color: #24304a; background: linear-gradient(180deg, #111a2a, var(--panel)); }
.tips h2 { color: #b6c6e0; }
.tip-icon { width: 28px; height: 28px; border-radius: 9px; background: #18233a; color: #93c5fd; display: inline-flex; align-items: center; justify-content: center; }
.tip-icon svg { width: 15px; height: 15px; }
.tip { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(7, 11, 16, .5); border: 1px solid #1b2638; }
.tip::before { content: ""; border-radius: 2px; background: var(--c, var(--signal)); }
.tip p { margin: 0; font-size: 13px; line-height: 1.45; color: #dce4ee; }
.tip .linkbtn { color: var(--c, var(--signal)); text-decoration: none; font-weight: 650; margin-top: 6px; display: inline-block; }
.tip.amber { --c: var(--amber); } .tip.sky { --c: var(--sky); } .tip.violet { --c: var(--violet); } .tip.coral { --c: var(--coral); }

/* Money */
.money-rows { display: flex; flex-direction: column; gap: 9px; }
.money-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--text-2); }
.money-rows b { font: 700 15px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.money-rows .neg b { color: #fca5a5; }
.money-rows .total { border-top: 1px solid var(--line); padding-top: 9px; color: var(--text); font-weight: 650; }
.money-rows .total b { font-size: 21px; color: var(--signal); }
.split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: #17212c; }
.split > span { display: block; height: 100%; }

/* Charts */
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--signal); }
.legend i.ghost { background: none; border: 1.5px dashed #5e6c7d; }
.legend i.now { background: var(--amber); }
.chart { display: flex; gap: 10px; height: 220px; }
.chart .y { display: flex; flex-direction: column; justify-content: space-between; font: 11px var(--mono); color: var(--faint); padding-bottom: 22px; text-align: right; min-width: 30px; }
.chart .plot { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chart .cols { flex: 1; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line-2); background: linear-gradient(#141e28 1px, transparent 1px) 0 0 / 100% 25%; }
.chart .col { flex: 1; height: 100%; position: relative; min-width: 0; }
.chart .col .ghost { position: absolute; left: 0; right: 0; bottom: 0; border: 1.5px dashed #3e4b5c; border-bottom: 0; border-radius: 5px 5px 0 0; }
.chart .col .bar { position: absolute; left: 14%; right: 14%; bottom: 0; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--signal), color-mix(in srgb, var(--signal) 55%, transparent)); min-height: 2px; }
.chart .col .bar.zero { background: var(--line); min-height: 1px; }
.chart .col .bar.now { background: linear-gradient(180deg, var(--amber), color-mix(in srgb, var(--amber) 45%, transparent)); }
.chart .col .bar.best { box-shadow: 0 0 18px rgba(52, 211, 153, .35); }
.chart .col:hover .bar { filter: brightness(1.25); }
.chart .xl { display: flex; gap: 3px; height: 22px; align-items: flex-end; font: 10.5px var(--mono); color: var(--faint); }
.chart .xl span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; min-width: 0; }
.days-chart { height: 200px; }
.weeks-chart { height: 180px; }
.weeks-chart .col .bar { left: 10%; right: 10%; }
.weeks-chart .col .val { position: absolute; left: 0; right: 0; text-align: center; font: 10.5px var(--mono); color: var(--text-2); transform: translateY(-16px); }
.mix { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: #17212c; }
.mix > span { display: block; height: 100%; }
.mix-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 48px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.mix-row i { width: 10px; height: 10px; border-radius: 3px; }
.mix-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix-row b { font-family: var(--mono); text-align: right; }
.pkg { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.pkg:last-child { border-bottom: 0; }
.pkg-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.pkg-bar { height: 7px; border-radius: 6px; background: #17212c; overflow: hidden; margin: 6px 0 2px; flex: 1; }
.pkg-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--signal-dim), var(--signal)); border-radius: 6px; }
.weekbars .wk { display: grid; grid-template-columns: 44px 1fr 110px; gap: 12px; align-items: center; padding: 5px 0; font-size: 13.5px; }
.weekbars .wk b { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.spark rect { fill: var(--line); }
.spark rect.on { fill: var(--signal); }
.hours rect { fill: var(--line); }
.hours rect.on { fill: color-mix(in srgb, var(--signal) 55%, transparent); }
.hours rect.peak { fill: var(--signal); }
.hours text { font-size: 9px; fill: var(--muted); }
.pulse { display: flex; align-items: flex-end; gap: 2px; height: 26px; }
.pulse i { flex: 1; border-radius: 2px; background: var(--signal); min-height: 3px; }
.pulse i.part { opacity: .55; }
.pulse i.none { background: var(--line); height: 18% !important; }

/* ── Tables, badges, statuses ─────────────────────────────────────── */
.orders { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.orders th { text-align: left; color: var(--faint); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; padding: 10px 14px; white-space: nowrap; }
.orders td { padding: 11px 14px; border-top: 1px solid #17212c; vertical-align: middle; }
.orders td.num, .orders th.num { text-align: right; font-variant-numeric: tabular-nums; }
.orders td.num { font-family: var(--mono); font-weight: 650; }
.orders td select { padding: 6px 8px; width: auto; min-width: 120px; }
.orders td .btn { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.orders tr.clickable { cursor: pointer; }
.orders tr.clickable:hover td { background: rgba(255, 255, 255, .025); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 11px; }
.who b { font-weight: 650; display: block; }
.reason { display: block; color: var(--muted); font-size: 12px; }
.st, .state {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; color: var(--sky); background: var(--sky-soft);
}
.st::before, .state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.success, .state.done { color: var(--signal); background: var(--signal-soft); }
.st.failed, .state.failed { color: var(--coral); background: var(--coral-soft); }
.st.needsReview { color: var(--amber); background: var(--amber-soft); }
.state.sent { color: var(--violet); background: rgba(196, 181, 253, .14); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 7px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.good { color: var(--signal); background: var(--signal-soft); }
.badge.warn { color: var(--amber); background: var(--amber-soft); }
.badge.bad { color: var(--coral); background: var(--coral-soft); }
.badge.sky { color: var(--sky); background: var(--sky-soft); }
.badge.gold { color: #fbbf24; background: #2b2210; }
.dot-inline { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5b6a7d; margin-right: 7px; }
.dot-inline.good { background: var(--signal); } .dot-inline.bad { background: var(--coral); } .dot-inline.warn { background: var(--amber); }
.days { font-weight: 700; font-variant-numeric: tabular-nums; }
.days.warn { color: var(--amber); } .days.bad { color: var(--coral); } .days.good { color: var(--signal); }
.cmd { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.cmd:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid #141e28; font-size: 13.5px; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { display: block; font-size: 11px; color: var(--faint); font-family: var(--mono); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--sky); }
.dot.good { background: var(--signal); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--coral); }
.wire { max-height: 640px; overflow: auto; }

/* ── Customers ────────────────────────────────────────────────────── */
.seg-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.seg-card {
  text-align: left; border: 1px solid var(--line); background: linear-gradient(180deg, #101820, var(--panel)); border-radius: 16px;
  padding: 12px 14px; color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.seg-card:hover { border-color: var(--line-2); }
.seg-card.on { border-color: var(--c, var(--signal)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--signal)) 18%, transparent); }
.seg-card .t { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.seg-card .t::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--signal)); }
.seg-card b { font: 700 24px var(--mono); }
.seg-card span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.tokens { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.token { font: 11.5px var(--mono); padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); cursor: pointer; }
.sms-preview { align-self: flex-start; max-width: 100%; padding: 11px 13px; border-radius: 16px 16px 16px 4px; background: #1c2733; font-size: 13px; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.sms-preview:empty { display: none; }
.sms-preview small { display: block; margin-top: 6px; color: var(--faint); font-size: 11px; }
.pack-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pack { min-height: 34px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.pack b { font-family: var(--mono); color: var(--muted); font-weight: 600; }
.pack:hover, .pack.sel { border-color: var(--signal); background: var(--signal-soft); }

/* ── Vendor: agent cards, radar ───────────────────────────────────── */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.agent-card {
  text-align: left; border: 1px solid var(--line); background: linear-gradient(180deg, #101820, var(--panel)); border-radius: 18px;
  padding: 16px; color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  transition: transform .15s ease, border-color .2s;
}
.agent-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.agent-card.warn { border-color: #3a2e12; }
.agent-card.bad { border-color: #45202a; }
.agent-card.blocked { opacity: .55; }
.ac-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ac-head .avatar { position: relative; width: 42px; height: 42px; border-radius: 13px; font-size: 14px; }
.ac-head .avatar i { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--panel); background: #5b6a7d; }
.ac-head .avatar i.on { background: var(--signal); }
.ac-head .grow b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; font-size: 12.5px; }
.ac-facts small { display: block; font-size: 11px; color: var(--muted); }
.ac-facts b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.radar { position: relative; padding: 36px 0 4px; }
.radar .track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #17212c 70%, rgba(251, 191, 36, .3)); }
.radar .pin { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translateX(-50%); }
.radar .pin span { font: 700 10.5px var(--mono); color: var(--text-2); white-space: nowrap; }
.radar .pin i { width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); color: var(--ink); font: 800 11px var(--sans); font-style: normal; display: grid; place-items: center; }
.radar .pin.warn span { color: var(--amber); } .radar .pin.warn i { background: var(--amber); }
.radar .pin.bad span { color: var(--coral); } .radar .pin.bad i { background: var(--coral); }
.radar .today { position: absolute; left: 0; top: 0; font: 700 10.5px var(--sans); color: var(--signal); letter-spacing: .06em; }
.radar .today::after { content: ""; display: block; width: 2px; height: 22px; background: var(--signal); margin-top: 4px; }
.radar-x { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--faint); }

/* ── Drawer ───────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 9; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 10; background: var(--panel);
  border-left: 1px solid var(--line); transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  overflow-y: auto; box-shadow: -30px 0 80px rgba(0, 0, 0, .45);
}
.drawer.open { transform: none; }
.d-head { position: sticky; top: 0; background: var(--panel); padding: 20px 22px 16px; border-bottom: 1px solid var(--line); z-index: 1; }
.d-head .row { justify-content: space-between; flex-wrap: nowrap; }
.d-head h3 { font-size: 20px; }
.d-sec { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kv div { background: var(--well); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.kv small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.kv b { font: 700 16px var(--mono); font-variant-numeric: tabular-nums; }
.licence-card { border-radius: 16px; padding: 16px; position: relative; overflow: hidden; background: linear-gradient(135deg, #12261e, #0e151c 60%); border: 1px solid #1d3a30; }
.licence-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; border: 22px solid rgba(52, 211, 153, .07); }
.licence-card .big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.licence-card.expiring { background: linear-gradient(135deg, #2a2210, #0e151c 60%); border-color: #3a2e12; }
.licence-card.expiring .big { color: var(--amber); }
.licence-card.expired .big { color: var(--coral); }

/* ── Palette ──────────────────────────────────────────────────────── */
.palette { width: min(680px, calc(100% - 24px)); padding: 0; border-radius: 20px; border: 1px solid var(--line-2); background: var(--panel); margin-top: 9vh; overflow: hidden; }
.palette::backdrop { background: rgba(3, 6, 10, .72); backdrop-filter: blur(4px); }
.pal-input { display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.pal-input input { border: 0; background: none; box-shadow: none; padding: 0; font-size: 18px; flex: 1; }
.pal-input input:focus { box-shadow: none; }
.pal-input .ico { color: var(--muted); }
.pal-list { max-height: min(56vh, 520px); overflow-y: auto; padding: 6px 8px 10px; }
.pal-group { font-size: 10.5px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 11px; cursor: pointer; border: 0; background: none; color: var(--text); font: inherit; width: 100%; text-align: left; }
.pal-item .pi { width: 32px; height: 32px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--c, var(--text-2)); flex: none; }
.pal-item .pi svg { width: 16px; height: 16px; }
.pal-item .pt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pal-item .pt b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .pt small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item.active, .pal-item:hover { background: var(--panel-2); }
.pal-item.active { box-shadow: inset 0 0 0 1px var(--line-2); }
.pal-sell { margin: 4px 2px 4px; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(52, 211, 153, .12), rgba(52, 211, 153, .03)); border: 1px solid #1d3a30; display: flex; flex-direction: column; gap: 12px; }
.pal-sell .pal-item { padding: 0; background: none; box-shadow: none; cursor: default; }
.pal-sell .pi { background: var(--signal); color: var(--signal-ink); border-color: transparent; }
.pal-empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 13.5px; }
.pal-foot { display: flex; gap: 14px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); }
.pal-foot kbd { margin-right: 3px; }

/* ── Forms (store, licence sales, alerts) ─────────────────────────── */
.creds { border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px 14px; margin: 12px 0 0; }
.creds legend { padding: 0 6px; font-size: 12px; color: var(--muted); }
.team-row > label { flex: 1 1 160px; margin-top: 10px; }
.team-row input, .team-row textarea { flex: 2; min-width: 200px; }
.team-row select { flex: 1; min-width: 160px; width: auto; }
#store-form .filters, #ls-form .filters { margin: 16px 0 4px; }
.plan-row label { margin-top: 8px; }
.store-link { word-break: break-all; font-family: var(--mono); background: var(--well); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.lb-support { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.lb-support:first-child { border-top: 0; }
.lb-support .btn { margin-left: auto; }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--panel-2); font: 700 12px var(--mono); }
.rank.r1 { background: #2b2210; color: #fbbf24; } .rank.r2 { background: #1c2733; color: #cbd5e1; } .rank.r3 { background: #2a1a12; color: #fdba8c; }
#ann-text { margin-top: 4px; }
body.viewer .admin-only { display: none !important; }

/* ── Dialog & toast ───────────────────────────────────────────────── */
dialog#dlg {
  border: 1px solid var(--line-2); border-radius: 20px; background: var(--panel); color: var(--text);
  width: min(460px, calc(100% - 32px)); padding: 24px; box-shadow: var(--shadow);
}
dialog { color: var(--text); }
dialog::backdrop { background: rgba(3, 6, 10, .72); backdrop-filter: blur(3px); }
dialog h3 { font-size: 18px; }
#dlg-extra { margin-top: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--ink); padding: 12px 18px; border-radius: 12px; font-weight: 650;
  transition: all .25s ease; z-index: 30; max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--coral); color: #1d0a0a; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 1320px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 > :last-child { grid-column: 1 / -1; }
  .seg-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g-hero, .g-side, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wire { max-height: 420px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 12; transform: translateX(-105%);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: 30px 0 80px rgba(0, 0, 0, .5);
  }
  .side.open { transform: none; }
  .side-scrim { z-index: 11; }
  .only-mobile { display: inline-flex; }
  .top { padding: 10px 14px; gap: 8px; }
  .page-title h1 { font-size: 18px; }
  .page-title small { display: none; }
  .search-trigger { flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; }
  .search-trigger .grow, .search-trigger kbd { display: none; }
  .live-dot em { display: none; }
  .live-dot { padding: 0 9px; }
  .page { padding: 14px 14px 110px; gap: 14px; }
  .phone-pick { padding: 12px 14px 0; }
  .tabbar {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 8;
    align-items: center; padding: 4px 6px; border-radius: 22px; background: rgba(14, 21, 28, .96); border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .5); backdrop-filter: blur(10px);
  }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; color: var(--faint); font: 600 10.5px var(--sans); padding: 8px 0; cursor: pointer; }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button.on { color: var(--signal); }
  .tabbar button.fab {
    flex: 0 0 56px; height: 56px; margin-top: -26px; border-radius: 19px; color: var(--signal-ink);
    background: linear-gradient(135deg, var(--signal), var(--signal-2)); border: 4px solid var(--ink); box-shadow: 0 10px 24px rgba(52, 211, 153, .35);
  }
  .tabbar button.fab svg { width: 22px; height: 22px; }
  .toast { bottom: 96px; }
}
@media (max-width: 640px) {
  .g-3 { grid-template-columns: minmax(0, 1fr); }
  .kpis-5, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-5 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ticker strong, .kpis > div > b { font-size: 21px; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; }
  .card-head.pad, .toolbar.pad { padding: 0 16px; }
  .ecg { margin: 0 -16px; }
  .hero-card { flex-direction: column; align-items: stretch; }
  .goal { flex-direction: row; text-align: left; }
  .cockpit { flex-direction: column; align-items: stretch; }
  .chart { height: 180px; }
  .chart .col .bar { left: 8%; right: 8%; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-sm { width: 100%; }
  .weekbars .wk { grid-template-columns: 40px 1fr 90px; }
  .live-dot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── v2 extras ────────────────────────────────────────────────────── */
.ring .bar.solid { stroke: var(--signal); }
.meter.busy { position: relative; }
.meter.busy > span { width: 35%; position: absolute; left: -35%; animation: busy 1.4s ease-in-out infinite; background: linear-gradient(90deg, transparent, var(--signal), transparent); }
@keyframes busy { to { left: 100%; } }
.clickable-row { cursor: pointer; padding: 8px 6px; margin: 0 -6px; border-radius: 10px; }
.clickable-row:hover { background: rgba(255, 255, 255, .03); }
#top-customers { display: flex; flex-direction: column; gap: 2px; }
.pad-x { padding: 0 20px; }
.nav-badge:empty { display: none; }
.nav-badge { margin-left: auto; font: 700 11px var(--mono); color: var(--muted); }
.agent-card .ring.sm .ring-in b { font-size: 13px; }
.agent-card > .badge { align-self: flex-start; }
.money-rows b.txt { font-family: var(--sans); font-weight: 650; font-size: 13.5px; }
#c-table td:nth-child(4) { white-space: nowrap; }
.side-card.tip span { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .goal .ring svg { width: 112px; height: 112px; }
  .goal .ring-in b { font-size: 20px; }
  .hero-big { font-size: 44px; }
}
@media (max-width: 640px) { .orders { min-width: 560px; } }
.side-card .t svg { width: 15px; height: 15px; color: var(--muted); }
