/* One hand-written stylesheet. Plain, readable, no framework. */
:root {
    --ink: #1d2433;
    --muted: #5b6475;
    --line: #dde1e8;
    --paper: #ffffff;
    --bg: #f5f6f8;
    --brand: #1f5f99;
    --brand-ink: #ffffff;
    --ok: #1f7a4d;
    --ok-bg: #e7f5ee;
    --warn: #8a5a00;
    --warn-bg: #fff4dc;
    --bad: #a3271f;
    --bad-bg: #fdecea;
    --radius: 6px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: #174a78; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
h1 { font-size: 1.6rem; margin: 0.5rem 0; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; background: #eef0f4; padding: 0 0.25em; border-radius: 3px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
.site-header { background: var(--ink); color: #fff; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.55rem 1rem; font-size: 0.92rem; }
.brand { color: #fff; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; margin-right: 0.5rem; }
.brand:hover { color: #fff; }
.brand-mark { color: #8fc1f0; flex: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.1rem; }
.site-header nav a, .site-header a { color: #d7e3f4; text-decoration: none; }
.site-header nav a { padding: 0.25rem 0.5rem; border-radius: var(--radius); }
.site-header nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.site-header nav a.active { color: #fff; background: rgba(255,255,255,0.14); }
.header-meta { margin-left: auto; display: flex; gap: 0.75rem; align-items: center; font-size: 0.85rem; white-space: nowrap; }
.demo-clock { background: #2e3850; padding: 0.15rem 0.5rem; border-radius: var(--radius); }
.who { color: #b9c4d6; margin-right: 0.4rem; }
.link-button { background: none; border: 0; color: #d7e3f4; cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }
.site-footer { color: var(--muted); font-size: 0.85rem; padding: 2rem 1rem; }
main { padding-top: 1rem; padding-bottom: 2rem; }

.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.card h2:first-child { margin-top: 0; }
.card.narrow { max-width: 520px; }
.card.warning { border-color: var(--warn); background: var(--warn-bg); }
.card.success { border-color: var(--ok); background: var(--ok-bg); }
.cards, .ways-in { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.cards .card, .ways-in .card { margin: 0; }
.hero p { max-width: 75ch; font-size: 1.05rem; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
form.inline { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }
.inline-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.button { display: inline-block; padding: 0.45rem 0.9rem; border: 1px solid #c9cfd8; border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.button:hover { border-color: var(--brand); color: var(--ink); }
.button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.button.primary:hover { background: #174a78; border-color: #174a78; color: var(--brand-ink); }
.button.danger { color: var(--bad); border-color: var(--bad); }
.button.danger:hover { background: var(--bad-bg); }
.button.small { padding: 0.15rem 0.5rem; font-size: 0.85rem; }

.flash { padding: 0.6rem 0.9rem; border-radius: var(--radius); border: 1px solid; }
.flash:empty { display: none; }
.flash-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.flash-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.flash-error { color: var(--bad); background: var(--bad-bg); border-color: var(--bad); }
.validation-summary-valid { display: none; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.stack > label, .stack > textarea { width: 100%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem 1rem; width: 100%; }
label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
label.checkbox { flex-direction: row; align-items: center; gap: 0.4rem; }
.label { font-size: 0.9rem; }
input, select, textarea { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid #c4cad4; border-radius: 4px; background: #fff; }
input[type=checkbox], input[type=radio] { width: 1.05rem; height: 1.05rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; width: 100%; background: var(--paper); }
legend { font-weight: 600; padding: 0 0.3rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin: 0.75rem 0; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }

.table-scroll { overflow-x: auto; margin: 0.5rem 0; }
.table-scroll > table.data { margin: 0; }
table.data { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); margin: 0.5rem 0; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: #f0f2f5; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); vertical-align: bottom; }
table.data tbody tr:hover { background: #f8f9fb; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data.compact { font-size: 0.85rem; }
table.data .num { text-align: right; white-space: nowrap; }
table.data th.num { white-space: normal; }
table.netsheet th { max-width: 7rem; }
.nowrap { white-space: nowrap; }

table.netsheet td { vertical-align: middle; }
table.netsheet td.option { min-width: 12rem; }
table.netsheet td.option strong { display: block; }
.option-sub { display: block; color: var(--muted); font-size: 0.85rem; }
table.netsheet td.option .badge { margin-top: 0.25rem; }
table.netsheet td.flags { min-width: 13rem; }
table.netsheet td.net { font-size: 1rem; }
table.netsheet tr.estimate, table.netsheet tr.estimate:hover { background: #f2f7fc; }
table.netsheet tr.estimate td { color: #3e4a5e; font-style: italic; }
table.netsheet tr.late, table.netsheet tr.late:hover { background: var(--warn-bg); }
table.netsheet tr.best td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
table.netsheet tr.best td.net { color: var(--ok); }
.error-text { color: var(--bad); max-width: 28ch; }

.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.8rem; background: #e6e9ef; color: var(--ink); white-space: nowrap; }
.badge-draft, .badge-queued, .badge-applied { background: #e6e9ef; }
.badge-published, .badge-distributing, .badge-sent, .badge-viewed, .badge-pending, .badge-processing, .badge-active { background: #e3edf9; color: #1d4f80; }
.badge-offersclosed, .badge-presented, .badge-offered { background: #efe7fa; color: #5a2d91; }
.badge-accepted, .badge-vetted { background: var(--ok-bg); color: var(--ok); }
.badge-withdrawn, .badge-expired, .badge-declined, .badge-rejected { background: #f1f1f1; color: var(--muted); }
.badge-dead, .badge-suspended { background: var(--bad-bg); color: var(--bad); }
.flag { display: inline-block; font-size: 0.75rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 0.35rem; margin: 0 0.2rem 0.2rem 0; background: #fafbfc; }
.flag-late { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }

.facts { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.facts dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.photos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.photos img, .photo-option img { border-radius: 4px; border: 1px solid var(--line); background: #eef0f4; }
.photo-picker { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.photo-option { flex-direction: row; align-items: center; }

.matches { list-style: none; padding: 0; }
.match { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; }
.match-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.score { display: inline-grid; place-items: center; min-width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; }
.reasons { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.88rem; color: var(--muted); }
.reasons.errors { color: var(--bad); }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0.35rem 0 0.35rem 0.9rem; font-size: 0.9rem; }
.timeline time { color: var(--muted); margin-right: 0.5rem; font-variant-numeric: tabular-nums; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 0.85rem; width: 8px; height: 8px; border-radius: 50%; background: #b8c2d1; }
.event-data { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.85rem; word-break: break-word; }

.inbox { list-style: none; padding: 0; }
.message { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin-bottom: 0.6rem; }
.message-head { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: baseline; }
.message-body { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 0.9rem; margin: 0.4rem 0 0; }

.switches, .counts { list-style: none; padding: 0; margin: 0; }
.switches li { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.switches li:last-child { border-bottom: 0; }
.switch-label { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; min-width: 0; }
.counts li { padding: 0.15rem 0; }
.why { margin-top: 0.75rem; }
.why summary, details > summary { cursor: pointer; }
.page-foot { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.decline input { min-width: 14rem; }
.quarantine summary { cursor: pointer; }
.assumptions { font-size: 0.85rem; max-width: 100ch; }

@media (max-width: 640px) {
    .header-meta { margin-left: 0; }
    table.data { display: block; overflow-x: auto; }
    .table-scroll > table.data { display: table; }
    .decline { flex-wrap: wrap; }
    .decline input { min-width: 0; flex: 1; }
    .facts dl { grid-template-columns: 1fr; }
}
