/* Manitoba Critical Care — SpaceX / Starlink dark theme */

:root {
    --brand-900: #000000;
    --brand-800: #0a0a0a;
    --brand-700: #111111;
    --brand-600: #ffffff;
    --brand-500: #e8e8e8;
    --accent: #ffffff;
    --accent-soft: rgba(255, 255, 255, 0.08);
    --success: #3dd68c;
    --warning: #f5a524;
    --danger: #ff6b6b;
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-raised: #141414;
    --border: #222222;
    --border-strong: #333333;
    --text: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #6e6e6e;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --radius: 2px;
    --radius-lg: 4px;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --font: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, 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: 2px;
    background: #fff;
    color: #000;
    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: 2px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    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.08);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 2px 0 0 #fff;
}

.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: rgba(255,255,255,0.08); color: #fff; }
.stat-card-teal .stat-card-icon { background: rgba(255,255,255,0.08); color: #fff; }
.stat-card-slate .stat-card-icon { background: rgba(255,255,255,0.08); color: #fff; }
.stat-card-amber .stat-card-icon { background: rgba(255,255,255,0.08); color: #fff; }

.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);
}

.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: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-strong);
    color: var(--text);
}

.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: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

/* ── Buttons ── */
.btn {
    font-weight: 600;
    border-radius: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

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

.btn-primary {
    background: #fff;
    border-color: #fff;
    color: #000;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #e8e8e8;
    border-color: #e8e8e8;
    color: #000;
}

.btn-outline-primary {
    color: #fff;
    border-color: #fff;
    background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: #fff;
    border-color: #fff;
    color: #000;
}

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

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: #fff;
    color: #fff;
}

.btn-outline-danger {
    color: var(--danger);
    border-color: rgba(255, 107, 107, 0.45);
}

.btn-outline-danger:hover {
    background: rgba(255, 107, 107, 0.12);
    border-color: var(--danger);
    color: var(--danger);
}

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

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

.form-control,
.form-select {
    border-radius: 2px;
    border-color: var(--border-strong);
    font-size: 0.875rem;
    background-color: #000;
    color: #fff;
}

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

.form-control:focus,
.form-select:focus {
    border-color: #fff;
    box-shadow: 0 0 0 1px #fff;
    background-color: #000;
    color: #fff;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* ── 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: #1a1a1a !important;
    color: #8a8a8a !important;
    border: 1px solid var(--border) !important;
}

.icu-default { background-color: #1a1a1a; color: #e0e0e0; border-color: #333; }
.icu-micu { background-color: rgba(37, 99, 235, 0.22); color: #93c5fd; border-color: rgba(59, 130, 246, 0.4); }
.icu-sicu { background-color: rgba(5, 150, 105, 0.22); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.icu-iicu { background-color: rgba(124, 58, 237, 0.22); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.4); }
.icu-grace { background-color: rgba(217, 119, 6, 0.22); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
.icu-icms { background-color: rgba(234, 88, 12, 0.22); color: #fdba74; border-color: rgba(249, 115, 22, 0.4); }
.icu-iccs { background-color: rgba(220, 38, 38, 0.22); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.icu-poap { background-color: rgba(190, 24, 93, 0.22); color: #f9a8d4; border-color: rgba(219, 39, 119, 0.4); }

/* 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: 2px;
    background: var(--surface-raised);
    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 #3b82f6; background: var(--surface-raised); }
.unit-check-chip:has(.icu-sicu) { border-left: 3px solid #10b981; background: var(--surface-raised); }
.unit-check-chip:has(.icu-iicu) { border-left: 3px solid #8b5cf6; background: var(--surface-raised); }
.unit-check-chip:has(.icu-grace) { border-left: 3px solid #d97706; background: var(--surface-raised); }
.unit-check-chip:has(.icu-icms) { border-left: 3px solid #f97316; background: var(--surface-raised); }
.unit-check-chip:has(.icu-iccs) { border-left: 3px solid #ef4444; background: var(--surface-raised); }
.unit-check-chip:has(.icu-poap) { border-left: 3px solid #db2777; background: var(--surface-raised); }

/* ── 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: var(--surface-raised);
    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);
    color: var(--text);
}

.app-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.quota-table thead th {
    background: var(--surface-raised);
    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: #000;
    min-width: 92px;
    white-space: nowrap;
    font-weight: 600;
    color: #fff;
    border-right: 1px solid var(--border);
}

.block-schedule .week-col-end {
    position: sticky;
    left: 92px;
    z-index: 3;
    background: #000;
    min-width: 68px;
    font-size: 0.75rem;
    color: #b3b3b3;
    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: #0d0d0d; }
.block-schedule td.unit-col.icu-sicu-cell { background-color: #0d0d0d; }
.block-schedule td.unit-col.icu-iicu-cell { background-color: #0d0d0d; }
.block-schedule td.unit-col.icu-grace-cell { background-color: #0d0d0d; }
.block-schedule td.unit-col.icu-icms-cell { background-color: #0d0d0d; }
.block-schedule td.unit-col.icu-iccs-cell { background-color: #0d0d0d; }
.block-schedule td.unit-col.icu-poap-cell { background-color: #0d0d0d; }

.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: #94a3b8;
    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: #000;
    color: #fff;
}

/* ── 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: #0a0a0a;
    min-width: 140px;
    max-width: 180px;
    white-space: nowrap;
    border-right: 1px solid var(--border);
    vertical-align: middle;
    font-weight: 600;
    color: #fff;
}

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

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

.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: #111;
    border-top: 2px solid var(--border);
    vertical-align: top;
    padding: 0.5rem 0.35rem;
    font-size: 0.75rem;
    color: #fff;
}

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

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

.schedule-cell-editable:hover {
    outline: 2px solid #fff;
    outline-offset: -2px;
    filter: brightness(1.15);
}

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

.bg-success-subtle {
    background-color: rgba(61, 214, 140, 0.12) !important;
}

.bg-warning-subtle {
    background-color: rgba(245, 165, 36, 0.12) !important;
}

.bg-primary-subtle {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

.text-success { color: #3dd68c !important; }
.text-warning { color: #f5a524 !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: var(--text-muted);
}

.on-call-dev-badge {
    font-size: 0.65rem;
    font-weight: 500;
    background: rgba(245, 165, 36, 0.15);
    color: #f5a524;
}

.on-call-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.on-call-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.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: var(--surface-raised);
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.on-call-table-row {
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

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

.on-call-table-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

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

.on-call-col-slot {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    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: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    cursor: pointer;
    text-align: left;
}

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

.on-call-unassigned {
    color: var(--text-muted);
    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;
}

/* ── SpaceX dark: Bootstrap / utility overrides ── */

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

a.roster-name,
a.text-decoration-none.fw-semibold {
    color: #fff !important;
}

a.roster-name:hover {
    color: #b3b3b3 !important;
}

.bg-light,
.bg-light-subtle,
.bg-body-tertiary,
.bg-white {
    background-color: var(--surface-raised) !important;
    color: var(--text) !important;
}

.border,
.border-top,
.border-bottom {
    border-color: var(--border) !important;
}

.card,
.list-group-item,
.modal-content,
.dropdown-menu {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.list-group-item {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.list-group-flush > .list-group-item {
    border-color: var(--border);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

.modal-content {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
}

.btn-close {
    filter: invert(1) grayscale(100%);
    opacity: 0.7;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: #fff;
    --bs-table-border-color: #222;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    color: #fff;
}

.breadcrumb {
    --bs-breadcrumb-divider-color: #6e6e6e;
}

.breadcrumb-item a {
    color: #b3b3b3;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #fff;
}

.alert-success {
    background: rgba(61, 214, 140, 0.12);
    border-color: rgba(61, 214, 140, 0.35);
    color: #3dd68c;
}

.alert-danger,
.alert-warning {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.35);
    color: #ffb4b4;
}

.badge.bg-light {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

.badge.bg-success-subtle {
    background: rgba(61, 214, 140, 0.15) !important;
    color: #3dd68c !important;
    border-color: rgba(61, 214, 140, 0.3) !important;
}

.badge.bg-warning,
.badge.bg-warning.text-dark {
    background: rgba(245, 165, 36, 0.2) !important;
    color: #f5a524 !important;
}

.empty-state {
    color: var(--text-muted);
}

.page-title {
    letter-spacing: -0.03em;
    text-transform: uppercase;
    font-size: 1.35rem;
    font-weight: 700;
}

.block-schedule {
    color: #fff;
}

.block-schedule td,
.block-schedule th {
    border-color: #222 !important;
}

.portal-cell-mine {
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 0 0 0 1px #fff;
}
