/* ==========================================================================
   SecureExam — design system
   Charte UNAH (Université Adventiste d'Haïti) : vert institutionnel #0f6938, or #e7b472 → #ad8348.
   ========================================================================== */

:root {
    /* Tons sombres (barre latérale, en-têtes) : vert UNAH très foncé */
    --dark-950: #05241a;
    --dark-900: #083322;
    --dark-800: #0c422b;
    --dark-700: #125436;
    --primary: #0f6938;
    --primary-600: #0a5129;
    --primary-50: #edf7f1;
    --primary-100: #d2ebdc;
    --accent: #d9a259;
    --gold: #e7b472;
    --gold-dark: #ad8348;
    --gold-50: #fbf4e8;





    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e2e7f0;
    --border-strong: #cdd5e3;
    --text: #101828;
    --text-2: #3b4559;
    --muted: #667085;

    --success: #12875a;
    --success-bg: #e8f7f0;
    --warning: #b45309;
    --warning-bg: #fff6e5;
    --danger: #d92d20;
    --danger-bg: #fdecea;
    --info: #1b6fd6;
    --info-bg: #eaf3ff;

    --sev-low: #667085;
    --sev-medium: #b45309;
    --sev-high: #d92d20;
    --sev-critical: #7a1111;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px rgba(12, 26, 58, .12);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
/* L’attribut hidden doit toujours masquer, même sur un élément stylé en flex ou grid. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
.icon { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -0.15em; }
.alert > .icon { width: 20px; height: 20px; margin-top: 1px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code, kbd { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Mise en page ---------- */
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.spacer { flex: 1; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
    padding: .7rem 1.1rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer; text-decoration: none !important;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--primary-100); outline-offset: 1px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 105, 56, .3); }
.btn-primary:hover { background: var(--primary-600); }
.btn-dark { background: var(--dark-900); color: #fff; }
.btn-dark:hover { background: var(--dark-800); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-50); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b42318; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn-danger-soft:hover { background: #fad4d0; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .45rem .75rem; font-size: .82rem; }
.btn-lg { padding: .95rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .45rem; }
.btn svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }
form.inline { display: inline; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 1.25rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 640px) { .card-body { padding: 1rem; } .card-header, .card-footer { padding: .85rem 1rem; } }

.stat-card { padding: 1.1rem 1.25rem; }
.stat-card .stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat-card .stat-hint { font-size: .82rem; color: var(--muted); }

/* ---------- Formulaires ---------- */
.field { display: block; }
.field + .field { margin-top: 1rem; }
.label { display: block; font-weight: 600; font-size: .88rem; color: var(--text-2); margin-bottom: .35rem; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.error-text { font-size: .82rem; color: var(--danger); margin-top: .3rem; font-weight: 500; }
.input, .select, .textarea {
    display: block; width: 100%; font: inherit; font-size: .95rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: .65rem .8rem; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input.is-invalid, .textarea.is-invalid, .select.is-invalid { border-color: var(--danger); }
.input-lg { padding: .85rem 1rem; font-size: 1.02rem; }
.input-code { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }

.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; font-size: .92rem; }
.check input { margin-top: .22rem; width: 1.05rem; height: 1.05rem; accent-color: var(--primary); flex-shrink: 0; }
.check + .check { margin-top: .6rem; }

/* Interrupteur */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch-label { font-size: .92rem; color: var(--text-2); }
.switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; background: var(--border-strong); border-radius: 22px; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 3px solid var(--primary-100); }

/* ---------- Alertes et badges ---------- */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: var(--success-bg); border-color: #b7e4cf; color: #0b5c3d; }
.alert-error { background: var(--danger-bg); border-color: #f7c1bb; color: #912018; }
.alert-warning { background: var(--warning-bg); border-color: #f6d9a6; color: #7a3d06; }
.alert-info { background: var(--info-bg); border-color: #c3dbfb; color: #134a92; }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 650; padding: .2rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: #b7e4cf; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: #f6d9a6; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: #f7c1bb; }
.badge-dark { background: var(--dark-900); color: #fff; border-color: var(--dark-900); }
.sev-LOW { color: var(--sev-low); }
.sev-MEDIUM { color: var(--sev-medium); background: var(--warning-bg); border-color: #f6d9a6; }
.sev-HIGH { color: var(--sev-high); background: var(--danger-bg); border-color: #f7c1bb; }
.sev-CRITICAL { color: #fff; background: var(--sev-critical); border-color: var(--sev-critical); }

/* ---------- Tableaux ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table .actions { text-align: right; white-space: nowrap; }
.table .row-muted td { color: var(--muted); background: var(--surface-2); }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty-state h3 { color: var(--text); }
.empty-state svg { width: 44px; height: 44px; color: var(--border-strong); margin-bottom: .75rem; }

/* ---------- Coque « personnel » : barre latérale ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--dark-900); color: #cfe0d6;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.2rem 1.25rem; color: #fff; text-decoration: none !important; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: grid; place-items: center; font-weight: 800; color: #fff; flex-shrink: 0; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.1; color: #fff; }
.brand-sub { font-size: .72rem; color: #9fbfae; font-weight: 500; letter-spacing: .02em; }
.nav { padding: .5rem .75rem; flex: 1; overflow-y: auto; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7fa28f; padding: 1rem .6rem .4rem; font-weight: 650; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: var(--radius-sm); color: #cfe0d6; font-weight: 500; font-size: .92rem; text-decoration: none; }
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(231, 180, 114, .14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.sidebar-footer .who { color: #fff; font-weight: 600; }
.sidebar-footer .role { color: #9fbfae; font-size: .78rem; }
.sidebar-footer a { color: #b6cfc1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; background: var(--dark-900); color: #fff; position: sticky; top: 0; z-index: 40; }
.topbar .brand { padding: 0; }
.app .topbar { display: none; }
.content { padding: 2rem; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--muted); margin-top: .3rem; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.breadcrumb a { color: var(--muted); }

@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
    body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .app .topbar { display: flex; padding: .7rem 1rem; }
    .content { padding: 1.25rem 16px; }
}
.nav-toggle { background: none; border: 0; color: #fff; padding: .35rem; cursor: pointer; }
.nav-toggle svg { width: 24px; height: 24px; }

/* Onglets */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a { padding: .7rem 1rem; font-weight: 600; font-size: .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Liste de définitions */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* Code d'accès mis en avant */
.code-display { font-family: ui-monospace, Consolas, monospace; font-size: 1.8rem; font-weight: 800; letter-spacing: .25em; color: var(--dark-900); background: var(--primary-50); border: 1px dashed var(--primary); border-radius: var(--radius); padding: .5rem 1rem; display: inline-block; }

/* ---------- Page d'accueil / connexion ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-hero {
    background: radial-gradient(1200px 600px at -10% -20%, rgba(15, 105, 56, .75), transparent 60%),
                radial-gradient(900px 500px at 120% 120%, rgba(217, 162, 89, .35), transparent 60%),
                var(--dark-950);
    color: #dcebe2; padding: 2.5rem 3rem; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth-hero .brand { padding: 0; }
.auth-hero-body { margin: auto 0; max-width: 520px; }
.auth-hero h1 { color: #fff; font-size: 2.5rem; font-weight: 750; line-height: 1.12; letter-spacing: -.02em; margin-bottom: 1rem; }
.auth-hero .lead { font-size: 1.08rem; color: #c3d8cb; margin-bottom: 2rem; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.feature-list li { display: flex; gap: .8rem; align-items: flex-start; font-size: .95rem; }
.feature-list .fi { width: 32px; height: 32px; border-radius: 8px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; flex-shrink: 0; color: var(--gold); }
.feature-list .fi svg { width: 17px; height: 17px; }
.feature-list strong { color: #fff; display: block; font-weight: 600; }
.auth-hero-foot { font-size: .8rem; color: #8fb3a0; margin-top: 2rem; }
.auth-panel { display: flex; flex-direction: column; padding: 2rem 3rem; }
.auth-panel-top { display: flex; justify-content: flex-end; gap: .5rem; }
.auth-card { width: 100%; max-width: 420px; margin: auto; }
.auth-card h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: .35rem; }
.auth-card .subtitle { color: var(--muted); margin-bottom: 1.75rem; }
.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .82rem; margin: 1.5rem 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
@media (max-width: 960px) {
    .auth-page { grid-template-columns: minmax(0, 1fr); }
    .auth-panel-top .btn { white-space: normal; text-align: right; }
    .auth-hero { padding: 1.5rem 16px 2rem; }
    .auth-hero h1 { font-size: 1.7rem; }
    .auth-hero .feature-list, .auth-hero-foot { display: none; }
    .auth-hero-body { margin-top: 1.5rem; }
    .auth-hero .lead { margin-bottom: 0; }
    .auth-panel { padding: 1.5rem 16px 2.5rem; }
}

/* ---------- Page d'erreur simple ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.center-card { max-width: 480px; width: 100%; text-align: center; }

/* ---------- Questions (aperçu et interface étudiant) ---------- */
.q-prompt { font-size: 1rem; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }
.q-media { margin: 1rem 0; }
.q-media figcaption { font-size: .82rem; color: var(--muted); margin-top: .4rem; text-align: center; }
.q-media-image img { display: block; margin: 0 auto; border-radius: var(--radius-sm); border: 1px solid var(--border); max-height: 420px; object-fit: contain; }
.chart-box { position: relative; max-width: 640px; height: 320px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; }
@media (max-width: 640px) { .chart-box { height: 240px; } }
.data-table { border-collapse: collapse; margin: 0 auto; font-size: .9rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { border: 1px solid var(--border-strong); padding: .4rem .75rem; text-align: center; }
.data-table th { background: var(--surface-2); font-weight: 650; }
.blank-input { display: inline-block; width: 9em; max-width: 100%; font: inherit; padding: .15rem .45rem; margin: 0 .15rem; border: 0; border-bottom: 2px solid var(--primary); background: var(--primary-50); border-radius: 4px 4px 0 0; color: var(--text); }
.blank-input:focus { outline: none; background: var(--primary-100); }
.blank-input:disabled { color: var(--text); opacity: 1; }
.option-list { display: grid; gap: .55rem; margin-top: 1rem; }
.option { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.option:hover { border-color: var(--primary); }
.option input { margin-top: .2rem; accent-color: var(--primary); width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.option.is-selected, .option:has(input:checked) { border-color: var(--primary); background: var(--primary-50); box-shadow: inset 0 0 0 1px var(--primary); }
.option.is-correct { border-color: var(--success); background: var(--success-bg); }
.option-letter { font-weight: 700; color: var(--muted); min-width: 1.2rem; }

/* Éditeur de question */
.option-editor { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; }
.option-editor + .option-editor { margin-top: .5rem; }
.option-editor .correct-toggle { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.option-editor .correct-toggle input { accent-color: var(--success); width: 1.05rem; height: 1.05rem; }
.type-section[hidden] { display: none !important; }
.preview-box { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 1rem; background: var(--surface-2); min-height: 60px; }
.media-item { display: flex; gap: .75rem; align-items: center; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.media-item + .media-item { margin-top: .5rem; }
.question-card { position: relative; }
.question-card .q-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.q-number { width: 30px; height: 30px; border-radius: 8px; background: var(--dark-900); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
details.help { font-size: .88rem; }
details.help summary { cursor: pointer; color: var(--primary); font-weight: 600; }
details.help[open] summary { margin-bottom: .5rem; }

.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 960px) { .grid-2-1 { grid-template-columns: 1fr; } }

/* ---------- Checklist avant examen ---------- */
.checklist { display: grid; gap: .6rem; }
.check-item { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check-state { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; margin-top: 1px; position: relative; }
.check-item.is-ok .check-state { background: var(--success); border-color: var(--success); }
.check-item.is-ok .check-state::after { content: ''; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check-item.is-error .check-state { border-color: var(--danger); background: var(--danger-bg); }
.check-item.is-info .check-state { border-color: var(--primary); background: var(--primary-50); }

/* ---------- Interface d'examen ---------- */
.exam-body { background: var(--bg); }
.exam-body.no-select .exam-main { -webkit-user-select: none; user-select: none; }
.exam-body.no-select .exam-main input, .exam-body.no-select .exam-main textarea { -webkit-user-select: text; user-select: text; }
.exam-topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
    padding: .65rem 1.25rem; background: var(--dark-900); color: #fff; box-shadow: 0 2px 8px rgba(8, 18, 48, .25);
}
.exam-title { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1; }
.exam-title-text { display: flex; flex-direction: column; min-width: 0; }
.exam-title-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.exam-title-text span { font-size: .78rem; color: #a9c6b5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-status { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 600; padding: .3rem .6rem; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #cfe0d6; white-space: nowrap; }
.status-pill.is-ok { color: #7fe0b5; }
.status-pill.is-pending { color: #ffd68a; }
.status-pill.is-error { background: rgba(217, 45, 32, .25); color: #ffb4ab; }
.exam-timer { display: inline-flex; align-items: center; gap: .45rem; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.35rem; padding: .35rem .85rem; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .1); letter-spacing: .02em; }
.exam-timer.is-warning { background: #b45309; }
.exam-timer.is-danger { background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .75; } }

.exam-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.5rem; max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; align-items: start; }
.exam-palette { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: grid; gap: .85rem; max-height: calc(100vh - 110px); overflow-y: auto; }
.palette-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress span { display: block; height: 100%; background: var(--success); transition: width .3s; }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.palette-btn { position: relative; aspect-ratio: 1; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm); font: inherit; font-weight: 650; font-size: .85rem; color: var(--text-2); cursor: pointer; }
.palette-btn:hover { border-color: var(--primary); color: var(--primary); }
.palette-btn.is-answered { background: var(--success); border-color: var(--success); color: #fff; }
.palette-btn.is-flagged::after { content: ''; position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%; background: #f59e0b; border: 2px solid var(--surface); }
.palette-btn.is-current { box-shadow: 0 0 0 2px var(--primary); }
.palette-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; color: var(--muted); }
.palette-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lg { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-strong); display: inline-block; }
.lg-answered { background: var(--success); border-color: var(--success); }
.lg-flagged { background: #f59e0b; border-color: #f59e0b; border-radius: 50%; }
.exam-main { display: grid; gap: 1rem; min-width: 0; }
.exam-question { scroll-margin-top: 90px; }
.exam-question[data-flagged="1"] { border-color: #f5c16c; box-shadow: inset 3px 0 0 #f59e0b; }
.flag-btn[aria-pressed="true"] { color: #b45309; background: var(--warning-bg); }
.answer-input { margin-top: 1rem; }

@media (max-width: 900px) {
    .exam-layout { grid-template-columns: minmax(0, 1fr); padding: 1rem 16px 5rem; }
    .exam-palette { position: static; max-height: none; }
    .palette-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
    .exam-status { display: none; }
    .exam-topbar { padding: .6rem 16px; }
    .exam-timer { font-size: 1.1rem; }
}

/* Fenêtres modales et écrans bloquants */
.modal { border: 0; border-radius: var(--radius-lg); padding: 1.5rem; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
.modal::backdrop { background: rgba(8, 18, 48, .55); }
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--dark-950); }
.overlay[hidden] { display: none; }
.overlay-card { background: var(--surface); border-radius: var(--radius-lg); padding: 2rem; max-width: 460px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.overlay-icon { width: 52px; height: 52px; margin: 0 auto 1rem; border-radius: 14px; }
.overlay-icon svg { width: 26px; height: 26px; }
.overlay-card p { color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 110; background: var(--dark-900); color: #fff; padding: .75rem 1.1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: .9rem; max-width: calc(100vw - 32px); }
.toast.is-error { background: var(--danger); }
.toast[hidden] { display: none; }

/* ---------- Consultation des copies ---------- */
@media (min-width: 961px) { .sticky-col { position: sticky; top: 1rem; } }
.option.is-wrong { border-color: var(--danger); background: var(--danger-bg); }
.blank-review { display: inline-block; padding: .05rem .45rem; margin: 0 .15rem; border-radius: 4px; font-weight: 600; border-bottom: 2px solid; }
.blank-review.is-good { background: var(--success-bg); border-color: var(--success); color: #0b5c3d; }
.blank-review.is-bad { background: var(--danger-bg); border-color: var(--danger); color: #912018; }
.blank-expected { font-size: .82rem; color: var(--success); font-weight: 600; margin-right: .25rem; }
.answer-box { margin-top: 1rem; padding: .75rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); white-space: normal; overflow-wrap: anywhere; }
.answer-box.is-long { min-height: 80px; }
.grade-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.grade-form .input { padding: .45rem .6rem; }
.timeline { list-style: none; margin: 0; padding: .5rem 1.25rem; max-height: 60vh; overflow-y: auto; }
.timeline li { display: grid; grid-template-columns: 4.2rem 1fr; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline-time { font-size: .78rem; color: var(--muted); padding-top: .15rem; }

/* ---------- Caméra ---------- */
.camera-test { margin-top: .6rem; }
.camera-test video { width: 240px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--dark-900); transform: scaleX(-1); display: block; }
.self-view { position: fixed; right: 16px; bottom: 16px; z-index: 35; width: 176px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--dark-900); border: 2px solid var(--surface); }
.self-view[hidden] { display: none; }
.self-view video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transform: scaleX(-1); }
.self-view-label { position: absolute; left: 0; right: 0; bottom: 0; padding: .3rem .5rem; font-size: .7rem; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(8, 18, 48, .85)); display: flex; align-items: center; gap: .35rem; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .3); animation: pulse 1.6s infinite; }
@media (max-width: 900px) { .self-view { width: 112px; right: 10px; bottom: 10px; } .self-view-label { display: none; } }

.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.live-card { display: block; overflow: hidden; color: inherit; text-decoration: none !important; transition: box-shadow .15s, border-color .15s; }
.live-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.live-card.is-flagged { border-color: #f5c16c; box-shadow: inset 0 3px 0 #f59e0b; }
.live-frame { position: relative; aspect-ratio: 4 / 3; background: var(--dark-900); }
.live-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.live-card.has-image .live-frame img { opacity: 1; }
.live-card.is-stale .live-frame img { opacity: .35; filter: grayscale(1); }
.live-noimg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .4rem; color: #a9c6b5; font-size: .8rem; text-align: center; padding: .5rem; }
.live-noimg svg { width: 28px; height: 28px; }
.live-card.has-image:not(.is-stale) .live-noimg { display: none; }
.live-card.is-stale .live-noimg { color: #ffb4ab; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.live-badge { position: absolute; top: 8px; left: 8px; font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; background: rgba(8, 18, 48, .75); color: #fff; }
.live-badge.is-live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: .35rem; }
.live-badge.is-paused { background: #b45309; }
.live-timer { position: absolute; top: 8px; right: 8px; font-size: .75rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; background: rgba(8, 18, 48, .75); color: #fff; }
.live-body { padding: .75rem .9rem .85rem; }
.live-name { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-incident { color: var(--warning); margin-top: .35rem; min-height: 1.2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.capture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; padding: 1rem 1.25rem; }
.capture-grid a { display: block; position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--dark-900); }
.capture-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.capture-grid span { position: absolute; bottom: 0; left: 0; right: 0; font-size: .68rem; color: #fff; padding: .15rem .35rem; background: rgba(8, 18, 48, .7); }
.mini-frame { display: block; width: 72px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: var(--dark-900); }

/* ---------- Identité UNAH ---------- */
.brand-logo { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(231, 180, 114, .45); }
.brand-sub { max-width: 170px; display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.hero-brand { display: flex; align-items: center; gap: 1.1rem; text-decoration: none !important; color: #fff; }
.hero-logo { height: 100px; width: auto; }
.hero-app { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; padding-left: 1.1rem; border-left: 1px solid rgba(231, 180, 114, .45); line-height: 1.15; }
.hero-app small { display: block; font-size: .78rem; font-weight: 500; color: var(--gold); letter-spacing: .02em; }
.auth-hero h1 .gold, .gold-text { color: var(--gold); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #1f1606; }
.btn-gold:hover { filter: brightness(1.05); }
@media (max-width: 960px) { .hero-logo { height: 64px; } .hero-app { font-size: 1.05rem; } }

/* ---------- Vidéo en direct (WebRTC) ---------- */
.live-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--dark-900); opacity: 0; transition: opacity .25s; }
.live-card.is-video .live-frame video { opacity: 1; }
.live-card.is-video .live-frame img, .live-card.is-video .live-noimg { display: none; }
.live-card.is-listening { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.live-name { font-weight: 650; font-size: .92rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-mode { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 90px); font-size: .68rem; font-weight: 650; padding: .18rem .5rem; border-radius: 999px; background: rgba(5, 36, 26, .78); color: #d7e6dd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-mode:empty { display: none; }
.live-mode.is-live { background: rgba(15, 105, 56, .9); color: #fff; }
.live-mode.is-live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; margin-right: .35rem; animation: pulse 1.4s infinite; }
.live-mode.is-pending { background: rgba(173, 131, 72, .9); color: #fff; }
.live-mode.is-warn { background: rgba(180, 83, 9, .92); color: #fff; }
.live-controls { position: absolute; right: 8px; bottom: 8px; display: flex; gap: .3rem; }
.live-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(5, 36, 26, .78); color: #fff; cursor: pointer; }
.live-btn:hover { background: var(--primary); }
.live-btn.is-on { background: var(--gold); color: #1f1606; }
.live-btn svg { width: 16px; height: 16px; }
.live-btn[hidden] { display: none; }
.live-modal { width: min(1000px, calc(100vw - 32px)); }
.live-modal-frame { position: relative; aspect-ratio: 4 / 3; max-height: 75vh; margin: 0 auto; background: var(--dark-900); border-radius: var(--radius); overflow: hidden; }
.live-modal-frame video, .live-modal-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.live-modal-frame [hidden] { display: none; }
.self-view.is-live { border-color: var(--gold); }
.self-view.is-live .self-view-label { background: linear-gradient(transparent, rgba(15, 105, 56, .92)); }

/* ---------- Vérification d'identité ---------- */
.identity-card .card-header h2 { display: flex; align-items: center; gap: .5rem; }
.id-step { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--surface-2); }
.id-step-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.id-step-title .q-number { width: 26px; height: 26px; font-size: .8rem; background: var(--primary); }
.id-capture { margin-top: .25rem; }
.id-video-wrap { position: relative; max-width: 520px; aspect-ratio: 16 / 9; background: var(--dark-900); border-radius: var(--radius-sm); overflow: hidden; }
.id-video-wrap.is-face { max-width: 360px; aspect-ratio: 4 / 3; }
.id-video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.id-video-wrap.is-face video { transform: scaleX(-1); }
.id-guide { position: absolute; inset: 12% 14%; border: 3px dashed var(--gold); border-radius: 12px; display: flex; align-items: flex-end; justify-content: center; box-shadow: 0 0 0 999px rgba(5, 36, 26, .35); pointer-events: none; }
.id-guide span { background: rgba(5, 36, 26, .8); color: #fff; font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; margin-bottom: -.8rem; }
.face-guide { position: absolute; left: 50%; top: 50%; width: 42%; height: 72%; transform: translate(-50%, -50%); border: 3px dashed var(--gold); border-radius: 50%; box-shadow: 0 0 0 999px rgba(5, 36, 26, .35); pointer-events: none; }
.id-preview { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin-top: .25rem; }
.id-preview img { max-width: 320px; max-height: 220px; border-radius: var(--radius-sm); border: 2px solid var(--success); background: #fff; }
.id-preview.is-face img { max-width: 180px; }
.identity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
@media (max-width: 640px) { .identity-grid { grid-template-columns: 1fr; } }
.identity-review.is-pending { border-color: #f5c16c; box-shadow: inset 0 3px 0 #f59e0b; }
.identity-review.is-rejected { border-color: #f7c1bb; }
.identity-photos { display: grid; grid-template-columns: 1.6fr 1fr; gap: .6rem; }
.identity-photo { position: relative; display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--dark-900); border: 1px solid var(--border); }
.identity-photo img { display: block; width: 100%; height: 170px; object-fit: contain; background: #111; }
.identity-photo span { position: absolute; left: 0; right: 0; bottom: 0; font-size: .7rem; font-weight: 600; color: #fff; padding: .2rem .45rem; background: rgba(5, 36, 26, .8); }
