/* Manitoba Critical Care — professional admin theme */

:root {
    --brand-900: #0c1929;
    --brand-800: #122337;
    --brand-700: #1a3352;
    --brand-600: #23466b;
    --brand-500: #2d5a87;
    --accent: #0d9488;
    --accent-soft: #ccfbf1;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #eef1f5;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #dde3ea;
    --border-strong: #c8d1dc;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
    --radius: 10px;
    --radius-lg: 14px;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Admin shell layout ── */
.admin-app {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--brand-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--brand-500), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.sidebar-brand-mark .brand-vital-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.12rem;
    line-height: 1;
}

.sidebar-brand-mark .brand-vital-mark i {
    font-size: 0.95rem;
}

.sidebar-brand-name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.sidebar-brand-tag {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 0.25rem;
}

.sidebar-section-label:first-child {
    margin-top: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link i {
    font-size: 1.05rem;
    opacity: 0.85;
    width: 1.25rem;
    text-align: center;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-link-muted {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.8rem;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-shell {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.admin-shell-full {
    margin-left: 0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
}

.topbar-start,
.topbar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-toggle {
    color: var(--text);
    padding: 0.25rem;
    margin-left: -0.5rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.topbar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-700);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.topbar-user-meta {
    line-height: 1.25;
}

.topbar-user-email {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.topbar-user-role {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.topbar-signout {
    font-size: 0.8rem;
    font-weight: 600;
}

.app-content {
    flex: 1;
    padding: 1.75rem 1.5rem 2rem;
    max-width: 1400px;
    width: 100%;
}

.app-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.app-footer-sep {
    opacity: 0.4;
}

.app-sidebar-mobile {
    background: var(--brand-900);
    color: #fff;
    width: var(--sidebar-width);
}

.app-sidebar-mobile .sidebar-link {
    color: rgba(255, 255, 255, 0.8);
}

/* ── Page header ── */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.page-header-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.35rem;
}

.page-header-kicker i {
    margin-right: 0.25rem;
}

.page-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0.35rem 0 0;
    max-width: 42rem;
}

/* ── Stat cards ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-primary .stat-card-icon { background: #dbeafe; color: #1d4ed8; }
.stat-card-teal .stat-card-icon { background: #ccfbf1; color: #0f766e; }
.stat-card-slate .stat-card-icon { background: #e2e8f0; color: #475569; }
.stat-card-amber .stat-card-icon { background: #fef3c7; color: #b45309; }

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--text);
}

.stat-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.2rem;
}

/* ── Cards ── */
.app-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.app-card .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.app-card .card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.app-card .card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

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

.app-card-primary,
.app-card-accent {
    border-top: none;
}

.add-attending-toggle {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.add-attending-toggle:hover,
.add-attending-toggle:focus-visible {
    background: var(--surface-raised, #f8f9fa);
}

.add-attending-toggle .add-attending-chevron {
    transition: transform 0.2s ease;
}

.add-attending-toggle[aria-expanded="true"] .add-attending-chevron {
    transform: rotate(180deg);
}

/* ── Notices & hints ── */
.notice-banner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.notice-banner-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

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

.flash-stack {
    margin-bottom: 1.25rem;
}

.alert-flash {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    border-radius: var(--radius);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

/* ── Buttons ── */
.btn {
    font-weight: 600;
    border-radius: 8px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.65rem 1.25rem;
}

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

.btn-primary:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-outline-primary {
    color: var(--brand-600);
    border-color: var(--border-strong);
}

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

/* ── Forms ── */
.form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border-color: var(--border-strong);
    font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(45, 90, 135, 0.15);
}

/* ── Roster list (dashboard sidebar) ── */
.roster-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.roster-item {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.roster-item:last-child {
    border-bottom: none;
}

.roster-name {
    font-weight: 600;
    color: var(--brand-600);
    text-decoration: none;
    font-size: 0.875rem;
}

.roster-name:hover {
    text-decoration: underline;
}

.roster-units {
    margin-top: 0.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ── Legacy stat pill ── */
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: #f1f5f9;
    color: var(--text-secondary);
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

/* ── ICU badges ── */
.icu-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3em 0.6em;
    border-radius: 6px;
    border: 1px solid transparent;
}

.icu-ineligible {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid var(--border) !important;
}

.icu-default { background-color: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.icu-micu { background-color: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.icu-sicu { background-color: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.icu-iicu { background-color: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.icu-grace { background-color: #fef3c7; color: #92400e; border-color: #fcd34d; }
.icu-icms { background-color: #ffedd5; color: #9a3412; border-color: #fdba74; }
.icu-iccs { background-color: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.icu-poap { background-color: #fce7f3; color: #9d174d; border-color: #f9a8d4; }

/* Unit picker chips */
.unit-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 0.65rem;
}

.unit-check-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
    min-height: 2.75rem;
}

.unit-check-chip .form-check-input {
    margin: 0;
    flex-shrink: 0;
    float: none;
    cursor: pointer;
}

.unit-check-chip .unit-check-label {
    color: var(--text) !important;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    font-size: 0.85rem;
}

.unit-check-chip:has(.icu-micu) { border-left: 3px solid #2563eb; background: #f8fafc; }
.unit-check-chip:has(.icu-sicu) { border-left: 3px solid #059669; background: #f8fafc; }
.unit-check-chip:has(.icu-iicu) { border-left: 3px solid #7c3aed; background: #f8fafc; }
.unit-check-chip:has(.icu-grace) { border-left: 3px solid #d97706; background: #f8fafc; }
.unit-check-chip:has(.icu-icms) { border-left: 3px solid #ea580c; background: #f8fafc; }
.unit-check-chip:has(.icu-iccs) { border-left: 3px solid #dc2626; background: #f8fafc; }
.unit-check-chip:has(.icu-poap) { border-left: 3px solid #be185d; background: #f8fafc; }

/* ── Tables ── */
.app-table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.app-table thead th {
    background: var(--brand-800);
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.app-table-light thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.app-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--border);
}

.app-table tbody tr:hover {
    background: #f8fafc;
}

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

/* ── Block schedule ── */
.block-schedule-wrap {
    max-height: calc(100vh - 220px);
    overflow: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.block-schedule {
    margin-bottom: 0;
    font-size: 0.8125rem;
}

.block-schedule .week-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f8fafc;
    min-width: 92px;
    white-space: nowrap;
    font-weight: 600;
    color: var(--brand-700);
    border-right: 1px solid var(--border);
}

.block-schedule .week-col-end {
    position: sticky;
    left: 92px;
    z-index: 3;
    background: #f8fafc;
    min-width: 68px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
}

.block-schedule thead .week-col,
.block-schedule thead .week-col-end {
    background: var(--brand-800);
    color: #fff;
    z-index: 5;
    vertical-align: middle;
}

.block-schedule thead .unit-group-header {
    text-align: center;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    vertical-align: middle;
    padding: 0.5rem 0.35rem;
}

.block-schedule thead .unit-group-header.icu-micu { background-color: #1d4ed8 !important; }
.block-schedule thead .unit-group-header.icu-sicu { background-color: #047857 !important; }
.block-schedule thead .unit-group-header.icu-iicu { background-color: #6d28d9 !important; }
.block-schedule thead .unit-group-header.icu-grace { background-color: #b45309 !important; }
.block-schedule thead .unit-group-header.icu-icms { background-color: #c2410c !important; }
.block-schedule thead .unit-group-header.icu-iccs { background-color: #b91c1c !important; }
.block-schedule thead .unit-group-header.icu-poap { background-color: #9d174d !important; }

.block-schedule thead .slot-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    vertical-align: middle;
    min-width: 72px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.block-schedule thead .slot-header.icu-micu { background-color: #3b82f6 !important; }
.block-schedule thead .slot-header.icu-sicu { background-color: #10b981 !important; }
.block-schedule thead .slot-header.icu-iicu { background-color: #8b5cf6 !important; }
.block-schedule thead .slot-header.icu-grace { background-color: #d97706 !important; }
.block-schedule thead .slot-header.icu-icms { background-color: #f97316 !important; }
.block-schedule thead .slot-header.icu-iccs { background-color: #ef4444 !important; }
.block-schedule thead .slot-header.icu-poap { background-color: #db2777 !important; }

.block-schedule .unit-col {
    min-width: 76px;
    max-width: 110px;
    text-align: center;
    vertical-align: middle;
    border-left: 1px solid var(--border);
}

.block-schedule td.unit-col.icu-micu-cell { background-color: #f8fafc; }
.block-schedule td.unit-col.icu-sicu-cell { background-color: #f8fafc; }
.block-schedule td.unit-col.icu-iicu-cell { background-color: #f8fafc; }
.block-schedule td.unit-col.icu-grace-cell { background-color: #f8fafc; }
.block-schedule td.unit-col.icu-icms-cell { background-color: #f8fafc; }
.block-schedule td.unit-col.icu-iccs-cell { background-color: #f8fafc; }
.block-schedule td.unit-col.icu-poap-cell { background-color: #f8fafc; }

.block-schedule .empty-cell {
    background: #fffbeb !important;
    color: #b45309;
    font-style: italic;
}

.block-schedule .schedule-cell-note {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.2;
    color: #64748b;
    white-space: normal;
}

.block-schedule td.unit-col.has-split-note {
    vertical-align: top;
}

.block-schedule tbody tr:nth-child(even) .week-col,
.block-schedule tbody tr:nth-child(even) .week-col-end {
    background: #f1f5f9;
}

/* ── Availability ── */
.availability-table .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.availability-table tbody tr.unavailable-week {
    background-color: #fef2f2;
}

.availability-table tbody tr.if-required-week {
    background-color: #fffbeb;
}

.availability-table .avail-col {
    width: 110px;
}

.availability-table .avail-unit-col {
    min-width: 150px;
}

.availability-table .week-unit {
    min-width: 140px;
}

/* ── Algorithm rules panel ── */
.algorithm-rules-card .card-header {
    border-bottom: 0;
    padding-bottom: 0.5rem;
}

.algorithm-rules-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.algorithm-rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.algorithm-rules-list li {
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-subtle, #e2e8f0);
    font-size: 0.875rem;
    line-height: 1.45;
}

.algorithm-rules-list li:last-child {
    border-bottom: 0;
}

.algorithm-rules-list strong {
    display: block;
    color: var(--text-primary, #0f172a);
    margin-bottom: 0.15rem;
}

.algorithm-rules-priority {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted, #64748b);
    margin-right: 0.35rem;
}

.algorithm-rules-weights summary {
    cursor: pointer;
    user-select: none;
}

/* ── Availability chart (admin index) ── */
.availability-chart {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.availability-chart-row {
    display: grid;
    grid-template-columns: minmax(140px, 22%) 1fr auto;
    gap: 0.75rem 1rem;
    align-items: center;
}

.availability-chart-label {
    font-size: 0.875rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.availability-chart-bar-wrap {
    height: 1.25rem;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.availability-chart-bar {
    height: 100%;
    background: linear-gradient(90deg, #059669, #10b981);
    border-radius: 999px;
    min-width: 2px;
    transition: width 0.2s ease;
}

.availability-chart-bar-partial {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.availability-chart-value {
    font-size: 0.875rem;
    white-space: nowrap;
    min-width: 3.5rem;
    text-align: right;
}

@media (max-width: 576px) {
    .availability-chart-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .availability-chart-label {
        grid-column: 1 / -1;
    }
}

/* ── Breadcrumb ── */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
}

.breadcrumb-item a {
    color: var(--brand-600);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ── Attending cards ── */
.attending-card {
    transition: box-shadow 0.15s;
}

.attending-card:hover {
    box-shadow: var(--shadow-md);
}

.attending-card .card-title a {
    color: var(--brand-600);
    font-weight: 600;
}

/* ── Schedule legend ── */
.schedule-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.schedule-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.schedule-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.schedule-legend-swatch.icu-micu { background-color: #2563eb; }
.schedule-legend-swatch.icu-sicu { background-color: #059669; }
.schedule-legend-swatch.icu-iicu { background-color: #7c3aed; }
.schedule-legend-swatch.icu-grace { background-color: #d97706; }
.schedule-legend-swatch.icu-icms { background-color: #ea580c; }
.schedule-legend-swatch.icu-iccs { background-color: #dc2626; }
.schedule-legend-swatch.icu-poap { background-color: #be185d; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    opacity: 0.35;
    display: block;
    margin-bottom: 0.75rem;
}

.fill-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}

.fill-bar-inner {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

/* ── Quota matrix ── */
.quota-matrix-wrap {
    overflow: auto;
    max-height: calc(100vh - 280px);
}

.quota-matrix {
    font-size: 0.8125rem;
    margin-bottom: 0;
}

.quota-matrix-name-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f8fafc;
    min-width: 140px;
    max-width: 180px;
    white-space: nowrap;
    border-right: 1px solid var(--border);
    vertical-align: middle;
    font-weight: 600;
}

.quota-matrix thead .quota-matrix-name-col {
    background: var(--brand-800);
    color: #fff;
    z-index: 5;
}

.quota-matrix-total-col {
    min-width: 56px;
    background: #f8fafc;
    border-left: 1px solid var(--border);
    font-weight: 600;
}

.quota-matrix-unit-col {
    min-width: 72px;
    vertical-align: bottom;
    padding: 0.5rem 0.35rem;
    color: #fff;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.quota-matrix-unit-col.icu-micu { background-color: #2563eb; }
.quota-matrix-unit-col.icu-sicu { background-color: #059669; }
.quota-matrix-unit-col.icu-iicu { background-color: #7c3aed; }
.quota-matrix-unit-col.icu-grace { background-color: #d97706; }
.quota-matrix-unit-col.icu-icms { background-color: #ea580c; }
.quota-matrix-unit-col.icu-iccs { background-color: #dc2626; }
.quota-matrix-unit-col.icu-poap { background-color: #be185d; }

.unit-header-label {
    font-weight: 700;
    font-size: 0.75rem;
}

.quota-matrix-cell {
    vertical-align: middle;
    padding: 0.35rem;
}

.quota-matrix-ineligible {
    background: #f1f5f9;
}

.quota-matrix-input {
    width: 64px;
    min-width: 56px;
    margin: 0 auto;
    padding: 0.35rem 0.25rem;
    font-weight: 600;
    font-size: 0.8125rem;
}

.quota-matrix-footer th,
.quota-matrix-footer td {
    background: #f8fafc;
    border-top: 2px solid var(--border);
    vertical-align: top;
    padding: 0.5rem 0.35rem;
    font-size: 0.75rem;
}

.quota-matrix-footer .quota-matrix-name-col {
    background: #e2e8f0;
    color: var(--text);
}

/* ── Responsive ── */
.schedule-cell-editable {
    cursor: pointer;
    position: relative;
}

.schedule-cell-editable:hover {
    outline: 2px solid var(--brand-500);
    outline-offset: -2px;
    filter: brightness(0.98);
}

.schedule-edit-hint {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.55rem;
    opacity: 0.35;
}

.bg-success-subtle {
    background-color: #ecfdf5 !important;
}

.bg-warning-subtle {
    background-color: #fffbeb !important;
}

.bg-primary-subtle {
    background-color: #eff6ff !important;
}

.text-success { color: #047857 !important; }
.text-warning { color: #b45309 !important; }

@media (max-width: 991.98px) {
    .app-sidebar {
        display: none;
    }

    .admin-shell {
        margin-left: 0;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 1.25rem 1rem 1.5rem;
    }

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

    .stat-card {
        padding: 0.85rem 1rem;
    }

    .stat-card-value {
        font-size: 1.25rem;
    }

    .page-title {
        font-size: 1.35rem;
    }

    .block-schedule-wrap {
        max-height: 65vh;
    }
}

/* On-call week (admin + portal) */

.on-call-week {
    margin-top: 0;
}

.on-call-week-header {
    margin-bottom: 0.75rem;
}

.on-call-week-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    letter-spacing: -0.01em;
}

.on-call-week-dates {
    font-size: 0.8rem;
    color: #64748b;
}

.on-call-dev-badge {
    font-size: 0.65rem;
    font-weight: 500;
    background: #fef3c7;
    color: #92400e;
}

.on-call-empty {
    font-size: 0.85rem;
    color: #64748b;
}

.on-call-table {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
}

.on-call-table-head,
.on-call-table-row {
    display: grid;
    grid-template-columns: 5.25rem 2.5rem 1fr;
    align-items: center;
    column-gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    min-height: 2.35rem;
}

.on-call-table-head {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.on-call-table-row {
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}

.on-call-table-row:last-child {
    border-bottom: none;
}

.on-call-table-row:nth-child(even) {
    background: #fafbfc;
}

.on-call-col-unit .icu-badge {
    font-size: 0.65rem;
}

.on-call-col-slot {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-align: center;
}

.on-call-col-name {
    min-width: 0;
}

.on-call-attending-btn {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    text-align: left;
}

.on-call-attending-btn:hover {
    color: #1e3a8a;
}

.on-call-unassigned {
    color: #94a3b8;
    font-style: italic;
}

.on-call-week--admin .on-call-week-title {
    display: none;
}

.on-call-week--admin .on-call-week-header {
    margin-bottom: 0.65rem;
}
