/* ================================================================
       DESIGN TOKENS — V8 (mobile-first baseline 360px)
    ================================================================ */
:root {
    --bg: #f0f2f7;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --primary: #2353e8;
    --primary-dark: #1a3ec0;
    --primary-light: #eff3ff;
    --accent: #f97316;
    --accent-light: #fff7ed;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --amber: #d97706;
    --amber-light: #fef3c7;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
    --border: #e2e8f0;
    --border-2: #cbd5e1;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-w: 248px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
    --shadow: 0 4px 12px rgba(15, 23, 42, .1);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .15);
    --font: 'DM Sans', system-ui, sans-serif;
    --font-display: 'Playfair Display', serif;
    --font-mono: 'Courier New', monospace;
    --transition: .18s cubic-bezier(.4, 0, .2, 1);
    /* Exam-specific */
    --exam-bg: #f8faff;
    --exam-surface: #ffffff;
    --exam-primary: #2353e8;
    --exam-accent: #f97316;
    --exam-radius: 12px;
    /* Anti-cheat severity colors */
    --cheat-low: #d97706;
    --cheat-high: #dc2626;
}

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

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a,
button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 99px;
}

.skip-link {
    position: absolute;
    top: -999px;
    left: 8px;
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    z-index: 9999;
    text-decoration: none;
}

.skip-link:focus {
    top: 8px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Fix: center dialogs against the true viewport, not the offset main container */
dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.action-menu-wrap {
    position: relative;
    display: inline-block;
}

.action-menu-trigger {
    font-size: 1.2rem;
    line-height: 1;
    padding: .25rem .5rem;
    letter-spacing: .05em;
}

.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 50;
    overflow: hidden;
}

.action-menu.is-open {
    display: block;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .6rem 1rem;
    font-size: .84rem;
    font-family: var(--font);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    transition: background var(--transition);
}

.action-menu-item:hover {
    background: var(--surface-2);
}

.action-menu-item--warn {
    color: var(--amber);
}

.action-menu-item--warn:hover {
    background: var(--amber-light);
}

.action-menu-item--success {
    color: var(--green);
}

.action-menu-item--success:hover {
    background: var(--green-light);
}

.action-menu-item--info {
    color: var(--primary);
}

.action-menu-item--info:hover {
    background: var(--primary-light);
}

.action-menu-item--danger {
    color: var(--red);
}

.action-menu-item--danger:hover {
    background: var(--red-light);
}

.action-menu-divider {
    height: 1px;
    background: var(--border);
    margin: .25rem 0;
}

/* ── Filter bar ───────────────────────────────────────────────────── */
.panel-filters {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.filter-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input {
    flex: 1;
    min-width: 180px;
    padding: .6rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition);
    -webkit-appearance: none;
}

.filter-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(35, 83, 232, .12);
}

.filter-select {
    width: auto;
    min-width: 130px;
}

/* ── Pagination ───────────────────────────────────────────────────── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border, #e5e7eb);
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-meta {
    font-size: .8rem;
    color: var(--text-3);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .4rem;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--surface-1, #fff);
    border-radius: var(--radius-sm, 4px);
    font-size: .82rem;
    cursor: pointer;
    color: var(--text-1);
    text-decoration: none;
    transition: background .15s;
}

.pg-btn:hover:not(.pg-disabled) {
    background: var(--surface-2);
}

.pg-btn.pg-disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

.pg-btn.pg-active {
    background: var(--primary, #2563eb);
    color: #fff;
    border-color: var(--primary, #2563eb);
    font-weight: 600;
}

.pg-ellipsis {
    padding: 0 .25rem;
    color: var(--text-3);
    font-size: .82rem;
}

/* ================================================================
       LOGIN
    ================================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-bg-art {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse 600px 400px at 80% 20%, rgba(35, 83, 232, .25) 0%, transparent 70%),
        radial-gradient(ellipse 400px 500px at 10% 80%, rgba(249, 115, 22, .12) 0%, transparent 70%);
}

.login-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: #fff;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 3rem;
}

.login-logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.login-logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #fff;
}

.login-brand h1 {
    font-family: var(--font-display);
    font-size: 2.75rem;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 1.25rem;
}

.login-brand h1 span {
    color: #93c5fd;
}

.login-brand p {
    font-size: 1rem;
    color: #94a3b8;
    line-height: 1.7;
    max-width: 380px;
}

.login-features {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    list-style: none;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .9rem;
    color: #cbd5e1;
}

.login-feature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: rgba(255, 255, 255, .03);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, .08);
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: .375rem;
}

.login-card>p {
    font-size: .875rem;
    color: var(--text-2);
    margin-bottom: 1.5rem;
}

/* Language toggle on login */
.lang-toggle {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
}

.lang-btn {
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    background: none;
    color: var(--text-2);
    transition: all var(--transition);
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: .4rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .65rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition);
    /* min 16px prevents iOS zoom */
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(35, 83, 232, .12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: var(--font);
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none;
    min-height: 44px;
    /* touch target */
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(.98);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: .5rem .875rem;
    font-size: .8rem;
    min-height: 36px;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-2);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--surface-2);
}

.btn-green {
    background: var(--green);
    color: #fff;
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-amber {
    background: var(--amber);
    color: #fff;
}

.error-msg {
    color: var(--red);
    font-size: .82rem;
    margin-top: .5rem;
    min-height: 1.2em;
}

.login-security-note {
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: .78rem;
    color: var(--primary);
    line-height: 1.6;
}

/* ================================================================
       DASHBOARD SHELL
    ================================================================ */
.dashboard {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-bottom: 1rem;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #f1f5f9;
    font-weight: 600;
}

.sidebar-company {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .625rem;
    background: rgba(255, 255, 255, .06);
    border-radius: var(--radius-sm);
}

.sidebar-company-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.sidebar-company-name {
    font-size: .8rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem .75rem;
}

.sidebar-nav-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, .6);
    padding: .5rem .5rem .25rem;
    margin-top: .5rem;
}

.sidebar-nav button {
    display: flex;
    align-items: center;
    gap: .625rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: .6rem .625rem;
    color: var(--sidebar-text);
    font-size: .875rem;
    font-family: var(--font);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    min-height: 44px;
}

.sidebar-nav button:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, .07);
}

.sidebar-nav button[aria-current="page"] {
    color: #fff;
    background: rgba(35, 83, 232, .35);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem .75rem 1.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: .75rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: .8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sidebar-user-role {
    font-size: .72rem;
    color: var(--sidebar-text);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    background: rgba(35, 83, 232, .25);
    color: #93c5fd;
    margin-top: .35rem;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 99;
    display: none;
}

.sidebar-overlay.is-open {
    display: block;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .625rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: .6rem .625rem;
    color: var(--sidebar-text);
    font-size: .875rem;
    font-family: var(--font);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    min-height: 44px;
    text-decoration: none;
}

.sidebar-nav a:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, .07);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(35, 83, 232, .35);
    font-weight: 600;
}

main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.topbar-sub {
    font-size: .78rem;
    color: var(--text-2);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.badge-company {
    padding: .3rem .75rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: .75rem;
    font-weight: 700;
}

.mobile-nav-toggle {
    display: none;
}

.content {
    padding: 1.5rem;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.panel-header {
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.panel-header h2 {
    font-size: .975rem;
    font-weight: 700;
}

.panel-body {
    padding: 1.25rem 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.125rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-card-label {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-2);
}

.stat-card-value {
    font-size: 1.875rem;
    font-weight: 700;
    margin: .25rem 0;
    line-height: 1;
}

.stat-card-sub {
    font-size: .75rem;
    color: var(--text-3);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table th {
    text-align: left;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-2);
    padding: .625rem .875rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: .75rem .875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tr:hover td {
    background: var(--surface-2);
}

.cand-mini {
    display: flex;
    align-items: center;
    gap: .625rem;
}

.cand-mini-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    color: var(--primary);
    flex-shrink: 0;
}

.cand-mini-name {
    font-weight: 600;
    font-size: .875rem;
}

.cand-mini-email {
    font-size: .75rem;
    color: var(--text-3);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

.chip-pass {
    background: var(--green-light);
    color: var(--green);
}

.chip-fail {
    background: var(--red-light);
    color: var(--red);
}

.chip-progress {
    background: var(--amber-light);
    color: var(--amber);
}

.chip-excellent {
    background: #f0fdf4;
    color: #166534;
}

.chip-verygood {
    background: var(--primary-light);
    color: var(--primary);
}

.chip-good {
    background: var(--accent-light);
    color: var(--accent);
}

.chip-average {
    background: var(--surface-2);
    color: var(--text-2);
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: .625rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.search-wrap {
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
}

.search-input {
    padding: .6rem .875rem .6rem 2.25rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    min-width: 200px;
}

.search-input:focus {
    border-color: var(--primary);
    outline: none;
}

.filter-select {
    padding: .6rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
}

.bar-track {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
    transition: width .4s ease;
}

/* ================================================================
       NORMING PIPELINE — Admin Panel
    ================================================================ */
.norm-panel {
    background: linear-gradient(135deg, #eff3ff 0%, #f0fdf4 100%);
    border: 1px solid #c7d2fe;
}

.norm-stat {
    text-align: center;
    padding: .875rem;
    background: rgba(255, 255, 255, .7);
    border-radius: var(--radius);
}

.norm-stat-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.norm-stat-label {
    font-size: .72rem;
    color: var(--text-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.norm-table-wrap {
    overflow-x: auto;
}

/* ================================================================
       ANTI-CHEAT LOG — Admin view
    ================================================================ */
.cheat-log-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
}

.cheat-log-row:last-child {
    border-bottom: none;
}

.cheat-severity {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
}

.severity-low {
    background: var(--amber-light);
    color: var(--amber);
}

.severity-high {
    background: var(--red-light);
    color: var(--red);
}

.cheat-log-time {
    font-size: .72rem;
    color: var(--text-3);
    min-width: 80px;
}

.cheat-log-msg {
    flex: 1;
    color: var(--text);
}

/* ================================================================
       CANDIDATE PORTAL — Mobile-first Exam Engine
       Baseline: 360px. Exam runs in a separate view.
    ================================================================ */
.exam-portal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--exam-bg);
    z-index: 200;
    overflow-y: auto;
}

/* Exam header */
.exam-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--exam-surface);
    border-bottom: 1px solid var(--border);
    padding: .875rem 1rem;
}

.exam-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.exam-logo {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: .375rem;
    background: var(--exam-primary);
    color: #fff;
    padding: .35rem .875rem;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}

.exam-timer.warning {
    background: var(--amber);
    animation: pulse-timer 1s ease infinite;
}

.exam-timer.critical {
    background: var(--red);
    animation: pulse-timer .5s ease infinite;
}

@keyframes pulse-timer {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .75
    }
}

/* Exam progress */
.exam-progress-bar {
    height: 3px;
    background: var(--border);
}

.exam-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width .3s ease;
}

.exam-progress-label {
    display: flex;
    justify-content: space-between;
    padding: .375rem 1rem 0;
    font-size: .72rem;
    color: var(--text-3);
}

/* Offline indicator */
.offline-banner {
    background: var(--amber);
    color: #fff;
    padding: .5rem 1rem;
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    display: none;
}

.offline-banner.visible {
    display: block;
}

/* Anti-cheat warning overlay */
.anticheat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .85);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.anticheat-overlay.visible {
    display: flex;
}

.anticheat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.anticheat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.anticheat-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--red);
    margin-bottom: .5rem;
}

.anticheat-msg {
    font-size: .875rem;
    color: var(--text-2);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.anticheat-count {
    font-size: .75rem;
    color: var(--text-3);
    margin-top: .75rem;
}

/* Exam card */
.exam-card {
    margin: 1rem;
    background: var(--exam-surface);
    border-radius: var(--exam-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.exam-q-header {
    background: var(--primary-light);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(35, 83, 232, .12);
}

.exam-q-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .375rem;
}

.exam-q-num {
    font-size: .72rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.exam-q-time {
    font-size: .72rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.exam-q-cat {
    font-size: .72rem;
    color: var(--text-2);
}

.exam-q-text {
    padding: 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.55;
}

/* Options — touch-friendly */
.exam-options {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .625rem;
}

.exam-option {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .875rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
    -webkit-tap-highlight-color: transparent;
    min-height: 52px;
}

.exam-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.exam-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.exam-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.exam-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.exam-option-label {
    font-size: .9rem;
    color: var(--text);
    cursor: pointer;
    flex: 1;
}

.exam-option-key {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-3);
    min-width: 18px;
}

/* Exam nav */
.exam-nav {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    gap: .5rem;
}

.exam-q-dots {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    justify-content: center;
    flex: 1;
}

.exam-q-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--border-2);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.exam-q-dot.answered {
    background: var(--green);
    border-color: var(--green);
}

.exam-q-dot.current {
    border-color: var(--primary);
    background: var(--primary);
}

/* Likert scale */
.likert-scale {
    display: flex;
    gap: .375rem;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0 1.25rem 1.25rem;
}

.likert-option {
    flex: 1;
    min-width: 52px;
}

.likert-option input {
    display: none;
}

.likert-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .625rem .25rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    font-size: .72rem;
    color: var(--text-2);
    transition: all var(--transition);
}

.likert-option label strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-3);
}

.likert-option input:checked+label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.likert-option input:checked+label strong {
    color: var(--primary);
}

/* Exam screens */
.exam-screen {
    padding: 1.25rem 1rem;
}

.exam-screen-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
}

.exam-screen h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: .75rem;
    color: var(--text);
}

.exam-screen p {
    font-size: .9rem;
    color: var(--text-2);
    line-height: 1.65;
    margin-bottom: 1rem;
}

.exam-screen ul {
    list-style: none;
    margin: 1rem 0;
    width: 100%;
}

.exam-screen li {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .5rem 0;
    font-size: .875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.exam-screen li:last-child {
    border-bottom: none;
}

.exam-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--green-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .7rem;
    color: var(--green);
    font-weight: 700;
}

.system-check-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
}

.system-check-item.ok {
    background: var(--green-light);
}

.system-check-item.warn {
    background: var(--amber-light);
}

.system-check-item.fail {
    background: var(--red-light);
}

.system-check-icon {
    font-size: 1rem;
}

.system-check-label {
    font-size: .875rem;
    font-weight: 600;
}

.system-check-detail {
    font-size: .75rem;
    color: var(--text-3);
}

.consent-box {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    max-height: 160px;
    overflow-y: auto;
    font-size: .8rem;
    color: var(--text-2);
    line-height: 1.6;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    margin-top: .75rem;
}

.consent-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.completion-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

.completion-band {
    display: inline-block;
    padding: .4rem 1rem;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* ================================================================
       QUESTION BANK — open-ended removed, only choice + likert
    ================================================================ */
.q-type-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
}

.type-single {
    background: var(--primary-light);
    color: var(--primary);
}

.type-multi {
    background: var(--accent-light);
    color: var(--accent);
}

.type-likert {
    background: var(--green-light);
    color: var(--green);
}

/* ================================================================
       SECURITY BANNER
    ================================================================ */
.security-banner {
    background: #fff8f0;
    border: 1px solid rgba(217, 119, 6, .25);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.security-banner h3 {
    font-size: .875rem;
    font-weight: 700;
    color: var(--amber);
    margin-bottom: .5rem;
}

.security-banner ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.security-banner li {
    font-size: .78rem;
    color: var(--text-2);
    padding-left: 1rem;
    position: relative;
}

.security-banner li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--amber);
}

/* ================================================================
       BACK BUTTON
    ================================================================ */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: none;
    border: none;
    color: var(--text-2);
    font-size: .875rem;
    font-family: var(--font);
    padding: .5rem 0;
    margin-bottom: 1rem;
    cursor: pointer;
}

.back-btn:hover {
    color: var(--text);
}

/* ================================================================
       CANDIDATE EVAL GRID
    ================================================================ */
.cand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.cand-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition);
    position: relative;
}

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

.cand-card-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    padding: .25rem .875rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    border-bottom-left-radius: 10px;
}

.ribbon-pass {
    background: var(--green);
    color: #fff;
}

.ribbon-fail {
    background: var(--red);
    color: #fff;
}

.ribbon-progress {
    background: var(--amber);
    color: #fff;
}

.cand-card-body {
    padding: 1.25rem;
    padding-top: 1.5rem;
}

.cand-card-name {
    font-weight: 700;
    font-size: .975rem;
    color: var(--text);
    margin-bottom: .2rem;
}

.cand-card-pos {
    font-size: .78rem;
    color: var(--text-2);
    margin-bottom: .625rem;
}

.cand-card-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.cand-card-actions {
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Company cards */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.company-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.company-card-name {
    font-weight: 700;
    font-size: .975rem;
    margin-bottom: .375rem;
}

.company-plan {
    display: inline-block;
    padding: .2rem .625rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    margin-bottom: .875rem;
}

.plan-enterprise {
    background: #f0fdf4;
    color: #166534;
}

.plan-pro {
    background: var(--primary-light);
    color: var(--primary);
}

.plan-starter {
    background: var(--surface-2);
    color: var(--text-2);
}

.company-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}

.company-stat-val {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
}

.company-stat-label {
    font-size: .7rem;
    color: var(--text-3);
}

/* Question bank table */
.question-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}

.question-table th {
    padding: .625rem .875rem;
    background: var(--surface-2);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.question-table td {
    padding: .75rem .875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.question-table tr:hover td {
    background: var(--surface-2);
}

/* Detail eval */
.competency-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .625rem 0;
    border-bottom: 1px solid var(--border);
}

.competency-row:last-child {
    border-bottom: none;
}

.competency-name {
    min-width: 160px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text);
}

.competency-bar-wrap {
    flex: 1;
}

.competency-score {
    min-width: 48px;
    text-align: right;
    font-weight: 700;
    font-size: .875rem;
}

/* Modals */
dialog {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    max-width: 90vw;
    width: 480px;
}

dialog::backdrop {
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
}

.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: 1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-3);
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tl-item {
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    padding-bottom: 1.25rem;
    position: relative;
}

.tl-item:last-child {
    padding-bottom: 0;
}

.tl-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.tl-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    z-index: 1;
}

.tl-dot.done {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.tl-dot.active {
    background: var(--primary);
    border-color: var(--primary);
}

.tl-dot.pending {
    background: var(--surface-2);
}

.tl-content {
    flex: 1;
    padding-top: 2px;
}

.tl-stage {
    font-weight: 600;
    font-size: .875rem;
}

.tl-date {
    font-size: .75rem;
    color: var(--text-3);
}

/* Grid helpers */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* ================================================================
       RESPONSIVE — mobile overrides
    ================================================================ */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

    main {
        margin-left: 0;
    }

    .topbar {
        padding: .75rem 1rem;
    }

    .content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .login-grid {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }

    .login-panel {
        padding: 2rem 1rem;
    }

    .cand-grid {
        grid-template-columns: 1fr;
    }

    .company-grid {
        grid-template-columns: 1fr 1fr;
    }

    .competency-name {
        min-width: 100px;
        font-size: .8rem;
    }

    dialog {
        width: 95vw;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .company-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
       PRINT
    ================================================================ */
@media print {

    .sidebar,
    .topbar,
    .back-btn,
    .btn {
        display: none !important;
    }

    main {
        margin-left: 0;
    }

    .panel {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
