:root {
    --navy: #0b2d52;
    --navy-dark: #081f3a;
    --cyan: #2fb6ea;
    --blue: #1a63a3;
    --page-bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e1e6ec;
    --fg: #1a2733;
    --fg-muted: #5b6b7b;
    --error-bg: #fdeceb;
    --error-fg: #a32a1f;
    --error-border: #f3c6c1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, sans-serif;
    color: var(--fg);
    background: var(--page-bg);
}

a {
    color: inherit;
}

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

.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;
}

.skip-link {
    position: absolute;
    top: -3rem;
    left: 1rem;
    z-index: 100;
    background: #fff;
    color: var(--navy);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 1rem;
}

/* Honeypot: off-screen for sighted users, aria-hidden for assistive tech; */
/* left in the tab order deliberately removed via tabindex="-1" on the input. */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Header */

.site-header {
    background: var(--navy);
    color: #fff;
}

.site-header__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
}

.logo__mark {
    display: inline-flex;
    width: 28px;
    height: 28px;
    color: var(--cyan);
}

.logo__mark svg {
    width: 100%;
    height: 100%;
}

.logo__text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.logo__accent {
    color: var(--cyan);
    font-weight: 500;
}

.beta-badge {
    margin-left: 2px;
    padding: 2px 8px 1px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--cyan), #5fd0f5);
    color: var(--navy-dark);
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    align-self: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    user-select: none;
}

.site-header__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
}

.site-header__nav > a {
    font-size: 0.85rem;
    color: #cfe0f2;
    text-decoration: none;
}

.site-header__nav > a:hover {
    color: #fff;
    text-decoration: underline;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.lang-toggle a {
    color: #8fa9c4;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.lang-toggle a.is-active {
    color: #fff;
}

.lang-toggle a:hover {
    color: #fff;
}

/* Hero */

.hero {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: #fff;
    padding: 3rem 1.25rem 4rem;
}

.hero__inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.6rem;
    letter-spacing: -0.01em;
}

.hero .subtitle {
    margin: 0 auto 2rem;
    max-width: 560px;
    color: #cfe0f2;
    font-size: 1.05rem;
    line-height: 1.5;
}

.hero--compact {
    padding: 2.25rem 1.25rem 2.75rem;
}

.hero--compact .subtitle {
    margin-bottom: 0;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border-radius: 999px;
    padding: 0.4rem 0.4rem 0.4rem 1.1rem;
    box-shadow: 0 12px 30px rgba(4, 20, 40, 0.35);
    transition: box-shadow 0.15s ease;
}

.search-form:focus-within {
    box-shadow: 0 12px 30px rgba(4, 20, 40, 0.35), 0 0 0 3px var(--cyan);
}

.search-form__icon {
    width: 20px;
    height: 20px;
    color: var(--fg-muted);
    flex-shrink: 0;
}

.search-form input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--fg);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.6rem 0;
}

.search-form input::placeholder {
    color: #9aa7b4;
}

.search-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: none;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-form button:hover {
    background: var(--navy);
}

.search-form button:disabled {
    cursor: default;
    background: var(--navy);
}

.search-form button svg {
    width: 20px;
    height: 20px;
}

.search-form button.is-loading svg {
    animation: spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .search-form button.is-loading svg {
        animation: none;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Page content */

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}

.page:has(> :first-child.notice),
.page:has(> :first-child.result-card) {
    margin-top: -2.25rem;
}

.notice {
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

/* The sample-vehicle notice: bright orange so nobody mistakes the invented car for real data. */
.notice--sample {
    color: #d9480f;
}

.notice--error {
    background: var(--error-bg);
    color: var(--error-fg);
    border-color: var(--error-border);
}

/* Error pages (404/500) */

.error-page {
    text-align: center;
    padding-top: 4rem;
    padding-bottom: 5rem;
}

.error-page__code {
    margin: 0;
    font-size: 4rem;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -0.02em;
}

.error-page h1 {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.4rem;
}

.error-page .subtitle {
    color: var(--fg-muted);
    margin: 0 0 1.75rem;
}

.error-page__home {
    display: inline-block;
    background: var(--blue);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border-radius: 999px;
    transition: background 0.15s ease;
}

.error-page__home:hover {
    background: var(--navy);
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(11, 45, 82, 0.08);
    overflow: hidden;
}

.result-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.result-card__logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex-shrink: 0;
}

.plate-chip {
    font-weight: 700;
    letter-spacing: 0.03em;
    background: var(--navy);
    color: #fff;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.result-card__title {
    font-weight: 600;
    color: var(--fg);
}

.result-section__title {
    margin: 0;
    padding: 0.55rem 1.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fg-muted);
    background: #f8fafc;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* The card header already has a bottom border -- don't double it. */
.result-card__header + .result-section .result-section__title {
    border-top: none;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin: 0;
}

.result-grid > div {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.result-grid > div:nth-last-child(-n+2) {
    border-bottom: none;
}

.result-grid dt {
    font-size: 0.78rem;
    color: var(--fg-muted);
    margin-bottom: 0.2rem;
}

.result-grid dd {
    margin: 0;
    font-weight: 600;
    font-size: 0.98rem;
}

/* Status color: reserved for pass/fail state, never reused as a series color. */
.status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.status-dot--good {
    background: #0ca30c;
}

.status-dot--warning {
    background: #e8a100;
}

.status-dot--critical {
    background: #d03b3b;
}

@media (max-width: 560px) {
    .hero {
        padding: 2.25rem 1rem 3rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .result-grid > div:nth-last-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }

    .result-grid > div:last-child {
        border-bottom: none;
    }
}

/* Footer */

.site-footer {
    text-align: center;
    padding: 1.5rem 1.25rem 2.5rem;
    color: var(--fg-muted);
    font-size: 0.85rem;
}

.site-footer__logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem 2.5rem;
    margin-bottom: 1rem;
}

.site-footer__logos img {
    height: 40px;
    width: auto;
    display: block;
}

.site-footer p {
    margin: 0.25rem 0;
}

.site-footer__build {
    font-size: 0.78rem;
    opacity: 0.85;
}

.site-footer__build button {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    text-decoration: underline;
    font: inherit;
    font-size: inherit;
    cursor: pointer;
}

.site-footer__build button:hover {
    color: var(--blue);
}

/* Stats page */

.stats-page {
    max-width: 900px;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--fg-muted);
}

.empty-state h2 {
    color: var(--fg);
    margin-bottom: 0.5rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 4px 14px rgba(11, 45, 82, 0.06);
}

.stat-tile__label {
    display: block;
    font-size: 0.78rem;
    color: var(--fg-muted);
    margin-bottom: 0.35rem;
}

.stat-tile__value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--navy);
}

.meter-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.meter-card__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.92rem;
    margin-bottom: 0.6rem;
}

.meter-card__value {
    font-weight: 700;
    color: var(--navy);
}

/* Status color: reserved for pass/fail state, never reused as a series color. */
.meter {
    display: flex;
    height: 10px;
    background: #e8ecf1;
    border-radius: 999px;
    overflow: hidden;
}

.meter__fill {
    height: 100%;
    background: #0ca30c;
}

.meter__fill--warning {
    background: #e8a100;
}

.meter__fill--critical {
    background: #d03b3b;
}

.meter-card__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: var(--fg-muted);
}

.meter-card__note {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--fg-muted);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem 1.25rem;
}

.chart-card h2 {
    font-size: 0.95rem;
    margin: 0 0 1rem;
    color: var(--fg);
}

.bar-chart {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.bar-chart li {
    display: grid;
    grid-template-columns: 6.5rem 1fr auto;
    align-items: center;
    gap: 0.6rem;
}

.bar-chart__label {
    font-size: 0.82rem;
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-chart__track {
    background: var(--page-bg);
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.bar-chart__fill {
    display: block;
    height: 100%;
    background: var(--blue);
    border-radius: 999px;
}

.bar-chart__value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* Privacy notice */
.privacy-page { max-width: 760px; }
.privacy-page h2 { margin: 28px 0 8px; font-size: 18px; }
.privacy-page p, .privacy-page li { line-height: 1.65; }
.privacy-page mark { background: #fff3bf; padding: 1px 4px; border-radius: 4px; }
.privacy-updated { color: #5a6877; font-size: 13px; margin-top: 28px; }
.site-footer__build a { color: inherit; text-decoration: underline; }

/* Admin sandbox preview */
.sandbox-banner { background: #fff3bf; color: #5c4400; text-align: center; padding: 8px 12px; font-weight: 600; font-size: 14px; }

.stats-updated { font-size: 0.85rem; }
