/* Tokens, reset, shell. Neutral zinc surfaces; chart hues follow the validated categorical order. */

:root {
  color-scheme: light;
  --canvas: #fafafa;
  --bg: #ffffff;
  --card: #ffffff;
  --fg: #09090b;
  --fg-2: #3f3f46;
  --muted: #f4f4f5;
  --muted-2: #e4e4e7;
  --muted-fg: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --primary: #18181b;
  --primary-fg: #fafafa;
  --ring: rgba(42, 120, 214, 0.45);
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, 0.1);
  --accent-fg: #1c5cab;

  --good: #0ca30c;
  --good-fg: #006300;
  --good-soft: rgba(12, 163, 12, 0.12);
  --warn: #fab219;
  --warn-fg: #8a5a00;
  --warn-soft: rgba(250, 178, 25, 0.2);
  --serious: #ec835a;
  --bad: #d03b3b;
  --bad-fg: #b42318;
  --bad-soft: rgba(208, 59, 59, 0.1);
  --info: #2a78d6;
  --info-fg: #1c5cab;
  --info-soft: rgba(42, 120, 214, 0.1);
  --idle: #a1a1aa;

  --c1: #2a78d6;
  --c2: #eb6834;
  --c3: #1baf7a;
  --c4: #eda100;
  --c5: #e87ba4;
  --c6: #008300;
  --c7: #6250d6;
  --c8: #e34948;

  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.05);
  --shadow-md: 0 4px 12px rgba(9, 9, 11, 0.08), 0 1px 3px rgba(9, 9, 11, 0.06);
  --shadow-lg: 0 16px 40px rgba(9, 9, 11, 0.16), 0 2px 8px rgba(9, 9, 11, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 236px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0c0c0e;
  --bg: #09090b;
  --card: #0e0e11;
  --fg: #fafafa;
  --fg-2: #d4d4d8;
  --muted: #18181b;
  --muted-2: #27272a;
  --muted-fg: #a1a1aa;
  --border: #27272a;
  --border-strong: #3f3f46;
  --primary: #fafafa;
  --primary-fg: #18181b;
  --ring: rgba(57, 135, 229, 0.55);
  --accent: #3987e5;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --accent-fg: #6da7ec;

  --good-fg: #5fd08a;
  --good-soft: rgba(12, 163, 12, 0.18);
  --warn-fg: #f0be58;
  --warn-soft: rgba(250, 178, 25, 0.16);
  --bad: #e66767;
  --bad-fg: #ff8a80;
  --bad-soft: rgba(230, 103, 103, 0.16);
  --info: #3987e5;
  --info-fg: #6da7ec;
  --info-soft: rgba(57, 135, 229, 0.16);

  --c1: #3987e5;
  --c2: #d95926;
  --c3: #199e70;
  --c4: #c98500;
  --c5: #d55181;
  --c6: #008300;
  --c7: #9085e9;
  --c8: #e66767;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font: 14px/1.5 var(--font);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
code, pre, kbd, samp, .mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted-fg); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 2rem; }

/* ---- shell ---- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 10px 10px; z-index: 30; background: var(--canvas);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; flex: none; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted-fg); letter-spacing: 0; line-height: 1.1; }
.nav-group { display: grid; gap: 1px; margin-bottom: 10px; }
.nav-label { font-size: 11px; font-weight: 500; color: var(--muted-fg); padding: 6px 8px 4px; letter-spacing: 0.01em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px; border-radius: 6px;
  color: var(--fg-2); font-weight: 500; font-size: 13.5px; position: relative;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.nav-item svg { color: var(--muted-fg); flex: none; transition: color 120ms var(--ease); }
.nav-item:hover { background: var(--muted); color: var(--fg); }
.nav-item.active { background: var(--muted); color: var(--fg); }
.nav-item.active svg { color: var(--fg); }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.nav-item .count.alert { color: var(--bad-fg); background: var(--bad-soft); border-radius: 999px; padding: 0 6px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.who-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.who-card .avatar { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-fg); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
.who-card strong { display: block; font-size: 13px; line-height: 1.2; }
.who-card span { font-size: 11.5px; color: var(--muted-fg); }

.inset {
  min-width: 0; margin: 8px 8px 8px 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: clip; display: flex; flex-direction: column;
}
.topbar {
  position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted-fg); min-width: 0; }
.crumbs a:hover { color: var(--fg); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--fg); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; width: 220px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--muted-fg); cursor: pointer; font-size: 13px;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease);
}
.search-btn:hover { border-color: var(--border-strong); background: var(--muted); }
.search-btn kbd { margin-left: auto; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted-fg); border: 1px solid var(--border); white-space: nowrap; }
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); }
.live-pill.ok .dot { background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: ping 2.4s ease-out infinite; }
.live-pill.bad { color: var(--bad-fg); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.live-pill.bad .dot { background: var(--bad); }

main { padding: 24px 28px 48px; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; }
main:focus { outline: none; }
main > * + * { margin-top: 20px; }
.enter { animation: enter 220ms var(--ease) both; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -0.025em; }
.page-head p { color: var(--muted-fg); margin-top: 4px; font-size: 14px; max-width: 72ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; opacity: 0; pointer-events: none; transition: opacity 180ms var(--ease); }

@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position-x: -200%; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

@media (max-width: 1100px) { .search-btn { width: 36px; padding: 0; justify-content: center; } .search-btn span, .search-btn kbd { display: none; } }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); height: 100%; transform: translateX(-102%); transition: transform 220ms var(--ease); border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .inset { margin: 0; border: none; border-radius: 0; box-shadow: none; min-height: 100vh; }
  .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: inline-grid; }
  .live-pill span { display: none; }
  .live-pill { padding: 0 8px; }
  main { padding: 18px 14px 40px; }
}

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