/* =====================================================
   Dashboard — Style principal
   Police : Syne (titres) + DM Sans (corps)
   Palette : Slate foncé + Ambre chaud
   ===================================================== */

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

:root {
    --sidebar-w: 240px;
    --sidebar-bg: #0f172a;
    --sidebar-border: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #f8fafc;
    --sidebar-hover-bg: #1e293b80;

    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: #fef3c7;

    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;

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

    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --neutral-bg: #f1f5f9;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
}

html, body {
    height: 100%;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ── Layout ── */
body { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    z-index: 200;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 8px;
}

.brand-icon {
    font-size: 22px;
    color: var(--accent);
    line-height: 1;
}

.brand-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #f8fafc;
    letter-spacing: .5px;
}

.sidebar-section-label {
    padding: 8px 18px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--sidebar-text);
    opacity: .6;
}

.sidebar-nav {
    list-style: none;
    padding: 4px 10px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
}

.nav-item:hover { background: var(--sidebar-hover-bg); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--accent); font-weight: 500; }

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 18px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer small { opacity: .5; }

.logout-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    margin: 0 -8px;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, .15);
    color: #fca5a5;
}

.logout-btn i { font-size: 14px; }

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

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
}

.topbar-title h1 {
    font-family: 'Syne', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.topbar-subtitle {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Page Body ── */
.page-body { padding: 24px 28px; flex: 1; }

/* ── Cards / Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card.accent { border-left: 3px solid var(--accent); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.danger  { border-left: 3px solid var(--danger);  }
.stat-card.warning { border-left: 3px solid var(--warning); }

/* ── Table ── */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.table-card-header h2 {
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    background: var(--surface-2);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8fafc; }

.data-table .company-cell { font-weight: 500; }
.data-table .muted { color: var(--text-muted); font-size: 12.5px; }

.actions-cell { display: flex; gap: 6px; white-space: nowrap; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-success  { background: var(--success-bg); color: #065f46; }
.badge-danger   { background: var(--danger-bg);  color: #991b1b; }
.badge-warning  { background: var(--warning-bg); color: #92400e; }
.badge-neutral  { background: var(--neutral-bg); color: var(--text-secondary); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background .15s, transform .1s;
    white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }

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

.btn-danger    { background: var(--danger-bg); color: var(--danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fecaca; }

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

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Forms ── */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px 28px;
    max-width: 780px;
}

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

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: .3px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="password"],
input[type="number"],
select,
textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Remettre la flèche native sur les select */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px #f59e0b25;
}

textarea { resize: vertical; min-height: 80px; }

.form-footer {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ── Alert ── */
.alert {
    padding: 11px 16px;
    border-radius: var(--radius);
    margin: 16px 28px 0;
    font-size: 13.5px;
    font-weight: 500;
    animation: slideDown .2s ease;
}

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

.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Search / Filters ── */
.filters-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    width: 220px;
    outline: none;
    transition: border-color .15s;
}

.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #f59e0b25; }

/* ── Search wrapper with icon ── */
.search-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-wrapper .bi {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    line-height: 1;
}

.search-wrapper .search-input {
    padding-left: 36px;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; line-height: 1; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13.5px; margin-bottom: 18px; }

/* ── Modal confirmation ── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 400px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
}

.modal h3 { font-family: 'Syne', sans-serif; font-size: 17px; margin-bottom: 10px; }
.modal p  { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Burger button (mobile) ── */
.burger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-primary);
    flex-shrink: 0;
}

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

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

/* ── Responsive ── */
@media (max-width: 700px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: 240px;
    }
    .sidebar.open { transform: translateX(0); }
    .burger-btn { display: flex; }
    .main-content { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
    .page-body { padding: 16px; }
    .topbar { padding: 14px 16px; }
    .cat-grid { grid-template-columns: 1fr; }
    .action-cards-grid { grid-template-columns: 1fr; }
    .test-container, .revision-container { padding: 0; }
}

/* =====================================================
   Préparation entretiens — Styles spécifiques
   ===================================================== */

/* ── Tri ── */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sort-label { font-size: 12px; color: var(--text-muted); }

.sort-chip {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all .15s;
}

.sort-chip:hover { background: var(--surface-2); }
.sort-chip.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent-hover); font-weight: 500; }

/* ── Grille catégories ── */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.cat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    transition: transform .2s, border-color .2s, box-shadow .2s;
    box-shadow: var(--shadow);
    display: block;
}

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

.cat-card-accent {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--cat-color);
    opacity: .7;
}

.cat-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.cat-card-info { display: flex; align-items: center; gap: 10px; }
.cat-card-icon { font-size: 24px; line-height: 1; }
.cat-card-name { font-size: 15px; font-weight: 600; }
.cat-card-count { font-size: 12px; color: var(--text-muted); }

.cat-card-stats { display: flex; gap: 8px; }

.cat-stat {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
    border-radius: var(--radius);
}

.cat-stat-success { background: #d1fae520; }
.cat-stat-warning { background: #fef3c720; }
.cat-stat-danger  { background: #fee2e220; }

.cat-stat-value { font-size: 16px; font-weight: 700; }
.cat-stat-success .cat-stat-value { color: var(--success); }
.cat-stat-warning .cat-stat-value { color: var(--warning); }
.cat-stat-danger  .cat-stat-value { color: var(--danger); }

.cat-stat-label { font-size: 10px; color: var(--text-muted); }

.cat-card-delete {
    position: absolute;
    top: 10px; right: 10px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    opacity: .5;
    transition: opacity .15s, color .15s, background .15s;
    padding: 4px 6px;
    border-radius: var(--radius);
    line-height: 1;
}

.cat-card:hover .cat-card-delete { opacity: .8; }
.cat-card-delete:hover { opacity: 1 !important; color: var(--danger); background: var(--danger-bg); border-color: #fca5a5; }

/* ── Color picker (modal) ── */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.color-swatch input { display: none; }
.color-swatch span {
    display: block; width: 28px; height: 28px;
    border-radius: 50%; cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, transform .15s;
}
.color-swatch input:checked + span { border-color: var(--text-primary); transform: scale(1.15); }

/* ── Action cards (test / revision) ── */
.action-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform .2s, border-color .2s, box-shadow .2s;
    box-shadow: var(--shadow);
    display: block;
}

.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.action-card.disabled { opacity: .4; pointer-events: none; }

.action-card-test:hover { border-color: var(--accent); }
.action-card-revision:hover { border-color: var(--success); }

.action-card-icon { font-size: 28px; margin-bottom: 10px; color: var(--text-secondary); }
.action-card-title { font-size: 16px; font-weight: 700; margin-bottom: 5px; }
.action-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }

.action-card-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}

.action-card-test .action-card-btn { background: var(--accent-light); color: var(--accent-hover); }
.action-card-revision .action-card-btn { background: var(--success-bg); color: #065f46; }

/* ── Section génération ── */
.generate-section {
    background: var(--surface);
    border: 1px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.generate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.generate-info {
    display: flex; align-items: center; gap: 10px;
}

.generate-info i { font-size: 22px; color: var(--warning); }
.generate-info strong { display: block; font-size: 14px; }
.generate-info span { display: block; font-size: 12px; color: var(--text-muted); }

.btn-accent {
    background: var(--accent); color: #000;
    padding: 9px 20px; border-radius: 10px;
    border: none; font-weight: 600; cursor: pointer;
    font-family: 'DM Sans', sans-serif; font-size: 13px;
    display: inline-flex; align-items: center; gap: 7px;
    transition: background .15s;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:disabled { background: var(--surface-2); color: var(--text-muted); cursor: wait; }

.btn-success {
    background: var(--success); color: #fff;
}
.btn-success:hover { background: #059669; }

.btn-success-outline { background: var(--success-bg); color: #065f46; border: 1px solid #6ee7b7; }
.btn-success-outline:hover { background: #a7f3d0; }

.btn-danger-outline { background: var(--danger-bg); color: #991b1b; border: 1px solid #fca5a5; }
.btn-danger-outline:hover { background: #fecaca; }

/* ── Spinner ── */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

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

/* ── Génération preview ── */
.gen-preview {
    margin-top: 18px;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface-2);
    animation: slideDown .3s ease;
}

.gen-preview-label { font-size: 11px; font-weight: 700; color: var(--warning); letter-spacing: .5px; margin-bottom: 10px; }
.gen-preview-question { font-size: 15px; font-weight: 600; line-height: 1.5; margin-bottom: 14px; }

.gen-preview-answer-box {
    padding: 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    margin-bottom: 16px;
}

.gen-preview-answer-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.gen-preview-answer { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.gen-preview-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.gen-duplicate {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--danger-bg);
    border: 1px solid #fca5a5;
    display: flex; align-items: center; gap: 10px;
    animation: slideDown .3s ease;
}

.gen-duplicate i { font-size: 18px; color: var(--danger); animation: spin 1.5s linear infinite; }
.gen-duplicate strong { display: block; font-size: 13px; color: #991b1b; }
.gen-duplicate span { display: block; font-size: 12px; color: var(--text-muted); }

.gen-error {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--danger-bg);
    border: 1px solid #fca5a5;
    color: #991b1b;
    font-size: 13px;
}

/* ── Questions list ── */
.questions-list { padding: 0; }

.question-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

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

.question-content { flex: 1; min-width: 0; }
.question-text { font-size: 14px; font-weight: 500; }
.question-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.question-status { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.streak-dots { display: flex; gap: 3px; }

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

.streak-dot.mastered { background: var(--success); }
.streak-dot.progress  { background: var(--warning); }
.streak-dot.weak      { background: var(--danger); }

.badge-mastered { background: var(--success-bg); color: #065f46; }
.badge-progress { background: var(--warning-bg); color: #92400e; }
.badge-weak     { background: var(--danger-bg);  color: #991b1b; }

.streak-count { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* ── Test mode ── */
.test-container { max-width: 700px; }

.test-progress-bar { margin-bottom: 24px; }

.test-progress-info {
    display: flex; justify-content: space-between;
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 8px;
}

.test-score { color: var(--success); font-weight: 600; }

.progress-track {
    height: 4px; border-radius: 2px;
    background: var(--border);
}

.progress-fill {
    height: 100%; border-radius: 2px;
    background: var(--accent);
    transition: width .4s ease;
}

.test-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.test-question {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 20px;
}

.test-card textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    resize: vertical;
    outline: none;
    transition: border-color .15s;
}

.test-card textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #f59e0b25; }

.test-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── AI Feedback ── */
.ai-feedback {
    padding: 18px; border-radius: var(--radius-lg);
    background: #eff6ff; border: 1px solid #93c5fd;
    margin-bottom: 16px;
}

.ai-feedback-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: #1e40af; }
.ai-feedback-body { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.ai-feedback-body p { margin-bottom: 4px; }

.text-success { color: var(--success); font-weight: 500; }
.text-warning { color: var(--accent-hover); font-weight: 500; }

.ai-score {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.score-good { background: var(--success-bg); color: #065f46; }
.score-mid  { background: var(--warning-bg); color: #92400e; }
.score-low  { background: var(--danger-bg);  color: #991b1b; }

.expected-answer {
    padding: 16px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--border);
    margin-bottom: 18px;
}

.expected-label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .5px; margin-bottom: 6px; }
.expected-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ── Test final ── */
.test-final {
    text-align: center;
    padding: 48px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.test-final-icon { font-size: 48px; color: var(--accent); margin-bottom: 16px; }
.test-final h2 { font-family: 'Syne', sans-serif; margin-bottom: 16px; }

.final-score-value {
    font-family: 'Syne', sans-serif;
    font-size: 48px;
    font-weight: 800;
    color: var(--accent);
}

.final-score-pct { font-size: 20px; color: var(--text-secondary); }
.test-final-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }

/* ── Révision ── */
.revision-container { max-width: 700px; }

.revision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.revision-streak {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 20px;
}

.revision-answer {
    padding: 18px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-top: 16px;
    animation: slideDown .3s ease;
}

.revision-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* ── Stats bar chart ── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 120px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bar-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 60%;
    height: 100px;
    justify-content: flex-end;
}

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

.bar-correct { background: var(--success); border-radius: 3px 3px 0 0; }
.bar-incorrect { background: var(--danger); border-radius: 0 0 3px 3px; }
.bar-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Stats mastery ── */
.mastery-row { margin-bottom: 14px; }

.mastery-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

.mastery-track {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
}

.mastery-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .6s ease;
}