/* Monochrome, with one amber tone for warnings only. Gray steps and weight show what matters, not color. */
/* Inter for Windows and Linux, whose system fonts have no 500 or 600 weight. macOS keeps SF Pro, so it never loads the file.
   Inter Variable 5.3.0, Latin only, SIL OFL 1.1: fonts/Inter-LICENSE.txt. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght.woff2") format("woff2-variations"), url("fonts/inter-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --side: #f7f7f7;
  --surface: #f4f4f4;
  /* Hover and pressed fills are see-through, so they show the same on the page, the sidebar, and a card. */
  --hover: rgb(0 0 0 / 0.07);
  --active: rgb(0 0 0 / 0.11);
  /* A keyboard selection fill with 3:1 against the page, the side bar, and the rows next to it (WCAG 1.4.11). */
  --selected: #8c8c8c;
  --text: #0d0d0d;
  --muted: #595959;
  /* Faint text, such as code line numbers, still needs 4.5:1 (WCAG 1.4.3). */
  --faint: #656565;
  --border: #e6e6e6;
  --strong-border: #cfcfcf;
  /* Inputs need a 3:1 edge against the page (WCAG 1.4.11). */
  --control-border: #8a8a8a;
  --focus: #0d0d0d;
  --scroll-thumb: #858585;
  --invert-bg: #0d0d0d;
  --invert-text: #ffffff;
  --warn: #8a5a00;
  --warn-bg: #fbf3e0;
  --radius: 12px;
  --status-height: 26px;
  --sidebar-width: 220px;
  --inspector-width: 360px;
  --sans: -apple-system, BlinkMacSystemFont, "Inter Variable", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --side: #111111;
    --surface: #161616;
    --hover: rgb(255 255 255 / 0.09);
    --active: rgb(255 255 255 / 0.14);
    --selected: #626262;
    --text: #f2f2f2;
    --muted: #a3a3a3;
    --faint: #909090;
    --border: #222222;
    --strong-border: #3a3a3a;
    --control-border: #6e6e6e;
    --focus: #f2f2f2;
    --scroll-thumb: #666666;
    --invert-bg: #f2f2f2;
    --invert-text: #0a0a0a;
    --warn: #e8b85c;
    --warn-bg: #2a2214;
  }
}

* { box-sizing: border-box; }

/* A display rule on a class must not show an element that the page hides. */
[hidden] { display: none !important; }

/* The page itself never scrolls. Only main scrolls, as in VS Code. */
/* clip, not hidden: a focus move or scrollIntoView can scroll a hidden box, which would shift the status bar off screen. */
html, body { height: 100%; overflow: clip; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, select {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--strong-border);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}
/* Every button fills on hover. :where keeps this rule weaker than any class, so a button with its own look keeps it. */
:where(button, select):where(:not(:disabled, [aria-disabled="true"])):hover { border-color: var(--control-border); background: var(--hover); }

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

/* Buttons and fields are at least 24 by 24 pixels (WCAG 2.5.8). */
button, select, a.button { min-height: 28px; }

input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }

/* Text for screen readers only. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* The first Tab stop: it moves the focus past the sidebar to the page. */
.skip { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--invert-bg); color: var(--invert-text); border: 0; padding: 6px 12px; transform: translateY(-200%); }
.skip:focus-visible { transform: none; }

/* A heading that gets the focus after a page change shows no ring. Tab still starts from it. */
[tabindex="-1"]:focus { outline: none; }

.muted { color: var(--muted); }

.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Shell: sidebar, main, and inspector. The status bar sits at the foot of the main column. */

.app { flex: 1; min-height: 0; display: flex; overflow: clip; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 14px 10px;
  background: var(--side);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

/* Thin scrollbars everywhere. The thumb keeps 3:1 against the panel (WCAG 1.4.11), as in T3 Code. */
.sidebar, .inspector, main, .explorer-tree, .explorer-view, .palette ul { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
}
.brand:hover { background: var(--hover); }
.brand::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--invert-bg);
}

.side-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }

.nav { display: grid; gap: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
}
.nav-item:hover { color: var(--text); background: var(--hover); }
/* A grip shows on hover or focus, so each area says that it can move. The whole area drags. */
.nav-grip { margin-left: auto; display: inline-grid; place-items: center; color: var(--faint); opacity: 0; cursor: grab; }
.nav-grip .icon { stroke-width: 3; }
.nav-item:hover .nav-grip, .nav-item:focus-visible .nav-grip, .nav-item.dragging .nav-grip { opacity: 1; }
/* While a drag runs, the other areas slide to make room, and the dragged area rides above them. */
.nav.sorting { user-select: none; }
.nav.sorting, .nav.sorting * { cursor: grabbing; }
.nav.sorting .nav-item:not(.dragging):hover { background: none; color: var(--muted); }
.nav.sorting .nav-item:not(.dragging) { transition: transform 150ms ease-out; }
.nav-item.dragging { position: relative; z-index: 1; color: var(--text); background: var(--bg); box-shadow: 0 0 0 1px var(--border), 0 6px 16px rgb(0 0 0 / 0.18); }
@media (prefers-reduced-motion: reduce) { .nav.sorting .nav-item:not(.dragging) { transition: none; } }
/* A bar at the start marks the selection. The fill alone is under 3:1 against the sidebar (WCAG 1.4.11). */
.nav-item.active { color: var(--text); background: var(--active); font-weight: 600; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

main { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: 32px 40px 48px; container: main / inline-size; }

/* A narrow window keeps the sidebar and scrolls main sideways, so the content never gets too narrow to read. */
.crumbs, #view { max-width: 1040px; margin-inline: auto; }

.crumbs { color: var(--muted); margin-bottom: 16px; font-size: 13px; }
/* Each crumb is at least 24px high, so it is easy to hit (WCAG 2.5.8). */
.crumbs a { display: inline-block; padding-block: 4px; text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs > * + *::before { content: "/"; margin: 0 8px; color: var(--faint); }

.statusbar {
  height: var(--status-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.status-item { min-height: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; height: 100%; border: 0; border-radius: 0; background: none; font-size: 12px; color: inherit; }
.status-item.warning { color: var(--warn); }
@media (prefers-reduced-motion: no-preference) {
  .status-item.busy .icon { animation: spin 1s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-item .icon { width: 13px; height: 13px; }
.status-item:hover { color: var(--text); background: var(--hover); }
/* Check sits at the right end of the bar. */
.status-item.end { margin-left: auto; flex-shrink: 0; }

/* Type */

h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
/* Three text levels, as in T3 Code: section titles 16/600, rows 14, notes 12 or 13 muted. Sentence case, no capitals. */
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); margin: 32px 0 10px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
h4 { font-size: 13px; font-weight: 600; color: var(--text); margin: 20px 0 6px; }

.meta { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
/* An empty search count takes no space. It stays in the page, so the status role keeps working. */
.search-count:empty { margin: 0; }
.small-text { font-size: 13px; margin: -6px 0 12px; }
.small-text.gap { margin-top: 14px; }
.warn { color: var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: 8px; }

/* Welcome */

/* Welcome keeps the left edge of the other areas, so the title does not move between pages. */
.welcome { margin: 24px 0 0; }
.hero { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; margin: 0; }
.lead { font-size: 16px; margin: 6px 0 40px; max-width: 560px; }
.welcome-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 24px 56px; }
.welcome h2 { margin: 0 0 10px; }
.welcome section > h2 ~ h2 { margin-top: 32px; }

.actions { display: grid; gap: 1px; }
.action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin-left: -10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-decoration: none;
  text-align: left;
}
.action .icon { color: var(--muted); }
.action:hover { background: var(--hover); }

.fit { list-style: none; margin: 0; padding: 0; display: grid; }
.fit li { display: grid; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.fit li b { font-weight: 600; }
.fit li span { font-size: 13px; }
.fit .step { display: block; background: none; border: 0; padding: 4px 14px; font: 12px var(--mono); color: var(--muted); }
.fit .step::before { content: "↓  "; color: var(--faint); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.welcome > .stats { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); margin-bottom: 32px; }
.stat { display: grid; align-content: start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.stat b { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.stat span { font-size: 13px; overflow-wrap: anywhere; }

/* Cards, chips, rows */

.card {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  text-align: left;
  transition: border-color 120ms, background-color 120ms;
}
.card p { margin: 0; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title .icon { flex: none; color: var(--muted); }
a.card:hover .card-title .icon, button.card:hover .card-title .icon { color: var(--text); }
a.card:hover, button.card:hover { border-color: var(--strong-border); background: var(--hover); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* min() lets a card shrink in a narrow window, so the page never scrolls sideways (WCAG 1.4.10). */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 10px; margin-top: 16px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); margin-bottom: 12px; }

.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
/* A filled badge means one thing: something needs you. A good state is outlined, so it does not pull the eye. */
.badge.accent { color: var(--invert-text); background: var(--invert-bg); border-color: transparent; }
/* A dot, not a button edge: a state must not look like a control. */
.badge.on { color: var(--text); }
.badge.on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.badge.warning { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
/* The muted .row span:last-child colour must not reach an accent badge, or its text fails 4.5:1. */
.row .badge.accent { color: var(--invert-text); }
.row .badge.on { color: var(--text); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 6px 8px 6px 12px; border-radius: 8px; font: 13px var(--mono); }
.chip .badge { font-family: var(--sans); }

.rows { display: grid; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rows .row { border: 0; border-radius: 0; background: none; }
.rows .row + .row { border-top: 1px solid var(--border); }
/* The list clips what is outside it, so the focus ring goes inside the row. */
.rows .row:focus-visible { outline-offset: -2px; }
a.row { text-decoration: none; }
a.row:hover, button.row:not([aria-disabled="true"]):hover { background: var(--hover); }
.row.mcp-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(var(--agents, 2), minmax(0, 1fr)); align-items: center; }
.row.mcp-row.head span { color: var(--muted); font: inherit; font-size: 12px; }
/* Cells wrap, so a badge and its button stay whole at 200% zoom (WCAG 1.4.4). */
.row.mcp-row > span { overflow-wrap: anywhere; white-space: normal; max-width: none; color: inherit; }
.row.mcp-row > span:first-child { font: 14px/1.4 var(--sans); }
.row .mcp-cell { flex-wrap: wrap; }
.mcp-cell .small-text { margin: 0; }
.mcp-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* The .row span rules are for plain rows. A badge in a cell keeps its own look. */
.row .mcp-cell > .badge { font-family: inherit; max-width: none; }
.row .mcp-cell > .badge.warning { color: var(--warn); }
button.small { min-height: 24px; padding: 2px 8px; font-size: 12px; }
/* A rare or risky action on a long list: no edge until hover or focus, so the rows that need action stand out. */
button.quiet { border-color: transparent; background: none; color: var(--muted); }
button.quiet:hover, button.quiet:focus-visible { border-color: var(--control-border); color: var(--text); background: var(--hover); }
.row .mcp-cell > .badge.on, .row .mcp-cell > .badge.muted { border-color: transparent; padding-inline: 0; }
.mcp-row .prefix { color: var(--muted); }
/* A switch per agent: on fills the track, and the knob moves, so the state does not rest on colour (WCAG 1.4.1). */
button.switch { position: relative; flex: none; width: 30px; min-width: 30px; height: 18px; min-height: 18px; padding: 0; border-radius: 9px; border: 1px solid var(--strong-border); background: var(--surface); }
button.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
button.switch[aria-checked="true"] { background: var(--text); border-color: var(--text); }
button.switch:hover:not([aria-checked="true"]) { border-color: var(--control-border); }
button.switch[aria-checked="true"]::after { transform: translateX(12px); background: var(--bg); }
button.switch[aria-disabled="true"] { opacity: 0.5; cursor: progress; }
@media (prefers-reduced-motion: no-preference) { button.switch::after { transition: transform 0.15s; } }
.row.stack-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) 130px; align-items: center; }
.row.stack-row > span:nth-child(2) { overflow-wrap: anywhere; font: 12px var(--mono); }
.row.stack-row > span.inline-badges { margin: 0; justify-content: flex-end; max-width: none; overflow: visible; }
.stack-row .inline-badges .badge { font-family: var(--sans); font-size: 12px; max-width: none; }
.stack-row .inline-badges .badge.warning { color: var(--warn); }
.row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; text-align: left; }
.row > span:first-child { font-family: var(--mono); font-size: 13px; }
.row.skill-row .usage-name { font-size: 14px; font-weight: 500; }
/* The last cell wraps and never clips, so no text is lost at 200% zoom or with wider text spacing (WCAG 1.4.4, 1.4.12). */
.row span:last-child { overflow-wrap: anywhere; max-width: 60%; color: var(--muted); }
.row.mcp-row span { max-width: none; color: inherit; }
.row.mcp-row .badge { white-space: nowrap; }
.row.mcp-row .muted, .row.mcp-row .prefix { color: var(--muted); }

.field { display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 1fr); gap: 12px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.field span:last-child { overflow-wrap: anywhere; }

pre {
  font: 12px/1.6 var(--mono);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.problems { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.problems li { display: grid; gap: 2px; padding: 8px 10px; background: var(--warn-bg); border-radius: 8px; }
.problems code { font: 12px var(--mono); color: var(--warn); overflow-wrap: anywhere; }

.files, .outline { margin: 0; padding-left: 18px; font-size: 13px; }
.files { font-family: var(--mono); font-size: 12px; }
.outline .h2 { margin-left: 12px; }
.outline .h3 { margin-left: 24px; color: var(--muted); }


/* Buttons and links that look like buttons */

a.button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--strong-border); border-radius: 8px; background: var(--surface); text-decoration: none; }
a.button:hover { border-color: var(--control-border); background: var(--hover); }
button .icon, a.button .icon { width: 14px; height: 14px; vertical-align: -2px; }
/* :where keeps this weaker than any class, so an icon-only button keeps its own centered grid. */
:where(button:has(.icon):not(.card)) { display: inline-flex; align-items: center; gap: 6px; }
button.primary, a.button.primary { background: var(--invert-bg); color: var(--invert-text); border-color: transparent; }
button.primary:hover, a.button.primary:hover { background: color-mix(in srgb, var(--invert-bg) 82%, var(--bg)); }
button:disabled, button[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
select:disabled { cursor: not-allowed; }
/* A press shows at once, as in T3 Code. One short step, not a loop. */
@media (prefers-reduced-motion: no-preference) {
  button, a.button, a.chip, a.card { transition: transform 80ms, border-color 120ms, background-color 120ms; }
  /* Go to rows have no fade, so the keyboard highlight moves at once and two rows never show a fill. */
  a.row, .nav-item, .tab, .action { transition: background-color 120ms, color 120ms; }
  a.row:active, .nav-item:active, .tab:active { background: var(--active); }
  button:active:not(:disabled):not([aria-disabled="true"]), a.button:active, a.chip:active { transform: scale(0.97); }
  a.card:active, button.card:active { transform: scale(0.99); }
}
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button-row.gap { margin-top: 16px; }

.chip.static { cursor: default; padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); }
.chips.inline { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.inline { display: block; margin: 0; }

/* Manage */

.stats.wide { margin-top: 20px; }
/* Each wide stats row has four cards, so it shows two or four to a row and never leaves one alone. */
@container main (min-width: 860px) { .stats.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.actions .action { flex-wrap: wrap; }
.actions .action .inline { flex-basis: 100%; padding-left: 26px; margin-top: -2px; }
.usage-row { display: grid; grid-template-columns: minmax(120px, 1fr) 100px 2fr 48px; align-items: center; }
.usage-row span:last-child { text-align: right; max-width: none; }
.bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.usage-name { overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; margin: 16px 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.tab { padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.tab:hover { color: var(--text); background: var(--hover); }
.tab.active { color: var(--text); background: var(--active); font-weight: 600; }
.chips.filter { margin: 16px 0 4px; }
a.chip { padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-family: inherit; }
a.chip:hover { border-color: var(--strong-border); background: var(--hover); }
a.chip.active { background: var(--active); color: var(--text); border-color: var(--strong-border); font-weight: 600; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.key:first-child { margin-left: 0; }
.form.setup { max-width: 520px; }
.kinds { border: 0; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.kinds legend { padding: 0; margin-bottom: 8px; font-weight: 600; }
.form label.kind { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.form label.kind:has(input:checked) { border-color: var(--control-border); background: var(--surface); }
.kind input { margin: 2px 0 0; }
.kind > span { display: grid; gap: 2px; }

/* Hosted */

.steps { list-style: none; counter-reset: step; margin: 24px 0 0; padding: 0; display: grid; gap: 22px; }
.steps > li { counter-increment: step; position: relative; padding-left: 40px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--invert-bg); color: var(--invert-text); font-size: 13px; font-weight: 600; }
.steps h3 { margin-top: 2px; }
.steps p { margin: 0 0 10px; }
.installers { display: grid; gap: 10px; }
.installers h4 { margin: 4px 0 4px; }
.command { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.command code { font: 12px var(--mono); overflow-wrap: anywhere; }
.change-row { display: grid; grid-template-columns: 100px 1fr; text-decoration: none; }
.change-row span:last-child { white-space: normal; max-width: none; color: var(--text); }

/* Inspector: a second side bar, as in VS Code. */

.inspector {
  width: var(--inspector-width);
  flex-shrink: 0;
  background: var(--side);
  border-left: 1px solid var(--border);
  padding: 14px 20px 24px;
  overflow-y: auto;
}

.inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 -8px 12px 0;
}
.inspector-head h2 { margin: 0; font: 600 16px/1.3 var(--sans); letter-spacing: -0.01em; text-transform: none; color: var(--text); }

.form { display: grid; gap: 10px; max-width: 36rem; }
.form label { display: grid; gap: 4px; font-size: 13px; }
.form input { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--control-border); border-radius: 8px; padding: 6px 10px; }

.form button { justify-self: start; }

.icon-button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); }
.icon-button:hover { color: var(--text); background: var(--hover); }

/* A drag handle on a panel edge. It takes no room, and a wider hit area sits over the border. */
.resizer { position: relative; flex: 0 0 0; z-index: 11; }
.resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: -3px; width: 6px; cursor: col-resize; transition: background-color 120ms 200ms; }
.resizer:hover::after, .resizer.dragging::after { background: var(--strong-border); }
.resizer:focus-visible::after { background: var(--focus); }
.resizer:focus-visible { outline: none; }
.resizer:has(+ .inspector[hidden]) { display: none; }
body.resizing { cursor: col-resize; user-select: none; }

/* A narrow window has no room for a third column, so the inspector floats over the main area. */
@media (max-width: 1100px) {
  .inspector { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10; box-shadow: -12px 0 32px rgb(0 0 0 / 0.18); }
  .resizer[data-resize="inspector"] { position: fixed; top: 0; bottom: 0; right: var(--inspector-width); }
}

/* Providers: companies on the left, the chosen company on the right. */
.split { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.split.gap { margin-top: 16px; }
.rows + .button-row { margin-top: 12px; }
.split-list { margin-top: 0; }
.split-list .row { align-items: center; text-decoration: none; color: inherit; }
.split-list .row span:first-child { font-family: inherit; font-size: 14px; min-width: 0; }
.split-list .row .badge { white-space: nowrap; }
.split-list .row .badge { max-width: none; }
.split-list .row.active { background: var(--active); font-weight: 600; }
.split-detail h2 { margin: 0; }
/* Tools: the group of servers outside the stack, and one row per agent in the chosen tool. */
.split-list .row.group-head { font-size: 12px; color: var(--muted); padding-block: 6px; }
.split-list .row.group-head span:first-child { font-size: 12px; }
.split-detail .section-head h2 { margin: 0; }
.tool-server h3 { margin: 16px 0 0; font-size: 14px; font-weight: 500; }
.tool-server .rows { margin-top: 8px; }
.row.agent-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; }
.row.agent-row > span:first-child { font: 14px/1.4 var(--sans); }
.row.agent-row span { max-width: none; color: inherit; }
.row.agent-row .muted, .row.agent-row .prefix { color: var(--muted); }
.row.agent-row .badge { white-space: nowrap; }
.row.plugin-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.row.plugin-row > span:first-child { font: 14px/1.4 var(--sans); }
.row.plugin-row span { max-width: none; color: inherit; }
.row.plugin-row.head span, .row.plugin-row .muted { color: var(--muted); }
.row.plugin-row.head span { font: inherit; font-size: 12px; }
.plugin-cell { display: flex; align-items: center; min-width: 0; }
.raw-json { margin-top: 32px; }
.product-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.product { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-top: 12px; }
.product h3 { margin: 0; }
.product.missing { border-style: dashed; color: var(--muted); }
/* main is the container, so the list stacks when main is narrow, whatever the width of the sidebar and the window. */
/* Stacked, the company list turns into a grid of small tiles, so the chosen company starts near the top. */
@container main (max-width: 760px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-list.rows { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 6px; border: 0; border-radius: 0; overflow: visible; }
  .split-list.rows .row, .split-list.rows .row + .row { border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; gap: 8px; }
  .split-list.rows .row.active { border-color: var(--strong-border); }
}
/* On a phone the tiles go two to a row with the state under the name, so the chosen company's actions start higher. */
@container main (max-width: 480px) {
  .split-list.rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-list.rows .row, .split-list.rows .row + .row { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* Manage pages that edit the stack. */
.editor { margin: 12px 0 20px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.editor-head code { font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.code-edit { width: 100%; box-sizing: border-box; font: 12.5px/1.5 var(--mono); color: inherit; background: var(--surface); border: 1px solid var(--control-border); border-radius: 8px; padding: 10px 12px; resize: vertical; tab-size: 2; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 8px 0; }
.checks label, .form label.inline { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; }
/* The chevron says that each row opens the skill. */
.row.skill-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 12px; align-items: center; gap: 12px; min-height: 40px; }
.skill-text { display: grid; gap: 2px; min-width: 0; }
.row .skill-text .skill-about { font: 13px/1.45 var(--sans); color: var(--muted); max-width: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 28px 0 8px; }
.group-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.group-head .group-link { margin-left: auto; display: inline-flex; align-items: center; min-height: 24px; font-size: 13px; }
.row.skill-row::after { content: "›"; color: var(--muted); font-size: 16px; line-height: 1; }
.row .badges > .badge { max-width: none; }
.row.skill-row > span.badges { max-width: none; overflow: visible; white-space: normal; margin: 0; justify-content: flex-end; flex-wrap: wrap; color: inherit; }
.row.hook-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; gap: 12px; }
.row.hook-row > * { min-width: 0; overflow-wrap: anywhere; max-width: none; white-space: normal; }
.hook-row code { font: 12px var(--mono); overflow-wrap: anywhere; }
.row.hook-row.head span { color: var(--muted); font-size: 12px; }
.row.hook-row > span:last-child { max-width: none; }
.hook-row code { white-space: inherit; }
@media (max-width: 720px) {
  /* The head row is hidden on a narrow screen, so each value shows its column name. */
  .row.hook-row > [data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
}
.name-field { display: grid; gap: 4px; }
.name-field .meta { margin: 0; }
.search { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--control-border); border-radius: 8px; padding: 6px 10px; min-width: 240px; }
.form select { font: inherit; border-color: var(--control-border); }
.confirm { margin: 8px 0; padding: 12px; border: 1px solid var(--warn); border-radius: 8px; background: var(--warn-bg); }
button.danger { color: var(--warn); border-color: var(--warn); }
.apply { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Workspaces and the agent setup explorer. */
.workspace-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0 8px; }
.workspace-head h3 { margin: 0; font: 14px var(--mono); min-width: 0; overflow-wrap: anywhere; }
.workspace-head button { margin-left: auto; }
.form.inline-form { margin-top: 20px; max-width: 480px; }
.form textarea { font: 13px var(--mono); color: inherit; background: var(--bg); border: 1px solid var(--control-border); border-radius: 8px; padding: 6px 10px; resize: vertical; }
.explorer { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); height: 560px; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.explorer-tree { overflow: auto; padding: 6px 0; background: var(--side); border-right: 1px solid var(--border); font-size: 13px; }
.explorer-tree details > summary { list-style: none; cursor: pointer; }
.explorer-tree details > summary::-webkit-details-marker { display: none; }
.tree-item { min-height: 26px; display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 8px; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-item:hover { background: var(--hover); }
.tree-item.active { background: var(--selected); color: var(--text); font-weight: 600; }
.tree-item .icon { flex: none; width: 14px; height: 14px; }
.tree-item .tree-chevron { width: 12px; height: 12px; color: var(--muted); transition: transform 120ms; }
.explorer-tree details[open] > summary .tree-chevron { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .tree-item .tree-chevron { transition: none; } }
.explorer-view { overflow: auto; min-width: 0; }
.explorer-path { position: sticky; top: 0; padding: 6px 12px; font: 12px var(--mono); color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--border); }
.explorer-path { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; z-index: 1; }
/* A long path wraps, so a narrow window does not scroll sideways (WCAG 1.4.10). */
.explorer-path > span:first-child, .explorer-path:not(:has(> span)) { min-width: 0; overflow-wrap: anywhere; }
.explorer-path .button-row { margin: 0; }
.tree-reading { margin: 4px 0; padding: 0 8px; }
.explorer-path button { min-height: 26px; padding-block: 2px; }
.explorer-note { padding: 8px 12px; margin: 0; }
.explorer-view .confirm, .explorer-view > p.small-text:not(:empty) { margin: 8px 12px; }
.explorer-edit { display: block; width: 100%; box-sizing: border-box; min-height: 420px; border: 0; border-radius: 0; padding: 12px; resize: none; background: var(--bg); font: 12.5px/1.5 var(--mono); }
.explorer-edit:focus-visible { outline-offset: -2px; }
.explorer-new { padding: 12px; max-width: 440px; }
.tree-new { color: var(--muted); }
.explorer-text { margin: 0; padding: 12px; border: 0; border-radius: 0; background: none; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Go to: the button in the sidebar, and the list that Cmd+K opens. */
.goto { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px 4px 10px; color: var(--muted); background: var(--bg); border-color: var(--control-border); text-align: left; }
.goto:hover { color: var(--text); background: var(--hover); }
.goto-label { flex: 1; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--muted); }
.palette { width: min(560px, calc(100vw - 32px)); max-height: min(480px, calc(100vh - 96px)); margin: 12vh auto auto; padding: 0; color: inherit; background: var(--bg); border: 1px solid var(--strong-border); border-radius: var(--radius); box-shadow: 0 24px 64px rgb(0 0 0 / 0.28); }
.palette[open] { display: flex; flex-direction: column; }
.palette::backdrop { background: rgb(0 0 0 / 0.32); }
.palette input { font: 15px/1.4 var(--sans); color: inherit; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 14px 16px; outline: none; }
/* The field keeps a visible focus line, also when no row matches (WCAG 2.4.7). */
.nav-toggle { display: none; }
.palette input:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.palette ul { list-style: none; margin: 0; padding: 6px; overflow-y: auto; min-height: 0; }
.palette-option { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.palette-option .muted { font-size: 12px; }
.palette-option[aria-selected="true"] { background: var(--selected); font-weight: 600; }
.palette-option[aria-selected="true"] .muted { color: inherit; }
@media (forced-colors: active) { .palette-option[aria-selected="true"] { outline: 2px solid Highlight; } }
.palette-empty { padding: 10px; }
.palette-help { margin: 0; padding: 8px 16px; font-size: 12px; border-top: 1px solid var(--border); }

/* The note after a save: at the bottom right, over the page. Empty, it takes no room. */
.toast { position: fixed; right: 16px; bottom: calc(var(--status-height) + 12px); z-index: 40; max-width: min(420px, calc(100vw - 32px)); margin: 0; padding: 8px 14px; font-size: 13px; color: var(--invert-text); background: var(--invert-bg); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.2); }
.toast:empty { padding: 0; box-shadow: none; }
/* In a modal the note is a line in the flow, so it covers no control. */
dialog > .toast { position: static; max-width: none; margin: 8px 16px 0; box-shadow: none; }
/* An empty note keeps its place in the accessibility tree, so its first message is heard. It takes no space. */
dialog > .toast:empty { height: 0; margin: 0; padding: 0; overflow: hidden; }

/* A narrow window, such as 320 pixels wide or a 400% zoom: one column, and nothing scrolls sideways (WCAG 1.4.10). */
@media (max-width: 720px) {
  /* The areas lie in a row here, so the bar of the current area moves to its bottom edge, as on a tab. */
  .app { flex-direction: column; }
  /* The areas hide behind the Pages button. Open, they show as one column under the bar. */
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  /* The Pages label gives way first, so the update button keeps its place in the top row in every run state. */
  .nav-toggle { display: inline-block; margin-left: auto; flex: 1 1 0; min-width: 3rem; max-width: max-content; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .sidebar > .side-foot { flex: 0 0 auto; }
  .sidebar:not(.open) .nav { display: none; }
  .sidebar.open .nav { flex-basis: 100%; max-height: 60vh; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
  .nav-grip { display: none; }
  .resizer { display: none; }
  .workspace { min-height: 0; }
  main { padding: 20px 16px 32px; }
  .crumbs, #view { min-width: 0; }
  .inspector { position: fixed; inset: 0; width: auto; z-index: 10; }
  .row.skill-row, .row.hook-row, .row.stack-row, .usage-row, .row.mcp-row, .change-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .row.mcp-row:not(.head) > .mcp-cell::before { content: attr(data-agent) ":"; color: var(--muted); font-size: 12px; }
  /* Hidden on screen only, so the table keeps its column headers for a screen reader. */
  .row.hook-row.head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .row.mcp-row.head > span:not(:first-child) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .row.stack-row > span.inline-badges { justify-content: flex-start; }
  /* A skill row keeps its badges on the name line, and the description goes under both. */
  .row.skill-row { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
  .row.skill-row .skill-text { display: contents; }
  /* The owner and its link share the first line. The count and the load rule go under them. */
  .group-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .group-head .group-link { grid-column: 2; grid-row: 1; }
  .group-head > span { grid-column: 1 / -1; }
  .row.skill-row .skill-about { grid-column: 1 / -1; grid-row: 2; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .row.skill-row::after { display: none; }
  .row span:last-child { max-width: none; }
  .explorer { grid-template-columns: minmax(0, 1fr); grid-template-rows: 200px minmax(0, 1fr); }
  .explorer-tree { border-right: 0; border-bottom: 1px solid var(--border); }
  .search { min-width: 0; flex: 1; }
  .goto { width: auto; flex: none; }
  .goto-label, .goto kbd { display: none; }
  .hero { font-size: 30px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  /* Four short counts stay two to a row on a phone, so the data starts higher. */
  .stats.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* No moves or fades for a reader who turns motion off. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Windows high contrast: the active item gets an edge, since a fill color is lost. */
@media (forced-colors: active) {
  .nav-item.active, .tab.active, a.chip.active, .tree-item.active, .split-list .row.active { outline: 2px solid CanvasText; outline-offset: -2px; }
  /* The current item has an inner line, so the keyboard focus needs a look of its own (WCAG 2.4.7). */
  :focus-visible { outline: 3px solid Highlight !important; outline-offset: 2px !important; }
  /* A list box clips what is outside it, so a ring in a list sits inside its row. */
  .rows :focus-visible { outline-offset: -3px !important; }
  .badge, .card, .chip { border: 1px solid CanvasText; }
  .bar > span { forced-color-adjust: none; }
}
.row.acp-row, .row.update-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.row.acp-row p, .row.update-row p { margin: 2px 0 0; max-width: none; white-space: normal; }
.limit { display: grid; gap: 4px; margin: 8px 0; }
/* An idle window dims only its bar. Dim text fails the 4.5:1 contrast rule (WCAG 1.4.3). */
.limit.muted .bar > span { opacity: 0.6; }
.resets h4 { font-size: 13px; font-weight: 600; margin: 8px 0 4px; }
.resets ul { margin: 0 0 8px; padding-left: 18px; }
.resets .button-row { align-items: center; gap: 4px 12px; margin: 0 0 6px; }
.resets .button-row .small-text, .check-row .small-text { margin: 0; }
.sign-in { margin-top: 8px; }
.sign-in p { margin: 4px 0 0; }
.row.update-row .badge, .row.acp-row .badge { max-width: none; }
/* The site link is a 24 px target at least (WCAG 2.5.8). */
.row.acp-row .badges a { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; padding: 0 4px; }
/* The version sits next to the name, so the eye reads them together. */
.row.update-row { align-items: center; }
.row.update-row .product-head, .row.acp-row .product-head { justify-content: flex-start; align-items: baseline; gap: 8px; }
.limit .bar { width: 100%; background: var(--border); }

/* Plugins: the parts that make a plugin, then an arrow to the plugin. */
.anatomy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.anatomy .parts { display: grid; gap: 6px; flex: 1 1 260px; }
.anatomy .part { display: grid; gap: 2px; padding: 8px 12px; background: var(--surface); border-radius: 8px; }
.anatomy .part.whole { background: var(--hover); flex: 0 1 200px; }
.anatomy .part.outside { border: 1px dashed var(--strong-border); background: none; flex: 1 1 100%; }
.anatomy .arrow { font-size: 24px; color: var(--muted); }
.plugin-card .meta { margin: 4px 0 0; }

/* A heading with its own small control on the right, as in a settings sheet. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 10px; }
.section-head h2 { margin: 0; }
.section-head .legend { margin: 0; }
.limit-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.limit-head strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.limit .when { margin: 0; }
.more { margin-top: 8px; font-size: 13px; }
.more > summary { cursor: pointer; color: var(--muted); padding: 4px 0; min-height: 24px; }
.more > summary:hover { color: var(--text); }
.more[open] > summary { margin-bottom: 4px; }
.update-slot { display: contents; }
.product .button-row { margin-top: 12px; }
.grid.plugins { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
/* In the company list only "signed in" is a pill. Other states are quiet text, so the one good state stands out. */
.split-list .badge.muted { border-color: transparent; padding-inline: 0; }
.row.empty > span { font: 13px/1.55 var(--sans); color: var(--muted); }
.plugin-card h3 a { display: inline-block; min-height: 24px; color: inherit; text-decoration: underline; text-decoration-color: var(--control-border); text-underline-offset: 4px; }
.plugin-card h3 a:hover { text-decoration-color: currentColor; }
.plugin-card:has(h3 a:hover) { border-color: var(--strong-border); }
/* Cards in one row are the same height, and the read time sits at the bottom of each. */
.limit-card { display: flex; flex-direction: column; }
.limit-card > .meta:last-child { margin-top: auto; padding-top: 12px; }
.read-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; }
.read-line p { margin: 0; }
/* auto-fit, not auto-fill: two limit cards share the row, with no empty third column. */
.grid.pair { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.pane-title { margin: 0 0 12px; }
/* Links in a "Needs" line have a quiet underline, so the title link leads. */
.plugin-card .meta a { text-decoration-color: var(--control-border); text-underline-offset: 3px; }
.plugin-card .meta a:hover { text-decoration-color: currentColor; }

/* The sidebar footer, as in T3 Code: Usage on the left, the update button at the bottom right. */
.side-foot { margin-top: auto; display: grid; gap: 6px; }
.side-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
/* Each foot button shows its name next to the icon, so it is found without a hover. */
.side-foot-row .icon-button { width: auto; gap: 6px; padding: 0 8px; grid-auto-flow: column; font-size: 12px; }
.foot-label { white-space: nowrap; }
.update-button { border-radius: 999px; position: relative; }
.update-button.has-update { color: var(--text); }
.update-button.has-update::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--side); }
@media (prefers-reduced-motion: no-preference) { .spinning .icon { animation: spin 1s linear infinite; } }
.update-pill { display: flex; align-items: center; min-height: 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 12px; }
.update-pill[hidden] { display: none; }
.pill-main { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 0; background: none; color: inherit; font-size: 12px; font-weight: 500; text-align: left; }
.pill-main .icon { width: 14px; height: 14px; flex-shrink: 0; }
.pill-close { width: 24px; height: 24px; min-height: 0; margin-right: 3px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.pill-close:hover, .pill-main:hover { color: var(--text); background: var(--hover); }
/* The main part fills to the pill edge on the left, so its corners follow the pill. */
.pill-main { border-radius: 7px 0 0 7px; }
.pill-close .icon { width: 13px; height: 13px; }

/* A large modal over the page, for Usage, as in T3 Code. Esc, the close button, or a press on the backdrop closes it. */
.app-modal { width: min(80rem, calc(100vw - 48px)); height: min(60rem, calc(100vh - 48px)); max-width: none; max-height: none; margin: auto; padding: 0; color: inherit; background: var(--bg); border: 1px solid var(--strong-border); border-radius: 16px; box-shadow: 0 24px 64px rgb(0 0 0 / 0.4); }
.app-modal[open] { display: flex; flex-direction: column; }
.app-modal::backdrop { background: rgb(0 0 0 / 0.45); }
.app-modal:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) {
  .app-modal[open] { animation: modal-in 150ms ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: scale(0.985); } }
}
.model-modal { width: min(36rem, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - 48px); }
/* Update everything, as in T3 Code: a mark for the state, a table of what changes, a fold for what it leaves out, and Cancel first. */
.update-modal { width: min(45rem, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - 48px); }
/* The top edge stays in place, so the dialog grows only down when the list fills in or opens. */
.app-modal.update-modal { width: min(45rem, calc(100vw - 32px)); height: fit-content; margin: min(12dvh, 96px) auto auto; max-height: calc(100dvh - min(12dvh, 96px) - 24px); border: 1px solid var(--strong-border); border-radius: 16px; }
/* The update dialog stays an inset, round box down to 601px. Only the phone sheet below 600px fills the width. */
/* The update rule is stronger than the shared .modal-head rule, so Close stays next to the title when the subtitle wraps. */
.update-modal .update-head { flex-wrap: nowrap; align-items: flex-start; gap: 12px; padding: 16px 12px 14px 20px; }
.update-head > .icon-button { order: 0; margin-top: -2px; }
.update-modal .update-head h2 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.update-head-text { flex: 1; min-width: 0; }
.update-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.update-sub .warn-text { color: var(--warn); }
.update-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.update-mark .icon { width: 18px; height: 18px; }
.update-mark[data-tone="ready"] { color: var(--text); }
.update-mark[data-tone="done"] { color: var(--text); }
.update-mark[data-tone="warn"] { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
/* In dark mode the dialog edge and the group lines are lighter, so they stand apart. */
/* In dark mode the dialog edge is the strongest line, then the group lines, then the row lines. */
/* The kind chip has a visible edge in both themes, so CLI and App read as labels. */
.update-modal .kind-chip { border-color: var(--strong-border); }
@media (prefers-color-scheme: dark) { .app-modal.update-modal { border-color: var(--control-border); } .update-modal .primary[aria-disabled="true"], .update-modal .modal-foot > button.again[aria-disabled="true"] { border-color: var(--strong-border); } .update-group:not(.fold) { border-top-color: var(--strong-border); } .update-line:not(.head) { border-top-color: color-mix(in srgb, var(--strong-border) 60%, var(--border)); } }
/* The list is positioned, so hidden screen reader text in a row stays inside the scroll box and does not make the dialog scroll. */
.update-modal .modal-body { container: update-list / inline-size; position: relative; padding: 16px 12px 16px 20px; overflow: auto; scrollbar-gutter: stable; display: grid; gap: 12px; }
.update-modal .modal-body > p { margin: 0; }
.update-table { display: grid; grid-template-columns: minmax(10.5rem, 1.1fr) 10rem minmax(10.5rem, 1.2fr) 6rem; column-gap: 20px; padding: 0; font-size: 13px; }
.update-line { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; padding: 8px 0; border-top: 1px solid var(--border); align-items: baseline; }
.update-line.head { padding: 8px 0 6px; border-top: 0; color: var(--faint); font-size: 12px; }
/* The column names stay in view while the list scrolls. */
/* The 16px shadow above covers the body padding, so rows do not show above the names. */
/* The list width, not the window width, decides this, so the names and the room above a focused row switch together. */
@container update-list (min-width: 41.01rem) {
  .update-line.head { position: sticky; top: 0; z-index: 1; background: var(--bg); box-shadow: 0 1px 0 var(--border), 0 -16px 0 var(--bg); }
  .update-line:not(.head), .update-group, .update-table :is(a, button) { scroll-margin-top: 48px; }
}
.update-group { grid-column: 1 / -1; padding: 12px 0 4px; border-top: 1px solid var(--strong-border); color: var(--text); font-size: 12px; font-weight: 500; }
.update-group + .update-line { border-top: 0; }
.update-group.act { font-weight: 600; }
/* The rows to act on lead the table, with a bar at the left edge and the name in bold. */
.update-line.act { position: relative; }
.update-line.act::before { content: ""; position: absolute; inset: 7px auto 7px -10px; width: 2px; border-radius: 2px; background: var(--text); }
.update-line.act .update-name { font-weight: 600; }
/* A by-hand row has a quieter bar, as the Update button does not run it. */
.update-line.act.hand::before { background: var(--faint); }
.update-count { margin-left: 6px; color: var(--faint); font-weight: 400; }
/* A version pair breaks at the arrow first. A version wider than the column breaks inside itself. */
.update-line .update-change { display: inline-flex; flex-wrap: wrap; white-space: normal; max-width: 100%; }
.update-change > * { min-width: 0; overflow-wrap: anywhere; }

.update-missing { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; text-wrap: balance; }
/* An Update that waits drops its fill, so it does not look like the main control. */
.update-modal .primary:disabled, .update-modal .primary[aria-disabled="true"], .update-modal .modal-foot > button.again[aria-disabled="true"] { background: var(--surface); color: var(--faint); border: 1px solid transparent; opacity: 1; cursor: not-allowed; }
/* In dark mode the off button keeps a border, so it does not blend into the footer. This rule comes after the shared one. */
@media (prefers-color-scheme: dark) { .update-modal .primary[aria-disabled="true"], .update-modal .modal-foot > button.again[aria-disabled="true"] { border-color: var(--strong-border); } }
/* The footer text: the next step, then the link to the Updates page. */
.update-foot-text { display: grid; gap: 2px; flex: 1 1 14rem; margin-right: auto; min-width: 0; }
/* Just above the phone width the note takes its own line, so the buttons stay together on the next one. */
@media (min-width: 601px) and (max-width: 760px) { .update-modal .modal-foot .update-foot-text { flex-basis: 100%; } }
.update-foot-text > .update-note { margin: 0; text-wrap: pretty; }
.update-note > .update-change { display: block; font-weight: 600; color: var(--text); }
/* Two lines are kept for the note, so the buttons do not move when a check ends. */
@media (min-width: 601px) { .modal-foot.has-ready .update-foot-text { min-height: calc(3em + 26px); align-content: start; } .update-foot-text > .update-note { text-wrap: balance; } }
.changelog .icon.out { width: 12px; height: 12px; margin-left: -2px; color: currentColor; opacity: 0.75; }
.update-modal .modal-foot { position: relative; }
.update-modal .modal-foot.more-below { box-shadow: 0 -8px 12px -8px rgb(0 0 0 / 0.18), 0 -1px 0 var(--strong-border); }
@media (prefers-color-scheme: dark) { .update-modal .modal-foot.more-below { box-shadow: 0 -8px 12px -8px color-mix(in srgb, var(--text) 20%, transparent), 0 -1px 0 var(--strong-border); } }
.update-modal .modal-body:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* The other footer buttons get a border that is easy to see in both themes. */
.update-modal .modal-foot > button:not(.primary) { border-color: var(--control-border); }
/* The fold row: a quiet text button with a chevron that turns when open. */
.update-group.fold { padding: 6px 0; }
/* The fold fills its row, so a press anywhere on the row opens it. */
.update-fold { display: flex; width: calc(100% + 8px); justify-content: flex-start; text-align: left; align-items: center; gap: 6px; min-height: 28px; margin-left: -8px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; }
.update-fold:hover { color: var(--text); background: var(--hover); }
.update-fold .icon { width: 14px; height: 14px; }
.update-fold[aria-expanded="true"] .icon { transform: rotate(90deg); }
.update-more { justify-self: start; display: inline-flex; align-items: center; min-height: 24px; color: var(--muted); }
.update-more:hover { color: var(--text); }
.update-empty { margin: 0; }
/* A first check that fails keeps some of the skeleton height, so the footer buttons do not jump far up from under the pointer. */
/* The first-check failure keeps some empty space under the message, so the dialog is not a thin strip. Settled. */
.update-modal .modal-body.empty-fail { padding-block: 24px; min-height: 9rem; }
.get-link .get-link-text, .get-link > span { position: static; width: auto; height: auto; clip-path: none; }
/* The links sit on one right edge in each state. */
.update-line > :nth-child(4) { justify-self: end; }
.update-line .mono { font: 13px var(--mono); overflow-wrap: anywhere; }
.update-line strong { font-weight: 600; }
/* The command of a ready row, under how it updates: small and muted, in full. It wraps only between words. */
.update-command { display: block; margin-top: 2px; overflow-wrap: break-word; word-break: normal; color: var(--muted); font: 12px/1.5 var(--mono); }
.update-name { font-weight: 500; }
.update-arrow { color: var(--faint); }
.kind-chip { display: inline-block; white-space: nowrap; margin-left: 6px; padding: 0 5px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: 11px; line-height: 16px; vertical-align: 1px; }
/* The bars have the row height of the table, so the dialog keeps its size when the list comes in. */
.update-skeleton { display: grid; padding: 0; font-size: 12px; color: var(--faint); }
.update-skeleton div { display: grid; grid-template-columns: minmax(10.5rem, 1.1fr) 10rem minmax(10.5rem, 1.2fr) 6rem; gap: 20px; align-items: center; padding: 13px 0 14px; border-top: 1px solid var(--border); }
.update-skeleton div.head { border-top: 0; padding: 8px 0 6px; }
/* Each height matches the real row it stands for, so the dialog keeps its size when the list lands. */
.update-skeleton div.two { padding: 11px 0 35.1px; }
.update-skeleton div.three { padding: 11px 0 39px; }
/* A not-checked row has its hint under how it updates, two lines at this width. */
.update-skeleton div.hint { padding: 11px 0 54.3px; }
/* The arrow and the new version sit in two columns, so they always start on the same line. */
.update-to { display: inline-grid; grid-template-columns: auto minmax(0, auto); white-space: pre; }
.update-to > strong { white-space: normal; overflow-wrap: anywhere; }
.update-skeleton div.head > span, .update-skeleton div.head > span:nth-child(3) { height: auto; width: auto; background: none; animation: none; }
.update-skeleton div.group { grid-template-columns: 1fr; padding: 18.6px 0 6px; border-top: 1px solid var(--strong-border); }
.update-skeleton div.group span { width: 7rem; }
.update-skeleton div.group.fold { padding: 15px 0; border-top: 1px solid var(--border); }
.update-skeleton div.group.fold span { width: 10rem; }
.update-skeleton div.group + div { border-top: 0; }
.update-skeleton span { height: 10px; border-radius: 5px; background: var(--hover); }
.update-skeleton span:nth-child(3) { width: 60%; }
/* The second and third lines of a row show as shadows of its How bar, so the skeleton has the line count of the real rows. */
.update-skeleton div.two span:nth-child(3) { box-shadow: 0 20px 0 var(--hover); }
.update-skeleton div.three span:nth-child(3), .update-skeleton div.hint span:nth-child(3) { box-shadow: 0 17px 0 var(--hover), 0 34px 0 var(--hover); }

@keyframes skeleton { to { opacity: 0.45; } }
@media (prefers-reduced-motion: no-preference) {
  .update-skeleton span { animation: skeleton 1.2s ease-in-out infinite alternate; }
}
/* With reduced motion, the check mark and the skeleton fade in place, so a check does not look frozen. A fade has no movement. */
@media (prefers-reduced-motion: reduce) {
  /* It fades three times, under 5 seconds, then stops (WCAG 2.2.2). The title still says that a check runs. */
  .update-mark.spinning .icon, .update-skeleton span { animation: skeleton 1.6s ease-in-out 3 alternate; }
}
/* The title takes the focus only as a fallback. It shows a ring only after keyboard use. */
.update-modal #update-title:focus:not(:focus-visible) { outline: none; }
/* The title takes the focus when a focused row goes away, so it shows a ring. */
.update-modal #update-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.changelog { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 28px; min-height: 28px; padding: 0 6px; margin: -4px -6px -4px 0; border-radius: 6px; color: var(--muted); font-size: 12px; text-decoration: none; white-space: nowrap; }
.changelog:hover { color: var(--text); background: var(--hover); }
.changelog .icon { width: 13px; height: 13px; }
/* The link text is underlined, so it reads as a link and not as row text. */
.changelog-text { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 2px; }
/* The download link is the next step, so it keeps its underline. It sits under the words in the How cell. */
.get-link .changelog-text, .changelog.news .changelog-text { text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.changelog.news { color: var(--text); }
.update-line .copy-command { display: flex; white-space: normal; text-align: left; width: fit-content; margin: 2px 0 0 -6px; border: 0; background: none; font: inherit; font-size: 12px; cursor: pointer; }
/* Close and Cancel have different widths, so a fixed width keeps the footer still when one becomes the other. */
.update-modal .modal-foot > button { min-width: 4.5rem; }
/* On a desktop, Update keeps room for its long label, so Close does not move when the first check ends. */
@media (min-width: 601px) { .update-modal .modal-foot > button.primary:not(.again) { min-width: 7.5rem; } }
.update-line .get-link { color: var(--text); font-weight: 500; display: flex; width: fit-content; min-height: 24px; justify-content: flex-start; margin: 0 0 0 -6px; }
/* A by-hand row lines up its cells on the first text line, as its how cell has two lines. */

.changelog:hover .changelog-text, .changelog:focus-visible .changelog-text { text-decoration-color: currentColor; }
/* On a narrow screen each row has two lines: the name and the version, then how it updates and the link. */
/* The four columns need 37rem plus 60px of gaps. When the list is narrower, at any base font size, each row takes two lines. */
@container update-list (max-width: 41rem) {
  /* The right column has a fixed share, so a long version in a folded row does not move the columns when the fold opens. */
  .update-table { grid-template-columns: minmax(0, 1fr) 45%; column-gap: 12px; }
  .update-line { row-gap: 2px; align-items: start; }
  .update-line > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .update-line > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .update-line > :nth-child(3) { grid-column: 1; grid-row: 2; font-size: 12px; }
  .update-line > :nth-child(4) { grid-column: 2; grid-row: 2; justify-self: start; }
  .update-line .changelog { margin-left: -6px; }
  /* The link text starts on the same line as how it updates. Its tap area reaches down, not up into the version. */
  .update-line > :nth-child(4) > .changelog { margin-top: 0; min-height: 24px; align-items: flex-start; }
  /* Two-line rows do not sit under columns, so the column names are only for a screen reader. */
  .update-line.head + .update-group { border-top: 0; padding-top: 4px; }
  .update-line.head { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
  .update-line.head > :nth-child(n + 3) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .update-line .mono { white-space: normal; overflow-wrap: anywhere; }
  
  /* The skeleton uses the same columns as the rows, so the versions do not move when the list fills in. */
  .update-skeleton div { grid-template-columns: minmax(0, 1fr) 45%; column-gap: 12px; padding: 18px 0; }
  .update-skeleton div > span:nth-child(2) { width: 6rem; }
  .update-skeleton span:nth-child(n + 3) { display: none; }
  .update-skeleton div.head { display: none; }
  /* A phone row has a name and a second line, so each skeleton row shows two bars. */
  .update-skeleton div.two, .update-skeleton div.three, .update-skeleton div.hint { padding: 12px 0 40px; }
  .update-skeleton div.two span:first-child, .update-skeleton div.three span:first-child, .update-skeleton div.hint span:first-child { box-shadow: 0 18px 0 var(--hover); }
}
@media (max-width: 600px) {
  /* The note and the link make one short paragraph. The buttons share the next line. */
  .update-foot-text { display: block; flex: 1 1 100%; }
  .update-foot-text > .update-note { display: inline; }
  .update-foot-text > .update-more { display: inline; min-height: 0; margin-left: 4px; }
  /* The three buttons share one row in equal parts, and a long label wraps inside its button. */
  .update-modal .modal-foot > button { flex: 1 1 0; min-width: 0; padding-inline: 8px; white-space: normal; }
  .update-fold { min-height: 44px; }
  .update-modal .modal-foot > button { min-height: 44px; }
  /* Each link has a 44px tap area that reaches down into the row padding, not up into the line above. */
  .changelog { position: relative; margin-block: 0; }
  .changelog::after { content: ""; position: absolute; inset: -4px 0 -12px; }
  /* The right-column link is a real 44px box inside its own row, so its tap area never reaches the next row. */
  .update-line > :nth-child(4) > .changelog { min-height: 44px; }
  .update-line > :nth-child(4) > .changelog::after { display: none; }
  /* Copy command and Download page can sit one under the other, so each has its own 44px box and no shared tap area. */
  /* The text sits at the top of its box, right under the line above, and the box reaches down. */
  .update-line .copy-command, .update-line .get-link { min-height: 44px; margin-block: 0; align-items: flex-start; padding-top: 2px; }
  .update-line .copy-command::after, .update-line .get-link::after { inset: 0; }
  /* The last link of a row lets its box reach into the row padding and the next row's top padding, so the row is not taller than its neighbours. */
  .update-line .copy-command:last-child, .update-line .get-link:last-child { margin-bottom: -16px; }
  /* Under Copy command, Download page keeps its own 44px box, so the two tap areas do not overlap. */
  .update-line .copy-command + .get-link { margin-top: 0; }
  .update-head > .icon-button { width: 44px; height: 44px; margin: -8px -8px 0 0; }
  /* Phone rows hold 44px links and a 44px fold, so the skeleton rows are as tall, and the dialog does not grow when the list lands. */
  .update-skeleton div.two, .update-skeleton div.three { padding: 12px 0 61.3px; }
  .update-skeleton div.hint { padding: 12px 0 73.4px; }
  .update-skeleton div.head + div.group { padding-top: 9.7px; }
  .update-skeleton div.group.fold { padding: 22.85px 0; }
  /* A bottom sheet: it rises from the bottom edge, with round top corners. */
  .app-modal.update-modal { width: 100vw; height: fit-content; margin: auto 0 0; max-height: calc(100dvh - 16px); border: 0; border-top: 1px solid var(--strong-border); border-radius: 16px 16px 0 0; }
}
@media (max-width: 360px) {
  /* Each link has its own 44px box here, so no tap area reaches into another row. The link stays in the right column. */
  .update-line .changelog, .update-line > :nth-child(4) > .changelog { min-height: 44px; }
  .update-line .changelog::after { display: none; }
}
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.modal-foot > p { margin: 0 auto 0 0; }
/* The list of a run, over the update button. */
.update-pop { inset: auto auto 52px 12px; width: min(20rem, calc(100vw - 24px)); max-height: calc(100dvh - 64px); overflow-y: auto; margin: 0; padding: 10px 12px; color: inherit; background: var(--bg); border: 1px solid var(--strong-border); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.25); font-size: 12px; }
.update-pop .pop-title { margin: 0 0 6px; font-weight: 500; }
.run-item { display: grid; gap: 1px; padding: 5px 0; border-top: 1px solid var(--border); }
.run-line { display: flex; justify-content: space-between; gap: 12px; }
.run-line > :last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-failure { overflow-wrap: anywhere; }
.run-failed { color: var(--warn); }
.run-actions { display: flex; justify-content: flex-end; gap: 4px; padding-top: 6px; }
.run-retry { justify-self: start; margin-top: 2px; }
.run-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; }
.run-item-actions .run-retry { margin-top: 0; }
.update-line .update-row { justify-self: start; margin-top: 4px; }
/* A touch screen gets 44 px targets: the list buttons grow, and the update button gets a larger hit area than it shows. */
@media (pointer: coarse) {
  .update-pop button { min-height: 44px; }
  .update-button::after { content: ""; position: absolute; inset: -8px -4px; }
}
/* The short count shows only where the label is hidden. */
.run-compact { display: none; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-item:focus-visible, .update-pop .pop-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.run-item:focus:not(:focus-visible), .update-pop .pop-title:focus:not(:focus-visible) { outline: none; }
/* During a run the button widens to hold the item name and a thin bar under it. */
.side-foot-row > .update-button { min-width: 0; }
/* During a run the update button takes the footer row, and Usage keeps only its icon, so the item name fits. */
.side-foot-row:has(.update-button.running) #usage-open .foot-label { display: none; }
.side-foot-row > .update-button.running { flex: 1 1 auto; justify-content: start; }
.update-button.running { grid-template-columns: auto minmax(0, 1fr); }
.update-button.running .foot-label { justify-self: stretch; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.run-bar { position: absolute; left: 10px; right: 10px; bottom: 2px; width: auto; height: 2px; appearance: none; border: 0; background: var(--strong-border); border-radius: 2px; overflow: hidden; }
.run-bar::-webkit-progress-bar { background: var(--strong-border); }
.run-bar::-webkit-progress-value { background: var(--text); }
.run-bar::-moz-progress-bar { background: var(--text); }
.modal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 15px; }
/* Close is before the tabs in the keyboard order, but sits at the end of the row on a wide screen. */
.modal-head > .icon-button { order: 1; }
.modal-tools { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.modal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
/* On a wide screen the idle filters keep their space, so the tabs never move. visibility also takes them out of the tab order. */
.modal-filters.idle { visibility: hidden; }
.modal-tools select { font-size: 12px; min-height: 30px; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 28px 32px; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.model-modal .modal-body { padding: 20px; }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.seg button { min-height: 26px; padding: 2px 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 12px; }
.seg button:hover:not([aria-pressed="true"]) { color: var(--text); background: var(--hover); }
.seg button[aria-pressed="true"] { color: var(--text); background: var(--bg); box-shadow: 0 0 0 1px var(--strong-border); font-weight: 600; }
@media (forced-colors: active) { .seg button[aria-pressed="true"] { outline: 2px solid Highlight; } }
.fine { font-size: 12px; margin: 2px 0; }
.usage-overview { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 32px; }
.usage-side { display: flex; flex-direction: column; gap: 18px; }
.usage-figure { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.provider-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.provider-line .key { margin: 0 8px 0 0; }
.provider-line .figure { font-variant-numeric: tabular-nums; }
.bar.thin { height: 4px; margin: 6px 0 4px; gap: 0; }
/* A small type keeps 3px, so a share with use never disappears. The others shrink to make room. */
.share .bar > span { min-width: 3px; flex-shrink: 1; }
.usage-chart { margin: 0; min-width: 0; }
.usage-chart h3, .usage-section h3 { margin: 0 0 10px; font-size: 13px; font-weight: 500; }
.usage-chart svg { display: block; width: 100%; height: auto; }
.usage-chart .grid-line { stroke: var(--border); }
.usage-chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--sans); }
.chart-numbers { margin-top: 8px; }
.numbers-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.numbers-table th, .numbers-table td { padding: 6px 0 6px 16px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.numbers-table thead th { font-size: 12px; font-weight: 400; color: var(--muted); }
.numbers-table th:first-child { padding-left: 0; text-align: left; font-weight: 400; }
.usage-chart .bar-group:hover .bar-part { opacity: 0.75; }
.usage-section { margin-top: 32px; }
.usage-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.usage-section-head h3 { margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 16px 24px; margin: 0; }
.metric dt { font-size: 12px; color: var(--muted); }
.metric dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric dd.fine { font-size: 12px; font-weight: 400; }
.shares { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 24px; margin-top: 20px; }
.share-head { margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.share-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.key-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.key-item .key { margin: 0; }
.table-wrap { overflow-x: auto; }
.mcp-detail { overflow-wrap: anywhere; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.usage-table th, .usage-table td { padding: 8px 0 8px 24px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.usage-table th { font-size: 12px; font-weight: 400; color: var(--muted); }
.usage-table td { color: var(--muted); }
.usage-table th:first-child, .usage-table td:first-child { width: 2ch; padding-left: 4px; text-align: left; }
.usage-table .narrow-only { display: none; }
.usage-empty { margin: 24px 0; }
.usage-table .name-cell { width: 100%; text-align: left; white-space: normal; color: var(--text); }
.usage-table td:nth-child(3), .usage-table td:last-child { color: var(--text); }
.usage-table tbody tr:hover { background: var(--hover); }
.usage-table td.empty { padding: 24px 0; text-align: center; }
.model-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.model-line .key { margin: 0; }
.link-button { min-height: 24px; display: inline-flex; align-items: center; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--strong-border); text-underline-offset: 3px; cursor: pointer; }
.link-button:hover { text-decoration-color: currentColor; }
@media (max-width: 900px) { .usage-overview { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .side-foot { margin: 0; display: flex; align-items: center; gap: 4px; }
  .side-foot .update-pill { display: none; }
  .app-modal { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  /* Row 1: the title and Close. Row 2 and on: the tools at full width. */
  .modal-head h2 { flex: 1; }
  .modal-head > .icon-button { order: 0; }
  .modal-tools { order: 2; width: 100%; margin-left: 0; }
  /* The four tabs keep one line each. When they do not fit, the group scrolls inside itself, never the page. */
  .modal-tools > .seg:first-child { flex-basis: 100%; overflow-x: auto; }
  .modal-tools > .seg:first-child button { flex: 1 0 auto; white-space: nowrap; }
  .modal-filters { margin-left: 0; }
  /* On a narrow screen the filters have a row of their own, so an idle row is only blank space. */
  .modal-filters.idle { display: none; }
  .side-foot-row .foot-label { display: none; }
  .side-foot-row .icon-button { width: 28px; padding: 0; }
  /* During a run the top-bar button shows a short count, such as 1/2 or Slow, next to its icon. */
  .side-foot-row .update-button:has(.run-compact) { width: auto; min-width: 5.5rem; padding: 0 6px; gap: 4px; justify-content: flex-start; }
  .side-foot-row .run-compact { display: inline; }
  .run-bar { left: 4px; right: 4px; }
  /* The button sits in the top bar here, so the list opens under it, at the right. */
  .update-pop { inset: calc(52px + env(safe-area-inset-top, 0px)) 12px auto auto; max-height: calc(100dvh - 64px - env(safe-area-inset-top, 0px)); }
  .modal-body { padding: 16px; }
  .usage-table .wide-only { display: none; }
  .usage-table th, .usage-table td { padding-left: 12px; }
  .usage-table .narrow-only { display: block; }
  /* The provider always takes its own line, so every row has the same shape. */
  .usage-table .model-line > .fine { flex-basis: 100%; }
  /* Cost and tokens line up with the model name, the first line of each row. */
  .usage-table td { vertical-align: top; }
}
/* A 1px gap in the page colour between the two parts of a stacked bar. */
.bar-part { stroke: var(--bg); stroke-width: 1px; }
.stripe-fill { fill: var(--muted); }

/* High contrast mode replaces the colors, so the off button and the row bars use system colors. */
@media (forced-colors: active) {
  .update-modal .primary[aria-disabled="true"], .update-modal .modal-foot > button.again[aria-disabled="true"] { color: GrayText; border-color: GrayText; }
  .update-line.act::before { background: CanvasText; forced-color-adjust: none; }
  .update-line.act.hand::before { background: GrayText; }
}

/* On a short screen only the list scrolls. The header and the footer stay in view, with less padding. Settled. */
@media (max-height: 480px) {
  .update-modal .modal-body, .update-modal .modal-body.empty-fail { min-height: 0; }
  .update-modal .update-head { padding-block: 10px 8px; }
  .update-modal .modal-foot { padding-block: 8px; }
  /* The mark repeats the title, so a short screen gives its room to the list. */
  .update-modal .update-mark { display: none; }
}
/* A very short window gives all its height to the dialog, so the list keeps room to scroll. */
@media (max-height: 320px) {
  .app-modal.update-modal { margin-top: 0; max-height: 100dvh; border-radius: 0; }
  .update-modal .update-head { padding-block: 6px 4px; }
  .update-modal .modal-foot { padding-block: 6px; gap: 6px; }
  .update-modal .modal-foot > button { min-height: 36px; padding: 4px 6px; font-size: 13px; }
  .update-modal .modal-body { padding-block: 8px; }
  .update-modal #update-title { font-size: 15px; }
  /* The footer text scrolls in its own small box, so the buttons and the list keep their room and no text is cut off. */
  .update-modal .update-foot-text { max-height: calc(2 * 1.5em); overflow-y: auto; }
}
/* In dark mode the phone sheet's top edge is the strongest line, as the dialog edge is on a desktop. */
@media (max-width: 600px) and (prefers-color-scheme: dark) { .app-modal.update-modal { border-top-color: var(--control-border); } }
