/*
 * Patchman web UI - hand-written CSS (no framework, no build step).
 * Tokens on :root, dark values for data-theme="dark" (theme toggle) or prefers-color-scheme.
 * No inline styles anywhere (strict CSP): every visual rule lives here.
 */

:root {
    color-scheme: light;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --bg: #f6f6f3;
    --surface: #ffffff;
    --surface-2: #f1f0ec;
    --border: #e1e0d9;
    --border-strong: #c3c2b7;
    --text: #0b0b0b;
    --text-2: #52514e;
    --muted: #686761;
    --link: #1c5cab;
    --primary: #1c5cab;
    --primary-hover: #184f95;
    --on-primary: #ffffff;
    --danger: #b02a2a;
    --danger-hover: #8f2222;
    --focus: #2a78d6;
    --sidebar-bg: #11161d;
    --sidebar-text: #d9dde3;
    --sidebar-muted: #9aa3ae;
    --sidebar-active: #233142;

    --critical-bg: #fbe9e9;
    --critical-text: #a12828;
    --warning-bg: #fdf1d6;
    --warning-text: #6e4b00;
    --good-bg: #e4f3e4;
    --good-text: #005c00;
    --info-bg: #e3eefb;
    --info-text: #184f95;
    --neutral-bg: #efeee9;
    --neutral-text: #4a4945;

    /* Charts (read by assets/chart_theme.js) */
    --series-1: #2a78d6;
    --chart-grid: #e1e0d9;
    --chart-axis: #c3c2b7;
    --chart-text: #52514e;

    --radius: 8px;
    --shadow: 0 1px 2px rgba(11, 11, 11, 0.06);
    --eyebrow: var(--primary);
}

/*
 * Dark tokens, applied by an explicit choice (data-theme="dark" on <html>, set by the theme
 * toggle and the init script of base.html.twig) or by the system preference unless light was
 * chosen explicitly. The two blocks must stay identical (ThemeToggleTest).
 */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --border: #2f2f2c;
    --border-strong: #45453f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #a5a49c;
    --link: #86b6ef;
    --primary: #256abf;
    --primary-hover: #2a78d6;
    --on-primary: #ffffff;
    --danger: #c43c3c;
    --danger-hover: #d65252;
    --focus: #6da7ec;
    --sidebar-bg: #121212;
    --sidebar-text: #e2e1dc;
    --sidebar-muted: #a5a49c;
    --sidebar-active: #262624;

    --critical-bg: #3b1818;
    --critical-text: #f3a6a6;
    --warning-bg: #3a2c0c;
    --warning-text: #f5cd72;
    --good-bg: #13301a;
    --good-text: #8fd88f;
    --info-bg: #142a45;
    --info-text: #a9cbf4;
    --neutral-bg: #2a2a28;
    --neutral-text: #d3d2ca;

    --series-1: #3987e5;
    --chart-grid: #2c2c2a;
    --chart-axis: #45453f;
    --chart-text: #c3c2b7;

    --shadow: none;
    --eyebrow: var(--link);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0d0d0d;
        --surface: #1a1a19;
        --surface-2: #232322;
        --border: #2f2f2c;
        --border-strong: #45453f;
        --text: #f0efec;
        --text-2: #c3c2b7;
        --muted: #a5a49c;
        --link: #86b6ef;
        --primary: #256abf;
        --primary-hover: #2a78d6;
        --on-primary: #ffffff;
        --danger: #c43c3c;
        --danger-hover: #d65252;
        --focus: #6da7ec;
        --sidebar-bg: #121212;
        --sidebar-text: #e2e1dc;
        --sidebar-muted: #a5a49c;
        --sidebar-active: #262624;

        --critical-bg: #3b1818;
        --critical-text: #f3a6a6;
        --warning-bg: #3a2c0c;
        --warning-text: #f5cd72;
        --good-bg: #13301a;
        --good-text: #8fd88f;
        --info-bg: #142a45;
        --info-text: #a9cbf4;
        --neutral-bg: #2a2a28;
        --neutral-text: #d3d2ca;

        --series-1: #3987e5;
        --chart-grid: #2c2c2a;
        --chart-axis: #45453f;
        --chart-text: #c3c2b7;

        --shadow: none;
        --eyebrow: var(--link);
    }
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

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

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 3px;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
code, pre, .mono { font-family: var(--font-mono); font-size: 0.875em; }

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

.skip-link {
    position: absolute;
    left: 0.5rem; top: -3rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius);
    z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

/* ---------------------------------------------------------------- layout */
.app {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}
/* Desktop: the dark column always spans the whole page height (this grid item shares the
   sidebar cell), while the sidebar itself stays pinned to the viewport and scrolls on its own. */
.app::before {
    content: "";
    grid-column: 1;
    grid-row: 1;
    background: var(--sidebar-bg);
}

.sidebar {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.25rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.125rem;
    text-decoration: none;
    padding: 0 0.5rem;
}
.brand img { width: 26px; height: 26px; }

.sidebar .tenant-switch {
    padding: 0.625rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
}
.tenant-switch .label { display: block; font-size: 0.75rem; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tenant-switch .name { display: block; font-weight: 600; color: #ffffff; overflow-wrap: anywhere; }
.tenant-switch a { color: var(--sidebar-muted); font-size: 0.8125rem; }

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sidebar-muted);
    padding: 0 0.75rem;
    margin: 0 0 0.25rem;
}
.nav-section a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 0.4375rem 0.75rem;
    border-radius: 6px;
}
.nav-section a:hover { background: var(--sidebar-active); }
.nav-section a[aria-current="page"] { background: var(--sidebar-active); color: #ffffff; font-weight: 600; box-shadow: inset 3px 0 0 var(--series-1); }

.sidebar-footer { margin-top: auto; font-size: 0.8125rem; color: var(--sidebar-muted); display: flex; flex-direction: column; gap: 0.5rem; padding: 0 0.5rem; }
.sidebar-footer .who { color: var(--sidebar-text); overflow-wrap: anywhere; }
.sidebar-footer .account-link { color: var(--sidebar-text); text-decoration: underline; text-underline-offset: 2px; }
.sidebar-footer .account-link[aria-current="page"] { font-weight: 600; }
.sidebar-footer button {
    align-self: flex-start;
    background: transparent;
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    padding: 0.3125rem 0.75rem;
    font: inherit;
    cursor: pointer;
}
.sidebar-footer button:hover { background: var(--sidebar-active); }
/* Theme toggle (assets/controllers/theme_controller.js): one icon per mode, shown by data-theme-mode. */
.theme-toggle { display: inline-flex; align-items: center; gap: 0.4375rem; }
.theme-toggle[hidden] { display: none; }
.theme-toggle .theme-icon { display: none; width: 1rem; height: 1rem; flex: none; }
.theme-toggle[data-theme-mode="system"] .theme-icon-system,
.theme-toggle[data-theme-mode="light"] .theme-icon-light,
.theme-toggle[data-theme-mode="dark"] .theme-icon-dark { display: block; }

.main { grid-column: 2; grid-row: 1; padding: 1.75rem 2rem 3rem; min-width: 0; }
.main-narrow { max-width: 760px; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.25rem;
}
.page-header .subtitle { color: var(--text-2); margin: 0; }
.breadcrumb { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.25rem; }
.breadcrumb a { color: var(--muted); }

.public {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}
.public-card {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}
.public-card .brand { color: var(--text); padding: 0; margin-bottom: 1.25rem; }

@media (max-width: 860px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .app::before { content: none; }
    .sidebar, .main { grid-column: auto; grid-row: auto; }
    .sidebar { position: static; height: auto; padding: 1rem; gap: 0.875rem; }
    .nav-section { flex-direction: row; flex-wrap: wrap; }
    .nav-title { width: 100%; }
    .sidebar-footer { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .main { padding: 1.25rem 1rem 2.5rem; }
}

/* ---------------------------------------------------------------- cards & grids */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.125rem 1.25rem;
    box-shadow: var(--shadow);
    min-width: 0;
}
.card > h2 { margin-bottom: 0.875rem; }
.card-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.card-header h2 { margin: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 1rem; }
/* Inside a grid the gap already spaces the cards; the margin would push a row's second card down. */
.grid > .card + .card { margin-top: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) {
    .grid-2, .grid-3-2 { grid-template-columns: minmax(0, 1fr); }
}

/* 6 KPIs on one line from 1280 px: main = 1280 - 248 (sidebar) - 64 (padding) = 968 px
   >= 6 x 140 + 5 x 12 (tests/e2e: dashboard-1280). Below, they wrap. */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    color: inherit;
}
a.kpi:hover { border-color: var(--border-strong); }
.kpi .kpi-label { color: var(--text-2); font-size: 0.8125rem; }
.kpi .kpi-value { font-size: 1.75rem; font-weight: 650; line-height: 1.1; }
.kpi .kpi-note { color: var(--muted); font-size: 0.8125rem; }
.kpi.kpi-critical { box-shadow: inset 4px 0 0 var(--critical-text); }
.kpi.kpi-warning { box-shadow: inset 4px 0 0 var(--warning-text); }

.chart-box { position: relative; height: 260px; }
.chart-box canvas { display: block; width: 100%; height: 100%; }
.chart-box-tall { height: 320px; }

details.data-table { margin-top: 0.75rem; font-size: 0.875rem; }
details.data-table summary { cursor: pointer; color: var(--text-2); }

/* ---------------------------------------------------------------- tables */
/* Every data table sits in <div class="table-wrap" role="region" tabindex="0" aria-label="...">:
   on narrow screens the table keeps its natural width and this region scrolls horizontally
   (keyboard-scrollable thanks to tabindex) instead of squeezing cells letter by letter. */
/* position: relative keeps absolutely positioned descendants (.visually-hidden) inside the scroller. */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
caption { text-align: left; color: var(--text-2); padding-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.5625rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-2); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
thead th:first-child { border-top-left-radius: 6px; }
thead th:last-child { border-top-right-radius: 6px; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* break-word (unlike anywhere) does not lower the min-content width: words stay whole. */
td.wrap { overflow-wrap: break-word; }
/* Long space-less blobs (JSON): may break anywhere, but never narrower than 16rem. */
td.wrap-blob { overflow-wrap: anywhere; min-width: 16rem; }
.empty { color: var(--muted); padding: 1rem 0; margin: 0; }
.card-footnote { margin: 0.75rem 0 0; font-size: 0.8125rem; }
table.updates th[scope="row"] { font-weight: 400; }
table.updates .package-name { font-weight: 600; margin-right: 0.375rem; }
table.updates .versions { white-space: nowrap; }
th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }
th a[aria-current="true"] { color: var(--text); }

/* ---------------------------------------------------------------- badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--neutral-bg);
    color: var(--neutral-text);
}
.badge-critical { background: var(--critical-bg); color: var(--critical-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-good { background: var(--good-bg); color: var(--good-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badges { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }

/* ---------------------------------------------------------------- forms & buttons */
.button, button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.9375rem;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--primary);
    color: var(--on-primary);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.25;
}
.button:hover { background: var(--primary-hover); }
.button-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.button-secondary:hover { background: var(--surface-2); }
.button-danger { background: var(--danger); }
.button-danger:hover { background: var(--danger-hover); }
.button-small { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.button-large { padding: 0.6875rem 1.25rem; font-size: 1rem; }

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.field label, .field .label { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 0.8125rem; color: var(--muted); }
.field .error { font-size: 0.8125rem; color: var(--critical-text); font-weight: 600; }
.field-grow { flex: 1 1 220px; }

input[type="text"], input[type="search"], input[type="email"], input[type="number"], input[type="date"], select {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 0.4375rem 0.625rem;
    min-height: 2.25rem;
    max-width: 100%;
}
input[aria-invalid="true"] { border-color: var(--critical-text); }
.checkbox { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.checkbox input { width: 1.0625rem; height: 1.0625rem; accent-color: var(--primary); }

.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1rem; }
.inline-form { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }

.danger-zone { border-color: var(--critical-bg); }
.danger-zone h2 { color: var(--critical-text); }
.danger-zone form + form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a {
    padding: 0.5rem 0.875rem;
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 600;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--series-1); }
/* In-page tabs (tabs_controller.js): buttons styled like the link tabs. */
.tabs [role="tab"] {
    padding: 0.5rem 0.875rem;
    color: var(--text-2);
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--series-1); }
.tabs [role="tab"]:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.tabs[hidden] { display: none; }
[role="tabpanel"] > h3:first-child { margin-top: 0; }
/* Long inline commands (URLs, JSON patches) wrap instead of widening the page at 390 px. */
[role="tabpanel"] :not(pre) > code { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- flashes & notices */
.flashes { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.flash, .notice {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
}
.flash-success { background: var(--good-bg); color: var(--good-text); border-color: transparent; }
.flash-error { background: var(--critical-bg); color: var(--critical-text); border-color: transparent; }
.flash-warning, .notice-warning { background: var(--warning-bg); color: var(--warning-text); border-color: transparent; }
.notice-info { background: var(--info-bg); color: var(--info-text); border-color: transparent; }
.notice ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.plan-banner { margin: 0 0 1rem; font-size: 0.9rem; }
.plan-banner a { color: inherit; font-weight: 600; }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.feature-list li { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.feature-list .excluded { color: var(--muted); }

/* ---------------------------------------------------------------- key/value lists */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.375rem 1.25rem; margin: 0; font-size: 0.875rem; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.875rem; font-size: 0.875rem; color: var(--text-2); }
.pagination ul { list-style: none; display: flex; gap: 0.375rem; margin: 0; padding: 0; }
.pagination a, .pagination span.current {
    display: inline-block;
    min-width: 2rem;
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}
.pagination span.current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pagination a:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- secrets & code */
.secret {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.secret code {
    flex: 1 1 320px;
    padding: 0.625rem 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    overflow-wrap: anywhere;
    user-select: all;
}
pre.commands {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.875rem 1rem;
    overflow-x: auto;
    margin: 0 0 0.75rem;
    line-height: 1.55;
}
.copy-row { display: flex; justify-content: flex-end; margin-bottom: 0.25rem; }

/* ---------------------------------------------------------------- misc */
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.tenant-list li + li { border-top: 1px solid var(--border); }
.tenant-list a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.25rem; text-decoration: none; color: var(--text); }
.tenant-list a:hover { background: var(--surface-2); }
.error-code { font-size: 3rem; font-weight: 700; color: var(--muted); line-height: 1; margin-bottom: 0.5rem; }

/* ---------------------------------------------------------------- public site (landing, pricing, legal) */
/* Same tokens as the application; one accent (--primary), status colors only for badges. */
.site-container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.site-narrow { max-width: 760px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.site-header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.site-header .brand { color: var(--text); padding: 0; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-nav a, .site-actions > a:not(.button) { color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
.site-nav a:hover, .site-actions > a:not(.button):hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }
.site-actions { margin-left: auto; display: flex; align-items: center; gap: 1rem; }

.site-main { display: block; }
.site-main:focus { outline: none; }
.site-section { padding: 3.5rem 0; }
.site-section-tight { padding: 1.5rem 0; }
.site-section-alt { background: var(--surface-2); }
/* Cards laid out by a grid: no stacking margin (.card + .card). */
.feature-columns > .card, .price-teaser > .card, .plan-cards > .card { margin-top: 0; }
.site-section h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.site-section h3 { font-size: 1.0625rem; }
.lead { font-size: 1.0625rem; color: var(--text-2); max-width: 46rem; }
.eyebrow { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--eyebrow); margin-bottom: 0.75rem; }

.hero { padding: 3.5rem 0 3rem; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; align-items: center; }
.hero h1 { font-size: 2.25rem; line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0.75rem; }
.hero-note { font-size: 0.875rem; }
.hero-visual { margin: 0; min-width: 0; }
.hero-visual img { display: block; width: 100%; height: auto; }
/* Illustrations are drawn on a light background: keep them on a light card in dark theme too. */
.illustration { background: #f7f5f1; border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 12px 32px rgba(11, 11, 11, 0.12); padding: 0.5rem; overflow: hidden; }
.illustration img { display: block; width: 100%; height: auto; }
.proof-visual { margin: 1.5rem auto 2rem; max-width: 52rem; }
.dashboard-preview { margin: 2rem 0 0; min-width: 0; }
.dashboard-preview h3 { margin-bottom: 0.75rem; }
.dashboard-preview img { display: block; width: 100%; height: auto; border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 12px 32px rgba(11, 11, 11, 0.12); }
.dashboard-preview figcaption { font-size: 0.8125rem; margin-top: 0.5rem; }
.hero-visual figcaption { font-size: 0.8125rem; margin-top: 0.5rem; }

.outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.outcomes li { border-top: 3px solid var(--border-strong); padding-top: 0.875rem; }
.outcome-before { color: var(--muted); }
.outcome-after { font-weight: 600; margin: 0; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.125rem 1.25rem; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; margin-bottom: 0.625rem; }
.steps code { overflow-wrap: anywhere; }
.steps p { margin: 0; }

.feature-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.feature-columns .card h3 { margin-bottom: 0.75rem; }
.ticks { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.5rem; }
.ticks li { padding-left: 1.5rem; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--good-text); font-weight: 700; }
.soon { margin: 1rem 0 0; font-size: 0.875rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card-grid > .card { margin-top: 0; }
.card-grid .card h3 { margin-bottom: 0.5rem; }
.persona-pain { color: var(--text-2); font-style: italic; }
.section-more { margin: 1.25rem 0 0; font-weight: 600; }
.crosses { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.5rem; }
.crosses li { padding-left: 1.5rem; position: relative; }
.crosses li::before { content: "✕"; position: absolute; left: 0; color: var(--muted); font-weight: 700; }

.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem 2rem; }
.trust-grid p { color: var(--text-2); margin: 0; }


.price-teaser { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.price-teaser li { display: flex; flex-direction: column; gap: 0.25rem; }
.price-teaser-name { font-weight: 700; }
.price-teaser-value { font-size: 1.75rem; font-weight: 650; }

.faq details { border-bottom: 1px solid var(--border); padding: 0.875rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.625rem 0 0; color: var(--text-2); }

.site-cta { text-align: center; }
.site-cta .hero-actions { justify-content: center; }

.pricing-head { padding-bottom: 1rem; }
.pricing-head h1 { font-size: 2rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.375rem; }
.plain-list li { overflow-wrap: anywhere; }
fieldset.choices { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; min-width: 0; }
fieldset.choices legend { font-weight: 600; margin-bottom: 0.375rem; }
.choice { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.625rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.choice input { margin-top: 0.2rem; accent-color: var(--primary); }
.period-switch { display: inline-flex; gap: 0.25rem; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.25rem; margin: 0.5rem 0 0; background: var(--surface); }
.period-switch[hidden] { display: none; }
.period-switch label { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.875rem; border-radius: 999px; cursor: pointer; font-weight: 600; }
.period-switch input { accent-color: var(--primary); }
.period-switch label:has(input:checked) { background: var(--surface-2); }

.plan-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.plan-card { display: flex; flex-direction: column; padding: 1.5rem; }
.plan-card-featured { border-color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
.plan-card h2 { font-size: 1.25rem; margin: 0; }
.plan-tagline { font-size: 0.875rem; }
.plan-price { margin: 0.25rem 0 0.25rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
.plan-amount { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-amount[hidden] { display: none; }
.plan-unit { color: var(--text-2); font-size: 0.875rem; }
.plan-annual { font-size: 0.8125rem; min-height: 2.5em; }
.plan-limits { margin: 0.5rem 0 1rem; padding-left: 1.125rem; font-weight: 600; }
.plan-features { font-size: 0.875rem; border-top: 1px solid var(--border); padding-top: 1rem; margin-bottom: 1.25rem; }
.plan-cta { margin: auto 0 0; }
.plan-cta .button { width: 100%; }
/* WCAG 2.2 target size: the link under the button gets a 24 px+ tap area. */
/* /cookies: readable columns at 390 px (the table-wrap scrolls if needed). */
.cookie-table th[scope="row"] { min-width: 9rem; font-weight: 600; }
.cookie-table td { min-width: 10rem; }
/* Narrow screens: one card per row, each cell labelled (no horizontal scrolling). */
@media (max-width: 40rem) {
    .cookie-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .cookie-table tr, .cookie-table th[scope="row"], .cookie-table td { display: block; min-width: 0; }
    .cookie-table th[scope="row"] { border-bottom: 0; padding-bottom: 0.25rem; }
    .cookie-table td { border-bottom: 0; padding-top: 0.25rem; padding-bottom: 0.25rem; }
    .cookie-table tr { border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
    .cookie-table td::before { content: attr(data-label) " : "; font-weight: 600; color: var(--text-2); }
}
.check { color: var(--good-text); font-weight: 700; }

table.comparison th[scope="row"] { font-weight: 400; }
table.comparison td { white-space: nowrap; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 2rem 0; font-size: 0.875rem; }
.site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; }
.site-footer-brand { margin: 0; }
.site-footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer-links a { color: var(--text-2); }

@media (max-width: 960px) {
    .hero-inner, .feature-columns { grid-template-columns: minmax(0, 1fr); }
    .outcomes, .steps, .price-teaser, .plan-cards, .card-grid { grid-template-columns: minmax(0, 1fr); }
    .hero h1 { font-size: 1.875rem; }
}
@media (max-width: 560px) {
    .site-header { position: static; }
    .site-actions { margin-left: 0; width: 100%; justify-content: space-between; }
    .site-nav { width: 100%; order: 3; }
    .hero { padding-top: 2rem; }
    .hero h1 { font-size: 1.625rem; }
    .site-section { padding: 2.5rem 0; }
}

/* Turbo Drive progress bar (its own <style> carries the CSP nonce; this is the fallback). */
.turbo-progress-bar { height: 3px; background: var(--series-1); }

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

@media print {
    .sidebar, .filters, .pagination, form, .site-header { display: none !important; }
    .app { display: block; }
    .app::before { content: none; }
}
