:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1b1f24;
    --muted: #57606a;
    --border: #d0d7de;
    --accent: #0b5cad;
    --accent-text: #ffffff;
    --focus: #f0a500;
    --covered-bg: #fde8d7;
    --covered-text: #8a3b00;
    --check-bg: #fff4c2;
    --check-text: #6b5300;
    --not-covered-bg: #dcf3e2;
    --not-covered-text: #1a6b34;
    --unknown-bg: #eaeef2;
    --unknown-text: #424a53;
    --error-bg: #fde7e9;
    --error-text: #8c1d26;
    --info-bg: #e6f0fb;
    --info-text: #0b4a8a;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1216;
        --surface: #171b21;
        --text: #e6e9ed;
        --muted: #9aa4af;
        --border: #313842;
        --accent: #4b9be8;
        --accent-text: #0b1118;
        --covered-bg: #4a2510;
        --covered-text: #ffc8a1;
        --check-bg: #43380a;
        --check-text: #ffe58a;
        --not-covered-bg: #143521;
        --not-covered-text: #9be3b0;
        --unknown-bg: #262c34;
        --unknown-text: #c3cbd4;
        --error-bg: #46151b;
        --error-text: #ffb3ba;
        --info-bg: #132c47;
        --info-text: #a9d1fb;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
    max-width: 60rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

h1 {
    font-size: 1.75rem;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

h2 {
    font-size: 1.25rem;
    margin: 0;
}

.lede {
    color: var(--muted);
    margin: 0 0 1.5rem;
}

form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

label {
    display: block;
    font-weight: 600;
}

.hint {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0.125rem 0 0.5rem;
}

textarea, input[type="date"] {
    width: 100%;
    font: inherit;
    color: inherit;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.625rem;
}

textarea {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    resize: vertical;
    min-height: 7rem;
}

input[type="date"] {
    max-width: 14rem;
}

details {
    margin: 0.75rem 0 1rem;
}

summary {
    cursor: pointer;
    color: var(--accent);
    padding: 0.25rem 0;
}

details[open] summary {
    margin-bottom: 0.5rem;
}

button {
    font: inherit;
    font-weight: 600;
    color: var(--accent-text);
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    padding: 0.625rem 1.25rem;
    min-height: 2.75rem;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.1);
}

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

.notice {
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0 0;
}

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

.notice-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.results {
    margin-top: 1.5rem;
}

.as-of {
    color: var(--muted);
    margin: 0.125rem 0 0.75rem;
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.status {
    display: inline-block;
    border-radius: 999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-covered {
    background: var(--covered-bg);
    color: var(--covered-text);
}

.status-check-required {
    background: var(--check-bg);
    color: var(--check-text);
}

.status-not-covered {
    background: var(--not-covered-bg);
    color: var(--not-covered-text);
}

.status-unknown {
    background: var(--unknown-bg);
    color: var(--unknown-text);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    text-align: left;
    vertical-align: top;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

thead th {
    font-size: 0.875rem;
    color: var(--muted);
    background: var(--bg);
}

tbody tr:last-child > * {
    border-bottom: 0;
}

.code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    white-space: nowrap;
}

tbody th.code {
    font-weight: 600;
}

.entry-type {
    font-size: 0.8rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 0.3rem;
    margin-left: 0.25rem;
}

.entry-sector {
    display: block;
    font-weight: 600;
}

.none {
    color: var(--muted);
}

footer {
    margin-top: 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent);
}

footer .warning {
    color: var(--check-text);
    background: var(--check-bg);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

/* Phones: each result becomes a card, with the column names as labels */
@media (max-width: 40rem) {
    main {
        padding-top: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    button {
        width: 100%;
    }

    input[type="date"] {
        max-width: none;
    }

    table, tbody, tr, th, td {
        display: block;
    }

    table {
        background: none;
        border: 0;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    tbody tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 0.75rem;
        padding: 0.25rem 0;
    }

    tbody th, tbody td {
        border: 0;
        padding: 0.375rem 0.875rem;
    }

    tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    tbody th.code {
        font-size: 1.05rem;
        padding-top: 0.625rem;
    }
}
