/* Ahooy WP monitor. One stylesheet, no build step. Light and dark follow the OS. */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --text: #1b1f24;
  --muted: #5a636e;
  --border: #d8dce2;
  --border-strong: #b9c0c9;
  --link: #1a56a8;
  --focus: #2f6fd6;

  --red: #a4161a;
  --red-bg: #fde8e7;
  --red-solid: #b42318;
  --amber: #7a4800;
  --amber-bg: #fff0d4;
  --amber-line: #c98a12;
  --green: #1d6b35;
  --green-bg: #e3f4e8;
  --info: #1f4f8a;
  --info-bg: #e6eefa;
  --grey: #4b5563;
  --grey-bg: #eceef1;

  --dev: #5b2a86;
  --dev-bg: #f1e7fb;

  --radius: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #171b20;
    --surface-2: #1d2228;
    --text: #e5e8ec;
    --muted: #9ba4af;
    --border: #2c333b;
    --border-strong: #3d4651;
    --link: #8db8ff;
    --focus: #8db8ff;

    --red: #ffa39e;
    --red-bg: #3b1517;
    --red-solid: #c42b22;
    --amber: #ffcf7d;
    --amber-bg: #392a0d;
    --amber-line: #d39a2c;
    --green: #86dca0;
    --green-bg: #13301d;
    --info: #a6c8ff;
    --info-bg: #152740;
    --grey: #c3c9d1;
    --grey-bg: #272c33;

    --dev: #e2c6ff;
    --dev-bg: #34204a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
}

a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }

h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
h4 { font-size: .875rem; margin: 1rem 0 .4rem; }

.sr {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 8px; top: -40px; z-index: 10;
  background: var(--surface); color: var(--text); padding: 6px 10px; border-radius: var(--radius);
}
.skip:focus { top: 8px; }

.muted { color: var(--muted); }
.sub { display: block; color: var(--muted); font-size: .8rem; }
.mono { font-family: var(--mono); font-size: .8125rem; }
.num { text-align: right; }
.nowrap { white-space: nowrap; }

/* Dev banner (CONTRACT §9.4): on every page in dev mode. */
.dev-banner {
  background: var(--dev-bg); color: var(--dev);
  border-bottom: 2px solid var(--dev);
  padding: 6px 16px; font-size: .8125rem;
}
.dev-banner strong { letter-spacing: .06em; margin-right: .5rem; }

/* Header */
.top {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 1.25rem; }
.top nav a { color: var(--text); text-decoration: none; padding: 4px 2px; }
.top nav a[aria-current="page"] { border-bottom: 2px solid var(--text); }
.who { margin-left: auto; display: flex; align-items: center; gap: .75rem; min-width: 0; }
.who-email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
form.inline { display: inline; margin: 0; }

button, .button-link {
  font: inherit; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 6px 12px; text-decoration: none; display: inline-block;
}
button:hover, .button-link:hover { background: var(--surface-2); }
.primary { background: var(--text); color: var(--surface); border-color: var(--text); font-weight: 600; }
.primary:hover { background: var(--text); opacity: .9; }
.link-button { border: 0; background: none; padding: 0; color: var(--link); text-decoration: underline; }
.link-button:hover { background: none; }

main { padding: 16px; max-width: 1680px; margin: 0 auto; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 12px; }
.summary { margin: 0; color: var(--muted); }
.controls { display: flex; align-items: center; gap: 1rem; }
.toggle { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; cursor: pointer; }
.toggle input { width: 16px; height: 16px; margin: 0; }
.crumb { margin: 0 0 .5rem; }

/* Data-source freshness strip */
.feeds ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.feed {
  display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: .8125rem;
}
.feed .sub { display: inline; }
.feed-name { font-weight: 600; }
.feed-ok .feed-state { color: var(--green); }
.feed-stale { border-color: var(--amber-line); background: var(--amber-bg); }
.feed-stale .feed-state { color: var(--amber); font-weight: 600; }

.warnings { margin: 0 0 12px; padding: 6px 10px; border: 1px solid var(--amber-line); background: var(--amber-bg); color: var(--amber); border-radius: var(--radius); }
.warnings summary { cursor: pointer; font-weight: 600; }
.warnings ul { margin: .4rem 0 0; padding-left: 1.2rem; }

/* Tables */
.table-wrap { overflow-x: auto; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 6px 10px; border-bottom: 1px solid var(--border); }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }

table.sites { font-size: 13px; line-height: 1.3; }
table.sites thead th { position: sticky; top: 0; z-index: 1; padding: 0; font-size: 11px; }
table.sites tbody th, table.sites td { padding: 5px 8px; }
table.sites tbody th { font-weight: 600; max-width: 15rem; overflow-wrap: anywhere; }
table.sites tbody th a { color: var(--text); }
table.sites td { white-space: nowrap; }
table.sites .sub { font-size: 12px; }
table.sites td:last-child { white-space: normal; min-width: 11rem; max-width: 16rem; }
table.sites .lc-what { max-width: 15rem; }
table.sites .flags { gap: 3px; }
table.sites .chip { font-size: 11px; line-height: 1.45; }
table.sites .flags .chip { white-space: normal; }
table.sites .vulns { flex-wrap: nowrap; }
table.sites .sort { padding: 7px 8px; }
table.sites tbody tr:hover > * { background: var(--surface-2); }
.row-red > th { box-shadow: inset 4px 0 0 var(--red-solid); }
.row-amber > th { box-shadow: inset 4px 0 0 var(--amber-line); }
.row[hidden] { display: none; }

.sort {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .3rem;
  width: 100%; padding: 8px 10px; cursor: pointer;
  font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit;
}
.sort:hover { color: var(--text); }
.sort:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.sort-ind::after { content: "↕"; opacity: .35; }
th[aria-sort="ascending"] .sort-ind::after { content: "▲"; opacity: 1; }
th[aria-sort="descending"] .sort-ind::after { content: "▼"; opacity: 1; }
th[aria-sort] { color: var(--text); }

table.list.compact { font-size: 13px; }
table.list.compact td, table.list.compact th { padding: 4px 8px; }
table.list.compact .sub { font-size: 11px; overflow-wrap: anywhere; }
table.list td .sub { margin-top: 1px; }

/* Versions with state: shape as well as colour carries the state. */
.ver { display: inline-flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: .8125rem; padding: 1px 6px; border-radius: var(--radius); border: 1px solid transparent; }
.ver-green { padding-left: 0; padding-right: 0; }
.ver-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.ver-red { color: #fff; background: var(--red-solid); font-weight: 700; }
.ver-unknown { color: var(--grey); background: var(--grey-bg); border: 1px dashed var(--border-strong); }

/* Severity */
.sev { display: inline-block; font-size: .75rem; font-weight: 600; padding: 0 6px; border-radius: 999px; line-height: 1.5; border: 1px solid transparent; }
.sev-critical { color: #fff; background: var(--red-solid); }
.sev-high { color: var(--red); background: var(--red-bg); border-color: var(--red); }
.sev-unknown { color: var(--red); background: var(--red-bg); border-style: dashed; border-color: var(--red); }
.sev-medium { color: var(--amber); background: var(--amber-bg); }
.sev-low { color: var(--grey); background: var(--grey-bg); }

.vulns { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.vuln-count { font-weight: 700; }
.vuln-unknown { color: var(--red); font-weight: 600; }
.sep { color: var(--muted); }

/* Chips (flags, small labels) */
.flags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; font-size: .75rem; line-height: 1.5; padding: 0 6px; border-radius: var(--radius); border: 1px solid transparent; white-space: nowrap; }
.chip-red { color: #fff; background: var(--red-solid); font-weight: 600; }
.chip-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.chip-info { color: var(--info); background: var(--info-bg); }
.chip-grey { color: var(--grey); background: var(--grey-bg); }
.chip-ok { color: var(--green); background: var(--green-bg); }
.chip-stale { color: var(--amber); background: var(--amber-bg); border: 1px dashed var(--amber-line); }

/* Reporting */
.rep { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.rep-green { color: var(--green); }
.rep-green .dot { background: var(--green); }
.rep-red { color: var(--red); }
.rep-red .dot { background: var(--red-solid); border-radius: 1px; }
.rep-grey { color: var(--grey); font-weight: 400; }

.lc-what { display: inline-block; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.lc-by { color: var(--text); }

.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.attribution { color: var(--muted); font-size: .8rem; margin-top: 12px; }

/* Notices */
.notice { padding: 8px 12px; border-radius: var(--radius); border: 1px solid; margin: 0 0 12px; }
.notice-ok { color: var(--green); background: var(--green-bg); border-color: transparent; }
.notice-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.notice-red { color: var(--red); background: var(--red-bg); border-color: var(--red); }
.notice-grey { color: var(--grey); background: var(--grey-bg); border-color: transparent; }
.note { display: block; margin-top: .25rem; color: var(--text); white-space: pre-wrap; }

/* Site page */
.site-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); gap: 16px; align-items: start; }
@media (min-width: 1101px) { .col-side { position: sticky; top: 16px; } }
.site-grid section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.site-grid section .table-wrap { border-radius: 0; }
.col-side section { margin-bottom: 16px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 10px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts.compact { grid-template-columns: 1fr; gap: 6px; }
.hash { font-size: .75rem; word-break: break-all; }
.flag-row { margin-top: 12px; }

.attribution-box { margin: 8px 0 0; padding: 8px 12px; font-size: .8rem; color: var(--muted); border-left: 3px solid var(--border-strong); background: var(--surface-2); }
.attribution-box h4 { margin: 0 0 .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.attribution-box p { margin: .25rem 0; }
.vuln-row-unknown td { background: var(--surface-2); }

details { margin: 0 0 6px; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details > .table-wrap, details > p, details > ul, details > dl { margin-bottom: 10px; }
ul.plain { list-style: none; padding: 0; margin: 4px 0 10px; }
ul.plain li { padding: 4px 0; border-bottom: 1px solid var(--border); }
ul.paths { font-family: var(--mono); font-size: .75rem; margin: 0 0 8px; padding-left: 1.2rem; overflow-wrap: anywhere; }

.review-form { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 4px; }
.review-form fieldset { border: 0; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.review-form legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.review-form label { display: block; }
.review-form textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 8px; margin: 4px 0 10px; resize: vertical; }

.type { white-space: nowrap; font-size: .75rem; padding: 0 6px; border-radius: var(--radius); background: var(--grey-bg); color: var(--grey); }
.type-event { background: var(--info-bg); color: var(--info); }
.type-alert { background: var(--red-bg); color: var(--red); }
.type-review { background: var(--green-bg); color: var(--green); }
.hist-outside > td:first-child { box-shadow: inset 3px 0 0 var(--amber-line); }
.hist-failure > td:first-child { box-shadow: inset 3px 0 0 var(--red-solid); }

/* Login and error */
.login-card, .error-card {
  max-width: 26rem; margin: 10vh auto 0; padding: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.login-card .primary { width: 100%; text-align: center; padding: 10px 14px; margin: 12px 0 8px; }
.login-card form { margin: 0; }
.error-card .status { font-family: var(--mono); color: var(--muted); margin: 0; }

/* Global messages */
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 16px; }
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 34rem); gap: 16px; align-items: start; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.msg-form .field { margin: 0 0 12px; min-width: 0; }
.msg-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.msg-form input, .msg-form textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 8px; }
.msg-form textarea { resize: vertical; }
.msg-form .field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.hint { color: var(--muted); font-size: .8rem; margin: 4px 0 0; }
.field-error { color: var(--red); font-size: .85rem; font-weight: 600; margin: 4px 0 0; }
.has-error input, .has-error textarea { border-color: var(--red); border-width: 2px; }
.notice ul { margin: 4px 0 0; padding-left: 1.25rem; }
.notice p { margin: 0; }
.notice-red a { color: inherit; }
table.messages .msg-text { max-width: 34rem; overflow-wrap: anywhere; }
table.messages .actions { white-space: nowrap; }
table.messages .actions form { margin-left: 6px; }
.chip-state-active { color: var(--green); background: var(--green-bg); font-weight: 600; }
.chip-state-scheduled { color: var(--info); background: var(--info-bg); }
.chip-state-ended { color: var(--grey); background: var(--grey-bg); }
.preview .wpbox-pair { display: grid; gap: 12px; }
.wpbox-wrap { margin: 0; }
.wpbox-wrap figcaption { color: var(--muted); font-size: .8rem; margin-bottom: 4px; }
/* The WordPress dashboard is light whatever the OS theme, so the preview is too. */
.wpbox { background: #fff; color: #1d2327; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); font-size: 13px; line-height: 1.4; }
.wpbox-title { font-size: 14px; font-weight: 600; margin: 0; padding: 8px 12px; border-bottom: 1px solid #c3c4c7; }
.wpbox-body { padding: 4px 12px 12px; }
.wpbox-body p { margin: 8px 0; overflow-wrap: anywhere; }
.wpbox-report, .wpbox a { color: #2271b1; text-decoration: underline; }
.wpbox-msgs { border-top: 1px solid #dcdcde; margin-top: 10px; }
.history .ack { margin-top: 4px; }
.history .ack summary { cursor: pointer; color: var(--link); font-size: .8rem; }
.history .ack textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 4px 6px; margin: 4px 0; }
.history .ack label { display: block; font-size: .8rem; }

/* Phase 2: exception and held badges (CONTRACT §5.7) */
.chip-exception { color: var(--dev); background: var(--dev-bg); border-color: var(--dev); font-weight: 600; }
.chip-held { color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line); font-weight: 600; }
.notice-held { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.notice-info { color: var(--info); background: var(--info-bg); border-color: transparent; }
.notice-info .sub, .notice-held .sub { color: inherit; opacity: .85; }
.notice > p + p { margin-top: .35rem; }

/* Review form with exception plugins */
ul.exceptions { list-style: none; margin: .4rem 0 0; padding: 0; color: var(--text); }
ul.exceptions li { padding: 4px 0; border-top: 1px solid var(--border); }
ul.exceptions .check { display: block; color: var(--text); font-size: .85rem; }
.review-form fieldset.exc { border-top: 1px solid var(--border); padding-top: 8px; }
.exc-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.exc-row .field { min-width: 0; }
.review-form select, .review-form input[type="text"], .side-form input[type="text"], .side-form textarea, .item-form input[type="text"], .report-form input, .report-form select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 5px 8px;
}
.review-form .check-label { display: flex; gap: .4rem; align-items: flex-start; margin: 8px 0; }
.review-form .has-error select, .review-form .has-error input, .side-form.has-error textarea, [aria-invalid="true"] { border-color: var(--red); }
fieldset[aria-invalid="true"] { border-left: 3px solid var(--red); padding-left: 8px; }
.side-form { margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.side-form label { font-weight: 600; }
.reissue { margin-top: 8px; }

/* Site page: empty or idle sections as one line; forms used now and then fold away */
.site-grid section.slim { padding: 8px 16px; }
.site-grid section.slim > h2 { display: inline; font-size: 1rem; margin: 0 .5rem 0 0; }
.slim > details, .slim > .side-form { margin-top: 6px; }
.row-form { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.row-form .hint { margin: 0; }
.form-details > summary { color: var(--link); font-weight: 600; }
.form-details[open] > summary { color: var(--text); }
.page-head .controls form.inline { display: inline-flex; }

/* Outgoing calls */
.out-failing > td { background: var(--red-bg); }
.chip-amber-text { color: var(--amber); }

/* Timeline types */
.type-hold { background: var(--amber-bg); color: var(--amber); }
.type-policy, .type-policy_applied { background: var(--dev-bg); color: var(--dev); }
.type-outgoing { background: var(--red-bg); color: var(--red); }
.type-round { background: var(--green-bg); color: var(--green); }
.type-change { background: var(--grey-bg); color: var(--grey); }

/* Update log filter */
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.filter-label { color: var(--muted); font-size: .8rem; }
.filter a { text-decoration: none; font-size: .8rem; padding: 1px 8px; border-radius: var(--radius); border: 1px solid var(--border); }
.filter a[aria-current="true"] { outline: 2px solid var(--text); outline-offset: 0; font-weight: 600; }
.pager { margin-top: 12px; }
.page-head .controls { flex-wrap: wrap; gap: .5rem; }

/* Rounds */
.chip-round-open { color: var(--info); background: var(--info-bg); font-weight: 600; }
.chip-round-complete { color: var(--green); background: var(--green-bg); }
.chip-round-abandoned { color: var(--grey); background: var(--grey-bg); }
.chip-item-open { color: var(--amber); background: var(--amber-bg); border: 1px dashed var(--amber-line); }
.chip-item-ok { color: var(--green); background: var(--green-bg); }
.chip-item-failed { color: #fff; background: var(--red-solid); font-weight: 600; }
.chip-item-na { color: var(--grey); background: var(--grey-bg); }
ol.checklist { list-style: none; margin: 0; padding: 0; }
.checklist .item { padding: 10px 0 10px 10px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.checklist .item:last-child { border-bottom: 0; }
.checklist .item-open { border-left-color: var(--amber-line); }
.checklist .item-failed { border-left-color: var(--red-solid); }
.checklist .item.has-error { background: var(--red-bg); }
.item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.item-label { font-weight: 600; }
.detail { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-top: 4px; }
.item-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.item-form input[type="text"] { flex: 1 1 14rem; width: auto; }
.item-form .hint { flex-basis: 100%; margin: 0; }
.item-form .field-error { flex-basis: 100%; }
fieldset.seg { border: 0; margin: 0; padding: 0; display: inline-flex; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-block; padding: 4px 10px; border: 1px solid var(--border-strong); margin-left: -1px; background: var(--surface); }
.seg label:first-of-type span { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 var(--radius) var(--radius) 0; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; position: relative; }
.seg-open input:checked + span { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); font-weight: 600; }
.seg-ok input:checked + span { background: var(--green-bg); color: var(--green); border-color: var(--green); font-weight: 600; }
.seg-failed input:checked + span { background: var(--red-solid); color: #fff; border-color: var(--red-solid); font-weight: 600; }
.seg-na input:checked + span { background: var(--grey-bg); color: var(--grey); border-color: var(--grey); font-weight: 600; }
button[aria-disabled="true"] { opacity: .55; }

tr.row-before > td { color: var(--muted); background: var(--surface-2); }
tr.row-before .chip-ok, tr.row-before .chip-red { opacity: .7; }
tr.group-before > th { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2); text-transform: none; letter-spacing: 0; border-top: 2px solid var(--border-strong); }

.from-event { color: var(--info); font-style: italic; }

/* Round import */
.chip-import-pending { color: var(--info); background: var(--info-bg); }
.chip-import-confirmed { color: var(--green); background: var(--green-bg); }
.chip-import-discarded, .chip-import-expired { color: var(--grey); background: var(--grey-bg); }
.import-sites { display: grid; gap: 12px; margin-bottom: 16px; }
.import-site h3 { margin-top: 0; }
.import-skip { opacity: .75; border-style: dashed; }
ul.items li { display: block; }
.decide { display: flex; gap: 8px; }
input[type="file"] { font: inherit; }

/* Printable report (CONTRACT §9.7) */
.report-controls { max-width: 60rem; margin: 0 auto 16px; }
.report-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.report-form label { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: var(--muted); }
.report { max-width: 60rem; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.report-head { border-bottom: 2px solid var(--text); margin-bottom: 16px; padding-bottom: 8px; }
.report-head p { margin: 2px 0; }
.report-brand { font-weight: 650; letter-spacing: .04em; text-transform: uppercase; font-size: .75rem; color: var(--muted); }
.report section { margin: 0 0 20px; break-inside: auto; }
.report h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.report-table { font-size: 13px; }
.report-table thead th { background: none; }
.report-failure td { color: var(--red); }
.report-round { break-inside: avoid; }
.report-state { display: inline-block; min-width: 12rem; font-weight: 600; }
.report-state-failed { color: var(--red); }
.report-state-ok { color: var(--green); }
.report-notices { font-size: .75rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.report-notices h2 { font-size: .8rem; border: 0; }

/* Phase 3: updates, select sites, batches, checks, rounds due (CONTRACT v1.12) */
.sub-inline { color: var(--muted); font-size: .8rem; }
.type-job { background: var(--dev-bg); color: var(--dev); }
.type-check { background: var(--info-bg); color: var(--info); }
.filter-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.filter-form select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 4px 6px; }
ul.versions { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; }
tr.row-vulnerable > th { border-left: 3px solid var(--red-solid); }
tr.row-untickable > td, tr.row-untickable > th { color: var(--muted); }
tr.row-untickable a { color: var(--link); }
tr.row-failed > td, tr.row-failed > th { background: var(--red-bg); }
tr.row-warning > td, tr.row-warning > th { background: var(--amber-bg); }
tr.row-quiet > td, tr.row-quiet > th { color: var(--muted); }
tr.has-error > td, tr.has-error > th { background: var(--red-bg); }
td.tick { width: 2rem; text-align: center; }
td.tick input { width: 1.1rem; height: 1.1rem; }
td.tick input:disabled { opacity: .35; cursor: not-allowed; }
.select-tools { display: flex; gap: 12px; margin: 0 0 8px; }
.submit-row { margin: 12px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.held-box, .exc-box { margin-top: 4px; }
.held-box .check-label { display: flex; gap: .4rem; align-items: center; margin-top: 4px; font-weight: 600; color: var(--amber); }
.exc-box .check, .item .check { display: block; font-size: .85rem; }
.note-inline { font-size: .85rem; }
p.reason { margin: 4px 0 0; font-size: .85rem; color: var(--text); }
ul.vuln-list { list-style: none; margin: 0; padding: 0; }
ul.vuln-list li { margin: 2px 0; }
details.more summary { cursor: pointer; font-size: .8rem; color: var(--link); }
.counts { display: flex; flex-wrap: wrap; gap: 4px; }
.mono.wrap, td.wrap { overflow-wrap: anywhere; word-break: break-word; }
.detail-list { margin: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 12px; }
.shot { margin: 0; }
.shot figcaption { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.shot img { display: block; width: 100%; height: auto; max-height: 36rem; object-fit: cover; object-position: top; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
tr.shot-row > td { background: var(--surface-2); }
section.stop { margin: 0 0 16px; padding: 12px 16px; }
section.stop h2 { margin-top: 0; color: inherit; }
section.stop .side-form label { color: var(--text); }
.evidence { font-weight: 600; }
.evidence-ok { color: var(--green); }
.evidence-red { color: var(--red); }
.evidence-amber { color: var(--amber); }
.evidence-row { margin: 4px 0 0; }
ul.reasons { margin: 4px 0 0; padding-left: 1.1rem; font-size: .8rem; }
ul.commands { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.cmd { display: flex; align-items: stretch; gap: 6px; }
.cmd pre { flex: 1 1 auto; margin: 4px 0 0; padding: 6px 10px; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font: .85rem/1.4 var(--mono); }
.cmd button.copy { margin-top: 4px; }
.run-checks .check-label { display: flex; gap: .4rem; align-items: flex-start; font-weight: 400; }
ul.results li { margin: 2px 0; }

@media (max-width: 1100px) {
  .site-grid, .msg-grid { grid-template-columns: minmax(0, 1fr); }
  .report { padding: 16px; }
}

@media (max-width: 640px) {
  main { padding: 12px 16px; }
  .top { flex-wrap: wrap; gap: .5rem 1rem; }
  .who-email { max-width: 12rem; }
  .msg-form .field-row { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .dev-banner, .top, .controls, .form-details, .review-form, .msg-form, .ack, .screen-only, .side-form, .item-form, .skip { display: none !important; }
  .table-wrap { overflow: visible; border: 0; }
  /* The report prints in black on white whatever the OS theme. */
  body.view-report { background: #fff; color: #000; font-size: 10.5pt; }
  .view-report main { padding: 0; max-width: none; }
  .view-report .report { border: 0; padding: 0; max-width: none; background: #fff; color: #000; }
  .view-report .sub, .view-report .muted, .view-report .report-notices, .view-report .report-brand { color: #444; }
  .view-report a { color: #000; }
  .view-report th, .view-report td { border-bottom-color: #bbb; }
  .view-report .report-failure td, .view-report .report-state-failed { color: #000; font-weight: 700; }
  .view-report .report-state-ok { color: #000; }
  .view-report tr.row-before > td { color: #555; background: none; font-style: italic; }
  .view-report tr.group-before > th { color: #333; background: none; }
  .view-report h2 { break-after: avoid; }
  .view-report tr { break-inside: avoid; }
  @page { margin: 16mm 14mm; }
}
.page-text { white-space: pre-wrap; max-height: 20em; overflow: auto; font-size: .85em; }
