/* Web fetch page.
   One accent: Team247 blue #3147FF. Cool neutrals only. Colours are hex/rgb only (no newer colour
   spaces or mixing functions), so scripts/ui-check.mjs can measure WCAG AA contrast from computed styles.
   Corner rule: controls (inputs, buttons) 10px, surfaces (cards, panels, dialog) 16px,
   chips and badges fully round. Typeface: Geist and Geist Mono, served from this server (OFL). */

@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f2f4f9; --surface-3: #e9ecf4;
  --border: #e2e5ee; --border-strong: #c6cbda;
  --text: #0f1433; --text-2: #3f4664; --text-3: #575e7b;
  --accent: #3147ff; --accent-hover: #2236e6; --accent-soft: #eef0ff; --accent-text: #2433d1; --on-accent: #ffffff;
  --ring: rgba(49, 71, 255, 0.45);
  --ok: #08703d; --ok-bg: #e6f6ed; --warn: #864700; --warn-bg: #fff3df; --bad: #b0122d; --bad-bg: #fdebee; --run: #2433d1; --run-bg: #eceefe;
  --bar-bg: rgba(245, 246, 250, 0.86);
  --shadow: 0 1px 2px rgba(15, 20, 51, 0.05), 0 8px 24px -12px rgba(15, 20, 51, 0.14);
  --shadow-lg: 0 24px 60px -20px rgba(15, 20, 51, 0.35);
  --glow: rgba(49, 71, 255, 0.10);
  --r-control: 10px; --r-surface: 16px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a0d18; --surface: #11152a; --surface-2: #171c33; --surface-3: #1f2541;
    --border: #252b47; --border-strong: #3a4166;
    --text: #e9ebf7; --text-2: #c0c5de; --text-3: #9aa1c0;
    --accent: #3147ff; --accent-hover: #4255ff; --accent-soft: #1b2150; --accent-text: #a8b2ff; --on-accent: #ffffff;
    --ring: rgba(132, 147, 255, 0.6);
    --ok: #5ed69b; --ok-bg: #0d2a1f; --warn: #f3b55e; --warn-bg: #2b1f0c; --bad: #ff8a9c; --bad-bg: #2e1119; --run: #a8b2ff; --run-bg: #181d42;
    --bar-bg: rgba(10, 13, 24, 0.82);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    --glow: rgba(49, 71, 255, 0.16);
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--sans); font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* A faint blue light at the top of the page. A pseudo-element, so text never sits on a gradient. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 420px; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 100% at 30% 0%, var(--glow), transparent 70%);
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--r-control); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.code { font-family: var(--mono); font-size: 0.82rem; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---- top bar ---------------------------------------------------------------------------------- */
.bar { position: sticky; top: 0; z-index: 30; background: var(--bar-bg); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.bar-in { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 40px; }
.logo { width: 26px; height: 26px; }
.brand-name { font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { color: var(--text-3); font-size: 0.86rem; padding-left: 10px; border-left: 1px solid var(--border-strong); }
.bar-right { display: flex; align-items: center; gap: 12px; }
.health { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--text-2); white-space: nowrap; }
.health .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--text-3); }
.health.online .dot { background: #13a35b; box-shadow: 0 0 0 3px rgba(19, 163, 91, 0.18); }
.health.offline .dot { background: #e0243f; box-shadow: 0 0 0 3px rgba(224, 36, 63, 0.18); }

/* ---- buttons ---------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  font: 550 0.93rem/1 var(--sans); min-height: 40px; padding: 0 16px; border-radius: var(--r-control); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(15, 20, 51, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.quiet { background: transparent; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 0.86rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-control); cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.pill-btn {
  font: 500 0.86rem/1 var(--sans); min-height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent-text); }

/* ---- layout ----------------------------------------------------------------------------------- */
/* minmax(0, 1fr): without the 0, a wide table inside the main column would widen the column itself
   past the screen (grid "blowout"), and the phone page would scroll sideways. ui-check measures it. */
.shell {
  position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 28px 24px 8px;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "history main"; gap: 28px; align-items: start;
}
/* The cards sit in a grid of their own; its one column needs the same minmax(0, 1fr), or a wide
   results table widens the cards past the screen (found by ui-check, first build). */
.main { grid-area: main; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.history { grid-area: history; position: sticky; top: 88px; max-height: calc(100vh - 108px); overflow: auto; padding: 4px 4px 12px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-surface); box-shadow: var(--shadow); padding: 28px; }
.foot { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 12px 24px 36px; color: var(--text-3); font-size: 0.82rem; }

/* ---- composer --------------------------------------------------------------------------------- */
.compose h1 { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.05rem); font-weight: 650; line-height: 1.15; letter-spacing: -0.03em; }
.lede { color: var(--text-2); margin-top: 8px; max-width: 60ch; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 22px; }
.examples-label { font-size: 0.86rem; color: var(--text-3); margin-right: 2px; }
.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
label, legend { display: block; font-weight: 550; font-size: 0.9rem; margin-bottom: 7px; color: var(--text); }
legend { padding: 0; }
.opt { font-weight: 400; color: var(--text-3); margin-left: 4px; }
input[type=url], input[type=password], input[type=number], input[type=text], textarea, select {
  width: 100%; font: 400 1rem/1.45 var(--sans); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-control); padding: 10px 13px; min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, textarea:hover, select:hover { border-color: var(--text-3); }
select { cursor: pointer; padding-right: 10px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
textarea { resize: vertical; field-sizing: content; min-height: 88px; max-height: 260px; }
.with-icon { position: relative; }
.with-icon .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.with-icon input { padding-left: 40px; font-family: var(--mono); font-size: 0.93rem; }
.hint { color: var(--text-3); font-size: 0.85rem; margin-top: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 38px; padding: 0 15px 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text-2);
  font-weight: 500; font-size: 0.9rem; cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 14px; border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
.field.small { width: 150px; margin-bottom: 0; }
.field.small.run-with { width: 240px; }
.field-action { margin-top: 8px; }
.field.small input { font-variant-numeric: tabular-nums; }
.budget-hint { flex: 1 1 200px; margin: 0 0 11px; }
.submit { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.kbd-hint { display: inline-flex; gap: 4px; }
kbd { font: 500 0.75rem/1 var(--mono); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 4px 6px; }
#start { min-width: 120px; min-height: 44px; font-size: 1rem; }
.callout { border-radius: var(--r-control); padding: 11px 14px; font-weight: 500; margin: 0 0 16px; }
.callout.bad { color: var(--bad); background: var(--bad-bg); }

/* ---- empty state ------------------------------------------------------------------------------ */
.empty h2 { font-size: 1.15rem; font-weight: 600; }
.how { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 14px; }
.how li { display: flex; gap: 14px; align-items: flex-start; color: var(--text-2); }
.how strong { color: var(--text); font-weight: 600; }
.how-n { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font: 600 0.85rem/1 var(--mono); }

/* ---- one job ---------------------------------------------------------------------------------- */
.job { animation: rise 0.25s ease both; scroll-margin-top: 80px; }
.job-head { display: flex; align-items: flex-start; gap: 14px; }
.mono-badge {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text); font: 650 1.1rem/1 var(--sans); text-transform: uppercase;
}
.job-title { flex: 1; min-width: 0; }
.job-title h2 { font-size: 1.2rem; font-weight: 650; overflow-wrap: break-word; }
.job-title h2:focus { outline: none; }
.job-goal { color: var(--text-2); margin-top: 3px; overflow-wrap: break-word; }
.job-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--text-3); font-size: 0.85rem; margin-top: 6px; }
.status {
  display: flex; align-items: center; gap: 10px; margin: 20px 0 0; padding: 11px 14px; border-radius: var(--r-control);
  font-weight: 550; color: var(--text-2); background: var(--surface-2);
}
.status::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 999px; background: currentColor; }
.status.queued, .status.running { color: var(--run); background: var(--run-bg); }
.status.running::before { animation: pulse 1.2s ease-in-out infinite; }
.status.done { color: var(--ok); background: var(--ok-bg); }
.status.blocked { color: var(--warn); background: var(--warn-bg); }
.status.failed { color: var(--bad); background: var(--bad-bg); }
.progress { height: 3px; margin-top: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; width: 35%; height: 100%; border-radius: 999px; background: var(--accent); animation: slide 1.4s ease-in-out infinite; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 0; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 13px 14px 12px; min-width: 0; }
.stat dt { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }
.stat dd { margin: 4px 0 0; font: 600 1.35rem/1.2 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { display: block; font-size: 0.78rem; color: var(--text-3); margin-top: 3px; }
.meter { display: block; height: 4px; margin-top: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; width: var(--pct, 0%); min-width: 2px; border-radius: 999px; background: var(--accent); transition: width 0.3s ease; }
.skeleton { display: grid; gap: 10px; margin-top: 22px; }
.skeleton span { display: block; height: 34px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton span:nth-child(1) { height: 38px; }

/* tabs */
.tabs { display: flex; gap: 4px; margin: 24px 0 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
[role=tab] {
  position: relative; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; cursor: pointer;
  font: 550 0.92rem/1 var(--sans); color: var(--text-3); background: transparent; border: 0; min-height: 42px; padding: 0 12px;
  border-radius: var(--r-control) var(--r-control) 0 0;
}
[role=tab]:hover { color: var(--text); }
[role=tab]:focus-visible { outline-offset: -3px; }
[role=tab][aria-selected=true] { color: var(--text); }
[role=tab][aria-selected=true]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.count { font: 500 0.75rem/1 var(--mono); color: var(--text-2); background: var(--surface-3); border-radius: 999px; padding: 3px 7px; }
.count:empty { display: none; }
.panel { padding-top: 18px; }
.panel:focus-visible { outline-offset: 4px; border-radius: 4px; }
.panel-title { font-size: 0.95rem; font-weight: 600; margin: 22px 0 10px; }
.panel h3 { font-size: 0.95rem; font-weight: 600; }

/* tables: two independent defences against "don|e" (first version): the table keeps its natural width
   and its .scroll wrapper scrolls, and cells wrap only between words (break-word does not shrink a
   column below its longest word; "anywhere" did). Either alone is enough; scripts/ui-check.mjs measures.
   .scroll is position: relative so a positioned child can never escape it and stretch the page. */
.scroll { position: relative; overflow: auto; max-width: 100%; max-height: 480px; border: 1px solid var(--border); border-radius: 12px; }
.table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 0.88rem; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 0.8rem; white-space: nowrap; }
.table td { max-width: 28em; overflow-wrap: break-word; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.url { font-family: var(--mono); font-size: 0.8rem; }
.table-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; color: var(--text-3); font-size: 0.86rem; }
.preview + .preview { margin-top: 24px; }

/* pictures */
.pics { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.pic { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.pic img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.25s ease; }
.pic:hover img { transform: scale(1.03); }

/* files */
.file-group + .file-group { margin-top: 20px; }
.file-group h3 { font-size: 0.8rem; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }
.files { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 12px; }
.files li { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 12px; }
.files li + li { border-top: 1px solid var(--border); }
.ftype { flex: none; font: 600 0.68rem/1 var(--mono); text-transform: uppercase; padding: 5px 0; width: 46px; text-align: center; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.ftype.csv { background: var(--ok-bg); color: var(--ok); }
.ftype.json { background: var(--accent-soft); color: var(--accent-text); }
.ftype.html { background: var(--warn-bg); color: var(--warn); }
.fname { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.84rem; overflow-wrap: anywhere; }
.fsize { color: var(--text-3); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* the agent's steps: a live timeline. Status is shown by the icon's shape and colour AND by a hidden
   word for screen readers, never by colour alone. */
.steps-hint { margin: 0 0 10px; }
.steps { list-style: none; margin: 0; padding: 4px 0; max-height: 520px; overflow: auto; position: relative; }
.step { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 12px; padding: 9px 4px 9px 2px; }
.step + .step::before { content: ""; position: absolute; left: 12px; top: -9px; height: 18px; width: 2px; background: var(--border); }
.step-icon { width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; margin-top: 1px; }
.step.ok .step-icon { border-color: var(--ok); background: var(--ok-bg); }
.step.ok .step-icon::after { content: ""; width: 5px; height: 9px; border: solid var(--ok); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.step.error .step-icon { border-color: var(--bad); background: var(--bad-bg); }
.step.error .step-icon::after { content: "!"; color: var(--bad); font: 700 0.8rem/1 var(--sans); }
.step.running .step-icon { border-color: var(--accent); background: var(--accent-soft); }
.step.running .step-icon::after { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.step.note .step-icon { border-style: dashed; }
.step-body { min-width: 0; }
.step-label { font-weight: 550; overflow-wrap: break-word; }
.step.note .step-label { font-weight: 400; color: var(--text-2); }
.step-who { font-size: 0.78rem; font-weight: 600; color: var(--text-3); margin-bottom: 1px; }
.step-sum { color: var(--text-3); font-size: 0.85rem; margin-top: 2px; overflow-wrap: anywhere; }
.step-meta { color: var(--text-3); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }

/* details */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 22px; margin: 0; }
.facts dt { color: var(--text-3); font-size: 0.88rem; }
.facts dd { margin: 0; overflow-wrap: break-word; }
.notes { margin: 16px 0 0; padding-left: 20px; color: var(--text-2); font-size: 0.88rem; }
.notes:empty { display: none; }

/* ---- history ---------------------------------------------------------------------------------- */
.aside-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 10px 10px; }
.aside-head h2 { font-size: 0.95rem; font-weight: 600; }
.history > .hint { margin: 0 0 8px 10px; }
.hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hist {
  display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; color: var(--text); text-decoration: none;
  border: 1px solid transparent; transition: background-color 0.15s ease;
}
.hist:hover { background: var(--surface-3); }
.hist[aria-current=true] { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.hist-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hist-host { flex: 1; min-width: 0; font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-time { flex: none; font-size: 0.78rem; color: var(--text-3); }
.hist-goal { font-size: 0.85rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.hist-meta { font-size: 0.78rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sdot { flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--text-3); }
.sdot.done { background: var(--ok); }
.sdot.blocked { background: var(--warn); }
.sdot.failed { background: var(--bad); }
.sdot.running, .sdot.queued { background: var(--run); animation: pulse 1.2s ease-in-out infinite; }
.hist .st-done { color: var(--ok); font-weight: 550; }
.hist .st-blocked { color: var(--warn); font-weight: 550; }
.hist .st-failed { color: var(--bad); font-weight: 550; }
.hist .st-running, .hist .st-queued { color: var(--run); font-weight: 550; }

/* ---- key dialog ------------------------------------------------------------------------------- */
.dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--r-surface); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(10, 13, 24, 0.5); backdrop-filter: blur(3px); }
.dialog form { padding: 22px 24px 24px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -8px 6px 0; }
.dlg-head h2 { font-size: 1.15rem; font-weight: 650; }
.dialog .hint { margin: 0 0 18px; }
.dialog .field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; min-height: 32px; margin: 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.msg { margin: 10px 0 0; font-size: 0.9rem; font-weight: 550; }
.msg:empty { display: none; }
.msg.good { color: var(--ok); }
.msg.bad { color: var(--bad); }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---- motion ----------------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- narrow screens --------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "history"; gap: 24px; padding-top: 20px; }
  .history { position: static; max-height: none; overflow: visible; padding: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .bar-in { padding: 0 14px; height: 56px; }
  .brand-sub, .kbd-hint { display: none; }
  /* the dot alone shows on a phone; the words stay for screen readers */
  #health-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .shell { padding: 14px 12px 4px; }
  .card { padding: 20px 16px; border-radius: 14px; }
  .field.small { width: calc(50% - 7px); }
  .field.small.run-with { width: 100%; }
  .step { grid-template-columns: 22px minmax(0, 1fr); }
  .step-meta { grid-column: 2; padding-top: 0; }
  .budget-hint { margin-bottom: 4px; }
  .submit, #start { width: 100%; }
  .job-head { flex-wrap: wrap; }
  .job-head #reuse { width: 100%; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .table td { max-width: 18em; }
  .foot { padding: 8px 16px 28px; }
}
