/* =====================================================================
   WorldsFastest Master Dashboard — stylesheet
   worldsfastest.com brand: deep navy, signal yellow, teal, terracotta,
   wide geometric display type. No external fonts or frameworks (strict
   CSP: self only) — fonts are served from /assets/fonts (SIL OFL).
   ===================================================================== */

@font-face {
    font-family: "WFW Display";
    src: url("../fonts/michroma-latin-400.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "WFW Sans";
    src: url("../fonts/jost-latin-variable.woff2") format("woff2");
    font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
    /* Brand palette (worldsfastest.com + brand kit) */
    --wfw-navy: #0E2536;
    --wfw-ink: #18323D;
    --wfw-yellow: #F3C010;
    --wfw-teal: #3F8CA8;
    --wfw-sky: #61BAD2;
    --wfw-terracotta: #A73A24;
    --wfw-salmon: #C3796A;
    --wfw-pink: #DF5980;
    --wfw-green: #82AF52;

    --bg: #F2F4F5;
    --surface: #ffffff;
    --surface-2: #F6F8F9;
    --border: #DDE4E8;
    --border-strong: #C5D0D6;
    --text: #0E2536;
    --text-2: #4A5E6B;
    --muted: #8A9BA6;
    --brand: #266A85;
    --brand-ink: #ffffff;
    --brand-soft: #E3F1F6;
    --accent: var(--wfw-yellow);
    --accent-ink: var(--wfw-navy);
    --accent-hover: #E2AF00;
    --nav-bg: var(--wfw-navy);
    --nav-text: #D3DEE5;
    --nav-muted: #7F97A6;
    --nav-active: #18384D;
    --good: #436B1F;
    --good-soft: #EAF3E0;
    --warn: #8A6400;
    --warn-soft: #FDF2CC;
    --bad: #A73A24;
    --bad-soft: #F8E3DE;
    --notice: #8A6400;
    --notice-soft: #FBF5D6;
    --info: #266A85;
    --info-soft: #E3F1F6;
    --chart: var(--wfw-teal);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(14, 37, 54, .06), 0 1px 3px rgba(14, 37, 54, .08);
    --font: "WFW Sans", "Futura", "Century Gothic", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --display: "WFW Display", "WFW Sans", "Arial Black", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0E2536;
        --surface: #132E42;
        --surface-2: #10293B;
        --border: #1E4058;
        --border-strong: #2A5470;
        --text: #F2F5F7;
        --text-2: #A9BCC8;
        --muted: #6F8899;
        --brand: #61BAD2;
        --brand-ink: #0E2536;
        --brand-soft: #123B4E;
        --nav-bg: #0A1B28;
        --nav-active: #15364B;
        --good: #9BCB6A;
        --good-soft: #1E3313;
        --warn: #F3C010;
        --warn-soft: #3A3008;
        --bad: #E07A63;
        --bad-soft: #3E1A12;
        --notice: #F3C010;
        --notice-soft: #332B05;
        --info: #61BAD2;
        --info-soft: #0F3646;
        --chart: #61BAD2;
        --shadow: 0 1px 2px rgba(0, 0, 0, .35);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-family: var(--display); font-size: 1.32rem; font-weight: 400; letter-spacing: .01em; text-transform: uppercase; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
small { font-size: .82em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- Layout ---------- */

.app {
    display: grid; grid-template-columns: 236px 1fr; min-height: 100vh;
    background: linear-gradient(to right, var(--nav-bg) 236px, transparent 236px);
}

.sidebar {
    background: var(--nav-bg);
    color: var(--nav-text);
    padding: 1rem .75rem 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.brand {
    display: flex; flex-direction: column; align-items: flex-start; gap: .55rem;
    color: #fff; padding: .4rem .5rem 1.1rem;
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 132px; height: auto; }
.brand-tag {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-muted); font-weight: 600;
}
.brand-tag::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--wfw-yellow); }
.brand small { display: block; color: var(--nav-muted); font-weight: 500; font-size: .72rem; }
.nav-group { margin-top: 1rem; }
.nav-group > span {
    display: block; padding: 0 .6rem .35rem;
    font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-muted);
}
.nav-group a {
    display: flex; align-items: center; gap: .55rem;
    color: var(--nav-text); padding: .42rem .6rem; border-radius: var(--radius-sm);
    font-size: .9rem;
}
.nav-group a:hover { background: var(--nav-active); text-decoration: none; color: #fff; }
.nav-group a.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--wfw-yellow); }
.nav-group a.active .nav-icon { stroke: var(--wfw-yellow); }
.nav-icon { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.topbar form.search { flex: 1; max-width: 420px; }
.topbar form.search input { width: 100%; }
.topbar form.search { position: relative; }
.suggest {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; margin: 0; padding: .35rem 0;
    list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(14, 37, 54, .16); max-height: 70vh; overflow-y: auto;
}
.suggest-group { padding: .45rem .9rem .2rem; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.suggest-item { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding: .4rem .9rem; cursor: pointer; border-left: 3px solid transparent; }
.suggest-item[aria-selected="true"] { background: var(--surface-2); border-left-color: var(--accent); }
.suggest-label { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-label mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.suggest-sub { font-size: .8rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.suggest-item.is-retired .suggest-label { color: var(--muted); }
.suggest-empty { padding: .55rem .9rem; color: var(--text-2); font-size: .86rem; }
.user-menu { display: flex; align-items: center; gap: .75rem; color: var(--text-2); font-size: .88rem; }
.user-menu form { margin: 0; }
.content { padding: 1.4rem 1.5rem 3rem; max-width: 1500px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin: 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .82rem; color: var(--text-2); margin-bottom: .2rem; }

/* ---------- Cards / grid ---------- */

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0;
}
.card > header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.card > header h2 { margin: 0; }
.card.flush { padding: 0; }
.card.flush > header { padding: .9rem 1.1rem 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .card + .grid, .kpis + .grid { margin-top: 1rem; }
.sub { display: block; color: var(--text-2); font-size: .8rem; }
.stack > * + * { margin-top: 1rem; }

/* ---------- KPI tiles ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.kpi .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.kpi .value { font-family: var(--display); font-size: 1.45rem; font-weight: 400; line-height: 1.2; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .8rem; color: var(--text-2); }
.kpi.good .value { color: var(--good); }
.kpi.warn .value { color: var(--warn); }
.kpi.bad .value { color: var(--bad); }
a.kpi { color: inherit; text-decoration: none; display: block; }
a.kpi:hover { border-color: var(--brand); text-decoration: none; }
.card-filters { padding: .75rem 1rem 0; margin: 0; }
.scan-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; margin: .5rem 0 1rem; }
.scan-source { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem; background: var(--surface-2); }
.scan-source h3 { margin: 0 0 .35rem; font-size: .92rem; }
.scan-source p { margin: .2rem 0; font-size: .86rem; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
    background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; font-weight: 600;
}
.table th a { color: inherit; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.nowrap { white-space: nowrap; }
.table .sub { display: block; color: var(--text-2); font-size: .8rem; }
.table-compact th, .table-compact td { padding: .35rem .55rem; }
.empty { padding: 1.5rem; text-align: center; color: var(--text-2); }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.props dt { color: var(--text-2); font-size: .84rem; }
dl.props dd { margin: 0; word-break: break-word; }

/* ---------- Badges & scores ---------- */

.badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border); white-space: nowrap;
}
.badge.good, .score.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.warn, .score.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad, .score.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.notice, .score.notice { background: var(--notice-soft); color: var(--notice); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.score {
    display: inline-block; min-width: 2.8rem; text-align: center; padding: .1rem .4rem; border-radius: var(--radius-sm);
    font-weight: 650; font-variant-numeric: tabular-nums; font-size: .84rem; background: var(--surface-2); color: var(--muted);
}
.score.muted { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.weight { font-variant-numeric: tabular-nums; font-weight: 650; }
.seg-COMPLIANCE { background: #FBE4EB; color: #A42A55; border-color: transparent; }
.seg-KEEP { background: var(--info-soft); color: var(--info); border-color: transparent; }
.seg-UPSELL { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.seg-IGNORE { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .seg-COMPLIANCE { background: #3D1426; color: #F08FAE; } }

/* ---------- Forms ---------- */

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
    width: 100%; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .45rem .6rem;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field { margin-bottom: .85rem; }
.field label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: .25rem; }
.field .help { display: block; color: var(--text-2); margin-top: .2rem; }
.field .error { display: block; color: var(--bad); margin-top: .2rem; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.field-check label { display: flex; gap: .45rem; align-items: center; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .span-2, .form-grid-3 .span-3 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem .2rem; margin: 0 0 1rem; }
legend { font-weight: 650; padding: 0 .35rem; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; flex: 0 1 180px; }
.filters .field.grow { flex: 1 1 240px; }
.filters .field label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .86rem;
    padding: .45rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: .25rem .55rem; font-size: .78rem; }
.btn-link { background: none; border: 0; color: var(--brand); padding: 0; font-weight: 500; cursor: pointer; font: inherit; }
.inline-form { display: inline; margin: 0; }

/* ---------- Alerts ---------- */

.alert { padding: .65rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--good-soft); color: var(--good); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }

.alerts { margin-bottom: 1rem; }
.alert-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.alert-row > div { flex: 1; min-width: 0; }
.alert-row .sub { color: inherit; opacity: .85; }
.kpi .value a { color: inherit; }

details { margin: .5rem 0 1rem; }
details > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .86rem; margin-bottom: .5rem; }

/* ---------- Pagination ---------- */

.pagination { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; color: var(--text-2); font-size: .85rem; gap: .5rem; flex-wrap: wrap; }
.pagination nav { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.pagination .per-page { margin: 0 auto 0 1rem; }
.pagination .per-page label { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-2); text-transform: none; letter-spacing: 0; margin: 0; }
.pagination .per-page select { width: auto; min-width: 4.5rem; padding: .25rem 1.6rem .25rem .5rem; font-size: .85rem; }
.pagination .btn.current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pagination .gap { padding: 0 .2rem; }
@media (max-width: 640px) { .pagination .per-page { margin: 0; } }

/* ---------- Charts ---------- */

svg.spark { vertical-align: middle; overflow: visible; }
svg.spark polyline { fill: none; stroke: var(--chart); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
svg.spark circle { fill: var(--chart); }
svg.chart-columns { width: 100%; height: 160px; display: block; }
svg.chart-columns rect { fill: var(--chart); opacity: .85; }
svg.chart-columns rect:hover { opacity: 1; }
svg.chart-columns text { fill: var(--text-2); font-size: 11px; }
ul.share-bars { list-style: none; margin: 0; padding: 0; }
ul.share-bars li { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: .6rem; padding: .22rem 0; font-size: .84rem; }
ul.share-bars .share-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
ul.share-bars svg { width: 100%; height: 8px; display: block; background: var(--surface-2); border-radius: 4px; }
ul.share-bars rect { fill: var(--chart); }
ul.share-bars .share-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Tabs (CSS only, :target) ---------- */

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .85rem; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: .88rem; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Auth ---------- */

.guest {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: var(--wfw-navy); color-scheme: dark;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-hero { display: block; width: min(340px, 86%); height: auto; margin: 0 auto -6px; position: relative; z-index: 1; }
.auth-card { width: 100%; padding: 1.4rem 1.4rem 1.1rem; border: 0; }
.auth-card .brand { color: var(--text); align-items: center; padding: .2rem 0 1.1rem; }
.auth-card .brand-logo { width: 150px; }
.auth-card .brand-tag { color: var(--text-2); }
.auth-card .brand small { color: var(--text-2); }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: .6rem; }
.auth-foot { text-align: center; margin-top: 1rem; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #7F97A6; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }

/* ---------- Error page ---------- */

.error-page { text-align: center; padding: 3rem 1rem; }
.error-page .code { font-family: var(--display); font-size: 3.2rem; font-weight: 400; color: var(--muted); }
.error-page .mascot { display: block; width: 180px; height: auto; margin: 0 auto 1rem; }
pre.trace { text-align: left; white-space: pre-wrap; font-size: .75rem; background: var(--surface-2); padding: 1rem; border-radius: var(--radius-sm); overflow: auto; max-height: 420px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; background: none; }
    .sidebar { position: static; height: auto; display: flex; flex-wrap: wrap; gap: .25rem; padding: .6rem; }
    .sidebar .nav-group { margin: 0; display: contents; }
    .sidebar .nav-group > span { display: none; }
    .brand { width: 100%; padding-bottom: .4rem; }
    .grid-2, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
}

@media print {
    .sidebar, .topbar, .page-actions, .filters, .pagination { display: none !important; }
    .app { display: block; }
    .card { box-shadow: none; break-inside: avoid; }
}

/* ---- Sub-headings inside a card (e.g. Vulnerabilities → Server software / WordPress) ---- */
.subhead { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem 0 .5rem; }
.card > .subhead:first-of-type, .card > header + .sa-software .subhead, .card > .sa-software:first-child .subhead { margin-top: 0; }
.subhead h3 { margin: 0; font-size: .95rem; }

/* ---- Security audit module ---- */
.sa-actions { display: inline-flex; align-items: center; gap: .6rem; }
.sa-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.sa-list li { line-height: 1.45; }
.sa-detail { display: block; margin: .15rem 0 0; color: var(--text-2); }
.sa-findings { list-style: none; margin: 0; padding: 0; }
.sa-finding { padding: .65rem 0; border-top: 1px solid var(--border); }
.sa-finding:first-child { border-top: 0; padding-top: 0; }
.sa-finding.is-ignored { opacity: .6; }
.sa-finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.sa-finding p { margin: .25rem 0 0; }
.sa-evidence span { display: inline-block; margin-right: .6rem; color: var(--text-2); }
.sa-evidence code { font-size: .78rem; word-break: break-all; }
.sa-ignore { display: inline-block; }
.sa-ignore > summary { list-style: none; cursor: pointer; }
.sa-ignore > summary::-webkit-details-marker { display: none; }
.sa-ignore[open] form { display: inline-flex; gap: .35rem; margin-left: .35rem; }
.sa-ignore input { min-width: 14rem; }
.sa-body { padding: 0 1.1rem 1.1rem; }
.sa-progress { width: 100%; height: .6rem; }
.sa-sub > td { background: var(--surface-2); padding-top: .2rem; }
.sa-sub details > summary { cursor: pointer; font-size: .84rem; color: var(--text-2); }
.sa-small { font-size: 1.05rem; }
.sa-props dd { color: var(--text-2); }

/* ---- Site re-assessment after a stack change ---- */
.card.reassess { border-left: 3px solid var(--accent); margin-bottom: 1rem; }
.reassess-changes { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: 0 0 .6rem; font-size: .9rem; }
.reassess-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: .9rem; }

/* ---- Prospect scanner module ---- */
.ps-filters { padding: .75rem 1.1rem; margin: 0; border-bottom: 1px solid var(--border); }
.ps-areas li { line-height: 1.35; }
.ps-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.ps-area { scroll-margin-top: 1rem; }
.ps-area > dl.props { margin-bottom: .9rem; }
.ps-more { margin-top: .6rem; }
.ps-more > summary { cursor: pointer; font-size: .86rem; color: var(--text-2); }
.ps-more .sa-list { margin-top: .5rem; }
.ps-vulns { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .2rem; }
.ps-notes { margin: .8rem 0 0; padding-left: 1.1rem; color: var(--text-2); }
.ps-coming { border-style: dashed; }
.ps-construction { display: flex; gap: .9rem; align-items: flex-start; color: var(--text-2); }
.ps-construction svg { flex: none; margin-top: .15rem; }
.ps-construction p { margin: 0 0 .25rem; }

/* ---- Prospect scanner: printable report (always light) ---- */
body.ps-report { min-height: 100vh; --bg: #ffffff; --surface: #ffffff; --surface-2: #F4F7F9; --text: #0E2536; --text-2: #4A5E6B; --border: #DCE5EA; color-scheme: light; background: #ffffff; color: #0E2536; font-family: var(--font); font-size: 15px; line-height: 1.55; margin: 0; }
.ps-report .rp { max-width: 820px; margin: 0 auto; padding: 2.2rem 1.6rem 3rem; }
.ps-report .rp-bar { display: flex; justify-content: flex-end; gap: .5rem; margin-bottom: 1rem; }
.ps-report .rp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; border-bottom: 3px solid #266A85; padding-bottom: 1.1rem; }
.ps-report .rp-head img { height: 24px; width: auto; max-width: 100%; }
.ps-report .rp-head > div:first-child { min-width: 0; flex: 1; }
.ps-report .rp-head h1 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin: .6rem 0 .1rem; color: #0E2536; }
.ps-report .rp-head p { margin: 0; color: #4A5E6B; }
.ps-report .rp-grade { text-align: center; min-width: 120px; }
.ps-report .rp-grade .letter { font-family: var(--display); font-size: 3.4rem; line-height: 1; }
.ps-report .rp-grade small { color: #4A5E6B; }
.ps-report .g-good { color: #1C7C4F; }
.ps-report .g-notice { color: #9A6B00; }
.ps-report .g-warn { color: #B4580F; }
.ps-report .g-bad { color: #B42318; }
.ps-report h2 { font-family: var(--display); font-weight: 400; font-size: 1.25rem; margin: 2rem 0 .4rem; color: #0E2536; }
.ps-report h3 { font-size: 1rem; margin: 1.4rem 0 .3rem; }
.ps-report .rp-intro { color: #4A5E6B; margin: 0 0 .7rem; }
.ps-report table.rp-table { width: 100%; border-collapse: collapse; margin: .6rem 0 1rem; }
.ps-report .rp-table th, .ps-report .rp-table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid #DCE5EA; vertical-align: top; }
.ps-report .rp-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #4A5E6B; }
.ps-report .pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.ps-report .p-critical, .ps-report .p-high { background: #FDE8E7; color: #B42318; }
.ps-report .p-medium { background: #FEF0E1; color: #B4580F; }
.ps-report .p-low { background: #FFF6DB; color: #9A6B00; }
.ps-report .p-good { background: #E3F4EC; color: #1C7C4F; }
.ps-report .p-none { background: #EEF2F5; color: #4A5E6B; }
.ps-report ol.rp-issues { padding-left: 1.2rem; margin: .4rem 0 0; }
.ps-report .rp-issues li { margin: 0 0 .75rem; break-inside: avoid; }
.ps-report .rp-issues .t { font-weight: 600; }
.ps-report .rp-issues p { margin: .15rem 0 0; color: #33475A; font-size: .92rem; }
.ps-report .rp-ok { color: #1C7C4F; }
.ps-report .rp-soon { color: #4A5E6B; font-style: italic; }
.ps-report .rp-foot { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid #DCE5EA; color: #4A5E6B; font-size: .82rem; }
@media print {
.ps-report .rp-bar { display: none; }
.ps-report .rp { padding: 0; max-width: none; }
.ps-report h2 { break-after: avoid; }
.ps-report a { color: inherit; text-decoration: none; }
}

/* ---- Customer care: notes, follow-ups, tickets ---- */
.cc-note-form { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.cc-note-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.cc-note-row .field { flex: 1 1 160px; margin-bottom: .5rem; }
.cc-note-row .cc-note-submit { flex: 0 0 auto; }
.cc-note-list { list-style: none; margin: 0; padding: 0; }
.cc-note { padding: .75rem 0; border-top: 1px solid var(--border); }
.cc-note:first-child { border-top: 0; padding-top: 0; }
.cc-note.is-due { border-left: 3px solid var(--warn); padding-left: .75rem; }
.cc-note-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.cc-note-body { margin: .35rem 0; white-space: normal; }
.cc-note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.cc-inline { display: inline-block; }
.cc-inline > summary { list-style: none; cursor: pointer; display: inline-block; }
.cc-inline > summary::-webkit-details-marker { display: none; }
.cc-inline[open] { display: block; width: 100%; margin-top: .4rem; }
.cc-inline[open] .inline-form { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.cc-new-ticket { margin-top: .9rem; }
.cc-new-ticket > summary { list-style: none; cursor: pointer; display: inline-block; }
.cc-new-ticket > summary::-webkit-details-marker { display: none; }
.cc-new-ticket[open] > summary { margin-bottom: .75rem; }
.cc-thread { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .75rem; }
.cc-thread li { padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cc-thread li.is-change { background: var(--surface-2); border-style: dashed; }
.cc-thread p { margin: .25rem 0 0; }

/* ---- Tags ---- */
.tag { display: inline-flex; align-items: center; gap: .25rem; padding: .05rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; line-height: 1.5; white-space: nowrap; text-decoration: none; border: 1px solid transparent; }
a.tag:hover { text-decoration: none; filter: brightness(1.1); }
.tag-gray   { background: rgba(120, 135, 150, .18); color: #6b7c8c; }
.tag-blue   { background: rgba(59, 130, 246, .16); color: #2f6fd6; }
.tag-green  { background: rgba(34, 160, 100, .16); color: #1c8a55; }
.tag-amber  { background: rgba(230, 160, 20, .2); color: #a8740a; }
.tag-red    { background: rgba(220, 60, 60, .16); color: #c03535; }
.tag-purple { background: rgba(140, 90, 220, .16); color: #7a4fd0; }
.tag-teal   { background: rgba(20, 160, 170, .16); color: #11878f; }
.tag-pink   { background: rgba(225, 80, 150, .16); color: #c23f84; }
@media (prefers-color-scheme: dark) {
    .tag-gray { color: #b3c1cc; } .tag-blue { color: #8db8ff; } .tag-green { color: #7fdcae; } .tag-amber { color: #f3c55e; }
    .tag-red { color: #ff9a9a; } .tag-purple { color: #c3a6ff; } .tag-teal { color: #7fdde2; } .tag-pink { color: #ff9fcf; }
}
.tag-row { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .3rem .45rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.tag-input:focus-within { border-color: var(--brand); }
.tag-chips { display: contents; }
.tag-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 .1rem; font-size: .9rem; line-height: 1; }
.tag-entry { flex: 1 1 8rem; min-width: 8rem; border: 0 !important; padding: .2rem !important; background: transparent !important; box-shadow: none !important; outline: none; }
.tag-edit input[type=text] { min-width: 12rem; }

/* ---- Contacts ---- */
.contact-card { padding: .7rem 0; border-top: 1px solid var(--border); }
.card > header + .contact-card, .card > .contact-card:first-of-type { border-top: 0; padding-top: 0; }
.contact-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.contact-lines { list-style: none; margin: .3rem 0; padding: 0; display: grid; gap: .15rem; font-size: .88rem; }
.contact-label { display: inline-block; min-width: 4.2rem; color: var(--text-2); font-size: .78rem; }
.repeat-list { display: grid; gap: .45rem; margin-bottom: .5rem; }
.repeat-row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.repeat-row input[type=email], .repeat-row input[type=tel] { flex: 1 1 16rem; }
.repeat-row .repeat-ext { width: 5.5rem; flex: 0 0 auto; }
.repeat-row select { flex: 0 0 auto; width: auto; }
.repeat-primary { display: inline-flex; align-items: center; gap: .25rem; font-size: .84rem; color: var(--text-2); font-weight: 500; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .35rem 1rem; }
.check-grid .field-check { display: flex; align-items: center; gap: .45rem; margin: 0; font-weight: 500; }

/* Access editor (Admin → Users → Access, Access groups) */
.access-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; }
.access-row select { flex: 1 1 18rem; max-width: 28rem; }
.access-row .field-check { display: inline-flex; align-items: center; gap: .35rem; margin: 0; font-weight: 500; }
.access-flag { font-size: .78rem; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .5rem; }
.stack-sm { display: grid; gap: .45rem; }
.access-summary { margin: 0; padding-left: 1.1rem; }
.access-summary li { margin: .1rem 0; }

/* Presence dot (Team page, users list, top bar) */
.presence { display: inline-flex; align-items: center; gap: .4rem; vertical-align: middle; }
.presence-dot { width: .62rem; height: .62rem; border-radius: 50%; flex: 0 0 auto; background: #9aa3ad; box-shadow: 0 0 0 2px var(--surface, #fff); }
.presence-online .presence-dot { background: #1f9d55; }
.presence-away .presence-dot { background: #e0a800; }
.presence-offline .presence-dot { background: #9aa3ad; }
.presence-text { font-size: .84rem; color: var(--text-2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Filterable, scrollable table (Cloudflare zones on DNS & email) */
.cf-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.cf-toolbar input[type=search] { max-width: 18rem; }
.chip-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: inherit; font-size: .84rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip span { font-weight: 500; color: var(--text-2); margin-left: .2rem; }
.chip:hover:not(:disabled) { border-color: var(--brand); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink, #0b1f2e); }
.chip.is-active span { color: inherit; }
.chip:disabled { opacity: .45; cursor: default; }
.scroll-box { max-height: 28rem; overflow-y: auto; }
.scroll-box thead th { position: sticky; top: 0; z-index: 1; }
.cf-foot { padding: .6rem 1rem .8rem; margin: 0; border-top: 1px solid var(--border); }

/* New Relic templates: script editor and preview */
.code-editor { width: 100%; font-family: var(--mono); font-size: .82rem; line-height: 1.45; tab-size: 2; white-space: pre; }
.code-preview { max-height: 32rem; font-family: var(--mono); font-size: .8rem; line-height: 1.45; padding: .75rem 1rem; background: var(--surface-2, rgba(127,127,127,.08)); border-radius: var(--radius); white-space: pre; overflow: auto; }
.text-bad { color: var(--bad); }
.monitoring-section .check-grid { margin: .4rem 0 .6rem; }
.row-action { display: flex; gap: .35rem; align-items: center; }
.row-action select { max-width: 17rem; font-size: .84rem; padding-block: .25rem; }
a.card-link { display: block; color: inherit; text-decoration: none; }
a.kpi:hover, a.card-link:hover { border-color: var(--brand); }
/* System health */
.health-grid { align-items: start; }
.health-table td:first-child { width: 1%; }
.health-table td:last-child { width: 1%; text-align: right; }
/* Batch runs (Blocklists: run the check now) */
.batch-progress { width: 100%; height: .8rem; accent-color: var(--brand); }
.batch-found { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .88rem; }
/* Update roll-outs */
.rollout-controls { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.rollout-select { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.check-col { width: 1%; }
.rollout-result .sub { max-width: 22rem; white-space: normal; }
.setup-steps { margin: .3rem 0 .6rem 1.2rem; padding: 0; font-size: .9rem; }
/* Query builder (audit trail) */
.query-builder { display: grid; gap: .6rem; }
.qb-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.qb-head label { font-weight: 600; }
.qb-head select { width: auto; }
.qb-rules { display: grid; gap: .4rem; }
.qb-rule { display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(8rem, 11rem) 1fr auto; gap: .4rem; align-items: center; }
@media (max-width: 640px) { .qb-rule { grid-template-columns: 1fr 1fr; } .qb-rule [data-qb-value] { grid-column: 1 / -1; } }
/* Admin → Email */
details.card > summary { list-style: none; margin: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary h2::after { content: ' ▸'; color: var(--text-2); font-size: .8em; }
details.card[open] > summary h2::after { content: ' ▾'; }
details.card[open] > summary { margin-bottom: .6rem; }
.form-row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1 1 18rem; margin: 0; }
.setup-steps ul { margin: .4rem 0; padding-left: 1.1rem; }
.setup-steps pre.code-preview { white-space: pre-wrap; overflow-wrap: anywhere; margin: .5rem 0; }
.mail-copies { margin: 0 0 .6rem; }
.mail-copies > summary { font-size: .84rem; }
.mail-test { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .8rem; }
/* Admin → Notifications */
.notify-rule > summary { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.notify-rule > summary h2 { font-size: 1rem; }
.notify-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .2rem 1rem; }
.notify-grid .field-check { display: block; margin: .15rem 0; }
.field .label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.field-narrow { flex: 0 1 14rem !important; }
.notify-subhead { font-size: .95rem; margin: 1rem 0 .5rem; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); margin: 1.6rem 0 .5rem; }
/* Two-step sign-in */
.tf-setup { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: start; }
.tf-qr svg { display: block; width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 8px; }
.tf-secret { font-size: 1rem; letter-spacing: .06em; word-break: break-all; }
.tf-remove { margin-top: .8rem; }
.code-input { font-size: 1.25rem; letter-spacing: .25em; max-width: 11rem; font-variant-numeric: tabular-nums; }
.auth-alt a { white-space: nowrap; }
.recovery-codes { columns: 2; column-gap: 2.5rem; padding-left: 1.6rem; margin: 1rem 0; }
.recovery-codes li { margin: .35rem 0; break-inside: avoid; }
.recovery-codes code { font-size: 1.1rem; letter-spacing: .08em; }
.print-only { display: none; }
@media (max-width: 640px) { .tf-setup { grid-template-columns: 1fr; } .recovery-codes { columns: 1; } }
@media print {
    .no-print, .alert { display: none !important; }
    .print-only { display: block; }
    .recovery-sheet { border: 0; padding: 0; }
}
