/* REA console. House baseline: every colour and font is a token on :root, no inline styles (strict CSP), AA contrast,
   visible focus on light and dark, no sideways scroll from 320 px up. System fonts, nothing loaded from elsewhere. */
:root {
  --bg: #f6f3ec; --panel: #ffffff; --text: #16202e; --mute: #566175; --line: #e1dccf; --field: #8a8574;
  --brand: #14b8a6; --brand-strong: #0b6e63; --on-brand: #04201c; --soft: #e7f6f3;
  --ok: #0f7a43; --bad: #b42318; --warn: #8a5300; --run: #1f5fbf; --code: #efece3;
  --r: 12px; --wrap: 1280px; --gutter: 16px; --side: 232px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --h-page: clamp(1.7rem, 3.4vw, 2.5rem);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --panel: #131d33; --text: #e8edf5; --mute: #a3aec2; --line: #22304d; --field: #6b7b99;
          --brand: #14b8a6; --brand-strong: #5eead4; --on-brand: #04201c; --soft: #11302f;
          --ok: #4cc38a; --bad: #ff8a7d; --warn: #f0b04f; --run: #8db4ff; --code: #0e1729; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1.0625rem/1.5 var(--sans); }
a { color: var(--brand-strong); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand-strong); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 8px 12px; z-index: 9; }
.skip:focus { left: 8px; top: 8px; }

/* shell: top bar on phones, side nav from 900 px */
.shell { min-height: 100vh; }
.side { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px var(--gutter); }
.brand { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-weight: 700; font-size: 1.15rem; }
.brand small { color: var(--mute); font-weight: 500; font-size: .85rem; }
.nav { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.nav a { display: inline-block; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { background: var(--soft); color: var(--brand-strong); font-weight: 700; }
.who { margin-top: 8px; color: var(--mute); font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
main { padding: 22px var(--gutter) 64px; max-width: var(--wrap); }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
  .side { border-bottom: 0; border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .nav { flex-direction: column; flex-wrap: nowrap; }
  main { padding: 28px 32px 72px; }
}

h1 { font-size: var(--h-page); line-height: 1.1; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.sub { color: var(--mute); margin: 0 0 22px; max-width: 70ch; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; }
@media (max-width: 900px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--mute); }
.right { text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions form { display: inline; margin: 0; }

/* tables scroll inside their panel, never the page */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--mute); font-weight: 600; font-size: .85rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.wrap { word-break: break-word; min-width: 16ch; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .8rem; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; }
.pill.s-SUCCEEDED { color: var(--ok); } .pill.s-FAILED, .pill.s-TIMED-OUT { color: var(--bad); }
.pill.s-ABORTED, .pill.s-ABORTING { color: var(--warn); } .pill.s-RUNNING, .pill.s-READY, .pill.s-ACTIVE { color: var(--run); }
.pill.s-off { color: var(--mute); } .stats .pill { font-size: .8rem; }

/* forms: field borders are 3:1 against the panel */
label { display: block; font-weight: 600; margin: 14px 0 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 6px 0; }
.check input { width: 20px; height: 20px; }
input[type=text], input[type=number], input[type=password], input[type=search], textarea, select {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--field); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
textarea { min-height: 96px; font-family: var(--mono); font-size: .9rem; }
.hint { color: var(--mute); font-size: .9rem; margin: 3px 0 0; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1 1 150px; min-width: 0; }
button, .btn { display: inline-block; background: var(--brand); color: var(--on-brand); border: 1.5px solid transparent; border-radius: 8px; padding: 9px 16px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.3; }
button:hover, .btn:hover { filter: brightness(1.07); }
.btn.ghost, button.ghost { background: transparent; color: var(--text); border-color: var(--field); }
button.danger { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { button.danger { color: #1a0604; } }
button.link { background: none; border: 0; padding: 0; color: var(--brand-strong); font-weight: 600; text-decoration: underline; }
.notice, .errors { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; border: 1.5px solid; }
.notice { border-color: var(--ok); background: var(--soft); }
.errors { border-color: var(--bad); }
.secret { font-family: var(--mono); font-size: 1rem; word-break: break-all; background: var(--code); padding: 12px; border-radius: 8px; border: 1.5px dashed var(--brand-strong); user-select: all; }

pre, code { background: var(--code); border-radius: 8px; font-family: var(--mono); font-size: .85rem; }
pre { padding: 12px; overflow: auto; max-height: 440px; white-space: pre-wrap; word-break: break-word; margin: 0; }
code { padding: 1px 6px; overflow-wrap: break-word; }
.stats { display: flex; gap: 10px 28px; flex-wrap: wrap; }
.stats b { display: block; font-size: 1.3rem; line-height: 1.2; }
.stats span { color: var(--mute); font-size: .85rem; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--field); text-decoration: none; color: var(--text); font-weight: 600; }
.tabs a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
meter { width: 100%; height: 14px; }
.bars td:nth-child(2) { width: 55%; }
.login { max-width: 420px; margin: 12vh auto; padding: 0 var(--gutter); }
details summary { cursor: pointer; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) { button, .btn, .nav a { transition: background-color .15s, filter .15s; } }
@media print { .side { display: none; } }
@media (min-width: 900px) { .shell.bare { display: block; } }
