/* ============================================================
   UpFace v2.0 - Custom Styles
   Glass-morphism dark theme with modern animations
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --accent: #06b6d4;
    --accent-dark: #0891b2;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-dark: #dc2626;

    --bg-base: #0b1120;
    --bg-surface: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-elevated: rgba(30, 41, 59, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(255, 255, 255, 0.06);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(148, 163, 184, 0.1);
    --border-hover: rgba(148, 163, 184, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--primary-glow);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(99, 102, 241, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse 50% 60% at 50% 90%, rgba(245, 158, 11, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* ── App Shell Layout ──────────────────────────────────────── */
body,
#app-shell {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    transition: width var(--transition-base), transform var(--transition-base);
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-icon svg { width: 22px; height: 22px; color: white; }

.sidebar-brand-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 0.75rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-link.active svg { opacity: 1; }

.nav-link .badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.nav-link .pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin-left: auto;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Top Header ─────────────────────────────────────────── */
.header {
    padding: 1rem 1.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-left p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.825rem;
    outline: none;
    font-family: inherit;
    width: 160px;
    transition: width var(--transition-fast);
}

.search-box input:focus { width: 200px; }

.search-box input::placeholder { color: var(--text-muted); }

.search-box svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.header-clock {
    text-align: right;
    min-width: 100px;
}

.header-clock .time {
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.header-clock .date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.icon-btn svg { width: 18px; height: 18px; }

.icon-btn .notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

/* ── Page Container ─────────────────────────────────────── */
.page-container,
.page-section {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.page-container::-webkit-scrollbar,
.page-section::-webkit-scrollbar { width: 6px; }
.page-container::-webkit-scrollbar-track,
.page-section::-webkit-scrollbar-track { background: transparent; }
.page-container::-webkit-scrollbar-thumb,
.page-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.page-container::-webkit-scrollbar-thumb:hover,
.page-section::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 1.25rem;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ── Stat Cards ────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.blue { background: rgba(99, 102, 241, 0.12); color: var(--primary-light); }
.stat-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.stat-icon.amber { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.12); color: var(--accent); }
.stat-icon.red { background: rgba(239, 68, 68, 0.12); color: var(--danger); }

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.825rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5); transform: translateY(-1px); }

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-success:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5); transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5); transform: translateY(-1px); }

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9rem; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-surface); }

/* ── Table Wrapper (responsive scroll) ────────────────── */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.table-wrap::-webkit-scrollbar { height: 5px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Tables (global) ─────────────────────────────────── */
table, .data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead th,
.data-table thead th {
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: rgba(100, 116, 139, 0.04);
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

table tbody td,
.data-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(100, 116, 139, 0.08);
    vertical-align: middle;
    color: var(--text-secondary);
    line-height: 1.5;
}

table tbody tr,
.data-table tbody tr {
    transition: background var(--transition-fast);
}

table tbody tr:hover,
.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

table tbody tr:last-child td,
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Zebra striping (subtle) */
table tbody tr:nth-child(even) { background: rgba(100, 116, 139, 0.02); }
table tbody tr:nth-child(even):hover { background: rgba(99, 102, 241, 0.04); }

/* Cell emphasis helpers */
td.cell-primary, .cell-primary { color: var(--text-primary); font-weight: 600; }
td.cell-mono, .cell-mono       { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; letter-spacing: 0.02em; font-weight: 700; }
td.cell-right   { text-align: right; }
td.cell-center  { text-align: center; }

/* Empty state inside tables */
.empty-state { color: var(--text-muted); text-align: center; font-size: 0.85rem; padding: 2.5rem 1rem; }
.empty-state p { margin: 0; }

/* Text truncate utility */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Table User Cell (avatar + name) ──────────── */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.user-cell .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-cell .avatar.has-face {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.user-cell .avatar.no-face {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
}

.user-cell .user-name,
.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.83rem;
}

.user-cell .user-sub {
    font-size: 0.67rem;
    color: var(--success);
    margin-top: 1px;
}

/* ── Score Display ───────────────────────────────── */
.score-value {
    font-weight: 800;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.score-value.score-high { color: var(--success); }
.score-value.score-mid  { color: #f59e0b; }
.score-value.score-low  { color: var(--danger); }

/* ── Actions Cell ────────────────────────────────── */
.actions-cell {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    white-space: nowrap;
}

/* ── Participation Bar (inline progress) ───────── */
.participation-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.participation-bar .bar {
    flex: 1;
    height: 5px;
    background: rgba(100, 116, 139, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.participation-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.participation-bar .bar-label {
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 35px;
    text-align: right;
}

/* ── Badges ──────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--accent); }
.badge-muted { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.modal-content:has(.searchable-select) {
    overflow: visible;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
}
.modal-body .searchable-select { overflow: visible; }

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ── Camera ─────────────────────────────────────────── */
.camera-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    border: 2px solid var(--border);
    transition: border-color var(--transition-base);
}

.camera-wrapper.face-detected {
    border-color: var(--success);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.camera-wrapper video, .camera-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-wrapper canvas {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.camera-status {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.camera-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.camera-status .dot.active {
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

.camera-actions {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 10px;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(11, 17, 32, 0.9);
    z-index: 4;
    gap: 12px;
}

.camera-placeholder svg { width: 48px; height: 48px; color: var(--text-muted); opacity: 0.4; }
.camera-placeholder p { font-size: 0.85rem; color: var(--text-muted); }

/* ── Checkin Control Panel ─────────────────────────── */
.checkin-control-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
}
.checkin-control-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}
.checkin-control-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Select wrapper */
.checkin-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 280px;
    max-width: 380px;
    flex: 1;
}
.checkin-select-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-light);
    pointer-events: none;
    z-index: 1;
    display: flex;
}
.checkin-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: transform var(--transition-fast);
}
.checkin-select {
    width: 100%;
    padding: 0.65rem 2.2rem 0.65rem 2.6rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.checkin-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.checkin-select:focus ~ .checkin-select-arrow { transform: translateY(-50%) rotate(180deg); }
.checkin-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 8px;
}

/* Training meta (instructor, room, etc.) */
.checkin-training-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: opacity var(--transition-base);
}
.checkin-training-meta:empty { display: none; }
.checkin-training-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.checkin-training-meta .meta-item svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Start button */
.btn-checkin-start {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 1.25rem 0.6rem 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
}
.btn-checkin-start:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--primary-glow);
}
.btn-checkin-start:active { transform: translateY(0); }
.btn-checkin-start.active {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
}
.btn-checkin-start.active:hover {
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.35);
}
.btn-checkin-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    flex-shrink: 0;
}
.btn-checkin-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.btn-checkin-text span:first-child {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}
.btn-checkin-hint {
    font-size: 0.68rem;
    opacity: 0.7;
    font-weight: 400;
    line-height: 1.3;
}

/* Manual button */
.btn-checkin-manual {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.btn-checkin-manual:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ── Searchable Select Component ──────────────────── */
.searchable-select {
    position: relative;
    width: 100%;
}
.ss-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0.65rem 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    min-height: 42px;
}
.ss-trigger:hover { border-color: var(--border-hover); }
.ss-trigger:focus,
.ss-trigger.ss-open {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.ss-trigger.ss-open svg:last-child { transform: rotate(180deg); }
.ss-trigger svg:last-child { transition: transform var(--transition-fast); }
.ss-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
    user-select: none;
}
.ss-selected {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    animation: ssSlideDown 0.15s ease-out;
}
@keyframes ssSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.ss-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.ss-search {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.84rem;
}
.ss-search::placeholder { color: var(--text-muted); }
.ss-options {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.ss-options::-webkit-scrollbar { width: 4px; }
.ss-options::-webkit-scrollbar-track { background: transparent; }
.ss-options::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.ss-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.ss-option:hover { background: var(--bg-hover); }
.ss-option-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.ss-option-info { min-width: 0; flex: 1; }
.ss-option-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-option-reg {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}
.ss-empty {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Camera placeholder v2 */
.camera-placeholder-v2 {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(11, 17, 32, 0.95);
    z-index: 4;
    gap: 12px;
    padding: 2rem;
}
.camera-ph-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    opacity: 0.5;
    animation: phPulse 3s ease-in-out infinite;
}
@keyframes phPulse {
    0%, 100% { border-color: var(--border); opacity: 0.5; }
    50% { border-color: var(--primary); opacity: 0.8; }
}
.camera-ph-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.camera-ph-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 320px;
    line-height: 1.5;
}
.camera-ph-steps {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.25rem;
}
.camera-ph-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.camera-ph-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .checkin-control-panel {
        flex-direction: column;
        align-items: stretch;
    }
    .checkin-control-right {
        justify-content: stretch;
    }
    .btn-checkin-start { flex: 1; justify-content: center; }
    .btn-checkin-manual { flex: 0; }
    .checkin-select-wrapper { min-width: 100%; max-width: 100%; }
    .camera-ph-steps { flex-direction: column; gap: 0.75rem; }
}

/* ── Camera Container (check-in page) ────────────────── */
.camera-container {
    position: relative;
    background: var(--bg-base);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    max-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera-container canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Check-in page 2-column layout */
.checkin-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}
.checkin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.checkin-sidebar .recent-list {
    flex: 1;
    overflow-y: auto;
    max-height: 340px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.checkin-sidebar .recent-list::-webkit-scrollbar { width: 4px; }
.checkin-sidebar .recent-list::-webkit-scrollbar-track { background: transparent; }
.checkin-sidebar .recent-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Detection card - ensure content is fully visible */
.checkin-sidebar .card {
    overflow: visible;
    flex-shrink: 0;
}
.checkin-sidebar .card:last-child {
    flex-shrink: 1;
    overflow: hidden;
    min-height: 120px;
}

@media (max-width: 900px) {
    .checkin-layout {
        grid-template-columns: 1fr;
    }
    .camera-container {
        max-height: 360px;
    }
}

/* ── Progress Bar ───────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
    background: var(--primary);
}

.progress-fill.green { background: var(--success); }
.progress-fill.amber { background: var(--warning); }
.progress-fill.red { background: var(--danger); }

/* ── Room Cards ─────────────────────────────────────── */
.room-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}
.room-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* top colour strip */
.room-card .room-strip {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.room-card.room-inactive .room-strip {
    background: var(--border);
}

.room-card .room-body {
    padding: 1.25rem 1.25rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* header row: icon + name/location + badge */
.room-card .room-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 1.15rem;
}
.room-card .room-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--primary-glow);
    color: var(--primary-light);
}
.room-card.room-inactive .room-icon {
    background: rgba(100,116,139,0.12);
    color: var(--text-muted);
}
.room-card .room-icon svg { width: 20px; height: 20px; }
.room-card .room-title {
    flex: 1;
    min-width: 0;
}
.room-card .room-title h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-card .room-title span {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* KPI metric row */
.room-card .room-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 1rem;
}
.room-card .room-metric {
    text-align: center;
    padding: 10px 4px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.room-card .room-metric:hover {
    background: var(--bg-hover);
}
.room-card .room-metric .metric-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 3px;
}
.room-card .room-metric .metric-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

/* occupation bar */
.room-card .room-occupation {
    margin-bottom: 1rem;
}
.room-card .room-occupation .occ-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    margin-bottom: 5px;
}
.room-card .room-occupation .occ-label { color: var(--text-muted); }
.room-card .room-occupation .occ-pct   { font-weight: 700; }
.room-card .room-occupation .occ-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.room-card .room-occupation .occ-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
}

/* footer actions */
.room-card .room-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

/* ── Confidence ──────────────────────────────────────── */
.confidence-value {
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 48px;
}

/* ── Activity / Log ─────────────────────────────────── */
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
    animation: slide-in 0.3s ease forwards;
}

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

@keyframes slide-in {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.activity-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.activity-avatar img { width: 100%; height: 100%; object-fit: cover; }

.activity-info { flex: 1; min-width: 0; }
.activity-info .name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-info .time { font-size: 0.7rem; color: var(--text-muted); }

.activity-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
    flex-shrink: 0;
}

/* ── Toast ───────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    min-width: 300px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.4s ease;
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--primary);
    animation: toast-timer 4s linear forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-timer {
    from { width: 100%; }
    to { width: 0; }
}

.toast.removing {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(60px) scale(0.95); }
}

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--danger); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.info { color: var(--primary-light); }

.toast-text { font-size: 0.8rem; font-weight: 500; line-height: 1.4; }

/* ── Success Banner (Full screen) ──────────────────── */
.success-banner {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.success-banner.active {
    opacity: 1;
    visibility: visible;
}

.success-content {
    text-align: center;
    animation: success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes success-pop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-icon-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.4);
}

.success-icon-lg svg { width: 48px; height: 48px; color: white; }

.success-banner h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.success-banner .sub { color: var(--text-secondary); font-size: 1rem; }

/* ── Loading ─────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transition: opacity var(--transition-slow);
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: 0.3; }
.empty-state p { font-size: 0.85rem; }

/* ── User Card Grid ──────────────────────────────────── */
.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.user-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0.08;
}

.user-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }

.user-card-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 12px;
    overflow: hidden;
    border: 3px solid var(--border);
    position: relative;
    z-index: 1;
    background: var(--bg-base);
}

.user-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Page Fade ───────────────────────────────────────── */
.page-section {
    animation: page-fade 0.35s ease;
}

@keyframes page-fade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-section.hidden { display: none; }

/* ── Grid Utilities ──────────────────────────────────── */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

/* ── Detection Panel ─────────────────────────────────── */
.detection-panel {
    text-align: center;
    padding: 1rem 0.75rem;
}

.detection-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 0.6rem;
    overflow: hidden;
    border: 3px solid var(--primary-glow);
    background: var(--bg-base);
    box-shadow: 0 0 20px var(--primary-glow);
}

.detection-avatar img { width: 100%; height: 100%; object-fit: cover; }

.detection-name { font-size: 1rem; font-weight: 700; margin-bottom: 2px; color: var(--text-primary); }
.detection-time { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.confidence-meter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 0.5rem;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 50;
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 49;
        display: none;
    }

    .sidebar-backdrop.active { display: block; }

    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }

    .search-box input { width: 120px; }
    .search-box input:focus { width: 150px; }

    .header { padding: 0.75rem 1rem; }
    .page-container { padding: 1rem; }
}

/* ── Utility ──────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
