/* The design of our admin and tool panels: each primitive fuses traits of GitHub Primer, IBM Carbon and Material
   Design. panel-design/README.md says what each takes from where; the sections below follow it. A panel loads
   this file, then its own stylesheet for what only it has. */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("IBMPlexSans-Light-Latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("IBMPlexSans-Regular-Latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("IBMPlexSans-Medium-Latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("IBMPlexSans-SemiBold-Latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("IBMPlexMono-Regular-Latin.woff2") format("woff2"); }

/* ── Colour: Primer's neutrals, Carbon's blue 60, Material's tonal container. Each token is light-dark(light, dark): it
   follows the browser's setting, or data-theme on <html> where a panel offers its own switch. ── */
:root {
  --bg: light-dark(#f6f8fa, #0d1117);
  --surface: light-dark(#ffffff, #151b23);
  --surface-2: light-dark(#f6f8fa, #1a2129);
  --field: light-dark(#eef1f4, #212830);
  --line: light-dark(#d1d9e0, #3d444d);
  --line-2: light-dark(#e6eaef, #2a313a);
  --rule: light-dark(#6e7781, #6e7681);
  --fg: light-dark(#1f2328, #f0f6fc);
  --muted: light-dark(#59636e, #9198a1);
  --accent: light-dark(#0f62fe, #4589ff);
  --accent-fill: #0f62fe;
  --accent-text: light-dark(#0043ce, #a6c8ff);
  --on-accent: #ffffff;
  --container: light-dark(#dbe4ff, #1c3a7a);
  --on-container: light-dark(#001a41, #dbe4ff);
  --button: light-dark(#f6f8fa, #212830);
  --ok: light-dark(#1a7f37, #3fb950);
  --ok-bg: light-dark(#dafbe1, #2ea04326);
  --attn: light-dark(#9a6700, #d29922);
  --attn-bg: light-dark(#fff8c5, #bb800926);
  --danger: light-dark(#cf222e, #f85149);
  --danger-fill: light-dark(#cf222e, #da3633);
  --danger-text: light-dark(#cf222e, #ff7b72);
  --danger-bg: light-dark(#ffebe9, #f8514926);
  --on-danger: #ffffff;
  --cyan: light-dark(#0b6e99, #56b8e6);
  --cyan-bg: light-dark(#def6ff, #56b8e626);
  --violet: light-dark(#8250df, #ab7df8);
  --violet-bg: light-dark(#fbefff, #ab7df826);
  /* Chart series: Carbon's categorical palette */
  --series-1: light-dark(#6929c4, #a56eff);
  --series-2: light-dark(#1192e8, #33b1ff);
  --series-3: light-dark(#005d5d, #08bdba);
  --series-4: light-dark(#9f1853, #ff7eb6);
  --series-5: #fa4d56;
  --tooltip: light-dark(#1f2328, #f0f6fc);
  --on-tooltip: light-dark(#ffffff, #1f2328);
  --scrim: light-dark(rgba(31, 35, 40, 0.45), rgba(1, 4, 9, 0.6));
  --drop: 0 1px 0 light-dark(rgba(31, 35, 40, 0.04), transparent);
  --overlay: 0 0 0 1px light-dark(#d1d9e0, #3d444d), 0 12px 28px light-dark(rgba(66, 74, 83, 0.18), #010409);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sprite { display: none; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* An app shell: the top bar and the rail stay put and each view scrolls only inside its own panels. */
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 14px/20px var(--sans);
  letter-spacing: 0.16px;
}
.shell { flex: 1; min-height: 0; display: flex; }
main { flex: 1; min-width: 0; min-height: 0; display: flex; }
.view { flex: 1; min-width: 0; min-height: 0; }
.column { display: flex; flex-direction: column; gap: 16px; padding: 24px 32px 16px; }
.scroll { overflow: auto; overscroll-behavior: contain; }
.grow { flex: 1; min-height: 0; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 32px 48px; }

/* ── Type: IBM Plex (Carbon) at Primer's compact sizes, levels named by Material's roles ── */
h1 { font-size: 24px; line-height: 32px; font-weight: 400; letter-spacing: 0; margin: 0 0 8px; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: 0; margin: 32px 0 12px; }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.mono, code { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.2px; }
.error { color: var(--danger); margin: 0; }
.error:empty { display: none; }
.status { min-height: 20px; margin: 0; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--danger); }
.bad { color: var(--danger); }

/* ── Top bar: Primer's white header and breadcrumb ── */
.top-bar { display: flex; align-items: center; gap: 12px; height: 48px; flex: none; padding: 0 16px 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { white-space: nowrap; }
.brand .slash { color: var(--muted); padding: 0 6px; }
.brand b { font-weight: 600; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-bar button { height: 28px; padding: 0 10px; font-size: 12px; }
.top-bar button.icon-button { width: 32px; height: 32px; padding: 0; }

/* ── Navigation: Material's rail item, Carbon's edge bar for where you are, Primer's white rail ── */
.rail { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 80px; flex: none; padding-top: 12px; overflow-y: auto; scrollbar-width: none; background: var(--surface); border-right: 1px solid var(--line); }
.rail button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  gap: 4px;
  width: 80px;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}
.rail button::after { display: none; }
.rail .indicator { display: flex; align-items: center; justify-content: center; width: 56px; height: 32px; border-radius: 16px; }
.rail .icon { width: 24px; height: 24px; }
.rail button:hover .indicator { background: color-mix(in srgb, var(--fg) 7%, transparent); }
.rail button[aria-current="page"] { color: var(--fg); font-weight: 600; }
.rail button[aria-current="page"] .indicator { background: var(--container); color: var(--on-container); }
.rail button[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 32px; background: var(--accent); }
.rail .icon.on, .rail button[aria-current="page"] .icon.off { display: none; }
.rail button[aria-current="page"] .icon.on { display: block; }
.rail button:focus-visible { outline: none; }
.rail button:focus-visible .indicator { outline: 2px solid var(--accent); outline-offset: 2px; }

.center { display: flex; align-items: center; justify-content: center; padding: 16px; }
.row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; justify-content: space-between; margin-bottom: 12px; }
.row-head h2 { margin: 0; }
.row-head .muted, .chart-note { font-size: 12px; line-height: 16px; }
.chart-note { margin: -4px 0 12px; max-width: 72ch; }

/* ── Number tile: Carbon's label on top and big light number, Primer's own bordered box ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0; }
.card .label { color: var(--muted); font-size: 12px; line-height: 16px; }
.card .value { font-size: 28px; line-height: 36px; font-weight: 300; letter-spacing: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card .value.ok { color: var(--ok); }
.card .value.bad { color: var(--danger); }
/* Many small facts: smaller tiles */
.cards.small { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.cards.small .card { min-height: 80px; padding: 8px 12px; }
.cards.small .value { font-size: 20px; line-height: 28px; font-weight: 400; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.split h3 { margin-top: 0; }
/* Panels: Primer's white box with a hairline border */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: auto; }
.panel.padded { padding: 16px; }
.panel.padded h3 { margin-top: 0; }

/* ── Table: Primer's box, muted header and hairlines; Carbon's 40 px rows and tabular numbers; Material's hover layer ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0 16px; vertical-align: middle; }
th { height: 36px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { height: 40px; padding-top: 6px; padding-bottom: 6px; }
tbody tr + tr td { border-top: 1px solid var(--line-2); }
table.dense td { height: 32px; padding-top: 4px; padding-bottom: 4px; }
table.sticky th { position: sticky; top: 0; z-index: 1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
th.shrink, td.shrink { width: 1%; white-space: nowrap; padding-right: 24px; }
td.empty { color: var(--muted); text-align: center; padding: 32px 16px; }
tbody tr:hover td { background: color-mix(in srgb, var(--fg) 4%, transparent); }
tbody tr:hover td.empty { background: none; }
/* A selected row: Material's tonal fill, Carbon's edge bar */
tbody tr.selected td { background: var(--container); color: var(--on-container); }
tbody tr.selected td:first-child { box-shadow: inset 3px 0 var(--accent); }

/* ── Button: Primer's 32 px and soft drop line; Carbon's label left with the icon at the far end; Material's state layer.
   Primary (no class) is Carbon blue; secondary is Primer grey; tonal is Material's container; ghost is a plain label. ── */
button, select, input { font: inherit; letter-spacing: inherit; color: var(--fg); }
button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
}
/* On a filled button the layer darkens, as Carbon's hover does, so white text keeps its contrast. */
button { --layer: #000000; }
button.secondary, button.tonal, button.ghost, button.danger:not(.solid), button.icon-button, button.chip, button.token-x { --layer: currentColor; }
button::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; background: var(--layer); opacity: 0; pointer-events: none; transition: opacity 110ms ease; }
button:hover:not(:disabled)::after { opacity: 0.08; }
button:active:not(:disabled)::after { opacity: 0.12; }
button .icon { width: 16px; height: 16px; }
/* A button that goes somewhere: its label on the left, the arrow at the far end. */
button.go { justify-content: space-between; gap: 24px; padding-right: 10px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: var(--button); border-color: var(--line); color: var(--fg); box-shadow: var(--drop); }
button.tonal { background: var(--container); color: var(--on-container); }
button.ghost { background: none; color: var(--accent); }
button.ghost:has(.icon:first-child) { padding-left: 8px; }
button.danger { background: var(--button); border-color: var(--line); color: var(--danger-text); box-shadow: var(--drop); }
button.danger:hover:not(:disabled), button.danger.solid { background: var(--danger-fill); border-color: transparent; color: var(--on-danger); }
button.danger:hover:not(:disabled)::after { opacity: 0; }
button.danger.solid:hover:not(:disabled)::after { opacity: 0.12; }
button.small { height: 24px; padding: 0 8px; font-size: 12px; }
button.icon-button { width: 32px; padding: 0; background: none; color: var(--muted); }
button.icon-button .icon { width: 20px; height: 20px; }
button.link { height: auto; padding: 0; border: 0; border-radius: 2px; background: none; color: var(--accent); font-weight: 400; }
button.link::after { display: none; }
button.link:hover { text-decoration: underline; }

/* ── Field: Material's filled anatomy (label inside, an active line), Carbon's flat fill and bottom rule, 48 px ── */
.field { position: relative; display: flex; flex-direction: column; width: 100%; min-width: 0; }
.field > span { position: absolute; top: 6px; left: 12px; right: 12px; color: var(--muted); font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.field input, .field select {
  width: 100%;
  height: 48px;
  min-width: 0;
  padding: 20px 12px 5px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 4px 4px 0 0;
  background-color: var(--field);
}
.field input:focus, .field select:focus { outline: none; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.field:focus-within > span { color: var(--accent); }
.field input:disabled, .field select:disabled { color: var(--muted); border-bottom-style: dashed; cursor: not-allowed; }
.field input::placeholder { color: var(--muted); }
/* Compact field: the same fill and rule at 32 px, its label beside it, for tables and toolbars */
:where(input:not([type="checkbox"], [type="radio"]), select):where(:not(.field *, .search-bar *)) {
  height: 32px;
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 4px 4px 0 0;
  background-color: var(--field);
  font-variant-numeric: tabular-nums;
}
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-fill); cursor: pointer; }
select {
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.field select { padding-right: 36px; background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%; }
select option { background: var(--surface); color: var(--fg); }
/* Search: Primer's bordered input with a leading icon, Carbon's inset focus ring */
.search-bar { display: flex; align-items: center; gap: 8px; flex: 1 1 240px; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); cursor: text; }
.search-bar .icon { width: 16px; height: 16px; }
.search-bar input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; outline: none; }
.search-bar input::placeholder { color: var(--muted); }
.search-bar:focus-within { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A field shows focus with its bottom line instead of the ring. */
:where(input:not([type="checkbox"], [type="radio"]), select):where(:not(.field *, .search-bar *)):focus { outline: none; border-bottom: 2px solid var(--accent); padding-bottom: 1px; }
:where(input):where(:not(.field *, .search-bar *)):invalid { border-bottom: 2px solid var(--danger); padding-bottom: 1px; }
/* Chrome lets the keyboard focus whole scrolling views and panels; a ring around a whole view says nothing. */
.view:focus-visible, .scroll:focus-visible { outline: none; }

.toolbar { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; }
.toolbar label:not(.field, .search-bar) { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.footnote { margin: 0; color: var(--muted); font-size: 12px; line-height: 16px; flex: none; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.stack > button { margin-top: 4px; }
/* An empty status or error line takes no room, but stays in place for screen readers. */
.stack > .status:empty { display: block; min-height: 0; margin-top: -12px; }
.stack > .notice { align-self: stretch; }
.stack p { margin: 0; }
.stack h3 { margin: 0; }

/* ── Notice: Carbon's inline notification (mark, text, a 3 px bar), Primer's rounded flash box, Material's tonal fill ── */
.notice { position: relative; padding: 8px 12px 8px 40px; border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); border-left: 3px solid var(--ok); border-radius: 6px; background: var(--ok-bg); color: var(--fg); }
.notice::before { content: ""; position: absolute; left: 12px; top: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--ok); }
.notice::after { content: ""; position: absolute; left: 19px; top: 12px; width: 5px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.notice.bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); border-left-color: var(--danger); background: var(--danger-bg); }
.notice.bad::before { background: var(--danger); }
.notice.bad::after { content: "!"; left: 12px; top: 8px; width: 20px; height: 20px; border: 0; transform: none; color: var(--surface); font-weight: 600; font-size: 13px; line-height: 20px; text-align: center; }

/* ── Filter chip: Material's chip with a check when on, Carbon's coloured dot (--dot), Primer's counter ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 28px; padding: 0 6px 0 10px; border-color: var(--line); background: var(--surface); color: var(--fg); font-size: 13px; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--muted)); flex: none; }
.chip .icon { display: none; margin: 0 -4px 0 -6px; }
.chip[aria-pressed="true"] { border-color: transparent; background: var(--container); color: var(--on-container); }
.chip[aria-pressed="true"] .icon { display: block; }
.chip .n { padding: 0 6px; border-radius: 2em; background: color-mix(in srgb, currentColor 12%, transparent); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; }
/* One filter value: the same chip, with a way out */
.token { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 2px 0 10px; border-radius: 4px; background: var(--container); color: var(--on-container); }
.token-x { width: 24px; height: 24px; padding: 0; background: none; color: inherit; }
.token-x .icon { width: 16px; height: 16px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; line-height: 16px; white-space: nowrap; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--attn); }
.status-dot.on::before { background: var(--ok); }

/* ── Label: Primer's 20 px pill with a border, Carbon's hue as a tint behind (--c, --cb), Material's label type ── */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid; border-radius: 2em; font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap;
  --c: var(--muted); --cb: var(--surface-2); color: var(--c); background: var(--cb); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.tag.info { --c: var(--accent-text); --cb: var(--container); }
.tag.ok { --c: var(--ok); --cb: var(--ok-bg); }
.tag.attn { --c: var(--attn); --cb: var(--attn-bg); }
.tag.bad { --c: var(--danger-text); --cb: var(--danger-bg); }
.tag.cyan { --c: var(--cyan); --cb: var(--cyan-bg); }
.tag.violet { --c: var(--violet); --cb: var(--violet-bg); }

/* ── List item: Material's two lines, Primer's bar on the open one, Carbon's mono ids and rules ── */
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.list li { position: relative; padding: 8px 12px; cursor: pointer; }
.list li + li { border-top: 1px solid var(--line-2); }
.list li:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.list li:focus-visible { outline-offset: -2px; }
.list li[aria-current="true"] { background: var(--container); color: var(--on-container); }
.list li[aria-current="true"]::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--accent); }
.list li:first-child { border-radius: 5px 5px 0 0; }
.list li:last-child { border-radius: 0 0 5px 5px; }
.list .primary { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .secondary-line { color: var(--muted); font-size: 12px; line-height: 16px; display: flex; gap: 0 10px; flex-wrap: wrap; margin-top: 2px; }
.list li[aria-current="true"] .secondary-line { color: var(--on-container); }
.list .empty { color: var(--muted); text-align: center; padding: 24px; cursor: default; }
.list .empty:hover { background: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; }
.pager .muted { font-size: 12px; line-height: 16px; }

/* ── JSON tree: Material's tree view, Primer's guide lines and one-line previews, values coloured by type ── */
.json { font-family: var(--mono); font-size: 12.5px; line-height: 20px; letter-spacing: 0; overflow-wrap: break-word; }
/* In a table a folded preview stays on one line; the panel scrolls sideways instead of squeezing the column. */
td .j-node:not([open]) > summary { white-space: nowrap; }
.j-row, .j-node > summary { padding-left: 18px; }
.j-node > summary { position: relative; list-style: none; cursor: pointer; border-radius: 4px; }
.j-node > summary::-webkit-details-marker { display: none; }
.j-node > summary::before { content: ""; position: absolute; left: 5px; top: 6px; border-style: solid; border-width: 4px 0 4px 7px; border-color: transparent transparent transparent var(--muted); transition: transform 0.1s; }
.j-node[open] > summary::before { transform: rotate(90deg); }
.j-node > summary:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.j-node > summary:focus-visible { outline-offset: 0; }
/* A taller line to tap on a touch screen */
@media (pointer: coarse) {
  .j-node > summary { padding-top: 6px; padding-bottom: 6px; }
  .j-node > summary::before { top: 12px; }
}
.j-children { margin-left: 8px; padding-left: 2px; border-left: 1px solid var(--line-2); }
.j-key { color: var(--accent); }
.j-string { color: var(--ok); }
.j-number { color: var(--violet); }
.j-boolean { color: var(--attn); }
.j-null, .j-punct, .j-preview, .j-count { color: var(--muted); }
.j-node[open] > summary > .j-preview, .j-node:not([open]) > summary > .j-count { display: none; }

/* ── Dialog: Material's layout (headline, text, actions on the right), Primer's rules, corners and shadow,
   Carbon's danger marks (a red bar and a red label) for what cannot be undone ── */
dialog.modal { width: min(540px, calc(100vw - 32px)); max-width: none; padding: 0; border: 0; border-radius: 8px; background: var(--surface); color: var(--fg); box-shadow: var(--overlay); }
dialog.modal[role="alertdialog"] { border-top: 3px solid var(--danger); }
dialog.modal::backdrop { background: var(--scrim); }
.modal-head { position: relative; padding: 16px 48px 12px 16px; border-bottom: 1px solid var(--line); }
.modal-label { margin: 0 0 2px; color: var(--muted); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
dialog.modal[role="alertdialog"] .modal-label { color: var(--danger); font-weight: 600; }
dialog.modal h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 500; }
.modal-head .icon-button { position: absolute; top: 8px; right: 8px; }
.modal-body { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: var(--muted); }
.modal-body p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 8px 8px; }

/* Tooltip: Primer's dark label; the panel places it */
.tooltip { z-index: 10; pointer-events: none; background: var(--tooltip); color: var(--on-tooltip); font-size: 12px; line-height: 16px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }

/* Medium windows */
@media (max-width: 839px) {
  .page { padding: 24px 24px 40px; }
  .column { padding: 16px 24px; }
  .split { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .card { min-height: 88px; }
  .card .value { font-size: 24px; line-height: 32px; }
  th, td { padding-left: 12px; padding-right: 12px; }
  th.shrink, td.shrink { padding-right: 12px; }
  /* Room inside the scroller for the focus ring */
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px; }
  .chip { flex: none; }
}

/* Compact windows: the rail becomes a navigation bar at the bottom. */
@media (max-width: 599px) {
  .top-bar { padding-left: 16px; }
  .who { display: none; }
  .shell { flex-direction: column-reverse; }
  .rail { flex-direction: row; align-items: stretch; gap: 0; width: auto; height: 72px; padding: 8px 0 12px; overflow: auto hidden; border-right: 0; border-top: 1px solid var(--line); }
  /* Five fill the bar; with more, each keeps 72 px and the next one shows at the edge, so the bar reads as scrollable. */
  .rail button { flex: 1 0 72px; width: auto; }
  .rail .indicator { width: 64px; }
  .rail button[aria-current="page"]::before { left: 0; right: 0; top: -8px; width: auto; height: 3px; }
  .page { padding: 16px 16px 32px; }
  .column { padding: 16px; }
}
