:root {
    --navy: #0f2742;
    --navy-dark: #071727;
    --blue: #1d4f82;
    --white: #ffffff;
    --off-white: #f6f8fb;
    --border: #d8e0ea;
    --text: #1f2933;
    --muted: #5c6b7a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--off-white);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    background: var(--navy);
    color: var(--white);
    border-bottom: 4px solid var(--blue);
}

.header-inner {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 0;
}

.brand {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 22px;
    font-size: 0.95rem;
}

.site-nav a {
    color: rgba(255, 255, 255, 0.88);
}

.site-nav a:hover,
.site-nav a:focus {
    color: var(--white);
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 64px 0;
}

.hero {
    min-height: 440px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--white) 0%, #eef4fa 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 56px;
    box-shadow: 0 20px 50px rgba(15, 39, 66, 0.08);
}

.hero-content {
    max-width: 720px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 18px;
    color: var(--navy-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.1;
}

.lede {
    max-width: 620px;
    margin: 0 0 32px;
    color: var(--muted);
    font-size: 1.15rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 210px;
    min-height: 56px;
    border-radius: 6px;
    padding: 14px 24px;
    font-weight: 700;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.button-primary {
    background: var(--navy);
    color: var(--white);
    border: 1px solid var(--navy);
}

.button-primary:hover,
.button-primary:focus {
    background: var(--navy-dark);
    border-color: var(--navy-dark);
}

.button-secondary {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--navy);
}

.button-secondary:hover,
.button-secondary:focus {
    background: #e8f0f8;
}

.content-panel {
    max-width: 760px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 14px 36px rgba(15, 39, 66, 0.07);
}

.content-panel p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.intake-panel {
    max-width: 880px;
}

.form-intro {
    max-width: 640px;
    margin: 0 0 28px;
    color: var(--muted);
}

.form-error {
    margin-bottom: 24px;
    border: 1px solid #d35b5b;
    border-radius: 6px;
    background: #fff2f2;
    color: #9f2424;
    padding: 14px 16px;
    font-weight: 700;
}

.flash-stack {
    display: grid;
    gap: 12px;
}

.flash-message {
    border-radius: 6px;
    padding: 14px 16px;
    font-weight: 700;
}

.flash-success {
    border: 1px solid #5ca77a;
    background: #eefaf3;
    color: #1f6f43;
}

.flash-error {
    border: 1px solid #d35b5b;
    background: #fff2f2;
    color: #9f2424;
}

.flash-warning {
    border: 1px solid #d7b34e;
    background: #fff8e6;
    color: #7b5d00;
}

.intake-form {
    display: grid;
    gap: 22px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    color: var(--navy-dark);
    font-weight: 700;
}

.form-field input,
.form-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--text);
    font: inherit;
    padding: 12px 14px;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(29, 79, 130, 0.16);
}

.form-field input[type="file"] {
    padding: 10px;
}

.field-help {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.form-submit {
    justify-self: start;
    border: 0;
    cursor: pointer;
}

.thank-you-actions {
    margin-top: 28px;
}

.login-panel {
    max-width: 560px;
}

.upload-form-panel {
    max-width: 700px;
}

.login-help {
    margin: 22px 0 0;
    color: var(--muted);
}

.login-help a {
    color: var(--blue);
    font-weight: 700;
}

.login-help a:hover,
.login-help a:focus {
    color: var(--navy);
}

.dashboard-shell {
    display: grid;
    gap: 28px;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.dashboard-header h1 {
    margin-bottom: 0;
}

.sign-out-link {
    color: var(--blue);
    font-weight: 700;
    padding-top: 10px;
}

.sign-out-link:hover,
.sign-out-link:focus {
    color: var(--navy);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 24px;
    align-items: start;
}

.dashboard-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 14px 36px rgba(15, 39, 66, 0.07);
}

.dashboard-panel h2 {
    margin: 0 0 22px;
    color: var(--navy-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    line-height: 1.2;
}

.checklist-list,
.updates-list {
    display: grid;
    gap: 16px;
}

.checklist-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

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

.status-marker {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #b5c0cc;
    border-radius: 50%;
    color: #7b8794;
    font-weight: 700;
    line-height: 1;
}

.status-complete {
    border-color: #1f8a52;
    background: #eaf7f0;
    color: #1f8a52;
}

.checklist-content h3,
.update-card h3 {
    margin: 0;
    color: var(--navy-dark);
    font-size: 1rem;
    line-height: 1.3;
}

.checklist-title-row,
.update-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.checklist-content p,
.update-card p,
.upload-panel p,
.empty-state {
    margin: 8px 0 0;
    color: var(--muted);
}

.meta-text {
    font-size: 0.9rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.badge-required {
    background: #e8f0f8;
    color: var(--blue);
}

.badge-action {
    background: #fff2f2;
    color: #9f2424;
}

.update-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
}

.upload-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.upload-panel h2 {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.cancel-link {
    color: var(--blue);
    font-weight: 700;
}

.cancel-link:hover,
.cancel-link:focus {
    color: var(--navy);
}

.admin-shell {
    display: grid;
    gap: 28px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.admin-stat-card {
    display: grid;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 14px 36px rgba(15, 39, 66, 0.07);
}

.admin-stat-card span {
    color: var(--navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.admin-stat-card strong {
    color: var(--muted);
}

.admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.admin-section-header h2 {
    margin-bottom: 0;
}

.case-status-header {
    align-items: flex-end;
}

.case-status-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.admin-search-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-search-field {
    min-width: 260px;
}

.pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.admin-text-link,
.clickable-row a {
    color: var(--blue);
    font-weight: 700;
}

.admin-list {
    display: grid;
    gap: 14px;
}

.admin-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.admin-list-item h3 {
    margin: 0;
    color: var(--navy-dark);
    font-size: 1rem;
}

.admin-list-item p,
.admin-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.admin-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-action-stack {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.document-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.document-links a {
    color: var(--blue);
    font-size: 0.9rem;
    font-weight: 700;
}

.document-links a:hover,
.document-links a:focus {
    color: var(--navy);
}

.admin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    min-height: 38px;
    padding: 8px 12px;
    text-decoration: none;
}

.admin-button-primary {
    background: var(--navy);
    color: var(--white);
}

.admin-button-muted {
    background: var(--white);
    border-color: var(--border);
    color: var(--navy);
}

.admin-table-panel {
    max-width: none;
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 14px 12px;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--navy-dark);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.status-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-pending {
    background: #fff7df;
    color: #856000;
}

.status-approved {
    background: #eefaf3;
    color: #1f6f43;
}

.status-dismissed {
    background: #eef1f5;
    color: #596575;
}

.status-active {
    background: #eaf7f0;
    color: #1f8a52;
}

.status-closed {
    background: #eef1f5;
    color: #596575;
}

.status-discharged {
    background: #e8f0fb;
    color: #1d4ed8;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

.admin-form {
    display: grid;
    gap: 16px;
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 24px;
}

.admin-form h3 {
    margin: 0;
    color: var(--navy-dark);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--navy-dark);
    font-weight: 700;
}

@media (max-width: 720px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-nav {
        justify-content: flex-start;
    }

    .page-shell {
        padding: 36px 0;
    }

    .hero,
    .content-panel {
        padding: 28px;
    }

    .button {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-submit {
        justify-self: stretch;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-header,
    .upload-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .sign-out-link {
        padding-top: 0;
    }

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

    .dashboard-panel {
        padding: 22px;
    }

    .checklist-title-row,
    .update-card-header {
        flex-direction: column;
    }

    .admin-stats,
    .admin-detail-grid {
        grid-template-columns: 1fr;
    }

    .admin-section-header,
    .admin-list-item {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-action-stack {
        justify-items: stretch;
    }

    .admin-button {
        width: 100%;
    }
}

/* ── Completion percentage colors ────────────────────────── */
.completion-cell {
    text-align: center;
}
.completion-pct {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
}
.pct-green {
    background: #d4edda;
    color: #155724;
}
.pct-yellow {
    background: #fff3cd;
    color: #856404;
}
.pct-red {
    background: #f8d7da;
    color: #721c24;
}

/* ── Document status cells ──────────────────────────────── */
.doc-cell {
    text-align: center;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ── Stats row (reuse from case-status-stats) ───────────── */
.case-status-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
