:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-variant-numeric: tabular-nums;

  --text-main: #242424;
  --bg-main: #f2f2f2;
  --map-bg: #e4e4e4;
  --muted: #606060;
  --line: #d6d6d6;
  --accent: #333333;
  --paper: #fafafa;
  --bg-label: #e6e6e6;
  --text-label: #363636;
  --bg-composer: #ebebeb;
  --btn-border: #828282;
  --btn-text: #303030;
  --btn-hover-bg: #e4e4e4;
  --btn-hover-border: #777777;
  --btn-primary-hover: #191919;
  --btn-danger-text: #292929;
  --btn-danger-border: #969696;
  --btn-danger-hover: #e2e2e2;
  --btn-disabled-bg: #e6e6e6;
  --btn-disabled-text: #696969;
  --btn-disabled-border: #cecece;
  --btn-primary-text: #ffffff;
  --focus-ring: #1c1c1c;
  --text-placeholder: #717171;
  --line-alt: #bdbdbd;
  --text-error: #292929;
  --bg-error: #e5e5e5;
  --border-error: #676767;
  --bg-pre: #eeeeee;
  --border-pre: #d9d9d9;
  --text-summary: #4d4d4d;
  --text-stage: #606060;
  --text-stage-help: #555555;
  --text-warn: #353535;
  --bg-warn: #e8e8e8;
  --text-status: #4b4b4b;
  --text-chip: #363636;
  --bg-chip-warn: #e0e0e0;
  --text-chip-warn: #353535;
  /* status colors: green = finished, the brand's rust = failed and its
     mustard = needs attention, at one intensity and one perceived
     brightness so none of the three stands out (OKLCH L 0.49 on light,
     0.77 on dark; the red sits a little lower, L 0.47 / 0.70, with more
     chroma, because a saturated red already looks brighter) */
  --map-passed: #357039;
  --map-failed: #9e2d26;
  --map-attention: #7e5908;
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --text-main: #e8e8e8;
  --bg-main: #1c1c1c;
  --map-bg: #0d0d0d;
  --muted: #a6a6a6;
  --line: #3d3d3d;
  --accent: #d2d2d2;
  --paper: #252525;
  --bg-label: #333333;
  --text-label: #c4c4c4;
  --bg-composer: #2b2b2b;
  --btn-border: #686868;
  --btn-text: #e8e8e8;
  --btn-hover-bg: #3d3d3d;
  --btn-hover-border: #8b8b8b;
  --btn-primary-hover: #eeeeee;
  --btn-danger-text: #eeeeee;
  --btn-danger-border: #858585;
  --btn-danger-hover: #383838;
  --btn-disabled-bg: #2e2e2e;
  --btn-disabled-text: #888888;
  --btn-disabled-border: #464646;
  --btn-primary-text: #1c1c1c;
  --focus-ring: #e2e2e2;
  --text-placeholder: #a0a0a0;
  --line-alt: #555555;
  --text-error: #eeeeee;
  --bg-error: #383838;
  --border-error: #a0a0a0;
  --bg-pre: #222222;
  --border-pre: #3b3b3b;
  --text-summary: #b4b4b4;
  --text-stage: #a6a6a6;
  --text-stage-help: #bdbdbd;
  --text-warn: #dddddd;
  --bg-warn: #383838;
  --text-status: #b4b4b4;
  --text-chip: #c4c4c4;
  --bg-chip-warn: #383838;
  --text-chip-warn: #dddddd;
  --map-passed: #7acb7d;
  --map-failed: #f86b60;
  --map-attention: #e1aa40;
}

body {
  color: var(--text-main);
  background: var(--bg-main);
}
/* Unio — Copyright (C) 2026 Daniel Mitev; Daniel Mevit (@danielmevit).
   https://github.com/danielmevit/unio
   SPDX-License-Identifier: AGPL-3.0-only; see LICENSE and NOTICE. No warranty. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; }
main { --page-pad: clamp(16px, 2.3vw, 48px); width: 100%; padding: 0 var(--page-pad) 24px; }
section, form, details, .workspace-layout > * { min-width: 0; }
button, input, textarea, select, summary { font: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 17px; font-weight: 550; letter-spacing: -.35px; margin: 0; }
h2 { font-size: 21px; line-height: 1.3; font-weight: 620; letter-spacing: -.5px; margin-bottom: 16px; }
h3 { font-size: 17px; line-height: 1.4; font-weight: 620; margin-bottom: 12px; }
h4 { font-size: 13px; font-weight: 650; margin-bottom: 7px; }
p { overflow-wrap: anywhere; }
.topbar { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.workspace-brand, .topbar-controls { display: flex; align-items: center; gap: 18px; }
.topbar-controls { min-width: 0; flex-wrap: wrap; }
.brand { font-size: 23px; font-weight: 750; letter-spacing: -1px; border-right: 1px solid var(--line); padding-right: 18px; }
.mode-label, .state-label { font-size: 12px; font-weight: 600; padding: 4px 8px; background: var(--bg-label); color: var(--text-label); border-radius: 4px; overflow-wrap: anywhere; }
.notice { color: var(--muted); font-size: 13px; margin: 15px 0 24px; max-width: 100ch; }
.small { font-size: 13px; color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .8px; margin: 0 0 6px; }
.workspace-layout { display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); align-items: start; gap: 24px; }
.composer { padding: 24px; background: var(--bg-composer); border: 1px solid var(--line); border-radius: 10px; }
.composer .small { margin-bottom: 18px; }
.selected-work { padding: 24px 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.section-heading h2 { margin-bottom: 12px; }
.empty-state { min-height: 280px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 20px 0; max-width: 56ch; }
.empty-mark { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 20px; border-bottom: 2px solid var(--accent); padding-bottom: 8px; }
.empty-state p { color: var(--muted); margin-bottom: 0; }
button { min-height: 44px; border: 1px solid var(--btn-border); background: var(--paper); color: var(--btn-text); border-radius: 5px; padding: 9px 14px; cursor: pointer; font-size: 13px; font-weight: 600; transition: background-color 140ms, border-color 140ms; }
button:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { background: var(--accent); color: var(--btn-primary-text); border-color: var(--accent); }
button.primary:hover { background: var(--btn-primary-hover); }
button.danger { color: var(--btn-danger-text); border-color: var(--btn-danger-border); }
button.danger:hover { background: var(--btn-danger-hover); }
button:disabled { cursor: default; background: var(--btn-disabled-bg); color: var(--btn-disabled-text); border-color: var(--btn-disabled-border); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
main:focus { outline: none; }
.skip-link { position: absolute; left: 16px; top: -80px; z-index: 2; padding: 12px 18px; background: var(--paper); color: var(--accent); border: 1px solid var(--accent); }
.skip-link:focus { top: 12px; }
label { display: block; font-size: 13px; font-weight: 550; margin: 14px 0 7px; }
textarea, input { width: 100%; min-width: 0; border: 1px solid var(--btn-border); border-radius: 5px; background: var(--paper); color: inherit; padding: 11px 12px; }
textarea { resize: vertical; min-height: 170px; line-height: 1.6; margin-bottom: 12px; }
textarea::placeholder { color: var(--text-placeholder); }
input { min-height: 44px; font-size: 13px; }
#draft-form > button { width: 100%; }
.draft-reopen { display: flex; flex-wrap: wrap; gap: 8px; }
.draft-reopen input { flex: 1 1 150px; }
.draft-reopen button { flex: 1 0 auto; }
.reopen-details { border-top: 1px solid var(--line-alt); margin-top: 22px; padding-top: 10px; }
#draft-status, #job-status { font-size: 13px; margin: 14px 0 0; }
#draft-status:empty, #job-status:empty { display: none; }
.error { color: var(--text-error); background: var(--bg-error); border: 1px solid var(--border-error); padding: 12px; border-radius: 3px; overflow-wrap: anywhere; }
#draft-reference { overflow-wrap: anywhere; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; background: var(--bg-pre); border: 1px solid var(--border-pre); border-radius: 5px; padding: 14px 16px; font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; max-width: 100%; margin: 0 0 16px; tab-size: 2; }
summary { cursor: pointer; color: var(--text-summary); font-size: 13px; font-weight: 550; min-height: 44px; padding: 12px 0; overflow-wrap: anywhere; }
details[open] > summary { margin-bottom: 8px; }
.stages { padding: 0; margin: 18px 0 22px; list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.stages li { font-size: 11px; color: var(--text-stage); border-top: 2px solid var(--line); padding-top: 7px; overflow-wrap: anywhere; }
.stages li[aria-current="step"] { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.stage-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.stage-heading h3 { margin-bottom: 8px; }
.stage-help { color: var(--text-stage-help); max-width: 76ch; font-size: 13px; margin-bottom: 16px; }
.execution-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.preview, .result { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; }
.preview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.provider-labels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 12px 0 8px; }
.provider-labels p { margin: 3px 0 0; font-size: 13px; }
.provider-labels strong { display: block; font-size: 13px; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; gap: 0 24px; }
.evidence-grid > div { border-bottom: 1px solid var(--line); padding: 12px 0; }
.evidence-grid dt { color: var(--muted); font-size: 12px; }
.evidence-grid dd { margin: 3px 0 0; font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.warnings { padding: 12px 16px 12px 30px; color: var(--text-warn); background: var(--bg-warn); font-size: 13px; border-radius: 4px; overflow-wrap: anywhere; }
.activity-section { margin-top: 30px; }
.console-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.console-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
.console-worker { display: block; width: 100%; text-align: left; margin: 0 0 8px; }
.console-worker strong, .console-worker .small, .console-excerpt { display: block; }
.console-excerpt { white-space: pre-wrap; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; margin-top: 8px; }
#console-workers { margin-top: 12px; }
#console-file-list { list-style: none; padding: 0; margin: 0 0 12px; }
#console-file-list li { margin: 0 0 8px; }
#console-file-list button { width: 100%; text-align: left; }
#console-text, #console-file-text { max-height: 320px; overflow: auto; }
#console-panel { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.activity-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.activity-heading h2 { margin-bottom: 0; }
#status { margin: 0; font-size: 12px; color: var(--text-status); text-align: right; }
#status.error { color: var(--text-error); }
.evidence-help { margin: 12px 0 20px; max-width: 90ch; }
.row { border-top: 1px solid var(--line); padding: 18px 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: 24px; }
.row strong { display: block; font-size: 13px; font-weight: 620; overflow-wrap: anywhere; }
.row p { font-size: 12px; margin: 5px 0 0; color: var(--muted); }
.row .data { font-size: 12px; }
.chip { display: inline-block; border-radius: 3px; background: var(--bg-label); color: var(--text-chip); font-size: 11px; font-weight: 550; padding: 2px 7px; }
.chip.warn { background: var(--bg-chip-warn); color: var(--text-chip-warn); }
.observer-details { border-top: 1px solid var(--line); margin: 4px 0 20px; }
.observer-details > details { border-bottom: 1px solid var(--line); }
#mode-footer { max-width: 100ch; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: 13px; text-underline-offset: 3px; }
@media (max-width: 1000px) {
  main { --page-pad: 24px; }
  .workspace-layout { grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); gap: 18px; }
  .selected-work, .composer { padding: 22px; }
  .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
  .preview-grid, .provider-labels { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 720px) {
  main { --page-pad: 16px; padding-bottom: 20px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 16px 0; }
  .workspace-brand { gap: 12px; }
  .brand { padding-right: 12px; }
  h1 { font-size: 15px; }
  .topbar-controls { width: 100%; justify-content: space-between; gap: 12px; }
  .notice { margin: 14px 0 20px; }
  .workspace-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .selected-work, .composer { padding: 20px; }
  .empty-state { min-height: 190px; }
  .activity-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  #status { text-align: left; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 18px 0; }
  .stage-heading { align-items: flex-start; flex-direction: column; gap: 4px; margin-bottom: 10px; }
  .evidence-grid { grid-template-columns: 1fr; }
  .execution-actions button { flex: 1 1 auto; }
  pre { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  button:active:not(:disabled) { transform: none; }
}

.view-switch {
  display: flex;
  gap: 8px;
}
.view-switch button[aria-pressed="true"] {
  background: var(--bg-label);
  border-color: var(--accent);
  color: var(--text-label);
}
.map-container {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(12px, 1.5vw, 24px);
  margin-top: 15px;
}
.map-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}
.map-controls input[type="search"] {
  flex: 1 1 200px;
  max-width: 100%;
  min-height: 44px;
  padding: 5px 10px;
}
.map-controls select {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--text-main);
  background: var(--paper);
  border: 1px solid var(--btn-border);
  border-radius: 5px;
}
.history-toggle {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
}
.history-toggle input { width: auto; min-height: auto; flex: none; }
/* The zoom controls float inside the map's bottom-left corner: just the
   buttons, no extra frame. The zoom level wears the map's own background,
   so it stays readable when a node slides behind it. */
.map-canvas-column { position: relative; }
.map-camera-controls { position: absolute; bottom: 10px; left: 10px; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100% - 20px); }
.map-camera-controls #map-zoom-level { align-self: stretch; display: grid; place-items: center; padding: 0 4px; background: var(--map-bg, var(--bg-main)); }
.map-camera-controls button { min-width: 44px; }
#map-zoom-level { min-width: 4ch; text-align: center; font-size: 12px; color: var(--muted); }
.map-activity { margin: 0 0 12px; font-weight: 600; }
.map-empty { margin: 0 0 12px; color: var(--muted); }
.map-workspace { display: grid; grid-template-columns: minmax(0, 1fr); }
.map-canvas-column, .map-details { min-width: 0; }
.map-scroll-area {
  overflow: hidden;
  border: 1px solid var(--line);
  /* a step less bright than the page in both themes (near-black in dark),
     with a barely visible dot grid, like a technical board */
  background: var(--map-bg, var(--bg-main)) radial-gradient(circle, color-mix(in srgb, var(--text-main) 4.5%, transparent) 1px, transparent 1.5px) 0 0 / 14px 14px;
  border-radius: 5px;
  height: clamp(320px, 55vh, 560px);
}
#work-map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
#work-map.is-panning, #work-map.is-panning [data-node-key] { cursor: grabbing !important; }
#work-map [data-layer="links"] { pointer-events: none; }
#work-map [data-node-key]:focus-visible rect { stroke: var(--focus-ring); stroke-width: 3; }
#work-map [data-inactive="true"] > :is(rect, .node-divider, .node-logo, .node-agent, .node-label, .node-state) { opacity: 0.55; }
#work-map [data-inactive="true"] > .node-status { opacity: 0.72; }
#work-map [data-inactive="true"]:is(:hover, :focus, [aria-pressed="true"]) > * { opacity: 1; }
.node-logo, .node-agent { fill: var(--text-main); pointer-events: none; }
.node-divider { stroke: var(--line); stroke-width: 1; pointer-events: none; }
.node-label { font-weight: 600; }
#work-map [data-signal="active"] .node-label { font-weight: 700; }
.map-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
  font-size: 13px;
}
.map-pagination button {
  min-height: 44px;
  padding: 5px 10px;
}
.map-counts {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
.map-details {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.map-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.map-details-header h3 { min-width: 0; }
/* close: a plain X, no frame until hovered */
#map-clear-sel {
  flex: none; display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; margin: 0 -6px 0 0; padding: 0;
  background: none; border-color: transparent; color: var(--muted);
}
#map-clear-sel:hover { color: var(--text-main); border-color: var(--line); }
#map-clear-sel svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.map-details-header h3 { overflow-wrap: anywhere; }
.node-status { stroke: var(--muted); stroke-width: 3; stroke-linecap: round; pointer-events: none; }
[data-signal="passed"] > .node-status { stroke: var(--map-passed); }
[data-signal="failed"] > .node-status { stroke: var(--map-failed); }
[data-signal="attention"] > .node-status { stroke: var(--map-attention); }
[data-signal="active"] > .node-status { stroke: var(--text-main); }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-legend i { display: inline-block; height: 12px; border-right: 3px solid var(--muted); }
.map-legend .signal-passed { border-color: var(--map-passed); }
.map-legend .signal-failed { border-color: var(--map-failed); }
.map-legend .signal-attention { border-color: var(--map-attention); }
.map-legend .signal-active { border-color: var(--text-main); }
@media (min-width: 1100px) {
  .map-workspace:has(> .map-details:not([hidden])) {
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    gap: 20px;
  }
  .map-details {
    margin-top: 0;
    padding: 0 0 0 20px;
    border-top: 0;
    border-left: 1px solid var(--line);
    height: clamp(320px, 55vh, 560px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .map-details .evidence-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .map-controls select, .map-controls input[type="search"] { flex-basis: 100%; }
  .map-counts { margin-left: 0; }
}

/* Designated AI agents & limits: neutral surfaces, status accents only. */
.limits-lead { margin: 14px 0; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; font-size: 13px; overflow-wrap: anywhere; }
.limits-lead strong { font-weight: 650; }
.limits-subtitle { font-size: 14px; margin: 22px 0 6px; }
.limits-routes, .limits-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.limits-card { border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; background: var(--paper); min-width: 0; overflow-wrap: anywhere; }
.limits-card h4 { margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.limits-card p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.limits-card .chip { margin: 0 4px 4px 0; }
.limits-window { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.limits-window strong { font-size: 12px; }
.limits-meter { height: 6px; margin: 6px 0 2px; background: var(--bg-label); border-radius: 3px; overflow: hidden; }
.limits-meter span { display: block; height: 100%; background: var(--accent); }
.limits-window[data-status="fresh"] .limits-meter span { background: var(--map-passed); }
.limits-window[data-status="stale"] .limits-meter span,
.limits-window[data-status="expired"] .limits-meter span,
.limits-window[data-status="historical"] .limits-meter span { background: var(--line-alt); }
.limits-window[data-status="invalid"] strong, .limits-window[data-status="unknown"] strong { color: var(--map-attention); }

/* ------------------------------------------------------------------------
   Unio interface language (shared with the project website).
   Function first: nothing here adds information that is not in the data.
   - corners: nothing is square; groups of buttons round their outer corners
     more than the inner ones; only the brand badge is a pill
   - small labels and numbers in monospace capitals
   - one muted tone per agent (logos and card edges), never instead of the
     status colors, which keep their meaning
   ------------------------------------------------------------------------ */
:root {
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-out: 9px;
  /* agent tones, light theme: dark enough to read on light panels */
  --t-rust: #8b3b2d;
  --t-mustard: #8a682e;
  --t-sea: #2e6b5d;
  --t-steel: #455a73;
  --t-periwinkle: #344483;
  --t-lavender: #433285;
}
[data-theme="dark"] {
  --t-rust: #cb7f72;
  --t-mustard: #caaa72;
  --t-sea: #74b4a5;
  --t-steel: #91a2b6;
  --t-periwinkle: #8795c9;
  --t-lavender: #a094d1;
}

/* Hidden but announced (the theme label used this class without a rule). */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Header: the brand badge, sticky so Refresh and the mode stay in reach */
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 64px;
  background: color-mix(in srgb, var(--bg-main) 92%, transparent);
  backdrop-filter: blur(8px);
}
.brand {
  display: inline-flex; align-items: center; height: 30px; padding: 0 13px;
  border: 0; border-radius: 15px; background: var(--accent); color: var(--btn-primary-text);
}
.brand-logo { display: block; height: 15px; width: auto; }
h1 { font-family: var(--mono); font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* header controls keep the 44 px touch target */
#theme-selector {
  min-height: 44px; padding: 6px 10px; font-size: 13px;
  color: var(--text-main); background: var(--paper); border: 1px solid var(--btn-border);
}
.topbar-controls { gap: 10px; }

/* Small labels: monospace capitals */
.eyebrow, .mode-label, .state-label, .chip, .map-counts, #status, .map-legend,
.evidence-grid dt, #map-zoom-level, .limits-card h4, .limits-subtitle, .empty-mark {
  font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase;
}
.eyebrow { font-size: 11px; }
.mode-label, .state-label, .chip { font-size: 10.5px; font-weight: 650; }
.map-counts, #status, .map-legend, .evidence-grid dt, #map-zoom-level { font-size: 11px; }
.limits-subtitle { font-size: 12px; font-weight: 650; color: var(--muted); }

/* Corners */
button, input, textarea, .map-controls select, #theme-selector { border-radius: var(--r-sm); }
.composer, .selected-work, .map-container { border-radius: var(--r-md); }
.map-scroll-area, .limits-card, .limits-lead, pre, .warnings, .error { border-radius: var(--r-sm); }
.mode-label, .state-label, .chip { border-radius: var(--r-xs); }
#work-map [data-node-key] > rect { rx: 4px; }

/* Button groups: inner corners small, outer corners rounder */
:is(.view-switch, .map-camera-controls, .map-pagination, .console-tabs, .execution-actions) { gap: 4px; }
:is(.view-switch, .map-camera-controls, .map-pagination, .console-tabs, .execution-actions) > button { border-radius: var(--r-xs); }
:is(.view-switch, .map-camera-controls, .map-pagination, .console-tabs, .execution-actions) > button:first-of-type {
  border-top-left-radius: var(--r-out); border-bottom-left-radius: var(--r-out);
}
:is(.view-switch, .map-camera-controls, .map-pagination, .console-tabs, .execution-actions) > button:last-of-type {
  border-top-right-radius: var(--r-out); border-bottom-right-radius: var(--r-out);
}
.draft-reopen { gap: 4px; }
.draft-reopen input { border-radius: var(--r-out) var(--r-xs) var(--r-xs) var(--r-out); }
.draft-reopen button { border-radius: var(--r-xs) var(--r-out) var(--r-out) var(--r-xs); }
/* The chosen view or tab is shown inverted, like a selected menu item */
.view-switch button[aria-pressed="true"], .console-tabs button[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--btn-primary-text);
}

/* Agent cards: a header strip with the agent's tone on its edge */
.limits-card { padding: 0 14px 12px; transition: border-color .16s, box-shadow .16s; }
.limits-card h4 {
  margin: 0 -14px 10px; padding: 8px 14px; font-size: 11.5px; font-weight: 700;
  background: var(--bg-composer); border-bottom: 1px solid var(--line);
  border-radius: calc(var(--r-sm) - 1px) calc(var(--r-sm) - 1px) 0 0;
}
.limits-card:hover { border-color: var(--text-label); box-shadow: 0 0 0 1px var(--text-label); }
.limits-meter { border-radius: var(--r-xs); }

/* Hover: the thing under the pointer answers with a firmer edge */
.map-container .row, .limits-lead { transition: background-color .16s; }
.map-container .row:hover { background: var(--bg-composer); }
input:hover, textarea:hover, .map-controls select:hover, #theme-selector:hover { border-color: var(--btn-hover-border); }

/* One tone per agent. Map nodes carry the logo's mark name; cards carry the
   configured route name. */
[data-agent-mark="claude"], [data-route^="claude"], [data-agent-mark="minimax"] { --tone: var(--t-rust); }
[data-agent-mark="openai"], [data-route^="codex"], [data-route^="perplexity"] { --tone: var(--t-sea); }
[data-agent-mark="antigravity"], [data-agent-mark="gemini"], [data-route^="antigravity"],
[data-route^="gemini"], [data-agent-mark="deepseek"], [data-route^="deepseek"] { --tone: var(--t-periwinkle); }
[data-agent-mark="grok"], [data-route^="grok"], [data-agent-mark="opencode"], [data-route^="opencode"] { --tone: var(--t-steel); }
[data-agent-mark="kimi"], [data-route^="kimi"], [data-agent-mark="qwen"], [data-route^="qwen"] { --tone: var(--t-lavender); }
[data-agent-mark="zai"], [data-route^="glm"], [data-route^="vibe"], [data-route^="mistral"] { --tone: var(--t-mustard); }
#work-map [data-agent-mark] .node-logo { fill: var(--tone, var(--text-main)); }

/* Loading screen: the dot U assembles while the first observation is read,
   its dots drifting through the agent tones. Purely visual: it never takes
   clicks, it leaves as soon as the page has data, and it removes itself
   after a few seconds even if no data ever arrives. */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 20px;
  background: var(--bg-main); pointer-events: none;
  /* Safety exit if no script ever marks the page ready. It moves the screen
     away instead of fading it: sharing opacity/visibility with the fade
     below made Firefox hold the screen up until this ran. */
  animation: boot-away 0s linear 8s forwards;
}
.is-ready .boot { opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s .35s; }
@keyframes boot-away { to { transform: translateY(-100%); } }
.boot-field { display: grid; grid-template-columns: repeat(10, 14px); gap: 4px; }
.boot-field i { width: 14px; height: 14px; border-radius: 3px; background: var(--bg-composer); }
/* Each dot of the U waits dim like the field, then appears small and grows
   to full size. It grows by uncovering a full-size square (clip-path) rather
   than scaling it, so the edges stay crisp the whole time. Its colored layer
   already starts in a tone, so while the page is still busy loading a dot
   never shows up gray. */
.boot-field i { position: relative; }
.boot-field i.on::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--t-rust); opacity: 0;
  animation: boot-dot .2s ease-out forwards, boot-tone 3.6s linear infinite;
}
@keyframes boot-dot {
  from { opacity: 1; clip-path: inset(32% round 1px); }
  to { opacity: 1; clip-path: inset(0 round 3px); }
}
@media (prefers-reduced-motion: reduce) { .boot-field i.on::after { opacity: 1; clip-path: none; background: var(--accent); } }
@keyframes boot-tone {
  0%, 100% { background: var(--t-rust); } 16.6% { background: var(--t-mustard); } 33.3% { background: var(--t-sea); }
  50% { background: var(--t-steel); } 66.6% { background: var(--t-periwinkle); } 83.3% { background: var(--t-lavender); }
}
/* Dots switch on as a ring growing from the top-left dot of the U: each
   dot's delay follows its distance from there, with a little jitter. */
.boot-field i:nth-child(23)::after { animation-delay: 0ms, 0ms; }
.boot-field i:nth-child(33)::after { animation-delay: 97ms, 97ms; }
.boot-field i:nth-child(24)::after { animation-delay: 100ms, 100ms; }
.boot-field i:nth-child(34)::after { animation-delay: 140ms, 140ms; }
.boot-field i:nth-child(43)::after { animation-delay: 198ms, 198ms; }
.boot-field i:nth-child(44)::after { animation-delay: 227ms, 227ms; }
.boot-field i:nth-child(53)::after { animation-delay: 269ms, 269ms; }
.boot-field i:nth-child(54)::after { animation-delay: 316ms, 316ms; }
.boot-field i:nth-child(37)::after { animation-delay: 380ms, 380ms; }
.boot-field i:nth-child(27)::after { animation-delay: 401ms, 401ms; }
.boot-field i:nth-child(63)::after { animation-delay: 403ms, 403ms; }
.boot-field i:nth-child(47)::after { animation-delay: 409ms, 409ms; }
.boot-field i:nth-child(64)::after { animation-delay: 414ms, 414ms; }
.boot-field i:nth-child(73)::after { animation-delay: 462ms, 462ms; }
.boot-field i:nth-child(74)::after { animation-delay: 465ms, 465ms; }
.boot-field i:nth-child(28)::after { animation-delay: 476ms, 476ms; }
.boot-field i:nth-child(57)::after { animation-delay: 486ms, 486ms; }
.boot-field i:nth-child(38)::after { animation-delay: 487ms, 487ms; }
.boot-field i:nth-child(48)::after { animation-delay: 505ms, 505ms; }
.boot-field i:nth-child(75)::after { animation-delay: 515ms, 515ms; }
.boot-field i:nth-child(58)::after { animation-delay: 536ms, 536ms; }
.boot-field i:nth-child(76)::after { animation-delay: 537ms, 537ms; }
.boot-field i:nth-child(67)::after { animation-delay: 546ms, 546ms; }
.boot-field i:nth-child(84)::after { animation-delay: 559ms, 559ms; }
.boot-field i:nth-child(77)::after { animation-delay: 597ms, 597ms; }
.boot-field i:nth-child(85)::after { animation-delay: 601ms, 601ms; }
.boot-field i:nth-child(68)::after { animation-delay: 615ms, 615ms; }
.boot-field i:nth-child(86)::after { animation-delay: 637ms, 637ms; }
.boot-field i:nth-child(78)::after { animation-delay: 662ms, 662ms; }
.boot-field i:nth-child(87)::after { animation-delay: 702ms, 702ms; }

/* ---- Tasks, readable: summary, grouped list, plain states ---------------- */
.task-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 4px 0 18px; }
.task-summary button {
  display: grid; grid-auto-flow: column; justify-content: start; align-content: center; align-items: baseline; column-gap: 10px;
  min-height: 64px; padding: 10px 16px; text-align: left; background: var(--paper);
  border-radius: var(--r-xs);
}
.task-summary button:first-child { border-radius: var(--r-out) var(--r-xs) var(--r-xs) var(--r-out); }
.task-summary button:last-child { border-radius: var(--r-xs) var(--r-out) var(--r-out) var(--r-xs); }
.summary-count { font-family: var(--mono); font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.summary-name { font-family: var(--mono); font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.task-summary button[data-state="attention"] .summary-count { color: var(--map-attention); }
.task-summary button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.task-summary button[aria-pressed="true"] .summary-count, .task-summary button[aria-pressed="true"] .summary-name { color: var(--btn-primary-text); }

#tasks { display: grid; gap: 22px; margin-top: 6px; }
.task-group { display: grid; gap: 6px; }
.task-group-title {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px;
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.task-group-count { color: var(--text-main); }
.task-row.row {
  display: grid; gap: 10px 22px; align-items: center; padding: 14px 16px 10px;
  grid-template-columns: minmax(0, 1.5fr) auto minmax(150px, .7fr) minmax(0, 1.2fr);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .16s, box-shadow .16s;
}
.task-row:hover { border-color: var(--text-label); box-shadow: 0 0 0 1px var(--text-label); }
[data-signal="passed"] { --signal-color: var(--map-passed); }
[data-signal="failed"] { --signal-color: var(--map-failed); }
[data-signal="attention"] { --signal-color: var(--map-attention); }
[data-signal="active"] { --signal-color: var(--text-main); }
.task-main { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 12px; min-width: 0; }
.agent-badge { grid-row: span 2; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
.agent-logo { width: 24px; height: 24px; fill: var(--tone, var(--text-main)); }
.agent-logo text { fill: var(--tone, var(--text-main)); font-family: var(--mono); font-weight: 700; }
.agent-name { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.task-name { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.task-sentence { margin: 0; font-size: 13px; color: var(--muted); }
.task-row .task-sentence { font-size: 13px; }

.track { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.track li {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: var(--r-xs); color: var(--muted); white-space: nowrap;
}
.track li:first-child { border-radius: var(--r-out) var(--r-xs) var(--r-xs) var(--r-out); }
.track li:last-child { border-radius: var(--r-xs) var(--r-out) var(--r-out) var(--r-xs); }
.track li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid var(--line-alt); }
.track li[data-step="done"] { color: var(--text-main); }
.track li[data-step="done"]::before { background: var(--map-passed); border-color: var(--map-passed); }
.track li[data-step="failed"] { color: var(--text-main); }
.track li[data-step="failed"]::before { background: var(--map-failed); border-color: var(--map-failed); }
.track li[data-step="running"]::before { background: var(--text-main); border-color: var(--text-main); }
.track li[data-step="unknown"]::before { border-style: dashed; }

.task-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.state-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 8px; border-radius: var(--r-xs);
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-main); background: var(--bg-label);
}
/* status is a small square, like the Run / Checks / Review steps and the
   map legend; no colored edges on rows or cards */
.state-pill::before, .tool-pill::before, .timeline-time::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--signal-color, var(--line-alt));
}
.task-when { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.next-step { display: grid; gap: 4px; min-width: 0; }
.next-label { font-family: var(--mono); font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.next-line { display: flex; align-items: stretch; gap: 4px; min-width: 0; }
.next-line code {
  flex: 1; min-width: 0; display: flex; align-items: center; padding: 6px 10px; overflow-x: auto; white-space: nowrap;
  font-family: var(--mono); font-size: 12px; color: var(--text-main);
  background: var(--bg-pre); border: 1px solid var(--border-pre); border-radius: var(--r-out) var(--r-xs) var(--r-xs) var(--r-out);
}
.copy-command { min-height: 44px; padding: 6px 12px; border-radius: var(--r-xs) var(--r-out) var(--r-out) var(--r-xs); }

.task-tech { grid-column: 1 / -1; margin-top: -4px; }
.task-tech summary { min-height: 0; padding: 2px 0; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); width: max-content; }
.task-tech[open] { border-top: 1px solid var(--line); padding-top: 6px; }
.task-tech[open] summary { margin-bottom: 4px; }
.task-tech p { margin: 0 0 4px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

/* details panel: the same plain summary first */
.task-brief { display: grid; gap: 10px; margin: 14px 0 16px; padding: 14px; background: var(--bg-composer); border-radius: var(--r-sm); }
.task-brief .track { flex-wrap: wrap; }
.map-details .task-tech { border-top: 1px solid var(--line); }

@media (max-width: 1200px) {
  .task-row.row { grid-template-columns: minmax(0, 1fr) auto; }
  .task-row .track { grid-column: 1 / -1; grid-row: 2; }
  .task-row .next-step { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .task-summary { grid-template-columns: minmax(0, 1fr); }
  .task-summary button { min-height: 52px; }
  .task-summary button:first-child { border-radius: var(--r-out) var(--r-out) var(--r-xs) var(--r-xs); }
  .task-summary button:last-child { border-radius: var(--r-xs) var(--r-xs) var(--r-out) var(--r-out); }
  .task-row.row { grid-template-columns: minmax(0, 1fr); }
  .task-row .task-status { flex-direction: row; align-items: center; gap: 10px; }
  .track { flex-wrap: wrap; }
}

/* ---- Agents & limits: one card per agent ---------------------------------- */
.limits-caveat { margin: -6px 0 14px; color: var(--muted); }
.limits-routes { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.limits-groups { gap: 6px; }
.limits-card h4 { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 13px; }
.limits-card h4 .agent-badge { flex-direction: row; min-width: 0; gap: 8px; }
.limits-card h4 .agent-logo { width: 18px; height: 18px; }
.limits-card h4 .agent-name { font-size: 12.5px; font-weight: 700; color: var(--text-main); text-transform: none; }
.limits-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.limits-tags .chip { margin: 0; }
.limits-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.limits-facts > div { display: contents; }
.limits-facts dt { font-family: var(--mono); font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.limits-facts dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.limits-allowance { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.limits-allowance-title { margin: 0 0 2px; font-family: var(--mono); font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.limits-allowance .limits-window:first-of-type { border-top: 0; margin-top: 0; padding-top: 2px; }
.limits-card > p.small { margin-top: 10px; }

/* ---- Activity timeline --------------------------------------------------- */
.timeline { display: grid; gap: 2px; margin: 4px 0 12px; }
.timeline-day { margin: 12px 0 4px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.timeline-day:first-child { margin-top: 0; }
.timeline-row {
  display: grid; grid-template-columns: 62px 104px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 6px 12px; border-radius: var(--r-sm); background: var(--paper);
}
.timeline-row[data-tone="passed"] { --signal-color: var(--map-passed); }
.timeline-row[data-tone="failed"] { --signal-color: var(--map-failed); }
.timeline-row[data-tone="attention"] { --signal-color: var(--map-attention); }
.timeline-time { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.timeline-row .agent-badge { grid-row: auto; flex-direction: row; gap: 6px; min-width: 0; }
.timeline-row .agent-logo { width: 16px; height: 16px; }
.timeline-text { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.timeline-warning { grid-template-columns: 88px minmax(0, 1fr); --signal-color: var(--map-attention); }
.timeline-warning .timeline-time { color: var(--map-attention); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.timeline-task { margin-right: 8px; font-weight: 650; }
.log-more { justify-self: start; min-height: 44px; margin-top: 6px; padding: 6px 14px; }
.raw-data > summary { font-size: 12px; }

/* ---- Drawers: Tools and limits, Activity log ------------------------------
   A label like every other section label; when closed it still says
   whether it is worth opening. */
.drawer > summary { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.drawer-count { margin-left: 12px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.drawer-count[data-tone="attention"] { color: var(--map-attention); }
.drawer-note { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.tools { display: grid; gap: 2px; margin: 0 0 14px; }
.tool-row {
  display: grid; grid-template-columns: 104px minmax(120px, 220px) minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: var(--r-sm); background: var(--paper);
}
.tool-row[data-tone="failed"] { --signal-color: var(--map-failed); }
.tool-row[data-tone="attention"] { --signal-color: var(--map-attention); }
.tool-row .agent-badge { grid-row: auto; flex-direction: row; gap: 6px; min-width: 0; }
.tool-row .agent-logo { width: 16px; height: 16px; }
.tool-name { font-size: 13px; overflow-wrap: anywhere; }
.tool-detail { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tool-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 8px; border-radius: var(--r-xs); white-space: nowrap;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-main); background: var(--bg-label);
}
@media (max-width: 720px) {
  .tool-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tool-row .agent-badge { display: none; }
  .tool-detail { grid-column: 1 / -1; grid-row: 2; }
}
.raw-data pre { max-height: 360px; overflow: auto; }

/* ---- Map: the how-to stays out of the way until asked for ----------------- */
/* "?" at the end of the map controls: the how-to opens above the controls
   on hover or keyboard focus, and a click or tap keeps it open */
.map-help-wrap { display: flex; }
.map-help {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 4;
  width: max-content; max-width: min(440px, calc(100vw - 48px)); margin: 0; padding: 12px 14px;
  font-size: 12.5px; line-height: 1.55; color: var(--text-main);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm);
  visibility: hidden; opacity: 0; transition: opacity .12s, visibility 0s .12s;
}
.map-help-wrap:hover .map-help, .map-help-wrap:focus-within .map-help, .map-help-wrap.is-open .map-help {
  visibility: visible; opacity: 1; transition: opacity .12s;
}

/* ---- Phones: filters two to a row instead of one long column -------------- */
@media (max-width: 720px) {
  .task-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .task-filters select, .task-filters input[type="search"] { min-width: 0; }
  .task-filters #map-reset-filters, .task-filters .map-counts { grid-column: 1 / -1; }
  .timeline-row { grid-template-columns: 62px minmax(0, 1fr); }
  .timeline-row .agent-badge { display: none; }
}

/* ---- Worker filter: each worker with its lab's logo -------------------------
   Uses the browser's customizable select where available (a real <select>,
   so keyboard, screen readers and forms behave as before). */
@supports (appearance: base-select) {
  #map-worker-filter, #map-worker-filter::picker(select) { appearance: base-select; }
  #map-worker-filter { display: flex; align-items: center; gap: 8px; }
  #map-worker-filter::picker(select) {
    max-height: min(60vh, 520px); padding: 4px; margin-top: 4px;
    background: var(--paper); color: var(--text-main);
    border: 1px solid var(--line-alt); border-radius: var(--r-sm);
  }
  #map-worker-filter option {
    display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px;
    border-radius: var(--r-xs); font-size: 13px;
  }
  #map-worker-filter option:hover, #map-worker-filter option:focus-visible { background: var(--btn-hover-bg); }
  #map-worker-filter option:checked { background: var(--bg-label); font-weight: 650; }
  #map-worker-filter option::checkmark { display: none; }
  #map-worker-filter .option-logo { flex: none; width: 18px; height: 18px; fill: var(--tone, var(--text-main)); }
}

/* ---- Footer: its own full-width band ------------------------------------- */
:root { --footer-bg: #e6e6e6; }
[data-theme="dark"] { --footer-bg: #151515; }
.page-footer {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  margin: 48px calc(-1 * var(--page-pad)) -24px; padding: 20px var(--page-pad) 22px;
  background: var(--footer-bg); border-top: 1px solid var(--line-alt);
  font-size: 12px; color: var(--muted);
}
.page-footer #mode-footer { margin: 0; max-width: 100ch; font-size: 12px; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 14px; border-top: 1px solid var(--line); }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; font-weight: 650; letter-spacing: .02em; color: var(--text-label); }
.footer-mark { width: auto; height: 16px; fill: currentColor; }
.page-footer nav { display: flex; gap: 4px; }
.page-footer nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--btn-border); border-radius: var(--r-xs); background: transparent;
  color: var(--text-label); text-decoration: none; font-size: 12px; font-weight: 600;
}
.page-footer nav a:first-child { border-radius: var(--r-out) var(--r-xs) var(--r-xs) var(--r-out); }
.page-footer nav a:last-child { border-radius: var(--r-xs) var(--r-out) var(--r-out) var(--r-xs); }
.page-footer nav a:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); color: var(--text-main); }
@media (max-width: 720px) {
  .page-footer { margin-bottom: -20px; }
  .footer-row { flex-direction: column; align-items: flex-start; }
}

/* ---- Task rows: every row shares the same columns ------------------------ */
.task-row.row { grid-template-columns: minmax(0, 1fr) 272px 176px 340px; }
.task-main { grid-template-columns: 40px minmax(0, 1fr); }
.agent-badge.logo-only { min-width: 0; width: 40px; }
.agent-badge.logo-only .agent-logo { width: 26px; height: 26px; }
.agent-badge.logo-only .agent-name {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* Run / Checks / Review: the same three widths in every row */
.track { display: grid; grid-template-columns: 62px 112px 90px; gap: 4px; }
.track li { justify-content: flex-start; min-width: 0; }
.next-step { width: 100%; }
@media (max-width: 1200px) {
  .task-row.row { grid-template-columns: minmax(0, 1fr) 176px; }
  .task-row .track { grid-column: 1 / -1; grid-row: 2; }
  .task-row .next-step { grid-column: 1 / -1; max-width: 520px; }
}
@media (max-width: 720px) {
  .task-row.row { grid-template-columns: minmax(0, 1fr); }
  .track { grid-template-columns: 62px 112px 90px; }
}
.task-row.row { grid-template-columns: minmax(0, 1fr) calc(272px + clamp(16px, 2vw, 40px)) 176px 384px; }
/* a long command wraps instead of being cut off; Copy takes it whole */
.next-line code { white-space: normal; overflow-wrap: anywhere; overflow-x: visible; }
@media (max-width: 1200px) { .task-row.row { grid-template-columns: minmax(0, 1fr) 176px; } }
@media (max-width: 720px) { .task-row.row { grid-template-columns: minmax(0, 1fr); } }

/* ---- Worker filter: the chosen worker's logo inside the closed control ---- */
.worker-filter { position: relative; display: flex; flex: 1 1 160px; min-width: 0; }
.worker-filter select { flex: 1; width: 100%; }
.worker-filter-logo { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: flex; pointer-events: none; z-index: 1; }
.worker-filter-logo .option-logo { width: 18px; height: 18px; fill: var(--tone, var(--text-main)); }
.worker-filter.has-logo select { padding-left: 38px; }
@media (max-width: 720px) { .worker-filter { flex-basis: auto; } }

/* ---- Agent cards: balanced rows (columns set from the card count) --------- */
.limits-routes, .limits-groups { grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }
.view-switch button, .task-summary .summary-name, .state-pill, .track li { white-space: nowrap; }
.view-switch { flex: none; }

/* Before the theme script runs, follow the system: in dark mode the page
   paints dark from the first frame instead of flashing light. Same values as
   [data-theme="dark"]; work_map_browser.cjs checks the two never drift. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --text-main: #e8e8e8;
    --bg-main: #1c1c1c;
    --map-bg: #0d0d0d;
    --muted: #a6a6a6;
    --line: #3d3d3d;
    --accent: #d2d2d2;
    --paper: #252525;
    --bg-label: #333333;
    --text-label: #c4c4c4;
    --bg-composer: #2b2b2b;
    --btn-border: #686868;
    --btn-text: #e8e8e8;
    --btn-hover-bg: #3d3d3d;
    --btn-hover-border: #8b8b8b;
    --btn-primary-hover: #eeeeee;
    --btn-danger-text: #eeeeee;
    --btn-danger-border: #858585;
    --btn-danger-hover: #383838;
    --btn-disabled-bg: #2e2e2e;
    --btn-disabled-text: #888888;
    --btn-disabled-border: #464646;
    --btn-primary-text: #1c1c1c;
    --focus-ring: #e2e2e2;
    --text-placeholder: #a0a0a0;
    --line-alt: #555555;
    --text-error: #eeeeee;
    --bg-error: #383838;
    --border-error: #a0a0a0;
    --bg-pre: #222222;
    --border-pre: #3b3b3b;
    --text-summary: #b4b4b4;
    --text-stage: #a6a6a6;
    --text-stage-help: #bdbdbd;
    --text-warn: #dddddd;
    --bg-warn: #383838;
    --text-status: #b4b4b4;
    --text-chip: #c4c4c4;
    --bg-chip-warn: #383838;
    --text-chip-warn: #dddddd;
    --map-passed: #7acb7d;
    --map-failed: #f86b60;
    --map-attention: #e1aa40;
    --t-rust: #cb7f72;
    --t-mustard: #caaa72;
    --t-sea: #74b4a5;
    --t-steel: #91a2b6;
    --t-periwinkle: #8795c9;
    --t-lavender: #a094d1;
    --footer-bg: #151515;
  }
}
