/* Suricode app stylesheet. Seven colour themes, each in light and dark, one accent, calm status colours. */

/* Tokens
   Every colour is a custom property. A theme sets its tokens once, as
   light-dark(light, dark) pairs, and color-scheme on <html> picks the half:
   "light dark" follows the device, data-mode pins one. The plain values at
   the top of :root are the fallback for browsers without light-dark(). */

:root {
  color-scheme: light dark;
  --ui: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-small: 8px;
  --shadow-card: 0 1px 2px var(--shadow-1), 0 8px 24px var(--shadow-1);
  --shadow-lift: 0 2px 4px var(--shadow-2), 0 14px 34px var(--shadow-3);

  /* Fallback: brand, light. The logo orange, on zinc paper. */
  --ink: #0a0a0c;
  --muted: #52525b;
  --faint: #71717a;
  --line: #e4e4e7;
  --line-soft: #f4f4f5;
  --paper: #f4f4f5;
  --card: #ffffff;
  --sunken: #ececee;
  --accent: #c46604;
  --accent-ink: #a85a04;
  --accent-quiet: #ffedd5;
  --danger: #be123c;
  --on-danger: #fff1f2;
  --focus: #c46604;
  --on-ink: #ffffff;
  --sidebar: #f4f4f5;
  --sidebar-text: #0a0a0c;
  --sidebar-mark: #c46604;
  --sidebar-muted: #71717a;
  --sidebar-hover: #e4e4e7;
  --sidebar-active: #ffffff;
  --sidebar-line: #e4e4e7;
  --shadow-1: rgba(10, 10, 12, 0.05);
  --shadow-2: rgba(10, 10, 12, 0.06);
  --shadow-3: rgba(10, 10, 12, 0.08);
  --tone-red-bg: #ffe4e6;
  --tone-red-fg: #9f1239;
  --tone-orange-bg: #ffedd5;
  --tone-orange-fg: #9a3412;
  --tone-amber-bg: #fef3c7;
  --tone-amber-fg: #92400e;
  --tone-stone-bg: #f1f5f9;
  --tone-stone-fg: #334155;
  --tone-green-bg: #dcfce7;
  --tone-green-fg: #166534;
  --tone-indigo-bg: #e0e7ff;
  --tone-indigo-fg: #3730a3;
  --tone-sand-bg: #dbeafe;
  --tone-sand-fg: #1d4ed8;
  --tone-sky-bg: #e0f2fe;
  --tone-sky-fg: #075985;
  --dot-ok: #15803d;
  --dot-fail: #be123c;
  --dot-busy: #b45309;
  --fig-alarm: #be123c;
  --fig-warn: #c2410c;

  /* Status colours shared by the themes; a theme overrides only what differs. */
  --tone-red-bg: light-dark(#ffe4e6, #45151f);
  --tone-red-fg: light-dark(#9f1239, #fecdd3);
  --tone-orange-bg: light-dark(#ffedd5, #45220f);
  --tone-orange-fg: light-dark(#9a3412, #fed7aa);
  --tone-amber-bg: light-dark(#fef3c7, #402c0c);
  --tone-amber-fg: light-dark(#92400e, #fde68a);
  --tone-stone-bg: light-dark(#e7e5e4, #302c29);
  --tone-stone-fg: light-dark(#44403c, #d6d3d1);
  --tone-green-bg: light-dark(#dcfce7, #123122);
  --tone-green-fg: light-dark(#166534, #bbf7d0);
  --tone-indigo-bg: light-dark(#e0e7ff, #1f2352);
  --tone-indigo-fg: light-dark(#3730a3, #c7d2fe);
  --tone-sand-bg: light-dark(#f3e2d2, #3a2416);
  --tone-sand-fg: light-dark(#9a3412, #fed7aa);
  --tone-sky-bg: light-dark(#e0f2fe, #0c2a3d);
  --tone-sky-fg: light-dark(#075985, #bae6fd);
  --dot-ok: light-dark(#15803d, #4ade80);
  --dot-fail: light-dark(#be123c, #fb7185);
  --dot-busy: light-dark(#b45309, #fbbf24);
  --fig-alarm: light-dark(#be123c, #fb7185);
  --fig-warn: light-dark(#c2410c, #fbbf24);
}

[data-mode="light"] { color-scheme: light; }
[data-mode="dark"] { color-scheme: dark; }
@supports not (color: light-dark(#000, #fff)) {
  :root { color-scheme: light; }
}

/* Brand: the homepage. Near-black and zinc, logo orange for actions. */
[data-theme="lime"] {
  --display: var(--ui);
  --ink: light-dark(#0a0a0c, #f4f4f5);
  --muted: light-dark(#52525b, #a1a1aa);
  --faint: light-dark(#71717a, #71717a);
  --line: light-dark(#e4e4e7, #2a2a2e);
  --line-soft: light-dark(#f4f4f5, #1c1c20);
  --paper: light-dark(#f4f4f5, #0a0a0c);
  --card: light-dark(#ffffff, #121214);
  --sunken: light-dark(#ececee, #1c1c20);
  --accent: light-dark(#c46604, #ee8105);
  --accent-ink: light-dark(#a85a04, #ff9d2e);
  --accent-quiet: light-dark(#ffedd5, #2a1808);
  --danger: light-dark(#be123c, #fda4af);
  --on-danger: light-dark(#fff1f2, #3f0a16);
  --focus: light-dark(#c46604, #ee8105);
  --on-ink: light-dark(#0a0a0c, #0a0a0c);
  --sidebar: light-dark(#f4f4f5, #0a0a0c);
  --sidebar-text: light-dark(#0a0a0c, #f4f4f5);
  --sidebar-mark: light-dark(#c46604, #ee8105);
  --sidebar-muted: light-dark(#71717a, #a1a1aa);
  --sidebar-hover: light-dark(#e4e4e7, rgba(255, 255, 255, 0.06));
  --sidebar-active: light-dark(#ffffff, rgba(255, 255, 255, 0.12));
  --sidebar-line: light-dark(#e4e4e7, transparent);
  --shadow-1: light-dark(rgba(10, 10, 12, 0.05), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(10, 10, 12, 0.06), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(10, 10, 12, 0.08), rgba(0, 0, 0, 0.4));
  --tone-stone-bg: light-dark(#f4f4f5, #27272a);
  --tone-stone-fg: light-dark(#3f3f46, #d4d4d8);
  --tone-sand-bg: light-dark(#ffedd5, #2a1808);
  --tone-sand-fg: light-dark(#a85a04, #ff9d2e);
}
/* Primary actions stay the logo orange in both modes. Inline links use the
   darker light accent above, so they stay readable on white. */
[data-theme="lime"] .btn-primary {
  background: #ee8105;
  border-color: #ee8105;
  color: #0a0a0c;
}
[data-theme="lime"] .btn-primary:hover {
  background: #ff9d2e;
  border-color: #ff9d2e;
  color: #0a0a0c;
}
[data-theme="lime"] .dash-hero .btn-primary,
[data-theme="lime"] .project-glance .btn-primary {
  background: var(--hero-ink);
  border-color: var(--hero-ink);
  color: var(--hero-bg);
}
[data-theme="lime"] .dash-hero .btn-primary:hover,
[data-theme="lime"] .project-glance .btn-primary:hover {
  background: color-mix(in srgb, var(--hero-ink) 86%, var(--hero-tint));
  border-color: transparent;
  color: var(--hero-bg);
}
[data-theme="lime"] .tp-accent { background: #ee8105; }

/* Warm: cream paper and terracotta, the original look. */
[data-theme="warm"] {
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --ink: light-dark(#1c1915, #f4efe7);
  --muted: light-dark(#645d55, #a49c90);
  --faint: light-dark(#9a9288, #7d766d);
  --line: light-dark(#ded4c7, #322d27);
  --line-soft: light-dark(#ebe3d8, #292420);
  --paper: light-dark(#f2ece3, #14120f);
  --card: light-dark(#fffdf9, #1d1a16);
  --sunken: light-dark(#e9e1d5, #16130f);
  --accent: light-dark(#9a3412, #fdba74);
  --accent-ink: light-dark(#7c2d12, #fed7aa);
  --accent-quiet: light-dark(#f3e2d2, #3a2416);
  --danger: light-dark(#9f1239, #fda4af);
  --on-danger: light-dark(#fff5f6, #3f0a16);
  --focus: light-dark(#9a3412, #fdba74);
  --on-ink: light-dark(#fffaf4, #14120f);
  --sidebar: light-dark(#1c1915, #0f0d0b);
  --sidebar-text: light-dark(#f6f1ea, #f4efe7);
  --sidebar-mark: #fdba74;
  --sidebar-muted: #a8a29e;
  --sidebar-hover: rgba(255, 250, 244, 0.08);
  --sidebar-active: rgba(255, 250, 244, 0.14);
  --sidebar-line: transparent;
  --shadow-1: light-dark(rgba(68, 42, 18, 0.05), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(68, 42, 18, 0.07), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(68, 42, 18, 0.1), rgba(0, 0, 0, 0.4));
  --tone-sand-bg: light-dark(#f3e2d2, #3a2416);
  --tone-sand-fg: light-dark(#9a3412, #fed7aa);
}

/* Soft warm: lighter cream, muted terracotta, a light sidebar. */
[data-theme="soft"] {
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --ink: light-dark(#2a2622, #efe9e1);
  --muted: light-dark(#6f675f, #a89f94);
  --faint: light-dark(#a39b91, #7f776d);
  --line: light-dark(#e8e0d6, #342e29);
  --line-soft: light-dark(#f0eae2, #2b2621);
  --paper: light-dark(#faf7f2, #171512);
  --card: light-dark(#ffffff, #1f1c18);
  --sunken: light-dark(#f1ece5, #191613);
  --accent: light-dark(#b4512b, #f4a26f);
  --accent-ink: light-dark(#93401f, #f8bc93);
  --accent-quiet: light-dark(#f7e6dc, #3c2619);
  --danger: light-dark(#b91c48, #fb9bb0);
  --on-danger: light-dark(#fff5f6, #3f0a16);
  --focus: light-dark(#b4512b, #f4a26f);
  --on-ink: light-dark(#fffaf6, #171512);
  --sidebar: light-dark(#f3ede5, #110f0d);
  --sidebar-text: light-dark(#2a2622, #efe9e1);
  --sidebar-mark: light-dark(#b4512b, #f4a26f);
  --sidebar-muted: light-dark(#6f675f, #a89f94);
  --sidebar-hover: light-dark(rgba(42, 38, 34, 0.06), rgba(255, 250, 244, 0.08));
  --sidebar-active: light-dark(rgba(42, 38, 34, 0.1), rgba(255, 250, 244, 0.14));
  --sidebar-line: light-dark(#e8e0d6, #2b2621);
  --shadow-1: light-dark(rgba(68, 42, 18, 0.04), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(68, 42, 18, 0.06), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(68, 42, 18, 0.08), rgba(0, 0, 0, 0.4));
  --tone-sand-bg: light-dark(#f7e6dc, #3c2619);
  --tone-sand-fg: light-dark(#93401f, #f8bc93);
}

/* Clean: white and slate grey, blue accent, light sidebar. */
[data-theme="clean"] {
  --display: var(--ui);
  --ink: light-dark(#0f172a, #e2e8f0);
  --muted: light-dark(#475569, #94a3b8);
  --faint: light-dark(#94a3b8, #64748b);
  --line: light-dark(#e2e8f0, #273449);
  --line-soft: light-dark(#eef2f7, #1e293b);
  --paper: light-dark(#f8fafc, #0b1220);
  --card: light-dark(#ffffff, #111a2e);
  --sunken: light-dark(#f1f5f9, #0e1627);
  --accent: light-dark(#2563eb, #60a5fa);
  --accent-ink: light-dark(#1d4ed8, #93c5fd);
  --accent-quiet: light-dark(#dbeafe, #172e6e);
  --danger: light-dark(#b91c1c, #fca5a5);
  --on-danger: light-dark(#fef2f2, #450a0a);
  --focus: light-dark(#2563eb, #60a5fa);
  --on-ink: light-dark(#ffffff, #0b1220);
  --sidebar: light-dark(#ffffff, #0b1220);
  --sidebar-text: light-dark(#0f172a, #e2e8f0);
  --sidebar-mark: light-dark(#2563eb, #60a5fa);
  --sidebar-muted: light-dark(#64748b, #94a3b8);
  --sidebar-hover: light-dark(#f1f5f9, rgba(226, 232, 240, 0.06));
  --sidebar-active: light-dark(#e2e8f0, rgba(226, 232, 240, 0.12));
  --sidebar-line: light-dark(#e2e8f0, #1e293b);
  --shadow-1: light-dark(rgba(15, 23, 42, 0.05), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(15, 23, 42, 0.06), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(15, 23, 42, 0.08), rgba(0, 0, 0, 0.4));
  --tone-stone-bg: light-dark(#f1f5f9, #1e293b);
  --tone-stone-fg: light-dark(#334155, #cbd5e1);
  --tone-sand-bg: light-dark(#dbeafe, #172e6e);
  --tone-sand-fg: light-dark(#1d4ed8, #bfdbfe);
  --dot-busy: light-dark(#d97706, #fbbf24);
}

/* Calm: off-white with a teal accent, deep teal sidebar. */
[data-theme="mint"] {
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --ink: light-dark(#14241f, #e6f1ee);
  --muted: light-dark(#5b6b66, #9db3ad);
  --faint: light-dark(#93a39d, #6f857f);
  --line: light-dark(#d9e3df, #22332f);
  --line-soft: light-dark(#e6eeea, #1b2a26);
  --paper: light-dark(#f4f8f6, #0d1614);
  --card: light-dark(#ffffff, #13201c);
  --sunken: light-dark(#e9f1ed, #0f1a17);
  --accent: light-dark(#0f766e, #5eead4);
  --accent-ink: light-dark(#115e59, #99f6e4);
  --accent-quiet: light-dark(#ccfbf1, #134e4a);
  --danger: light-dark(#be123c, #fda4af);
  --on-danger: light-dark(#fff1f2, #3f0a16);
  --focus: light-dark(#0f766e, #5eead4);
  --on-ink: light-dark(#f0fdfa, #0d1614);
  --sidebar: light-dark(#0f2a26, #080f0d);
  --sidebar-text: light-dark(#e6f4f0, #e6f1ee);
  --sidebar-mark: #5eead4;
  --sidebar-muted: light-dark(#9fb8b2, #9db3ad);
  --sidebar-hover: rgba(230, 244, 240, 0.08);
  --sidebar-active: rgba(230, 244, 240, 0.14);
  --sidebar-line: light-dark(transparent, #1b2a26);
  --shadow-1: light-dark(rgba(20, 36, 31, 0.05), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(20, 36, 31, 0.06), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(20, 36, 31, 0.08), rgba(0, 0, 0, 0.4));
  --tone-stone-bg: light-dark(#e4ece9, #22332f);
  --tone-stone-fg: light-dark(#3f4f4a, #cfe0da);
  --tone-sand-bg: light-dark(#ccfbf1, #134e4a);
  --tone-sand-fg: light-dark(#115e59, #99f6e4);
}

/* Violet: cool greys with a violet accent. */
[data-theme="violet"] {
  --display: var(--ui);
  --ink: light-dark(#1a1530, #ece9f6);
  --muted: light-dark(#5b5675, #a39dbd);
  --faint: light-dark(#9893ad, #736d8c);
  --line: light-dark(#e4e1ee, #2a2541);
  --line-soft: light-dark(#eeecf5, #221d36);
  --paper: light-dark(#f7f6fb, #0f0c1c);
  --card: light-dark(#ffffff, #171329);
  --sunken: light-dark(#efedf6, #110e20);
  --accent: light-dark(#6d28d9, #a78bfa);
  --accent-ink: light-dark(#5b21b6, #c4b5fd);
  --accent-quiet: light-dark(#ede9fe, #2f2159);
  --danger: light-dark(#be123c, #fda4af);
  --on-danger: light-dark(#fff1f2, #3f0a16);
  --focus: light-dark(#6d28d9, #a78bfa);
  --on-ink: light-dark(#ffffff, #0f0c1c);
  --sidebar: light-dark(#15112b, #0a0815);
  --sidebar-text: light-dark(#efecfa, #ece9f6);
  --sidebar-mark: light-dark(#c4b5fd, #a78bfa);
  --sidebar-muted: #a39dbd;
  --sidebar-hover: rgba(239, 236, 250, 0.08);
  --sidebar-active: rgba(239, 236, 250, 0.14);
  --sidebar-line: light-dark(transparent, #221d36);
  --shadow-1: light-dark(rgba(26, 21, 48, 0.05), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(26, 21, 48, 0.07), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(26, 21, 48, 0.09), rgba(0, 0, 0, 0.4));
  --tone-stone-bg: light-dark(#ecebf2, #2a2541);
  --tone-stone-fg: light-dark(#46425c, #d4cfe6);
  --tone-sand-bg: light-dark(#ede9fe, #2f2159);
  --tone-sand-fg: light-dark(#5b21b6, #ddd6fe);
}

/* Graphite: greys only, one blue for actions, red and orange kept for alerts. */
[data-theme="graphite"] {
  --display: var(--ui);
  --ink: light-dark(#161616, #ededed);
  --muted: light-dark(#5f5f5f, #a3a3a3);
  --faint: light-dark(#9a9a9a, #737373);
  --line: light-dark(#e3e3e3, #2c2c2c);
  --line-soft: light-dark(#ededed, #232323);
  --paper: light-dark(#f5f5f5, #111111);
  --card: light-dark(#ffffff, #181818);
  --sunken: light-dark(#efefef, #141414);
  --accent: light-dark(#0a5bd8, #4d8dff);
  --accent-ink: light-dark(#0747a8, #7facff);
  --accent-quiet: light-dark(#e6eefc, #0f2449);
  --danger: light-dark(#c81e1e, #ff8080);
  --on-danger: light-dark(#fff5f5, #3b0a0a);
  --focus: light-dark(#0a5bd8, #4d8dff);
  --on-ink: light-dark(#ffffff, #0b0b0b);
  --sidebar: light-dark(#161616, #0b0b0b);
  --sidebar-text: light-dark(#f2f2f2, #ededed);
  --sidebar-mark: light-dark(#f2f2f2, #ededed);
  --sidebar-muted: #a0a0a0;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.14);
  --sidebar-line: light-dark(transparent, #232323);
  --shadow-1: light-dark(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.5));
  --shadow-2: light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.55));
  --shadow-3: light-dark(rgba(0, 0, 0, 0.09), rgba(0, 0, 0, 0.4));
  --tone-stone-bg: light-dark(#ebebeb, #2c2c2c);
  --tone-stone-fg: light-dark(#3d3d3d, #d4d4d4);
  --tone-sand-bg: light-dark(#e9e9e9, #2c2c2c);
  --tone-sand-fg: light-dark(#3d3d3d, #d4d4d4);
  --tone-sky-bg: light-dark(#ececec, #2c2c2c);
  --tone-sky-fg: light-dark(#444444, #d4d4d4);
  --tone-indigo-bg: light-dark(#e9e9e9, #2c2c2c);
  --tone-indigo-fg: light-dark(#3d3d3d, #d4d4d4);
  --tone-green-bg: light-dark(#e4efe8, #16271f);
  --tone-green-fg: light-dark(#1f5a3a, #a7dcc0);
}

/* Base */

* { box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  background: var(--paper);
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
code, kbd, pre { font-family: var(--mono); }
small { font-size: 13px; color: var(--muted); }
ul, ol { margin: 0; padding-left: 20px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}
.skip:focus { left: 8px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Auth layout */

body.auth {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, var(--accent-quiet), transparent 42%),
    var(--paper);
  padding: 24px 0;
}

body.auth main {
  width: min(520px, calc(100% - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lift);
}

body.auth main.wide { width: min(720px, calc(100% - 32px)); }
body.auth .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 18px;
}
body.auth .brand-mark {
  width: 28px;
  height: 28px;
  display: block;
  flex: none;
  object-fit: contain;
}
body.auth .brand span { color: var(--accent); }
body.auth h1 { font-size: 26px; margin-bottom: 8px; }
body.auth .lead { color: var(--muted); margin-bottom: 20px; }
body.auth form { display: grid; gap: 14px; margin-top: 6px; }
body.auth .foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 14px;
}

/* App layout
   One slim bar across the top, content centred below it. The bar is glass:
   the page shows through a blur, and a shadow appears once the page has
   scrolled under it. The --sidebar tokens still name its colours. */

:root {
  --topbar-height: 60px;
  --page-max: 1440px;
  --page-pad: clamp(16px, 4vw, 48px);
}

body.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  color: var(--sidebar-text);
  background: color-mix(in srgb, var(--sidebar) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--sidebar-line) 70%, transparent);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
@supports not (background: color-mix(in srgb, #000 50%, transparent)) {
  .topbar { background: var(--sidebar); border-bottom-color: var(--sidebar-line); }
}
.topbar[data-scrolled] { box-shadow: 0 1px 0 var(--shadow-1), 0 10px 30px -12px var(--shadow-3); }

.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.topbar .mark {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--ui);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 6px 4px;
  border-radius: 10px;
}
.topbar .mark:hover { color: var(--sidebar-text); }
.topbar .mark-accent { color: var(--sidebar-mark); }
.mark-sign {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
  object-fit: contain;
}

.topbar nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--sidebar-hover);
  justify-self: center;
}
.topbar nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar nav a svg { width: 17px; height: 17px; opacity: 0.75; flex: none; }
.topbar nav a:hover { background: color-mix(in srgb, var(--sidebar-text) 8%, transparent); color: var(--sidebar-text); }
.topbar nav a[aria-current="page"] {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  box-shadow: 0 1px 2px var(--shadow-2);
}
.topbar nav a[aria-current="page"] svg { color: var(--sidebar-mark); opacity: 1; }

.account-menu { justify-self: end; }
.account-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}
.account-summary:hover, .account-menu[open] .account-summary { background: var(--sidebar-hover); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--on-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  flex: none;
}
.account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chevron { width: 14px; height: 14px; opacity: 0.6; transition: transform 0.15s ease; }
.account-menu[open] .account-chevron { transform: rotate(180deg); }
.account-panel { min-width: 240px; padding: 6px; }
.account-id { display: grid; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.account-id strong { font-weight: 600; }
.account-id span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-panel a, .account-panel button { display: flex; align-items: center; gap: 10px; }
.account-panel svg { width: 16px; height: 16px; color: var(--muted); flex: none; }

.content {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--page-pad) 64px;
  min-width: 0;
}
.content-narrow { max-width: 820px; }

.narrow { max-width: 720px; }

/* Page header */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 26px;
}
.page-head .badge { margin-top: 10px; }
.page-head .lead { color: var(--muted); margin-top: 8px; max-width: 62ch; font-size: 16px; }
.project-notes { display: grid; gap: 4px; margin: -4px 0 16px; }
.project-notes .foot { color: var(--muted); font-size: 14px; }
.content > .project-meta { margin: 0 0 20px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: none; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 12px;
}
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--ink); }
svg[aria-hidden="true"] { width: 1em; height: 1em; vertical-align: -0.125em; }
.title-link {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--muted);
  font-size: 18px;
  vertical-align: middle;
}
.title-link:hover { color: var(--ink); }

/* Notices */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-small);
  border: 1px solid var(--line);
  background: var(--card);
  margin: 0 0 18px;
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice-error { background: var(--tone-red-bg); color: var(--tone-red-fg); border-color: transparent; }
.notice-ok { background: var(--tone-green-bg); color: var(--tone-green-fg); border-color: transparent; }
.notice-info { background: var(--tone-sky-bg); color: var(--tone-sky-fg); border-color: transparent; }
.notice-warn { background: var(--tone-amber-bg); color: var(--tone-amber-fg); border-color: transparent; }
#history-secret-banner { align-items: center; }
#history-secret-banner span { flex: 1; }
#first-scan-guide a { color: inherit; font-weight: 600; text-decoration: underline; }

/* Badges and dots */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--tone-stone-bg);
  color: var(--tone-stone-fg);
}
.badge-large { font-size: 15px; padding: 6px 14px; }
.badge-act, .badge-critical, .badge-rotate, .badge-failed { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.badge-attention { background: var(--accent-quiet); color: var(--accent-ink); }
.badge-high, .badge-fix { background: var(--tone-orange-bg); color: var(--tone-orange-fg); }
.badge-medium, .badge-policy { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.badge-low, .badge-muted, .badge-ignore, .badge-info { background: var(--tone-stone-bg); color: var(--tone-stone-fg); }
.badge-good { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.badge-checking, .badge-uncertain { background: var(--tone-indigo-bg); color: var(--tone-indigo-fg); }
.badge-sand { background: var(--tone-sand-bg); color: var(--tone-sand-fg); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-good, .dot-ok { background: var(--dot-ok); }
.dot-act, .dot-failed, .dot-fail { background: var(--dot-fail); }
.dot-attention, .dot-busy { background: var(--dot-busy); }
.dot-checking { background: var(--tone-indigo-fg); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--sunken); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-ink); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-ink); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--on-danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--sunken); color: var(--ink); }
.btn-small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-small svg { width: 14px; height: 14px; }
.btn-large { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions-end { justify-content: flex-end; }

/* Cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 14px; }
.card h2, .card h3 { margin-bottom: 6px; }
.card > p { color: var(--muted); }
.card .actions { margin-top: 16px; }
.card.stack > .actions { margin-top: 0; }
.card-quiet { box-shadow: none; background: transparent; }

.agent-stack > .card + .card { margin-top: 0; }
.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.agent-grid > .card + .card { margin-top: 0; }
.agent-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 160px;
  padding: 20px 22px 18px;
}
.agent-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.agent-card-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--accent);
  margin: 0;
  overflow-wrap: anywhere;
}
.agent-card .agent-card-name { margin-bottom: 0; }
.agent-card-head .inline-form { flex: none; margin-top: 2px; }
.agent-card-meta, .agent-card-key {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.agent-card-key { word-break: break-all; margin-top: auto; padding-top: 12px; }
.agent-add-card {
  appearance: none;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-height: 160px;
  width: 100%;
  margin: 0;
  padding: 20px;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  text-align: center;
}
.agent-add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-quiet);
}
.agent-add-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.agent-add-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-quiet);
  color: var(--accent);
}
.agent-add-icon svg { width: 22px; height: 22px; }
.agent-add-label { font-weight: 600; font-size: 15px; }
.stack { display: grid; gap: 14px; }
.stack-large { gap: 24px; }
.section { margin-top: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { color: var(--muted); }

/* Disclosure */

.fold {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-small);
  background: var(--card);
}
.fold summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary:hover { color: var(--ink); }
.fold-chevron { width: 16px; height: 16px; transition: transform 0.15s ease; flex: none; }
.fold[open] > summary .fold-chevron { transform: rotate(180deg); }
.fold-body { padding: 4px 14px 14px; border-top: 1px solid var(--line-soft); display: grid; gap: 12px; }
.fold-body > :first-child { margin-top: 10px; }
.fold-quiet { border-color: transparent; background: transparent; }
.fold-quiet summary { padding-left: 0; padding-right: 0; }
.fold-quiet .fold-body { border-top: 0; padding-left: 0; padding-right: 0; }

/* Code and copy */

.code {
  margin: 0;
  padding: 14px 16px;
  background: var(--sunken);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-small);
  font-size: 13px;
  line-height: 1.55;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
}
.code-tall { max-height: none; }
.copy-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.copy-row p { color: var(--muted); font-size: 14px; }
.secret {
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
  background: var(--sunken);
  border-radius: var(--radius-small);
  word-break: break-all;
}

/* Empty state */

.empty {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.empty-icon { width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-quiet); color: var(--accent); }
.empty-icon svg { width: 22px; height: 22px; }
.empty-busy .empty-icon { background: transparent; }
.empty-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 48ch; margin: 0 auto; }
.empty .actions { justify-content: center; margin-top: 20px; }

/* Forms */

form.stack { gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--ink);
}
.field textarea { min-height: 120px; font-family: var(--mono); font-size: 13px; }
.field input::placeholder { color: var(--faint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--card);
  cursor: pointer;
}
.check input { margin: 2px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.check span { display: grid; gap: 2px; }
.check small { color: var(--muted); }
.check:has(input:checked) { border-color: var(--accent); }
.check:has(input:disabled) { opacity: 0.6; cursor: default; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  min-width: 220px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input { border: 0; background: transparent; width: 100%; padding: 2px 0; outline: none; }
.select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

/* Dialog */

.dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  padding: 24px;
  width: min(560px, calc(100% - 32px));
  box-shadow: var(--shadow-lift);
}
.dialog::backdrop { background: rgba(28, 25, 21, 0.45); }
.dialog h2 { margin-bottom: 8px; }
.dialog p { color: var(--muted); }
.dialog form { display: grid; gap: 16px; }
.dialog .actions { justify-content: flex-end; }
.dialog-small { width: min(440px, calc(100% - 32px)); }
.dialog.dialog-agent {
  width: min(400px, calc(100% - 32px));
  padding: 32px 28px 24px;
  text-align: center;
}
.dialog.dialog-agent h2 {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.dialog.dialog-agent .agent-dialog-step { display: grid; gap: 16px; }
.dialog.dialog-agent .agent-dialog-step[hidden] { display: none; }
.dialog.dialog-agent .field { text-align: left; }
.dialog.dialog-agent form.stack { gap: 16px; }
.dialog.dialog-agent .actions { justify-content: center; }
.dialog.dialog-agent .fold-quiet { text-align: left; }

/* Tabs */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 24px 0 20px;
  overflow: auto hidden;
  scrollbar-width: none;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: -1px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.tabs a[aria-current="page"] .tab-count { background: var(--accent-quiet); color: var(--accent); }

/* Stats */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
a.stat:hover { border-color: var(--accent); }
.stat-value { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-act .stat-value { color: var(--tone-red-fg); }
.stat-attention .stat-value { color: var(--tone-orange-fg); }
.stat-checking .stat-value { color: var(--tone-indigo-fg); }
.stat-good .stat-value { color: var(--tone-green-fg); }

/* Dashboard (Home) */

/* The headline is one raised panel on the page surface, tinted by the score
   band: a soft wash from the left in light mode, a glow on the card in dark.
   The band also washes the top of the page faintly, through the glass top
   bar. The detail cards below are flat and quiet so the panel is what the
   eye lands on. */

:root {
  --hero-bg: var(--card);
  --hero-ink: var(--ink);
  --hero-muted: var(--muted);
  --hero-line: var(--line);
  --hero-tint: var(--accent);
  --vivid-red: light-dark(#e11d48, #fb7185);
  --vivid-amber: light-dark(#d97706, #fbbf24);
  --vivid-sky: light-dark(#0284c7, #38bdf8);
  --vivid-green: light-dark(#059669, #34d399);
}
[data-band="risk"] { --hero-tint: var(--vivid-red); }
[data-band="work"] { --hero-tint: var(--vivid-amber); }
[data-band="good"] { --hero-tint: var(--vivid-sky); }
[data-band="excellent"] { --hero-tint: var(--vivid-green); }

body.app { position: relative; }
.dash-tint {
  position: absolute;
  inset: 0 0 auto 0;
  height: 620px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px 460px at 50% -80px, color-mix(in srgb, var(--hero-tint) 7%, transparent), transparent 70%);
}

.dash-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 2fr);
  gap: 40px;
  padding: 32px 36px 28px;
  margin-bottom: 20px;
  border-radius: calc(var(--radius) + 6px);
  color: var(--hero-ink);
  background: var(--hero-bg);
  border: 1px solid color-mix(in srgb, var(--hero-tint) 18%, var(--line));
  box-shadow: var(--shadow-card);
}
.dash-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -10%;
  top: -60%;
  width: 55%;
  height: 200%;
  /* The glow is read on the panel itself, so the band colour it mixes is
     the panel's own data-band, not the page default. */
  --hero-glow: light-dark(color-mix(in srgb, var(--hero-tint) 11%, transparent), color-mix(in srgb, var(--hero-tint) 14%, transparent));
  background: radial-gradient(closest-side, var(--hero-glow), transparent);
  pointer-events: none;
}
.dash-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--hero-tint) 4%, transparent), transparent 45%);
}
.dash-hero .dash-title { color: var(--hero-muted); }
.hero-score { display: grid; gap: 16px; align-content: start; min-width: 0; }
.hero-note { color: var(--hero-muted); font-size: 14px; }
.dash-hero .ring .ring-number { fill: var(--hero-ink); font-size: 44px; }
.dash-hero .ring .ring-track { stroke: var(--hero-line); }
.dash-hero .ring { color: var(--hero-tint); }
.dash-hero .dash-score-word { color: var(--hero-tint); font-family: var(--display); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.dash-hero .dash-score-delta { color: var(--hero-ink); font-size: 14px; }
.dash-hero .risk-detail { display: grid; gap: 8px; margin-top: 4px; }
.dash-hero .risk-next { margin: 0; color: var(--hero-ink); font-size: 14px; }
.dash-hero .milestones { margin: 0; }
.dash-hero .milestones .chip {
  background: color-mix(in srgb, var(--hero-ink) 14%, transparent);
  color: var(--hero-ink);
}
.risk-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.risk-bars li {
  display: grid;
  grid-template-columns: minmax(88px, 108px) minmax(48px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.risk-bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--hero-line);
  overflow: hidden;
}
.risk-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--hero-tint);
}
.dash-hero .risk-bar-label,
.dash-hero .risk-bar-count { color: var(--hero-ink); }
.dash-hero .risk-bar-fixed { color: var(--vivid-green); font-size: 12px; }
.risk-bar-fixed:empty { display: none; }
.risk-face { display: grid; gap: 8px; margin-top: 2px; max-width: 360px; }
.risk-pills { display: flex; gap: 8px; margin: 0; }
.risk-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 650; }
.risk-pill-down { color: #047857; background: color-mix(in srgb, var(--vivid-green) 16%, white); }
.risk-pill-up { color: var(--vivid-red); background: color-mix(in srgb, var(--vivid-red) 12%, white); }
.risk-pair { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: center; }
.risk-pair + .risk-pair { margin-top: 3px; }
.risk-pair-label { font-size: 11px; color: var(--hero-muted); }
.risk-track { height: 5px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--hero-ink) 8%, transparent); }
.risk-fill { display: flex; height: 5px; border-radius: inherit; overflow: hidden; }
.risk-bit { display: block; height: 5px; min-width: 0; }
.risk-bit-rotate { background: var(--vivid-red); }
.risk-bit-critical { background: #9f1239; }
.risk-bit-high { background: var(--vivid-amber); }
.risk-bit-medium { background: #ca8a04; }
.risk-bit-low { background: #a16207; }
.risk-bit-other { background: color-mix(in srgb, var(--hero-ink) 28%, transparent); }
.risk-bit-fixed { background: #3d9a78; }
.risk-bit-new { background: var(--vivid-red); }
.risk-compare .risk-pair:first-child .risk-fill { opacity: 0.4; }
.risk-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; padding: 0; font-size: 11px; color: var(--hero-muted); }
.project .risk-face { max-width: 320px; }
.risk-legend li { display: flex; align-items: center; gap: 6px; }
.risk-legend i { width: 8px; height: 8px; border-radius: 99px; display: block; }
.risk-key-rotate i { background: var(--vivid-red); }
.risk-key-critical i { background: #9f1239; }
.risk-key-high i { background: var(--vivid-amber); }
.risk-key-medium i { background: #ca8a04; }
.risk-key-low i { background: #a16207; }
.risk-key-fixed i { background: #3d9a78; }
.risk-tick { width: 14px; height: 14px; border-radius: 99px; display: grid; place-items: center; background: color-mix(in srgb, #3d9a78 18%, white); color: #047857; }
.risk-tick svg { width: 10px; height: 10px; }
.risk-cleared { color: var(--hero-ink); }
.risk-next { margin: 0; font-size: 13px; color: var(--hero-ink); }
.dash-hero .risk-pill-down,
.project .risk-pill-down { color: #047857; background: color-mix(in srgb, var(--vivid-green) 18%, white); }
/* The project score column stays the width of the ring and the short bars.
   The three counts take the rest of the card. */
@media (min-width: 861px) {
  .dash-hero.dash-hero-counts {
    grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
    gap: 36px;
    align-items: center;
  }
  .dash-hero.dash-hero-counts .hero-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 100%;
    position: relative;
  }
  .dash-hero.dash-hero-counts .hero-stats { width: 100%; }
  .dash-hero.dash-hero-counts .hero-stat,
  .dash-hero.dash-hero-counts .hero-stat:first-child,
  .dash-hero.dash-hero-counts .hero-stat:last-child {
    align-items: center;
    text-align: center;
    justify-content: center;
    border-left: 0;
    padding: 0 8px;
    gap: 2px;
  }
  .dash-hero.dash-hero-counts .dash-big {
    font-size: 88px;
    margin-top: 0;
    line-height: 0.85;
    letter-spacing: -0.045em;
  }
  .dash-hero.dash-hero-counts .dash-title {
    text-transform: none;
    letter-spacing: 0.01em;
    font-size: 13px;
    font-weight: 550;
  }
  .dash-hero.dash-hero-counts.dash-hero-bar {
    align-items: stretch;
    grid-template-rows: auto;
  }
  .dash-hero.dash-hero-counts.dash-hero-bar .hero-score { grid-column: 1; grid-row: 1; }
  .dash-hero.dash-hero-counts.dash-hero-bar .hero-side { grid-column: 2; grid-row: 1; }
  .dash-hero.dash-hero-counts.dash-hero-bar .hero-bar {
    position: absolute;
    right: 0;
    bottom: 0;
    margin-top: 0;
  }
}
@media (min-width: 1100px) {
  .dash-hero:has(.risk-face) .risk-legend { flex-wrap: nowrap; }
}
.dash-hero .fold-quiet summary, .dash-hero .fold-quiet p { color: var(--hero-muted); font-size: 13px; }
.dash-hero .fold-quiet summary:hover { color: var(--hero-ink); }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.hero-stat { display: flex; flex-direction: column; gap: 6px; padding: 4px 24px; border-left: 1px solid var(--hero-line); min-width: 0; }
.hero-stat:first-child { border-left: 0; padding-left: 0; }
.hero-stat:last-child { padding-right: 0; }
.dash-hero .dash-big { font-family: var(--display); font-size: 58px; line-height: 1; letter-spacing: -0.03em; font-weight: 600; margin-top: 6px; }
.dash-hero .dash-sub { color: var(--hero-muted); }
.dash-hero .dash-act .dash-big { color: var(--vivid-red); }
.dash-hero .dash-attention .dash-big { color: var(--vivid-amber); }
.dash-hero .dash-good .dash-big, .dash-hero .dash-activity .dash-big { color: var(--hero-ink); }
.dash-hero .dash-fixed .dash-big { color: var(--vivid-green); }
.dash-hero .dash-ignore .dash-big { color: var(--hero-ink); }
.dash-hero .dash-foot .muted { color: var(--hero-muted); }
.dash-hero .spark, .dash-hero .spark-up { color: var(--vivid-green); }
.dash-hero .hero-score .dash-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hero-line);
}
.dash-hero .hero-score .dash-foot .muted { white-space: normal; }
.dash-hero .hero-score .spark { color: var(--hero-tint); }
.dash-hero-bar { grid-template-rows: 1fr auto; }
.dash-hero-bar .hero-score { grid-row: 1 / -1; }
.dash-hero-bar .hero-stats { grid-column: 2; grid-row: 1; }
.dash-hero-bar .hero-bar {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 4px;
}
.dash-hero .btn-secondary,
.project-glance .btn-secondary {
  background: transparent;
  border-color: var(--hero-line);
  color: var(--hero-ink);
}
.dash-hero .btn-secondary:hover,
.project-glance .btn-secondary:hover {
  background: color-mix(in srgb, var(--hero-ink) 8%, transparent);
  border-color: var(--hero-ink);
  color: var(--hero-ink);
}
.dash-hero .btn-primary,
.project-glance .btn-primary { background: var(--hero-ink); border-color: var(--hero-ink); color: var(--hero-bg); box-shadow: none; }
.dash-hero .btn-primary:hover,
.project-glance .btn-primary:hover { background: color-mix(in srgb, var(--hero-ink) 86%, var(--hero-tint)); border-color: transparent; color: var(--hero-bg); }

.dash-grid { display: grid; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-row-1 { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
/* Below the numbers: two columns whose cards stack on their own, so a tall
   card never drags an empty neighbour down with it. */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-col > .dash-card { flex: 1 1 auto; }
.dash-card { margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; border-color: var(--line-soft); box-shadow: none; }
.dash-card + .dash-card { margin-top: 0; }
.dash-number .dash-foot { margin-top: auto; padding-top: 4px; }
/* Activity is a full-width row under the projects and the chart. On a wide
   page the entries sit in two columns so the row stays short. */
.dash-feed { margin-bottom: 16px; }
.dash-feed .feed { grid-template-columns: 1fr 1fr; column-gap: 28px; }
.dash-feed .feed-item {
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 8px 10px;
  border-bottom: 0;
  border-radius: 12px;
}
.dash-feed .feed-item:hover { background: var(--paper); }
.dash-feed .feed-icon { width: 32px; height: 32px; background: var(--accent-quiet); color: var(--accent); }
.dash-feed .feed-icon svg { width: 15px; height: 15px; }
.dash-feed .feed-main a { font-weight: 600; }
.dash-feed .feed-when { padding-top: 0; }
.dash-title { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; margin: 0; }
.dash-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dash-head .muted { font-size: 13px; }
.dash-more { font-size: 13px; color: var(--accent); text-decoration: none; }
.dash-more:hover { text-decoration: underline; }
.dash-score-body { display: flex; gap: 20px; align-items: center; }
.dash-score-text { display: grid; gap: 4px; min-width: 0; }
.dash-score-word { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.dash-score-delta { font-size: 14px; color: var(--ink); }
.dash-score .fold-quiet summary { padding-top: 0; padding-bottom: 0; }
.dash-number { gap: 4px; }
.dash-big { font-size: 40px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.dash-sub { color: var(--muted); font-size: 14px; }
.dash-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.dash-foot .muted { white-space: nowrap; }
.dash-act .dash-big { color: var(--tone-red-fg); }
.dash-attention .dash-big { color: var(--tone-orange-fg); }
.dash-good .dash-big { color: var(--tone-green-fg); }
.dash-fixed .dash-big { color: var(--band-excellent); }
.dash-ghost .chart, .dash-ghost .chart-legend { opacity: 0.35; }
.dash-ghost-note { font-size: 13px; }
.dash-checking { border-left: 4px solid var(--tone-indigo-fg); }
.dash-checking .dash-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); text-transform: none; }
.dash-card .empty { padding: 24px 12px; border: 0; background: transparent; box-shadow: none; }
.dash-card .empty h2 { font-size: 17px; }

.fix-board { margin-bottom: 16px; }
.fix-board-body {
  display: grid;
  grid-template-columns: 280px minmax(220px, 300px) minmax(0, 1fr);
  gap: 12px 36px;
  align-items: center;
  min-height: 280px;
}
.fix-pie-wrap { display: grid; place-items: center; }
.fix-pie { width: min(260px, 100%); height: auto; }
.fix-pie .fix-slice { fill: none; stroke: currentColor; }
.fix-slice { opacity: 0.45; cursor: pointer; transition: opacity 0.15s ease; }
/* One accent, the theme's own. Kinds are steps of that colour, not a
   separate orange and green palette. */
.fix-slice-secret_rotation { color: var(--accent-ink); }
.fix-slice-dependency_bump { color: var(--accent); }
.fix-slice-code_change { color: color-mix(in srgb, var(--accent) 68%, var(--muted)); }
.fix-slice-config { color: color-mix(in srgb, var(--accent) 42%, var(--faint)); }
.fix-board:has(#fix-kind-secret_rotation:checked) .fix-slice-secret_rotation,
.fix-board:has(#fix-kind-dependency_bump:checked) .fix-slice-dependency_bump,
.fix-board:has(#fix-kind-code_change:checked) .fix-slice-code_change,
.fix-board:has(#fix-kind-config:checked) .fix-slice-config { opacity: 1; }
.fix-legend { display: grid; gap: 8px; align-content: center; }
.fix-detail { min-height: 24rem; align-self: stretch; }
.fix-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
}
.fix-legend-item:hover { background: var(--paper); }
.fix-legend-item:has(input:checked) { background: var(--sunken); border-color: var(--line); }
.fix-legend-item input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.fix-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  background: color-mix(in srgb, currentColor 22%, transparent);
  box-shadow: inset 0 0 0 3px currentColor;
}
.fix-legend-name { font-weight: 600; font-size: 16px; }
.fix-legend-count { margin-left: auto; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.fix-pane { display: none; min-width: 0; height: 25rem; }
.fix-detail { height: 25rem; overflow: hidden; align-self: stretch; }
.fix-board:not(.fix-board-live):has(#fix-kind-secret_rotation:checked) .fix-pane-secret_rotation,
.fix-board:not(.fix-board-live):has(#fix-kind-dependency_bump:checked) .fix-pane-dependency_bump,
.fix-board:not(.fix-board-live):has(#fix-kind-code_change:checked) .fix-pane-code_change,
.fix-board:not(.fix-board-live):has(#fix-kind-config:checked) .fix-pane-config,
.fix-board.fix-board-live .fix-pane.is-shown {
  display: flex;
  flex-direction: column;
}
.fix-board.fix-board-live .fix-pane { display: none; }
.fix-board.fix-board-live .fix-pane.is-shown { display: flex; flex-direction: column; }
.fix-board-live .fix-pane.is-shown .fix-pane-title,
.fix-board-live .fix-pane.is-shown .fix-next-more,
.fix-board-live .fix-pane.is-shown .fix-next-item {
  animation: fix-item-in 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.fix-board-live .fix-pane.is-shown .fix-next-item:nth-child(1) { animation-delay: 0.04s; }
.fix-board-live .fix-pane.is-shown .fix-next-item:nth-child(2) { animation-delay: 0.08s; }
.fix-board-live .fix-pane.is-shown .fix-next-item:nth-child(3) { animation-delay: 0.12s; }
.fix-board-live .fix-pane.is-shown .fix-next-item:nth-child(4) { animation-delay: 0.16s; }
.fix-board-live .fix-pane.is-shown .fix-next-item:nth-child(5) { animation-delay: 0.2s; }
.fix-board-quiet .fix-pane.is-shown .fix-pane-title,
.fix-board-quiet .fix-pane.is-shown .fix-next-more,
.fix-board-quiet .fix-pane.is-shown .fix-next-item { animation: none; }
@keyframes fix-item-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.fix-pane-title { font-family: var(--ui); font-size: 18px; margin-bottom: 4px; flex: none; }
.fix-next-more { margin: 12px 0 0; padding-left: 36px; height: 34px; flex: none; display: flex; align-items: center; }
.fix-next-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: fixnext; flex: 1; min-height: 0; }
.fix-next-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 12px 0 12px 36px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.fix-pane .fix-next-item { border-bottom-color: var(--line-soft); padding-top: 10px; padding-bottom: 10px; }
.fix-next-items > .fix-next-item:last-child { border-bottom: 0; padding-bottom: 4px; }
.fix-next-item::before {
  counter-increment: fixnext;
  content: counter(fixnext);
  position: absolute;
  left: 0;
  top: 13px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--sunken);
  color: var(--muted);
}
.fix-next-rotate::before { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.fix-next-main { display: grid; gap: 3px; min-width: 0; }
.fix-next-title { font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fix-next-title:hover { color: var(--accent); }
.fix-next-summary { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fix-next-where { display: flex; gap: 8px; flex-wrap: nowrap; font-size: 12.5px; color: var(--faint); min-width: 0; overflow: hidden; }
.fix-next-where code { font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.fix-next-side { display: flex; gap: 6px; flex-wrap: wrap; }
.fix-next-side .badge { font-size: 11.5px; padding: 2px 8px; }
.fix-next-side .badge-muted { background: transparent; border: 1px solid var(--line-soft); }
@media (min-width: 1181px) {
  .fix-next-item { grid-template-columns: minmax(0, 1fr) auto; }
  .fix-next-side { justify-content: flex-end; max-width: 240px; }
}

/* Welcome (empty workspace) */

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 40px;
  padding: 40px 44px;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line);
  background:
    radial-gradient(640px 320px at 0% 0%, var(--accent-quiet), transparent 70%),
    var(--card);
  box-shadow: var(--shadow-card);
  margin: 0 auto;
  max-width: 1100px;
}
.welcome-intro { display: grid; gap: 14px; align-content: start; }
.welcome-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--on-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  box-shadow: 0 8px 20px -8px var(--accent);
}
.welcome-mark svg { width: 24px; height: 24px; }
.welcome h2 { font-size: 28px; letter-spacing: -0.02em; }
.welcome-lead { font-size: 16px; color: var(--muted); max-width: 52ch; }
.welcome-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: welcome; }
.welcome-steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 2px;
  position: relative;
}
.welcome-steps li::before {
  counter-increment: welcome;
  content: counter(welcome);
  grid-row: 1 / span 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-quiet);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.welcome-steps li strong { font-weight: 600; font-size: 15px; line-height: 30px; }
.welcome-steps li span { color: var(--muted); font-size: 14px; }
.welcome-steps li.is-current::before {
  color: var(--on-ink);
  background: var(--accent);
  border-color: transparent;
}
.welcome-steps li.is-upcoming { opacity: 0.55; }
.welcome-add { display: grid; gap: 12px; align-content: start; min-width: 0; }
.welcome-add h3 { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }

.repo-picker { display: grid; gap: 16px; }
.repo-picker fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.repo-picker legend {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.repo-cards { display: grid; gap: 10px; }
.repo-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.repo-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.repo-card:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-quiet) 70%, var(--card));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.repo-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.repo-card label {
  display: grid;
  grid-template-columns: 18px 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 10px 8px 10px 12px;
  cursor: pointer;
}
.repo-card input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.repo-card-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  box-sizing: border-box;
}
.repo-card:has(input:checked) .repo-card-mark {
  border-color: var(--accent);
  background:
    radial-gradient(circle at center, var(--accent) 0 4px, transparent 5px),
    var(--card);
}
.repo-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--sunken);
  color: var(--ink);
}
.repo-card-icon svg { width: 22px; height: 22px; }
.repo-card-ink .repo-card-icon { background: var(--ink); color: var(--on-ink); }
.repo-card-indigo .repo-card-icon { background: var(--tone-indigo-bg); color: var(--tone-indigo-fg); }
.repo-card-accent .repo-card-icon { background: var(--accent-quiet); color: var(--accent); }
.repo-card-slate .repo-card-icon { background: var(--sunken); color: var(--muted); }
.repo-card-copy { display: grid; gap: 2px; min-width: 0; }
.repo-card-copy strong {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 15px;
  font-weight: 650;
}
.repo-card-copy span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.repo-card-guide {
  margin-right: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  text-decoration: none;
  background: transparent;
}
.repo-card-guide:hover { background: var(--accent-quiet); }
.repo-picker-bar { display: flex; justify-content: flex-end; }
.repo-picker-bar .btn { min-width: 160px; }
.welcome-choice {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.welcome-choice:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-card); }
.welcome-choice-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--sunken); }
.welcome-choice-icon svg { width: 20px; height: 20px; }
.welcome-choice-text { display: grid; gap: 1px; min-width: 0; }
.welcome-choice-text strong { font-weight: 600; font-size: 15px; }
.welcome-choice-text span { color: var(--muted); font-size: 13px; }
.welcome-choice-arrow svg { width: 18px; height: 18px; color: var(--muted); }
.welcome-choice-primary { border-color: var(--accent); }
.welcome-choice-primary .welcome-choice-icon { background: var(--accent-quiet); color: var(--accent); }
.welcome-choice-form { margin: 0; }
button.welcome-choice { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.choice-with-guide { display: grid; }
a.mini-guide {
  justify-self: end;
  margin: 2px 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
a.mini-guide:hover { text-decoration: underline; }

.arrive-ask {
  font-weight: 500;
  font-size: clamp(34px, 6vw, 48px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-align: center;
}
.arrive-ask:focus { outline: none; }
.arrive-choices { display: grid; gap: 12px; margin-top: 28px; }
.arrive-choice-form { margin: 0; }
.arrive-choice {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 20px 16px;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  color: var(--ink);
  text-align: center;
}
.arrive-choice strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.arrive-choice span { color: var(--muted); font-size: 15px; line-height: 1.4; }
.arrive-choice:hover { border-color: var(--accent); }
.arrive-choice:hover strong { color: var(--accent); }
.arrive-onboard .stack { margin: 22px auto 0; text-align: left; width: min(100%, 340px); }
.arrive-onboard .stack .btn-primary { width: 100%; justify-content: center; }
.arrive-onboard .arrive-actions { gap: 10px; flex-wrap: wrap; }
.arrive-setup {
  display: block;
  justify-self: center;
  width: min(100%, 420px);
  margin: 16px auto 0;
  font-size: 12px;
  line-height: 1.45;
  box-sizing: border-box;
}
.arrive-pasted-form { margin: 18px auto 0; width: min(100%, 420px); }
.arrive-pasted {
  width: 100%;
  justify-content: center;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  padding: 12px 16px;
}

/* Arrival
   One frosted moment over Home after a sign-in. The dialog itself stays
   clear; the backdrop is what softens the workspace behind it. */

/* arrive-lock is on the opening <html> tag, so the page scrollbar is gone
   before the body is parsed. :has() keeps the same lock if that class is
   missing. The dialog stays overflow:hidden because the browser's modal
   style uses overflow:auto and paints a scrollbar even when the card fits.
   The rise motion starts 10px lower; that has to be clipped inside the
   panel, or the scroll box paints a scrollbar until the motion ends. */
html.arrive-lock,
html.arrive-lock body,
html:has(dialog.arrive:not(.arrive-done)),
html:has(dialog.arrive:not(.arrive-done)) body {
  overflow: hidden;
}
.arrive {
  width: min(560px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  overflow: hidden;
}
.arrive::backdrop {
  background:
    radial-gradient(720px 420px at 50% 38%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    color-mix(in srgb, var(--paper) 72%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(22px);
  backdrop-filter: saturate(1.5) blur(22px);
  animation: arrive-frost 0.5s ease both;
}
.arrive-scroll {
  max-height: calc(100dvh - 64px);
  overflow: auto;
  overscroll-behavior: contain;
}
.arrive-panel { display: grid; align-content: start; overflow: hidden; }
.arrive-hi {
  font-weight: 500;
  font-size: clamp(46px, 8vw, 72px);
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-align: center;
  animation: arrive-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s both;
}
.arrive-hi:focus { outline: none; }
.arrive-since,
.arrive-quiet {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 18px;
  animation: arrive-rise 0.5s ease 0.45s both;
}
.arrive-waiting { color: var(--ink); }
.arrive-lines {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.arrive-line {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  animation: arrive-rise 0.45s ease both;
}
.arrive-lines .arrive-line:nth-child(1) { animation-delay: 0.55s; }
.arrive-lines .arrive-line:nth-child(2) { animation-delay: 0.66s; }
.arrive-lines .arrive-line:nth-child(3) { animation-delay: 0.77s; }
.arrive-lines .arrive-line:nth-child(4) { animation-delay: 0.88s; }
.arrive-line-key { color: var(--fig-alarm); }
.arrive-actions {
  display: flex;
  justify-content: center;
  margin-top: 26px;
  animation: arrive-rise 0.4s ease 1s both;
}
.arrive-actions .btn-primary { padding: 12px 28px; font-size: 15px; }
.arrive.arrive-out { animation: arrive-leave 0.4s ease forwards; }
.arrive.arrive-out::backdrop { animation: arrive-leave 0.4s ease forwards; }
@keyframes arrive-frost {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes arrive-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes arrive-leave {
  from { opacity: 1; }
  to { opacity: 0; }
}

.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dash-table th, .dash-table td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.dash-table thead th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-table tbody tr:last-child td, .dash-table tbody tr:last-child th { border-bottom: 0; }
.dash-table tbody th { font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.dash-table tbody th a { color: var(--ink); text-decoration: none; }
.dash-table tbody th a:hover { color: var(--accent); }
.dash-table .ring .ring-number { font-size: 12px; }
.dash-cell-score, .dash-cell-trend { width: 1%; }
.dash-cell-todo a { color: var(--ink); }
.dash-cell-when time { color: var(--muted); }
.dash-next { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.dash-next time { color: inherit; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--muted); }
.feed-icon svg { width: 13px; height: 13px; }
.feed-good .feed-icon { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.feed-attention .feed-icon { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.feed-main { display: grid; gap: 2px; min-width: 0; }
.feed-main a { color: var(--ink); text-decoration: none; }
.feed-main a:hover { color: var(--accent); }
.feed-detail { color: var(--muted); font-size: 13px; }
.feed-when { color: var(--faint); font-size: 12px; white-space: nowrap; padding-top: 2px; }

/* Key/value */

.kv { display: grid; gap: 10px; margin: 0; }
.kv > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.kv code { font-size: 13px; background: var(--sunken); padding: 1px 6px; border-radius: 4px; }

/* Health hero (Home and Project) */

.health {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 24px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}
.health-scored { grid-template-columns: auto minmax(0, 1fr) auto; }
.health-score { display: grid; gap: 6px; justify-items: center; align-content: center; padding-right: 8px; }
.health-score .ring .ring-number { font-size: 26px; }
.health-text { display: grid; gap: 8px; }
.health-text h1 { font-size: 28px; }
.health-text .badge { justify-self: start; }
.health-text .lead { font-size: 16px; }
.health-text .foot { color: var(--muted); font-size: 14px; }
.health-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.health-act { border-left: 4px solid var(--dot-fail); }
.health-attention { border-left: 4px solid var(--dot-busy); }
.health-good { border-left: 4px solid var(--dot-ok); }
.health-checking { border-left: 4px solid var(--tone-indigo-fg); }
.health-failed { border-left: 4px solid var(--dot-fail); }
.health-muted { border-left: 4px solid var(--line); }

/* Project list */

.project-list { display: grid; gap: 12px; }
@media (min-width: 1200px) {
  .project-list { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); align-items: start; }
}
.project {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 10px 24px;
  align-items: start;
  padding: 22px 24px 18px;
  color: var(--hero-ink);
  background:
    radial-gradient(closest-side at 16% 42%, color-mix(in srgb, var(--hero-tint) 14%, transparent), transparent),
    linear-gradient(180deg, color-mix(in srgb, var(--hero-tint) 5%, transparent), transparent 48%),
    var(--hero-bg);
  border: 1px solid color-mix(in srgb, var(--hero-tint) 18%, var(--line));
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-card);
}
.project-score {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
}
.project-score .ring { color: var(--hero-tint); }
.project-score .ring .ring-number { fill: var(--hero-ink); font-size: 36px; }
.project-score .ring .ring-track { stroke: var(--hero-line); }
.project-score .dash-foot {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 0;
  padding-top: 8px;
  width: 120px;
  border-top: 1px solid var(--hero-line);
}
.project-score .dash-foot .muted { color: var(--hero-muted); white-space: normal; text-align: center; }
.project-main { grid-column: 2; grid-row: 1; display: grid; gap: 6px; min-width: 0; }
.project-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.project-title h2 { font-size: 22px; }
.project-title h2 a { color: var(--hero-ink); text-decoration: none; }
.project-title h2 a:hover { color: var(--hero-tint); }
.project .dash-score-word {
  color: var(--hero-tint);
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.project .dash-score-delta { color: var(--hero-ink); }
.project-sentence { color: var(--hero-ink); }
.project-meta { color: var(--hero-muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.project-meta span + span::before { content: "·"; margin-right: 8px; color: var(--hero-line); }
.project .spark, .project .spark-up, .project .spark-down { color: var(--hero-tint); }
.project:not(:has(.project-score)) {
  grid-template-columns: minmax(0, 1fr);
}
.project:not(:has(.project-score)) .project-main,
.project:not(:has(.project-score)) .project-bar {
  grid-column: 1;
}
.project-bar {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.project .progress { grid-column: 1 / -1; grid-row: auto; }

.progress { display: grid; gap: 6px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--tone-indigo-fg); width: 15%; transition: width 0.6s ease; }
.progress-fill.indeterminate { width: 30%; animation: slide 1.6s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.progress-text { color: var(--muted); font-size: 13px; display: flex; gap: 8px; justify-content: space-between; }

.more-menu { position: relative; }
.more-menu summary { list-style: none; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: grid;
  gap: 2px;
}
.more-menu .menu a, .more-menu .menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.more-menu .menu a:hover, .more-menu .menu button:hover { background: var(--sunken); }
.more-menu .menu .danger { color: var(--danger); }
.more-menu .menu form { margin: 0; }

/* Stepper (live scan) */

.stepper { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.stepper li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  color: var(--muted);
  position: relative;
}
.stepper li::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 30px;
  bottom: -8px;
  width: 2px;
  background: var(--line-soft);
}
.stepper li:last-child::before { display: none; }
.step-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  color: var(--on-ink);
  font-size: 12px;
  font-weight: 700;
}
.step-mark svg { width: 14px; height: 14px; }
.stepper li.done { color: var(--ink); }
.stepper li.done .step-mark { background: var(--dot-ok); border-color: var(--dot-ok); }
.stepper li.active { color: var(--ink); font-weight: 600; }
.stepper li.active .step-mark { border-color: var(--tone-indigo-fg); color: var(--tone-indigo-fg); }
.stepper li.active .step-mark::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--tone-indigo-fg); animation: pulse 1.4s ease-in-out infinite; }
.stepper li.failed .step-mark { background: var(--dot-fail); border-color: var(--dot-fail); }
.step-text { display: grid; gap: 2px; padding-top: 1px; }
.step-note { font-size: 13px; color: var(--muted); font-weight: 400; }

.terminal {
  margin: 0;
  padding: 12px 14px;
  background: #0f0d0b;
  color: #d6d3d1;
  border-radius: var(--radius-small);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  max-height: 320px;
  overflow: auto;
}
.terminal .term-line { display: block; white-space: pre-wrap; word-break: break-word; }
.terminal .term-time { color: #78716c; margin-right: 8px; }
.terminal .tone-error { color: #fda4af; }
.terminal .tone-warn { color: #fde68a; }
.terminal .tone-ok { color: #86efac; }
.terminal .term-wait { color: #a8a29e; font-style: italic; }

/* Fix cards */

.fix-group { margin-top: 28px; }
.fix-group > header { display: grid; gap: 4px; margin-bottom: 12px; }
.fix-group > header h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.fix-group > header p { color: var(--muted); max-width: 70ch; }
.fix-list { display: grid; gap: 12px; }
.fix {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 10px;
}
.fix-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.fix-head h3 { font-size: 17px; flex: 1; min-width: 200px; }
.fix-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fix-action { font-size: 15px; }
.fix-action strong { font-weight: 600; }
.fix-summary { color: var(--muted); }
.fix-files { color: var(--muted); font-size: 13px; }
.fix-files code { font-size: 12.5px; background: var(--sunken); padding: 1px 6px; border-radius: 4px; }
.fix .actions { margin-top: 4px; }
.fix-rotate { border-left: 4px solid var(--dot-fail); }
.fix-fix { border-left: 4px solid var(--dot-busy); }
.fix-policy { border-left: 4px solid var(--tone-amber-fg); }
.fix-uncertain { border-left: 4px solid var(--tone-indigo-fg); }
.fix-ignore { border-left: 4px solid var(--line); }
.fix-ignore h3 { color: var(--muted); font-weight: 500; }
.steps-list { display: grid; gap: 8px; padding-left: 20px; }
.steps-list li { padding-left: 4px; }

/* Issues */

.issue-group { margin-top: 26px; }
.issue-group > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.issue-group > header h2 { font-size: 19px; }
.issue-group > header p { color: var(--muted); font-size: 14px; }
.issue-list { display: grid; gap: 8px; }
.issue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
}
a.issue:hover { border-color: var(--accent); }
.issue-main { display: grid; gap: 4px; min-width: 0; }
.issue-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.issue-where { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-where code { font-size: 12.5px; }
.issue-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.issue-cluster { padding: 0; }
.issue-cluster summary { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; cursor: pointer; list-style: none; }
.issue-cluster summary::-webkit-details-marker { display: none; }
.issue-cluster .issue-list { padding: 0 12px 12px; }
.issue-cluster .issue { border-color: var(--line-soft); }

/* Issue detail */

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.decision-box {
  display: grid;
  gap: 10px;
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.decision-box h2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 20px; }

/* Charts
   Plain SVG from ui/charts.js. Score bands share one palette everywhere:
   excellent green, good sky, needs work amber, at risk red. */

.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--ui); font-size: 11px; fill: var(--muted); }
.chart .grid { stroke: var(--line-soft); }
.chart .seg-critical, .chart .seg-high { stroke: var(--fig-alarm); }
.chart .seg-medium { stroke: var(--fig-warn); }
.chart .seg-low, .chart .seg-info { stroke: var(--muted); }
.chart .seg-absent { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .dot-mark { fill: var(--card); stroke-width: 2; }
.chart .dot-critical, .chart .dot-high { stroke: var(--fig-alarm); }
.chart .dot-medium { stroke: var(--fig-warn); }
.chart .dot-low, .chart .dot-info { stroke: var(--muted); }
.chart .dot-absent { stroke: var(--line); }
.chart-figure { margin: 0; }

:root {
  --band-excellent: var(--tone-green-fg);
  --band-good: var(--tone-sky-fg);
  --band-work: var(--tone-amber-fg);
  --band-risk: var(--tone-red-fg);
  --band-none: var(--faint);
}
.band-excellent { color: var(--band-excellent); }
.band-good { color: var(--band-good); }
.band-work { color: var(--band-work); }
.band-risk { color: var(--band-risk); }
.band-none { color: var(--band-none); }

.ring { display: block; flex: none; }
.ring .ring-track { stroke: var(--line-soft); }
.ring .ring-value { stroke: currentColor; transition: stroke-dasharray 0.6s ease; }
.ring .ring-number { fill: var(--ink); font-family: var(--ui); font-weight: 700; letter-spacing: -0.02em; }
.ring-excellent,
.ring-good,
.ring-work,
.ring-risk { color: var(--accent); }
.ring-none { color: var(--band-none); }
.ring-none .ring-number { fill: var(--faint); }

.score-blocked {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  flex: none;
}
.score-blocked-ring {
  display: grid;
  filter: blur(7px);
  opacity: 0.45;
}
.score-blocked-mark {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--vivid-red);
  color: #fff;
  font-family: var(--ui);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 0 0 4px var(--hero-bg, var(--card));
}

.spark { display: block; flex: none; color: var(--muted); }
.spark .spark-line { stroke: currentColor; }
.spark .spark-dot { fill: currentColor; }
.spark-up { color: var(--accent); }
.spark-down { color: var(--muted); }

.bars .bar-new { fill: var(--accent); opacity: 0.92; }
.bars .bar-fixed { fill: color-mix(in srgb, var(--accent) 42%, var(--faint)); }
.bars .line-open { stroke: var(--ink); opacity: 0.7; }
.bars .line-dot { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
.bars .axis-name { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend .key-new { background: var(--accent); }
.chart-legend .key-fixed { background: color-mix(in srgb, var(--accent) 42%, var(--faint)); }
.chart-legend .key-open { background: var(--ink); height: 2px; width: 14px; border-radius: 1px; }

.strip { display: block; max-width: 100%; height: auto; }
.strip text { font-family: var(--ui); font-size: 10px; fill: var(--muted); }
.strip .cell { fill: var(--accent); }
.strip .level-0 { fill: var(--sunken); }
.strip .level-1 { opacity: 0.3; }
.strip .level-2 { opacity: 0.5; }
.strip .level-3 { opacity: 0.75; }
.strip .level-4 { opacity: 1; }

.stack-chart .stack-name { fill: var(--ink); font-size: 12px; }
.stack-chart .stack-bar { fill: var(--accent); opacity: 0.8; }
.stack-chart .stack-framework { fill: var(--tone-indigo-fg); }
.stack-chart .stack-runtime { fill: var(--tone-sky-fg); }
.stack-chart .stack-gone { opacity: 0.35; }

.line-chart .line-main { stroke: var(--accent); }
.line-chart .line-dot { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.line-chart .dot-excellent { stroke: var(--band-excellent); }
.line-chart .dot-good { stroke: var(--band-good); }
.line-chart .dot-work { stroke: var(--band-work); }
.line-chart .dot-risk { stroke: var(--band-risk); }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.timeline time { color: var(--muted); }
.locations { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.locations li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 10px; background: var(--sunken); border-radius: 8px; }
.locations code { font-size: 13px; word-break: break-all; }
.locations span { color: var(--muted); white-space: nowrap; }

/* Scan history */

/* Open · Fixed · All on the issues tab */
.segments {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--sunken);
  margin-bottom: 18px;
}
.segments a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}
.segments a:hover { color: var(--ink); }
.segments a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px var(--shadow-2); }
.segment-count { font-size: 12px; color: var(--faint); }
.segments a[aria-current="page"] .segment-count { color: var(--muted); }
.issue-resolved .issue-title { color: var(--muted); }
.dialog .actions .dialog-aside { margin-right: auto; }

/* Project History tab */
.story-card { padding-top: 6px; padding-bottom: 6px; }
.story .feed-item { font-size: 14px; padding: 12px 0; }
.story .feed-item[aria-current="true"] .feed-main > a { color: var(--accent); }
.story .feed-icon { width: 28px; height: 28px; }
.story .feed-icon svg { width: 15px; height: 15px; }
.feed-fail .feed-icon { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.feed-checking .feed-icon { background: var(--tone-indigo-bg); color: var(--tone-indigo-fg); }
.trends .dash-card { box-shadow: none; }

.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.history li[aria-current="true"] { border-color: var(--accent); }
.history-main { display: grid; gap: 2px; min-width: 0; }
.history-main strong { font-weight: 600; }
.history-main span { color: var(--muted); font-size: 13px; }
.history-when { color: var(--muted); font-size: 13px; text-align: right; }

/* Choices (add project) */

.choices { display: grid; gap: 12px; }
.choice {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-card);
}
.choice:hover { border-color: var(--accent); color: var(--ink); }
.choice-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--sunken); }
.choice-icon svg { width: 22px; height: 22px; }
.choice-text { display: grid; gap: 2px; }
.choice-text strong { display: flex; gap: 8px; align-items: center; font-size: 16px; }
.choice-text span { color: var(--muted); font-size: 14px; }
.choice-arrow svg { width: 18px; height: 18px; color: var(--muted); }
.choice-primary { border-color: var(--accent); }
.choice-primary .choice-icon { background: var(--accent-quiet); color: var(--accent); }
.choice-form { margin: 0; }
button.choice { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }

dialog.repo-help {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0;
  margin: auto;
  width: min(480px, calc(100vw - 32px));
  height: auto;
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  animation: repo-help-in 0.22s ease;
}
dialog.repo-help::backdrop {
  background: rgba(20, 18, 16, 0.5);
  animation: repo-help-fade 0.22s ease;
}
@keyframes repo-help-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes repo-help-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.repo-help,
  dialog.repo-help::backdrop { animation: none; }
}
.repo-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.repo-help-head h2 { font-size: 26px; margin: 0; }
.repo-help-close {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
}
.repo-help-close svg { width: 18px; height: 18px; }
.repo-help-close:hover { color: var(--ink); background: var(--sunken); }
button.repo-help-close { border: 0; background: transparent; cursor: pointer; padding: 0; font: inherit; }
dialog.repo-help .repo-help-body {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px 20px 24px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
dialog.repo-help h3 { font-family: var(--ui); font-size: 14px; margin: 4px 0 0; }
dialog.repo-help p,
dialog.repo-help li { color: var(--muted); font-size: 14.5px; line-height: 1.55; }
dialog.repo-help ul,
dialog.repo-help ol { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
dialog.repo-help strong { color: var(--ink); font-weight: 650; }
.repo-prompt {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.repo-prompt .copy-row { margin: 0; }
.repo-prompt .copy-row h3 { margin: 0; }
.repo-prompt .code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--card);
}
.repo-help-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
dialog.history-secrets {
  width: min(560px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
dialog.history-secrets .repo-help-foot { position: relative; z-index: 1; }
.history-secret-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.history-secret-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.history-secret-item p { margin: 0; }
.history-secret-path { font-family: var(--mono); font-size: 13px; color: var(--ink); word-break: break-all; }
.history-ack-all { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; width: 100%; margin: 0; }
.history-ack { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 14px; }
.history-ack input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.guide-step { display: grid; gap: 12px; align-content: start; }
.guide-progress { display: flex; gap: 6px; margin: 0; }
.guide-progress span {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
}
.guide-progress .is-done,
.guide-progress .is-current { background: var(--accent); }
.guide-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.guide-step-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-quiet);
  color: var(--accent);
}
.guide-step-icon svg { width: 24px; height: 24px; }
.guide-step h3 { font-family: var(--display); font-size: 22px; margin: 0; color: var(--ink); }
.guide-step > p { margin: 0; }
.guide-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.guide-answers a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 650;
  font-size: 16px;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.guide-answers a:hover { border-color: var(--accent); background: var(--accent-quiet); color: var(--ink); }
.guide-prompt { display: grid; gap: 10px; }
.guide-prompt h3 { font-family: var(--ui); font-size: 14px; }
.guide-prompt .code { font-family: var(--mono); font-size: 12.5px; background: var(--paper); }
.guide-prompt .btn { width: 100%; white-space: normal; }
.guide-step > .btn { justify-self: start; }

.repo-pick { display: grid; gap: 8px; max-height: 480px; overflow: auto; padding: 2px; }

/* Settings subnav */

.subnav { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--line); overflow: auto hidden; scrollbar-width: none; }
.subnav a {
  padding: 10px 14px;
  margin-bottom: -1px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Appearance picker. Each option is drawn in its own theme, so the card
   previews what the choice looks like in the current light or dark mode. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.theme-option {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.theme-option input {
  position: absolute;
  top: 18px;
  left: 18px;
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  z-index: 1;
}
.theme-option:hover { border-color: var(--faint); }
.theme-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-preview {
  display: grid;
  grid-template-columns: 30% minmax(0, 1fr);
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
}
.theme-preview .tp-side { background: var(--sidebar); border-right: 1px solid var(--sidebar-line); }
.theme-preview .tp-body { padding: 10px 8px 8px; display: grid; gap: 6px; align-content: start; }
.theme-preview .tp-card { height: 18px; border-radius: 4px; background: var(--card); border: 1px solid var(--line); }
.theme-preview .tp-text { height: 6px; width: 70%; border-radius: 999px; background: var(--muted); opacity: 0.6; }
.theme-preview .tp-accent { height: 12px; width: 44%; border-radius: 999px; background: var(--accent); }
.theme-name { font-family: var(--display); font-weight: 600; font-size: 16px; }
.theme-option small { color: var(--muted); line-height: 1.35; }
.fieldset-plain { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.fieldset-plain legend { padding: 0; font-weight: 600; }
.fieldset-plain .hint { margin-top: 2px; color: var(--muted); font-size: 13px; }
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--card);
}
.segmented label {
  position: relative;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  border-right: 1px solid var(--line);
}
.segmented label:last-of-type { border-right: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.segmented label:hover { color: var(--ink); }
.segmented label:has(input:checked) { background: var(--accent-quiet); color: var(--accent); font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.appearance-status { min-height: 20px; margin-top: 12px; }

.row-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.row-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.row-list .row-main { display: grid; gap: 2px; min-width: 0; }
.row-list .row-main strong { font-weight: 600; }
.row-list .row-main span { color: var(--muted); font-size: 13px; word-break: break-all; }

/* Chips row for stack */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--sunken); font-size: 13px; color: var(--ink); }

.tool-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tool-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 10px; }
.tool-list .tool-what { color: var(--muted); }
.tool-list .tool-state { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Dev chrome compatibility */

#dev-errors { font-family: var(--mono); }

/* Mobile */

@media (max-width: 1100px) {
  .topbar-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar nav { justify-self: end; }
  .account-name { display: none; }
}

@media (max-width: 860px) {
  :root { --topbar-height: 54px; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs a { white-space: nowrap; }
  .topbar-inner { gap: 10px; }
  .topbar .mark { font-size: 17px; gap: 7px; }
  .mark-sign { width: 20px; height: 20px; }
  .topbar nav { padding: 3px; }
  .topbar nav a { padding: 7px 9px; }
  .topbar nav a span { display: none; }
  .topbar nav a svg { width: 19px; height: 19px; }
  .account-summary { padding: 2px; }
  .account-chevron { display: none; }
  .avatar { width: 30px; height: 30px; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
  .agent-grid { grid-template-columns: 1fr; }
  .health, .health-scored { grid-template-columns: 1fr; }
  .health-score { justify-items: start; grid-auto-flow: column; align-items: center; gap: 14px; padding-right: 0; }
  .health-actions { justify-content: flex-start; }
  .project { grid-template-columns: 1fr; grid-template-rows: none; }
  .project-score, .project-main, .project-bar { grid-column: 1; grid-row: auto; }
  .project-bar { justify-content: flex-end; }
  .project .dash-score-word { font-size: 24px; }
  .project-score .ring { width: 96px; height: 96px; }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  .field-row { grid-template-columns: 1fr; }
  .choice { grid-template-columns: 44px minmax(0, 1fr); }
  .choice-arrow { display: none; }
  .history li { grid-template-columns: auto minmax(0, 1fr); }
  .history-when { grid-column: 2; text-align: left; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .issue { grid-template-columns: 1fr; }
  .issue-side { justify-content: flex-start; }
  .tool-list li { grid-template-columns: 10px minmax(0, 1fr); }
  .tool-list .tool-state { grid-column: 2; }
  h1 { font-size: 26px; }
  .health-text h1 { font-size: 24px; }
  .stat-value { font-size: 26px; }
  .dash-row-1, .dash-cols { grid-template-columns: 1fr; }
  .fix-board-body { grid-template-columns: 1fr; justify-items: center; min-height: 0; }
  .fix-legend, .fix-detail { width: 100%; }
  .fix-detail, .fix-pane { height: auto; min-height: 0; }
  .dash-feed .feed { grid-template-columns: 1fr; }
  .dash-feed .feed-item { grid-template-columns: 32px minmax(0, 1fr); }
  .dash-big { font-size: 34px; }
  .dash-hero { grid-template-columns: 1fr; gap: 24px; padding: 22px 20px; }
  .dash-hero-bar { grid-template-rows: none; }
  .dash-hero-bar .hero-score, .dash-hero-bar .hero-stats, .dash-hero-bar .hero-bar { grid-column: 1; grid-row: auto; }
  .dash-hero-bar .hero-bar { margin-top: 0; }
  .dash-hero .ring { width: 112px; height: 112px; }
  .dash-hero .dash-score-word { font-size: 26px; }
  .dash-hero .dash-score-body { flex-direction: column; align-items: flex-start; }
  .dash-hero .dash-score-text { width: 100%; }
  .risk-bars li {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "label count fixed" "track track track";
  }
  .risk-bar-label { grid-area: label; }
  .risk-bar-count { grid-area: count; }
  .risk-bar-fixed { grid-area: fixed; }
  .risk-bar-track { grid-area: track; }
  .hero-stats { grid-template-columns: 1fr; gap: 4px; }
  .hero-stat { border-left: 0; padding: 12px 0; border-top: 1px solid var(--hero-line); }
  .hero-stat:first-child { border-top: 0; }
  .dash-hero .dash-big { font-size: 40px; }
  .dash-hero-counts .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dash-hero-counts .hero-stat,
  .dash-hero-counts .hero-stat:first-child {
    align-items: center;
    text-align: center;
    border-top: 0;
    border-left: 0;
    padding: 8px 2px 0;
    gap: 2px;
  }
  .dash-hero-counts .dash-big { font-size: 48px; margin-top: 0; line-height: 0.9; }
  .dash-hero-counts .dash-title { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 550; }
  .dash-tint { height: 420px; }
  .welcome { grid-template-columns: 1fr; gap: 28px; padding: 24px 16px; }
  .repo-card label { grid-template-columns: 18px 40px minmax(0, 1fr); gap: 10px; padding-left: 8px; }
  .repo-picker-bar { justify-content: stretch; }
  .repo-picker-bar .btn { width: 100%; }
  dialog.repo-help {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
    animation-name: repo-help-sheet;
  }
  @keyframes repo-help-sheet {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
  }
  .welcome h2 { font-size: 24px; }
  .feed-item { grid-template-columns: 28px minmax(0, 1fr); }
  .feed-when { grid-column: 2; }
}

@media (max-width: 1360px) {
  .dash-cell-commits { display: none; }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row-1 .dash-score { grid-column: 1 / -1; }
  .dash-hero { grid-template-columns: 1fr; gap: 28px; }
  .dash-hero-bar { grid-template-rows: none; }
  .dash-hero-bar .hero-score, .dash-hero-bar .hero-stats, .dash-hero-bar .hero-bar { grid-column: 1; grid-row: auto; }
  .hero-stat { padding: 4px 20px; }
  .dash-hero .dash-big { font-size: 48px; }
  .dash-cols { grid-template-columns: 1fr; }
  .fix-board-body { grid-template-columns: 220px minmax(0, 1fr); }
  .fix-detail { grid-column: 1 / -1; }
  .dash-feed .feed { grid-template-columns: 1fr; }
  .welcome { gap: 28px; padding: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
