:root {
  --bg: #070b14; --bg2: #0b1220; --panel: #0f1829; --panel2: #13203a; --line: #1e2d4a; --line2: #2a3d63;
  --text: #e6edf8; --muted: #8fa3c4; --dim: #5d7093;
  --blue: #3b82f6; --blue2: #2563eb; --blue-soft: rgba(59,130,246,.14); --cyan: #38bdf8;
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --violet: #a78bfa;
  --header-h: 60px; --nav-w: 264px; --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
body.app { overflow: hidden; }
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.header { position: fixed; inset: 0 0 auto 0; height: var(--header-h); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: linear-gradient(180deg, #0c1527, #0a1222); border-bottom: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; font-size: 16px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 30% 30%, #60a5fa, #1d4ed8); box-shadow: 0 0 18px rgba(59,130,246,.45); font-size: 13px; }
.brand small { color: var(--muted); font-weight: 500; font-size: 12px; }
.header .spacer { flex: 1; }
.header .crumb { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header .crumb b { color: var(--text); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line2); color: var(--muted); font-size: 12px; background: var(--bg2); white-space: nowrap; }
.icon-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; height: 36px; min-width: 36px;
  padding: 0 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); flex: none; }
.icon-btn:hover { border-color: var(--blue); }
.badge-dot { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.user-chip .uname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-soft); border: 1px solid var(--blue); flex: none;
  display: grid; place-items: center; color: #bfdbfe; font-weight: 700; font-size: 12px; }
.menu-toggle { display: none; }
.nav-scrim { display: none; }

/* left navigation */
.nav { position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--nav-w); background: var(--bg2);
  border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 10px 16px; z-index: 20; scrollbar-width: thin; }
.nav .group { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; margin: 10px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 9px; color: var(--muted);
  font-size: 13px; border: 1px solid transparent; white-space: nowrap; position: relative; }
.nav a .ic { width: 18px; text-align: center; opacity: .85; flex: none; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--blue-soft); color: #dbeafe; border-color: rgba(59,130,246,.45); }
.nav a .count { margin-left: auto; }

.main { position: fixed; top: var(--header-h); left: var(--nav-w); right: 0; bottom: 0; overflow: hidden; display: flex; flex-direction: column; }
/* every page is laid out to fit the screen: the view is a flex column and long lists paginate instead of scrolling */
.view { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 14px 18px 14px; display: flex; flex-direction: column; gap: 12px; }
.view > * { flex: none; }
.view > .mt, .view .fill > .mt { margin-top: 0; }
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-head h1 { font-size: 19px; margin: 0; font-weight: 650; }
.view-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* fill helpers */
.fill { flex: 1 1 0 !important; min-height: 0; display: flex; flex-direction: column; }
.card.fill, .grid > .card, .rowfill > .card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.rowfill { display: grid; gap: 12px; flex: 1 1 0 !important; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
.rowfill.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rowfill.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rowfill.c21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.rowfill.c12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.card .tabs { flex: none; }
[data-panes] { min-height: 0; }
[data-pane] { min-height: 0; flex: 1 1 0; display: flex; flex-direction: column; gap: 10px; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }
.sm-only { display: none !important; }

/* ---------- components ---------- */
.grid { display: grid; gap: 14px; }
.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)); }
.span2 { grid-column: span 2; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card h3 { flex: none; margin: 0 0 10px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 .sub { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 12px; }
.kpi { padding: 10px 12px; justify-content: center; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value { font-size: 21px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .hint { color: var(--dim); font-size: 11.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.accent { background: linear-gradient(160deg, rgba(37,99,235,.22), var(--panel) 60%); border-color: rgba(59,130,246,.35); }

.btn { background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 14px; cursor: pointer;
  color: var(--text); font-weight: 550; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: linear-gradient(180deg, #3b82f6, #2563eb); border-color: #2563eb; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(239,68,68,.5); color: #fecaca; background: rgba(239,68,68,.1); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap.fit { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.table-scroll { flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; }
.pager { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 4px 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pager .btn { min-width: 30px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; background: #0d1626; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px; z-index: 1; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(59,130,246,.05); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  font-weight: 600; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { color: #86efac; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.tag.warn { color: #fcd34d; border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); }
.tag.bad { color: #fca5a5; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.tag.info { color: #93c5fd; border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.1); }
.tag.plain::before { display: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs button { background: none; border: none; padding: 7px 12px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 550; white-space: nowrap; }
.tabs button.active { color: #dbeafe; border-bottom-color: var(--blue); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.toolbar.card { margin-bottom: 0; padding: 10px 12px; }
.toolbar .field input, .toolbar .field select { padding: 6px 8px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 550; }
.field .help { font-size: 11.5px; color: var(--dim); }
input, select, textarea { background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px;
  outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
textarea { resize: vertical; min-height: 80px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }

.modal-back { position: fixed; inset: 0; background: rgba(2,6,15,.7); display: grid; place-items: center; z-index: 60;
  padding: 18px; backdrop-filter: blur(3px); }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: min(760px, 100%);
  max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal.wide { width: min(1040px, 100%); }
.modal header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal header h2 { margin: 0; font-size: 16px; }
.modal header .x { margin-left: auto; }
.modal .body { padding: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal header, .modal footer { flex: 0 0 auto; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.toast-area { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--blue); padding: 10px 14px;
  border-radius: 10px; min-width: 260px; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

.secret-box { background: #050912; border: 1px dashed var(--blue); border-radius: 10px; padding: 12px; font-family: var(--mono);
  word-break: break-all; color: #bfdbfe; }
.callout { border: 1px solid rgba(245,158,11,.4); background: rgba(245,158,11,.08); color: #fde68a; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; }
.callout.info { border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.08); color: #bfdbfe; }
pre.code { background: #050912; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto;
  font-family: var(--mono); font-size: 12px; color: #c7d2fe; margin: 0; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: none; }
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.flow .node { padding: 6px 10px; border-radius: 8px; background: var(--blue-soft); border: 1px solid rgba(59,130,246,.4); color: #dbeafe; }
.flow .arrow { color: var(--dim); }

/* charts */
.chart { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.chart-box { flex: 1 1 0; min-height: 90px; overflow: hidden; }
.chart svg { display: block; }
.chart .axis { stroke: var(--line2); }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .bar-a { fill: #3b82f6; }
.chart .bar-b { fill: #38bdf8; }
.chart .bar-c { fill: #a78bfa; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; flex: none; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .a { background: #3b82f6; } .legend .b { background: #38bdf8; } .legend .c { background: #a78bfa; }
.meter { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.meter.warn span { background: linear-gradient(90deg, var(--warn), #fbbf24); }
.meter.bad span { background: linear-gradient(90deg, var(--bad), #f87171); }

/* ---------- login (split: product story left, login card right) ---------- */
body.login { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; background: var(--bg); }
.login-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, 0.85fr); }
.login-hero { position: relative; overflow: hidden; padding: 44px 56px; display: flex; flex-direction: column; gap: 28px; justify-content: center;
  background:
    radial-gradient(900px 520px at 20% -10%, rgba(37,99,235,.35), transparent 60%),
    radial-gradient(700px 480px at 100% 110%, rgba(56,189,248,.16), transparent 60%),
    linear-gradient(160deg, #0b1427 0%, #070b14 70%);
  border-right: 1px solid var(--line); }
.login-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(59,130,246,.10) 1px, transparent 1px), linear-gradient(90deg, rgba(59,130,246,.10) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse at 30% 30%, #000 30%, transparent 75%); }
.login-hero > * { position: relative; }
.hero-brand { font-size: 22px; position: absolute; top: 36px; left: 56px; }
.hero-brand .brand-mark { width: 38px; height: 38px; font-size: 15px; border-radius: 10px; }
.hero-copy { max-width: 620px; margin-top: 40px; }
.hero-kicker { display: inline-block; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: #93c5fd;
  border: 1px solid rgba(59,130,246,.45); background: rgba(59,130,246,.12); padding: 4px 10px; border-radius: 999px; }
.hero-copy h2 { font-size: clamp(26px, 2.6vw, 38px); line-height: 1.15; margin: 16px 0 12px; font-weight: 700; letter-spacing: -.3px;
  background: linear-gradient(90deg, #ffffff, #bfdbfe 70%, #7dd3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0; max-width: 580px; }
.hero-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 680px; }
.hero-features li { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px;
  background: rgba(15,24,41,.65); border: 1px solid var(--line); backdrop-filter: blur(4px); }
.hero-features b { display: block; font-size: 14px; margin-bottom: 3px; }
.hero-features small { color: var(--muted); font-size: 12.5px; line-height: 1.45; display: block; }
.hf-ic { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 16px;
  background: var(--blue-soft); border: 1px solid rgba(59,130,246,.45); color: #bfdbfe; }
.hero-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; max-width: 680px; }
.hero-flow span { padding: 6px 10px; border-radius: 8px; background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.35); color: #dbeafe; }
.hero-flow i { color: var(--dim); font-style: normal; }
.hero-platforms { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 680px; }
.hero-platforms small { color: var(--dim); text-transform: uppercase; letter-spacing: 1.2px; font-size: 11px; margin-right: 4px; }
.hero-platforms span { font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2); }

.login-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 32px 20px;
  background: radial-gradient(600px 400px at 50% 0%, rgba(37,99,235,.10), transparent 70%), var(--bg); }
.login-card { width: min(420px, 100%); background: rgba(15,24,41,.92); border: 1px solid var(--line2);
  border-radius: 18px; padding: 30px; box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(59,130,246,.06) inset; }
.login-card .card-brand { display: none; justify-content: center; margin-bottom: 10px; font-size: 20px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
.login-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card input { padding: 11px 12px; }
.login-card .btn { padding: 12px; font-size: 14px; }
.login-card .btn.sm { padding: 5px 10px; font-size: 12px; }
.login-card .link { background: none; border: none; color: var(--cyan); cursor: pointer; padding: 0; font-size: 13px; }
.login-card #demo-box { margin-bottom: 14px; line-height: 1.6; }
.login-card #msg { margin-bottom: 14px; }
.login-card .foot { text-align: center; margin-top: 20px; color: var(--dim); font-size: 12px; }
.login-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted);
  font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.pw-toggle:hover { color: var(--text); background: var(--panel2); }
.login-legal { color: var(--dim); font-size: 11.5px; margin-top: 18px; }
.alert { padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.alert.err { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #fecaca; }
.alert.ok { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.4); color: #bbf7d0; }
.otp { letter-spacing: 8px; text-align: center; font-size: 22px; font-family: var(--mono); }

/* laptops: tighter hero */
@media (max-width: 1279px) {
  .login-hero { padding: 36px 40px; gap: 22px; }
  .hero-brand { left: 40px; top: 30px; }
  .hero-platforms { display: none; }
}
/* tablets: stack — compact story on top, card below */
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { border-right: none; border-bottom: 1px solid var(--line); padding: 28px 28px 24px; gap: 16px; justify-content: flex-start; }
  .hero-brand { position: static; }
  .hero-copy { margin-top: 0; }
  .hero-copy h2 { font-size: 24px; margin-top: 12px; }
  .hero-copy p { font-size: 14px; }
  .hero-flow { display: none; }
  .login-side { padding: 28px 20px; justify-content: flex-start; }
}
/* phones: brand + one-line pitch, login card first-class */
@media (max-width: 699px) {
  .login-hero { padding: 20px 18px 18px; gap: 10px; }
  .hero-brand { font-size: 18px; }
  .hero-brand .brand-mark { width: 32px; height: 32px; font-size: 13px; }
  .hero-kicker, .hero-features { display: none; }
  .hero-copy h2 { font-size: 19px; margin: 6px 0 6px; }
  .hero-copy p { font-size: 13px; line-height: 1.5; }
  .login-side { padding: 16px 12px 20px; }
  .login-card { padding: 22px 18px; border-radius: 14px; }
  .login-card h1 { font-size: 19px; }
  .login-sub { margin-bottom: 16px; }
}

/* ---------- responsive ---------- */
/* tablets / small laptops: icon rail navigation */
@media (max-width: 1279px) {
  :root { --nav-w: 64px; }
  .nav { padding: 8px 8px; }
  .nav .group { font-size: 0; margin: 4px 4px; border-top: 1px solid var(--line); }
  .nav a { justify-content: center; padding: 6px 0; font-size: 0; gap: 0; }
  .nav a .ic { font-size: 16px; width: auto; }
  .nav a .count { position: absolute; top: 2px; right: 4px; font-size: 10px; }
  .brand small, .header .crumb { display: none; }
  .rowfill.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rowfill.c3 > :nth-child(3) { grid-column: 1 / -1; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-md { display: none !important; }
}
/* portrait tablets */
@media (max-width: 900px) {
  .rowfill.c21, .rowfill.c12, .rowfill.c2 { grid-template-columns: minmax(0, 1fr); }
  .user-chip .uname { display: none; }
}
/* phones: drawer navigation, compact everything */
@media (max-width: 699px) {
  :root { --header-h: 52px; }
  .menu-toggle { display: inline-flex; }
  .header { gap: 6px; padding: 0 8px; }
  .brand { font-size: 15px; }
  #env-pill { display: none; }
  #logout-btn .uname { display: none; }
  .nav { width: 248px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px rgba(0,0,0,.45); z-index: 40; }
  .nav { padding: 6px 8px; }
  .nav .group { font-size: 10px; margin: 6px 10px 2px; border-top: none; }
  .nav a { justify-content: flex-start; padding: 6px 12px; font-size: 13px; gap: 10px; }
  .nav a .ic { width: 18px; }
  .nav a .count { position: static; margin-left: auto; }
  body.nav-open .nav { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(2,6,15,.6); z-index: 35; }
  .main { left: 0; }
  .view { padding: 10px 10px; gap: 8px; }
  .view-head h1 { font-size: 17px; }
  .view-head p { display: none; }
  .view-head .actions .btn { padding: 6px 10px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .rowfill.c3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .kpi { padding: 8px 10px; }
  .kpi .value { font-size: 17px; }
  .kpi .hint { display: none; }
  .card { padding: 10px; }
  .hide-sm { display: none !important; }
  .sm-only { display: flex !important; }
  th, td { padding: 6px 8px; font-size: 12.5px; }
  .modal-back { padding: 0; }
  .modal, .modal.wide { width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .toolbar .field { flex: 1 1 40%; }
}
/* short screens (landscape phones, small laptops) */
@media (max-height: 760px) {
  .nav a { padding-top: 5px; padding-bottom: 5px; }
  .nav .group { margin-top: 6px; margin-bottom: 2px; }
  .view { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .view-head p { display: none; }
  .kpi .hint { display: none; }
}

/* utilities */
.mt { margin-top: 14px; }
.spacer { flex: 1; }
h3.mt { margin-bottom: 10px; }
.pill.warn { color: #fcd34d; border-color: rgba(245,158,11,.5); }
.list-plain li .spacer { flex: 1; }
.btn.ghost.mono { padding: 2px 6px; }
td .btn-row { flex-wrap: nowrap; }
.tabs.sm-only { display: none !important; }
/* phones and portrait tablets: side-by-side panels become tabs */
@media (max-width: 900px) {
  .tabs.sm-only { display: flex !important; }
  .rowfill.panes-wide { display: flex; flex-direction: column; }
  .rowfill.panes-wide > [data-pane] { flex: 1 1 0; }
}
/* wider screens: show every pane of a tab set side by side */
@media (min-width: 901px) { .panes-wide > [data-pane] { display: flex !important; } }
.kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis.k7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1279px) { .kpis.k7 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 699px) { .kpis.k6, .kpis.k7 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card h3 a.sub { color: var(--cyan); }
.wizard-nav { flex: none; margin-top: 10px; }
.btn-row .spacer { flex: 1; }
form.fill { overflow: hidden; }
pre.code.fill { min-height: 0; overflow: auto; }
details.filters { padding: 0; }
details.filters > summary { cursor: pointer; padding: 8px 12px; color: var(--muted); font-size: 12.5px; list-style: none; }
details.filters > summary::before { content: "▸ "; }
details.filters[open] > summary::before { content: "▾ "; }
details.filters .toolbar { padding: 0 12px 10px; margin: 0; }
details.filters[open] .toolbar { padding-top: 0; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; flex: none; }
[data-pane] > h3 { margin: 0; font-size: 13px; }
.scroll-y { overflow-y: auto; }
.sm-only-block { display: none; }
@media (max-width: 699px) { .sm-only-block { display: block; } .view-head .actions input[type=date] { width: 130px; padding: 5px 6px; } }
/* login: keep everything within one screen */
@media (min-width: 901px) and (max-height: 820px) {
  .hero-platforms { display: none; }
  .login-hero { gap: 18px; }
  .hero-copy h2 { font-size: clamp(24px, 2.3vw, 32px); }
}
@media (max-width: 900px) {
  .hero-features { gap: 8px; }
  .hero-features li { padding: 10px 12px; align-items: center; }
  .hero-features small { display: none; }
  .hf-ic { width: 28px; height: 28px; font-size: 14px; }
  .login-side { padding-top: 22px; padding-bottom: 8px; }
  .login-legal { margin-top: 10px; }
}
@media (max-width: 699px) {
  .hero-copy p { display: none; }
  .login-legal { display: none; }
}

/* AI Models: full-width model picker */
.model-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; }
.model-pick label { font-weight: 600; white-space: nowrap; }
.model-pick select { flex: 1 1 auto; min-width: 0; width: 100%; font-size: 15px; padding: 10px 12px; }
@media (max-width: 699px) { .model-pick { flex-direction: column; align-items: stretch; gap: 6px; } }
.nowrap { white-space: nowrap; }
@media (max-width: 1599px) { .hide-lg { display: none !important; } }
