/*
   Direction: an instrument panel. Dense, quiet, high contrast.
   The page is monochrome except for status, so any colour on screen means
   something is wrong. The dashboard is a matrix: a row per site, a column per
   check, so one bad cell is visible immediately and a bad column means the
   host broke every site at once.
*/

:root {
    --paper: #f7f8f9;
    --surface: #ffffff;
    --ink: #0d1216;
    --ink-2: #4b555e;
    --ink-3: #7d8892;
    --rule: #e2e6e9;
    --rule-2: #ccd3d8;
    --edge: #0d1216;
    --fail: #cf2318;
    --fail-tint: #fdeceb;
    --warn: #b57500;
    --warn-tint: #fdf3e2;
    --ok: #2f9e5f;
    --ok-tint: #edf7f1;
    --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0e1215;
        --surface: #151b1f;
        --ink: #eef2f4;
        --ink-2: #a7b1b9;
        --ink-3: #78838c;
        --rule: #242c32;
        --rule-2: #333d45;
        --edge: #eef2f4;
        --fail: #ff5f52;
        --fail-tint: #2b1614;
        --warn: #e3a33c;
        --warn-tint: #2a2115;
        --ok: #45b877;
        --ok-tint: #16241c;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--edge); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .88em; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -.2em; }
.icon-inline { width: 1em; height: 1em; margin-right: .35em; color: var(--ink-3); }
.icon-head { width: 15px; height: 15px; display: block; margin: 0 auto .15rem; }
.icon-cell { width: 12px; height: 12px; stroke-width: 2.6; vertical-align: 0; }
.icon-row { width: 16px; height: 16px; color: var(--ink-3); vertical-align: -.2em; }
.icon-state { width: 13px; height: 13px; stroke-width: 2.4; vertical-align: 0; }
.icon-title { width: 20px; height: 20px; stroke-width: 2.4; vertical-align: 0; }
.brand-mark { width: 20px; height: 20px; color: var(--ok); stroke-width: 2.2; }

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

/* ---------------------------------------------------------------- chrome */

.topbar {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    padding: .85rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--rule-2);
    flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .95rem; letter-spacing: -.01em; text-decoration: none; }
.topbar nav { display: flex; gap: 1.4rem; }
.topbar nav a { font-size: .92rem; text-decoration: none; color: var(--ink-2); }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.current { color: var(--ink); font-weight: 600; }
.topbar .logout { margin-left: auto; font-size: .85rem; color: var(--ink-3); text-decoration: none; }
.topbar .logout:hover { color: var(--ink); text-decoration: underline; }

main { max-width: 1360px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.foot { max-width: 1360px; margin: 0 auto; padding: 0 1.5rem 2.5rem; color: var(--ink-3); font-size: .82rem; }

/* -------------------------------------------------------------- overview */

.overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
    gap: 1.5rem 2.5rem;
    align-items: end;
    margin-bottom: 1.5rem;
}
.overview-text { min-width: 0; }
.headline { margin: 0; font-size: 1.4rem; font-weight: 400; letter-spacing: -.01em; }
.headline b { font-weight: 600; }
.count { font-variant-numeric: tabular-nums; }
.count-fail { color: var(--fail); }
.count-warn { color: var(--warn); }
.overview-meta { margin: .35rem 0 0; color: var(--ink-3); font-size: .88rem; display: flex; align-items: center; }

.healthbar svg { width: 100%; height: 8px; display: block; border-radius: 2px; overflow: hidden; background: var(--rule); }
.healthbar .seg-fail { fill: var(--fail); }
.healthbar .seg-warn { fill: var(--warn); }
.healthbar .seg-ok { fill: var(--ok); }
.healthbar .seg-unknown { fill: var(--rule-2); }
.healthbar-key {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    margin: .6rem 0 0;
    padding: 0;
    font-size: .8rem;
    color: var(--ink-3);
}
.healthbar-key li { display: flex; align-items: center; gap: .35rem; }
.healthbar-key b { color: var(--ink); font-variant-numeric: tabular-nums; }
.healthbar-inline { max-width: 34rem; margin-bottom: 1.5rem; }

/* -------------------------------------------------------------- controls */

.controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: .6rem 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1rem;
}
.control-field { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--ink-3); }
.control-field input {
    font: inherit;
    font-size: .92rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    padding: .3rem .55rem;
    width: 14rem;
    max-width: 45vw;
}
.control-check { display: flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--ink-2); }
.filter-summary { margin: 0; font-size: .82rem; color: var(--ink-3); }
.filter-summary .link-button { font-size: .82rem; }
.control-buttons { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: wrap; }
.control-buttons .button-ghost { padding: .35rem .8rem; font-size: .84rem; }
.key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.key-fail { background: var(--fail); }
.key-warn { background: var(--warn); }
.key-ok { background: var(--ok); }
.key-unknown, .key-none { background: transparent; border: 1px dashed var(--rule-2); }

/* ---------------------------------------------------------------- matrix */

.matrix-wrap {
    /* No overflow here on a wide screen: a scroll container of its own would
       stop the sticky header from sticking to the window. */
    overflow: visible;
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
}
.matrix { width: 100%; border-collapse: collapse; font-size: .88rem; }

.matrix thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--surface);
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--ink-3);
    text-align: center;
    padding: .5rem .25rem .45rem;
    border-bottom: 1px solid var(--rule-2);
    white-space: nowrap;
    vertical-align: middle;
    height: 46px;
}
.matrix thead th .code { display: block; font-size: .62rem; letter-spacing: .06em; }
.matrix thead th.col-hot .icon-head { color: var(--warn); }
.matrix thead th.col-site { text-align: left; padding-left: .9rem; z-index: 3; vertical-align: middle; }
.matrix thead th.col-when { text-align: right; padding-right: .9rem; }
.matrix thead th.col-hot { color: var(--fail); }
.matrix abbr { text-decoration: none; cursor: help; }

.matrix tbody tr { border-bottom: 1px solid var(--rule); }
.matrix tbody tr:last-child { border-bottom: none; }
.matrix tbody tr:hover { background: var(--paper); }

.matrix th.col-site {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
    text-align: left;
    font-weight: 400;
    padding: 0 .9rem;
    white-space: nowrap;
    max-width: 15rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.matrix tbody tr:hover th.col-site { background: var(--paper); }
.matrix th.col-site a { text-decoration: none; }
.matrix th.col-site a:hover { text-decoration: underline; }
.matrix tr.site-fail th.col-site a { color: var(--fail); font-weight: 600; }
.matrix tr.site-warn th.col-site a { color: var(--ink); font-weight: 500; }
.matrix tr.site-skip th.col-site a { color: var(--ink-3); }
.favicon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    border-radius: 3px;
    flex: none;
    vertical-align: -.2em;
    margin-right: .5rem;
}
.favicon-large { width: 24px; height: 24px; margin-right: .1rem; vertical-align: -.15em; }

.open-site { display: inline-flex; align-items: center; margin-left: .4rem; color: var(--ink-3); opacity: 0; vertical-align: -.15em; }
.matrix tr:hover .open-site, .open-site:focus-visible { opacity: 1; }
.open-site:hover { color: var(--ink); }
.icon-open { width: 13px; height: 13px; }

.off { font-size: .7rem; color: var(--ink-3); border: 1px solid var(--rule-2); border-radius: 2px; padding: 0 .25rem; margin-left: .35rem; }

.matrix td { padding: 0; height: 34px; }
.matrix td.col-cell { text-align: center; width: 46px; }
.matrix td.col-when {
    text-align: right;
    padding-right: .9rem;
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--ink-3);
    white-space: nowrap;
    width: 6.5rem;
}

.cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid transparent;
    vertical-align: middle;
}
.cell-ok   { background: var(--ok-tint); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.cell-fail { background: var(--fail); color: #fff; border-color: var(--fail); }
.cell-warn { background: var(--warn-tint); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.cell-skip { background: transparent; color: var(--ink-3); border-color: var(--rule-2); }
.cell-none { background: transparent; color: var(--rule-2); border: 1px dashed var(--rule-2); }

.matrix tr.site-fail td { background: var(--fail-tint); }
.matrix tr.site-warn td { background: var(--warn-tint); }

.matrix td.col-pages {
    text-align: right;
    padding-right: .9rem;
    font-family: var(--mono);
    font-size: .76rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
    width: 5rem;
}
.matrix td.col-pages .none { color: var(--rule-2); }
.matrix thead th.col-pages { text-align: right; padding-right: .9rem; }
.matrix thead th.col-pages .icon-head { margin-right: 0; margin-left: auto; }
.matrix td.col-act { width: 3rem; padding-right: .6rem; text-align: right; }
.matrix td.col-act .button-small { opacity: .35; }
.matrix tr:hover td.col-act .button-small,
.matrix td.col-act .button-small:focus-visible { opacity: 1; }

.inline-form { display: inline-block; }
.icon-btn { width: 14px; height: 14px; stroke-width: 2.2; vertical-align: -.15em; margin-right: .4em; }

.button-small {
    align-self: auto;
    display: inline-flex;
    align-items: center;
    padding: .2rem .45rem;
    font-size: .74rem;
    color: var(--ink-2);
    background: transparent;
    border: 1px solid var(--rule-2);
    border-radius: 4px;
}
.button-small .icon-btn { margin-right: 0; width: 15px; height: 15px; }
.button-small { padding: .25rem; }
.button-small:hover { background: var(--edge); border-color: var(--edge); color: var(--surface); }

.actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.actions-note { font-size: .8rem; color: var(--ink-3); flex: 1 1 16rem; }
.button-ghost {
    align-self: auto;
    display: inline-flex;
    align-items: center;
    padding: .45rem 1rem;
    font-size: .88rem;
    color: var(--ink-2);
    background: transparent;
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    cursor: pointer;
}
.button-ghost:hover { color: var(--ink); border-color: var(--edge); background: transparent; }
button.button { display: inline-flex; align-items: center; }

.no-matches { color: var(--ink-2); font-size: .92rem; }

/* ----------------------------------------------------------- site detail */

.page-head { margin-bottom: 1.5rem; }
.page-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); letter-spacing: -.02em; overflow-wrap: anywhere; display: flex; align-items: center; gap: .6rem; }
.title-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: none;
}
.title-state.state-ok { background: var(--ok-tint); color: var(--ok); }
.title-state.state-warn { background: var(--warn-tint); color: var(--warn); }
.title-state.state-fail { background: var(--fail); color: #fff; }
.title-state.state-skip { background: var(--rule); color: var(--ink-3); }
.page-head .meta { margin: .3rem 0 0; color: var(--ink-2); font-size: .9rem; }

.section-label {
    display: flex;
    align-items: center;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-2);
    margin: 2rem 0 .6rem;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    margin-bottom: 1.5rem;
}
table.data caption { text-align: left; color: var(--ink-3); font-size: .82rem; padding-bottom: .45rem; }
table.data th, table.data td { text-align: left; padding: .5rem .9rem; border-bottom: 1px solid var(--rule); vertical-align: top; font-weight: 400; }
table.data thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
table.data tbody tr:last-child th, table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody th { font-weight: 600; }
.col-check { width: 11rem; white-space: nowrap; }
td.col-icon { width: 2.4rem; padding-right: 0; text-align: center; }
.col-state { width: 5.5rem; }
/* URLs and their explanations are reference detail, not headline text, so
   they sit a size below the rest of the table. */
td.url {
    overflow-wrap: anywhere;
    max-width: 34rem;
    font-family: var(--mono);
    font-size: .76rem;
    line-height: 1.5;
    color: var(--ink-2);
}
td.url a { color: inherit; }
tr.row-fail td.url + td + td,
tr.row-warn td.url + td + td { font-size: .78rem; color: var(--ink-2); }
td.num { font-family: var(--mono); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.row-fail td, tr.row-fail th { background: var(--fail-tint); }
tr.row-warn td, tr.row-warn th { background: var(--warn-tint); }
tr.row-muted td, tr.row-muted th { color: var(--ink-2); }
tr.row-muted td.url a { text-decoration: line-through; }

.state { font-size: .78rem; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.state-fail { color: var(--fail); }
.state-warn { color: var(--warn); }
.state-ok { color: var(--ok); }
.state-skip { color: var(--ink-3); font-weight: 400; }

.chart {
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    padding: .6rem .75rem;
    margin-bottom: .4rem;
}
.chart svg { width: 100%; height: 70px; display: block; }
.chart .bar { fill: var(--ok); }
.chart .bar-warn { fill: var(--warn); }
.chart .bar-fail { fill: var(--fail); }
.chart .bar-skip { fill: var(--rule-2); }
.caption { color: var(--ink-3); font-size: .8rem; margin: 0 0 1.5rem; }
.prose { max-width: 70ch; color: var(--ink-2); font-size: .95rem; }
.prose strong { color: var(--ink); }

/* ------------------------------------------------------------------ forms */

form.stack { display: flex; flex-direction: column; gap: .7rem; max-width: 32rem; }
form.stack label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
form.stack .hint { display: block; font-weight: 400; font-size: .82rem; color: var(--ink-3); }
form.stack input[type="text"], form.stack input[type="url"], form.stack input[type="password"], form.stack textarea {
    font: inherit;
    font-size: .95rem;
    padding: .45rem .6rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    width: 100%;
}
form.stack textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); }

button {
    align-self: flex-start;
    font: inherit;
    font-size: .92rem;
    padding: .45rem 1.2rem;
    color: var(--surface);
    background: var(--edge);
    border: 1px solid var(--edge);
    border-radius: 3px;
    cursor: pointer;
}
button:hover { background: transparent; color: var(--ink); }
.link-button { align-self: auto; padding: 0; background: none; border: none; color: var(--ink-3); text-decoration: underline; font-size: .85rem; }
.link-button:hover { background: none; color: var(--fail); }

.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 4fr); gap: 2rem; margin-bottom: 2rem; align-items: start; }
.notice { border-left: 3px solid var(--edge); padding: .5rem .75rem; margin: 0 0 1.25rem; font-size: .92rem; background: var(--surface); }
.notice.error { border-left-color: var(--fail); color: var(--fail); }
.empty { color: var(--ink-2); padding: 2rem 0; }
.tag { font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fail); margin-left: .3rem; }

/* ------------------------------------------------------------------ login */

body.entry-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: var(--paper); }
.login { width: min(23rem, 100%); background: var(--surface); border: 1px solid var(--rule-2); border-radius: 4px; padding: 1.75rem; }
.login h1 { font-size: 1rem; margin-bottom: 1.25rem; }
.login form.stack { max-width: none; }
.login button { align-self: stretch; text-align: center; }
.login .fineprint { font-size: .8rem; color: var(--ink-3); margin: .75rem 0 0; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
    /* Narrow enough that the matrix needs sideways scrolling; the header
       gives up sticking in exchange. */
    .matrix-wrap { overflow-x: auto; }
}

@media (max-width: 900px) {
    .columns { grid-template-columns: 1fr; gap: 1.5rem; }
    .overview { grid-template-columns: 1fr; align-items: start; }
    .control-buttons { margin-left: 0; width: 100%; }
}

@media (max-width: 560px) {
    main { padding: 1.25rem 1rem 2.5rem; }
    .topbar { gap: 1rem; padding: .75rem 1rem; }
    .topbar .logout { margin-left: 0; }
    .headline { font-size: 1.15rem; }
    .matrix th.col-site { max-width: 9rem; }
    .matrix td.col-when, .matrix thead th.col-when { display: none; }
    .matrix td.col-pages, .matrix thead th.col-pages { display: none; }
    .col-check { width: auto; white-space: normal; }
    table.data { font-size: .86rem; }
    table.data th, table.data td { padding: .45rem .6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ----------------------------------------------------------- scan modal */

.scan-modal {
    width: min(40rem, calc(100vw - 2rem));
    padding: 1.5rem;
    border: 1px solid var(--rule-2);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
}
.scan-modal::backdrop { background: rgba(10, 14, 18, .45); }

.scan-head { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1.25rem; }
.scan-head h2 { font-size: 1.15rem; overflow-wrap: anywhere; }
.scan-stage { margin: .15rem 0 0; color: var(--ink-2); font-size: .88rem; }
.scan-modal.is-done .icon-spin { animation: none; color: var(--ok); }
.scan-modal.is-failed .icon-spin { animation: none; color: var(--fail); }
.scan-modal.is-done .progress-fill { background: var(--ok); }
.scan-modal.is-failed .progress-fill { background: var(--fail); }

.scan-log {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    max-height: 15rem;
    overflow-y: auto;
}
.scan-line {
    display: grid;
    grid-template-columns: 9.5rem 4.5rem minmax(0, 1fr);
    gap: .6rem;
    align-items: baseline;
    padding: .35rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: .88rem;
}
.scan-line b { font-weight: 600; }
.scan-verdict { font-size: .76rem; font-weight: 600; }
.line-ok .scan-verdict { color: var(--ok); }
.line-warn .scan-verdict { color: var(--warn); }
.line-fail .scan-verdict { color: var(--fail); }
.line-skip .scan-verdict { color: var(--ink-3); font-weight: 400; }
.scan-detail { color: var(--ink-2); font-size: .84rem; overflow-wrap: anywhere; }

.scan-foot { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.button-danger {
    align-self: auto;
    display: inline-flex;
    align-items: center;
    padding: .45rem 1rem;
    font-size: .88rem;
    color: var(--fail);
    background: transparent;
    border: 1px solid var(--fail);
    border-radius: 3px;
    cursor: pointer;
}
.button-danger:hover { background: var(--fail); border-color: var(--fail); color: #fff; }
.button-danger[disabled] { opacity: .5; cursor: default; }
.button-danger[disabled]:hover { background: transparent; color: var(--fail); }

@media (max-width: 560px) {
    .scan-modal { padding: 1.1rem; }
    .scan-line { grid-template-columns: 1fr; gap: .1rem; }
}

/* -------------------------------------------------------------- progress */

.icon-spin { width: 22px; height: 22px; color: var(--ink-3); animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress { max-width: 46rem; }
.progress-track {
    height: 8px;
    background: var(--rule);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 2%;
    background: var(--ok);
    border-radius: 4px;
    transition: width .35s ease;
}
.progress-failed .progress-fill { background: var(--fail); }

/* While a scan is working the bar carries a moving stripe, so a long check
   reads as waiting rather than as a page that has died. */
.scan-modal.is-working .progress-fill {
    background-image: linear-gradient(
        115deg,
        rgba(255, 255, 255, .35) 25%, transparent 25%,
        transparent 50%, rgba(255, 255, 255, .35) 50%,
        rgba(255, 255, 255, .35) 75%, transparent 75%
    );
    background-size: 18px 18px;
    animation: barber 900ms linear infinite;
}
@keyframes barber { to { background-position: 18px 0; } }

/* A check running well past its timeout gets an amber bar, so "waiting" and
   "probably wedged" do not look the same. */
.scan-modal.is-slow .progress-fill { background-color: var(--warn); }
.scan-modal.is-slow .scan-stage { color: var(--warn); }

@media (prefers-reduced-motion: reduce) {
    .scan-modal.is-working .progress-fill { animation: none; }
}

.progress-block { margin-bottom: .9rem; }
.progress-label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 .3rem;
    font-size: .82rem;
    color: var(--ink-2);
}
.progress-label span:first-child { font-weight: 600; }
.progress-label span:last-child { color: var(--ink-3); font-family: var(--mono); font-size: .76rem; white-space: nowrap; }

#scan-total-block .progress-fill { background: var(--ink-2); }
.scan-modal.is-done #scan-total-block .progress-fill { background: var(--ok); }

.progress-meta {
    display: flex;
    justify-content: flex-end;
    margin: .5rem 0 1.25rem;
    font-size: .85rem;
    color: var(--ink-2);
}
.progress-elapsed { font-family: var(--mono); color: var(--ink-3); }

.progress-log { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.progress-line {
    display: grid;
    grid-template-columns: 11rem 5rem minmax(0, 1fr);
    gap: .75rem;
    align-items: baseline;
    padding: .4rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: .9rem;
}
.progress-line b { font-weight: 600; }
.progress-verdict { font-size: .78rem; font-weight: 600; }
.line-ok .progress-verdict { color: var(--ok); }
.line-warn .progress-verdict { color: var(--warn); }
.line-fail .progress-verdict { color: var(--fail); }
.line-skip .progress-verdict { color: var(--ink-3); font-weight: 400; }
.progress-detail { color: var(--ink-2); font-size: .85rem; overflow-wrap: anywhere; }

.progress-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
a.button-ghost { text-decoration: none; }

@media (max-width: 560px) {
    .progress-line { grid-template-columns: 1fr; gap: .15rem; }
}

@media (prefers-reduced-motion: reduce) {
    .icon-spin { animation: none; }
}


/* ---------------------------------------------------------------- report */

.report { max-width: 76rem; }

.report-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.report-head .meta { margin: .35rem 0 0; color: var(--ink-2); font-size: .9rem; }

.report-figures {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: .9rem;
}
.figure-tile {
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 4px;
    padding: .7rem .9rem;
}
.figure-tile strong {
    display: block;
    font-family: var(--mono);
    font-size: 2rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.figure-tile span { font-size: .8rem; color: var(--ink-3); }
.tile-fail strong { color: var(--fail); }
.tile-warn strong { color: var(--warn); }
.tile-ok strong { color: var(--ok); }
.tile-unknown strong { color: var(--ink-3); }

.report-bar { margin-bottom: 2.25rem; }

.report-block { margin-bottom: 2.5rem; }
.report-block h2 {
    font-size: 1.05rem;
    margin-bottom: .3rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--rule-2);
    break-after: avoid;
}
.report-note {
    margin: .4rem 0 1rem;
    font-size: .82rem;
    color: var(--ink-3);
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}
.report-note .key + span { margin-left: .1rem; }

/* One bar per check: how many sites carry that fault. */
.checkchart { list-style: none; margin: 0; padding: 0; }
.checkchart li {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr) 4rem;
    align-items: center;
    gap: .75rem;
    padding: .3rem 0;
    break-inside: avoid;
}
.checkchart-label { display: flex; align-items: center; gap: .45rem; font-size: .88rem; }
.checkchart-bar svg { display: block; width: 100%; height: 14px; border-radius: 2px; background: var(--rule); }
.checkchart-bar .seg-fail { fill: var(--fail); }
.checkchart-bar .seg-warn { fill: var(--warn); }
.checkchart-count { font-family: var(--mono); font-size: .82rem; text-align: right; display: flex; gap: .4rem; justify-content: flex-end; }

/* Domains listed as chips: names, not paragraphs. */
.affected-group { margin-bottom: 1.25rem; break-inside: avoid; }
.affected-group h3 {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .92rem;
    margin-bottom: .35rem;
}
.chips { margin: 0 0 .4rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: baseline; }
.chips-label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-right: .3rem;
}
.chips-fail .chips-label { color: var(--fail); }
.chips-warn .chips-label { color: var(--warn); }
.chip {
    font-family: var(--mono);
    font-size: .74rem;
    padding: .1rem .4rem;
    border-radius: 3px;
    border: 1px solid var(--rule-2);
    background: var(--surface);
}
.chips-fail .chip { border-color: color-mix(in srgb, var(--fail) 45%, transparent); background: var(--fail-tint); }
.chips-warn .chip { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-tint); }

.report-foot { color: var(--ink-3); font-size: .8rem; border-top: 1px solid var(--rule); padding-top: .6rem; }

/* Printing is the export: keep the colour, drop the interface. */
@media print {
    @page { margin: 12mm 10mm; }

    *, *::before, *::after {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    :root {
        --paper: #fff;
        --surface: #fff;
        --ink: #000;
        --ink-2: #333;
        --ink-3: #555;
        --rule: #d8d8d8;
        --rule-2: #999;
    }

    body { background: #fff; font-size: 9.5pt; }
    main { max-width: none; padding: 0; }
    .topbar, .foot, .no-print, .scan-modal, .controls { display: none !important; }

    .report { max-width: none; }
    .page-title { font-size: 18pt; }
    .report-block { break-inside: auto; }
    .report-figures { gap: .5rem; }
    .figure-tile strong { font-size: 1.5rem; }

    .matrix-wrap { overflow: visible; border: 1px solid #999; }
    .matrix { font-size: 7.5pt; }
    .matrix thead th { position: static; height: auto; padding: 2pt; }
    .matrix thead { display: table-header-group; }
    .matrix tr { break-inside: avoid; }
    .matrix td { height: 16pt; }
    .matrix th.col-site { position: static; max-width: none; padding: 0 4pt; }
    .cell { width: 15px; height: 11px; border-radius: 2px; }
    .cell-warn { border-color: #b9852c; }
    .icon-cell { width: 8px; height: 8px; }
    .favicon, .open-site { display: none; }

    a { text-decoration: none; color: #000; }
}

/* ------------------------------------------------------------------ stars */

.star-button {
    align-self: auto;
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin-right: .4rem;
    background: none;
    border: none;
    color: var(--rule-2);
    cursor: pointer;
    vertical-align: -.15em;
}
.star-button:hover { background: none; color: var(--warn); }
.star-button.is-starred { color: var(--warn); }
.star-button.is-starred .icon-star { fill: var(--warn); }
.icon-star { width: 14px; height: 14px; }

/* An unstarred row only shows its outline on hover, so the starred ones
   stand out down the column. */
.matrix tbody tr .star-button { opacity: .25; }
.matrix tbody tr:hover .star-button,
.matrix tbody tr .star-button.is-starred,
.matrix tbody tr .star-button:focus-visible { opacity: 1; }

.button-starred { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.button-starred:hover { background: var(--warn); border-color: var(--warn); color: #fff; }
.button-starred .icon-btn { fill: currentColor; }

/* Retrying a single URL from the site page. */
tr.is-rechecking { opacity: .55; }
tr.is-fixed td, tr.is-fixed th { background: var(--ok-tint); }
td.url-note { font-size: .78rem; color: var(--ink-2); }

/* A brief flash after a retry, so an unchanged result still reads as "asked". */
@keyframes just-checked {
    from { background-color: color-mix(in srgb, var(--ok) 30%, transparent); }
    to   { background-color: transparent; }
}
tr.just-checked td, tr.just-checked th { animation: just-checked 1.6s ease-out; }

@media (prefers-reduced-motion: reduce) {
    tr.just-checked td, tr.just-checked th { animation: none; }
}

/* The single-URL retry dialog. */
.recheck-modal { width: min(34rem, calc(100vw - 2rem)); }
.recheck-modal .scan-stage { font-family: var(--mono); font-size: .76rem; overflow-wrap: anywhere; }
.recheck-modal.is-done .icon-spin { animation: none; color: var(--ok); }
.recheck-modal.is-failed .icon-spin { animation: none; color: var(--fail); }

.recheck-result {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin: 0 0 1rem;
    padding: .75rem 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.recheck-result dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.recheck-result dd { margin: .2rem 0 0; font-family: var(--mono); font-size: .9rem; }
.recheck-note { margin: 0 0 1.25rem; font-size: .9rem; color: var(--ink-2); }

/* Log output on the cron page. */
.logbox {
    background: var(--surface);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    padding: .75rem .9rem;
    margin: 0 0 1.5rem;
    font-family: var(--mono);
    font-size: .76rem;
    line-height: 1.6;
    color: var(--ink-2);
    max-height: 24rem;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.logbox-bad { border-color: color-mix(in srgb, var(--fail) 45%, transparent); color: var(--fail); }

/* Sites with no icon of their own get a plain globe, drawn inline. */
.favicon-blank { color: var(--ink-3); }
