:root {
    --archive-ink: #183344;
    --archive-muted: #637a87;
    --archive-primary: #1679b4;
    --archive-primary-dark: #0f608f;
    --archive-primary-soft: #e7f2f8;
    --archive-border: #dce8ee;
    --archive-surface: #f2f7fa;
    --bs-success: #1679b4;
    --bs-success-rgb: 22, 121, 180;
}

.archive-page {
    background: #f4f8fb;
    color: var(--archive-ink);
    font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
}

.archive-navbar {
    background: #fff;
    border-bottom: 1px solid var(--archive-border);
    box-shadow: 0 4px 18px rgba(24, 65, 91, 0.045);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.archive-navbar .container {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 72px;
}

.archive-brand {
    align-items: center;
    color: var(--archive-ink);
    display: inline-flex;
    font-weight: 750;
    gap: 0.7rem;
    text-decoration: none;
    transition: color 160ms ease;
}

.archive-brand:hover {
    color: var(--archive-primary);
}

.archive-brand-mark {
    align-items: center;
    background: var(--archive-primary-soft);
    border-radius: 10px;
    color: var(--archive-primary);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.archive-nav-actions {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.archive-nav-link {
    border-radius: 8px;
    color: var(--archive-muted);
    font-size: 0.92rem;
    font-weight: 650;
    padding: 0.5rem 0.65rem;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.archive-nav-link:hover {
    background: var(--archive-primary-soft);
    color: var(--archive-primary-dark);
}

.archive-user {
    border-left: 1px solid var(--archive-border);
    color: var(--archive-muted);
    font-size: 0.88rem;
    padding-left: 1rem;
}

.archive-shell {
    max-width: 1180px;
}

.report-shell {
    max-width: 1000px;
}

.archive-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.dashboard-hero {
    background: linear-gradient(120deg, #fff 0%, #edf6fb 100%);
    border: 1px solid var(--archive-border);
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(24, 65, 91, 0.07);
    padding: clamp(1.25rem, 3vw, 2rem);
}

.dashboard-heading {
    align-items: center;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
}

.dashboard-stats {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1.6rem;
}

.dashboard-stat {
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(210, 228, 238, 0.9);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    min-width: 0;
    padding: 0.8rem 1rem;
}

.dashboard-stat-label {
    color: var(--archive-muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.dashboard-stat-value {
    color: var(--archive-ink);
    font-size: 1.3rem;
    font-weight: 750;
    line-height: 1;
}

.archive-eyebrow {
    color: var(--archive-primary);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.archive-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.035em;
    margin: 0;
}

.archive-subtitle {
    color: var(--archive-muted);
    margin: 0.45rem 0 0;
}

.archive-card {
    background: #fff;
    border: 1px solid var(--archive-border);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(24, 65, 91, 0.07);
    overflow: hidden;
}

.bay-card {
    border: 1px solid var(--archive-border);
    border-top: 4px solid #9aadb8;
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(24, 65, 91, 0.055);
    overflow: hidden;
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.bay-card--green {
    border-top-color: #198754;
}

.bay-card--orange {
    border-top-color: #f08c00;
}

.bay-card--red {
    border-top-color: #dc3545;
}

.bay-card--free {
    border-top-color: #a7b9c3;
}

.bay-severity {
    align-items: center;
    color: var(--archive-ink);
    display: flex;
    gap: 0.45rem;
}

.severity-indicator {
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 0.8rem;
    height: 0.8rem;
    width: 0.8rem;
}

.severity-indicator--green {
    background-color: #198754;
}

.severity-indicator--orange {
    background-color: #f08c00;
}

.severity-indicator--red {
    background-color: #dc3545;
}

.severity-indicator--neutral {
    background-color: #84929a;
}

.severity-classification {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem;
}

.severity-classification--green {
    background: #eaf5ee;
    color: #17653b;
}

.severity-classification--orange {
    background: #fff3e0;
    color: #8a4b00;
}

.severity-classification--red {
    background: #fdebed;
    color: #a5212d;
}

.severity-classification--neutral {
    background: #eef1f3;
    color: #58656c;
}

.severity-panel {
    border-left: 4px solid #84929a;
}

.severity-panel--green {
    border-left-color: #198754;
}

.severity-panel--orange {
    border-left-color: #f08c00;
}

.severity-panel--red {
    border-left-color: #dc3545;
}

.severity-fieldset {
    border: 0;
    min-width: 0;
    padding: 0;
}

.severity-options {
    display: grid;
    gap: 0.55rem;
}

.severity-option {
    align-items: center;
    background: #fff;
    border: 1px solid var(--archive-border);
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    gap: 0.65rem;
    padding: 0.7rem;
}

.severity-option:hover {
    background: #f7fbfd;
    border-color: #9fc8dd;
}

.severity-option .form-check-input {
    flex: 0 0 auto;
    margin: 0;
}

.severity-option-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.severity-option-label small {
    color: var(--archive-muted);
}

.bay-card-header {
    background: #fff;
    border: 0;
    padding: 1rem 1rem 0.25rem;
}

.bay-card-header h2 {
    color: var(--archive-ink);
    font-size: 1.02rem;
    font-weight: 750;
}

.bay-card .card-body {
    padding: 0.85rem 1rem 0.5rem;
}

.bay-patient {
    color: var(--archive-ink);
    font-size: 1.1rem;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.bay-guardian {
    color: var(--archive-muted);
    font-size: 0.9rem;
}

.bay-observations {
    background: var(--archive-surface);
    border-radius: 9px;
    color: var(--archive-muted);
    font-size: 0.84rem;
    line-height: 1.5;
    padding: 0.7rem 0.8rem;
    white-space: pre-wrap;
}

.bay-observations strong {
    color: var(--archive-ink);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bay-empty {
    align-items: center;
    color: var(--archive-muted);
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    gap: 0.65rem;
    justify-content: center;
    min-height: 130px;
    text-align: center;
}

.bay-empty-mark {
    align-items: center;
    background: var(--archive-primary-soft);
    border-radius: 50%;
    color: var(--archive-primary);
    display: inline-flex;
    font-size: 1.35rem;
    font-weight: 500;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.bay-card-footer {
    background: #fff;
    border: 0;
    padding: 0.75rem 1rem 1rem;
}

.archive-table {
    margin: 0;
    vertical-align: middle;
}

.archive-table thead th {
    background: var(--archive-surface);
    border-bottom: 1px solid var(--archive-border);
    color: var(--archive-muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    padding: 0.9rem 1rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.archive-table tbody td {
    padding: 1rem;
}

.archive-patient {
    font-weight: 700;
}

.archive-meta {
    color: var(--archive-muted);
    font-size: 0.85rem;
}

.archive-btn {
    border-radius: 8px;
    font-weight: 650;
    transition: box-shadow 160ms ease, transform 160ms ease;
}

.auth-layout {
    min-height: calc(100vh - 72px);
    padding-bottom: 3rem;
    padding-top: 3rem;
}

.auth-layout > .row {
    align-items: center;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.auth-layout > .row > [class*="col-"] {
    width: 100%;
}

.auth-card {
    background: #fff;
    border: 1px solid var(--archive-border);
    border-radius: 22px;
    box-shadow: 0 22px 60px rgba(24, 65, 91, 0.1);
    overflow: hidden;
}

.auth-card--login {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    margin: 0 auto;
    max-width: 920px;
    min-height: 540px;
}

.auth-panel {
    background: linear-gradient(145deg, #155a7e 0%, #1679b4 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 540px;
    overflow: hidden;
    padding: clamp(2rem, 4vw, 3.5rem);
    position: relative;
    isolation: isolate;
}

.auth-panel::before {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    content: "";
    height: 300px;
    position: absolute;
    right: -145px;
    top: -145px;
    width: 300px;
    z-index: -1;
}

.auth-panel .auth-mark {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.55rem;
    height: 60px;
    width: 60px;
}

.auth-panel-eyebrow {
    color: #c4e3f2;
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    margin-bottom: 0.8rem;
}

.auth-panel h1 {
    color: #fff;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.06em;
    margin-bottom: 1rem;
}

.auth-panel-copy {
    color: rgba(255, 255, 255, 0.83);
    font-size: 1.02rem;
    line-height: 1.7;
    max-width: 19rem;
}

.auth-panel-foot {
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    padding-top: 1rem;
}

.auth-form-panel {
    align-self: center;
    padding: clamp(2rem, 5vw, 4rem);
    width: 100%;
}

.auth-form-panel .archive-title {
    font-size: clamp(1.6rem, 2.5vw, 2rem);
}

.auth-form-panel .form-control {
    min-height: 52px;
}

.auth-form-panel .btn-lg {
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    min-height: 52px;
}

.auth-form-foot {
    color: var(--archive-muted);
    font-size: 0.8rem;
    line-height: 1.55;
    margin-top: 1.4rem;
}

.auth-mark {
    align-items: center;
    background: var(--archive-primary-soft);
    border: 1px solid #d5eaf4;
    border-radius: 14px;
    color: var(--archive-primary);
    display: inline-flex;
    font-size: 1.35rem;
    height: 52px;
    justify-content: center;
    width: 52px;
}

.report-banner {
    align-items: center;
    background: linear-gradient(120deg, #155a7e, #1679b4);
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 1.6rem 1.8rem;
}

.report-banner .archive-eyebrow {
    color: #c4e3f2;
}

.report-banner .archive-title {
    font-size: clamp(1.4rem, 3vw, 1.85rem);
}

.report-status {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 650;
    padding: 0.5rem 0.8rem;
    white-space: nowrap;
}

.report-content {
    padding: 1.75rem;
}

.patient-summary {
    border: 1px solid var(--archive-border);
    border-radius: 10px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1.8rem;
    overflow: hidden;
}

.summary-item {
    background: var(--archive-surface);
    border-right: 1px solid var(--archive-border);
    padding: 0.9rem 1rem;
}

.summary-item:last-child {
    border-right: 0;
}

.summary-label {
    color: var(--archive-muted);
    display: block;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
}

.summary-value {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.report-section {
    margin-top: 1.7rem;
}

.report-section-title {
    align-items: center;
    border-bottom: 1px solid var(--archive-border);
    display: flex;
    font-size: 1rem;
    font-weight: 750;
    gap: 0.65rem;
    margin: 0 0 1rem;
    padding-bottom: 0.7rem;
}

.section-number {
    align-items: center;
    background: var(--archive-primary-soft);
    border-radius: 7px;
    color: var(--archive-primary);
    display: inline-flex;
    font-size: 0.72rem;
    height: 28px;
    justify-content: center;
    width: 32px;
}

.admission-notes,
.report-empty {
    background: var(--archive-surface);
    border-radius: 8px;
    color: var(--archive-muted);
    line-height: 1.6;
    padding: 0.9rem 1rem;
    white-space: pre-wrap;
}

.admission-notes {
    border-left: 3px solid var(--archive-primary);
    color: var(--archive-ink);
}

.evolution-entry,
.medication-entry {
    border: 1px solid var(--archive-border);
    border-radius: 10px;
    margin-bottom: 0.8rem;
    padding: 1rem;
}

.evolution-date {
    color: var(--archive-primary);
    font-size: 0.86rem;
    font-weight: 750;
    margin-bottom: 0.75rem;
}

.clinical-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.metric-chip {
    background: var(--archive-surface);
    border-radius: 7px;
    font-size: 0.84rem;
    padding: 0.5rem 0.65rem;
}

.metric-chip strong {
    color: var(--archive-muted);
    font-size: 0.72rem;
    font-weight: 700;
    margin-right: 0.2rem;
    text-transform: uppercase;
}

.clinical-notes {
    border-top: 1px solid var(--archive-border);
    line-height: 1.6;
    margin: 0.8rem 0 0;
    padding-top: 0.75rem;
    white-space: pre-wrap;
}

.medication-title {
    font-weight: 750;
}

.application-list {
    color: var(--archive-muted);
    font-size: 0.86rem;
    margin: 0.6rem 0 0;
    padding-left: 1.2rem;
}

.application-actor {
    align-items: center;
    background: var(--archive-surface);
    border: 1px solid var(--archive-border);
    border-radius: 8px;
    color: var(--archive-muted);
    display: flex;
    font-size: 0.8rem;
    gap: 0.4rem;
    justify-content: space-between;
    min-height: 34px;
    padding: 0.35rem 0.65rem;
}

.application-actor strong {
    color: var(--archive-ink);
    overflow-wrap: anywhere;
}

.report-actions {
    border-top: 1px solid var(--archive-border);
    margin-top: 1.8rem;
    padding-top: 1.25rem;
}

.signature {
    margin: 3rem auto 0;
    max-width: 360px;
    padding-top: 0.8rem;
    text-align: center;
}

.signature-line {
    border-top: 1px solid #9aaba8;
    margin-bottom: 0.65rem;
}

.btn-primary,
.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--archive-primary);
    --bs-btn-border-color: var(--archive-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--archive-primary-dark);
    --bs-btn-hover-border-color: var(--archive-primary-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--archive-primary-dark);
    --bs-btn-active-border-color: var(--archive-primary-dark);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--archive-primary);
    --bs-btn-disabled-border-color: var(--archive-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--archive-primary);
    --bs-btn-border-color: var(--archive-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--archive-primary);
    --bs-btn-hover-border-color: var(--archive-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--archive-primary-dark);
    --bs-btn-active-border-color: var(--archive-primary-dark);
}

.form-control,
.form-select {
    border-color: #d4e0e7;
    border-radius: 9px;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: #75b4d5;
    box-shadow: 0 0 0 0.22rem rgba(22, 121, 180, 0.14);
}

.modal-content {
    border: 1px solid var(--archive-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 49, 69, 0.18);
    overflow: hidden;
}

.modal-header,
.modal-footer {
    background: #f9fbfc;
    border-color: var(--archive-border);
}

.alert-success {
    background-color: var(--archive-primary-soft);
    border-color: var(--archive-border);
    color: var(--archive-primary-dark);
}

.text-bg-success {
    background-color: var(--archive-primary) !important;
}

.border-success {
    border-color: var(--archive-primary) !important;
}

.report-actions .btn {
    border-radius: 8px;
    font-weight: 650;
}

@media (max-width: 767.98px) {
    .archive-heading,
    .report-banner,
    .dashboard-heading {
        align-items: start;
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-heading form,
    .dashboard-heading .btn {
        width: 100%;
    }

    .dashboard-stats {
        gap: 0.55rem;
    }

    .dashboard-stat {
        align-items: start;
        flex-direction: column-reverse;
        gap: 0.4rem;
        padding: 0.7rem;
    }

    .dashboard-stat-label {
        font-size: 0.73rem;
    }

    .patient-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-item:nth-child(2) {
        border-right: 0;
    }

    .summary-item:nth-child(-n + 2) {
        border-bottom: 1px solid var(--archive-border);
    }

    .report-content {
        padding: 1rem;
    }

    .auth-panel {
        padding: 2rem;
    }

    .auth-form-panel {
        padding: 2rem;
    }

    .auth-card--login {
        display: block;
        min-height: 0;
    }

    .auth-panel {
        gap: 1.25rem;
        min-height: 0;
    }

    .auth-panel-foot {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .archive-navbar .container {
        min-height: 64px;
    }

    .archive-nav-actions {
        gap: 0.25rem;
    }

    .archive-nav-link {
        font-size: 0.82rem;
        padding: 0.45rem;
    }

    .archive-user {
        display: none;
    }

    .archive-brand {
        font-size: 0.9rem;
        gap: 0.45rem;
    }

    .archive-brand-mark {
        height: 34px;
        width: 34px;
    }

    .auth-layout {
        min-height: calc(100vh - 64px);
        padding: 1.5rem 12px 2rem;
    }

    .auth-layout > .row {
        min-height: 0;
    }

    .auth-card--login {
        display: block;
        min-height: 0;
    }

    .auth-panel {
        gap: 1.25rem;
        min-height: 0;
        padding: 1.5rem;
    }

    .auth-panel .auth-mark {
        height: 48px;
        margin-bottom: 1rem !important;
        width: 48px;
    }

    .auth-panel h1 {
        font-size: 2rem;
    }

    .auth-panel-copy {
        font-size: 0.92rem;
        margin-bottom: 0;
    }

    .auth-panel-foot {
        display: none;
    }

    .auth-form-panel {
        padding: 1.75rem 1.5rem 2rem;
    }
}

@media (hover: hover) {
    .bay-card:hover {
        box-shadow: 0 14px 30px rgba(24, 65, 91, 0.11);
        transform: translateY(-3px);
    }

    .archive-btn:hover {
        transform: translateY(-1px);
    }
}

@media print {
    @page {
        margin: 14mm;
    }

    .archive-page {
        background: #fff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .no-print {
        display: none !important;
    }

    .archive-shell {
        margin: 0 !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .archive-card {
        border: 0;
        box-shadow: none;
    }

    .report-section,
    .evolution-entry,
    .medication-entry {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
