/* Website Audit Manager: a plain operator UI on top of Shared base.css tokens. Light and dark follow the system.
   One breakpoint (640px): above it a sidebar shell, below it a slim top bar with a <details> menu. */
:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-muted: #eef1f5;
    --text: #18202d;
    --muted: #5b6577;
    --border: #dde2ea;
    --primary: #1f5fbf;
    --primary-dark: #174a96;
    --on-primary: #ffffff;
    --danger: #b42318;
    --success: #1a7f37;
    --warning: #9a6700;
    --high: #c2410c;
    --radius: 12px;
    --radius-sm: 8px;
    --shell-max: 1280px;
    --sidebar-width: clamp(12.5rem, 17vw, 15rem);
    --shadow-card: 0 1px 2px rgb(16 24 40 / 0.05);

    --ui-color-canvas: var(--bg);
    --ui-color-surface: var(--surface);
    --ui-color-surface-muted: var(--surface-muted);
    --ui-color-text: var(--text);
    --ui-color-text-muted: var(--muted);
    --ui-color-border: var(--border);
    --ui-color-accent: var(--primary);
    --ui-color-accent-strong: var(--primary-dark);
    --ui-color-on-accent: var(--on-primary);
    --ui-color-focus-ring: color-mix(in srgb, var(--primary) 35%, transparent);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #11151c;
        --surface: #1a2029;
        --surface-muted: #232a35;
        --text: #e7ebf1;
        --muted: #a4aebd;
        --border: #313a47;
        --primary: #6ea2ef;
        --primary-dark: #9cc0f5;
        --on-primary: #0d1420;
        --danger: #f2877d;
        --success: #6fdd8b;
        --warning: #e3b341;
        --high: #fb923c;
        --shadow-card: none;
    }
}

body { font-size: 1rem; }

a { color: var(--primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--ui-color-focus-ring);
    outline-offset: 2px;
}

/* Text only for screen readers. Same rule as Shared base.css .sr-only, which views here never used. */
.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;
}

/* Shell: top bar (phones and signed-out pages) */
.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.5rem 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}
/* Small accent square: a ring-like mark that echoes the score rings. */
.brand-mark {
    width: 1.6rem;
    height: 1.6rem;
    flex: none;
    border-radius: 8px;
    background: conic-gradient(var(--primary) 0 72%, color-mix(in srgb, var(--primary) 25%, var(--surface)) 72% 100%);
    -webkit-mask: radial-gradient(circle, transparent 0.35rem, #000 0.36rem);
    mask: radial-gradient(circle, transparent 0.35rem, #000 0.36rem);
}
.nav-plain a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.5rem; font-weight: 600; text-decoration: none; }

.nav-menu { flex-basis: 100%; }
.nav-menu:not([open]) { flex-basis: auto; }
.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 0.85rem;
    margin-left: auto;
    width: max-content;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    list-style: none;
    cursor: pointer;
}
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after {
    display: block;
    width: 1.1rem;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}
.nav-toggle-icon { position: relative; }
.nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }
.nav-menu[open] .nav-toggle-icon { background: transparent; }
.nav-menu[open] .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-menu[open] .nav-toggle-icon::after { top: 0; transform: rotate(-45deg); }
/* Open on phones: the toggle stays next to the brand, the link list takes the row below. */
.site-header { position: relative; }
.nav-menu[open] > summary { position: absolute; top: 0.5rem; right: 16px; }
.nav-menu:not([open]) { align-self: center; }
/* A closed <details> still lays out its hidden content in Chrome; drop it so the top bar cannot overflow. */
@media (max-width: 640px) {
    .nav-menu:not([open])::details-content { display: none; }
}

.nav { display: grid; gap: 1rem; padding: 0.25rem 0 0.75rem; }
.nav-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-group-label {
    display: block;
    padding: 0 0.75rem 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.nav a, .nav-logout-button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 0 0.75rem;
    font: inherit;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.nav a:hover, .nav-logout-button:hover { background: var(--surface-muted); }
.nav a[aria-current="page"] {
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 11%, var(--surface));
    box-shadow: inset 3px 0 0 var(--primary);
}
.nav-logout-form { margin: 0; }
.nav-account { padding-top: 0.75rem; border-top: 1px solid var(--border); }

/* Shell: sidebar above the phone breakpoint */
@media (min-width: 641px) {
    body.app-shell {
        display: grid;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
        align-items: start;
    }
    body.app-shell > .site-header {
        grid-column: 1;
        grid-row: 1;
        position: sticky;
        top: 0;
        height: 100dvh;
        overflow-y: auto;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        gap: 1.25rem;
        padding: 1.1rem 0.75rem;
        border-bottom: 0;
        border-right: 1px solid var(--border);
    }
    body.app-shell > main { grid-column: 2; grid-row: 1; min-width: 0; }
    body.app-shell .brand { padding: 0 0.5rem; }
    /* The menu is always open here: hide the toggle and show the closed <details> content anyway. */
    body.app-shell .nav-menu { display: flex; flex-direction: column; flex: 1; }
    body.app-shell .nav-menu > summary { display: none; }
    body.app-shell .nav-menu::details-content { content-visibility: visible; display: contents; }
    /* Flex column: the account group sits at the bottom however many groups the role shows. */
    body.app-shell .nav { flex: 1; display: flex; flex-direction: column; padding: 0; }
    body.app-shell .nav-account { margin-top: auto; }
    .site-header { padding-inline: max(16px, calc((100% - var(--shell-max)) / 2)); }
    body.app-shell > .site-header { padding-inline: 0.75rem; }
}

.page-shell {
    width: min(100% - 32px, var(--shell-max));
    margin: 1.75rem auto 3rem;
    display: grid;
    /* minmax(0, 1fr): wide content (rings, long buttons) wraps instead of widening the page on phones. */
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}
@media (min-width: 641px) {
    .app-shell .page-shell { width: min(100% - 4rem, var(--shell-max)); margin-top: 2.25rem; }
}
h1 { font-size: clamp(1.6rem, 1.25rem + 1.2vw, 2.1rem); line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; line-height: 1.3; margin-bottom: 0.85rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
h4 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.h-sub { font-weight: 400; font-size: 0.95rem; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.page-shell > h1 + .lead { margin-top: -0.5rem; }
.muted { color: var(--muted); }
.eyebrow { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.panel, .auth-card, .stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-card);
    min-width: 0;
}
@media (max-width: 640px) {
    .panel, .stat { padding: 1rem; }
}
.panel > :last-child { margin-bottom: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.85rem; }
.panel-head h2 { margin: 0; }
.panel-head a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; }
.panel-head a:hover { text-decoration: underline; }
.auth-card { width: min(100%, 420px); margin: 0 auto; display: grid; gap: 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 0; }
.stat dt { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.stat dd { margin: 0.25rem 0 0; font-size: 2rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }

/* Dashboard KPI tiles: a coloured bar on top, the label and number carry the meaning. */
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { position: relative; overflow: hidden; padding-top: 1.4rem; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--kpi-accent, var(--primary)); }
.kpi dd { color: var(--text); }
.kpi-primary { --kpi-accent: var(--primary); }
.kpi-lead { --kpi-accent: #7c3aed; }
.kpi-good { --kpi-accent: var(--success); }
.kpi-busy { --kpi-accent: var(--warning); }
.kpi-muted { --kpi-accent: var(--border); }
@media (prefers-color-scheme: dark) {
    .kpi-lead { --kpi-accent: #b794f6; }
}

.form-panel { display: grid; gap: 0.4rem; max-width: 520px; }
.form-panel label { font-weight: 600; margin-top: 0.6rem; }
.form-panel label.checkbox-label { display: flex; gap: 0.5rem; align-items: center; font-weight: 400; }
.form-panel input:not([type="checkbox"]):not([type="hidden"]) {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.form-panel .button { margin-top: 0.8rem; justify-self: start; }
.field-error, .field-validation-error { color: var(--danger); font-size: 0.9rem; }
.input-validation-error { border-color: var(--danger) !important; }
.validation-summary-valid { display: none; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.5rem 1.1rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.button.primary { background: var(--primary); color: var(--on-primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.button.secondary:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); background: var(--surface-muted); }

.message { padding: 0.75rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.message.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.message.success { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }

/* Tables: calm header, hover rows, actions grouped at the right edge. */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; vertical-align: middle; }
.data-table th { color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.data-table tbody tr { transition: background-color 0.12s; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table td.row-actions { justify-content: flex-end; }

/* Phones: each row becomes a small card, labels come from data-label. */
@media (max-width: 640px) {
    .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .data-table tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
    .data-table tbody tr:last-child { border-bottom: 0; }
    .data-table tbody tr:hover { background: none; }
    .data-table td { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.5rem; border: 0; padding: 0.25rem 0; }
    .data-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
    .data-table td:not([data-label])::before { content: none; }
    .data-table td.row-actions { display: flex; justify-content: flex-start; padding-top: 0.5rem; }
}

/* Scans */
.button.small { min-height: 36px; padding: 0.25rem 0.75rem; font-size: 0.9rem; }
.button[disabled] { opacity: 0.55; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.row-actions form { margin: 0; }
/* Links next to row buttons look like quiet buttons, so a row's actions read as one group. */
.row-actions > a { display: inline-flex; align-items: center; min-height: 36px; padding: 0.25rem 0.75rem; font-size: 0.9rem; font-weight: 600; text-decoration: none; border-radius: var(--radius-sm); }
.row-actions > a:hover { background: var(--surface-muted); }
@media (pointer: coarse) { .row-actions > a, .button.small { min-height: 44px; } }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.35rem; }

.facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 0.4rem 1.25rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 640px) {
    .facts { grid-template-columns: 1fr; gap: 0.1rem; }
    .facts dd { margin-bottom: 0.5rem; }
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    color: var(--status-color, var(--muted));
    background: color-mix(in srgb, var(--status-color, var(--muted)) 14%, var(--surface));
}
.status::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; flex: none; }
.status-completed { --status-color: var(--success); }
.status-partial { --status-color: var(--warning); }
.status-failed, .status-cancelled { --status-color: var(--danger); }
.status-running, .status-pending { --status-color: var(--primary); }
.status-running::before { animation: status-pulse 1.4s ease-in-out infinite; }
@keyframes status-pulse { 50% { opacity: 0.3; } }

.shot-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 1rem; align-items: start; }
.shot { margin: 0; display: grid; gap: 0.4rem; }
.shot img { width: 100%; height: auto; max-height: 70vh; object-fit: cover; object-position: top; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); }
.shot figcaption { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 640px) {
    .shot-grid { grid-template-columns: 1fr; }
}

/* Findings and leads */
.finding-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.finding { border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; padding: 0.75rem 1rem; }
.finding-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; }
.finding-hint, .finding-effect { margin: 0.35rem 0 0; }
.finding-effect { font-size: 0.9rem; }
.severity { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.severity-critical { border-left-color: var(--danger); }
.severity-high { border-left-color: var(--high); }
.severity-medium { border-left-color: #b7791f; }
.severity-low { border-left-color: var(--primary); }
.score { font-weight: 700; font-size: 1.1rem; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.filter-bar select, .form-panel select, .form-panel textarea {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.form-panel textarea { min-height: 8rem; resize: vertical; }
.inline-form { margin-top: 1rem; }
/* Guest quota: number field and save button on one line inside a table cell */
.quota-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.quota-form input { width: 6rem; min-height: 36px; padding: 0.25rem 0.5rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

/* Area overview and guide: one card per audit area, colour follows the worst finding */
.area-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.area-card { display: grid; gap: 0.15rem; padding: 0.85rem 1rem; border: 1px solid var(--border); border-top-width: 4px; border-radius: 8px; background: var(--surface); }
.area-name { font-weight: 600; }
.area-score { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.area-state { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.area-count { font-size: 0.9rem; }
.area-good { border-top-color: #1a7f37; }
.area-good .area-state { color: #1a7f37; }
.area-minor { border-top-color: var(--primary); }
.area-minor .area-state { color: var(--primary); }
.area-attention { border-top-color: #b7791f; }
.area-attention .area-state { color: #9a6700; }
.area-problem { border-top-color: var(--danger); }
.area-problem .area-state { color: var(--danger); }
@media (prefers-color-scheme: dark) {
    .area-good .area-state { color: #6fdd8b; }
    .area-attention .area-state { color: #e3b341; }
}
.finding-fix { margin: 0.35rem 0 0; }
.top-actions { margin-bottom: 0.5rem; }
.area-tag { display: inline-block; padding: 0.05rem 0.5rem; margin-right: 0.4rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--surface-muted); color: var(--muted); }
.common-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.common-list .finding { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; padding: 0.5rem 0.85rem; }
.common-list a { min-height: 24px; }
.area-toc { margin: 0 0 0.75rem; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.area-toc a { display: inline-flex; align-items: center; min-height: 44px; }
.finding:target { outline: 3px solid var(--ui-color-focus-ring); }
[id^="area-"], [id^="plan-"], [id^="rule-"], [id^="scan-"] { scroll-margin-top: 4.5rem; }

/* Dashboard and report */
.dashboard-grid { display: grid; gap: 1.25rem; }
@media (min-width: 1000px) { .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Compact row lists (top leads, recent scans): name left, badges right. */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.row-list li:last-child { border-bottom: 0; }
.row-list-main { flex: 1 1 10rem; min-height: 32px; display: inline-flex; align-items: center; font-weight: 600; text-decoration: none; }
.row-list-main:hover { text-decoration: underline; }
.score-pill { min-width: 2.6rem; padding: 0.1rem 0.5rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; border-radius: 999px; color: #6d28d9; background: color-mix(in srgb, #7c3aed 12%, var(--surface)); }
@media (prefers-color-scheme: dark) { .score-pill { color: #c4b5fd; } }

/* Most common problems: one line per rule, coloured by severity. */
.issue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.issue { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-muted); border-left: 4px solid var(--sev, var(--border)); }
.issue-title { flex: 1 1 14rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.issue-title a { font-weight: 600; }
.issue-title .area-tag { margin: 0; background: var(--surface); }
.issue-count { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.severity-pill { min-width: 4.5rem; padding: 0.1rem 0.5rem; text-align: center; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; border-radius: 999px; color: var(--sev, var(--muted)); background: color-mix(in srgb, var(--sev, var(--muted)) 14%, var(--surface)); }
.issue.severity-critical, .severity-pill.severity-critical { --sev: var(--danger); }
.issue.severity-high { --sev: var(--high); }
.issue.severity-medium { --sev: var(--warning); }
.issue.severity-low { --sev: var(--primary); }
.issue.severity-info { --sev: var(--muted); }

/* Scan details: header with scores, jump bar, collapsible technical sections. */
.scan-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.scan-hero-main { flex: 1 1 22rem; min-width: 0; display: grid; gap: 0.6rem; }
.scan-hero h1 { margin: 0; }
.scan-hero-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin: 0; }
.scan-hero .button-row { margin-top: 0.4rem; }
.scan-hero .button-row form { margin: 0; }
.facts-inline { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 0; }
.facts-inline > div { display: grid; gap: 0.05rem; }
.facts-inline dt { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.facts-inline dd { margin: 0; font-variant-numeric: tabular-nums; }
.facts-inline .facts-error { flex-basis: 100%; }
.facts-inline .facts-error dd { color: var(--danger); }

.score-rings { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.score-ring { position: relative; display: grid; justify-items: center; gap: 0.35rem; width: 7.5rem; text-align: center; }
.score-ring svg { width: 6.5rem; height: 6.5rem; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 3.4; }
.ring-track { stroke: var(--surface-muted); }
.ring-value { stroke: var(--ring, var(--primary)); stroke-linecap: round; }
.ring-number { position: absolute; top: 0; height: 6.5rem; display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.ring-good { --ring: var(--success); }
.ring-mid { --ring: var(--warning); }
.ring-bad { --ring: var(--danger); }
.ring-lead { --ring: #7c3aed; }
@media (prefers-color-scheme: dark) { .ring-lead { --ring: #b794f6; } }
@media (max-width: 640px) {
    .scan-hero { padding: 1rem; }
    .score-rings { width: 100%; justify-content: space-around; }
}

.jump-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: -0.25rem 0;
    padding: 0.35rem 0;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(6px);
}
.jump-bar ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; }
.jump-bar a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 0.9rem;
    white-space: nowrap;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.jump-bar a:hover { border-color: var(--primary); color: var(--primary); }
@media (pointer: coarse) { .jump-bar a { min-height: 44px; } }

.collapsible-group { display: grid; gap: 0.5rem; }
.collapsible { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.collapsible > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0 1rem;
    list-style: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after { content: ""; width: 0.55rem; height: 0.55rem; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
.collapsible[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.collapsible > summary:hover { background: var(--surface-muted); }
.collapsible > summary h3 { margin: 0; font-size: 1rem; }
.collapsible > :not(summary) { margin-inline: 1rem; }
.collapsible[open] { padding-bottom: 0.75rem; }
.collapsible[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin-bottom: 0.75rem; }
.collapsible .facts { margin-bottom: 0.25rem; }
.report-page { display: grid; gap: 1.5rem; }
.report-foot { border-top: 1px solid var(--border); padding-top: 1rem; font-size: 0.9rem; }
@media print {
    .site-header, .jump-bar, .no-print, .ui-alert, .alert { display: none !important; }
    body.app-shell { display: block; }
    body { background: #fff; color: #000; }
    .page-shell { width: 100%; margin: 0; }
    .stat, .panel, .finding, .area-card { break-inside: avoid; border-color: #bbb; }
    .report-shots { break-before: page; }
    .shot img { max-height: none; }
    a { color: inherit; text-decoration: none; }
}

/* Two-factor */
.auth-card--wide { width: min(100%, 640px); }
.qr { max-width: 240px; background: #fff; padding: 0.75rem; border-radius: 8px; }
.qr svg { width: 100%; height: auto; display: block; }
.code-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.4rem; padding: 0; list-style: none; }
.code-list code { font-size: 1rem; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

/* Shared first-administrator setup form (Rekcuz.Shared.Web partial, own markup) */
.first-administrator { width: min(100%, 480px); margin: 0 auto; display: grid; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.first-administrator form { display: grid; gap: 0.25rem; }
.first-administrator form p { display: grid; gap: 0.35rem; margin: 0 0 0.6rem; }
.first-administrator label { font-weight: 600; }
.first-administrator input {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.first-administrator button { justify-self: start; min-height: 44px; padding: 0.5rem 1.1rem; font: inherit; font-weight: 600; color: var(--on-primary); background: var(--primary); border: 0; border-radius: 8px; cursor: pointer; }
.first-administrator .validation-summary-errors { color: var(--danger); }

.error-page { width: min(100%, 640px); margin: 2rem auto; display: grid; gap: 0.75rem; }

/* Contacts, templates and the message editor. Same 640px breakpoint as the rest of the app. */
.form-panel.form-wide { max-width: none; }
.form-panel fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 1rem 1rem; margin: 0.75rem 0 0; display: grid; gap: 0.4rem; min-width: 0; }
.form-panel legend { font-weight: 700; padding: 0 0.35rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; }
.form-row > div { display: grid; gap: 0.4rem; align-content: start; min-width: 0; }
.permission-row { display: grid; gap: 0.35rem; padding: 0.5rem 0; border-top: 1px solid var(--border); }
.permission-row:first-of-type { border-top: 0; }
.sub-label { font-weight: 400 !important; margin-top: 0 !important; color: var(--muted); }
.message.notice { border-color: color-mix(in srgb, #b7791f 45%, var(--border)); background: color-mix(in srgb, #b7791f 8%, var(--surface)); }
.contact-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.35rem; }
.contact-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; }
.contact-list li.selected { border-color: var(--primary); }
.contact-list a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.placeholder-toolbar { margin-top: 0.8rem; }
.placeholder-toolbar summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { font: inherit; font-size: 0.85rem; min-height: 36px; padding: 0.2rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-muted); color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.chip:hover { border-color: var(--primary); }
.chip-custom { border-style: dashed; }
.message-preview { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); display: grid; gap: 0.6rem; min-width: 0; }
.message-preview h3 { margin: 0; }
.preview-subject { font-weight: 600; overflow-wrap: anywhere; }
.preview-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; }
.preview-list { margin: 0; padding-left: 1.25rem; }
.preview-issues, .preview-warnings { color: var(--danger); }
mark.ph-missing, mark.ph-unknown { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); border-radius: 4px; padding: 0 0.15rem; outline: 1px dashed var(--danger); }
.permission-box { display: grid; gap: 0.35rem; }
.permission-level:empty { display: none; }
.permission-allowed { color: #1a7f37; }
.permission-warning { color: #9a6700; }
.permission-blocked { color: var(--danger); }
.review-check { margin-top: 0.8rem !important; font-weight: 600 !important; }
.version-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.version-list summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.kind { font-size: 0.75rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.kind-vulnerability { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.kind-legalrisk { color: #9a6700; border-color: color-mix(in srgb, #b7791f 45%, var(--border)); }
@media (prefers-color-scheme: dark) {
    .permission-allowed { color: #4ac26b; }
    .permission-warning, .kind-legalrisk { color: #d29922; }
}
@media print {
    .placeholder-toolbar, [data-copy] { display: none; }
}

/* Access codes: a new code is shown once and read out or typed, so make it big. */
.access-code { font-size: 1.5rem; letter-spacing: 0.08em; word-break: break-all; }
