/* ============================================================
   CBT KEF XVI - Kumo-inspired shared styles
   ============================================================ */
/* ponytail: simplified & unified Kumo UI semantic design tokens */

/* --- Web Fonts --- */
@font-face {
    font-family: 'Inter';
    src: url('../assets/fonts/Inter-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../assets/fonts/Inter-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../assets/fonts/Inter-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../assets/fonts/Inter-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Material Symbols Outlined';
    src: url('../assets/fonts/material-symbols.ttf') format('truetype');
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

/* --- Kumo UI Semantic Tokens --- */
:root {
    color-scheme: light;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 68px;
    
    --kumo-primary: #4338ca;
    --kumo-primary-hover: #4338ca;
    --kumo-primary-light: #eef2ff;
    --kumo-primary-border: #c7d2fe;
    
    --kumo-bg: #f7f7f8;
    --kumo-surface: #ffffff;
    --kumo-elevated: #fbfbfc;
    --kumo-recessed: #f0f1f3;
    --kumo-border: #dedfe3;
    --kumo-border-hover: #c8cad0;
    
    --kumo-text-main: #202124;
    --kumo-text-muted: #5f6368;
    --kumo-text-subtle: #80868b;
    
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.04);
    
    --accent-gradient: linear-gradient(135deg, #4338ca 0%, #0d9488 100%);
}

/* --- Resets & Globals --- */
* { box-sizing: border-box; }
html { background: var(--kumo-bg); scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--kumo-text-main);
    background: var(--kumo-bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; }
button, a, select, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--kumo-primary); outline-offset: 2px; }
input:focus:focus-visible,
select:focus:focus-visible,
textarea:focus:focus-visible {
    outline: 0;
    border-color: var(--kumo-primary);
    box-shadow: 0 0 0 2px rgba(67, 56, 202, 0.18);
}
[hidden] { display: none !important; }

/* Kumo content rules, kept here so every PHP page inherits them. */
.font-headline-lg,
.font-headline-md,
.font-display {
    font-family: 'Inter', system-ui, sans-serif !important;
}
.font-bold,
.font-black { font-weight: 600 !important; }
.font-label-caps { letter-spacing: normal !important; text-transform: none; }
.tracking-wider,
.tracking-widest { letter-spacing: normal !important; }
.shadow-sm,
.shadow-md { box-shadow: none !important; }
.transition-colors { transition-duration: 0s !important; }
.transition-all { transition-property: transform, opacity !important; }

/* --- Material Symbols --- */
.material-symbols-outlined {
    display: inline-block;
    overflow: hidden;
    width: 1em;
    font-family: 'Material Symbols Outlined';
    font-size: 22px;
    font-style: normal;
    font-weight: 400;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- Brand Mark --- */
.brand-mark { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    background: var(--accent-gradient);
    font-size: 20px;
    border: none;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.avatar { border-radius: 9999px; }
.avatar-sm { width: 36px; height: 36px; }

/* --- Kumo UI Card / Panel --- */
.panel {
    border: 1px solid var(--kumo-border);
    border-radius: 10px;
    background: var(--kumo-surface);
    box-shadow: none;
}

/* --- Kumo Glass Sticky Header --- */
header.sticky {
    background: var(--kumo-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--kumo-border);
}

/* --- Sidebar (Admin & Proctor) --- */
.sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    padding: 18px 14px;
    border-right: 1px solid var(--kumo-border);
    background: var(--kumo-surface);
    transition: width 0.2s ease, transform 0.2s ease;
}
.sidebar-brand-row { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 6px; padding: 0 4px; }
.sidebar-brand-text { color: var(--kumo-text-main); font-size: 16px; font-weight: 700; white-space: nowrap; }
.sidebar-toggle,
.mobile-sidebar-toggle {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--kumo-border);
    border-radius: 8px;
    color: var(--kumo-text-muted);
    background: var(--kumo-surface);
    cursor: pointer;
}
.sidebar-toggle:hover,
.mobile-sidebar-toggle:hover { color: var(--kumo-text-main); background: var(--kumo-bg); border-color: var(--kumo-border-hover); }
.sidebar-session { margin: 18px 4px 14px; }
.sidebar-session label { display: block; margin-bottom: 6px; color: var(--kumo-text-muted); font-size: 13px; font-weight: 500; }
.sidebar-session select {
    width: 100%;
    height: 40px;
    padding: 0 30px 0 12px;
    border: 1px solid var(--kumo-border);
    border-radius: 8px;
    color: var(--kumo-text-main);
    background: var(--kumo-surface);
    font-size: 13px;
}
.sidebar-session select:focus { border-color: var(--kumo-primary); outline: none; }
.sidebar-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 3px; overflow-y: auto; padding-top: 6px; }
.sidebar-link {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--kumo-text-muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.sidebar-link .material-symbols-outlined { font-size: 20px; }
.sidebar-link:hover { color: var(--kumo-text-main); background: var(--kumo-bg); }
.sidebar-link.is-active {
    color: var(--kumo-primary);
    background: var(--kumo-primary-light);
    font-weight: 600;
}
.sidebar-link-danger { color: #e11d48; }
.sidebar-link-danger:hover { color: #be123c; background: #fff1f2; }
.sidebar-footer-nav { display: flex; flex-direction: column; gap: 3px; padding-top: 14px; border-top: 1px solid var(--kumo-border); }
.sidebar-user { display: flex; min-width: 0; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 6px 0; border-top: 1px solid var(--kumo-border); }
.main-content { min-width: 0; margin-left: var(--sidebar-width); transition: margin-left 0.2s ease; }
.sidebar-footer { margin-left: var(--sidebar-width); }
.mobile-sidebar-toggle, .sidebar-backdrop { display: none; }

html.sidebar-collapsed .sidebar,
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); padding-inline: 10px; }
html.sidebar-collapsed .main-content,
body.sidebar-collapsed .main-content,
html.sidebar-collapsed .sidebar-footer,
body.sidebar-collapsed .sidebar-footer { margin-left: var(--sidebar-collapsed-width); }
html.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .sidebar-text,
html.sidebar-collapsed .sidebar-session,
body.sidebar-collapsed .sidebar-session { display: none; }
html.sidebar-collapsed .sidebar-brand-row,
body.sidebar-collapsed .sidebar-brand-row { justify-content: center; }
html.sidebar-collapsed .sidebar-brand-row .brand-mark,
body.sidebar-collapsed .sidebar-brand-row .brand-mark { display: none; }
html.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-link { justify-content: center; padding-inline: 8px; border-left: none; }
html.sidebar-collapsed .sidebar-user,
body.sidebar-collapsed .sidebar-user { justify-content: center; padding-inline: 0; }

/* --- Page Chrome --- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title {
    margin: 0;
    color: var(--kumo-text-main);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
}
.page-subtitle { margin: 4px 0 0; color: var(--kumo-text-muted); font-size: 14px; line-height: 1.5; }

/* --- Auth Shell (Login Pages) --- */
.auth-shell {
    display: flex;
    width: 100%;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--kumo-bg);
}
.auth-container { width: min(420px, 100%); }
.auth-panel {
    padding: 32px;
    border: 1px solid var(--kumo-border);
    border-radius: 12px;
    background: var(--kumo-surface);
    box-shadow: none;
    position: relative;
    overflow: hidden;
}
.auth-panel::before {
    content: '';
    display: block;
    height: 4px;
    margin: -32px -32px 24px;
    background: var(--accent-gradient);
}

/* --- Stats Grid (Kumo Bento Grid) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    overflow: hidden;
    border: 1px solid var(--kumo-border);
    border-radius: 12px;
    background: var(--kumo-surface);
    box-shadow: none;
}
.stat-item { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--kumo-border); }
.stat-item:last-child { border-right: 0; }
.stat-label { color: var(--kumo-text-muted); font-size: 13px; font-weight: 500; }
.stat-value { margin-top: 4px; color: var(--kumo-text-main); font-size: 26px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* --- Data Tables --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    height: 44px;
    padding: 0 16px;
    border-bottom: 1px solid var(--kumo-border);
    color: var(--kumo-text-muted);
    background: var(--kumo-bg);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}
.data-table th.text-center { text-align: center; }
.data-table td { min-height: 52px; padding: 14px 16px; border-bottom: 1px solid var(--kumo-border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f1f5f9; }
.monitoring-table th { font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: normal; }

/* --- Kumo Pill Status Badges --- */
.status-badge, .kumo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}
.status-success, .badge-success { border: 1px solid #a7f3d0; color: #047857; background: #ecfdf5; }
.status-warning, .badge-warning { border: 1px solid #fde68a; color: #b45309; background: #fffbeb; }
.status-danger, .badge-danger   { border: 1px solid #fecaca; color: #be123c; background: #fff1f2; }
.badge-primary                   { border: 1px solid #c7d2fe; color: #4338ca; background: #eef2ff; }
.badge-neutral                   { border: 1px solid #e2e8f0; color: #475569; background: #f8fafc; }

/* --- Exam Workspace & Option Rows --- */
.option-row {
    min-height: 58px;
    border: 1.5px solid var(--kumo-border);
    border-radius: 12px;
    padding: 14px 18px;
    background: var(--kumo-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
}
.option-row:hover {
    border-color: var(--kumo-primary-border);
    background: var(--kumo-bg);
}
.option-row.selected {
    border-color: var(--kumo-primary);
    background: var(--kumo-primary-light);
    box-shadow: 0 0 0 1px var(--kumo-primary);
}
.option-row.selected .radio-custom {
    border-color: var(--kumo-primary);
    background: var(--kumo-primary);
    box-shadow: inset 0 0 0 4px #fff;
}
.radio-custom {
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    border: 2px solid var(--kumo-text-subtle);
    flex-shrink: 0;
}

.exam-workspace { display: flex; gap: 20px; }
.exam-question-pane { min-width: 0; flex: 1; }
.exam-palette { width: 310px; flex: 0 0 310px; }
.exam-palette-backdrop { display: none; }
.exam-palette-close { display: none; }

/* --- Dialogs & Modals --- */
dialog.app-dialog-root, dialog.form-dialog {
    border: 0;
    border-radius: 12px;
    background: var(--kumo-surface);
    box-shadow: 0 0 0 1px var(--kumo-border), var(--shadow-lg);
}
.app-dialog-root {
    width: min(420px, calc(100% - 32px));
    padding: 0;
}
.app-dialog {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 24px;
}
.app-dialog-icon {
    display: flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--kumo-primary);
    background: var(--kumo-primary-light);
}
.app-dialog-copy h2 { margin: 0; font-size: 16px; font-weight: 600; }
.app-dialog-copy p { margin: 4px 0 0; color: var(--kumo-text-muted); }
.app-dialog-actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.app-dialog-btn { min-height: 36px; padding: 6px 14px; border-radius: 8px; font-weight: 600; }
.app-dialog-cancel { border: 1px solid var(--kumo-border); color: var(--kumo-text-main); background: var(--kumo-surface); }
.app-dialog-confirm { color: #fff; background: var(--kumo-primary); }
.app-dialog-root[data-tone='danger'] .app-dialog-icon { color: #b91c1c; background: #fef2f2; }
.app-dialog-root[data-tone='danger'] .app-dialog-confirm { background: #b91c1c; }
dialog::backdrop {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.form-dialog-panel {
    max-height: min(88dvh, 760px);
    overflow-y: auto;
    padding: 24px;
    border: 0;
    border-radius: 12px;
    background: var(--kumo-surface);
    box-shadow: 0 0 0 1px var(--kumo-border), var(--shadow-lg);
}

/* Legacy exam snackbar: status save now lives in the header. */
#snackbar { display: none !important; }

/* --- Toast Notifications --- */
.toast-container { position: fixed; z-index: 50; top: 18px; right: 18px; display: flex; width: min(360px, calc(100% - 36px)); flex-direction: column; gap: 10px; }
.toast-alert {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--kumo-border);
    border-radius: 12px;
    background: var(--kumo-surface);
    box-shadow: var(--shadow-md);
}


/* Missing responsive spans used by staff filter toolbars. */
@media (min-width: 768px) {
    .md\:col-span-4 { grid-column: span 4 / span 4; }
    .md\:col-span-8 { grid-column: span 8 / span 8; }
}
/* --- Staff portal motion & theme (admin + proctor only) --- */
.staff-theme-toggle { width: 100%; border: 0; text-align: left; background: transparent; cursor: pointer; }
html.staff-portal .main-content > * { animation: staff-page-in .24s cubic-bezier(.2, .75, .3, 1) both; }
html.staff-portal .panel,
html.staff-portal .sidebar-link,
html.staff-portal .sidebar-toggle,
html.staff-portal .mobile-sidebar-toggle,
html.staff-portal .data-table tbody tr,
html.staff-portal .data-table tbody td,
html.staff-portal .monitoring-table tbody tr,
html.staff-portal button,
html.staff-portal input,
html.staff-portal select,
html.staff-portal textarea { transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
html.staff-portal .transition-colors { transition-duration: .18s !important; }
html.staff-portal .transition-all { transition-duration: .18s !important; transition-property: color, background-color, border-color, box-shadow, opacity, transform !important; }
html.staff-portal button:active,
html.staff-portal .sidebar-link:active { transform: scale(.985); }
html.staff-portal .session-select-row:hover td,
html.staff-portal .session-select-row:focus-visible td { background: rgba(224, 231, 255, .42); }
html.staff-portal .session-select-row:hover td:first-child,
html.staff-portal .session-select-row:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--kumo-primary); }
html.staff-portal .form-dialog[open] .form-dialog-panel,
html.staff-portal .app-dialog-root[open] .app-dialog { animation: staff-dialog-in .2s cubic-bezier(.2, .75, .3, 1) both; }
html.staff-portal dialog[open]::backdrop { animation: staff-backdrop-in .18s ease both; }
html.staff-portal::view-transition-old(root),
html.staff-portal::view-transition-new(root) { animation-duration: .22s; }
@keyframes staff-page-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes staff-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes staff-backdrop-in { from { opacity: 0; } to { opacity: 1; } }

html.staff-portal[data-staff-theme='dark'] {
    color-scheme: dark;
    --kumo-primary: #a5b4fc;
    --kumo-primary-hover: #c7d2fe;
    --kumo-primary-light: #242052;
    --kumo-primary-border: #4f46e5;
    --kumo-bg: #0f1117;
    --kumo-surface: #171a22;
    --kumo-elevated: #1c202a;
    --kumo-recessed: #232733;
    --kumo-border: #303644;
    --kumo-border-hover: #454d5f;
    --kumo-text-main: #f1f5f9;
    --kumo-text-muted: #b0b8c7;
    --kumo-text-subtle: #8490a3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, .3);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, .42);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #14b8a6 100%);
}
html.staff-portal[data-staff-theme='dark'],
html.staff-portal[data-staff-theme='dark'] body,
html.staff-portal[data-staff-theme='dark'] .bg-background,
html.staff-portal[data-staff-theme='dark'] .bg-surface { background-color: var(--kumo-bg) !important; color: var(--kumo-text-main); }
html.staff-portal[data-staff-theme='dark'] .bg-white,
html.staff-portal[data-staff-theme='dark'] .bg-surface-container-lowest { background-color: var(--kumo-surface) !important; }
html.staff-portal[data-staff-theme='dark'] .bg-surface-container-low { background-color: var(--kumo-elevated) !important; }
html.staff-portal[data-staff-theme='dark'] .bg-surface-container,
html.staff-portal[data-staff-theme='dark'] .bg-surface-container-high,
html.staff-portal[data-staff-theme='dark'] .bg-slate-100,
html.staff-portal[data-staff-theme='dark'] .bg-slate-200 { background-color: var(--kumo-recessed) !important; }
html.staff-portal[data-staff-theme='dark'] .bg-primary-fixed,
html.staff-portal[data-staff-theme='dark'] .bg-primary-fixed\/40 { background-color: #26245f !important; }
html.staff-portal[data-staff-theme='dark'] .bg-error-container,
html.staff-portal[data-staff-theme='dark'] .bg-error-container\/20,
html.staff-portal[data-staff-theme='dark'] .bg-error-container\/5,
html.staff-portal[data-staff-theme='dark'] .bg-red-50,
html.staff-portal[data-staff-theme='dark'] .bg-red-100 { background-color: #3a1820 !important; }
html.staff-portal[data-staff-theme='dark'] .bg-emerald-50,
html.staff-portal[data-staff-theme='dark'] .bg-emerald-100 { background-color: #123327 !important; }
html.staff-portal[data-staff-theme='dark'] .bg-amber-50,
html.staff-portal[data-staff-theme='dark'] .bg-amber-100 { background-color: #3b2a12 !important; }
html.staff-portal[data-staff-theme='dark'] .bg-blue-100 { background-color: #172a4d !important; }
html.staff-portal[data-staff-theme='dark'] .bg-purple-100 { background-color: #2e1d4e !important; }
html.staff-portal[data-staff-theme='dark'] .text-on-surface { color: var(--kumo-text-main) !important; }
html.staff-portal[data-staff-theme='dark'] .text-on-surface-variant { color: var(--kumo-text-muted) !important; }
html.staff-portal[data-staff-theme='dark'] .text-outline { color: var(--kumo-text-subtle) !important; }
html.staff-portal[data-staff-theme='dark'] .text-primary { color: #a5b4fc !important; }
html.staff-portal[data-staff-theme='dark'] .text-error,
html.staff-portal[data-staff-theme='dark'] .text-red-600,
html.staff-portal[data-staff-theme='dark'] .text-red-800 { color: #fda4af !important; }
html.staff-portal[data-staff-theme='dark'] .text-emerald-600,
html.staff-portal[data-staff-theme='dark'] .text-emerald-800 { color: #6ee7b7 !important; }
html.staff-portal[data-staff-theme='dark'] .text-amber-600,
html.staff-portal[data-staff-theme='dark'] .text-amber-700,
html.staff-portal[data-staff-theme='dark'] .text-amber-800,
html.staff-portal[data-staff-theme='dark'] .text-amber-900,
html.staff-portal[data-staff-theme='dark'] .text-amber-950 { color: #fcd34d !important; }
html.staff-portal[data-staff-theme='dark'] .text-blue-800 { color: #93c5fd !important; }
html.staff-portal[data-staff-theme='dark'] .text-purple-800 { color: #d8b4fe !important; }
html.staff-portal[data-staff-theme='dark'] .text-slate-700 { color: #cbd5e1 !important; }
html.staff-portal[data-staff-theme='dark'] .border-outline-variant,
html.staff-portal[data-staff-theme='dark'] .border-outline-variant\/70,
html.staff-portal[data-staff-theme='dark'] .border-slate-200 { border-color: var(--kumo-border) !important; }
html.staff-portal[data-staff-theme='dark'] input:not([type='checkbox']):not([type='radio']),
html.staff-portal[data-staff-theme='dark'] select,
html.staff-portal[data-staff-theme='dark'] textarea { border-color: var(--kumo-border); color: var(--kumo-text-main); background-color: var(--kumo-surface); }
html.staff-portal[data-staff-theme='dark'] input::placeholder,
html.staff-portal[data-staff-theme='dark'] textarea::placeholder { color: var(--kumo-text-subtle); }
html.staff-portal[data-staff-theme='dark'] option { color: var(--kumo-text-main); background: var(--kumo-surface); }
html.staff-portal[data-staff-theme='dark'] .data-table tbody tr:hover,
html.staff-portal[data-staff-theme='dark'] .monitoring-table tbody tr:hover { background: #202633; }
html.staff-portal[data-staff-theme='dark'] .session-select-row:hover td,
html.staff-portal[data-staff-theme='dark'] .session-select-row:focus-visible td { background: #232947; }
html.staff-portal[data-staff-theme='dark'] .sidebar-link-danger:hover { color: #fda4af; background: #3a1820; }
html.staff-portal[data-staff-theme='dark'] .status-success,
html.staff-portal[data-staff-theme='dark'] .badge-success { border-color: #166534; color: #6ee7b7; background: #123327; }
html.staff-portal[data-staff-theme='dark'] .status-warning,
html.staff-portal[data-staff-theme='dark'] .badge-warning { border-color: #854d0e; color: #fcd34d; background: #3b2a12; }
html.staff-portal[data-staff-theme='dark'] .status-danger,
html.staff-portal[data-staff-theme='dark'] .badge-danger { border-color: #9f1239; color: #fda4af; background: #3a1820; }
html.staff-portal[data-staff-theme='dark'] .badge-primary { border-color: #4f46e5; color: #c7d2fe; background: #26245f; }
html.staff-portal[data-staff-theme='dark'] .badge-neutral { border-color: #475569; color: #cbd5e1; background: #29303d; }
html.staff-portal[data-staff-theme='dark'] .app-dialog-root[data-tone='danger'] .app-dialog-icon { color: #fda4af; background: #3a1820; }
html.staff-portal[data-staff-theme='dark'] dialog { color: var(--kumo-text-main); }

@media (prefers-reduced-motion: reduce) {
    html.staff-portal { scroll-behavior: auto; }
    html.staff-portal .main-content > *,
    html.staff-portal .form-dialog[open] .form-dialog-panel,
    html.staff-portal .app-dialog-root[open] .app-dialog,
    html.staff-portal dialog[open]::backdrop { animation: none !important; }
    html.staff-portal *,
    html.staff-portal *::before,
    html.staff-portal *::after { transition-duration: .01ms !important; }
    html.staff-portal::view-transition-group(*) { animation-duration: .01ms; }
}

/* ============================================================
   Responsive Breakpoints
   ============================================================ */
@media (max-width: 900px) {
    .sidebar { width: min(280px, calc(100vw - 48px)); transform: translateX(-100%); }
    html.sidebar-collapsed .sidebar, body.sidebar-collapsed .sidebar { width: min(280px, calc(100vw - 48px)); padding: 18px 14px; }
    html.sidebar-collapsed .sidebar-text, body.sidebar-collapsed .sidebar-text,
    html.sidebar-collapsed .sidebar-session, body.sidebar-collapsed .sidebar-session { display: block; }
    html.sidebar-collapsed .sidebar-brand-row .brand-mark, body.sidebar-collapsed .sidebar-brand-row .brand-mark { display: flex; }
    html.sidebar-collapsed .sidebar-brand-row, body.sidebar-collapsed .sidebar-brand-row { justify-content: space-between; }
    html.sidebar-collapsed .sidebar-link, body.sidebar-collapsed .sidebar-link { justify-content: flex-start; padding-inline: 12px; }
    html.sidebar-collapsed .sidebar-user, body.sidebar-collapsed .sidebar-user { justify-content: flex-start; padding-inline: 6px; }
    .main-content, .sidebar-footer,
    html.sidebar-collapsed .main-content, body.sidebar-collapsed .main-content,
    html.sidebar-collapsed .sidebar-footer, body.sidebar-collapsed .sidebar-footer { margin-left: 0; }
    .mobile-sidebar-toggle { position: fixed; z-index: 30; top: max(12px, env(safe-area-inset-top)); left: 12px; display: inline-flex; border: 1px solid var(--kumo-border); background: var(--kumo-surface); box-shadow: var(--shadow-sm); }
    .sidebar-backdrop { position: fixed; z-index: 35; inset: 0; display: none; border: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(3px); }
    body.sidebar-mobile-open .sidebar { transform: translateX(0); }
    body.sidebar-mobile-open .sidebar-backdrop { display: block; }
    body.sidebar-mobile-open { overflow: hidden; }
    .has-sidebar .main-content { padding-top: 64px !important; }
    .has-sidebar .main-content.p-xl { padding: 64px 16px 24px !important; }
    .has-sidebar .main-content > .p-xl { padding: 16px !important; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-header { align-items: flex-start; flex-direction: column; }
    
    .exam-workspace { display: block; }
    .exam-palette { position: fixed; z-index: 50; inset: 0 0 0 auto; display: none; width: min(320px, calc(100vw - 40px)); padding: 16px; background: var(--kumo-bg); transform: none; }
    .exam-palette-backdrop { position: fixed; z-index: 45; inset: 0; border: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(3px); }
    .exam-palette-close { display: inline-flex; }
    body.exam-palette-open { overflow: hidden; }
    body.exam-palette-open .exam-palette { display: flex; }
    body.exam-palette-open .exam-palette-backdrop { display: block; }
}

@media (max-width: 560px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-item { border-bottom: 1px solid var(--kumo-border); }
    .stat-item:nth-child(2n) { border-right: 0; }
    .stat-item:nth-last-child(-n+2) { border-bottom: 0; }
}
