/* ============================================================
   DRAGONFLY — Design System v2.0  |  Palette Océan
   ============================================================ */

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

/* ── TOKENS ── */
:root {
    /* Couleurs principales */
    --primary:       #1d6cff;
    --primary-dark:  #1554d4;
    --primary-light: rgba(29, 108, 255, .1);
    --primary-glow:  rgba(29, 108, 255, .18);
    --accent:        #06b6d4;
    --accent-light:  rgba(6, 182, 212, .1);

    /* Sémantique */
    --success:       #10b981;
    --success-light: rgba(16, 185, 129, .1);
    --warning:       #f59e0b;
    --warning-light: rgba(245, 158, 11, .1);
    --danger:        #ef4444;
    --danger-light:  rgba(239, 68, 68, .1);

    /* Sidebar (palette Océan — bleu clair pastel) */
    --sidebar-bg:        #e8f1fb;
    --sidebar-border:    rgba(29, 108, 255, .13);
    --sidebar-text:      #4e6a9e;
    --sidebar-text-h:    #1e3264;
    --sidebar-hover:     rgba(29, 108, 255, .07);
    --sidebar-active-bg: rgba(29, 108, 255, .11);
    --sidebar-active:    #1d6cff;

    /* Gris neutres */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Layout */
    --sidebar-w:   248px;
    --topbar-h:    56px;
    --bottomnav-h: 62px;

    /* Forme */
    --radius:    12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Ombres */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
    --shadow:    0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg: 0 12px 24px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.06);

    /* Transitions */
    --ease: cubic-bezier(.16, 1, .3, 1);
    --dur:  .18s;
}

/* ── BASE ── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

svg {
    width: 18px; height: 18px;
    fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}


/* ╔══════════════════════════════════════════╗
   ║  LAYOUT                                  ║
   ╚══════════════════════════════════════════╝ */

.layout {
    display: flex;
    min-height: 100vh;
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 36px 40px;
    max-width: calc(1140px + var(--sidebar-w));
    min-width: 0;
}


/* ╔══════════════════════════════════════════╗
   ║  SIDEBAR — Desktop                       ║
   ╚══════════════════════════════════════════╝ */

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    transition: transform .3s var(--ease);
}
.sidebar::-webkit-scrollbar { display: none; }

/* Logo */
.sidebar-logo {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}
.logo-icon {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #fff; font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(29,108,255,.4);
}
.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e3264;
    letter-spacing: -.01em;
}
.logo-sub {
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8fa8cc;
    margin-top: 1px;
}

/* Sections de navigation */
.nav-section {
    padding: 14px 10px 4px;
    flex-shrink: 0;
}
.nav-section-label {
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9ab0d4;
    padding: 0 8px;
    margin-bottom: 4px;
}

/* Items de navigation */
.nav-links {
    list-style: none;
    flex: 1;
}
.nav-links a,
.nav-item-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 1px 0;
    color: var(--sidebar-text);
    border-radius: var(--radius-xs);
    font-size: .875rem;
    font-weight: 500;
    transition: background var(--dur), color var(--dur);
    text-decoration: none;
    cursor: pointer;
    position: relative;
}
.nav-links a svg,
.nav-item-link svg {
    width: 17px; height: 17px;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity var(--dur);
}
.nav-links a:hover,
.nav-item-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-h);
    text-decoration: none;
}
.nav-links a:hover svg,
.nav-item-link:hover svg { opacity: 1; }

.nav-links a.active,
.nav-item-link.active {
    background: var(--sidebar-active-bg);
    color: var(--primary);
}
.nav-links a.active svg,
.nav-item-link.active svg { opacity: 1; }

/* Indicateur actif */
.nav-links a.active::after,
.nav-item-link.active::after {
    content: '';
    position: absolute;
    right: 10px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

/* Séparateur visuel entre sections */
.nav-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 8px 18px;
}

/* Bas de sidebar — chip utilisateur */
.sidebar-bottom {
    padding: 14px 10px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-xs);
    background: rgba(29, 108, 255, .07);
    transition: background var(--dur);
    cursor: default;
}
.user-chip:hover { background: rgba(29, 108, 255, .13); }

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: .02em;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
    font-size: .8rem;
    font-weight: 600;
    color: #1e3264;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-level {
    font-size: .65rem;
    color: #8fa8cc;
    margin-top: 1px;
}
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: var(--radius-xs);
    color: #9ab0d4;
    transition: background var(--dur), color var(--dur);
    flex-shrink: 0;
    text-decoration: none;
}
.btn-logout:hover {
    background: var(--danger-light);
    color: var(--danger);
    text-decoration: none;
}
.btn-logout svg { width: 15px; height: 15px; }


/* ╔══════════════════════════════════════════╗
   ║  TOPBAR MOBILE                           ║
   ╚══════════════════════════════════════════╝ */

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--sidebar-bg);
    z-index: 150;
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    border-bottom: 1px solid var(--sidebar-border);
}
.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-xs);
    border: none;
    background: transparent;
    color: #4e6a9e;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dur), color var(--dur);
}
.hamburger:hover { background: rgba(29,108,255,.1); color: var(--primary); }
.hamburger svg { width: 20px; height: 20px; }

.topbar-logo {
    display: flex; align-items: center; gap: 9px;
    text-decoration: none; flex: 1;
}
.topbar-logo-icon {
    width: 28px; height: 28px;
    background: var(--primary);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; color: #fff; font-weight: 800;
}
.topbar-logo-text {
    font-size: .95rem; font-weight: 700; color: #1e3264;
}

.topbar-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

/* ── Overlay mobile ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 190;
    opacity: 0;
    transition: opacity .3s var(--ease);
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible {
    display: block;
}
.sidebar-overlay.active {
    opacity: 1;
}


/* ╔══════════════════════════════════════════╗
   ║  BOTTOM NAV MOBILE                       ║
   ╚══════════════════════════════════════════╝ */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottomnav-h);
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    z-index: 150;
    align-items: center;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-xs);
    transition: color var(--dur);
    font-size: .62rem; font-weight: 500;
}
.bottom-nav-item svg { width: 20px; height: 20px; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover { color: var(--sidebar-text-h); text-decoration: none; }

/* ── Indicateur bas de nav actif ── */
.bottom-nav-indicator {
    position: absolute;
    top: 0;
    width: 28px; height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--primary);
    transition: left .25s var(--ease);
}


/* ╔══════════════════════════════════════════╗
   ║  PAGE HEADER                             ║
   ╚══════════════════════════════════════════╝ */

.page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-left { min-width: 0; }
.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -.02em;
}
.page-header p {
    color: var(--gray-500);
    margin-top: 3px;
    font-size: .9rem;
}

/* Badge streak / infos */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}


/* ╔══════════════════════════════════════════╗
   ║  CARDS                                   ║
   ╚══════════════════════════════════════════╝ */

.card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: box-shadow var(--dur);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title svg { color: var(--gray-400); }

.card-action {
    margin-left: auto;
    font-size: .78rem;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
}
.card-action:hover { text-decoration: underline; }


/* ╔══════════════════════════════════════════╗
   ║  GRILLES                                 ║
   ╚══════════════════════════════════════════╝ */

.grid   { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }


/* ╔══════════════════════════════════════════╗
   ║  STAT CARDS                              ║
   ╚══════════════════════════════════════════╝ */

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px 20px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--dur), transform var(--dur);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Barre de couleur en haut de chaque stat card */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.sc-blue::before   { background: var(--primary); }
.stat-card.sc-cyan::before   { background: var(--accent); }
.stat-card.sc-green::before  { background: var(--success); }
.stat-card.sc-amber::before  { background: var(--warning); }

.stat-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.si-blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.si-cyan   { background: var(--accent-light);  color: var(--accent); }
.stat-icon.si-green  { background: var(--success-light); color: var(--success); }
.stat-icon.si-amber  { background: var(--warning-light); color: var(--warning); }

.stat-label {
    font-size: .72rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
    margin: 4px 0 2px;
    letter-spacing: -.02em;
}
.stat-unit { font-size: .78rem; color: var(--gray-400); }
.stat-trend {
    font-size: .75rem;
    font-weight: 600;
    margin-top: 6px;
}
.stat-trend.up   { color: var(--success); }
.stat-trend.muted { color: var(--gray-400); }

.stat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}
.stat-badge.green { background: var(--success-light); color: #065f46; }
.stat-badge.blue  { background: var(--primary-light); color: var(--primary-dark); }


/* ╔══════════════════════════════════════════╗
   ║  BOUTONS                                 ║
   ╚══════════════════════════════════════════╝ */

.btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 7px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 600;
    border: none; cursor: pointer;
    transition: all var(--dur);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(29,108,255,.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(29,108,255,.35);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary-light);
    text-decoration: none;
}

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0da271; color: #fff; text-decoration: none; }

.btn-lg { padding: 12px 28px; font-size: .95rem; border-radius: var(--radius-sm); }
.btn-sm { padding: 5px 14px; font-size: .8rem; border-radius: var(--radius-xs); }


/* ╔══════════════════════════════════════════╗
   ║  FORMULAIRES                             ║
   ╚══════════════════════════════════════════╝ */

.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: border-color var(--dur), box-shadow var(--dur);
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-error { color: var(--danger); font-size: .8rem; margin-top: 4px; }
.form-help  { color: var(--gray-500); font-size: .8rem; margin-top: 4px; }


/* ╔══════════════════════════════════════════╗
   ║  SLIDERS                                 ║
   ╚══════════════════════════════════════════╝ */

.slider-wrap { display: flex; flex-direction: column; gap: 8px; }
.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-label { font-size: .85rem; font-weight: 600; color: var(--gray-700); }
.slider-value {
    font-size: .85rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 20px;
    min-width: 52px;
    text-align: center;
}
input[type=range] {
    -webkit-appearance: none;
    width: 100%; height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(29,108,255,.35);
    transition: box-shadow var(--dur), transform var(--dur);
}
input[type=range]::-webkit-slider-thumb:hover {
    box-shadow: 0 2px 10px rgba(29,108,255,.5);
    transform: scale(1.1);
}
input[type=range]::-moz-range-thumb {
    width: 20px; height: 20px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}


/* ╔══════════════════════════════════════════╗
   ║  TABLEAUX                                ║
   ╚══════════════════════════════════════════╝ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }

thead th {
    background: var(--gray-50);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    border-bottom: 1.5px solid var(--gray-200);
    white-space: nowrap;
}
tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}
.badge-speed    { background: rgba(29,108,255,.1);  color: #1554d4; }
.badge-tachy    { background: rgba(109,40,217,.1);  color: #5b21b6; }
.badge-exercise { background: rgba(16,185,129,.1);  color: #065f46; }


/* ╔══════════════════════════════════════════╗
   ║  ACCORDÉON                               ║
   ╚══════════════════════════════════════════╝ */

.accordion {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.accordion + .accordion { margin-top: 8px; }

.accordion-header {
    padding: 14px 18px;
    background: var(--gray-50);
    cursor: pointer;
    font-weight: 600;
    font-size: .875rem;
    display: flex; justify-content: space-between; align-items: center;
    user-select: none;
    transition: background var(--dur);
}
.accordion-header:hover { background: var(--gray-100); }
.accordion-header .chevron {
    transition: transform .22s var(--ease);
    font-size: .7rem;
    color: var(--gray-400);
}
.accordion-header.open .chevron { transform: rotate(180deg); }

.accordion-body {
    display: none;
    padding: 18px;
    background: #fff;
    font-size: .875rem;
    color: var(--gray-600);
    line-height: 1.7;
    border-top: 1px solid var(--gray-100);
}
.accordion-body.open { display: block; }


/* ╔══════════════════════════════════════════╗
   ║  ALERTES                                 ║
   ╚══════════════════════════════════════════╝ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-error   { background: var(--danger-light);  color: #991b1b; border: 1px solid rgba(239,68,68,.2); }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid rgba(16,185,129,.2); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border: 1px solid rgba(29,108,255,.2); }


/* ╔══════════════════════════════════════════╗
   ║  GRAPHIQUES                              ║
   ╚══════════════════════════════════════════╝ */

.chart-container { position: relative; height: 220px; }
canvas { width: 100% !important; }


/* ╔══════════════════════════════════════════╗
   ║  MODULES D'ENTRAÎNEMENT                  ║
   ╚══════════════════════════════════════════╝ */

.module-card {
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    display: flex; flex-direction: column; gap: 12px;
    transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.module-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity var(--dur);
}
.module-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}
.module-card:hover::after { opacity: 1; }
.module-card.mc-blue::after  { background: var(--primary); }
.module-card.mc-cyan::after  { background: var(--accent); }
.module-card.mc-green::after { background: var(--success); }

.module-icon {
    width: 46px; height: 46px;
    background: var(--primary-light);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
}
.module-icon svg { width: 22px; height: 22px; color: var(--primary); stroke: var(--primary); }
.module-icon.mi-cyan  { background: var(--accent-light); }
.module-icon.mi-cyan svg  { color: var(--accent); stroke: var(--accent); }
.module-icon.mi-green { background: var(--success-light); }
.module-icon.mi-green svg { color: var(--success); stroke: var(--success); }

.module-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.module-desc  { color: var(--gray-500); font-size: .85rem; line-height: 1.6; flex: 1; }

.module-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 4px;
}
.module-cta svg { width: 14px; height: 14px; }


/* ╔══════════════════════════════════════════╗
   ║  TEST DE VITESSE                         ║
   ╚══════════════════════════════════════════╝ */

.text-list { display: grid; gap: 8px; }

.text-item {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--dur);
    background: #fff;
}
.text-item:hover  { border-color: var(--primary); background: var(--primary-light); }
.text-item.selected { border-color: var(--primary); background: var(--primary-light); }

.text-meta { flex: 1; min-width: 0; }
.text-name { font-weight: 600; color: var(--gray-800); font-size: .9rem; }
.text-info { font-size: .78rem; color: var(--gray-500); margin-top: 1px; }

.diff-badge { padding: 2px 9px; border-radius: 20px; font-size: .7rem; font-weight: 700; }
.diff-easy   { background: var(--success-light); color: #065f46; }
.diff-medium { background: var(--warning-light); color: #92400e; }
.diff-hard   { background: var(--danger-light);  color: #991b1b; }

#reading-panel { display: none; }
#reading-text {
    font-size: 1rem; line-height: 1.9; color: var(--gray-800);
    padding: 24px;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
    user-select: none;
}
.timer-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
#timer-display { font-size: 1.4rem; font-weight: 700; color: var(--primary); min-width: 60px; }
.progress-bar { flex: 1; height: 5px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width .3s;
}


/* ╔══════════════════════════════════════════╗
   ║  TACHISTOSCOPE                           ║
   ╚══════════════════════════════════════════╝ */

#tachi-display {
    min-height: 180px;
    background: var(--gray-900);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .03em;
    user-select: none;
    margin: 20px 0;
    transition: background var(--dur);
}
#tachi-display .placeholder { color: var(--gray-600); font-size: 1rem; font-weight: 400; }


/* ╔══════════════════════════════════════════╗
   ║  GAMMES / EXERCICES                      ║
   ╚══════════════════════════════════════════╝ */

.exercise-card {
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 22px;
    cursor: pointer;
    transition: all var(--dur);
}
.exercise-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.exercise-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.exercise-card p  { font-size: .85rem; color: var(--gray-500); }

.exercise-area {
    font-family: 'Courier New', monospace;
    font-size: 1rem; line-height: 2;
    text-align: center; color: var(--gray-800);
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    min-height: 200px;
    white-space: pre;
    overflow-x: auto;
}
.exercise-area .center-dot { color: var(--primary); font-weight: 900; font-size: 1.2rem; }


/* ╔══════════════════════════════════════════╗
   ║  PAGE MÉTHODE                            ║
   ╚══════════════════════════════════════════╝ */

.method-principle {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 18px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: #fff;
    transition: box-shadow var(--dur);
}
.method-principle:hover { box-shadow: var(--shadow); }

.principle-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.principle-content h3 { font-size: .9rem; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.principle-content p  { font-size: .85rem; color: var(--gray-500); line-height: 1.6; }
.solution-tag {
    display: inline-block; margin-top: 6px;
    font-size: .72rem; font-weight: 600;
    color: var(--success); background: var(--success-light);
    padding: 2px 8px; border-radius: 20px;
}


/* ╔══════════════════════════════════════════╗
   ║  QUESTIONNAIRE                           ║
   ╚══════════════════════════════════════════╝ */

.question-card { padding: 18px 0; border-bottom: 1px solid var(--gray-100); }
.question-card:last-child { border-bottom: none; }
.question-text { font-weight: 600; font-size: .9rem; color: var(--gray-800); margin-bottom: 12px; }

.likert { display: flex; gap: 6px; }
.likert label {
    flex: 1; text-align: center;
    padding: 8px 4px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .72rem; color: var(--gray-600); font-weight: 500;
    transition: all var(--dur);
}
.likert input[type=radio] { display: none; }
.likert input:checked + label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}
.likert label:hover { border-color: var(--gray-300); background: var(--gray-50); }

.quiz-result {
    padding: 22px;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-top: 20px;
    border: 1px solid rgba(29,108,255,.15);
}
.quiz-result h3 { font-size: 1rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 12px; }
.quiz-brake {
    padding: 10px 14px; background: #fff; border-radius: var(--radius-xs);
    margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start;
}
.brake-score { font-size: 1.3rem; font-weight: 800; color: var(--primary); min-width: 34px; }


/* ╔══════════════════════════════════════════╗
   ║  PAGE CONNEXION                          ║
   ╚══════════════════════════════════════════╝ */

/* ╔══════════════════════════════════════════╗
   ║  PAGE CONNEXION — Split Screen            ║
   ╚══════════════════════════════════════════╝ */

.auth-body { background: var(--gray-100); }

.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── Panneau gauche : hero éditorial ── */
.auth-hero {
    background: #0d1f3c;
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(29,108,255,.25) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(6,182,212,.15) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 48px 52px;
}
.auth-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 480px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}
.auth-brand-icon {
    width: 42px; height: 42px;
    background: var(--primary);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 800; color: #fff;
    box-shadow: 0 4px 14px rgba(29,108,255,.5);
    flex-shrink: 0;
}
.auth-brand-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.01em;
}
.auth-brand-sub {
    font-size: .65rem;
    color: rgba(255,255,255,.4);
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.auth-headline {
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.08;
    letter-spacing: -.03em;
    margin-bottom: 18px;
}
.auth-headline-accent {
    background: linear-gradient(135deg, #1d6cff 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-tagline {
    color: rgba(255,255,255,.55);
    font-size: .9rem;
    line-height: 1.75;
    margin-bottom: 36px;
    max-width: 380px;
}

.auth-benefits {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}
.auth-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.auth-benefit-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.auth-benefits li > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.auth-benefits li strong {
    font-size: .88rem;
    font-weight: 700;
    color: #fff;
}
.auth-benefits li span {
    font-size: .8rem;
    color: rgba(255,255,255,.45);
    line-height: 1.55;
}

.auth-quote {
    border-left: 2px solid rgba(29,108,255,.5);
    padding-left: 16px;
    margin-top: 4px;
}
.auth-quote p, .auth-quote {
    font-size: .82rem;
    font-style: italic;
    color: rgba(255,255,255,.4);
    line-height: 1.7;
}
.auth-quote cite {
    font-style: normal;
    font-size: .75rem;
    color: rgba(255,255,255,.28);
    margin-top: 6px;
    display: block;
}

/* Décorations géométriques */
.auth-deco {
    position: absolute;
    border-radius: 50%;
    z-index: 1;
    opacity: .07;
}
.auth-deco-1 {
    width: 380px; height: 380px;
    background: var(--primary);
    top: -120px; right: -120px;
}
.auth-deco-2 {
    width: 220px; height: 220px;
    background: var(--accent);
    bottom: -60px; left: -60px;
}
.auth-deco-3 {
    width: 140px; height: 140px;
    background: #fff;
    bottom: 120px; right: 20px;
}

/* ── Panneau droit : formulaire ── */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--gray-50);
}
.auth-form-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 18px;
    padding: 36px;
    box-shadow: 0 4px 24px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.05);
}

/* Onglets */
.auth-tabs {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-500);
    transition: all var(--dur);
    font-family: inherit;
}
.auth-tab:hover { color: var(--gray-800); }
.auth-tab.active {
    background: #fff;
    color: var(--gray-900);
    box-shadow: var(--shadow-xs);
}

/* Bouton Google */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: .88rem;
    font-weight: 600;
    color: var(--gray-700);
    text-decoration: none;
    transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
    cursor: pointer;
    margin-bottom: 16px;
}
.btn-google:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow);
    background: var(--gray-50);
    text-decoration: none;
    color: var(--gray-700);
}
.btn-google svg { flex-shrink: 0; }

/* Séparateur "ou" */
.auth-separator {
    position: relative;
    text-align: center;
    margin: 18px 0;
}
.auth-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: var(--gray-200);
}
.auth-separator span {
    position: relative;
    background: #fff;
    padding: 0 12px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* Lien "oublié" dans le label */
.form-label-link {
    font-size: .75rem;
    font-weight: 500;
    color: var(--gray-400);
    margin-left: auto;
    text-decoration: none;
    float: right;
}
.form-label-link:hover { color: var(--primary); }

/* Champ mot de passe avec œil */
.input-password-wrap { position: relative; }
.input-password-wrap .form-input { padding-right: 42px; }
.btn-eye {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--dur);
}
.btn-eye:hover { color: var(--gray-600); }
.btn-eye svg { width: 16px; height: 16px; }

/* Barre de force mot de passe */
.pwd-strength-bar {
    height: 3px;
    background: var(--gray-200);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}
#pwd-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width .3s, background .3s;
}

/* Bouton submit */
.auth-submit { width: 100%; margin-top: 8px; }

/* Footer de la carte */
.auth-card-footer {
    text-align: center;
    margin-top: 22px;
    font-size: .75rem;
    color: var(--gray-400);
    line-height: 1.6;
}
.auth-card-footer a { color: var(--gray-400); }
.auth-card-footer a:hover { color: var(--primary); }

/* ── Responsive connexion ── */
@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-hero {
        padding: 32px 24px;
        min-height: auto;
    }
    .auth-headline { font-size: 2rem; }
    .auth-benefits { display: none; }
    .auth-quote    { display: none; }
    .auth-tagline  { margin-bottom: 0; }
    .auth-form-panel { padding: 28px 20px; }
    .auth-form-card { padding: 28px 22px; }
}

@media (max-width: 480px) {
    .auth-hero { padding: 24px 20px; }
    .auth-headline { font-size: 1.7rem; }
    .auth-tagline { font-size: .82rem; }
}


/* ╔══════════════════════════════════════════╗
   ║  PAGE ACCUEIL                            ║
   ╚══════════════════════════════════════════╝ */

.hero { margin-bottom: 28px; }
.hero h1 { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.03em; }
.hero p { color: var(--gray-500); font-size: 1rem; margin-top: 8px; max-width: 600px; }
.hero-author { margin-top: 10px; font-size: .82rem; color: var(--gray-400); }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.quick-card {
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 8px;
    text-decoration: none; color: inherit;
    transition: all var(--dur);
}
.quick-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none; color: inherit;
}
.quick-card-icon  { font-size: 1.6rem; }
.quick-card-title { font-weight: 700; font-size: .9rem; color: var(--gray-900); }
.quick-card-desc  { font-size: .8rem; color: var(--gray-500); }


/* ╔══════════════════════════════════════════╗
   ║  PAGE LIVRE                              ║
   ╚══════════════════════════════════════════╝ */

.book-cover  { width: 180px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.book-layout { display: flex; gap: 32px; align-items: flex-start; }
.book-info   { flex: 1; }
.book-title  { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.02em; }
.book-author { color: var(--gray-500); font-size: .9rem; margin-top: 4px; }
.book-description { color: var(--gray-600); line-height: 1.8; margin: 14px 0; font-size: .9rem; }
.book-features { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.book-features li { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--gray-700); }
.book-features li::before { content: "✓"; color: var(--success); font-weight: 700; }
.tagline {
    font-style: italic; font-size: 1rem; color: var(--gray-600);
    border-left: 3px solid var(--primary);
    padding-left: 16px; margin: 18px 0;
    border-radius: 0;
}


/* ╔══════════════════════════════════════════╗
   ║  PROGRAMME 21 JOURS                      ║
   ╚══════════════════════════════════════════╝ */

.week-card { padding: 18px 20px; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); background: #fff; }
.week-number { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.week-title  { font-size: .95rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.week-desc   { font-size: .85rem; color: var(--gray-500); line-height: 1.6; }
.week-goal {
    display: inline-block; margin-top: 8px;
    padding: 3px 10px; background: var(--success-light); color: #065f46;
    border-radius: 20px; font-size: .72rem; font-weight: 700;
}


/* ╔══════════════════════════════════════════╗
   ║  RESPONSIVE — Tablette (≤ 1024px)        ║
   ╚══════════════════════════════════════════╝ */

@media (max-width: 1024px) {
    .main-content { padding: 28px 24px; }
}


/* ╔══════════════════════════════════════════╗
   ║  RESPONSIVE — Mobile (≤ 900px)           ║
   ╚══════════════════════════════════════════╝ */

@media (max-width: 900px) {
    /* Sidebar devient un drawer */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        top: 0;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    /* Topbar mobile visible */
    .mobile-topbar { display: flex; }

    /* Bottom nav visible */
    .bottom-nav { display: flex; }

    /* Contenu principal : décalage topbar + padding bottomnav */
    .main-content {
        margin-left: 0;
        padding: calc(var(--topbar-h) + 20px) 16px calc(var(--bottomnav-h) + 16px);
    }

    /* Grilles */
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }

    /* Page header simplifié */
    .page-header { flex-direction: column; gap: 10px; }
    .streak-badge { align-self: flex-start; }

    /* Livre */
    .book-layout { flex-direction: column; }
    .book-cover  { width: 110px; }
}


/* ╔══════════════════════════════════════════╗
   ║  RESPONSIVE — Petit mobile (≤ 600px)     ║
   ╚══════════════════════════════════════════╝ */

@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .main-content { padding-left: 12px; padding-right: 12px; }
    .likert { flex-wrap: wrap; }
    .likert label { flex: 1 0 40%; }
    .stat-value { font-size: 1.6rem; }
}

/* ╔══════════════════════════════════════════╗
   ║  MODULE MÉMOIRE & NOTES                  ║
   ╚══════════════════════════════════════════╝ */

/* ── Onglets ── */
.mem-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.mem-tab {
    flex: 1;
    min-width: 0;
    padding: 9px 14px;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius) - 3px);
    font-size: .82rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.mem-tab:hover { color: var(--gray-800); background: var(--gray-200); }
.mem-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,.10);
}
.mem-tab-icon { font-size: 1rem; }

/* ── Cards insight ── */
.mem-insight-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}
.mem-insight-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.mem-insight-title { font-weight: 700; font-size: .9rem; color: var(--gray-800); margin-bottom: 3px; }
.mem-insight-text { font-size: .83rem; color: var(--gray-600); line-height: 1.6; }

/* ── Steps ── */
.mem-step-card {
    padding: 18px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-top: 3px solid var(--step-color, var(--primary));
}
.mem-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 800;
    margin-bottom: 10px;
}
.mem-step-title { font-weight: 700; font-size: .95rem; color: var(--gray-800); margin-bottom: 6px; }
.mem-step-text { font-size: .83rem; color: var(--gray-600); line-height: 1.65; }

/* ── Timer bar ── */
.timer-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

/* ── Liste de textes ── */
.text-list { display: flex; flex-direction: column; gap: 10px; }
.text-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.text-item:hover { border-color: var(--primary); background: var(--primary-light); }
.text-item-icon { font-size: 1.4rem; flex-shrink: 0; }
.text-item-title { font-weight: 600; font-size: .9rem; color: var(--gray-800); }
.text-item-meta { font-size: .78rem; color: var(--gray-500); margin-top: 2px; }
.text-item-arrow { width: 16px; height: 16px; stroke: var(--gray-400); fill: none; stroke-width: 2; margin-left: auto; flex-shrink: 0; }

/* ── Score circle ── */
.mem-score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .3s;
}
.mem-score-circle.score-high { border-color: var(--success); }
.mem-score-circle.score-mid  { border-color: var(--warning); }
.mem-score-circle.score-low  { border-color: var(--danger); }
.mem-score-value { font-size: 1.5rem; font-weight: 800; color: var(--gray-800); }
.mem-score-label { font-size: .7rem; color: var(--gray-500); font-weight: 500; }

/* ── Tags mots-clés ── */
.keyword-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 500;
    margin: 3px 4px 3px 0;
}
.keyword-tag.found { background: var(--success-light); color: #15803d; }
.keyword-tag.missed { background: var(--danger-light); color: #b91c1c; text-decoration: line-through; }

/* ── Cornell template ── */
.cornell-template {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-family: inherit;
}
.cornell-header {
    background: var(--gray-100);
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-200);
}
.cornell-body { display: flex; min-height: 180px; }
.cornell-cues {
    width: 30%;
    border-right: 1.5px solid var(--gray-200);
    padding: 12px;
    background: #fafbff;
}
.cornell-notes-zone { flex: 1; padding: 12px; }
.cornell-zone-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary);
    opacity: .6;
}
.cornell-summary-zone {
    border-top: 1.5px solid var(--gray-200);
    padding: 10px 12px;
    background: #fffdf0;
    min-height: 56px;
}

/* ── Cornell pratique ── */
.cornell-practice { border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); overflow: hidden; }
.cornell-practice-body { display: flex; min-height: 220px; }
.cornell-practice-cues {
    width: 30%;
    border-right: 1.5px solid var(--gray-200);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cornell-practice-notes {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cornell-practice-summary {
    border-top: 1.5px solid var(--gray-200);
    padding: 12px;
    background: #fffdf0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cornell-practice-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
}
.cornell-practice .form-textarea {
    flex: 1;
    resize: vertical;
    background: transparent;
    border: none;
    outline: none;
    font-size: .85rem;
    line-height: 1.7;
    color: var(--gray-700);
    padding: 0;
}
.cornell-practice .form-textarea:focus { box-shadow: none; }

/* ── Questionnaire freins ── */
.quiz-question-text {
    font-size: .9rem;
    color: var(--gray-800);
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.55;
}
.quiz-scale {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.quiz-option { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.quiz-option input[type=radio] { display: none; }
.quiz-option-label {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 700;
    color: var(--gray-500);
    transition: all .15s;
    cursor: pointer;
}
.quiz-option input:checked + .quiz-option-label {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.quiz-option:hover .quiz-option-label { border-color: var(--primary); color: var(--primary); }
.quiz-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: .7rem;
    color: var(--gray-400);
    margin-left: 4px;
    flex: 1;
    min-width: 80px;
}

/* ── Mind Map ── */
.mm-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}
.mm-compare-col {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.mm-compare-header {
    padding: 8px 14px;
    font-size: .78rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: .02em;
}
.mm-compare-list {
    list-style: none;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.mm-compare-list li {
    font-size: .82rem;
    color: var(--gray-600);
    line-height: 1.55;
    padding-left: 14px;
    position: relative;
}
.mm-compare-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--gray-400);
    font-size: .75rem;
}

.mm-law-card {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-top: 3px solid var(--law-color, var(--primary));
}
.mm-law-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--law-color, var(--primary));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 800;
    margin-bottom: 8px;
}
.mm-law-title { font-weight: 700; font-size: .9rem; color: var(--gray-800); margin-bottom: 6px; }
.mm-law-text { font-size: .81rem; color: var(--gray-600); line-height: 1.65; }

.mm-builder-form { display: flex; flex-direction: column; gap: 12px; }
.mm-center-input label { display: block; margin-bottom: 6px; }
.mm-branch-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}
.mm-branch-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 12px;
}
.mm-branch-input { flex: 1; min-width: 160px; }
.mm-subs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
    padding-left: 20px;
}
.mm-sub-input { width: 140px !important; font-size: .8rem !important; padding: 5px 10px !important; }
.mm-addsub-btn {
    font-size: .75rem;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    width: 100%;
    text-align: left;
    padding-left: 20px;
}
.mm-addsub-btn:hover { color: var(--primary); }
.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: .82rem;
    color: var(--primary);
    padding: 0;
    text-decoration: underline;
}
.btn-link:hover { color: var(--primary-dark); }

/* ── Mobile adjustments ── */
@media (max-width: 900px) {
    .mem-tabs { flex-wrap: nowrap; }
    .mem-tab { font-size: .75rem; padding: 8px 10px; }
    .cornell-practice-body { flex-direction: column; }
    .cornell-practice-cues { width: 100%; border-right: none; border-bottom: 1.5px solid var(--gray-200); }
    .cornell-body { flex-direction: column; }
    .cornell-cues { width: 100%; border-right: none; border-bottom: 1.5px solid var(--gray-200); }
    .mm-compare { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}
