/* ==========================================================================
   FT AI Test Agent — UI skin. One accent (the Friendly Technologies blue), flat
   surfaces separated by 1px lines, IBM Plex for text and IBM Plex Mono for
   anything an operator compares by eye (case IDs, TR-181 paths, durations,
   runner output). Colour is reserved for run state; everything else is type,
   alignment and density. No text below 11px anywhere.
   ========================================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* palette */
  --ground: #F3F5F7; --surface: #FFFFFF; --surface-2: #EAEEF2; --surface-3: #DDE3E9;
  --line: #D9DFE5; --line-2: #C7CFD8;
  --ink: #16202B; --ink-2: #4A5866; --ink-3: #7A8794;
  --accent: #2B6EAC; --accent-ink: #1F4F7D; --accent-soft: #E4EEF7;
  --pass: #1F8A4C; --pass-soft: #E3F3E9;
  /* Trend chart pair: --pass/--fail side by side fail the colour-blind check (deutan dE 4.7);
     this pair differs in lightness and passes the dataviz palette validator on the light surface. */
  --chart-pass: #38A56B; --chart-fail: #B23028;
  --fail: #C93A32; --fail-soft: #FBE7E5;
  --warn: #B7791F; --warn-soft: #FBF1DC;
  --blocked: #6B7280; --blocked-soft: #ECEEF1;
  --violet: #6B4FB3; --violet-soft: #EEE9F8;
  /* type */
  --sans: 'IBM Plex Sans', 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, 'Cascadia Code', monospace;
  /* shape */
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-pill: 3px;
  --shadow-sm: none;
  --shadow-md: 0 8px 24px rgba(22, 32, 43, 0.12);
  --transition: 0.15s ease;
  /* Legacy names. The templates still reference these; they resolve to the
     palette above so an old inline style lands on the new skin unchanged. */
  --blue: var(--accent); --blue-hover: var(--accent-ink); --blue-light: var(--accent-soft);
  --green: var(--pass); --green-bg: var(--pass-soft); --green-dark: var(--pass);
  --red: var(--fail); --red-bg: var(--fail-soft); --red-dark: var(--fail); --red-light: var(--fail-soft); --red-600: var(--fail);
  --amber: var(--warn); --amber-bg: var(--warn-soft); --amber-dark: var(--warn);
  --purple: var(--violet);
  --gray-50: var(--ground); --gray-100: var(--surface-2); --gray-200: var(--line); --gray-300: var(--line-2);
  --gray-400: var(--ink-3); --gray-500: var(--ink-3); --gray-600: var(--ink-2); --gray-700: var(--ink-2); --gray-900: var(--ink);
  --white: var(--surface);
  --font: var(--sans);
  --card-bg: var(--surface); --card-border: var(--line);
}

/* --- test management: runs --- */
/* The name a wave is started under, typed next to Run Selected. */
.rc-name { width: 168px; }
/* Four TestRail-style tiles instead of six raw counts, each carrying its
   share of the whole wave next to the label. */
.bsum.bsum-4 { grid-template-columns: repeat(4, 1fr); }
.bsum.bsum-5 { grid-template-columns: repeat(5, 1fr); }
/* Where the non-green runs broke (spec 2026-10-06): tiles, then the grouped broken steps. */
.brk { margin-top: 8px; }
.bsum.bsum-brk { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.brk-head { font-weight: 600; margin: 8px 0 4px; }
.brk-table { width: 100%; }
.brk-deferred { margin: 8px 0; }
.brk-case { margin-left: 8px; }
.brk-pill { margin-left: 4px; font-size: 11px; }
.bsum i { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bsum-line { display: flex; align-items: baseline; gap: 10px; margin: -6px 0 14px; font-size: 13px; }
.bsum-line b { font-weight: 600; color: var(--ink); }
/* What a wave is called, next to the report title and on the wave card. */
.batch-scope, .wave-scope { font-size: 12px; }
.wave-name { font-weight: 600; color: var(--ink); }
.export-menu { display: inline-flex; align-items: center; gap: 4px; }
.export-menu .dim { font-size: 12px; }
/* Batch list: the name column carries the project/section under it. */
.cell-batch-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cell-batch-name .cell-sub { display: block; font-size: 11px; font-weight: 400; }
.cell-build { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
/* Per-row comment and defects: read as one line, edited in place. */
.col-notes { width: 178px; }
.cell-notes { white-space: normal; }
.notes-read { display: flex; align-items: center; gap: 6px; min-width: 0; }
.notes-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-ref { font-family: var(--mono); font-size: 11px; }
.notes-edit { display: flex; align-items: center; gap: 4px; }
.notes-edit .form-input { min-width: 0; flex: 1; }
tr:hover .cell-notes .row-edit, .cell-notes .row-edit:focus-visible { opacity: 1; }
/* Comments on the report as a whole. */
.bcomments { margin-top: 16px; padding: 12px; background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.bcomments-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.bcomments-head .dim { font-weight: 400; }
.bcomments-list { list-style: none; display: grid; gap: 6px; }
.bcomments-list li { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.bc-who { font-weight: 600; color: var(--ink-2); }
.bc-when { font-size: 11px; white-space: nowrap; }
.bc-text { flex: 1; min-width: 0; text-wrap: pretty; }
.bcomments-add { display: flex; gap: 6px; margin-top: 10px; }
.bcomments-add .form-input { flex: 1; min-width: 0; }
/* "Edit run": two columns — the live queue, and what may be added to it. */
.modal-card.eb-card { max-width: min(880px, 92vw); }
.eb-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.eb-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.eb-head { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.eb-list { list-style: none; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.eb-list li { border-bottom: 1px solid var(--line); }
.eb-list li:last-child { border-bottom: none; }
.eb-list label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 12px; cursor: pointer; min-width: 0; }
.eb-list .q-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.eb-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.eb-foot .dim { margin-right: auto; font-size: 12px; }
/* A file input that only its own button ever opens. */
.tm-file { display: none; }
/* Stacking order of the three layers, top last: an ordinary modal (1000), a
   dialog that must stay reachable above a panel or another modal (.modal-top,
   1200), and the decision dialog (1300), which is asked FROM those and so must
   paint over every one of them. It used to be a plain .modal-overlay: opened
   from "Edit run" (.modal-top) it was invisible behind it, and opened from the
   batch report — same z-index, declared later in the DOM — it lost there too,
   so the next click landed on @click.outside and declined the question nobody
   had seen. */
.modal-overlay.modal-decision { z-index: 1300; }

/* Dark theme: the same token names, night values. The bare :root is the light
   default; <html data-theme="dark"> is stamped by the stored choice or, with none, by the OS. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0F151B; --surface: #161E26; --surface-2: #1D2731; --surface-3: #26323E;
  --line: #2A3542; --line-2: #37455A;
  --ink: #E6EBF0; --ink-2: #A9B4BF; --ink-3: #7C8894;
  --accent: #6FA8DC; --accent-ink: #9CC4EA; --accent-soft: #1B2E42;
  --pass: #5CC489; --pass-soft: #163224;
  --chart-pass: #43AA71; --chart-fail: #C0463D;
  --fail: #F07A72; --fail-soft: #3C1F1D;
  --warn: #E0B15A; --warn-soft: #3A2E15;
  --blocked: #9AA3AE; --blocked-soft: #232B34;
  --violet: #A48BE0; --violet-soft: #2A2340;
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-run, :root[data-theme="dark"] .login-btn { color: #0F151B; }

[x-cloak] { display: none !important; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--sans); font-size: 13px; line-height: 1.45;
  background: var(--ground); color: var(--ink); min-height: 100vh;
}
a { color: var(--accent); }
button, input, select, textarea { font-family: inherit; }
::placeholder { color: var(--ink-3); opacity: 1; }
code, pre, .mono { font-family: var(--mono); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Icons: one inline sprite, drawn with the current text colour. */
.ico {
  width: 14px; height: 14px; flex-shrink: 0; vertical-align: -2px;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ico-lg { width: 18px; height: 18px; }

/* Header */
.header { position: sticky; top: 0; z-index: 100; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: none; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
/* Brand mark: the seahorse from /favicon.svg, same on both themes. */
.logo-mark { width: 28px; height: 28px; flex-shrink: 0; display: block; }
.header-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.header-sub { font-size: 11px; color: var(--ink-3); }
.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Header tabs */
.header-tabs { max-width: 1400px; margin: 0 auto; padding: 4px 24px 0; display: flex; gap: 2px; overflow-x: auto; }
.header-tab {
  padding: 8px 12px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition-property: color, border-bottom-color; transition-duration: 0.15s; transition-timing-function: ease;
  display: flex; align-items: center; gap: 6px;
}
.header-tab:hover { color: var(--ink); }
.header-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Status chips (header, toolbars) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.4;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink-2); background: var(--surface); white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.chip .dot.ok { background: var(--pass); }
.chip .dot.bad { background: var(--fail); }
.chip .dot.busy { background: var(--warn); }
.chip strong { color: var(--ink); font-weight: 500; }
/* The × on the header chip that stops the Live browser tab following your runs. */
.chip-x {
  border: 0; background: none; padding: 0 0 0 2px; margin: 0; cursor: pointer;
  color: var(--ink-3); font-size: 14px; line-height: 1;
}
.chip-x:hover { color: var(--ink); }

/* Main */
.main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 48px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 16px;
}
.card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px; }

/* Pills: state only. Coloured ones carry a dot so the state reads without colour. */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; border-radius: var(--radius-pill); line-height: 1.5; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.pill-green { background: var(--pass-soft); color: var(--pass); }
.pill-red { background: var(--fail-soft); color: var(--fail); }
.pill-amber { background: var(--warn-soft); color: var(--warn); }
.pill-blue { background: var(--accent-soft); color: var(--accent); }
.pill-gray { background: var(--surface-2); color: var(--ink-2); }
.pill-blocked { background: var(--blocked-soft); color: var(--blocked); }
.pill-green::before, .pill-red::before, .pill-amber::before, .pill-blue::before, .pill-blocked::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}

/* Buttons */
.btn-primary, .btn-run {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm); line-height: 1.3;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition-property: background-color, border-color, transform; transition-duration: 0.15s;
}
.btn-run { height: 30px; padding: 0 14px; font-size: 12px; }
.btn-primary:hover:not(:disabled), .btn-run:hover:not(:disabled) { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-primary:active:not(:disabled), .btn-run:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled, .btn-run:disabled { background: var(--surface-3); border-color: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }

.btn-outline, .btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--radius-sm); line-height: 1.4;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition-property: color, border-color, background-color; transition-duration: 0.15s;
}
.btn-outline:hover:not(:disabled), .btn:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
.btn-outline:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 3px 8px; font-size: 11px; }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--radius-sm); line-height: 1.4;
  border: 1px solid var(--fail); background: var(--fail); color: #fff;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition-property: background-color, border-color; transition-duration: 0.15s;
}
.btn-danger:hover { background: #A92E27; border-color: #A92E27; }

/* Rows inside a dropdown menu (bulk-delete list). */
.menu-item {
  display: block; width: 100%; text-align: left; padding: 6px 12px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--ink-2);
  transition-property: background-color; transition-duration: 0.15s;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item-danger { padding: 8px 12px; color: var(--fail); font-weight: 500; }
.menu-item-danger:hover { background: var(--fail-soft); }

/* Spinner */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  margin-right: 6px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Case rows (Tests, Drafts, Editor list) */
.test-list { list-style: none; }
.test-item {
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: background var(--transition);
}
.test-item:hover, .hover-row:hover { background: var(--ground); }
.test-item:last-child { border-bottom: none; }
.test-item-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.test-id { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--accent-ink); white-space: nowrap; }
.test-title { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 12px; color: var(--ink-3); }
.test-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.test-item-main .test-meta { flex-wrap: wrap; flex-shrink: 1; }
.test-steps { font-size: 12px; color: var(--ink-3); }
/* Plain-text facts of a case (portal · type · priority · steps); a pill is kept for state only. */
.test-facts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-size: 12px; color: var(--ink-3); }
.test-facts > span + span::before { content: '\00B7'; margin-right: 6px; color: var(--line-2); }
.prio-critical { color: var(--fail); font-weight: 500; }
.prio-high { color: var(--warn); font-weight: 500; }
.test-item .test-checkbox { flex-shrink: 0; cursor: pointer; accent-color: var(--accent); margin: 0; width: 15px; height: 15px; }

/* Run controls */
.run-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--ground);
}
.run-controls select {
  padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 12px; background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.run-controls label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.run-controls > .rc-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.card-header .header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.card-header .header-actions select,
.card-header .header-actions .btn-outline,
.card-header .header-actions .btn-run { height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12px; box-sizing: border-box; }
.card-header .header-actions select {
  padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.card-header .header-actions select.rc-env-unset { border-color: var(--warn); }
.run-controls select, .run-controls input[type="text"], .run-controls .btn-outline {
  height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12px; box-sizing: border-box;
}
.run-controls select { max-width: 200px; }

/* Output area */
.output-area {
  padding: 12px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
  max-height: 500px; overflow-y: auto; background: var(--ground);
}

/* Steps result */
.step-result { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.step-result:last-child { border-bottom: none; }
.step-num { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-3); min-width: 48px; padding-top: 2px; }
.step-text { font-size: 13px; color: var(--ink); flex: 1; }
.step-mark { width: 16px; display: inline-flex; justify-content: center; align-items: center; padding-top: 2px; color: var(--ink-3); }
.step-mark .ico { width: 14px; height: 14px; stroke-width: 2.4; vertical-align: 0; }
.step-mark.pass { color: var(--pass); }
.step-mark.fail { color: var(--fail); }
.step-mark.skip { color: var(--warn); }
/* A claim the run could not measure (evidence_gate) — amber like the run-level
   INCONCLUSIVE pill, never the green of a verdict nobody reached. */
.step-mark.inconclusive { color: var(--warn); }
.step-mark.executed { color: var(--ink-3); }
.step-mark.pending { color: var(--line-2); }
/* A step the browser is on right now (live progress hook) */
.step-spin {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* Dashboard metrics */
.metrics-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 800px) { .metrics-row { grid-template-columns: repeat(2, 1fr); } }
.metric-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px 12px; text-align: left; display: flex; flex-direction: column; gap: 4px;
}
.metric-label { order: -1; margin: 0; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.metric-value { font-size: 24px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; line-height: 1.15; }

/* Phase stepper */
.phase-stepper { display: flex; align-items: center; padding: 10px 16px; gap: 4px; background: var(--ground); border-bottom: 1px solid var(--line); }
.phase-step { display: flex; align-items: center; gap: 6px; flex: 1; font-size: 12px; color: var(--ink-3); }
.phase-step.active { color: var(--accent); font-weight: 500; }
.phase-step.completed { color: var(--pass); }
.phase-dot {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
}
.phase-dot .ico { width: 11px; height: 11px; stroke-width: 3; vertical-align: 0; }
.phase-step.active .phase-dot { border-color: var(--accent); background: var(--accent-soft); }
.phase-step.completed .phase-dot { border-color: var(--pass); background: var(--pass-soft); color: var(--pass); }
.phase-label { white-space: nowrap; }

/* MCP Log */
.mcp-log-area { padding: 10px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.7; max-height: 500px; overflow-y: auto; background: var(--ground); }
.mcp-line { padding: 2px 8px; border-radius: 3px; margin-bottom: 2px; white-space: pre-wrap; word-break: break-word; }
.mcp-line-click { background: var(--accent-soft); color: var(--accent-ink); }
.mcp-line-snapshot { background: var(--surface-2); color: var(--ink-2); }
.mcp-line-run-code { background: var(--pass-soft); color: var(--pass); }
.mcp-line-navigate { background: var(--warn-soft); color: var(--warn); }
.mcp-line-type { background: var(--violet-soft); color: var(--violet); }
.mcp-line-default { background: var(--surface-2); color: var(--ink-2); }

/* Sub-tabs for right panel */
.sub-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.sub-tab {
  padding: 8px 14px; border: none; background: none;
  font-size: 12px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition-property: color, border-bottom-color; transition-duration: 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.sub-tab:hover { color: var(--ink); }
.sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sub-tab-badge { background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 3px; line-height: 1.5; }

/* Runner grid */
.runner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .runner-grid { grid-template-columns: 1fr; } }

/* Editor */
.editor-grid { display: grid; grid-template-columns: 440px 1fr; gap: 16px; }
@media (max-width: 800px) { .editor-grid { grid-template-columns: 1fr; } }
.active-item { background: var(--accent-soft) !important; }
.editor-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row > .form-group { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.form-input {
  padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink); background: var(--surface); line-height: 1.4;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#settings-tab .form-group { margin-bottom: 14px; }
#settings-tab .form-row { margin-bottom: 14px; }
#settings-tab .form-row > .form-group { margin-bottom: 0; }
.step-editor {
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md);
  margin-bottom: 8px; background: var(--ground); display: flex; flex-direction: column;
}
.step-editor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(22, 32, 43, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); width: 90%; max-width: 1200px;
}
.modal-card .card-body textarea { width: 100%; box-sizing: border-box; }

/* Login: the same system as the app, one card on the ground colour. */
.login-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: var(--ground); }
.login-card { width: 380px; max-width: 92vw; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px 32px 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.login-app { margin: 6px 0 22px; font-size: 13px; color: var(--ink-3); }
.login-input {
  display: block; width: 100%; height: 38px; margin-bottom: 10px; padding: 0 12px;
  font-size: 13px; color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-btn {
  width: 100%; height: 38px; margin-top: 6px; border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.login-btn:hover { background: var(--accent-ink); }
.login-err { margin: 12px 0 0; text-align: center; color: var(--fail); font-size: 12px; }

/* Toasts: the single feedback channel. Bottom-right, newest at the bottom, above modals. */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
  width: min(440px, calc(100vw - 40px)); pointer-events: none;
}
.toast-item {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  box-shadow: var(--shadow-md); font-size: 13px; line-height: 1.45; color: var(--ink);
  white-space: pre-line; word-break: break-word; animation: toastIn 0.2s ease-out;
}
.toast-error { border-left-color: var(--fail); }
.toast-success { border-left-color: var(--pass); }
.toast-info { border-left-color: var(--accent); }
.toast-warn { border-left-color: var(--warn); }
.toast-text { flex: 1; min-width: 0; text-wrap: pretty; }
.toast-close {
  flex-shrink: 0; width: 32px; height: 32px; margin: -6px -6px -6px 0;
  border: none; background: none; cursor: pointer; color: var(--ink-3);
  border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center;
  transition-property: color, background-color; transition-duration: 0.15s;
}
.toast-close:hover { color: var(--ink); background: var(--surface-2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Empty / loading / error placeholders: one look, an icon and (where it makes sense) one action. */
.list-state, .empty {
  padding: 36px 20px; text-align: center; color: var(--ink-3); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-wrap: pretty;
}
.list-state .ico, .empty .ico { width: 26px; height: 26px; stroke-width: 1.5; color: var(--line-2); }
.list-state-error { color: var(--fail); }
.list-state .btn-outline, .empty .btn-outline, .empty .btn-primary { margin-top: 4px; }

/* Tables: the one data-table component. */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 8px 12px; white-space: nowrap;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500;
  background: var(--ground); border-bottom: 1px solid var(--line);
}
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--ground); }
.table .row-link { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { font-family: var(--mono); font-size: 12px; }
.table .dim { color: var(--ink-3); }
.table .cell-title { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .empty-cell { padding: 28px 12px; text-align: center; color: var(--ink-3); }
.table-compact th, .table-compact td { padding: 5px 10px; }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- Shell --- */
:root { --header-h: 53px; }
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.shell.nav-collapsed { grid-template-columns: 56px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h));
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 12px 10px 10px; overflow-y: auto; overflow-x: hidden;
}
.nav { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; padding: 0 10px 4px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px;
  border: none; background: none; border-radius: var(--radius-sm); color: var(--ink-2);
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
  transition-property: background-color, color; transition-duration: 0.12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item .ico { width: 15px; height: 15px; vertical-align: 0; }
.nav-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.nav-count.live { color: var(--accent); font-weight: 500; }
.nav-collapse { margin-top: 12px; color: var(--ink-3); }
.nav-collapsed .nav-text, .nav-collapsed .nav-label, .nav-collapsed .nav-count { display: none; }
.nav-collapsed .nav-item { justify-content: center; padding: 8px; }
.nav-collapsed .sidebar { padding-left: 8px; padding-right: 8px; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 56px minmax(0, 1fr); }
  .sidebar .nav-text, .sidebar .nav-label, .sidebar .nav-count { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 8px; }
  .nav-collapse { display: none; }
}
/* A grid item with auto margins stops stretching; the column is the width. */
.main { max-width: none; min-width: 0; margin: 0; padding: 20px 24px 48px; }

/* ------------------------------------------------------------ Dashboard --- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px 10px; display: grid; gap: 3px; }
.kpi-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; }
.kpi-delta.up { color: var(--pass); }
.kpi-delta.down { color: var(--fail); }
.kpi-spark { width: 100%; height: 30px; margin-top: 4px; }
.kpi-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.kpi-spark polygon { fill: var(--accent); opacity: 0.12; }

/* ----------------------------------------------------------------- Runs --- */
.run-progress { height: 4px; background: var(--surface-2); position: relative; }
.run-progress i { position: absolute; inset: 0 auto 0 0; background: var(--accent); transition: width 0.3s ease; }

/* --------------------------------------------------------------- Editor --- */
.editor-grid { align-items: start; }
.editor-side { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); display: flex; flex-direction: column; }
.editor-list { overflow-y: auto; flex: 1; min-height: 140px; }
.editor-main { overflow: visible; }
.editor-main > .card-header { position: sticky; top: var(--header-h); z-index: 5; background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.editor-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-anchor { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 4px 0;
}
.menu .menu-item { display: flex; align-items: center; gap: 8px; }
.menu-sep { border-top: 1px solid var(--line); margin: 4px 0; }
.steps-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.steps-head .sp { flex: 1; }
.step-editor-header { gap: 8px; }
.step-toggle {
  width: 24px; height: 24px; border: none; background: none; cursor: pointer; color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; flex-shrink: 0;
}
.step-toggle:hover { background: var(--surface-2); color: var(--ink); }
.step-toggle .ico, .toggle-ico { transition: transform 0.15s ease; vertical-align: 0; }
.step-toggle .ico.open, .toggle-ico.open { transform: rotate(90deg); }
.step-label { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.step-summary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-2); }
.step-body { display: flex; flex-direction: column; }
.step-editor > .step-editor-header { margin-bottom: 0; }
.step-editor > .step-body { margin-top: 8px; }

/* ------------------------------------------------------------- Settings --- */
.settings-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } .settings-index { display: none; } }
.settings-index { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.settings-index a { padding: 5px 10px; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-size: 13px; }
.settings-index a:hover { background: var(--surface-2); color: var(--ink); }
.settings-index a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.settings-body { min-width: 0; }
.settings-section { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.card-open { overflow: visible; }
.settings-actions {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 16px -20px -20px; padding: 12px 20px;
  background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ------------------------------------------------------------ Utilities ---
   The handful of inline styles that appeared dozens of times, as classes.
   New markup uses these; tests/test_ui_skin.py ratchets the inline count. */
.hint { font-size: 11px; color: var(--ink-3); }
.hint-accent { font-size: 11px; color: var(--accent-ink); font-weight: 600; }
.muted { color: var(--ink-3); font-weight: 400; }
.dim { color: var(--ink-3); }
.small { font-size: 11px; }
.text-sm { font-size: 12px; }
.italic { font-style: italic; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 4px; }
.w-110 { flex: 0 0 110px; }
.w-full { width: 100%; }
.grow { flex: 1; min-width: 120px; }
/* A field that takes a whole row of its own inside .field-row. */
.basis-full { flex-basis: 100%; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 4px; }
.field-row { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; align-items: flex-end; }
.between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 11px; cursor: pointer; }
/* The field labels of the acs_task editor blocks (step and ACS_TASK preflight). */
.acs-label { font-size: 11px; color: var(--warn); font-weight: 600; min-width: 90px; }
.input-sm { font-size: 11px; padding: 2px 4px; }
.icon-btn { padding-left: 8px; padding-right: 8px; }
.row-edit { padding: 2px 6px; opacity: 0; transition: opacity 0.12s; }
.test-item:hover .row-edit, .row-edit:focus-visible { opacity: 1; }
/* Icon-only controls in the step header stay comfortably clickable. */
.step-editor-header .btn-outline { min-height: 26px; min-width: 28px; justify-content: center; }

/* Keyboard focus */
button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.header-tab:focus-visible, .sub-tab:focus-visible { outline-offset: -2px; }

/* Updating figures must not jiggle as digits change. */
.metric-value, .test-steps, .step-num, .sub-tab-badge, .pill, .nums { font-variant-numeric: tabular-nums; }
.card-title, .metric-label, .header-title { text-wrap: balance; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .spinner { border-top-color: var(--accent); opacity: 0.75; }
}

/* Batch report summary: six tiles that add up to Total. */
.bsum { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.bsum > div { padding: 12px 8px; border-radius: var(--radius-lg); text-align: center; background: var(--surface-2); display: grid; gap: 2px; }
.bsum b { font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bsum span { font-size: 12px; color: var(--ink-3); }
.bsum small { font-size: 11px; color: var(--pass); font-variant-numeric: tabular-nums; }
.bsum .t-pass { background: var(--pass-soft); } .bsum .t-pass b { color: var(--pass); }
.bsum .t-fail { background: var(--fail-soft); } .bsum .t-fail b { color: var(--fail); }
.bsum .t-warn { background: var(--warn-soft); } .bsum .t-warn b { color: var(--warn); }
.bsum .t-blocked { background: var(--blocked-soft); } .bsum .t-blocked b { color: var(--blocked); }
@media (max-width: 800px) { .bsum { grid-template-columns: repeat(3, 1fr); } }

/* Test cases: the verdict of a case's most recent run, click to open it. */
.last-run { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink-3); }
.last-run .dim { font-size: 12px; white-space: nowrap; }
.last-run:hover .dim { color: var(--ink); }

/* Runs: the batch as a whole. */
.batch-panel { padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.batch-bar { display: flex; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.batch-bar i { display: block; height: 100%; transition: width 0.3s ease; }
.batch-bar .pass { background: var(--pass); }
.batch-bar .fail { background: var(--fail); }
.batch-bar .warn { background: var(--warn); }
.batch-bar .amber { background: var(--warn); }
.batch-bar .blocked { background: var(--blocked); }
.batch-facts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.batch-facts .bf-count b { font-size: 14px; color: var(--ink); }
.batch-facts .bf-pass { color: var(--pass); font-weight: 500; }
.batch-facts .bf-amber { color: var(--warn); font-weight: 500; }
/* A wave in flight on any worker: the Overview and Runs share this card. */
.wave-card { border-left: 3px solid var(--accent); }
.wave-body { padding: 10px 16px 12px; }
.wave-where { margin-left: 8px; font-size: 12px; }
.wave-current { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; min-width: 0; }
.wave-current .q-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Batch report: read against an earlier batch, rerun a slice. */
.select-sm { padding: 4px 8px; font-size: 12px; }
.diff-panel { margin-bottom: 16px; padding: 12px; background: var(--ground); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.diff-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.diff-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* The batch report cut by verdict: chips on the left, the order select on the right. */
.diff-chips.batch-cut { margin-bottom: 12px; align-items: center; }
.diff-chips.batch-cut select { margin-left: auto; }
.diff-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; cursor: pointer; font-family: inherit; }
.diff-chip b { color: var(--ink); }
.diff-chip.fail b { color: var(--fail); }
.diff-chip.pass b { color: var(--pass); }
.diff-chip.amber b { color: var(--warn); }
.diff-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.diff-only-there { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.judge.diff-was { border-style: dashed; }
/* Verdict + judge + "was …": they wrap inside the cell instead of spilling
   over the Reason column, which a fixed table layout does not clip. */
.cell-status { white-space: normal; line-height: 1.9; }

.list-more { display: flex; justify-content: center; padding: 10px 0 14px; }

/* A red the known-issues registry already explains. */
.judge.judge-known { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); cursor: help; }
/* A YAML an older converter wrote (Tests tab); a re-import refreshes it. */
.judge.judge-stale { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); cursor: help; }
/* A retry tag opens the crashed first attempt. */
.judge.retried { cursor: pointer; }

/* Editor: the case as TestRail holds it, beside the converted steps. */
.tr-source { margin: 8px 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-md); background: var(--ground); }
.tr-source-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; margin-bottom: 6px; }
.tr-source pre { margin: 2px 0; font-family: var(--sans); font-size: 12px; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.tr-precond { margin-bottom: 8px; font-size: 12px; }
.tr-steps { margin: 0; padding-left: 20px; max-height: 320px; overflow-y: auto; }
.tr-steps li { margin-bottom: 8px; }
.tr-steps .tr-expected { color: var(--ink-2); border-left: 2px solid var(--line-2, var(--line)); padding-left: 8px; margin-top: 3px; }
.batch-facts .bf-fail { color: var(--fail); font-weight: 500; }
.batch-facts .bf-warn { color: var(--warn); font-weight: 500; }
.batch-facts .bf-queue { margin-left: auto; }
.batch-queue { list-style: none; margin: 8px 0 0; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.batch-queue li { display: flex; align-items: center; gap: 10px; padding: 4px 10px; font-size: 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.batch-queue li:last-child { border-bottom: none; }
.batch-queue li.running { background: var(--accent-soft); }
.batch-queue li.pending { color: var(--ink-3); }
.batch-queue .q-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Runs, nothing in flight: one line, the history right under it. */
.idle-strip { display: flex; align-items: center; gap: 12px; padding: 10px 16px; font-size: 13px; color: var(--ink-2); }
.idle-strip .ico { color: var(--ink-3); flex-shrink: 0; }
.idle-strip .btn-outline { margin-left: auto; }

/* The run report as a place to work from. */
.report-actions { display: inline-flex; align-items: center; gap: 6px; }
.report-actions a.btn-outline { text-decoration: none; }
/* Rerun is secondary: plain text, set apart from the links before it. */
.report-rerun { background: none; border: 0; padding: 2px 6px; margin-left: 10px; font-size: 12px; color: var(--ink-3); cursor: pointer; text-decoration: underline; }
.report-rerun:hover:not(:disabled) { color: var(--ink); }
.report-rerun:disabled { opacity: 0.5; cursor: not-allowed; }
/* The failure screenshot under the step it belongs to. */
.step-shot { margin: 8px 0 0; }
.step-shot img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; border: 1px solid var(--line-2); border-radius: 4px; cursor: zoom-in; }
.step-shot figcaption { margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.shot-lightbox { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 24px 24px; background: rgba(22, 32, 43, 0.82); outline: none; }
.shot-lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; background: var(--surface); border-radius: 4px; }
.shot-lightbox-close { position: absolute; top: 12px; right: 16px; }
.shot-lightbox-cap { color: #fff; font-size: 12px; }
.output-more { display: flex; align-items: center; gap: 10px; padding: 6px 16px; font-size: 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.case-history { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
button.pill { cursor: pointer; border: 0; }
/* A pill that carries an identifier (run id, user) rather than a status word: keep its case. */
.pill-raw { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-weight: 500; }
.step-reason { display: block; margin-top: 3px; font-family: var(--mono); font-size: 11.5px; color: var(--fail); white-space: pre-wrap; word-break: break-word; }
/* Implicit oracles: what the page raised. The run's counts on the report bar,
   a marker on each step with findings, and a faint note where the console
   could not be read (a note, never a warning). */
.oracle-badge { cursor: help; }
.oracle-mark { display: inline-flex; align-items: center; margin-left: 6px; color: var(--warn); cursor: help; vertical-align: -2px; }
.oracle-mark .ico { width: 13px; height: 13px; stroke-width: 2.2; }
.oracle-unread { margin-left: 6px; font-size: 11px; color: var(--ink-3); cursor: help; }

/* Keyboard cheat sheet. */
.modal-narrow { max-width: 420px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; font-size: 13px; margin: 0; }
.keys dd { margin: 0; }
kbd { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 1px 7px; background: var(--surface-2); color: var(--ink); }

/* Runs: one card, two lists. */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btn { padding: 5px 12px; border: 0; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition-property: background-color, color; transition-duration: 0.15s; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-2); }
.seg-btn:hover { color: var(--ink); background: var(--surface-2); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent-ink); }
.seg-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg-btn.active .seg-count { color: var(--accent-ink); }
.cell-reason { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Second line of a history row: why the run is not green. */
.cell-title-text, .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 11px; color: var(--ink-3); cursor: pointer; }
/* A click opens the whole reason; a second click folds it. */
.cell-sub.open { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
.repeat-count { font-size: 11px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------- Verdict source (judge) --- */
/* Who produced a verdict: measured (programmatic) / keywords / LLM / unverified.
   A tag, not a pill: it qualifies the verdict next to it rather than competing with it. */
.judge { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); color: var(--ink-3); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.02em; line-height: 1.5; white-space: nowrap; vertical-align: 1px; }
.judge-programmatic { color: var(--pass); border-color: var(--pass-soft); background: var(--pass-soft); }
.judge-keyword { color: var(--ink-2); }
.judge-llm { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.judge-none { color: var(--ink-3); border-style: dashed; }
.judge-lg { font-size: 12px; padding: 3px 9px; margin-left: 0; }
.step-result .judge { margin-left: 8px; }
.idle-last { display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.c-pass { color: var(--pass); } .c-fail { color: var(--fail); } .c-warn { color: var(--warn); }

/* ------------------------------------------------------- Run report panel --- */
/* The report of a finished run, opened from a list: a panel fixed over the
   section, the list untouched underneath. The same block sits in the flow of
   the Runs section (no .run-drawer) while a run is live. */
.run-panel { outline: none; }
/* Below the header, so its controls stay reachable while a report is open. */
.drawer-backdrop { position: fixed; top: var(--header-h); right: 0; bottom: 0; left: 0; z-index: 1040; background: rgba(22, 32, 43, 0.28); }
.run-drawer {
  position: fixed; top: var(--header-h); right: 0; bottom: 0; z-index: 1050;
  width: min(1680px, calc(100vw - 96px)); box-sizing: border-box;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 20px 32px; background: var(--ground);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-md);
  animation: drawerIn 0.18s ease-out;
}
/* The log is what the panel is opened for: it gets more of the width than
   the step list. Narrow windows fall back to one column below. */
.run-drawer .runner-grid { grid-template-columns: minmax(280px, 2fr) 3fr; }
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 1100px) { .run-drawer .runner-grid { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .run-drawer { width: 100vw; border-left: 0; } }
/* Dialogs that must stay reachable above the panel (the cheat sheet). */
.modal-overlay.modal-top { z-index: 1200; }
/* Verdict, judge, facts and actions of a finished run, under its header. */
.report-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
/* The provenance stamp: the bar's last item, on a line of its own. */
.report-prov { flex-basis: 100%; overflow-wrap: anywhere; }
.pill-md { font-size: 13px; padding: 5px 14px; }
.report-artifacts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* The row whose report is open, in the lists behind the panel. */
.table .row-open td { background: var(--accent-soft); }
/* Column widths on the header are only honoured with a fixed layout; with the
   automatic one a no-wrap title pushed the Reason column out of the dialog. */
.table-fixed { table-layout: fixed; }
/* A fixed layout keeps the column WIDTH but not the text inside it: a value
   longer than its column (env "test-agent-oracle" in a 92px Env column) simply
   painted over its neighbour, so the reader saw "test-agent-oracl24 min ago".
   The text cells of a fixed table clip with an ellipsis instead; each already
   carries the full value in its title, so nothing becomes unreadable. Scoped to
   `dim` + `nowrap` on purpose: the Verdict cell is nowrap too, and clipping
   there would cut the pills. */
.table-fixed td.dim.nowrap { overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------- Output: failed verdicts --- */
/* Every failed verdict in the log, and the one the jump landed on. Painted
   through the Custom Highlight API, so the log stays one text node. */
::highlight(ft-fail) { color: var(--fail); }
::highlight(ft-fail-current) { background-color: var(--fail-soft); color: var(--fail); }
/* Right margin only: the spacer supplies the left one, and a hidden neighbour
   (x-show keeps it in the DOM) must not change the spacing. */
.sub-tab-action { margin: 4px 8px 4px 0; padding: 4px 10px; font-size: 11px; }
.sub-tab-action.is-fail { color: var(--fail); border-color: var(--fail-soft); font-family: var(--mono); font-weight: 600; }
.spacer { flex: 1; }

/* Test cases: the filters stack, the search taking the width the selects
   leave. The run settings live in the card header (see "tests header"). */
.run-controls-rows { flex-direction: column; align-items: stretch; gap: 8px; }
.rc-filters .rc-search { flex: 1 1 180px; min-width: 160px; width: auto; }

/* ------------------------------------------------ Editor: per-type blocks --- */
/* A step type shows its own payload in a tinted box under the common
   action/expected pair. The tint carries meaning only as "this is a typed
   step"; --sb is the box's colour, set by the modifier. */
.step-box { display: flex; flex-direction: column; gap: 8px; margin-top: 6px;
            padding: 10px; border-radius: 6px;
            border: 1px solid var(--sb); background: var(--sb-soft); }
.step-box-accent  { --sb: var(--accent);  --sb-soft: var(--accent-soft); }
.step-box-pass    { --sb: var(--pass);    --sb-soft: var(--pass-soft); }
.step-box-blocked { --sb: var(--blocked); --sb-soft: var(--blocked-soft); }
.step-box-neutral { --sb: var(--gray-400); --sb-soft: var(--violet-soft); }
.step-box-label { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: var(--sb); }
.step-box-neutral .step-box-label { color: var(--gray-700); }

/* Inputs inside a typed block: compact, and monospace where the value is a
   path, a tool name or a task name rather than prose. */
.input-mono { font-size: 11px; padding: 3px 6px; font-family: var(--mono); }

/* key = value editor (emulator arguments, and the shape acs_task already uses). */
.kv-head { font-size: 11px; font-weight: 600; color: var(--gray-700); }
.kv-list { max-height: 200px; overflow-y: auto; padding: 6px; border-radius: 4px;
           border: 1px solid var(--gray-200); background: var(--surface);
           font-family: var(--mono); font-size: 12px; }
.kv-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.kv-key { flex: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis;
          white-space: nowrap; font-size: 11px; color: var(--gray-700); }
.kv-val { flex: 1; font-size: 11px; font-family: var(--mono); padding: 2px 6px;
          border: 1px solid var(--gray-200); border-radius: 3px; background: var(--surface); }
.kv-del { padding: 2px 6px; font-size: 11px; border: none; border-radius: 3px;
          cursor: pointer; color: var(--fail); background: var(--fail-soft); }
.kv-add-row { display: flex; gap: 4px; margin-top: 6px; }
.kv-add-row .kv-add-key { flex: 2; }
.kv-add-row .kv-add-val { flex: 1; }

/* --- test management: cases --- */
/* The Test cases tab and the Editor as they became on 2026-09-08: a bulk bar
   over the selection, a trash view, the find/replace preview, and the three
   Editor panels (change history, execution history, attachments). No inline
   styles: the ratchet in tests/test_ui_skin.py only goes down. */

/* A file input that exists only to be clicked by its button. */
.tm-file-input { display: none; }

/* Toolbar toggle that is currently on (the Trash view). */
.btn-outline.is-on { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }

/* Destructive action inside a row of ordinary ones. */
.btn-outline.tm-danger { color: var(--fail); border-color: var(--fail-soft); }
.btn-outline.tm-danger:hover:not(:disabled) { color: var(--fail); border-color: var(--fail); background: var(--fail-soft); }

/* Bulk bar: appears with the selection, between the filters and the list, so
   it never moves the rows it acts on. */
.tm-bulk-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
}
.tm-bulk-count { font-size: 12px; font-weight: 600; color: var(--accent-ink); }

/* Trash view: replaces the case list while it is open. */
.tm-trash { padding: 0 0 8px; }
.tm-trash-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tm-trash .table td { vertical-align: middle; }
.tm-trash .table .btn-sm + .btn-sm { margin-left: 4px; }

/* Find / replace modal and its dry-run table. */
.tm-bulk-modal { max-width: min(900px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.tm-bulk-modal .card-body { overflow: auto; }
.tm-bulk-actions { margin-top: 10px; }
.tm-preview { margin-top: 12px; }
.tm-preview .table td { font-size: 12px; word-break: break-word; }
.tm-row-changed td { background: var(--accent-soft); }

/* Editor panels: change history, execution history, attachments. */
.tm-panel { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.tm-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tm-panel-title { font-size: 13px; font-weight: 600; }

/* One version per row: version, who, when, what moved, bug, build, actions. */
.tm-history { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; }
.tm-history li {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 5px 6px; border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.tm-history li:last-child { border-bottom: none; }
.tm-ver { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--accent-ink); }
.tm-changes { color: var(--ink-2); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The unified diff of one version against the case as it is now. */
.tm-diff-modal { max-width: min(1000px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.tm-diff-modal .card-body { overflow: auto; }
.tm-diff {
  margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  white-space: pre; overflow: auto; max-height: 62vh;
}

/* Files attached to a case. */
.tm-attachments { list-style: none; margin: 0; padding: 0; }
.tm-attachments li {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 5px 6px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.tm-attachments li:last-child { border-bottom: none; }
/* The file name is a button, not a link: a download has to go through the
   fetch wrapper to carry the bearer token, so it cannot be a navigation. It
   still has to read as the name of a file. */
.tm-linkish {
  padding: 0; border: none; background: none; cursor: pointer;
  color: var(--accent); font: inherit; text-decoration: underline;
  text-align: left; word-break: break-all;
}
.tm-linkish:hover:not(:disabled) { color: var(--accent-ink); }
.tm-linkish:disabled { color: var(--ink-3); cursor: not-allowed; text-decoration: none; }

/* --- tests header --- */
/* Row 1 of the Test cases card: what is on screen on the left, what a run of
   it would be on the right. The header used to be four wrapped rows that mixed
   authoring, housekeeping, run settings, selection and filters. */
.tests-head { gap: 16px; }
.tests-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.tests-head .count {
  font-size: 12px; color: var(--ink-3); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The selection, and the two ways to change it, as one quiet group. */
.sel-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 2px 9px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; white-space: nowrap;
}
.sel-pill .sel-n { color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* Selected, but not on screen under the current filters. Amber because it is
   the number that makes a kept selection safe to read: "2 selected · 1 hidden"
   is a different wave from "2 selected". */
.sel-pill .sel-hidden { color: var(--warn); font-variant-numeric: tabular-nums; }
.sel-link {
  padding: 0; border: none; background: none; cursor: pointer;
  font: inherit; color: var(--accent); text-decoration: underline;
}
.sel-link:hover:not(:disabled) { color: var(--accent-ink); }
.sel-link:disabled { color: var(--ink-3); cursor: not-allowed; text-decoration: none; }

/* One bordered group for the run: env, model, order, name, go. The controls
   share the group's border instead of each drawing its own. */
.tests-head .run-bar {
  display: flex; align-items: stretch; height: 30px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden; min-width: 0;
}
.tests-head .run-bar select,
.tests-head .run-bar input {
  height: 100%; margin: 0; padding: 0 10px; font-size: 12px;
  border: none; border-right: 1px solid var(--line); border-radius: 0;
  background: var(--surface); color: var(--ink-2); box-sizing: border-box;
}
.tests-head .run-bar select { cursor: pointer; max-width: 170px; }
/* The stand and the button that starts the run keep their width; the optional
   name is what gives way, so a narrow window never clips "Run Selected". */
.tests-head .run-bar .rc-env { flex-shrink: 0; }
.tests-head .run-bar input.rc-name { width: 168px; min-width: 0; flex-shrink: 1; }
.tests-head .run-bar input::placeholder { color: var(--ink-3); }
.tests-head .run-bar select:focus-visible,
.tests-head .run-bar input:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* An unset env is the one thing in the bar that has to shout. */
.tests-head .run-bar select.rc-env-unset { color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.tests-head .run-bar .btn-run { border-radius: 0; border-left: none; flex-shrink: 0; white-space: nowrap; }
.tests-head .header-actions .btn-icon { padding: 0; width: 30px; justify-content: center; }
.tests-library .menu { min-width: 210px; }
/* The trash item is a toggle: while the trash view is open it has to say so. */
.tests-library-menu .menu-item.is-on { color: var(--accent-ink); background: var(--accent-soft); }

/* Row 2: the search and the filters a visit reaches for every time. */
.filter-row { flex: 1 1 auto; }
.more-filters-toggle .ico { transition: transform 0.15s ease; }
.more-filters-toggle.is-on .ico { transform: rotate(180deg); }
/* Row 3: the three the toggle folds away. Inset so it reads as belonging to
   the row above rather than as a third bank of controls. */
.more-filters {
  padding-top: 8px; border-top: 1px dashed var(--line);
}

/* The on-conflict choice, asked about the file that was just picked. */
.import-xml-modal { max-width: 460px; }
.import-xml-file {
  margin: 0 0 12px; font-family: var(--mono); font-size: 12px;
  color: var(--ink-2); word-break: break-all;
}
.import-xml-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 13px; color: var(--ink); cursor: pointer;
}
.import-xml-opt input { accent-color: var(--accent); margin: 0; }
.import-xml-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
/* The LLM mode of a TestRail export's import, and which file kind it is for. */
.import-xml-mode {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 13px; color: var(--ink);
}
.import-xml-hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-2); }
/* An import dialog's cached-only warning: shown while No LLM, cached only is
   chosen, it says which cases the import skips. */
.cache-only-note { margin-top: 8px; font-size: 12px; color: var(--warn); }
/* The Import from TestRail result step: each skipped case and its reason. */
.testrail-skipped-list {
  max-height: 200px; overflow-y: auto; margin-top: 8px; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--ink-2);
}

/* The re-import dialog: what the request carries, its options, and what each
   reimported case changed. */
.reimport-sends { margin-bottom: 8px; font-size: 12px; color: var(--ink-2); }
/* The running bar's look; its width is an object :style, which Alpine merges.
   A string :style would replace the whole style attribute, height included. */
.reimport-bar-fill { height: 100%; background: var(--blue); transition: width .3s; }
/* The done step's outcome box: green when every case went through, amber otherwise. */
.reimport-outcome { margin-bottom: 10px; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.reimport-outcome.is-ok { background: var(--pass-soft); color: var(--pass); }
.reimport-outcome.is-warn { background: var(--warn-soft); color: var(--warn); }
.reimport-opt { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; }
.reimport-changes {
  margin-top: 8px; padding: 10px; max-height: 180px; overflow-y: auto;
  font-family: var(--mono); font-size: 11px; background: var(--surface-2); border-radius: 6px;
}

/* --- editor sidebar header --- */
/* The same four jobs as the Test cases tab, in a column half as wide: what is
   listed, how it is narrowed, what is selected, and the housekeeping. */
.ed-head { padding: 10px 12px; gap: 8px; }
.ed-head-left { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ed-head .count {
  font-size: 12px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ed-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ed-head-actions .btn-icon { padding: 0; width: 26px; height: 26px; justify-content: center; }
.editor-side-menu { min-width: 230px; max-height: 420px; overflow-y: auto; }
.editor-side-menu .menu-label {
  padding: 6px 12px 2px; font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.editor-side-menu .menu-count { color: var(--ink-3); font-size: 11px; }
.editor-side-menu .menu-empty { padding: 6px 12px; font-size: 12px; color: var(--ink-3); }

.ed-search { padding: 8px 12px 0; }
.ed-search .form-input { width: 100%; }

/* Three filters, one row, equal share of a narrow column: a select that sized
   itself to its longest option pushed the next one onto a line of its own. */
.ed-filters {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.ed-filters .form-input { flex: 1 1 0; min-width: 0; padding: 4px 8px; font-size: 12px; }
.ed-filters .ed-reset { flex: 0 0 auto; font-size: 12px; }

.ed-bulk {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-bottom: 1px solid var(--line);
}
.ed-selectall {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-3); cursor: pointer;
}
.ed-bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- coverage contract: the map a case was converted with, the audit sheet
   of a run. Built on the worker; the page only paints them. Tokens only. --- */
/* Editor: the TestRail line a step came from, read-only. */
.tr-tag {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 8px;
  background: var(--surface-2); color: var(--ink-3); white-space: nowrap;
}
/* TestRail panel: the map's own items under each entry, as converted. */
.tr-drift {
  margin: 0 0 8px; padding: 4px 8px; border-radius: var(--radius-md);
  background: var(--warn-soft); color: var(--warn); font-size: 12px;
}
.tr-conv { list-style: none; margin: 4px 0 0; padding: 0 0 0 8px; border-left: 2px solid var(--line); font-size: 12px; }
.tr-conv li { display: flex; align-items: baseline; gap: 6px; margin: 2px 0; }
.tr-conv .tr-conv-cap { color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.tr-conv-apart { margin-top: 8px; }
.tr-conv-id, .audit-id { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
/* Run report: the audit card between the report bar and the steps. */
.audit-card { margin-bottom: 16px; }
.audit-body { display: flex; flex-direction: column; gap: 10px; }
/* The header row: the two verdicts, the reason beside them, the copy button.
   The reason takes what width is left and wraps, so a long one stays legible. */
.audit-head { flex: 1 1 320px; justify-content: flex-end; min-width: 0; }
.audit-reason { flex: 1 1 240px; min-width: 0; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.audit-missing { font-size: 13px; }
.audit-missing ul { margin: 4px 0 0; padding-left: 18px; }
.audit-missing li { margin: 2px 0; }
.audit-why { color: var(--warn); }
.audit-table th.col-row { width: 64px; }
.audit-table th.col-status { width: 150px; }
.audit-table td.audit-cell { white-space: normal; word-break: break-word; }
.audit-md { width: 100%; min-height: 140px; box-sizing: border-box; font-family: var(--mono); font-size: 12px; }
/* The selection copy's scratch field: in the page (a copy needs it), never seen. */
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
/* Run history and the batch table: one more fixed-width column. */
.table-fixed th.col-audited { width: 112px; }
/* Batch report: which single cause keeps the most runs out of audited. */
.audit-reasons { margin: -4px 0 12px; font-size: 12px; color: var(--warn); }
/* Adaptation tab at corpus scale: filter bar, status toggles, sortable headers, pager. */
.adapt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.adapt-filters .adapt-search { width: 220px; }
.adapt-hold-panel .adapt-hold-reason, .adapt-filters .adapt-hold-reason { width: 320px; }
button.pill.pill-on { box-shadow: 0 0 0 1.5px currentColor; }
button.pill.pill-off { opacity: 0.45; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: var(--ink); }
.table tr.row-picked td { background: var(--accent-soft); }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); background: var(--ground); }
.table .cell-why { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.adapt-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); }
/* Adaptation status panel: the .kpi tiles and one stacked bar in the pill palette,
   so both themes come from the same tokens. Every segment is also a legend line
   with its count and share: the colours are never the only carrier. A label is
   always two lines tall, so the numbers of a row of tiles share one baseline. */
.adapt-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.adapt-tile { align-content: start; }   /* a tile stretched to its row's height keeps its rows where they are */
.adapt-tile .kpi-label { min-height: 2.8em; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.adapt-tile-value { border: 0; background: none; padding: 0; font-family: inherit; text-align: left; cursor: pointer; color: var(--accent-ink); }
.adapt-tile-value:hover { text-decoration: underline; }
/* The palette's mid-tones measure 1.0-1.7:1 against each other, so segments are
   set apart by a 2px gap in the surface colour (WCAG 1.4.11's separator); every
   fill clears 3:1 against that surface in both themes. */
.adapt-bar { display: flex; gap: 2px; height: 14px; border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; margin-bottom: 8px; }
.adapt-bar i { display: block; height: 100%; min-width: 3px; }
.adapt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.adapt-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.adapt-legend-item i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.adapt-legend-item b { color: var(--ink); }
.seg-written { background: var(--accent); }
.seg-no_change { background: var(--ink-2); }
.seg-restored { background: var(--accent-ink); }
.seg-ready_to_write { background: var(--pass); }
.seg-needs_attention { background: var(--warn); }
.seg-error { background: var(--fail); }
.seg-held { background: var(--blocked); }
.seg-no_equivalent { background: var(--violet); }
.seg-refresh_pending { background: var(--ink-3); }
.seg-waiting_for_model { background: var(--ink); }
/* Drawn as an outline: Not adapted has no adaptation yet, In progress is a job's transient state. */
.seg-not_adapted { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg-in_progress { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
/* A status with no case keeps its tile in place, dimmed (spec 2026-10-05 section 5). */
.adapt-tile-zero { opacity: 0.55; }
.adapt-tile-group-label { margin-bottom: 4px; }
/* QA sign-off (stage 7). A mark whose YAML changed after it is grey with a dashed
   edge (no stripes: the skin has no gradients), neither the green of a published
   mark nor the amber of a local one. The padding keeps the pill's size. */
.pill-qa-stale { background: var(--surface-2); color: var(--ink-2); border: 1px dashed var(--ink-3); padding: 1px 6px; }
.report-qa { display: inline-flex; align-items: center; gap: 6px; }
.qa-mark-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.qa-remark-cats { border: 0; padding: 0; margin: 0 0 12px; }
.qa-remark-cats .check { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; }
.qa-remark { border-top: 1px solid var(--line); padding: 12px 0; }
.qa-remark:first-child { border-top: 0; padding-top: 0; }
.qa-remark-head { flex-wrap: wrap; gap: 8px; align-items: center; }
.qa-remark-cat { font-weight: 600; }
.qa-remark-text { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.qa-remark-replies { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); }
.qa-remark-replies li { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.qa-remark-who { font-weight: 600; margin-right: 6px; }
.qa-remark-actions { margin-top: 8px; display: grid; gap: 8px; }
.qa-remark-actions .row { gap: 8px; flex-wrap: wrap; }
.qa-remark-actions .form-input { flex: 1 1 220px; min-width: 0; }
.qa-remark-actions .qa-remark-build { flex: 0 1 140px; }

/* --- case lists at scale --- */
/* Pages of the Test cases list and of the Editor sidebar (2026-09-25). */
.list-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); }
.list-pager-compact { justify-content: space-between; padding: 6px 8px; }
/* A page turn scrolls the Test cases list's top into view; the sticky header must not cover its first row. */
.test-list { scroll-margin-top: var(--header-h); }

/* --- converter tab --- */
/* The overview's counters, label over value, as many per row as fit. */
.conv-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.conv-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.conv-stats strong { font-size: 18px; }
/* One line per import running on any worker, under the counters. */
.conv-running { margin-top: 12px; padding: 8px 12px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.conv-actions { margin-top: 12px; }
/* The journal: its filter row, the job list under it, and the job / case cards
   that open below the list and scroll clear of the sticky header. */
.conv-input { font-size: 12px; padding: 4px 8px; }
.conv-source { width: 160px; }
.conv-case { width: 180px; }
.conv-table { margin-top: 8px; }
.conv-detail { margin: 12px 0 0; scroll-margin-top: calc(var(--header-h) + 12px); }
.conv-summary { padding: 8px 16px; border-bottom: 1px solid var(--line); }
.confirm-choice { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.confirm-choice-select { width: auto; font-size: 12px; padding: 4px 8px; }
.reimport-note { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
/* Compare: the source form, the state tiles (each one a filter), the tools row
   over the case table, and the lists of cases outside the run under it. */
.cmp-form { flex-wrap: wrap; }
.cmp-kind { width: 150px; }
.cmp-id { width: 160px; }
.cmp-q { width: 220px; }
.cmp-source { margin-top: 8px; }
.cmp-stats { margin-top: 8px; }
.cmp-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid transparent; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.cmp-stat.active { border-color: var(--accent); }
.cmp-stat strong { font-size: 18px; }
.cmp-tools { margin-top: 12px; flex-wrap: wrap; }
.cmp-more { margin-top: 6px; }
.cmp-list { margin-top: 12px; }
.cmp-list-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.cmp-list-item { font-size: 12px; padding: 2px 0; }

/* --- editor status dialogs --- */
/* The outcome line of the Generate Tree and Regenerate dialogs. Its colour is a
   class: Alpine applies a string :style by replacing the whole style attribute,
   so a padding written next to one never showed. */
.gen-result { margin-top: 12px; padding: 8px 12px; border-radius: 6px; font-size: 12px; }
.gen-result.is-ok { background: var(--pass-soft); color: var(--pass); }
.gen-result.is-bad { background: var(--fail-soft); color: var(--fail); }

/* Pre-check dialog: one decision badge per case. Theme tokens only. */
.pc-card { max-width: 760px; }
.pc-error-text { color: var(--fail); }
.pc-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.pc-env { margin-bottom: 8px; }
.pc-table-wrap { max-height: 50vh; overflow: auto; }
.pc-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pc-run { background: var(--green-bg); color: var(--green-dark); }
.pc-warn { background: var(--amber-bg); color: var(--amber-dark); }
.pc-skip { background: var(--gray-100); color: var(--gray-600); }
.pc-reimport_first { background: var(--blue-light); color: var(--blue); }
.pc-error { background: var(--red-bg); color: var(--red); }
.pc-partial { margin-left: 6px; font-size: 11px; color: var(--gray-500); border: 1px dashed var(--gray-400); border-radius: 8px; padding: 0 5px; }

/* Readiness label (readiness spec 2026-10-06 section 8): one tone per label, theme tokens only. */
.rd-pill { border: 1px solid transparent; font-family: inherit; }
button.rd-pill { cursor: pointer; }
.rd-manual_only { background: var(--violet-soft); color: var(--violet); }
.rd-postponed { background: var(--surface-2); color: var(--ink-2); border-style: dashed; border-color: var(--ink-3); }
.rd-reimport_first { background: var(--accent-soft); color: var(--accent-ink); }
.rd-cannot_run { background: var(--fail-soft); color: var(--fail); }
.rd-coverage_gap { background: var(--warn-soft); color: var(--warn); }
.rd-ready { background: var(--surface); color: var(--pass); border-color: var(--pass); }
.rd-confirmed { background: var(--pass-soft); color: var(--pass); }
.rd-unknown { background: var(--surface-2); color: var(--ink-3); }
/* An env requirement (Task 5b): a tag, not a label, so it is outlined and never filled like one. */
.rd-need { background: var(--surface); color: var(--ink-2); border: 1px solid var(--ink-3); }
.readiness-filter .menu { min-width: 200px; }
.readiness-filter .menu-item.is-on { background: var(--accent-soft); }
.rd-card { max-width: 920px; }
.rd-head { display: flex; gap: 8px; align-items: center; margin: 6px 0 8px; }
.rd-line { margin: 4px 0; }
.rd-axis { margin-top: 12px; }
.rd-axis-head { font-weight: 600; margin-bottom: 4px; }
.rd-table td { vertical-align: top; }
.rd-mark-card { max-width: 520px; }
.rd-mark-card .form-input { width: 100%; margin-bottom: 8px; }

.rd-gate { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.rd-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.rd-tile { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--surface); color: var(--ink); cursor: pointer; font-family: inherit; }
.rd-tile b { font-size: 16px; }
.rd-bar { display: flex; width: 100%; height: 18px; border-radius: var(--radius-md); overflow: hidden; margin: 12px 0 4px;
  border: 1px solid var(--line); }
.rd-seg { flex: 0 0 auto; height: 100%; border: 0; border-right: 1px solid var(--surface); padding: 0; cursor: pointer; }
.rd-legend { margin-bottom: 4px; }
.rd-sum { align-self: center; margin-left: auto; }
.rd-tags { margin-top: 8px; }
.rd-tag { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.rd-spread { border: 0; background: none; color: var(--ink-2); cursor: pointer; font-family: inherit; font-size: 12px;
  padding: 2px 4px; text-decoration: underline dotted; }
.rd-section-head { font-weight: 600; margin: 16px 0 6px; }
.rd-portal { width: auto; min-width: 140px; }
.table tbody tr.rd-portal-picked td { background: var(--accent-soft); font-weight: 600; }

/* A case QA verified by hand (a manual record, no run cited) and one whose QA record cannot be read: neither is
   the green of a run-backed sign-off. */
.pill-qa-manual { background: var(--surface-2); color: var(--ink); border: 1px solid var(--green); padding: 1px 6px; }
.pill-qa-unreadable { background: var(--warn-soft); color: var(--ink); border: 1px dashed var(--ink-3); padding: 1px 6px; }

/* The Adaptation tab could not read the QA-verified state: holds may be missing. */
.adapt-freeze-banner { background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }

.import-frozen-note { margin-bottom: 8px; }
.reimport-extra { display: block; margin-top: 4px; }

/* Step editor: a field that grows, and one that only keeps a minimum width. */
.field-grow { flex: 1; min-width: 150px; }
.field-min { min-width: 150px; }

/* --- Test cases: sticky header block, labeled columns, chips, legend --- */
/* `.card` clips its children (overflow: hidden), which would stop a sticky child from sticking. */
.tests-card { overflow: visible; }
.tests-sentinel { height: 1px; margin-bottom: -1px; scroll-margin-top: calc(var(--header-h) + var(--tests-stick-gap, 0px)); }
.tests-sticky {
  /* Sticks where it already stands: --tests-stick-gap is its measured distance below the app
     header (_watchTestsSticky), so the block never rides up before it sticks. */
  position: sticky; top: calc(var(--header-h) + var(--tests-stick-gap, 0px)); z-index: 6;
  background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 1px 0 var(--line);
}
/* The strip between the app header and the stuck block shows the page colour, not the rows
   scrolling under the block. */
.tests-sticky::before {
  content: ""; position: absolute; left: -1px; right: -1px; bottom: 100%;
  height: var(--tests-stick-gap, 0px); background: var(--ground); pointer-events: none;
}
/* Stuck: paint only. Folding a row or the padding here changed the block height on stick,
   which moved the list, re-triggered the sentinel and made the header jump. */
.tests-sticky.is-stuck { box-shadow: 0 1px 0 var(--line), 0 4px 10px rgba(16, 32, 43, 0.08); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--ground); }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 9px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink-2); font-size: 12px;
}
.filter-chip-x {
  border: none; background: none; cursor: pointer; color: var(--ink-3);
  font-size: 14px; line-height: 1; padding: 0 4px; border-radius: var(--radius-pill);
}
.filter-chip-x:hover { color: var(--ink); background: var(--surface-2); }

/* Column heads and rows share these widths. */
.tc-head {
  display: flex; align-items: center; gap: 12px; padding: 5px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
}
.tc-head-main { flex: 1; min-width: 0; padding-left: 35px; display: inline-flex; align-items: center; gap: 8px; }
.tc-cols { display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0; }
.tc-head .tc-cols { align-items: center; }
.tc-col { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; font-size: 12px; color: var(--ink-3); }
/* One line per column: the case column takes what is left (owner 2026-10-09: rows had grown
   to two or three lines and the Last run date ran into Readiness). */
.tc-cov { width: 150px; }
.tc-run { width: 220px; }
/* A long case title wraps to two lines instead of being cut mid-word; the full text is in the title. */
.test-list .test-item-left .test-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tc-ready { width: 340px; }
.tc-ref { width: 90px; }
.tc-actions { width: 84px; justify-content: flex-end; }
.tc-cov, .tc-run { flex-wrap: nowrap; overflow: hidden; }
/* The secondary tags flow on after the readiness label instead of opening a line of their own. */
.tc-sub { display: contents; font-size: 11px; }
.tc-ref a, .tc-ref span { overflow-wrap: anywhere; }
.test-item-main .test-meta { gap: 0; }
.tc-legend-toggle {
  width: 18px; height: 18px; padding: 0; border: 1px solid var(--line-2); border-radius: 50%;
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: 11px; font-weight: 600; line-height: 1; cursor: pointer;
}
.tc-legend-toggle:hover { color: var(--accent-ink); border-color: var(--accent); }
.tc-legend-toggle .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tc-legend { padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--ground); font-size: 12px; color: var(--ink-2); max-height: 40vh; overflow: auto; }
.tc-legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.tc-legend li { display: flex; gap: 8px; }
.tc-legend strong { flex: 0 0 240px; font-weight: 600; color: var(--ink); }
.tests-bulk-menu { right: auto; left: 0; }

@media (max-width: 1100px) {
  .tc-head { display: none; }
  .test-item { flex-wrap: wrap; }
  .tc-cols { flex-basis: 100%; flex-wrap: wrap; }
  .tc-cov, .tc-run, .tc-ready, .tc-ref, .tc-actions { width: auto; }
}

/* Activity: a burst of one action is one row that unfolds. */
.act-head { cursor: pointer; }
.act-head:hover td { background: var(--gray-50); }
.act-child td:first-child { padding-left: 24px; }
.act-user { font-weight: 500; }
.act-detail { max-width: 360px; }
.act-count { margin-left: 6px; font-size: 12px; color: var(--gray-600); }
.worker-addr summary { cursor: pointer; }
.ed-legend { padding: 4px 12px; font-size: 11px; color: var(--gray-500); }

/* Header pill: the env the next run starts on. Five slots built on the palette
   tokens (dark theme follows because the tokens do); the slot is a stable hash
   of the env name (envHueIndex in index.html). */
.env-pill strong { color: inherit; font-weight: 600; }
.env-pill-k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.env-pill.env-c0 { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); }
.env-pill.env-c1 { color: var(--pass); background: var(--pass-soft); border-color: var(--pass); }
.env-pill.env-c2 { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.env-pill.env-c3 { color: var(--violet); background: var(--violet-soft); border-color: var(--violet); }
.env-pill.env-c4 { color: var(--ink-2); background: var(--blocked-soft); border-color: var(--blocked); }
