@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --navy: #0f172a;
    --navy-light: #1e293b;
    --slate-600: #475569;
    --slate-400: #94a3b8;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
    overflow-x: hidden;
    width: 100%;
}
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--slate-50);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}
/* Safety net: nothing should ever be able to force the page itself wider than the
   viewport — any element that genuinely needs more room (a wide table) must
   scroll within its own .table-wrapper instead, never the whole page. */
img, video { max-width: 100%; height: auto; }
.card, .stat-card, .alert { max-width: 100%; }

/* Container — Full width & uniform 4-side padding */
.container {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 24px !important;
}

/* Modern Top Navigation Bar */
.topbar {
    background: var(--navy);
    color: #fff;
    padding: 0 24px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand-area {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}
.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}
.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.brand-badge {
    background: rgba(255, 255, 255, 0.12);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    color: #93c5fd;
    font-weight: 600;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.topbar-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.topbar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.topbar-nav a.active {
    background: rgba(37, 99, 235, 0.3);
    color: #93c5fd;
    font-weight: 600;
}
.user-pill {
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 13px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}
.user-pill .avatar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}
.session-timer-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 13px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    font-family: monospace;
    font-weight: 600;
}

/* Modern Card */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    row-gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--slate-100);
}
/* The action button group inside a .card-header (e.g. "HR Workflow Guide" +
   "Create Training"). A dedicated class instead of an inline style so its
   layout is fully controlled from this one external stylesheet. */
.card-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* KPI Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-left: 4px solid var(--slate-300);
}
.stat-card.blue { border-left: 4px solid #2563eb; }
.stat-card.purple { border-left: 4px solid #8b5cf6; }
.stat-card.green { border-left: 4px solid #10b981; }
.stat-card.amber { border-left: 4px solid #f59e0b; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #ecfdf5; color: #10b981; }
.stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.stat-icon.amber { background: #fffbeb; color: #f59e0b; }
.stat-info .stat-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.1;
}
.stat-info .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* Typography & Headings */
h1 { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
h3 { font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
p { color: var(--text-muted); font-size: 14px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: 1px solid transparent;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(29, 78, 216, 0.2);
}
.btn:active { transform: translateY(0); }
.btn-secondary {
    background: #fff;
    color: var(--slate-600);
    border-color: var(--slate-200);
}
.btn-secondary:hover {
    background: var(--slate-50);
    color: var(--navy);
    box-shadow: var(--shadow-sm);
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #059669;
    box-shadow: 0 3px 6px rgba(16, 185, 129, 0.25);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 5px;
}
.btn-block {
    display: flex;
    width: 100%;
}

/* Forms & Inputs */
label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--navy);
    letter-spacing: -0.01em;
}
input[type=text], input[type=email], input[type=date], input[type=time],
input[type=number], input[type=password], input[type=file], select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--navy);
    background: #fff;
    font-family: inherit;
    transition: all 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea { resize: vertical; min-height: 80px; }

/* Filter & Search Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}
.search-box input {
    padding-left: 36px;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-400);
    pointer-events: none;
    font-size: 14px;
}

/* Tables */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: #fff;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}
th {
    background: var(--slate-50);
    color: var(--slate-600);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-200);
    white-space: nowrap;
}
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-600);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-red { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-orange { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-blue { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-purple { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Stepper / Steps */
.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}
.step-item {
    flex: 1;
    text-align: center;
    position: relative;
}
.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--slate-200);
    z-index: 1;
}
.step-item.completed:not(:last-child)::after {
    background: var(--success);
}
.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--slate-200);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--slate-400);
    position: relative;
    z-index: 2;
    transition: all 0.2s ease;
}
.step-item.active .step-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}
.step-item.completed .step-circle {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}
.step-label {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-400);
}
.step-item.active .step-label { color: var(--primary); }
.step-item.completed .step-label { color: var(--navy); }

/* MCQ Test & Option Cards */
.mcq-option {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14.5px;
}
.mcq-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.mcq-option input[type=radio] {
    margin-right: 14px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Timer Sticky Box */
.timer-pill {
    position: sticky;
    top: 76px;
    z-index: 40;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 30px;
    padding: 10px 22px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: var(--navy);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.timer-pill.urgent {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Floating Toast Notification */
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--navy);
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px 20px;
    position: fixed;
    z-index: 999;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}
#toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 40px;
}

/* Video Wrapper */
.video-frame {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.video-frame video {
    width: 100%;
    display: block;
    max-height: 520px;
}

/* Signature Pad Canvas */
.signature-box {
    background: #fff;
    border: 2px dashed var(--slate-200);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    margin-top: 10px;
}
.signature-box canvas {
    background: #fff;
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 600px;
    height: 180px;
    touch-action: none;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
}

/* Action Icon Link Button */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--slate-100);
    color: var(--slate-600);
    text-decoration: none;
    transition: all 0.15s ease;
}
.action-btn:hover {
    background: var(--primary);
    color: #fff;
}
.action-btn.delete:hover {
    background: var(--danger);
    color: #fff;
}

/* Compact per-training progress summary (Dashboard training list) */
.progress-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
}
.progress-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-500);
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 20px;
    padding: 2px 8px 2px 6px;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
}
a.progress-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.progress-chip.is-positive {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.progress-chip-num {
    font-weight: 800;
    color: var(--navy);
}
.progress-chip.is-positive .progress-chip-num {
    color: #047857;
}

/* Row "more actions" dropdown menu (Dashboard training list) */
.row-menu {
    position: relative;
    display: inline-block;
    margin-left: 4px;
}
.row-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 50;
    text-align: left;
}
.row-menu-panel.open {
    display: block;
}
.row-menu-panel a {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-700);
    text-decoration: none;
    white-space: nowrap;
}
.row-menu-panel a:hover {
    background: var(--slate-50);
    color: var(--primary);
}
.row-menu-panel a.row-menu-danger {
    color: var(--danger);
}
.row-menu-panel a.row-menu-danger:hover {
    background: #fef2f2;
    color: var(--danger);
}

/* Clean Tabs */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--slate-200);
    margin-bottom: 20px;
}
.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    font-weight: 600;
    font-size: 14px;
    color: var(--slate-600);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .topbar { height: auto; padding: 12px 16px; flex-direction: column; gap: 10px; }
    .topbar-nav { flex-wrap: wrap; justify-content: center; }
    .stats-grid { grid-template-columns: 1fr; }
    .card { padding: 20px; }
    .container { padding: 16px !important; }
    h1 { font-size: 20px; }
    h2 { font-size: 17px; }

    /* Every .card on a phone: never allow it to be wider than the screen, and
       never let its content force horizontal scroll — !important because a
       .card can contain almost anything (inline-styled divs, forms, tables)
       and this must win over all of it unconditionally on small screens. */
    .card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .card * {
        max-width: 100%;
    }
    /* .table-wrapper is the one thing allowed to exceed .card's width internally —
       it manages its own horizontal scroll for genuinely wide tables. */
    .card .table-wrapper, .card .table-wrapper * {
        max-width: none;
    }

    /* Card headers (page title + action buttons) are a left/right row by default,
       which squeezes the title into a narrow column on a phone. Force them to
       stack instead, and center the button group in its own row below. */
    .card-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 14px !important;
    }
    .card-header > * {
        width: 100% !important;
    }
    .card-header-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
        width: 100% !important;
    }
    .card-header-actions > .btn,
    .card-header-actions > a,
    .card-header-actions > button {
        flex: 0 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    /* Main Training Programs table: instead of a table that needs sideways
       scrolling to read on a phone, turn each row into its own stacked card —
       every cell becomes a full-width block, in the same top-to-bottom order
       it already has (Topic, Schedule, Status, Progress, Actions). */
    #trainingsTable, #trainingsTable thead, #trainingsTable tbody,
    #trainingsTable tr, #trainingsTable th, #trainingsTable td {
        display: block;
        width: 100%;
    }
    #trainingsTable thead {
        display: none;
    }
    #trainingsTable tr {
        margin-bottom: 14px;
        border: 1px solid var(--slate-200);
        border-radius: var(--radius);
        overflow: hidden;
    }
    #trainingsTable tr:last-child {
        margin-bottom: 0;
    }
    #trainingsTable td {
        padding: 10px 14px !important;
        border-bottom: 1px solid var(--slate-100);
        text-align: left !important;
        white-space: normal !important;
        max-width: none !important;
    }
    /* The Actions cell (Report button + "more" menu) reads better centered
       on its own row, set apart from the details above it. :not([colspan])
       so the "no trainings yet" empty-state message doesn't get the same
       treatment — that's a single wide cell, not an Actions column. */
    #trainingsTable td:last-child:not([colspan]) {
        border-bottom: none;
        display: flex;
        justify-content: center;
        background: var(--slate-50);
    }

    /* Training report table AND Support Tickets table: same stack-into-cards
       treatment — both are dense (7-9 columns of mostly badges/short values),
       so each cell also gets a small uppercase label (from its data-label
       attribute) so it's still clear what you're looking at once it's on its
       own line. */
    #reportTable, #reportTable thead, #reportTable tbody,
    #reportTable tr, #reportTable th, #reportTable td,
    #ticketsTable, #ticketsTable thead, #ticketsTable tbody,
    #ticketsTable tr, #ticketsTable th, #ticketsTable td {
        display: block;
        width: 100%;
    }
    #reportTable thead, #ticketsTable thead {
        display: none;
    }
    #reportTable tr, #ticketsTable tr {
        margin-bottom: 14px;
        border: 1px solid var(--slate-200);
        border-radius: var(--radius);
        overflow: hidden;
    }
    #reportTable tr:last-child, #ticketsTable tr:last-child {
        margin-bottom: 0;
    }
    #reportTable td, #ticketsTable td {
        padding: 10px 14px !important;
        border-bottom: 1px solid var(--slate-100);
        text-align: left !important;
        white-space: normal !important;
        max-width: none !important;
    }
    #reportTable td[data-label]::before, #ticketsTable td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--slate-400);
        margin-bottom: 4px;
    }
    /* :not([colspan]) so the "no rows yet" empty-state message (a single wide
       cell spanning the whole table) doesn't get squeezed into this same
       centered-flex-row treatment meant for the real Actions column. */
    #reportTable td:last-child:not([colspan]), #ticketsTable td:last-child:not([colspan]) {
        border-bottom: none;
        display: flex;
        justify-content: center;
        background: var(--slate-50);
    }
}

/* Small phones: keep the step-by-step progress bar (used on nearly every page)
   from cramping or wrapping awkwardly */
@media (max-width: 480px) {
    .step-circle { width: 28px; height: 28px; font-size: 12px; }
    .step-item:not(:last-child)::after { top: 14px; }
    .step-label { font-size: 10.5px; margin-top: 6px; line-height: 1.2; }
    .container { padding: 12px !important; }
    .card { padding: 16px; border-radius: var(--radius); }
    .btn { padding: 10px 14px; font-size: 13.5px; }
    .stat-num { font-size: 22px !important; }
    .video-frame video { max-height: 260px; }
    .signature-box canvas { height: 150px; }
    .timer-pill { padding: 8px 16px; font-size: 13.5px; }
}

/* =====================================================
   Advanced Sidebar Layout Styles (Expert Grade)
   ===================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: #0f172a; /* Slate 900 */
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

/* Sidebar Body & Scrollable Area */
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.sidebar-body::-webkit-scrollbar {
    width: 5px;
}
.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
}
.sidebar-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Sidebar Menu */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-nav li {
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

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

.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.sidebar-link-icon {
    font-size: 18px;
    width: 24px;
    display: inline-flex;
    justify-content: center;
}

/* Sidebar Footer / User section */
.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: 12px;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-user-status {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

/* Main Content Area */
.main-content-layout {
    flex: 1;
    margin-left: 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    width: calc(100% - 280px);
    max-width: 100%;
    overflow-x: hidden;
}

/* Topbar in main layout */
.main-header {
    background: #ffffff;
    height: 70px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.main-header-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

/* Responsive adjustment for sidebar layout */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    .sidebar-header {
        padding: 16px 8px;
        justify-content: center;
    }
    .sidebar-brand-text, .sidebar-brand-sub, .sidebar-user-info {
        display: none;
    }
    .sidebar-body {
        padding: 12px 6px;
    }
    .sidebar-link {
        justify-content: center;
        padding: 12px 0;
    }
    .sidebar-link-text {
        display: none;
    }
    .sidebar-footer {
        padding: 12px 6px;
    }
    .sidebar-user {
        justify-content: center;
        padding: 8px;
    }
    .main-content-layout {
        margin-left: 80px;
        width: calc(100% - 80px);
    }
    .main-header {
        padding: 0 20px;
    }
    .container {
        padding: 20px !important;
    }
    
    /* Responsive stats & table styling to eliminate scroll */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    table {
        font-size: 12.5px !important;
    }
    th, td {
        padding: 10px 8px !important;
    }
    th {
        white-space: normal !important;
    }
}

/* Mobile Hamburger Toggle & Overlay Drawer styling */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #0f172a;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mobile-nav-toggle:hover {
    background: var(--slate-100);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    z-index: 95;
    animation: fadeIn 0.2s ease;
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: inline-flex;
    }
    .header-user-info {
        display: none !important;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 280px !important;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-brand-text, .sidebar-brand-sub, .sidebar-user-info {
        display: flex !important;
    }
    .sidebar-body {
        padding: 16px 12px;
    }
    .sidebar-link {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    .sidebar-link-text {
        display: inline !important;
    }
    .sidebar-footer {
        padding: 16px 14px;
        display: block !important;
    }
    .sidebar-user {
        justify-content: flex-start;
        padding: 12px;
    }
    .main-content-layout {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .main-header {
        padding: 0 16px;
        justify-content: flex-start;
        gap: 8px;
    }
    .container {
        padding: 16px !important;
    }
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Responsive grids */
    .two-col-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Touch targets: icon buttons, dropdown menu items, and checkboxes are sized
       for a mouse pointer by default — enlarge them on touch-sized screens so
       they're comfortable to tap (roughly the 44px guideline) without changing
       how dense the desktop admin UI feels. */
    .action-btn {
        width: 40px;
        height: 40px;
    }
    .row-menu-panel a {
        padding: 12px 14px;
        font-size: 14px;
    }
    input[type=checkbox], input[type=radio] {
        width: 20px !important;
        height: 20px !important;
    }
    td, th {
        padding: 12px 10px !important;
    }
}


