/* Light only: dark themes wash out on projectors. One spacing scale: 4, 8, 12, 16, 24, 32. */
:root {
  --bg: #fff; --fg: #111827; --muted: #6b7280; --line: #e5e7eb; --card: #f9fafb;
  --ok: #15803d; --ok-bg: #ecfdf3; --bad: #b91c1c; --bad-bg: #fef2f2; --busy: #a16207; --busy-bg: #fefce8;
  --accent: #1d4ed8; --accent-bg: #eff6ff; --brand: #b54a4a; --code: #0f172a;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* layout classes below set display, which would beat the attribute */
body { margin: 0; padding: 24px 16px 48px; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, sans-serif; }
main { max-width: 1200px; margin: 0 auto; }
h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
h2 { margin: 0 0 12px; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
p { margin: 4px 0; }
a { color: var(--accent); }
code { display: block; margin: 8px 0; padding: 8px 12px; border-radius: 6px; background: var(--code); color: #e2e8f0; font: 14px ui-monospace, monospace; overflow-x: auto; }
code.inline { display: inline; margin: 0; padding: 1px 6px; border-radius: 4px; background: var(--card); color: var(--fg); border: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
pre { margin: 8px 0 0; padding: 8px 12px; border-radius: 6px; background: var(--code); color: #e2e8f0; font: 12.5px/1.45 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.muted, .label { color: var(--muted); }
.label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.small { font-size: 13px; }
.good { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }
a.more { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
a.more:hover { text-decoration: underline; }

/* Header and navigation */
/* The chips are as tall as the title line and sit level with it. */
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; --bar: 36px; }
header h1 { line-height: var(--bar); }
header p { margin: 0; font-size: 13px; }
.brand { display: flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 700; }
.brand img { width: 1.1em; height: 1.1em; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.meta .tag { padding: 7px 14px; line-height: 20px; } /* 36px with the border, keeping label and value on one baseline */
.meta button { height: var(--bar); padding: 0 14px; }
/* A header menu: the models list and the account. */
.dropdown { position: relative; }
.dropdown summary { display: flex; align-items: baseline; gap: 4px; margin: 0; color: inherit; font-size: inherit; list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown .chevron { align-self: center; width: 6px; height: 6px; margin: 0 2px 3px 4px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .15s; }
.dropdown[open] .chevron { margin-bottom: -3px; transform: rotate(-135deg); }
.dropdown .menu { position: absolute; right: -11px; top: calc(100% + 10px); z-index: 1; min-width: 240px; padding: 10px 6px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .1); }
.dropdown .menu > .label { padding: 0 8px 6px; font-size: 11px; }
.models .model { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; }
.models .model.primary { background: var(--accent-bg); }
.models .rank { width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.models .primary .rank { background: var(--accent); color: #fff; }
.models .model .muted { font-size: 12px; }
.tag { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); white-space: nowrap; }
.tag .label { font-size: 11px; }
.account summary { align-items: center; gap: 6px; }
.avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; text-transform: uppercase; }
.account .menu { width: 260px; min-width: 0; padding: 12px; display: grid; gap: 10px; white-space: normal; }
.account .menu button { width: 100%; }
.dropdown summary:focus { outline: none; }
.dropdown summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
.account .menu > .label { padding: 0; }
.account .menu p { margin: 0; }
button.small { padding: 4px 12px; font-size: 13px; }
nav { display: flex; gap: 4px; margin: 16px 0 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
nav a { padding: 8px 12px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav a.on { color: var(--fg); border-bottom-color: var(--accent); }
nav .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; text-align: center; }

/* Status banner */
.banner { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 12px 16px; border-radius: var(--radius); border-left: 5px solid; }
.banner b { font-size: 18px; }
.banner.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.banner.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.banner.busy { background: var(--busy-bg); border-color: var(--busy); color: var(--busy); }
.banner span { color: var(--fg); }

/* Overview: the incident gets the room, the rest sits in a side column. */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.side .card + .card { margin-top: 16px; }
.side h2 { font-size: 15px; margin-bottom: 8px; }
.hint { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }

/* Vitals as compact rows */
.vital { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 8px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.group + .group { margin-top: 14px; }
.group > .label { margin-bottom: 4px; }
.group > .label + .vital { border-top: 0; padding-top: 0; }
.vital .name { font-weight: 600; font-size: 14px; }
.vital .value { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }
.vital .bar { position: relative; height: 6px; border-radius: 3px; background: var(--line); }
.vital .bar i { display: block; height: 100%; border-radius: 3px; background: var(--ok); transition: width .4s; }
.vital .bar u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .6; }
.vital .note { font-size: 12px; color: var(--muted); }
.vital.hot .value, .vital.hot .name { color: var(--bad); }
.vital.hot .bar i { background: var(--bad); }

/* Stats */
.score { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.score.wide { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 11px; }

/* Simulate a failure */
.faults .group { display: grid; gap: 8px; }
.fault { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 8px 10px; background: var(--card); border-radius: 8px; border-left: 3px solid transparent; }
.fault b { font-size: 14px; }
.fault span { grid-column: 1; font-size: 12px; color: var(--muted); }
.fault button { grid-row: 1 / span 2; grid-column: 2; }
.fault.active { border-left-color: var(--bad); background: var(--bad-bg); }
button { font: inherit; font-size: 14px; font-weight: 600; padding: 5px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; white-space: nowrap; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; font-weight: 500; color: var(--muted); }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--fg); color: var(--bg); font-weight: 600; }

/* Incident */
.incident-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.incident-head h2 { margin: 0; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.chip.open { background: var(--busy-bg); color: var(--busy); border-color: transparent; }
.chip.repaired { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.escalated { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips .chip { font-weight: 500; }
.steps { display: flex; margin: 24px 0 20px; padding: 0; list-style: none; counter-reset: step; }
.steps li { flex: 1; position: relative; padding-top: 26px; text-align: center; font-size: 12px; color: var(--muted); counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; line-height: 20px; border-radius: 50%; background: var(--line); color: var(--muted); font-weight: 700; font-size: 11px; z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::after { display: none; }
.steps li.done, .steps li.now, .steps li.fail { color: var(--fg); font-weight: 600; }
.steps li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.steps li.done::after, .steps li.now::after, .steps li.fail::after { background: var(--ok); }
.steps li.now::before { background: var(--busy); color: #fff; }
.steps li.fail::before { content: "✕"; background: var(--bad); color: #fff; }
.steps li.skip { opacity: .4; }
.alert-box { margin: 16px 0 8px; padding: 12px 14px; border-radius: 8px; background: var(--bad-bg); }
.alert-box .label { margin-bottom: 4px; }
.attempt-card { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.attempt-card > .row { margin-bottom: 8px; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline .step { position: relative; margin: 0 0 8px; padding: 8px 12px; background: var(--card); border-radius: 8px; }
.timeline .step::before { content: ""; position: absolute; left: -23px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.timeline .step.error::before, .timeline .step.rejected::before { background: var(--bad); }
.timeline .step.rejected { background: var(--bad-bg); }
.step-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.step-head .muted { white-space: nowrap; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 4px; }
blockquote.thinking { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--accent-bg); border-radius: 0 6px 6px 0; }
blockquote.thinking .label { font-size: 11px; color: var(--accent); }
blockquote.thinking p { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; }
blockquote.thinking p + p { margin-top: 6px; }
.timeline .step.decision { background: var(--bg); border: 1px solid var(--accent); }
.timeline .step.decision::before { background: var(--fg); }
.timeline .step.review::before { background: var(--busy); }
details.email { margin-top: 12px; }
details.email iframe { display: block; width: 100%; max-width: 640px; height: 900px; border: 1px solid var(--line); border-radius: 8px; background: #f1f5f9; }
.timeline .step.ran::before, .timeline .step.verified::before, .timeline .step.checked::before { background: var(--ok); }
.chip.tool { padding: 0 8px; font-size: 11px; background: var(--accent-bg); color: var(--accent); border-color: transparent; vertical-align: 1px; }
.timeline .step.verified { background: var(--ok-bg); }
.timeline .step.error { background: var(--bad-bg); }
.decision .diagnosis { font-size: 15px; font-weight: 600; }
.decision .action { margin-top: 10px; }
.decision .action .label { font-size: 11px; }
.verdict { margin-top: 8px; padding: 8px 12px; border-radius: 8px; }
.verdict.good { background: var(--ok-bg); }
.verdict.bad { background: var(--bad-bg); }
.escalation { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--bad); border-radius: 8px; background: var(--bad-bg); }
.escalation ol { margin: 4px 0 8px; padding-left: 20px; }
.actions { justify-content: flex-start; margin-top: 8px; }
.empty { padding: 24px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--radius); }

/* Tables: one line per row; long text is cut and shown in full on hover. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 8px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-top: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
td.text { white-space: normal; }
td.clip { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
td.time { color: var(--muted); font-variant-numeric: tabular-nums; }
td.kind { font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card); }
.k-alert, .k-error, .k-reject, .k-escalate, .k-detect, .k-inject { color: var(--bad); }
.k-allow, .k-execute, .k-verify, .k-recover { color: var(--ok); }
.k-observe, .k-start, .k-resolve { color: var(--muted); }
.k-propose, .k-tool { color: var(--accent); }
.k-operator, .k-notify { color: var(--busy); }

@media (max-width: 900px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  body { padding: 16px 16px 40px; }
  .steps li { font-size: 10px; }
  .step-head { flex-direction: column; gap: 2px; }
}

/* Navigation links look like buttons so they read as actions. */
a.btn { display: inline-block; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
a.btn:hover { background: var(--card); }
a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.back { margin-bottom: 12px; }
.card-foot { margin-top: 16px; }
.step > .label { font-size: 11px; margin-top: 8px; }
pre.args { background: var(--bg); color: var(--fg); border: 1px solid var(--line); margin-top: 6px; }
.auto { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

/* Repair tree */
.tree { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.tree-scroll { overflow-x: auto; margin: 8px 0 12px; }
.tree svg { display: block; max-width: 100%; height: auto; font: 12px system-ui, -apple-system, sans-serif; }
.tree .row-label { fill: var(--muted); font-weight: 600; }
.tree .node rect { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.tree .node-label { fill: var(--fg); font-weight: 600; }
.tree .node.alert rect { fill: var(--bad-bg); stroke: var(--bad); }
.tree .node.probe rect { fill: var(--accent-bg); stroke: var(--accent); }
.tree .node.probe.fail rect { stroke: var(--bad); stroke-dasharray: 4 3; }
.tree .node.candidate.pass rect, .tree .node.check.pass rect, .tree .node.run.pass rect { fill: var(--ok-bg); stroke: var(--ok); }
.tree .node.candidate.fail rect, .tree .node.failed rect, .tree .node.check.fail rect, .tree .node.run.fail rect { fill: var(--bad-bg); stroke: var(--bad); }
.tree .node.escalate rect, .tree .node.review rect { fill: var(--busy-bg); stroke: var(--busy); }
.tree .edge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.tree .edge.bad { stroke: var(--bad); stroke-dasharray: 5 4; }
.tree .edge-label { fill: var(--bad); font-size: 10px; text-anchor: middle; }
.tree .arrow { fill: var(--muted); }
.tree .arrow-bad { fill: var(--bad); }

code.anatomy .verb { color: #93c5fd; font-weight: 700; }
code.anatomy .flags { color: #cbd5e1; }
code.anatomy .target { color: #fcd34d; }
.proof ul.checks { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 4px; }
.proof ul.checks li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.proof ul.checks .mark { width: 18px; height: 18px; flex: none; border-radius: 50%; text-align: center; line-height: 18px; font-size: 11px; font-weight: 700; color: #fff; }
.proof ul.checks li.pass .mark { background: var(--ok); }
.proof ul.checks li.fail .mark { background: var(--bad); }
.proof ul.checks li.fail { color: var(--bad); font-weight: 600; }
.proof ul.checks .why { color: var(--muted); font-weight: 400; }
dialog.signin { border: 0; border-radius: 14px; padding: 28px; width: calc(100% - 32px); max-width: 380px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
dialog.signin::backdrop { background: rgba(15, 23, 42, .45); }
dialog.signin form { display: grid; gap: 12px; }
dialog.signin .brand { font-size: 17px; }
dialog.signin h2 { margin: 0; font-size: 22px; }
dialog.signin p { margin: 0; line-height: 1.5; }
dialog.signin .field { display: grid; gap: 6px; }
dialog.signin .field .label { display: flex; justify-content: space-between; }
dialog.signin input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
dialog.signin input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
dialog.signin button.primary { background: var(--brand); border-color: var(--brand); }
dialog.signin button.link { color: var(--brand); }
dialog.signin .error { padding: 8px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: 13px; font-weight: 600; }
dialog.signin .error[hidden] { display: none; }
button.wide { width: 100%; padding: 10px 14px; font-size: 15px; margin-top: 4px; }
button.wide:disabled { opacity: .7; cursor: default; }
dialog.signin button.link { justify-self: center; }
button.link { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--accent); cursor: pointer; }
