* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Tahoma, sans-serif;
    color: #1f2933;
    background: #f5f7fb;
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    padding: 24px;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(320px, 460px) minmax(520px, 1fr);
    gap: 22px;
    align-items: start;
    max-width: 1280px;
    margin: 0 auto;
}

.panel {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(31, 41, 51, .08);
}

.login-card {
    padding: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.brand img {
    width: 74px;
    height: 88px;
    object-fit: contain;
}

.brand-title {
    font-size: 24px;
    line-height: 1.1;
    font-weight: 800;
}

.brand-subtitle {
    margin-top: 4px;
    color: #607080;
    font-size: 13px;
}

.form-row {
    margin-top: 12px;
}

.form-row label {
    display: block;
    color: #52616f;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.text-input {
    width: 100%;
    height: 42px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 15px;
    background: #fbfcfe;
}

.primary-button {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: 6px;
    background: #0f62a8;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
}

.primary-button:hover {
    background: #0b4f88;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.quick-link {
    display: block;
    text-align: center;
    padding: 10px 8px;
    border-radius: 6px;
    background: #eef4fb;
    color: #0f4f83;
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
}

.quick-link:hover {
    background: #dfeaf6;
}

.dashboard-panel {
    padding: 18px;
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.panel-title {
    font-size: 18px;
    font-weight: 800;
}

.panel-subtitle {
    color: #607080;
    font-size: 12px;
    margin-top: 2px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.metric {
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfe;
}

.metric-label {
    color: #607080;
    font-size: 12px;
    font-weight: 700;
}

.metric-value {
    margin-top: 4px;
    font-size: 28px;
    font-weight: 900;
}

.ward-table-wrap {
    overflow-x: auto;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
}

.ward-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

.ward-table th,
.ward-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e9eef5;
    text-align: right;
    white-space: nowrap;
}

.ward-table th:first-child,
.ward-table td:first-child {
    text-align: left;
}

.ward-table th {
    background: #f1f5f9;
    font-size: 12px;
    color: #445566;
}

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

.chart-card {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    background: #fbfcfe;
}

.chart-title {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.chart-wrap {
    width: 100%;
    max-width: 640px;
    height: 300px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 300px !important;
}

.admit-bars {
    display: grid;
    gap: 8px;
}

.admit-bar-row {
    display: grid;
    grid-template-columns: 76px 1fr 36px;
    gap: 10px;
    align-items: center;
}

.admit-bar-label {
    color: #52616f;
    font-size: 12px;
    font-weight: 800;
}

.admit-bar-track {
    height: 12px;
    border-radius: 999px;
    background: #e7edf5;
    overflow: hidden;
}

.admit-bar-fill {
    height: 12px;
    border-radius: 999px;
    background: #0f62a8;
}

.admit-bar-value {
    text-align: right;
    font-weight: 900;
    font-size: 12px;
}

.alert {
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 13px;
    margin-bottom: 12px;
}

.app-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px;
}

.wide-page {
    max-width: 1480px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.topbar-title {
    font-size: 22px;
    font-weight: 900;
}

.topbar-kicker {
    color: #0f766e;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    margin-bottom: 2px;
}

.topbar-meta {
    color: #607080;
    font-size: 13px;
    margin-top: 3px;
}

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

.nav-button {
    display: inline-block;
    border: 1px solid #cfd8e3;
    background: #fff;
    color: #1f2933;
    border-radius: 6px;
    padding: 9px 12px;
    font-weight: 800;
    text-decoration: none;
    font-size: 13px;
}

.nav-button:hover {
    background: #f1f5f9;
}

.menu-section {
    margin-top: 16px;
}

.menu-section-title {
    color: #52616f;
    font-size: 13px;
    font-weight: 900;
    margin: 0 0 8px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.menu-card {
    display: block;
    min-height: 112px;
    padding: 14px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(31, 41, 51, .06);
}

.menu-section:first-of-type .menu-card {
    border-left: 4px solid #0f766e;
}

.menu-card:hover {
    border-color: #b7c7d8;
    transform: translateY(-1px);
}

.menu-card.disabled {
    opacity: .5;
    cursor: not-allowed;
}

.menu-card-title {
    font-weight: 900;
    font-size: 15px;
}

.menu-card-desc {
    color: #607080;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
}

.tag {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef4fb;
    color: #0f4f83;
    font-size: 11px;
    font-weight: 900;
}

.content-grid {
    display: grid;
    gap: 16px;
    align-items: start;
}

.two-columns {
    grid-template-columns: minmax(420px, 1fr) minmax(280px, 360px);
}

.form-panel,
.info-panel,
.table-panel {
    padding: 18px;
}

.panel-heading {
    margin-bottom: 14px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.panel-heading p {
    margin: 4px 0 0;
    color: #607080;
    font-size: 13px;
}

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

.form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.primary-button.compact {
    width: auto;
    min-width: 110px;
    padding: 0 16px;
}

.select-input {
    width: 100%;
    height: 42px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 15px;
    background: #fbfcfe;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list dt {
    color: #607080;
    font-size: 12px;
    font-weight: 800;
}

.detail-list dd {
    margin: 2px 0 0;
    font-size: 15px;
    font-weight: 800;
}

.status-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef4fb;
    color: #0f4f83;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.alert.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert.error {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(140px, 180px) minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.action-row {
    min-width: 110px;
}

.table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.data-table-wrap {
    overflow-x: auto;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1120px;
    background: #fff;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e3e8ef;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.data-table th {
    color: #52616f;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

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

.center {
    text-align: center !important;
}

.nowrap {
    white-space: nowrap;
}

.empty-state {
    max-width: 560px;
    padding: 18px 0;
}

.empty-state h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
}

.empty-state p {
    color: #607080;
    line-height: 1.5;
    margin: 8px 0 16px;
}

.rapid-summary-panel {
    margin-bottom: 16px;
}

.rapid-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 12px;
}

.positive-text {
    color: #b91c1c;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d6e0eb;
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: #1f2933;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
}

.filter-tab b {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef4fb;
    color: #0f4f83;
    text-align: center;
}

.filter-tab.active {
    border-color: #0f62a8;
    background: #eaf4ff;
    color: #0f4f83;
}

.test-chip,
.result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.test-chip.covid {
    background: #eef4fb;
    color: #0f4f83;
}

.test-chip.flu-a {
    background: #fef3c7;
    color: #92400e;
}

.test-chip.flu-b {
    background: #dcfce7;
    color: #166534;
}

.test-chip.flu-ab {
    background: #ede9fe;
    color: #5b21b6;
}

.test-chip.other {
    background: #f3f4f6;
    color: #4b5563;
}

.result-badge.positive {
    background: #fee2e2;
    color: #991b1b;
}

.result-badge.negative {
    background: #dcfce7;
    color: #166534;
}

.result-badge.pending {
    background: #f3f4f6;
    color: #374151;
}

.rapid-table {
    min-width: 1180px;
}

.clinical-cell {
    min-width: 240px;
    color: #374151;
}

.muted-text {
    color: #94a3b8;
}

@media (max-width: 900px) {
    .app-shell {
        padding: 12px;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

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

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

    .two-columns,
    .inline-form,
    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .nav-actions {
        width: 100%;
    }

    .nav-button {
        flex: 1 1 auto;
        text-align: center;
    }
}
