@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/JetBrainsMono-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg:        #050806;
  --surface:   #0B110D;
  --surface-2: #101A14;
  --line:      #1C2B22;
  --text:      #D8F3E0;
  --muted:     #7E9E89;
  --green:     #00FF41;
  --green-dim: #00B32E;
  --amber:     #FFB020;
  --red:       #FF4D4D;
  /* Dot color only: below 4.5:1, so NOT CONNECTED text uses --muted. */
  --grey:      #5C6F63;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
p { margin: 0; }
h1, h2 { line-height: 1.2; margin: 0; }

#rain { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; opacity: 0.5; }
body[data-rain="dim"] #rain { opacity: 0.35; }
body > header, body > main { position: relative; z-index: 1; }

/* Layout: one 800 px column for the header and the cards (correction 2). */
.col { width: 100%; max-width: 800px; margin: 0 auto; }
main { padding: 32px; }
.top { background: var(--bg); border-bottom: 1px solid var(--line); padding: 16px 32px; }
.bar { display: flex; align-items: center; gap: 16px; }
.bar .wordmark { flex: 1; font-size: 16px; }
.who { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; text-align: right; }

.wordmark { font-family: var(--mono); font-weight: 700; letter-spacing: 0.08em; color: var(--text); display: flex; align-items: center; gap: 12px; }
.mark { width: 12px; height: 12px; background: var(--green); display: inline-block; flex: none; }

/* S1 sign in */
.signin { max-width: 480px; padding-top: 64px; padding-bottom: 64px; }
.signin .wordmark { font-size: 28px; margin-bottom: 16px; }
.signin .lead { color: var(--muted); margin-bottom: 24px; }
.signin form { margin: 0; }
.foot { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; letter-spacing: 0.08em; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.cards { display: flex; flex-direction: column; gap: 16px; }
.section-label { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 4px 8px; margin: 32px 0 12px; }

/* Banner */
.banner h2 { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; color: var(--muted); }
.overall { font-family: var(--mono); font-weight: 700; font-size: 28px; letter-spacing: 0.08em; margin: 8px 0; }
.overall.ready { color: var(--green); }
.overall.failed { color: var(--red); }
.summary { color: var(--muted); }

/* Connection cards */
.conn { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.conn-body { flex: 1 1 280px; min-width: 0; }
.conn h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.state-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; }
.badge { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }
.badge.connected { color: var(--green); }
.badge.connected::before { background: var(--green); }
.badge.attention { color: var(--amber); }
.badge.attention::before { background: var(--amber); }
.badge.not_connected { color: var(--muted); }
.badge.unavailable { color: var(--muted); }
.badge.checking::before { animation: pulse 1s ease-in-out infinite; }
.detail { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.footer-actions .link { background: var(--bg); border-radius: 6px; padding: 4px 8px; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* Claude connect panel (S4) */
.panel { flex: 1 1 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.step-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.num { font-family: var(--mono); font-weight: 700; color: var(--green); }
.step-body { padding-left: 32px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.caption { color: var(--muted); font-size: 14px; }
.code-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0; width: 100%; }
.code-form input, .code-form select {
  flex: 1 1 200px; min-width: 0;
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 12px;
}

/* Messages */
.error, .notice { color: var(--red); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; overflow-wrap: anywhere; }
.notice { color: var(--amber); border-color: var(--amber); }
.conn .error, .panel .error, .panel .notice { flex: 1 1 100%; margin: 0; }
.hidden { display: none; }

/* Buttons */
button, .button { font: inherit; font-size: 16px; border-radius: 6px; padding: 8px 16px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-block; line-height: 1.5; }
.primary { background: var(--green); color: var(--bg); font-weight: 600; }
.primary:hover { background: var(--green-dim); }
.primary:disabled { opacity: 0.6; cursor: default; }
.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.secondary:hover { border-color: var(--muted); }
.link { background: none; border: 0; color: var(--muted); padding: 4px 0; }
.link:hover { color: var(--text); text-decoration: underline; }
.wide { display: block; width: 100%; text-align: center; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Mobile (S6, S7): one column, 16 px page padding. */
@media (max-width: 640px) {
  main { padding: 16px; }
  .top { padding: 12px 16px; }
  .bar { flex-wrap: wrap; gap: 8px 16px; }
  .who { flex: 1 1 100%; order: 3; text-align: left; }
  .card, .panel { padding: 16px; }
  .step-body { padding-left: 0; }
  .signin { padding-top: 48px; padding-bottom: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .badge.checking::before { animation: none; }
}

body[data-rain="dense"] #rain { opacity: 0.12; }
.skip { position: absolute; left: 8px; top: -64px; z-index: 3; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.skip:focus { top: 8px; }
.admin-container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.admin-grid { display: grid; gap: 16px; }
/* Above main, so the fixed bottom tab bar inside it stays on top of the page. */
.admin-top { background: var(--surface); border-bottom: 1px solid var(--line); z-index: 2; }
.admin-bar { display: flex; align-items: center; gap: 24px; min-height: 56px; }
.admin-bar .wordmark { font-size: 14px; text-decoration: none; }
.admin-nav { flex: 1; display: flex; }
.admin-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; }
.admin-nav a { display: flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.admin-nav a:hover { color: var(--text); }
.admin-nav a[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }
.admin-nav svg { display: none; }
.live-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.live-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }
.admin-bar .who { font-size: 12px; display: none; }
.admin-main { padding: 24px 0 64px; }
.admin-title { font-size: 20px; font-weight: 600; line-height: 28px; margin-bottom: 16px; }

.data-row { display: grid; align-items: center; gap: 16px; min-height: 44px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.data-row .n, .kpi .value { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.data-row .n { text-align: right; min-width: 6ch; }
.chip { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; background: var(--bg); border-radius: 6px; padding: 4px 8px; white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }
.chip.good::before { background: var(--green); }
.chip.warn { color: var(--amber); }
.chip.warn::before { background: var(--amber); }
.chip.bad { color: var(--red); }
.chip.bad::before { background: var(--red); }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .value { font-size: 20px; line-height: 28px; }
.kpi .label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

@media (min-width: 1024px) {
  .admin-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
  .admin-nav ul { gap: 24px; }
  .admin-bar .who { display: inline; }
}

@media (max-width: 639px) {
  .admin-container { padding: 0 16px; }
  .admin-bar { min-height: 48px; gap: 12px; }
  .admin-bar .wordmark { flex: 1; }
  .admin-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .admin-nav ul { flex: 1; justify-content: space-around; gap: 0; }
  .admin-nav a { flex-direction: column; justify-content: center; gap: 4px; min-height: 56px; min-width: 52px; padding: 0 4px; font-size: 10px; border-bottom: 0; border-top: 2px solid transparent; }
  .admin-nav a[aria-current="page"] { border-top-color: var(--green); }
  .admin-nav svg { display: block; }
  .admin-main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

.dot { display: inline-flex; align-items: center; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }

/* Tones: one meaning per token, always next to a text label. */
.tone-queued, .tone-neutral { color: var(--muted); }
.tone-working { color: var(--green-dim); }
.tone-waiting { color: var(--amber); }
.tone-good { color: var(--green); }
.tone-bad { color: var(--red); }
.tone-queued::before { background: var(--grey); }
.tone-working::before { background: var(--green-dim); animation: pulse 1s ease-in-out infinite; }
.tone-waiting::before { background: var(--amber); }
.tone-good::before { background: var(--green); }
.tone-neutral::before { background: var(--muted); }
.tone-bad::before { background: var(--red); }
.tone-fill-queued { fill: var(--grey); }
.tone-fill-working { fill: var(--green-dim); }
.tone-fill-waiting { fill: var(--amber); }
.tone-fill-good { fill: var(--green); }
.tone-fill-neutral { fill: var(--muted); }
.tone-fill-bad { fill: var(--red); }
.tone-text-bad { color: var(--red); }
.tone-text-waiting { color: var(--amber); }
.tone-text-good { color: var(--green); }

/* Admin page head, filters and chips */
.page-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.page-head .admin-title { margin-bottom: 0; }
.page-head .count { color: var(--muted); font-size: 14px; }
.page-head .export { margin-left: auto; font-size: 14px; padding: 8px 12px; }
.filters { margin-bottom: 16px; }
.filters > summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 12px 0 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field select { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; min-height: 44px; max-width: 100%; }
.field.check { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; }
.field.check input { width: 20px; height: 20px; accent-color: var(--green); }
.filters-form .primary { min-height: 44px; font-size: 14px; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip.removable { color: var(--text); text-decoration: none; border: 1px solid var(--line); min-height: 32px; }
.chip.removable::before { display: none; }
.chip.removable:hover { border-color: var(--muted); }

/* Data tables: real tables everywhere, two-line rows on phones. */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.data-table th { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { height: 44px; padding: 12px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 16px; }
.data-table .c-repo { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.data-table .c-state .chip { margin-left: 8px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; min-width: 6ch; }
.data-table .c-meta { display: none; }
.data-table a { color: var(--green); }
.data-table th a { color: inherit; text-decoration: none; }
.data-table th a:hover { color: var(--text); }
.data-table th[aria-sort] a { color: var(--green); }
.data-table th[aria-sort] a::after { content: " ↓"; }
.run-link { font-family: var(--mono); font-weight: 700; text-decoration: none; }
.data-table .run-link { color: var(--text); }
.run-link:hover { text-decoration: underline; }
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.pager .button { font-size: 14px; }
.empty { padding: 24px; color: var(--muted); }
.admin-error p { display: flex; align-items: center; gap: 8px; }

/* Run page */
.back { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-decoration: none; }
.run-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.run-head .admin-title { margin-bottom: 0; font-family: var(--mono); font-weight: 700; }
.run-summary { color: var(--muted); font-size: 14px; line-height: 20px; margin-bottom: 24px; }
.run-grid, .run-rail { display: grid; gap: 16px; align-content: start; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head > span { font-size: 12px; }
.card .section-label { margin: 0 0 12px; font-weight: 400; line-height: 16px; }
.timeline { list-style: none; margin: 0; padding: 0; background: linear-gradient(var(--line), var(--line)) 71px 0 / 2px 100% no-repeat; }
.entry { display: grid; grid-template-columns: 48px 24px minmax(0, 1fr); gap: 0 12px; align-items: start; padding: 12px 0; min-height: 44px; }
.entry .time { font-size: 12px; line-height: 24px; color: var(--muted); text-align: right; }
.glyph { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; font-weight: 700; border: 1px solid currentColor; border-radius: 4px; background: var(--surface); }
.entry-body { min-width: 0; }
.entry-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; line-height: 24px; }
.entry-text { overflow-wrap: anywhere; }
.ms { margin-left: auto; color: var(--muted); font-size: 12px; }
.entry-detail { color: var(--muted); font-size: 12px; line-height: 16px; }
.subs { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); display: grid; gap: 4px; font-size: 14px; }
.subs li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reveal { display: inline-flex; margin: 0; }
.reveal button { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; padding: 4px 0; }
pre.revealed { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 8px 0 0; font-family: var(--mono); font-size: 12px; line-height: 16px; max-height: 400px; overflow: auto; }
pre.revealed.failed { color: var(--red); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpis .kpi { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.stage-bar { display: block; width: 100%; height: 8px; border-radius: 4px; overflow: hidden; }
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12px; line-height: 16px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.links li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.links .label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); flex: none; }
.links .value, .links a { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.links a { color: var(--green); }

@media (min-width: 1024px) {
  .filters > summary { display: none; }
  .filters::details-content { content-visibility: visible; display: block; }
  .filters-form { margin-top: 0; }
  .run-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
  .run-rail { position: sticky; top: 24px; }
}

@media (max-width: 639px) {
  .admin-main { padding-bottom: calc(64px + 64px + env(safe-area-inset-bottom)); }
  .filters > summary { position: fixed; right: 16px; bottom: calc(64px + 8px + env(safe-area-inset-bottom)); z-index: 4; min-height: 48px; background: var(--green); color: var(--bg); border-color: var(--green); }
  .filters[open] .filters-form { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; margin: 0; max-height: 80vh; overflow-y: auto; background: var(--surface); border-top: 1px solid var(--line); padding: 24px 16px calc(64px + 64px + env(safe-area-inset-bottom)); }
  .filters-form .field { flex: 1 1 100%; }
  .page-head .export { margin-left: 0; }
  .table-scroll { overflow: visible; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 56px; }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table td { display: none; height: auto; padding: 0; border: 0; }
  .data-table td.c-id, .data-table td.c-state, .data-table td.c-meta { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .data-table td.c-id { grid-column: 1; grid-row: 1; }
  .data-table td.c-state { grid-column: 2; grid-row: 1; justify-self: end; }
  .data-table td.c-meta { grid-column: 1 / -1; grid-row: 2; font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--muted); }
  .entry { grid-template-columns: 40px 24px minmax(0, 1fr); gap: 0 8px; }
  .reveal button { min-height: 44px; }
  .timeline { background-position: 59px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tone-working::before { animation: none; }
}

@media print {
  #rain, .admin-nav, .live-badge, .skip, .filters, .reveal, .revealed, .pager .button { display: none !important; }
  body, .card, .kpis .kpi { background: #fff; color: #000; }
  .card { border-color: #000; }
}

/* Tokens per model */
.tok { color: var(--muted); font-size: 12px; min-width: 8ch; text-align: right; }
.token-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.token-table th, .token-table td { padding: 8px 0 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.token-table th:first-child { padding-left: 0; }
.token-table thead th { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.token-table tbody th { font-weight: 400; }
.token-table .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.token-table .model { display: block; }
.token-table .raw { display: block; color: var(--muted); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.token-table .tok-line { display: none; }
.token-table tr.total th, .token-table tr.total td { border-bottom: 0; font-weight: 600; }
@media (min-width: 1024px) {
  .token-table thead, .token-table td:not(:last-child) { display: none; }
  .token-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .token-table .tok-line { display: block; color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 400; }
  .token-table tr.total .tok-line { display: none; }
}
@media (max-width: 639px) {
  .token-table thead, .token-table td:not(:last-child) { display: none; }
  .token-table .tok-line { display: block; color: var(--muted); font-size: 12px; line-height: 16px; }
  .token-table tr.total .tok-line { display: none; }
}

/* Now page */
.live-badge[data-live="on"] { color: var(--green); }
.live-badge[data-live="on"]::before { background: var(--green); }
.live-badge[data-live="wait"] { color: var(--amber); }
.live-badge[data-live="wait"]::before { background: var(--amber); }
.live-badge[data-live="off"] { color: var(--red); }
.live-badge[data-live="off"]::before { background: var(--red); }
.now-grid { display: grid; gap: 16px; align-items: start; }
.now-grid > .card { min-width: 0; }
.card-foot { margin-top: 12px; font-size: 12px; line-height: 16px; color: var(--muted); }
.empty-line { padding: 12px 0; color: var(--muted); font-size: 14px; line-height: 20px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.row-link { display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; gap: 4px 12px; min-height: 56px; padding: 8px 0; color: var(--text); text-decoration: none; }
a.row-link:hover .row-main { text-decoration: underline; }
.row-link .dot { grid-row: 1 / span 2; align-self: center; }
.row-main { font-size: 14px; line-height: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { grid-column: 2; font-size: 12px; line-height: 16px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-level="amber"] > .row-link .row-main { color: var(--amber); }
[data-level="red"] > .row-link .row-main { color: var(--red); }
.more > summary { display: flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--muted); cursor: pointer; }
.health-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.health-strip > li { display: grid; }
.health-strip a { display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; gap: 4px 8px; min-height: 56px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); text-decoration: none; }
.health-strip a:hover { border-color: var(--muted); }
.health-strip .dot { grid-row: 1 / span 2; }
.health-strip .row-sub { white-space: normal; }
.health-strip [data-level="amber"] .row-sub { color: var(--amber); }
.health-strip [data-level="red"] .row-sub { color: var(--red); }
.table-card-head { padding: 24px 24px 0; }
.table-card-foot { padding: 0 24px 24px; }
.table-card-head .card-head { margin-bottom: 0; }
.live-table .c-step { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.live-table .c-flags .chip + .chip { margin-left: 8px; }
.live-table tr.finished td { color: var(--muted); }
.data-table tr.flash td { background: var(--surface-2); }
.data-table td { transition: background-color 300ms; }
.live-pill { position: sticky; top: 8px; z-index: 2; display: block; margin: 0 auto 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; }

@media (min-width: 640px) {
  .health-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .live-table th:first-child, .live-table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; padding-left: 24px; }
  .live-table th:nth-last-child(2), .live-table td:nth-last-child(2) { padding-right: 24px; }
}
@media (min-width: 1024px) {
  .now-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); grid-template-areas: "health health" "needs live" "queues live"; gap: 24px; }
  .now-health { grid-area: health; }
  .now-needs { grid-area: needs; }
  .now-live { grid-area: live; }
  .now-queues { grid-area: queues; }
  .health-strip { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .table-card-head { padding: 16px 16px 0; }
  .table-card-foot { padding: 0 16px 16px; }
  .live-table td.c-flags:has(.chip) { display: flex; gap: 8px; grid-column: 1 / -1; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .data-table td { transition: none; }
}
@media print {
  .card-foot, .live-pill { display: none !important; }
}

/* Health page */
.health-grid { display: grid; gap: 16px; align-items: start; }
.health-nav { display: none; }
.health-cards { display: grid; gap: 16px; min-width: 0; }
.health-card { scroll-margin-top: 16px; }
.health-state { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 24px; font-weight: 600; margin-bottom: 4px; }
.health-state::before { display: none; }
.health-rule { color: var(--muted); font-size: 14px; line-height: 20px; margin-bottom: 12px; }
.health-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.health-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14px; }
.health-nav a:hover { background: var(--surface-2); }
@media (min-width: 1024px) {
  .health-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 24px; }
  .health-nav { display: block; position: sticky; top: 24px; padding: 12px; }
  .health-cards { gap: 24px; }
}

/* Agents page */
.agents-grid { display: grid; gap: 16px; align-items: start; }
.agents-grid > .card { min-width: 0; }
.agent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.agent-item { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 4px; }
.agent-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.agent-head .badge { margin-left: auto; }
.agent-name { font-weight: 600; font-size: 14px; line-height: 20px; }
.agent-head .muted { font-size: 12px; }
.agent-state { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; }
.agent-state::before { display: none; }
.card > .agent-state { margin-bottom: 12px; }
.agent-meta { color: var(--muted); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.agent-meta .run-link { color: var(--green); }
.agent-tokens { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12px; line-height: 16px; }
.agent-tokens li { display: flex; justify-content: space-between; gap: 12px; }
.person-row { grid-template-columns: minmax(0, 1fr) auto; }
.person-row .row-sub { grid-column: 1 / -1; }
.conns { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.conn { display: inline-flex; align-items: center; gap: 4px; }
@media (min-width: 1024px) {
  .agents-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "seats codex smith" "roles roles roles" "people people people"; gap: 24px; }
  .agents-seats { grid-area: seats; }
  .agents-codex { grid-area: codex; }
  .agents-smith { grid-area: smith; }
  .agents-roles { grid-area: roles; }
  .agents-people { grid-area: people; }
}

/* Trends page */
.periods { margin-left: auto; }
.chip.period { color: var(--muted); text-decoration: none; border: 1px solid var(--line); min-height: 32px; }
.chip.period::before { display: none; }
.chip.period[aria-current="true"] { color: var(--green); border-color: var(--green); }
.trend-kpis { margin-bottom: 16px; }
.trend-kpis .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.trends-grid { display: grid; gap: 16px; align-items: start; }
.trend-card { min-width: 0; display: grid; gap: 12px; }
.trend-card .section-label { margin-bottom: 0; }
svg.chart { display: block; width: 100%; height: auto; max-height: 240px; overflow: visible; }
svg.chart text { fill: var(--muted); font-family: var(--mono); font-size: 20px; }
svg.chart .axis, svg.chart .tick { stroke: var(--line); stroke-width: 2; }
svg.chart .tick { stroke: var(--text); }
.chart-table > summary { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--muted); cursor: pointer; }
.legend .swatch { width: 8px; height: 8px; flex: none; }
.trend-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.trend-table th, .trend-table td { padding: 8px 0 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.trend-table th:first-child { padding-left: 0; }
.trend-table thead th { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.trend-table thead th.n, .trend-table td.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend-table tbody th { font-weight: 400; overflow-wrap: anywhere; }
@media (min-width: 1024px) {
  .trend-kpis .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .trends-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .trend-kpis { margin-bottom: 24px; }
}
@media print {
  .periods, .chart-table > summary { display: none !important; }
}

/* Mode filter tabs and personal assistant setup */
.mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.mode-tab { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; min-height: 36px; padding: 0 12px; cursor: pointer; }
.mode-tab:hover { color: var(--text); border-color: var(--muted); }
.mode-tab.active { color: var(--green); border-color: var(--green); background: var(--surface-2); }
.personal-card { display: grid; gap: 12px; }
.personal-account-list { display: grid; gap: 12px; }
.personal-account-row { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: var(--bg); display: grid; gap: 8px; }
.badge.provider { color: var(--muted); border-color: var(--line); }
.badge.primary-badge { color: var(--green); border-color: var(--green); }
.delegates-list { display: grid; gap: 8px; margin-top: 8px; }

/* Security vulnerabilities page */
.security-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.security-banner { margin-bottom: 16px; border-color: var(--green); }
.security-banner p { margin: 0; font-size: 14px; line-height: 20px; }
.security-banner a { color: var(--green); font-family: var(--mono); }
.security-filter-card { display: grid; gap: 12px; margin-bottom: 16px; }
.security-filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.security-filter-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-width: 110px; }
.security-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.security-pill { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--muted); font-family: var(--mono); font-size: 12px; text-decoration: none; }
.security-pill:hover { color: var(--text); border-color: var(--muted); }
.security-pill.active { color: var(--green); border-color: var(--green); background: var(--surface-2); }
.security-list { display: grid; gap: 16px; }
.security-card { display: grid; gap: 12px; min-width: 0; }
.security-card-selected { border-color: var(--green); }
.security-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.security-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.security-project-tag { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
.security-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.security-create-issue { margin: 0; }
.security-create-issue button, .security-issue-link { min-height: 40px; font-size: 13px; padding: 8px 16px; text-decoration: none; display: inline-flex; align-items: center; }
.security-action-error { margin: 4px 0 0; font-size: 12px; }
.security-headline { margin: 0; font-size: 16px; font-weight: 600; line-height: 22px; overflow-wrap: anywhere; }
.security-location { margin: 0; font-size: 13px; color: var(--green); overflow-wrap: anywhere; }
.security-details { border-top: 1px solid var(--line); padding-top: 8px; }
.security-details > summary { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 12px; color: var(--green); cursor: pointer; }
.security-details-body { display: grid; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.security-detail-section h3 { margin: 0 0 4px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.security-detail-section p { margin: 0; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.security-meta-grid { margin: 0; display: grid; gap: 8px; font-size: 13px; }
.security-meta-row { display: grid; grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); gap: 8px 12px; align-items: baseline; }
.security-meta-row dt { color: var(--muted); }
.security-meta-row dd { margin: 0; overflow-wrap: anywhere; }
.security-fix-list { margin: 0; padding-left: 16px; display: grid; gap: 8px; font-size: 14px; line-height: 20px; }
@media (min-width: 1024px) {
  .security-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
  .security-filter-card { margin-bottom: 24px; }
}
@media (max-width: 639px) {
  .security-meta-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .security-card-actions, .security-create-issue, .security-create-issue button, .security-issue-link { width: 100%; justify-content: center; }
}
