:root {
    --color-bg: #ffffff;
    --color-bg-subtle: #f7f8f7;
    --color-bg-elevated: #ffffff;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-border-strong: #d1d5db;
    --color-text: #0f1a14;
    --color-text-muted: #5b6b62;
    --color-text-inverse: #ffffff;

    --color-brand: #43853d;
    --color-brand-hover: #356b30;
    --color-brand-soft: rgba(67, 133, 61, 0.12);
    --color-accent: #77b062;

    --color-success: #43853d;
    --color-success-soft: rgba(67, 133, 61, 0.12);
    --color-warning: #b45309;
    --color-warning-soft: rgba(180, 83, 9, 0.12);
    --color-danger: #b42318;
    --color-danger-soft: rgba(180, 35, 24, 0.10);
    --color-info: #1f6feb;
    --color-info-soft: rgba(31, 111, 235, 0.10);

    --color-nav-bg: #0d1117;
    --color-nav-text: #e6edf3;
    --color-nav-text-muted: #8b949e;
    --color-nav-border: #21262d;

    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.125rem;

    --shadow-sm: 0 1px 2px rgba(15, 26, 20, 0.04);
    --shadow-md: 0 1px 3px rgba(15, 26, 20, 0.06), 0 1px 2px rgba(15, 26, 20, 0.04);

    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", "Fira Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0d1117;
        --color-bg-subtle: #010409;
        --color-bg-elevated: #161b22;
        --color-surface: #161b22;
        --color-border: #21262d;
        --color-border-strong: #30363d;
        --color-text: #e6edf3;
        --color-text-muted: #8b949e;

        --color-brand: #77b062;
        --color-brand-hover: #90c47b;
        --color-brand-soft: rgba(119, 176, 98, 0.16);
        --color-accent: #77b062;

        --color-success: #77b062;
        --color-success-soft: rgba(119, 176, 98, 0.16);
        --color-warning: #d29922;
        --color-warning-soft: rgba(210, 153, 34, 0.16);
        --color-danger: #f85149;
        --color-danger-soft: rgba(248, 81, 73, 0.14);
        --color-info: #58a6ff;
        --color-info-soft: rgba(88, 166, 255, 0.14);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.5);
    }
}

html {
    font-size: 15px;
    background-color: var(--color-bg-subtle);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-subtle);
    color: var(--color-text);
    letter-spacing: -0.005em;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Field validation messages — Bootstrap's .text-danger is a red that only reads well on light bg. */
.text-danger,
.field-validation-error {
    color: var(--color-danger) !important;
}

main {
    flex: 1 0 auto;
}

code, kbd, pre, samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.02em;
    color: var(--color-text);
    font-weight: 600;
}

a {
    color: var(--color-brand);
    text-decoration: none;
    transition: color 120ms ease;
}

a:hover {
    color: var(--color-brand-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.text-muted {
    color: var(--color-text-muted) !important;
}

/* ---------- Navbar ---------- */

.app-nav {
    background-color: var(--color-nav-bg);
    border-bottom: 1px solid var(--color-nav-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: saturate(180%) blur(8px);
}

.app-nav .navbar-brand {
    color: var(--color-nav-text);
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.app-nav .navbar-brand:hover {
    color: var(--color-nav-text);
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-accent) 100%);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.app-nav .nav-link {
    color: var(--color-nav-text-muted);
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 120ms ease, background-color 120ms ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
    color: var(--color-nav-text);
    background-color: rgba(255, 255, 255, 0.04);
}

.app-nav .nav-link.active {
    color: var(--color-nav-text);
    background-color: rgba(255, 255, 255, 0.06);
}

/* Operations destination — reachable, but subordinate to the caseworker links. */
.app-nav .nav-link.is-secondary {
    color: var(--color-nav-text-muted);
    opacity: 0.6;
    font-size: 0.85rem;
    font-weight: 400;
}

.app-nav .nav-link.is-secondary:hover,
.app-nav .nav-link.is-secondary:focus {
    opacity: 1;
}

.app-nav .navbar-toggler {
    border-color: var(--color-nav-border);
    color: var(--color-nav-text-muted);
}

.app-nav .navbar-toggler-icon {
    filter: invert(1) opacity(0.75);
}

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

.page-header {
    margin: 2rem 0 1.5rem;
}

.page-header .page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-header .page-subtitle {
    color: var(--color-text-muted);
    margin: 0;
}

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

.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: 1.25rem 1.5rem;
}

.card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

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

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.meta-item .meta-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.meta-item .meta-value {
    font-size: 0.95rem;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.meta-item .meta-value.mono {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

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

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text);
    margin-bottom: 0.375rem;
}

.form-control {
    background-color: var(--color-bg-elevated);
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.form-control::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

.form-control:focus {
    background-color: var(--color-bg-elevated);
    color: var(--color-text);
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand-soft);
    outline: none;
}

.form-text {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

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

.btn {
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0.55rem 1.05rem;
    font-size: 0.925rem;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 60ms ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-brand-hover);
    border-color: var(--color-brand-hover);
    color: #fff;
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px var(--color-brand-soft);
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: var(--color-bg-subtle);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* ---------- Suggestions dropdown ---------- */

.suggestions {
    margin-top: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-elevated);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    max-height: 20rem;
    overflow-y: auto;
}

.suggestion-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    padding: 0.7rem 0.95rem;
    color: var(--color-text);
    font-size: 0.925rem;
    cursor: pointer;
    transition: background-color 80ms ease;
}

.suggestion-item:last-child {
    border-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item:focus {
    background-color: var(--color-brand-soft);
    color: var(--color-text);
    outline: none;
}

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

.table {
    color: var(--color-text);
    margin-bottom: 0;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: var(--color-bg-subtle);
    --bs-table-hover-bg: var(--color-brand-soft);
    --bs-table-border-color: var(--color-border);
}

.table > :not(caption) > * > * {
    background-color: transparent;
}

.table-wrapper {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    background-color: var(--color-bg-subtle);
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    font-size: 0.925rem;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

/* ---------- Status pills ---------- */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background-color: var(--color-bg-subtle);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    white-space: nowrap;
}

.status-pill::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background-color: currentColor;
}

.status-pill.is-success {
    background-color: var(--color-success-soft);
    color: var(--color-success);
    border-color: transparent;
}

.status-pill.is-warning {
    background-color: var(--color-warning-soft);
    color: var(--color-warning);
    border-color: transparent;
}

.status-pill.is-danger {
    background-color: var(--color-danger-soft);
    color: var(--color-danger);
    border-color: transparent;
}

.status-pill.is-info {
    background-color: var(--color-info-soft);
    color: var(--color-info);
    border-color: transparent;
}

.status-pill.is-pending::before {
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.job-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-info, #3b82f6);
    animation: job-spinner-rotate 0.9s linear infinite;
    vertical-align: middle;
}

.job-spinner[hidden] {
    display: none;
}

@keyframes job-spinner-rotate {
    to { transform: rotate(360deg); }
}

/* ---------- File list ---------- */

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.125rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.file-row .file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.file-row .file-name {
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.alert {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 0.875rem 1.125rem;
    font-size: 0.925rem;
}

.alert-danger {
    background-color: var(--color-danger-soft);
    color: var(--color-danger);
    border-color: transparent;
}

/* ---------- Footer ---------- */

.app-footer {
    border-top: 1px solid var(--color-border);
    background-color: var(--color-bg);
    color: var(--color-text-muted);
    padding: 1.25rem 0;
    font-size: 0.85rem;
}

.app-footer a {
    color: var(--color-text-muted);
}

.app-footer a:hover {
    color: var(--color-text);
}

/* ---------- Section headings ---------- */

.section-heading {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 1.75rem 0 0.75rem;
}

.section-heading + .section-intro {
    margin-top: -0.4rem;
}

.section-intro {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    max-width: 60ch;
    margin-bottom: 0.85rem;
}

.section-disclaimer {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin: 0.75rem 0 0;
    max-width: 68ch;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.75rem 0 0.9rem;
}

.section-link {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.section-link:hover {
    color: var(--color-brand);
}

.empty-state .card-body {
    padding: 2.25rem 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
}

.form-card {
    max-width: 34rem;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

/* ---------- Case list (work queue) ---------- */

.case-table .case-address {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.case-table .case-address:hover {
    color: var(--color-brand);
    text-decoration: none;
}

.case-table .case-address-sub {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.case-table .case-address-bfe {
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.case-table .case-number {
    font-size: 0.8125rem;
    white-space: nowrap;
}

.case-table .case-open {
    text-align: right;
    white-space: nowrap;
}

/* Whole-row click target. Focus styling stays on the links inside, which remain the
   keyboard path — the row is not itself focusable. */
.case-row[data-case-href] {
    cursor: pointer;
}

@media (hover: hover) {
    .case-row[data-case-href]:hover {
        background-color: var(--color-brand-soft);
    }
}

.case-row[data-case-href]:focus-within {
    background-color: var(--color-brand-soft);
}

/* Below tablet the table becomes a stack of case cards: the address, status and
   action must stay obvious without horizontal scrolling. */
@media (max-width: 767.98px) {
    .table-wrapper:has(.case-table) {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .case-table,
    .case-table tbody,
    .case-table tr,
    .case-table td {
        display: block;
        width: 100%;
    }

    .case-table thead {
        display: none;
    }

    .case-table tbody tr {
        background-color: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        padding: 0.9rem 1.1rem;
        margin-bottom: 0.75rem;
    }

    .case-table tbody td {
        border-bottom: 0;
        padding: 0.2rem 0;
    }

    .case-table tbody td[data-label]:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--color-text-muted);
        margin-bottom: 0.1rem;
    }

    .case-table tbody td[data-label="Ejendom"] {
        padding-bottom: 0.55rem;
    }

    .case-table .case-open {
        text-align: left;
        padding-top: 0.75rem;
    }
}

/* ---------- Case details ---------- */

.case-identity {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0 1.25rem;
}

.case-address-title {
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
}

.case-address-postal {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
}

.case-identity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin-top: 0.9rem;
    font-size: 0.85rem;
    color: var(--color-text);
}

.case-identity-meta .meta-key {
    color: var(--color-text-muted);
    margin-right: 0.15rem;
}

.case-summary {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.4rem;
}

/* Completeness headline. The tone class only colours the leading dot, so the
   sentence itself stays readable rather than shouting. */
.case-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 1.05rem;
    font-weight: 500;
}

.case-status::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background-color: var(--color-text-muted);
    flex: none;
}

.case-status.is-success::before { background-color: var(--color-success); }
.case-status.is-warning::before { background-color: var(--color-warning); }
.case-status.is-danger::before  { background-color: var(--color-danger); }
.case-status.is-info::before    { background-color: var(--color-info); }
.case-status.is-pending::before { animation: pulse 1.4s ease-in-out infinite; }

.case-summary-missing {
    margin: 0.4rem 0 0 1.15rem;
    font-size: 0.9rem;
    color: var(--color-warning);
}

.case-summary-missing a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.case-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

/* Property findings and data gaps are different kinds of information and never
   share a colour with each other or with the case status. */
.case-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-subtle);
    color: var(--color-text);
}

.case-chip:hover {
    text-decoration: none;
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.case-chip::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background-color: currentColor;
}

.case-chip.is-attention {
    color: var(--color-info);
    background-color: var(--color-info-soft);
    border-color: transparent;
}

.case-chip.is-missing {
    color: var(--color-warning);
    background-color: var(--color-warning-soft);
    border-color: transparent;
}

.case-summary-note {
    margin: 0.85rem 0 0 1.15rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.case-section {
    margin-top: 1.5rem;
    scroll-margin-top: 5rem;
}

/* Compact, neutral BBR overview. It deliberately shares the page surface rather than introducing
   another card, and has no warning or attention colour treatment. */
.bbr-fact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 2rem;
    margin: 0;
}

.bbr-fact {
    min-width: 0;
}

.bbr-fact dt {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.bbr-fact dd {
    margin: 0.15rem 0 0;
    font-size: 0.95rem;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.bbr-summary-note {
    margin: 0.9rem 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

@media (max-width: 640px) {
    .bbr-fact-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
}

/* ---------- Spildevand ----------
   Deliberately the plainest block on the page. Planned separatkloakering is material to a buyer, but
   this batch states it as a fact and nothing more: no warning colour, no attention treatment, and no
   visual difference between "planlagt separatkloakering" and "ingen separatkloakering planlagt". The
   only typographic distinction is between a fact and the source that published it, because that is the
   distinction the block exists to preserve. */

.sewer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sewer-line {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

/* Muted, so a line reads as its fact first and its attribution second - while still being on the
   same line, because an attribution that can be scrolled away from its fact is not an attribution. */
.sewer-source {
    color: var(--color-text-muted);
}

.sewer-group + .sewer-group {
    margin-top: 0.8rem;
}

.sewer-group-source {
    margin: 0 0 0.15rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.sewer-note {
    margin: 0.9rem 0 0;
    font-size: 0.9rem;
    color: var(--color-text);
}

.sewer-retrieved {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ---------- Bevaringsværdi (SAVE) ----------
   Neutral on purpose. A preservation value is a fact about the property, and whether one warrants a
   caseworker's attention is a municipal judgement this section does not make - so no warning colour,
   no attention treatment, and no visual difference between a high value and a low one. */

.save-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.save-row {
    display: grid;
    grid-template-columns: minmax(6.5rem, max-content) 1fr;
    gap: 0.15rem 1rem;
    align-items: baseline;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--color-border);
}

.save-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.save-building {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.save-value {
    font-size: 0.95rem;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

/* Second row of the grid, under the value rather than beside the label. */
.save-detail {
    grid-column: 2;
    font-size: 0.85rem;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.save-registration {
    grid-column: 2;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

.save-band-note,
.save-source {
    margin: 0.9rem 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.save-source + .save-source {
    margin-top: 0.3rem;
}

@media (min-width: 760px) {
    .save-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(var(--save-column-rows), auto);
        grid-auto-flow: column;
        gap: 0.55rem 2rem;
        align-items: start;
    }

    .save-row {
        align-self: start;
    }
}

@media (max-width: 640px) {
    .save-row {
        grid-template-columns: 1fr;
    }

    .save-detail,
    .save-registration {
        grid-column: 1;
    }
}

/* ---------- Attention points ---------- */

.finding-list,
.issue-list,
.meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.finding-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-info);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.1rem;
    box-shadow: var(--shadow-sm);
}

.finding-title {
    font-weight: 600;
    font-size: 0.975rem;
}

.finding-detail {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
}

.finding-description {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.25rem;
    max-width: 72ch;
}

.finding-toggle {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-brand);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.finding-toggle:hover {
    color: var(--color-brand-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.finding-card.is-expanded .finding-description {
    display: block;
}

.finding-card.is-expanded .finding-detail {
    display: block;
    overflow: visible;
}

.finding-card.is-expanded .finding-toggle {
    margin-top: 0.25rem;
}

.finding-source {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 0.4rem;
}

.issue-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.1rem;
    box-shadow: var(--shadow-sm);
}

.issue-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.issue-detail {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-top: 0.15rem;
}

.meta-list {
    gap: 0.15rem;
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

/* ---------- Document cards ---------- */

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    gap: 0.75rem;
}

.doc-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.doc-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.doc-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

.doc-card-note {
    font-size: 0.85rem;
    color: var(--color-warning);
    margin: 0;
}

/* Informational, not a warning: the document was collected, one optional artifact was not.
   Muted on purpose so it does not read as the amber "missing" state above. */
.doc-card-info {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

.doc-card-warning {
    font-size: 0.8125rem;
    color: var(--color-warning);
    margin: 0;
}

.doc-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.3rem;
}

/* Normal state is quiet, exceptions attract attention: a ready document gets a plain
   label with a small green dot, a missing one keeps the amber fill and a visible edge. */
.doc-card .status-pill.is-success {
    background-color: transparent;
    border-color: transparent;
    color: var(--color-text-muted);
    font-weight: 500;
}

.doc-card .status-pill.is-success::before {
    background-color: var(--color-success);
}

.doc-card .status-pill.is-warning {
    border-color: var(--color-warning);
    font-weight: 700;
}

.source-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-subtle);
    color: var(--color-text-muted);
}

.source-tag.is-official {
    color: var(--color-success);
    background-color: var(--color-success-soft);
    border-color: transparent;
}

.source-tag.is-public {
    color: var(--color-info);
    background-color: var(--color-info-soft);
    border-color: transparent;
}

.source-tag.is-indicative {
    color: var(--color-warning);
    background-color: var(--color-warning-soft);
    border-color: transparent;
}

/* ---------- Case footer ---------- */

.case-footer {
    margin: 2.5rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.btn-quiet-danger {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.btn-quiet-danger:hover {
    color: var(--color-danger);
}

/* ---------- Dashboard ---------- */

.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 992px) {
    .dash-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .dash-kpi-row {
        grid-template-columns: 1fr;
    }
}

.dash-kpi {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.dash-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.dash-kpi-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.1;
}

.dash-kpi-spark {
    min-height: 40px;
    margin-top: 0.25rem;
}

.dash-kpi-delta {
    font-size: 0.8rem;
    line-height: 1;
    min-height: 1em;
}

.range-btn.active {
    background-color: var(--color-brand-soft);
    color: var(--color-brand);
    border-color: var(--color-brand);
}

.dash-provider-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    align-items: start;
}

@media (max-width: 768px) {
    .dash-provider-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dash-provider-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.dash-provider-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text);
    margin-top: -0.5rem;
}

.dash-activity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 320px;
    overflow-y: auto;
}

.dash-activity-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--color-text);
    text-decoration: none;
    transition: background-color 80ms ease;
}

.dash-activity-row:hover {
    background-color: var(--color-brand-soft);
    color: var(--color-text);
    text-decoration: none;
}

.dash-activity-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.dash-activity-addr {
    font-size: 0.9rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-activity-time {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.dash-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background-color: var(--color-border-strong);
    display: inline-block;
}

.dash-dot.is-succeeded { background-color: var(--color-success); }
.dash-dot.is-failed    { background-color: var(--color-danger); }
.dash-dot.is-skipped   { background-color: var(--color-text-muted); opacity: 0.5; }
.dash-dot.is-pending   {
    background-color: var(--color-info);
    animation: pulse 1.4s ease-in-out infinite;
}
