:root {
  --ink: #1d2433;
  --muted: #5b6475;
  --line: #dfe3ea;
  --bg: #f5f6f8;
  --card: #ffffff;
  --accent: #1f4f8f;
  --accent-ink: #ffffff;
  --ok: #1d6b3a;
  --ok-bg: #e5f3ea;
  --bad: #a3261d;
  --bad-bg: #fbe9e7;
  --live: #1f4f8f;
  --live-bg: #e6eef9;
  --warn-bg: #fff6e0;
  --warn-line: #e8c66a;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }
h1 { font-size: 1.6rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h2.section { margin: 32px 0 8px; }
h3 { font-size: 1rem; margin: 0; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
p { margin: 0 0 12px; }

.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: 0.02em; }
.brand span { font-weight: 400; color: var(--muted); }
nav { display: flex; gap: 20px; align-items: center; }
nav a { text-decoration: none; }
nav form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.narrow { max-width: 560px; margin: 32px auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid + * { margin-top: 16px; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; }
.back { margin-bottom: 8px; }
.error-text { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
ul.plain { padding-left: 1.2em; margin: 0 0 12px; }
ul.plain li { margin-bottom: 4px; }

.alert { background: var(--bad-bg); color: var(--bad); border-radius: 6px; padding: 10px 12px; }
.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.banner.live { background: var(--live-bg); color: var(--live); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

.badge { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eceef2; color: var(--muted); white-space: nowrap; margin: 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.live { background: var(--live-bg); color: var(--live); }

label { font-weight: 600; font-size: 0.92rem; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #c4cad4; border-radius: 6px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9cbcec; outline-offset: 1px; }
input[readonly] { background: var(--bg); }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack button { margin-top: 10px; align-self: flex-start; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.row input { flex: 1 1 260px; }
form { margin: 0 0 12px; }

button, .button { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 6px; text-decoration: none; display: inline-block; }
button:disabled { opacity: 0.6; cursor: progress; }
button.primary { font-size: 1.05rem; padding: 12px 22px; }
button.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button.small { padding: 3px 10px; font-size: 0.85rem; background: #fff; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 400; text-decoration: underline; }

table { width: 100%; border-collapse: collapse; font-size: 0.93rem; position: relative; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
td.summary, .summary { color: var(--muted); font-size: 0.9rem; }
td.actions a { margin-right: 16px; }
table.dash { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; }
table.dash th:first-child, table.dash td:first-child { padding-left: 16px; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.kv dt { color: var(--muted); font-weight: 400; }
dl.kv dt label { font-weight: 400; font-size: inherit; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.secret-row { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
input.secret { width: 13em; font-family: ui-monospace, Menlo, Consolas, monospace; padding: 3px 8px; }

.status-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.countdown { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.countdown .label { display: block; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.countdown.soon { color: var(--bad); }

.stages { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
.stage { margin-bottom: 0; display: flex; flex-direction: column; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.stage.locked { background: #fafbfc; }
.stage.locked p { color: var(--muted); }
.stage.passed { border-left: 4px solid var(--ok); }
.run-form { margin-top: auto; }
.run-form label { display: block; margin-bottom: 4px; }
.run-form .row { margin-bottom: 0; }

.working::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border-radius: 50%; border: 2px solid var(--live); border-right-color: transparent; animation: spin 0.9s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .working::before { animation: none; } }

ol.log { list-style: none; margin: 0; padding: 12px; background: #11161f; color: #d8dee9; border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; max-height: 480px; overflow-y: auto; }
ol.log:empty { display: none; }
ol.log li { padding: 1px 0; white-space: pre-wrap; }
ol.log time { color: #7f8aa0; margin-right: 8px; }
ol.log li.warn span { color: #f1c86b; }
ol.log li.fail span { color: #ff8a80; }

@media (max-width: 560px) {
  .stages { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}
