/* OCP Control Center — one stylesheet, no scripts, no external assets. */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14181f; --muted: #5b6573; --line: #dde1e7; --link: #1d4ed8;
  --running: #1d4ed8; --queued: #475569; --planning: #6d28d9; --testing: #0e7490; --waiting: #a16207;
  --blocked: #c2410c; --attention: #be123c; --legacy: #6b7280; --done: #15803d; --cancelled: #57534e;
  --failed: #b91c1c; --unknown: #7c3aed;
  --live: #15803d; --stale: #b45309; --unk: #7c3aed;
  --demo-bg: #fef3c7; --demo-ink: #78350f; --err-bg: #fee2e2; --err-ink: #7f1d1d; --info-bg: #e0f2fe; --info-ink: #0c4a6e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --panel: #171b21; --ink: #e6e9ee; --muted: #9aa4b2; --line: #2a313b; --link: #8ab4ff;
    --running: #6ea8ff; --queued: #a3adbb; --planning: #b794f6; --testing: #5cc8dc; --waiting: #e0b84a;
    --blocked: #f59e5b; --attention: #fb7185; --legacy: #9ca3af; --done: #4ade80; --cancelled: #b8b0a8;
    --failed: #f87171; --unknown: #c4a5ff; --live: #4ade80; --stale: #fbbf24; --unk: #c4a5ff;
    --demo-bg: #3a2c05; --demo-ink: #fde68a; --err-bg: #3b0d0d; --err-ink: #fecaca; --info-bg: #082f49; --info-ink: #bae6fd;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
code, time { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
h1 { font-size: 20px; margin: 12px 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

header.site { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; }
.brand { color: var(--ink); text-decoration: none; font-size: 15px; }
.signout { margin: 0; }
.linkish { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; }
.nav ul { list-style: none; margin: 0; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.nav a { display: block; padding: 8px 10px; white-space: nowrap; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--link); font-weight: 600; }
.statusbar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 6px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.ro { border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }

main { padding: 8px 16px 24px; max-width: 1600px; margin: 0 auto; }
footer { padding: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.lede { color: var(--muted); margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 12.5px; }

.banner { padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.banner-demo { background: var(--demo-bg); color: var(--demo-ink); }
.banner-error { background: var(--err-bg); color: var(--err-ink); }
.banner-stale { background: var(--demo-bg); color: var(--demo-ink); }
.banner-info { background: var(--info-bg); color: var(--info-ink); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tile { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: 8px 10px; min-width: 0; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.tile-value .unknown, .tile-value .cost { font-size: 15px; }
.tile-note { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.tile .fresh { white-space: normal; }
.inline-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #fff; background: var(--unknown); white-space: nowrap; }
.badge.lastknown { opacity: .75; outline: 1px dashed currentColor; }
.st-queued { --c: var(--queued); } .st-planning { --c: var(--planning); } .st-running { --c: var(--running); }
.st-testing { --c: var(--testing); } .st-waiting { --c: var(--waiting); } .st-blocked { --c: var(--blocked); }
.st-owner-attention { --c: var(--attention); } .st-legacy-review-hold { --c: var(--legacy); } .st-done { --c: var(--done); }
.st-cancelled { --c: var(--cancelled); } .st-failed { --c: var(--failed); } .st-unknown { --c: var(--unknown); }
.badge[class*="st-"] { background: var(--c); }
@media (prefers-color-scheme: dark) { .badge { color: #0f1216; } }
.tile[class*="st-"] { border-left-color: var(--c); }

.fresh { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 6px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.fresh-live { color: var(--live); } .fresh-stale { color: var(--stale); } .fresh-unknown { color: var(--unk); }
.health { font-weight: 700; font-size: 12px; }
.health-healthy { color: var(--live); } .health-degraded, .health-provisioning { color: var(--stale); }
.health-down { color: var(--failed); } .health-unknown { color: var(--unk); }
.unknown { color: var(--unk); font-weight: 600; }
.na { color: var(--muted); font-style: italic; }
.cost b { font-variant-numeric: tabular-nums; } .cost small { color: var(--muted); margin-left: 3px; }
.cost-unknown { color: var(--unk); font-weight: 700; }
.cost-lower b { color: var(--stale); }
.ev { font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 4px; border: 1px solid currentColor; }
.ev-pass { color: var(--done); } .ev-fail { color: var(--failed); } .ev-pending { color: var(--waiting); }
.ev-not-run { color: var(--muted); border-style: dashed; } .ev-not-available { color: var(--unk); border-style: dotted; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; margin: 1px; font-size: 12px; }

.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cost-line { font-size: 13px; font-weight: 400; }
.tile-cost .tile-value { font-size: 13px; }
main, .panel, .tile, .attention-card, .kv dd, .grid td, .banner, h1 { overflow-wrap: anywhere; min-width: 0; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.grid td { overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 4px 16px; margin: 0; }
.kv > div { display: contents; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0 0 12px; }
.filters label { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.filters label.check { display: flex; align-items: center; gap: 6px; }
.filters input[type=search], .filters select { font: inherit; padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); min-width: 0; }
button { font: inherit; padding: 5px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; }
.tabs { display: flex; gap: 4px; margin: 0 0 8px; flex-wrap: wrap; }
.tab { padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.tab[aria-current="page"] { background: var(--link); color: var(--panel); border-color: var(--link); }

.empty { border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; color: var(--muted); }
.empty p { margin: 0; }
.empty-na { border-color: var(--unk); color: var(--unk); }

.attention-list { display: grid; gap: 10px; }
.attention-card { border: 1px solid var(--line); border-left: 4px solid var(--attention); border-radius: 6px; padding: 10px 12px; }
.attention-card .reason { font-weight: 600; margin: 6px 0; }
.timeline { margin: 0; padding-left: 18px; }
.timeline li { margin: 3px 0; }

.login-main { max-width: 360px; margin: 12vh auto; padding: 16px; }
.login { display: grid; gap: 10px; }
.login label { display: grid; gap: 4px; }
.login input { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); }

/* Mobile: tables become cards; primary fields (state, executor, model, cost, blocker,
   freshness) come first and stay full size; secondary fields shrink. */
@media (max-width: 760px) {
  body { font-size: 14px; }
  main { padding: 8px 12px 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-wrap { overflow-x: visible; }
  table.grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid tr { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 8px; padding: 6px 4px; }
  .grid td { border: 0; padding: 3px 6px; }
  .grid td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .grid td.p { order: 1; flex: 1 1 45%; }
  .grid td.s { order: 2; flex: 1 1 45%; font-size: 12.5px; }
  .grid td:empty { display: none; }
  /* Primary cells come first in the DOM; the first secondary cell starts its own line, so the
     critical fields always sit above the metadata. */
  .grid td.p + td.s { flex-basis: 100%; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 6px; }
  .badge, .fresh, .health { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dd { margin-bottom: 6px; }
  .filters > * { flex: 1 1 140px; }
}

/* Current claims, fail-closed (views.claim, static/ocp-clock.js). The NOT CURRENT form is what
   is rendered; the current form is inert in a <template> until the clock check confirms its
   absolute deadline has not passed, and is removed again at that deadline. Visibility is
   switched with the `hidden` attribute, so it holds even without this stylesheet. */
[hidden] { display: none !important; }
.claim { display: inline; }
div.claim { display: block; }
.expiring-scope:not([data-claim="current"]) > .scope-body { opacity: .45; }
.scope-expired { font-weight: 700; color: var(--stale); }
.banner-expired { background: var(--err-bg); color: var(--err-ink); position: sticky; top: 0; z-index: 3; }
