:root {
  color-scheme: dark;
  --ground: #111111; --ledger: #0b0b0b; --raised: #191919;
  --rule: #292929; --control: #484848; --ink: #f1f1f1;
  --muted: #b4b4b4; --faint: #949494; --signal: #88c6d7; --failure: #ef8c96; --success: #94c6a8;
  --font: Arial, Helvetica, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --nav-width: clamp(320px, 24vw, 360px);
  --topbar: 64px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.5 var(--font); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 500; letter-spacing: -.7px; }
h2 { font-size: 15px; line-height: 1.4; font-weight: 500; }
h3 { font-size: 13px; font-weight: 500; }
a { color: inherit; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
button, input { font: inherit; color: inherit; }
button { min-height: 34px; border: 1px solid var(--control); border-radius: 5px; background: transparent; padding: 6px 11px; cursor: pointer; }
button:hover:not(:disabled) { background: var(--raised); border-color: var(--muted); }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.muted { color: var(--faint); font-size: 12px; }
.muted:empty, .message:empty, .page-status:empty { display: none; }
.eyebrow { font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--faint); }
.signal { display: inline-block; width: 6px; height: 6px; background: var(--signal); border-radius: 50%; vertical-align: middle; }
.notice { border: 1px solid #664149; padding: 10px 12px; border-radius: 4px; color: var(--failure); font-size: 12px; line-height: 1.5; }
.notice.quiet { border-color: var(--control); color: var(--muted); margin-bottom: 22px; }
.notice.quiet strong { color: var(--ink); font-weight: 500; }

.topbar { height: var(--topbar); display: flex; align-items: center; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--rule); background: var(--ledger); }
.brand { width: calc(var(--nav-width) - 24px); display: flex; align-items: center; gap: 10px; flex: none; }
.brand strong { font-size: 16px; font-weight: 500; letter-spacing: -.3px; }
.version { font: 10px var(--mono); color: var(--faint); padding: 1px 5px; border: 1px solid var(--rule); border-radius: 3px; }
.workspace-label { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.slash { color: var(--control); margin: 0 3px; }
.who { min-width: 0; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar > button { flex: none; font-size: 12px; min-height: 30px; }
.user-button { flex: none; display: flex; align-items: center; min-width: 28px; min-height: 28px; }
.user-button:empty { min-width: 0; }

.page-status { padding: 18px 24px; color: var(--muted); font-size: 13px; }
.centered { display: flex; justify-content: center; padding: 72px 24px; }
.empty { width: 100%; max-width: 440px; }
.empty h1 { margin: 14px 0 12px; }
.empty > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; margin-bottom: 24px; }

.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); height: calc(100vh - var(--topbar)); }
.navigator { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 22px 24px 18px; background: var(--ledger); border-right: 1px solid var(--rule); }
.navigator-heading { margin-bottom: 16px; }
.field-label { display: block; color: var(--faint); font-size: 11px; margin-bottom: 7px; }
input[type="text"] { display: block; width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--control); border-radius: 5px; background: transparent; font: 12px var(--mono); }
.hint { color: var(--faint); font-size: 11px; line-height: 1.45; margin: 6px 0 16px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.chip, .segmented label, .switch { position: relative; }
.chip input, .segmented input, .switch input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.chip span { display: flex; align-items: center; gap: 7px; min-height: 32px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 5px; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.chip span::before { content: ""; flex: none; width: 10px; height: 10px; border: 1px solid var(--control); border-radius: 2px; }
.chip span:hover { border-color: var(--muted); }
.chip input:checked + span { background: var(--raised); border-color: var(--control); color: var(--ink); }
.chip input:checked + span::before { background: var(--signal); border-color: var(--signal); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); }
.segmented span { display: block; padding: 5px 8px; border-radius: 4px; color: var(--faint); font-size: 12px; text-align: center; cursor: pointer; }
.segmented span:hover { color: var(--ink); }
.segmented input:checked + span { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--control); }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.track { flex: none; position: relative; width: 30px; height: 18px; border: 1px solid var(--control); border-radius: 9px; background: var(--ground); }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--faint); }
.switch input:checked + .track { background: var(--signal); border-color: var(--signal); }
.switch input:checked + .track::after { left: 14px; background: var(--ledger); }
.chip input:focus-visible + span, .segmented input:focus-visible + span, .switch input:focus-visible + .track { outline: 2px solid var(--signal); outline-offset: 2px; }
.switch + .hint { margin-left: 40px; }
.primary { background: var(--ink); border-color: var(--ink); color: var(--ground); font-weight: 500; }
.primary:hover:not(:disabled) { background: #ffffff; border-color: #ffffff; }
.wide { display: block; width: 100%; }
.wide + .wide { margin-top: 8px; }
#review-run { margin-top: 4px; }
.confirm { background: var(--raised); border-radius: 7px; padding: 16px; }
.confirm h3 { margin-bottom: 8px; }
.key-values { margin: 0 0 14px; }
.key-values > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid #333; }
.key-values dt { color: var(--faint); font-size: 11px; }
.key-values dd { margin: 0; font-size: 11px; overflow-wrap: anywhere; }
.confirm .notice { margin-bottom: 14px; }
.message { color: var(--muted); font-size: 12px; margin-top: 12px; }

.recent { flex: 1 0 220px; display: flex; flex-direction: column; min-height: 220px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--rule); }
.recent .navigator-heading { margin-bottom: 6px; }
.recent .message { margin-top: 6px; }
.run-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0 -8px; padding: 0; }
.run { padding: 11px 8px; border-bottom: 1px solid var(--rule); }
.run:last-child { border-bottom: 0; }
.run strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin: 5px 0; font-size: 12px; font-weight: 400; line-height: 1.45; }
.run-row-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--faint); font-size: 11px; }
.run-row-meta time { font: 10px var(--mono); white-space: nowrap; }
.run-state { font: 10px var(--mono); color: var(--muted); white-space: nowrap; }
.run-actor { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run a { flex: none; color: var(--muted); text-decoration: none; }
.run a:hover { color: var(--ink); text-decoration: underline; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--faint); vertical-align: 1px; }
.run[data-state="active"] .status-dot { background: var(--signal); }
.run[data-state="success"] .status-dot { background: var(--success); }
.run[data-state="failure"] .status-dot, .run[data-state="timed_out"] .status-dot, .run[data-state="startup_failure"] .status-dot { background: var(--failure); }
.run[data-state="failure"] .run-state, .run[data-state="timed_out"] .run-state, .run[data-state="startup_failure"] .run-state { color: var(--failure); }

.history-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.history-head { display: flex; align-items: baseline; gap: 14px; padding: 18px 24px 16px; border-bottom: 1px solid var(--rule); }
.history { display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: var(--ground); }
.history-failed { padding: 56px 24px; }
.history-failed h3 { font-size: 19px; font-weight: 400; margin: 12px 0 10px; }
.history-failed p:not(.eyebrow) { color: var(--faint); font-size: 12px; }

@media (max-width: 800px) {
  .shell { display: block; height: auto; }
  .brand { width: auto; }
  .navigator { overflow: visible; border-right: 0; border-bottom: 1px solid var(--rule); }
  .recent { flex: none; min-height: 0; }
  .run-list { max-height: 420px; }
  .history { flex: none; height: 80vh; min-height: 480px; }
}
@media (max-width: 650px) {
  :root { --topbar: 56px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .workspace-label, .who { display: none; }
  .brand { margin-right: auto; }
  .navigator { padding: 20px 16px; }
  .history-head { padding: 16px; }
  .history-failed { padding: 40px 16px; }
  .centered { padding: 48px 16px; }
}
