/* ══════════════════════════════════════════════════════════
   FaceEngine Dashboard — Design System & Styles
   ══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #222842;
    --bg-input: #151b30;
    --border: #2a3050;
    --border-light: #363f60;
    --text-primary: #e8ecf4;
    --text-secondary: #8892a8;
    --text-muted: #5a6478;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-teal: #14b8a6;
    --accent-pink: #ec4899;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }

.logo { display: flex; align-items: center; gap: 12px; }

.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(59,130,246,0.3);
}
.logo-icon .material-symbols-rounded { font-size: 24px; color: #fff; }

.logo-text h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.logo-text .version { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.nav-section { padding: 16px 12px 8px; }
.nav-label { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 1.5px; padding: 0 12px; margin-bottom: 6px; display: block; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: all var(--transition);
    position: relative;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.1));
    color: var(--accent-blue);
}
.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 24px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}
.nav-item .material-symbols-rounded { font-size: 20px; }

.badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px; font-weight: 700;
    background: var(--border);
    color: var(--text-secondary);
}
.badge.danger { background: var(--accent-red); color: #fff; }
.badge.pulse { animation: pulse 2s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.system-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.status-dot.offline { background: var(--accent-red); }

/* ─── Main Content ─── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── Topbar ─── */
.topbar {
    height: var(--topbar-height);
    padding: 0 28px;
    display: flex; align-items: center; gap: 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }
.topbar-title h2 { font-size: 18px; font-weight: 700; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.mode-selector { display: flex; gap: 4px; background: var(--bg-card); border-radius: var(--radius-sm); padding: 3px; }
.mode-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    border: none; border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.mode-btn .material-symbols-rounded { font-size: 16px; }
.mode-btn:hover { color: var(--text-primary); }
.mode-btn.active { background: var(--accent-blue); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.3); }

.datetime { font-size: 13px; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }

/* ─── Pages ─── */
.page { display: none; padding: 24px 28px; flex: 1; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
.page#page-live-view { padding: 16px 20px; }
.page#page-live-view.active { display: flex; flex-direction: column; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 20px;
    border-radius: var(--radius);
    display: flex; align-items: center; gap: 16px;
    position: relative; overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
}

.gradient-blue { background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(59,130,246,0.05)); }
.gradient-green { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05)); }
.gradient-purple { background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(139,92,246,0.05)); }
.gradient-red { background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(239,68,68,0.05)); }
.gradient-teal { background: linear-gradient(135deg, rgba(20,184,166,0.15), rgba(20,184,166,0.05)); }
.gradient-orange { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.05)); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05);
}
.stat-icon .material-symbols-rounded { font-size: 24px; }
.gradient-blue .stat-icon { color: var(--accent-blue); }
.gradient-green .stat-icon { color: var(--accent-green); }
.gradient-purple .stat-icon { color: var(--accent-purple); }
.gradient-red .stat-icon { color: var(--accent-red); }
.gradient-teal .stat-icon { color: var(--accent-teal); }
.gradient-orange .stat-icon { color: var(--accent-orange); }

.stat-value { font-size: 28px; font-weight: 800; display: block; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-top: 4px; }

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h3 .material-symbols-rounded { font-size: 18px; color: var(--accent-blue); }
.card-body { padding: 16px 20px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Data Table ─── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px;
    font-size: 11px; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(42,48,80,0.5);
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }

/* ─── Status Badges ─── */
.status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.status-badge.present { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.status-badge.late { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.status-badge.absent { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.status-badge.authorized { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.status-badge.unauthorized { background: rgba(239,68,68,0.15); color: var(--accent-red); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.btn .material-symbols-rounded { font-size: 18px; }
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #2563eb; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent-blue); }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Inputs ─── */
.input-field, .input-select, .input-date {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px; font-family: inherit;
    transition: border-color var(--transition);
}
.input-field:focus, .input-select:focus, .input-date:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.input-select { cursor: pointer; }
.input-date { max-width: 200px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

/* ─── Live View (Fullscreen HD) ─── */
.live-container { display: flex; gap: 0; height: calc(100vh - var(--topbar-height)); width: 100%; position: relative; }

.live-feed-wrapper { flex: 1; position: relative; overflow: hidden; background: #000; min-height: 0; }
.live-feed { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #000; }
.live-feed img { width: 100%; height: 100%; object-fit: contain; display: block; }
.live-feed img.hidden { display: none; }

.live-overlay {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 12px 16px;
    display: flex; justify-content: space-between; align-items: flex-start;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 100%);
    z-index: 10;
}
.live-overlay > * { pointer-events: auto; }
.live-indicator {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(239,68,68,0.9);
    border-radius: 6px;
    font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
    box-shadow: 0 2px 10px rgba(239,68,68,0.4);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1s infinite; }
.live-stats {
    font-size: 13px; font-weight: 600;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 6px;
    display: flex; align-items: center; gap: 12px;
}

/* Live controls bar at bottom */
.live-controls {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 10px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
    display: flex; justify-content: flex-end; align-items: center; gap: 8px;
    z-index: 10;
}
.live-control-btn {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}
.live-control-btn:hover { background: rgba(255,255,255,0.25); }
.live-control-btn .material-symbols-rounded { font-size: 20px; }

/* Collapsible detected faces sidebar */
.live-sidebar {
    width: 300px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    transition: width var(--transition), opacity var(--transition);
    flex-shrink: 0;
}
.live-sidebar.collapsed { width: 0; overflow: hidden; opacity: 0; border: none; }

/* Fullscreen mode */
.fullscreen-mode .sidebar { transform: translateX(-100%); }
.fullscreen-mode .main-content { margin-left: 0; }
.fullscreen-mode .topbar { display: none; }
.fullscreen-mode .live-container { height: 100vh; }
.fullscreen-mode .live-sidebar { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; box-shadow: -4px 0 20px rgba(0,0,0,0.5); }

/* ─── Person & Camera Grids ─── */
.page-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.persons-grid, .cameras-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.person-card, .camera-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}
.person-card:hover, .camera-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: var(--shadow); }

.person-card .person-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.person-card .person-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}
.person-card .person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.embedding-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}
.embedding-badge.trained-high {
    color: var(--accent-green);
    border-color: rgba(0, 220, 100, 0.35);
    background: rgba(0, 220, 100, 0.10);
}
.embedding-badge.trained-partial {
    color: var(--accent-orange);
    border-color: rgba(255, 165, 0, 0.35);
    background: rgba(255, 165, 0, 0.10);
}
.sync-progress-box {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02);
}
.sync-progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin: 8px 0;
}
.sync-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    transition: width 250ms ease;
}
.sync-student-list {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.person-card .person-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.person-card .person-role { font-size: 12px; color: var(--text-secondary); text-transform: capitalize; }
.person-card .person-meta { margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.person-card .person-actions { margin-top: 14px; display: flex; gap: 8px; }

.camera-card .camera-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.camera-card .camera-location { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.camera-card .camera-status { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 12px; }
.camera-card .camera-actions { display: flex; gap: 8px; }

/* ─── Alerts ─── */
.alerts-feed { display: flex; flex-direction: column; gap: 12px; }
.alert-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}
.alert-item:hover { border-color: var(--border-light); }
.alert-item.severity-critical { border-left: 3px solid var(--accent-red); }
.alert-item.severity-high { border-left: 3px solid var(--accent-orange); }
.alert-item.severity-medium { border-left: 3px solid var(--accent-purple); }
.alert-item.severity-low { border-left: 3px solid var(--accent-blue); }

.alert-icon { font-size: 24px; margin-top: 2px; }
.alert-item.severity-critical .alert-icon { color: var(--accent-red); }
.alert-item.severity-high .alert-icon { color: var(--accent-orange); }
.alert-item .alert-info { flex: 1; }
.alert-item .alert-type { font-size: 13px; font-weight: 700; text-transform: capitalize; }
.alert-item .alert-message { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.alert-item .alert-time { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ─── Activity Feed ─── */
.activity-feed { max-height: 350px; overflow-y: auto; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(42,48,80,0.3); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.activity-dot.known { background: var(--accent-green); }
.activity-dot.unknown { background: var(--accent-red); }
.activity-text { font-size: 13px; flex: 1; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ─── Faces List (Live View Sidebar) ─── */
.face-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(42,48,80,0.3);
}
.face-item:last-child { border-bottom: none; }
.face-thumb {
    width: 40px; height: 40px; border-radius: 8px;
    background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.face-item .face-name { font-size: 13px; font-weight: 600; }
.face-item .face-confidence { font-size: 11px; color: var(--text-secondary); }

/* ─── Empty State ─── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}
.empty-state .material-symbols-rounded { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }
.empty-state small { font-size: 12px; margin-top: 6px; }
.empty-state.large .material-symbols-rounded { font-size: 72px; }
.empty-state.small { padding: 20px; }
.empty-state.small .material-symbols-rounded { font-size: 32px; }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 200;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: 6px; transition: all var(--transition); }
.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }
.modal-body { padding: 24px; max-height: calc(100vh - 140px); overflow-y: auto; }

/* ─── Image Upload Preview ─── */
.image-preview { margin-top: 12px; }
.image-preview:empty { display: none; }
.image-preview-header {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--text-secondary); margin-bottom: 10px;
}
.image-preview-clear {
    background: none; border: none; color: var(--accent-red);
    font-size: 12px; font-weight: 600; cursor: pointer;
    padding: 2px 8px; border-radius: 6px; transition: background var(--transition);
}
.image-preview-clear:hover { background: rgba(239, 68, 68, 0.12); }
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
}
.image-preview-item {
    position: relative; aspect-ratio: 1;
    border-radius: var(--radius-sm); overflow: hidden;
    border: 1px solid var(--border); background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    animation: previewIn 0.3s ease both;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.image-preview-item:hover { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.image-preview-item img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform var(--transition);
}
.image-preview-item:hover img { transform: scale(1.06); }
.image-preview-item.invalid { color: var(--text-muted); }
.image-preview-item.invalid > .material-symbols-rounded { font-size: 28px; margin-bottom: 14px; }
.image-preview-meta {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 16px 6px 4px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    font-size: 10px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.image-preview-remove {
    position: absolute; top: 5px; right: 5px;
    width: 22px; height: 22px; border-radius: 50%;
    border: none; background: rgba(10, 14, 26, 0.75); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transform: scale(0.85);
    transition: all var(--transition);
}
.image-preview-remove .material-symbols-rounded { font-size: 14px; }
.image-preview-item:hover .image-preview-remove,
.image-preview-remove:focus-visible { opacity: 1; transform: none; }
.image-preview-remove:hover { background: var(--accent-red); }
@media (hover: none) { .image-preview-remove { opacity: 1; transform: none; } }
@keyframes previewIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }

/* Enlarged preview on thumbnail hover */
.image-hover-preview {
    position: fixed; top: 0; left: 0; z-index: 250;
    display: flex; flex-direction: column;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59, 130, 246, 0.15);
    pointer-events: none;
    opacity: 0; visibility: hidden;
    transform: translateY(4px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.image-hover-preview.visible { opacity: 1; visibility: visible; transform: none; }
.image-hover-preview[data-placement="bottom"] { transform-origin: top center; }
.image-hover-preview[data-placement="top"] { transform-origin: bottom center; }
.image-hover-preview img {
    display: block;
    max-width: min(380px, 85vw); max-height: min(340px, 60vh);
    width: auto; height: auto;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}
.image-hover-caption {
    width: 0; min-width: 100%;
    padding: 6px 4px 2px;
    font-size: 11px; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (hover: none) { .image-hover-preview { display: none; } }

/* ─── Toast ─── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }

.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 4.7s forwards;
    max-width: 380px;
}
.toast .material-symbols-rounded { font-size: 20px; }
.toast.success .material-symbols-rounded { color: var(--accent-green); }
.toast.error .material-symbols-rounded { color: var(--accent-red); }
.toast.warning .material-symbols-rounded { color: var(--accent-orange); }

@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .live-container { flex-direction: column; }
    .live-sidebar { width: 100%; }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .mode-selector { display: none; }
    .page { padding: 16px; }
}

/* ─── Ghost / icon buttons (used app-wide; was previously undefined) ─── */
.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}
.btn-ghost:focus-visible, .btn-primary:focus-visible {
    outline: 2px solid var(--accent-blue); outline-offset: 2px;
}
.btn-icon {
    width: 34px; height: 34px; padding: 0; justify-content: center;
}
.btn-icon .material-symbols-rounded { font-size: 19px; }

/* ─── Live View toolbar ─── */
.live-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 14px; padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.live-toolbar-group { display: flex; align-items: center; gap: 8px; }
.live-toolbar-label {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-muted); margin-right: 2px;
}
.live-toolbar-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* segmented control for grid layout */
.seg-control {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 9px;
}
.seg-control .btn {
    padding: 5px 12px; font-size: 12px; border-radius: 6px;
    border: 1px solid transparent; background: transparent; color: var(--text-secondary);
}
.seg-control .btn:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.seg-control .btn.active,
.seg-control .btn.btn-primary {
    background: var(--accent-blue); color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.live-quality-select {
    width: auto; height: 34px; padding: 0 30px 0 12px; font-size: 12.5px;
}

/* ─── Box colour legend popover ─── */
.box-legend-wrap { position: relative; }
.box-legend-btn { height: 34px; padding: 0 12px; font-size: 12.5px; gap: 8px; }
.box-legend-btn.active {
    color: var(--text-primary); border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.12);
}
.box-legend-btn-dots { display: inline-flex; align-items: center; }
.box-legend-btn-dots i {
    display: inline-block; width: 10px; height: 10px; border-radius: 3px;
    margin-left: -3px; border: 2px solid var(--bg-card);
}
.box-legend-btn-dots i:first-child { margin-left: 0; }

.box-legend-panel {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 300;
    width: 360px; max-height: min(560px, calc(100vh - 160px)); overflow-y: auto;
    padding: 14px;
    background: rgba(17, 24, 39, 0.94);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light); border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top right;
    transition: opacity .18s ease, transform .18s ease;
}
.box-legend-panel[hidden] { display: none; }
.box-legend-panel.open { opacity: 1; transform: none; }

.box-legend-head {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
    font-size: 14px; color: var(--text-primary);
}
.box-legend-head .material-symbols-rounded { font-size: 18px; color: var(--accent-blue); }
.box-legend-close {
    margin-left: auto; display: flex; padding: 3px; border-radius: 6px;
    background: none; border: none; cursor: pointer; color: var(--text-secondary);
}
.box-legend-close:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.07); }
.box-legend-close .material-symbols-rounded { font-size: 18px; color: inherit; }

.box-legend-section {
    margin: 12px 0 4px; font-size: 10.5px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
}
.box-legend-list { list-style: none; margin: 0; padding: 0; }
.box-legend-list li {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 8px; border-radius: 8px; transition: background .15s;
}
.box-legend-list li:hover { background: rgba(255, 255, 255, 0.04); }
.box-legend-list li > div { min-width: 0; }
.box-legend-list b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.box-legend-list small { display: block; font-size: 11px; line-height: 1.35; color: var(--text-secondary); }

/* swatch = miniature of the box drawn on the video */
.lg-swatch {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 3px;
    border: 2px solid var(--c);
    background: color-mix(in srgb, var(--c) 14%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--c) 40%, transparent);
}
.lg-swatch-thick { border-width: 4px; }
.lg-swatch-body { width: 16px; height: 26px; margin: 0 3px; }

.box-legend-note {
    display: flex; gap: 8px; margin-top: 12px; padding: 10px;
    font-size: 11.5px; line-height: 1.45; color: var(--text-secondary);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.28); border-radius: 9px;
}
.box-legend-note b { font-weight: 600; color: var(--text-primary); }
.box-legend-note .material-symbols-rounded { flex: 0 0 auto; font-size: 17px; color: var(--accent-orange); }

@media (max-width: 640px) {
    .box-legend-panel { position: fixed; top: 70px; left: 12px; right: 12px; width: auto; }
}

/* ─── Person Media & Embeddings Inspector ─── */
.modal.modal-wide { max-width: min(980px, 95vw); }
.person-avatar.clickable {
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.person-avatar.clickable:hover {
    transform: scale(1.06);
    box-shadow: 0 0 0 2px var(--accent-blue);
}
button.embedding-badge {
    border-style: solid;
    font-family: inherit;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease;
}
button.embedding-badge:hover { transform: translateY(-1px); filter: brightness(1.15); }

.inspector-banner {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.inspector-banner-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.inspector-banner-title { font-size: 16px; font-weight: 700; }
.inspector-banner-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.inspector-banner-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.inspector-tabs {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.inspector-tab-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 8px;
    background: var(--bg-input); color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all var(--transition);
}
.inspector-tab-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.inspector-tab-btn.active {
    background: var(--accent-blue); color: #fff; border-color: var(--accent-blue);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
}
.inspector-tab-count {
    font-size: 11px; padding: 1px 7px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}
.inspector-tab-btn:not(.active) .inspector-tab-count {
    background: rgba(255, 255, 255, 0.06); color: var(--text-muted);
}

.inspector-section-title {
    font-size: 12px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted);
    margin: 14px 0 10px;
}
.source-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.source-photo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex; flex-direction: column;
}
.source-photo-thumb {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    display: block; background: var(--bg-input); cursor: zoom-in;
}
.source-photo-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.source-photo-name {
    font-size: 12.5px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.source-photo-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; }

.aligned-crops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}
.aligned-crop-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex; flex-direction: column;
}
.aligned-crop-thumb {
    position: relative; aspect-ratio: 1; background: var(--bg-input);
}
.aligned-crop-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.aligned-crop-tag {
    position: absolute; top: 4px; left: 4px;
    padding: 1px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 700;
    background: rgba(10, 14, 26, 0.82); color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.14);
}
.aligned-crop-meta {
    padding: 5px 7px; font-size: 10.5px; color: var(--text-secondary);
    display: flex; justify-content: space-between; gap: 4px;
}

.enrolled-videos-list { display: flex; flex-direction: column; gap: 14px; }
.enrolled-video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.enrolled-video-head {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px; margin-bottom: 10px;
}
.enrolled-video-player {
    width: 100%; max-height: 460px; border-radius: 8px;
    background: #000; display: block;
}

.embeddings-summary-bar {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 12px;
}
.inspector-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    background: var(--bg-input); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.inspector-pill.ok {
    background: rgba(16, 185, 129, 0.14); color: #34d399;
    border-color: rgba(16, 185, 129, 0.35);
}
.inspector-pill.warn {
    background: rgba(245, 158, 11, 0.14); color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}
.inspector-pill.info {
    background: rgba(59, 130, 246, 0.14); color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.35);
}

.embeddings-list { display: flex; flex-direction: column; gap: 8px; }
.embedding-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.embedding-row-main {
    display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
}
.embedding-row-thumb {
    width: 48px; height: 48px; border-radius: 8px;
    overflow: hidden; flex: 0 0 auto;
    background: var(--bg-input); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent-blue);
}
.embedding-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.embedding-row-info { flex: 1 1 220px; min-width: 0; }
.embedding-row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.embedding-row-stats { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.embedding-row-preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px; color: var(--text-muted); margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.embedding-barcode-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.embedding-barcode {
    width: 220px; height: 24px; border-radius: 4px;
    background: var(--bg-input); border: 1px solid var(--border);
}
.embedding-vector-drawer {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border);
    display: none;
}
.embedding-vector-drawer.open { display: block; }
.embedding-vector-actions {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; margin-bottom: 6px; font-size: 11.5px; color: var(--text-secondary);
}
.embedding-vector-values {
    max-height: 170px; overflow-y: auto;
    padding: 8px 10px; border-radius: 6px;
    background: var(--bg-input); border: 1px solid var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px; line-height: 1.5; color: #cbd5e1;
    word-break: break-all;
}

.live-candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.live-candidate-card {
    background: var(--bg-card);
    border: 1px solid rgba(245, 158, 11, 0.38);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.live-candidate-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-input);
}
.live-candidate-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.live-candidate-stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.live-candidate-score {
    font-size: 11.5px;
    font-weight: 700;
    color: #fbbf24;
}
.live-candidate-sub {
    font-size: 10.5px;
    color: var(--text-secondary);
}
.live-candidate-actions {
    display: flex;
    gap: 6px;
}
.live-candidate-actions .btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 4px 6px;
    font-size: 11px;
}

/* ─── Persons Directory Table & Admission Badges ─── */
.persons-toolbar {
    justify-content: space-between;
    gap: 12px;
}
.persons-toolbar-left,
.persons-toolbar-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.persons-search-input {
    width: 240px;
    padding: 8px 12px;
    font-size: 13px;
}
.persons-filter-select {
    width: auto;
    min-width: 150px;
    padding: 8px 12px;
    font-size: 13px;
}
.persons-count-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.persons-table-wrap {
    padding: 0;
    overflow-x: auto;
}
.persons-table th,
.persons-table td {
    vertical-align: middle;
}
.person-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}
.person-avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.person-name-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.person-name-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}
.person-role-cell {
    text-transform: capitalize;
    color: var(--text-secondary);
}
.person-table-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.table-actions .btn-sm {
    padding: 5px 9px;
}
.table-actions .btn-sm .material-symbols-rounded {
    font-size: 16px;
}
.admission-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    font-weight: 600;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.3);
    white-space: nowrap;
}
.admission-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid rgba(148, 163, 184, 0.3);
    white-space: nowrap;
}
.admission-type-badge.is-ac-hostel {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.16);
    border-color: rgba(139, 92, 246, 0.35);
}
.admission-type-badge.is-hostel {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
}
.admission-type-badge.is-day-scholar {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.35);
}
.person-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.input-with-action {
    display: flex;
    gap: 8px;
    align-items: center;
}
.input-with-action .input-field {
    flex: 1;
}
.input-with-action .btn {
    white-space: nowrap;
}
.form-hint {
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--text-secondary);
    min-height: 16px;
}
.text-muted {
    color: var(--text-muted);
}

/* ─── Live View Recognized Roster ─── */
.live-workspace {
    display: flex;
    gap: 12px;
    align-items: stretch;
    min-height: 0;
}
.live-roster-panel {
    width: 310px;
    flex-shrink: 0;
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}
.live-roster-panel.collapsed {
    display: none;
}
.live-roster-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.live-roster-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.live-roster-item:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
}
.live-roster-info {
    flex: 1;
    min-width: 0;
}
.live-roster-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.live-roster-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-roster-score {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-green);
    flex-shrink: 0;
}
.live-roster-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}
.live-roster-badges .admission-code-badge,
.live-roster-badges .admission-type-badge {
    font-size: 10.5px;
    padding: 2px 7px;
}
.live-roster-class {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}
.class-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.class-section-badge.is-class {
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
}
.class-section-badge.is-section {
    color: #5eead4;
    border-color: rgba(20, 184, 166, 0.28);
    background: rgba(20, 184, 166, 0.09);
}

/* ─── PPE Compliance Command Center ─── */
.ppe-toolbar {
    justify-content: space-between;
    gap: 12px;
}
.ppe-live-workspace {
    display: flex;
    gap: 14px;
    align-items: stretch;
}
.ppe-live-grid {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 12px;
}
.ppe-cam-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ppe-cam-video {
    position: relative;
    background: #000;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ppe-cam-video img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.ppe-cam-meta {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.ppe-cam-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}
.ppe-live-roster {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    max-height: 460px;
}
.ppe-roster-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}
.ppe-roster-header span {
    font-size: 11px;
    color: var(--text-secondary);
}
.ppe-roster-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ppe-person-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
}
.ppe-person-row.has-violation {
    border-color: rgba(239, 68, 68, 0.55);
}
.ppe-person-row.is-compliant {
    border-color: rgba(16, 185, 129, 0.45);
}
.ppe-item-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}
.ppe-item-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.ppe-item-pill.worn {
    color: #34d399;
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
}
.ppe-item-pill.missing {
    color: #f87171;
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
}
.ppe-check-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
}
.ppe-check-preview {
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
    max-height: 440px;
    display: flex;
    justify-content: center;
}
.ppe-check-preview img {
    max-width: 100%;
    max-height: 440px;
    object-fit: contain;
    display: block;
}
.ppe-violation-row {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.ppe-evidence-thumb {
    width: 68px;
    height: 52px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border);
    cursor: zoom-in;
    flex-shrink: 0;
    background: var(--bg-input);
}
@media (max-width: 1024px) {
    .ppe-live-workspace {
        flex-direction: column;
    }
    .ppe-live-roster {
        width: 100%;
        max-height: 300px;
    }
}
@media (max-width: 1100px) {
    .live-workspace {
        flex-direction: column;
    }
    .live-roster-panel {
        width: 100%;
        height: 260px;
    }
}
