/* ============================================================================
   mangoUEFN Staff console: design system
   One stylesheet for every page: tokens (dark default + light), base type,
   components, the app shell, page layouts and the sign-in screens.
   ============================================================================ */

/* ── tokens ──────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --font: "Inter", "InterVariable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  /* graphite neutrals */
  --bg: #0b0b0d;
  --bg-elev: #0e0e11;
  --surface: #131316;
  --surface-2: #18181c;
  --surface-3: #1f1f24;
  --border: #232328;
  --border-2: #2f2f36;
  --text: #ededef;
  --text-2: #a1a1aa;
  --text-3: #8a8a94;

  /* mango */
  --accent: #ff9f43;
  --accent-2: #ffb26b;
  --accent-ink: #1f1206;
  --accent-text: #ffb066;
  --accent-soft: rgba(255, 159, 67, 0.12);
  --accent-line: rgba(255, 159, 67, 0.34);

  /* status */
  --ok: #3dd68c;     --ok-soft: rgba(61, 214, 140, 0.12);
  --warn: #f2c94c;   --warn-soft: rgba(242, 201, 76, 0.12);
  --bad: #f2555a;    --bad-soft: rgba(242, 85, 90, 0.13);
  --info: #6cb2ff;   --info-soft: rgba(108, 178, 255, 0.12);

  /* charts */
  --heat-empty: #1b1b20;
  --heat-0: #33231a;
  --heat-1: #7a4318;
  --heat-2: #e9832a;
  --heat-3: #ffd2a1;
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-neg: #e5676d;
  --chart-bar: #34343c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --tip-bg: #1c1c21;

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f7;
  --bg-elev: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ebebee;
  --border: #e6e6e9;
  --border-2: #d6d6db;
  --text: #17171a;
  --text-2: #52525b;
  --text-3: #66666f;

  --accent: #ff9f43;
  --accent-2: #ff8c24;
  --accent-ink: #1f1206;
  --accent-text: #b4530a;
  --accent-soft: rgba(255, 140, 40, 0.13);
  --accent-line: rgba(234, 120, 20, 0.42);

  --ok: #15803d;     --ok-soft: rgba(21, 128, 61, 0.1);
  --warn: #a16207;   --warn-soft: rgba(202, 138, 4, 0.12);
  --bad: #d92d2d;    --bad-soft: rgba(217, 45, 45, 0.09);
  --info: #2563eb;   --info-soft: rgba(37, 99, 235, 0.09);

  --heat-empty: #efeff2;
  --heat-0: #ffeedd;
  --heat-1: #ffc98e;
  --heat-2: #ff9a3d;
  --heat-3: #c2570c;
  --chart-grid: rgba(0, 0, 0, 0.07);
  --chart-neg: #dc4c52;
  --chart-bar: #d6d6dc;

  --shadow-sm: 0 1px 2px rgba(16, 16, 20, 0.06);
  --shadow-md: 0 6px 20px rgba(16, 16, 20, 0.08);
  --shadow-lg: 0 24px 64px rgba(16, 16, 20, 0.16), 0 2px 8px rgba(16, 16, 20, 0.06);
  --tip-bg: #ffffff;
}

/* ── base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-line); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.xs { width: 14px; height: 14px; }

/* page-to-page crossfade (cross-document view transitions; ignored where unsupported) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.16s; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font: 500 13px/1 var(--font);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
  -webkit-user-select: none; user-select: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.75; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 38%, transparent); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-danger.is-armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn .i { width: 16px; height: 16px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.is-spinning .i { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--text-2); font-size: 13px; font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); color: var(--text-3);
  font: 500 11px/1 var(--font);
}

/* ── badges + tags ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font: 600 11.5px/1 var(--font); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font: 600 11.5px/1 var(--font); white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}

.tone-accent { background: var(--accent-soft); color: var(--accent-text); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-neutral { background: var(--surface-3); color: var(--text-2); }

/* ── status pill (live / offline) ────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font: 500 12.5px/1 var(--font); white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status-pill[data-state="live"] { background: var(--ok-soft); color: var(--ok); }
.status-pill[data-state="offline"] { background: var(--bad-soft); color: var(--bad); }
.status-pill[data-state="live"] i { box-shadow: 0 0 0 0 currentColor; animation: ping 2.4s ease-out infinite; }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px transparent; }
}

/* ── cards ───────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 18px 14px;
}
.card-head .grow { flex: 1 1 220px; min-width: 0; }
.card-title { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 0 18px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }
.card-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.card-link:hover { color: var(--text); }
.count-pill {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font: 600 12px/1 var(--font); font-variant-numeric: tabular-nums;
}
.count-pill.is-hot { background: var(--accent-soft); color: var(--accent-text); }
.count-pill.is-bad { background: var(--bad-soft); color: var(--bad); }

/* ── stat cards ──────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px 15px; text-decoration: none; color: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
a.stat[href]:hover { border-color: var(--border-2); background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.stat:not([href]) .go { display: none; }
.stat .meter { margin-top: 4px; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.stat-label .i { width: 16px; height: 16px; color: var(--text-3); }
.stat-label .go { margin-left: auto; color: var(--text-3); opacity: 0; transform: translate(-2px, 2px); transition: opacity 0.15s, transform 0.15s; }
a.stat[href]:hover .stat-label .go { opacity: 1; transform: none; }
.stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; height: 31px; }
.stat-value {
  font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.stat-value.is-empty { color: var(--text-3); }
.stat.is-hot .stat-value { color: var(--accent-text); }
.stat.is-bad .stat-value { color: var(--bad); }
.stat.is-ok .stat-value { color: var(--ok); }
.stat-foot { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; min-height: 19px; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.spark { width: 96px; height: 30px; color: var(--accent); overflow: visible; flex: none; }
.spark .area { fill: currentColor; opacity: 0.14; }
.spark .line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ── list rows ───────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list.scroll { max-height: clamp(260px, 46vh, 460px); overflow-y: auto; overscroll-behavior: contain; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; min-height: 60px; flex-shrink: 0;
  border-top: 1px solid var(--border);
  transition: background 0.15s, opacity 0.2s;
}
.row:hover { background: color-mix(in srgb, var(--surface) 55%, var(--surface-2)); }
.row.is-claimed { opacity: 0.6; }
.row.is-claimed:hover { opacity: 0.85; }
.row.is-ghost { opacity: 0.62; }
.row-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.row-title .mono { color: var(--text-2); font-weight: 400; }
.row-meta { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.row-time { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; min-width: 34px; text-align: right; }
.claimed-by { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ok); white-space: nowrap; }
.row.row-enter { opacity: 0; transform: translateY(-4px); }
.row.row-enter.in { opacity: 1; transform: none; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }

/* table-like log rows: time · kind · member · details · link */
.log-row { display: grid; grid-template-columns: 44px 128px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.log-row .row-time { text-align: left; }
.log-row .tag { justify-self: start; }

/* ── avatars ─────────────────────────────────────────────────────────────── */
.avatar {
  --h: 30;
  width: 32px; height: 32px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center;
  background: hsl(var(--h) 38% 30%); color: hsl(var(--h) 80% 88%);
  font: 600 12px/1 var(--font); letter-spacing: 0.01em;
}
:root[data-theme="light"] .avatar { background: hsl(var(--h) 70% 90%); color: hsl(var(--h) 55% 30%); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .i { width: 16px; height: 16px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.sm .i { width: 13px; height: 13px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ── empty states + banners ──────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 34px 20px 36px; border-top: 1px solid var(--border);
}
.empty.flush { border-top: 0; }
.empty-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px; background: var(--surface-2); color: var(--text-3); }
.empty.is-ok .empty-icon { background: var(--ok-soft); color: var(--ok); }
.empty.is-off .empty-icon { background: var(--bad-soft); color: var(--bad); }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text); }
.empty-text { font-size: 13px; color: var(--text-3); max-width: 44ch; }

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent);
  background: var(--warn-soft); color: var(--text); font-size: 13.5px;
}
.banner .i { color: var(--warn); margin-top: 1px; }
.banner b { font-weight: 600; }

/* ── skeletons ───────────────────────────────────────────────────────────── */
.skel {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel.circle { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.skel.line { height: 11px; }
.skel-stack { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.w-20 { width: 20%; } .w-30 { width: 30%; } .w-40 { width: 40%; } .w-50 { width: 50%; } .w-60 { width: 60%; }
.skel-text { display: inline-block; width: 260px; max-width: 70%; height: 12px; vertical-align: middle; }

/* ── segmented control ───────────────────────────────────────────────────── */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px; flex: none;
  background: transparent; color: var(--text-2); font: 500 12.5px/1 var(--font);
  cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border-2);
}

/* ── meters (bars) ───────────────────────────────────────────────────────── */
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span {
  display: block; height: 100%; border-radius: inherit; background: var(--accent);
  width: calc(var(--w, 0) * 100%);
  transition: width 0.7s var(--ease);
}
.meter.thin { height: 6px; }
.meter.ok > span { background: var(--ok); }

/* ── charts ──────────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; height: 280px; }
.chart.heat { height: 260px; }
.chart.short { height: 200px; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.35s var(--ease); }
.chart.is-ready canvas { opacity: 1; }
.chart .chart-ovl { pointer-events: none; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 20px;
  text-align: center; font-size: 13px; color: var(--text-3); pointer-events: none;
}
.chart-empty span { background: var(--surface); padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
  padding: 9px 11px; border-radius: 10px;
  background: var(--tip-bg); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  font-size: 12.5px; color: var(--text);
  opacity: 0; transform: translateY(3px); transition: opacity 0.12s, transform 0.12s;
}
.chart-tip.show { opacity: 1; transform: none; }
.tip-title { font-size: 12px; color: var(--text-3); margin-bottom: 6px; white-space: nowrap; }
.tip-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tip-row + .tip-row { margin-top: 4px; }
.tip-row .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tip-row .v { margin-left: auto; padding-left: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-foot { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--text-3); }
.tip-foot b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-note { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 12px; color: var(--accent-text); font-weight: 500; }

.chart-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.legend .sw.neg { background: var(--chart-neg); }
.heat-scale { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.heat-scale .steps { display: inline-flex; gap: 3px; }
.heat-scale .steps i { width: 11px; height: 11px; border-radius: 3px; }
.heat-scale .steps i:nth-child(1) { background: var(--heat-empty); box-shadow: inset 0 0 0 1px var(--border); }
.heat-scale .steps i:nth-child(2) { background: var(--heat-0); }
.heat-scale .steps i:nth-child(3) { background: var(--heat-1); }
.heat-scale .steps i:nth-child(4) { background: var(--heat-2); }
.heat-scale .steps i:nth-child(5) { background: var(--heat-3); }

/* ── form fields ─────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.btn .label { color: inherit; font: inherit; }
.input {
  width: 100%; height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--bg); color: var(--text); font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.code {
  height: 54px; text-align: center; font: 600 24px/1 var(--mono); letter-spacing: 0.42em; padding-left: 0.42em;
}
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.field-error { font-size: 12.5px; color: var(--bad); }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--bg-elev) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px), var(--border) var(--sidebar-w), transparent var(--sidebar-w));
}

/* sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  view-transition-name: sidebar;
}
.sb-brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 16px; flex: none; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.brand-name b { font-weight: 700; color: var(--accent-text); }
.brand-tag { margin-left: auto; font: 600 10.5px/1 var(--font); letter-spacing: 0.04em; color: var(--text-3); border: 1px solid var(--border-2); border-radius: 6px; padding: 4px 6px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav-label { padding: 18px 10px 6px; font: 600 11px/1 var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav-link .i { color: var(--text-3); transition: color 0.12s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .i { color: var(--text-2); }
.nav-link.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav-link.is-active .i { color: var(--accent); }
.nav-link .nav-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
  font: 600 11.5px/1 var(--font); font-variant-numeric: tabular-nums;
}
.nav-badge.is-bad { background: var(--bad-soft); color: var(--bad); }
.nav-skel { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px; }
.nav-skel .skel { height: 14px; }

.sb-foot { flex: none; padding: 10px; border-top: 1px solid var(--border); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.sb-user .u-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.u-name { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-tier { font-size: 12px; color: var(--text-3); }

/* main + topbar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 20px 0 24px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  view-transition-name: topbar;
}
.tb-menu { display: none; margin-left: -8px; }
.tb-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; }
.tb-crumbs .server { color: var(--text-3); white-space: nowrap; }
.tb-crumbs .sep { color: var(--border-2); }
.tb-crumbs .page { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-spacer { flex: 1; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; width: 280px; padding: 0 8px 0 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-3); font-size: 13px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.search-btn:hover { border-color: var(--border-2); color: var(--text-2); }
.search-btn .lbl { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-btn kbd { height: 20px; }
.tb-updated { font-size: 12.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

.content { width: 100%; max-width: 1380px; margin: 0 auto; padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 20px; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 4px; }
.page-title { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; }
.page-sub { margin-top: 6px; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-sub b { color: var(--text); font-weight: 600; }
.page-sub .hot { color: var(--accent-text); font-weight: 600; }
.page-sub .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: 0.7; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* layout grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.stretch { align-items: stretch; }
.stretch > .card { height: 100%; }

/* scrim for the mobile drawer */
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
body.nav-open .scrim { opacity: 1; pointer-events: auto; }

/* ── command palette ─────────────────────────────────────────────────────── */
.pal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px;
  background: rgba(5, 5, 7, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fadeIn 0.12s ease;
}
:root[data-theme="light"] .pal-backdrop { background: rgba(20, 20, 26, 0.28); }
.palette {
  width: min(580px, 100%); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: popIn 0.16s var(--ease);
}
.pal-input-wrap { position: relative; border-bottom: 1px solid var(--border); }
.pal-input-wrap .i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.pal-input { width: 100%; height: 54px; padding: 0 16px 0 46px; border: 0; background: transparent; color: var(--text); font-size: 15px; }
.pal-input:focus { outline: none; }
.pal-list { max-height: min(380px, 52vh); overflow-y: auto; padding: 6px; }
.pal-group { padding: 10px 10px 4px; font: 600 11px/1 var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.pal-item { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 8px; color: var(--text-2); cursor: pointer; font-size: 14px; }
.pal-item .i { color: var(--text-3); }
.pal-item .hint { margin-left: auto; font-size: 12px; color: var(--text-3); }
.pal-item[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.pal-item[aria-selected="true"] .i { color: var(--accent); }
.pal-empty { padding: 26px 12px; text-align: center; color: var(--text-3); font-size: 13px; }
.pal-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.pal-foot span { display: inline-flex; align-items: center; gap: 5px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(0.985); } }

/* ── toast ───────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  background: var(--tip-bg); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  font-size: 13.5px; color: var(--text); animation: popIn 0.18s var(--ease);
}
.toast .i { color: var(--ok); }
.toast.is-bad .i { color: var(--bad); }

/* ============================================================================
   PAGE PIECES
   ============================================================================ */

/* command: all-clear hero */
.allclear { display: flex; align-items: center; gap: 18px; padding: 26px 24px; }
.allclear .ac-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); flex: none; }
.allclear .ac-icon .i { width: 26px; height: 26px; stroke-width: 2; }
.allclear h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.allclear p { margin-top: 3px; color: var(--text-2); font-size: 14px; }

/* newcomers: activation funnel */
.funnel { display: flex; flex-direction: column; padding: 4px 18px 20px; }
.f-stage { display: grid; grid-template-columns: 120px minmax(0, 1fr) 92px; align-items: center; gap: 14px; }
.f-label { font-size: 13.5px; font-weight: 500; color: var(--text); }
.f-track { height: 30px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.f-fill { display: block; height: 100%; width: calc(var(--w, 0) * 100%); border-radius: 8px; background: var(--accent); transition: width 0.8s var(--ease); }
.f-val { text-align: right; display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
.f-val b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.f-val span { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 34px; }
.f-drop { display: grid; grid-template-columns: 120px minmax(0, 1fr) 92px; gap: 14px; height: 30px; align-items: center; }
.f-drop .conv { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); padding-left: 2px; }
.f-drop .conv .i { width: 14px; height: 14px; }
.ret-big { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ret-wrap { display: flex; flex-direction: column; gap: 12px; padding: 4px 18px 20px; }
.ret-wrap .meter { height: 10px; }
.ret-caption { font-size: 13px; color: var(--text-2); }

/* staff: spotlight + leaderboard */
.spotlight {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--surface);
  border-color: var(--accent-line);
}
.spotlight .sp-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.spotlight .sp-icon .i { width: 22px; height: 22px; }
.spotlight .sp-body { flex: 1; min-width: 0; }
.spotlight .sp-label { font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.spotlight .sp-name { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotlight .sp-stat { text-align: right; }
.spotlight .sp-stat b { display: block; font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.spotlight .sp-stat span { font-size: 12.5px; color: var(--text-3); }
.spotlight.is-calm { background: var(--surface); border-color: var(--border); }
.spotlight.is-calm .sp-icon { background: var(--surface-2); color: var(--text-3); }
.spotlight.is-calm .sp-name { font-size: 15px; font-weight: 500; color: var(--text-2); white-space: normal; }

.lb-row { display: grid; grid-template-columns: 28px 32px minmax(0, 1fr) 110px; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex-shrink: 0; }
.lb-row.row-enter { opacity: 0; transform: translateY(4px); }
.lb-row.in { opacity: 1; transform: none; transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); }
.lb-row.lb-head { min-height: 0; padding-top: 9px; padding-bottom: 9px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.lb-row.lb-head span:last-child { text-align: right; }
.lb-rank { font-size: 14px; font-weight: 600; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.lb-row.r1 .lb-rank { color: var(--accent-text); }
.lb-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.lb-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); text-decoration: none; min-width: 0; }
.lb-name span.nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.lb-name:hover span.nm { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); }
.lb-stat { text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.lb-stat b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-stat span { font-size: 12px; color: var(--text-3); }

.you-badge { height: 18px; padding: 0 6px; border-radius: 5px; font: 700 10.5px/18px var(--font); letter-spacing: 0.04em; background: var(--accent-soft); color: var(--accent-text); flex: none; }

/* pulse + staff: bar list */
.barlist { display: flex; flex-direction: column; gap: 14px; padding: 4px 18px 20px; }
.bar-item { display: flex; flex-direction: column; gap: 7px; }
.bar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.bar-top .nm { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-top .v { color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 500; }

/* cases: member lookup */
.lookup-form { display: flex; gap: 8px; padding: 0 18px 14px; }
.lookup-form .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13.5px; }
.lookup-hint { padding: 0 18px 18px; font-size: 13px; color: var(--text-3); }
.lookup-error { margin: 0 18px 14px; font-size: 13px; color: var(--bad); }
.lk { border-top: 1px solid var(--border); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.lk.enter { opacity: 0; transform: translateY(4px); }
.lk.enter.in { opacity: 1; transform: none; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
.lk-head { display: flex; align-items: center; gap: 12px; }
.lk-head .grow { flex: 1; min-width: 0; }
.lk-id { font-size: 15px; font-weight: 600; }
.lk-full { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.lk-facts { display: flex; gap: 10px; flex-wrap: wrap; }
.lk-fact { flex: 1; min-width: 120px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.lk-fact b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lk-fact b.hot { color: var(--bad); }
.lk-fact span { font-size: 12.5px; color: var(--text-3); }
.lk-clean { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-size: 13.5px; font-weight: 500; }
.lk-sec h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.lk-line { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.lk-line:first-of-type { border-top: 0; }
.lk-line .txt { flex: 1; min-width: 0; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lk-line .when { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* gatekeeper: status band */
.gate { display: flex; align-items: center; gap: 18px; padding: 22px; }
.gate-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gate-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.gate-icon .i { width: 26px; height: 26px; stroke-width: 2; }
.gate.is-hot .gate-icon { background: var(--bad-soft); color: var(--bad); }
.gate.is-off .gate-icon { background: var(--surface-2); color: var(--text-3); }
.gate h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.gate h2 b { color: var(--bad); }
.gate p { color: var(--text-2); font-size: 13.5px; }
.gate .posture { margin-top: 10px; }
.gate-side { flex: none; }
.posture { display: flex; gap: 8px; flex-wrap: wrap; }
.posture .badge { height: 26px; padding: 0 10px; font-size: 12px; font-weight: 500; }
.posture .badge b { font-weight: 600; }

/* settings: key/value rows */
.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 18px; border-top: 1px solid var(--border); font-size: 13.5px; min-height: 46px; }
.kv-row .k { color: var(--text-2); }
.kv-row .v { color: var(--text); font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.kv-row .v.mono { font-weight: 400; }
.kv.is-stale .badge { opacity: 0.6; }
.state-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.state-dot i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state-dot.on { color: var(--ok); }
.state-dot.hot { color: var(--bad); }
.state-dot.warn { color: var(--warn); }
.state-dot.dim { color: var(--text-3); }

/* ============================================================================
   v3 PIECES: inbox, overview, tabs, coverage
   ============================================================================ */
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }

/* counts inside filters and tabs */
.seg button .ct, .tab .ct {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; font: 600 11px/1 var(--font); font-variant-numeric: tabular-nums;
}
.seg button .ct { background: var(--accent-soft); color: var(--accent-text); }
.seg button .ct.is-zero { background: var(--surface-3); color: var(--text-3); }
.tab .ct { background: var(--surface-3); color: var(--text-2); }
.tab .ct.is-bad { background: var(--bad-soft); color: var(--bad); }

/* wait timers: neutral, then amber, then red as something sits unanswered */
.wait { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; min-width: 48px; font: 600 12.5px/1 var(--font); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wait i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.wait.is-warn { color: var(--warn); }
.wait.is-late { color: var(--bad); }
.row.is-claimed .wait { color: var(--text-3); }
.list-divider {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 9px 18px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 60%, var(--bg));
  font-size: 12px; font-weight: 600; color: var(--text-3);
}
.list-divider .ct { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; }

/* page + right rail */
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.with-rail.no-rail { grid-template-columns: minmax(0, 1fr); }
.rail-main { min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.inbox-head { padding-bottom: 12px; }

/* first-run tip */
.tip-card {
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border-color: var(--accent-line);
  background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%), var(--surface);
}
.tip-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.tip-head .i { color: var(--accent); }
.tip-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--text-2); }
.tip-steps b { color: var(--text); font-weight: 600; }
.tip-card .btn { align-self: flex-start; }

/* you card */
.you-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.you-head { display: flex; align-items: center; gap: 12px; }
.you-head .u-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.you-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.you-stat { padding: 10px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.you-stat b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.you-stat span { font-size: 11.5px; line-height: 1.3; color: var(--text-3); }
.you-foot { display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--text-2); }
.you-line { display: flex; align-items: flex-start; gap: 8px; }
.you-line .i { margin-top: 3px; color: var(--text-3); }
.you-line b { color: var(--text); font-weight: 600; }
.you-nudge { font-size: 13px; color: var(--accent-text); }

/* overview: needs-you strip */
.attention {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px 14px 18px;
  border-color: var(--accent-line);
  background: linear-gradient(90deg, var(--accent-soft), transparent 65%), var(--surface);
}
.attention.is-ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: linear-gradient(90deg, var(--ok-soft), transparent 65%), var(--surface); }
.attention.is-off { border-color: var(--border); background: var(--surface); }
.att-items { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.att-item {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.att-item:hover { border-color: var(--border-2); color: var(--text); }
.att-item .i { color: var(--accent); }
.att-item.is-bad .i { color: var(--bad); }
.att-item b { font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.att-side { display: flex; align-items: center; gap: 14px; flex: none; }
.att-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.att-main b { display: block; font-size: 14.5px; font-weight: 600; }
.att-main span { font-size: 13px; color: var(--text-2); }
.att-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-3); }
.attention.is-ok .att-icon { background: var(--ok-soft); color: var(--ok); }
.attention.is-off .att-icon { background: var(--bad-soft); color: var(--bad); }

/* overview: team + moderation snapshots */
#team-snap, #mod-snap { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.snap-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.snap-line .i { flex: none; color: var(--accent); }
.snap-line b { color: var(--text); font-weight: 600; }
.muted-line { font-size: 12.5px; color: var(--text-3); }
.muted-line .i { color: var(--text-3); }
.muted-line .tag { height: 20px; font-size: 11px; vertical-align: middle; }
.mini-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mini-row { display: grid; grid-template-columns: 16px 24px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13.5px; }
.mini-row + .mini-row { border-top: 1px solid var(--border); }
.mini-rank { text-align: center; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mini-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.mini-val { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.mini-val b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.mini-sub { min-width: 64px; text-align: right; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.snap-note { font-size: 13px; color: var(--text-3); }
.snap-callout { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13px; text-decoration: none; transition: background 0.15s; }
.snap-callout:hover { background: var(--surface-3); }
.snap-callout b { color: var(--text); }
.snap-callout > .i:first-child { flex: none; }
.snap-callout > .i:last-child { margin-left: auto; flex: none; color: var(--text-3); }
.snap-callout.is-warn > .i:first-child { color: var(--warn); }
.snap-callout.is-ok > .i:first-child { color: var(--ok); }
.snap-status { display: flex; align-items: center; gap: 12px; }
.snap-status b { display: block; font-size: 14.5px; font-weight: 600; }
.snap-status span { font-size: 12.5px; color: var(--text-3); }
.snap-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.snap-status.is-hot .snap-ic { background: var(--bad-soft); color: var(--bad); }
.snap-status.is-off .snap-ic { background: var(--surface-2); color: var(--text-3); }
.snap-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fact span { font-size: 12px; color: var(--text-3); }
.fact.is-bad b { color: var(--bad); }
.gate-facts { display: flex; gap: 8px; flex: none; }
.gate-facts .fact { min-width: 112px; }

/* tabs */
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; flex: none; height: 46px; padding: 0 10px;
  border: 0; background: none; color: var(--text-2); font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.page-tabs { padding: 0; margin-top: -6px; }
.page-tabs .tab { height: 42px; padding: 0 12px; font-size: 14px; }
.page-tabs .tab:first-child { padding-left: 2px; }
.page-tabs .tab:first-child[aria-selected="true"]::after { left: 0; }
.tab-panel.stack { display: flex; flex-direction: column; gap: 16px; }
.tab-panel > .list:first-child > :first-child { border-top: 0; }
.tab-panel .empty { border-top: 0; }
.panel-note { padding: 12px 18px; font-size: 12.5px; color: var(--text-3); }
.panel-sub { padding: 14px 18px 4px; font-size: 13px; color: var(--text-2); }
.panel-sub b { color: var(--text); }
.panel-title { padding: 6px 18px 10px; font-size: 13.5px; font-weight: 600; }
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-bar .seg { margin-left: auto; }
.panel-lead { font-size: 13.5px; color: var(--text-2); }
.panel-lead:empty { display: none; }
.h-channels { margin-bottom: 12px; }
.bar-top .share { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.funnel.wide .f-stage, .funnel.wide .f-drop { grid-template-columns: 140px minmax(0, 1fr) 110px; }

/* team: coverage */
.cov-callout { display: flex; align-items: flex-start; gap: 10px; margin: 0 18px 4px; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13.5px; }
.cov-callout[hidden] { display: none; }
.cov-callout b { color: var(--text); }
.cov-callout .i { flex: none; margin-top: 2px; }
.cov-callout.is-warn { background: var(--warn-soft); }
.cov-callout.is-warn .i { color: var(--warn); }
.cov-callout.is-ok { background: var(--ok-soft); }
.cov-callout.is-ok .i { color: var(--ok); }
.legend .sw.line { width: 14px; height: 2px; border-radius: 2px; background: var(--text); }
.legend .sw.bar { background: var(--chart-bar); }
.lb-row.is-me { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* ── tickets ────────────────────────────────────────────────────────────── */
/* someone else's ticket still shows when it's overdue */
.row.is-claimed .wait.is-warn { color: var(--warn); }
.row.is-claimed .wait.is-late { color: var(--bad); }
/* "Take over" asks for a second click */
.btn.is-confirm, .btn.is-confirm:hover { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.meter.bad > span { background: var(--bad); }
.meter.info > span { background: var(--info); }
.rail-main.stack { display: flex; flex-direction: column; gap: 16px; }
.list-more { display: flex; justify-content: center; padding: 8px 18px 12px; border-top: 1px solid var(--border); }
#t-panels { flex-wrap: wrap; }

/* ============================================================================
   SIGN-IN SCREENS
   ============================================================================ */
body.auth {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 32px 16px;
  background:
    radial-gradient(900px 520px at 50% -12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(600px 400px at 85% 110%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%),
    var(--bg);
}
.auth-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.auth-card {
  width: 100%; padding: 30px 28px 26px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: rise 0.45s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 30px; height: 30px; }
.auth-brand .brand-name { font-size: 16px; }
.auth-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.auth-lead { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.auth-body { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field + .field { margin-top: 0; }
.auth-hint { font-size: 12.5px; color: var(--text-3); text-align: center; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-alt { display: flex; justify-content: center; }
.auth-foot { font-size: 12.5px; color: var(--text-3); text-align: center; }
.auth-foot a { color: var(--text-2); text-decoration: none; }
.auth-foot a:hover { color: var(--text); }
.btn-discord { background: #5865f2; border-color: transparent; color: #fff; font-weight: 600; }
.btn-discord:hover { background: #4752c4; }
.btn-discord svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: 10px;
  background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
  color: var(--text); font-size: 13.5px;
}
.notice svg { width: 17px; height: 17px; flex: none; color: var(--bad); margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-step-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.auth-step-label .n { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; }
.qr-box { align-self: center; padding: 10px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-md); min-width: 168px; min-height: 168px; display: grid; place-items: center; }
.qr-box img { display: block; image-rendering: pixelated; max-width: 240px; height: auto; }
.qr-box.is-empty {
  box-shadow: none;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
.key-box {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; border: 1px dashed var(--border-2); background: var(--bg);
  font: 500 13.5px/1.4 var(--mono); letter-spacing: 0.06em; color: var(--text);
  cursor: copy; user-select: all; word-break: break-all;
}
.key-box:hover { border-color: var(--accent-line); }
.key-box::after { content: "Click to copy"; margin-left: auto; flex: none; font: 500 11.5px/1 var(--font); letter-spacing: 0; color: var(--text-3); }
.key-box.copied { border-style: solid; border-color: var(--ok); }
.key-box.copied::after { content: "Copied"; color: var(--ok); }
.key-meta { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.btn .spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; display: none; }
.btn[aria-busy="true"] .spinner { display: inline-block; }
.btn[aria-busy="true"] .arrow { display: none; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1200px) {
  .search-btn { width: 220px; }
}
@media (max-width: 1100px) {
  .with-rail { grid-template-columns: minmax(0, 1fr); }
  .grid-12 > [class*="span-"] { grid-column: span 12; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: auto;
    transform: translateX(-102%); transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .tb-menu { display: inline-grid; }
  .tb-crumbs .server, .tb-crumbs .sep { display: none; }
  .search-btn { width: 34px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-btn .lbl, .search-btn kbd { display: none; }
  .topbar { padding: 0 12px 0 16px; }
  .content { padding: 20px 16px 48px; gap: 16px; }
}
@media (max-width: 640px) {
  .page-sub { flex-direction: column; align-items: flex-start; gap: 3px; }
  .page-sub .dotsep { display: none; }
  .tb-updated, .tb-sep { display: none; }
  .page-title { font-size: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 14px; }
  .stat-value { font-size: 24px; }
  .spark { width: 64px; }
  .row { flex-wrap: wrap; padding: 12px 14px; }
  .row-actions { width: 100%; justify-content: flex-end; padding-left: 46px; }
  .row-actions:empty { display: none; }
  .log-row { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 6px; }
  .log-row .row-time { grid-column: 1; grid-row: 1; }
  .log-row .tag { grid-column: 2; grid-row: 1; justify-self: start; }
  .log-row .row-actions { grid-column: 3; grid-row: 1; width: auto; padding-left: 0; }
  .log-row .row-main { grid-column: 2 / -1; grid-row: 2; }
  .card-head { padding: 14px 14px 12px; }
  .card-body { padding: 0 14px 14px; }
  .kv-row, .lb-row { padding-left: 14px; padding-right: 14px; }
  .lb-row { grid-template-columns: 22px 28px minmax(0, 1fr) 72px; gap: 10px; }
  .f-stage, .f-drop { grid-template-columns: 92px minmax(0, 1fr) 70px; gap: 10px; }
  .f-val span { display: none; }
  .funnel, .barlist, .ret-wrap { padding-left: 14px; padding-right: 14px; }
  .lookup-form, .lookup-hint { padding-left: 14px; padding-right: 14px; }
  .lk { padding: 14px; }
  .chart.heat { height: 230px; }
  .spotlight { flex-wrap: wrap; }
  .allclear { padding: 20px; }
  .gate { flex-wrap: wrap; padding: 18px; align-items: flex-start; }
  .gate-side { width: 100%; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .attention { padding: 14px; }
  .att-items, .att-side { width: 100%; }
  .att-side { justify-content: space-between; }
  .att-item { flex: 1 1 auto; }
  .mini-sub { display: none; }
  .gate-facts { width: 100%; }
  .gate-facts .fact { flex: 1; min-width: 0; }
  .funnel.wide .f-stage, .funnel.wide .f-drop { grid-template-columns: 92px minmax(0, 1fr) 70px; }
  .row .wait { min-width: 0; }
  .list-divider { padding-left: 14px; padding-right: 14px; }
  .cov-callout { margin-left: 14px; margin-right: 14px; }
  #team-snap, #mod-snap { padding-left: 14px; padding-right: 14px; }
  .filters { width: 100%; }
  .filters button { flex: 1; }
  /* four chips don't fit one row on a phone: two by two instead of clipping the last one */
  .filters, #t-panels:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
