/* ============================================================
   style.css — Suivi des devoirs
   1. Jetons de design      2. Base            3. Structure
   4. Composants            5. Écrans d'accueil
   6. Synthèse              7. Tableau des notes
   8. Graphiques            9. Réglages, notifications, accès
   10. Modules métier (bac, niveaux, jalons…)   11. Ajustements
   12. Mobile               13. Mouvements réduits
   ============================================================ */

/* === 1. JETONS DE DESIGN === */
:root {
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --on-accent: #FFFFFF;
  --panel: var(--wash);                  /* compatibilité : modules métier */
  --panel2: var(--wash-2);

  /* Thème clair (A) — par défaut */
  color-scheme: light;
  --bg: #F5F6FA;
  --bg-grad: radial-gradient(1000px 480px at 0% -12%, rgba(79,95,232,0.07), transparent 60%);
  --surface: #FFFFFF; --surface-2: #F3F5F9; --surface-3: #E9ECF3; --elevated: #FFFFFF; --surface-hover: #F8F9FC;
  --glass: rgba(245,246,250,0.84); --glass-nav: rgba(255,255,255,0.92);
  --border: #E4E7EF; --border-strong: #CDD3DF;
  --text: #1B2033; --muted: #5F6779; --faint: #8A92A5;
  --accent: #4F5FE8; --accent-fill: #4F5FE8; --accent-soft: #E9ECFF; --accent-ink: #3440C4; --violet: #7C5CF0;
  --accent2: #9A6200;
  --good: #0F7A58; --good-bg: #E1F4EC; --good-ink: #0B6448;
  --warn: #9A6200; --warn-bg: #FBEFD8; --warn-ink: #734800;
  --bad: #C23450;  --bad-bg: #FCE6EA;  --bad-ink: #9E2440;
  --gold: #D9A300;
  --grade-bad: #C23450; --grade-bad-bg: #FCE6EA; --grade-warn: #9A6200; --grade-warn-bg: #FBEFD8;
  --grade-good: #0F7A58; --grade-good-bg: #E1F4EC; --grade-top: #3440C4; --grade-top-bg: #E6E9FF;
  --ink-wash: #1B2033; --wash: rgba(27,32,51,0.04); --wash-2: rgba(27,32,51,0.07); --sunken: #EEF1F6;
  --scrim: rgba(20,24,40,0.36); --chart-grid: rgba(27,32,51,0.08); --knob: #FFFFFF;
  --shadow: 0 1px 2px rgba(20,24,40,0.06), 0 8px 24px -12px rgba(20,24,40,0.16);
  --shadow-lg: 0 24px 60px -16px rgba(20,24,40,0.30);
  --ring: 0 0 0 3px rgba(79,95,232,0.28);
}
/* Thème sombre (B) : l'appareil est en mode sombre, sauf choix « clair »… */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1020;
    --bg-grad: radial-gradient(1100px 520px at 8% -12%, rgba(130,152,255,0.12), transparent 62%), radial-gradient(800px 460px at 108% -4%, rgba(95,221,176,0.06), transparent 58%);
    --surface: #141B2D; --surface-2: #1A2338; --surface-3: #222D46; --elevated: #1C2640; --surface-hover: #182036;
    --glass: rgba(11,16,32,0.84); --glass-nav: rgba(20,27,45,0.92);
    --border: #243049; --border-strong: #33415F;
    --text: #E6EAF2; --muted: #95A1B6; --faint: #6B7690;
    --accent: #8298FF; --accent-fill: #5B6FF0; --accent-soft: #1E2750; --accent-ink: #C3CEFF; --violet: #9D84FF;
    --accent2: #F5B85A;
    --good: #5FDDB0; --good-bg: #12342B; --good-ink: #9EF0CF;
    --warn: #F5B85A; --warn-bg: #3A2C12; --warn-ink: #FAD69A;
    --bad: #FF8DA1;  --bad-bg: #3B1822;  --bad-ink: #FFC2CD;
    --gold: #FBBF24;
    --grade-bad: #FF8DA1; --grade-bad-bg: #3B1822; --grade-warn: #F5B85A; --grade-warn-bg: #3A2C12;
    --grade-good: #5FDDB0; --grade-good-bg: #123429; --grade-top: #A3B3FF; --grade-top-bg: #1F2A57;
    --ink-wash: #FFFFFF; --wash: rgba(255,255,255,0.04); --wash-2: rgba(255,255,255,0.08); --sunken: rgba(0,0,0,0.22);
    --scrim: rgba(3,6,14,0.62); --chart-grid: rgba(148,163,184,0.14); --knob: #CBD5E1;
    --shadow: 0 1px 2px rgba(0,0,0,0.30), 0 12px 32px -14px rgba(0,0,0,0.55);
    --shadow-lg: 0 28px 70px -16px rgba(0,0,0,0.75);
    --ring: 0 0 0 3px rgba(130,152,255,0.35);
  }
}
/* …ou l'utilisateur a choisi « sombre » (Réglages → Apparence). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1020;
  --bg-grad: radial-gradient(1100px 520px at 8% -12%, rgba(130,152,255,0.12), transparent 62%), radial-gradient(800px 460px at 108% -4%, rgba(95,221,176,0.06), transparent 58%);
  --surface: #141B2D; --surface-2: #1A2338; --surface-3: #222D46; --elevated: #1C2640; --surface-hover: #182036;
  --glass: rgba(11,16,32,0.84); --glass-nav: rgba(20,27,45,0.92);
  --border: #243049; --border-strong: #33415F;
  --text: #E6EAF2; --muted: #95A1B6; --faint: #6B7690;
  --accent: #8298FF; --accent-fill: #5B6FF0; --accent-soft: #1E2750; --accent-ink: #C3CEFF; --violet: #9D84FF;
  --accent2: #F5B85A;
  --good: #5FDDB0; --good-bg: #12342B; --good-ink: #9EF0CF;
  --warn: #F5B85A; --warn-bg: #3A2C12; --warn-ink: #FAD69A;
  --bad: #FF8DA1;  --bad-bg: #3B1822;  --bad-ink: #FFC2CD;
  --gold: #FBBF24;
  --grade-bad: #FF8DA1; --grade-bad-bg: #3B1822; --grade-warn: #F5B85A; --grade-warn-bg: #3A2C12;
  --grade-good: #5FDDB0; --grade-good-bg: #123429; --grade-top: #A3B3FF; --grade-top-bg: #1F2A57;
  --ink-wash: #FFFFFF; --wash: rgba(255,255,255,0.04); --wash-2: rgba(255,255,255,0.08); --sunken: rgba(0,0,0,0.22);
  --scrim: rgba(3,6,14,0.62); --chart-grid: rgba(148,163,184,0.14); --knob: #CBD5E1;
  --shadow: 0 1px 2px rgba(0,0,0,0.30), 0 12px 32px -14px rgba(0,0,0,0.55);
  --shadow-lg: 0 28px 70px -16px rgba(0,0,0,0.75);
  --ring: 0 0 0 3px rgba(130,152,255,0.35);
}

/* === 2. BASE === */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 0.9rem; line-height: 1.45;
  color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
a { color: var(--accent); }
h1, h2, h3 { letter-spacing: -0.01em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 22%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.number, .kpi-value, .grade-moy, .note-val, td { font-variant-numeric: tabular-nums; }

/* === 3. STRUCTURE === */
#main-content { max-width: 1200px; margin: 0 auto; padding: 0 20px 40px; }
.container { max-width: 1200px; margin: 0 auto; position: relative; }
.main-content-area { padding: 22px 0 0; position: relative; z-index: 1; }

/* Barre du haut: identité de l'élève, sélecteurs, commandes, puis onglets */
.app-top {
  position: sticky; top: 0; z-index: 1000; margin: 0 -20px; padding: 12px 20px 0;
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
#main-header { background: none; border: 0; padding: 0; box-shadow: none; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.app-identity { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 260px; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center;
  font-weight: 750; font-size: 0.95rem; letter-spacing: 0.5px; color: #fff;
  background: linear-gradient(135deg, var(--accent-fill) 0%, var(--violet) 100%);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 75%, transparent);
}
.avatar:empty { display: none; }
#main-title { min-width: 0; font-size: 1.12rem; font-weight: 700; line-height: 1.2; }
.title-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.title-meta:empty, .title-meta > #title-level-badge:empty { display: none; }
.title-age::before { content: '·'; margin-right: 8px; color: var(--faint); }
.title-meta > #title-level-badge:empty + .title-age::before { content: none; margin: 0; }
.ro-badge { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); font-size: 0.7rem; font-weight: 600; }
.birthday-badge { margin-left: 6px; }

.header-controls { display: flex; align-items: center; gap: 8px; }
.tabs-right { display: flex; gap: 6px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 210px; overflow: hidden;
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.chip::after { content: ''; width: 7px; height: 7px; margin-left: 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); flex: none; }
.chip #level-tab-label, .chip .chip-text { overflow: hidden; text-overflow: ellipsis; }
.tab-select-wrapper select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.font-size-control-btn { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.click-a { color: var(--muted); font-weight: 700; cursor: pointer; user-select: none; display: flex; align-items: center; transition: color .15s, transform .15s; }
.click-a:hover { color: var(--text); transform: scale(1.12); }
.click-a:active { transform: scale(0.92); }
.static-label-small { font-size: 11px !important; }
.static-label-large { font-size: 16px !important; }
.font-size-indicator-container { width: 26px; height: 26px; display: grid; place-items: center; }
.font-size-dot { background: var(--accent-fill); color: var(--on-accent); border-radius: 50%; display: grid; place-items: center; font-weight: 700; transition: all .2s cubic-bezier(.25,1,.5,1); user-select: none; }
.dot-1 { width: 12px; height: 12px; font-size: 8px !important; }
.dot-2 { width: 15px; height: 15px; font-size: 9px !important; }
.dot-3 { width: 18px; height: 18px; font-size: 11px !important; }
.dot-4 { width: 22px; height: 22px; font-size: 12px !important; }
.dot-5 { width: 26px; height: 26px; font-size: 14px !important; }

.btn-logout { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: all .15s; flex: none; }
.btn-logout:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.btn-logout .ico { width: 18px; height: 18px; }

/* Onglets (bureau) */
.app-nav { margin-top: 10px; }
.main-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.main-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 10px 14px 13px; background: none; border: 0; border-radius: 10px 10px 0 0;
  color: var(--muted); font: 600 0.88rem/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s;
}
.tab-btn .ico { width: 18px; height: 18px; flex: none; }
.tab-btn:hover { color: var(--text); background: color-mix(in srgb, var(--ink-wash) 4%, transparent); }
.tab-btn.active { color: var(--text); }
.tab-btn.active .ico { color: var(--accent); }
.tab-btn.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .22s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* === 4. COMPOSANTS === */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink-wash) 2%, transparent), color-mix(in srgb, var(--ink-wash) 0%, transparent)), var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); min-width: 0;
}
.card h2 { margin: 0 0 12px; font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-subtitle { margin: 0 0 12px; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.card-intro { margin: -4px 0 14px; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.section-title { margin: 0 0 14px; font-size: 1.05rem; font-weight: 750; display: flex; align-items: baseline; gap: 10px; }
.section-title small { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.admin-stack { display: flex; flex-direction: column; gap: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .action-btn { margin: 0; flex: 1 1 auto; }
.field-label { display: block; margin: 16px 0 6px; font-size: 0.78rem; font-weight: 650; color: var(--muted); }
.field-label:first-child { margin-top: 0; }
.field-label small { font-weight: 500; color: var(--faint); }

/* Boutons */
.action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; margin-top: 10px;
  padding: 9px 16px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font: 650 0.88rem/1.2 var(--font); color: var(--text); background: var(--surface-3);
  transition: background .15s, border-color .15s, transform .08s, filter .15s, opacity .15s;
}
.action-btn:hover { filter: brightness(1.1); }
.action-btn:active { transform: translateY(1px); }
.action-btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.blue-btn { background: var(--accent-fill); color: var(--on-accent); box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 90%, transparent); }
.green-btn { background: var(--good); color: #04281b; }
.gold-btn { background: var(--gold); color: #241700; }
.outline-btn { background: transparent; border-color: var(--border-strong); color: var(--text); }
.outline-btn:hover { background: color-mix(in srgb, var(--ink-wash) 5%, transparent); border-color: var(--accent); filter: none; }
.ghost-btn { background: transparent; color: var(--muted); }
.ghost-btn:hover { background: color-mix(in srgb, var(--ink-wash) 5%, transparent); filter: none; }
.danger, .ghost-btn.danger { color: var(--bad); }
.ghost-btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.icon-btn { margin-left: auto; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.ico-sm { width: 15px; height: 15px; }

/* Champs */
input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font: 500 0.92rem var(--font); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder { color: var(--faint); }
input[type="date"] { color-scheme: dark; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
select option { background: var(--surface); color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: auto; min-height: 0; }
input[type="number"].no-spinners { -moz-appearance: textfield; appearance: textfield; }
input[type="number"].no-spinners::-webkit-inner-spin-button, input[type="number"].no-spinners::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Interrupteur (réglages des notifications) */
input.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; cursor: pointer;
  width: 44px; height: 26px; min-height: 0; padding: 0; margin: 0; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .2s, border-color .2s;
}
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--knob); transition: transform .2s cubic-bezier(.3,1.4,.6,1), background .2s; }
input.switch:checked { background: var(--accent-fill); border-color: var(--accent-fill); }
input.switch:checked::after { transform: translateX(18px); background: #fff; }

/* Pastilles */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0; text-transform: none; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.pill:empty { display: none; }
.pill.late { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad-ink); }
.pill.good-status { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good-ink); }
.late { color: var(--bad); } .good-status { color: var(--good); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 0.88rem; table-layout: fixed; }
th, td { border: 1px solid var(--border); padding: 7px 6px; text-align: center; }
th { background: var(--surface-2); font-weight: 650; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table-scroll { overflow-x: auto; }

/* Fenêtres */
.modal {
  position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .18s ease-out;
}
.modal-content {
  width: 100%; max-height: min(90vh, 920px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop .24s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 1.05rem; font-weight: 750; color: var(--text); }
.modal-body { padding: 18px 20px 22px; overflow-y: auto; }
.modal-body > input + input, .modal-body > input + select, .modal-body > select + input { margin-top: 10px; }
.close-btn, .note-close-btn {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; transition: background .15s, color .15s;
}
.close-btn:hover, .note-close-btn:hover { background: color-mix(in srgb, var(--ink-wash) 7%, transparent); color: var(--text); }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .action-btn { margin: 0; flex: 1; }
.modal-actions .blue-btn { flex: 2; }

/* Fenêtre « note » */
.note-sheet { max-width: 390px; }
.note-input-container { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 4px 0 2px; }
input.custom-note-input {
  width: 140px; min-height: 0; padding: 2px 0 6px; text-align: center; background: transparent; box-shadow: none;
  border: 0; border-bottom: 2px solid var(--border-strong); border-radius: 0; font-size: 2.3rem; font-weight: 800; letter-spacing: -0.02em;
}
input.custom-note-input:focus { border-bottom-color: var(--accent); box-shadow: none; }
#note-modal-max { color: var(--muted); font-size: 1.15rem; font-weight: 650; }
.note-status-hint { display: block; margin-top: 8px; min-height: 1.2em; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }

/* Messages éphémères */
#toast-host { position: fixed; z-index: 12000; top: 14px; left: 50%; transform: translateX(-50%); width: min(92vw, 440px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; cursor: pointer; white-space: pre-line;
  padding: 12px 16px; border-radius: 13px; border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  background: var(--elevated); color: var(--text); box-shadow: var(--shadow-lg); font-size: 0.88rem; font-weight: 550;
  opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast-good { border-left-color: var(--good); }
.toast-warn { border-left-color: var(--warn); }
.toast-bad { border-left-color: var(--bad); }

/* Barre « Annuler » */
#undo-bar {
  position: fixed; z-index: 11000; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: min(92vw, 560px);
  padding: 10px 12px 10px 16px; border-radius: 14px; border: 1px solid var(--border-strong);
  background: var(--elevated); color: var(--text); box-shadow: var(--shadow-lg); font-size: 0.88rem;
}
.undo-btn { flex: none; border: 0; border-radius: 9px; padding: 7px 14px; background: var(--accent-fill); color: var(--on-accent); font: 700 0.85rem var(--font); cursor: pointer; }
.undo-close { color: var(--muted); cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 0 4px; }
.undo-close:hover { color: var(--text); }

/* === 5. ÉCRANS D'ACCUEIL === */
#login-screen { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; background: var(--bg); background-image: var(--bg-grad); }
.login-box { width: min(100%, 380px); padding: 32px 28px 26px; text-align: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 26px; box-shadow: var(--shadow-lg); animation: pop .3s cubic-bezier(.2,.8,.2,1); }
.login-logo { display: block; width: 66px; height: 66px; margin: 0 auto 16px; border-radius: 19px; object-fit: cover; box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--accent) 80%, transparent); }
.login-box h1 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.9rem; }
.login-box input { margin-bottom: 10px; }
.login-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.login-actions .action-btn { margin: 0; width: 100%; min-height: 46px; }
.login-forgot { display: inline-block; margin-top: 14px; color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.login-forgot:hover { color: var(--text); text-decoration: underline; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.google-btn { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 12px; border: 0; background: #fff; color: #1f2937; font: 650 0.9rem var(--font); cursor: pointer; transition: filter .15s; }
.google-btn:hover { filter: brightness(0.95); }
#login-error { margin-top: 14px; color: var(--bad); font-size: 0.85rem; }

.state-screen { max-width: 460px; margin: 14vh auto 0; padding: 32px 28px; text-align: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 24px; box-shadow: var(--shadow-lg); }
.state-icon { font-size: 2.4rem; margin-bottom: 10px; }
.state-screen h1 { margin: 0 0 10px; font-size: 1.3rem; font-weight: 800; }
.state-screen p { margin: 0 0 20px; color: var(--muted); line-height: 1.55; }
.state-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.state-actions .action-btn { margin: 0; }

/* === 6. SYNTHÈSE === */
#alerts-box { margin-bottom: 14px; }
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--r); border: 1px solid; font-size: 0.88rem; font-weight: 550; }
.alert-item + .alert-item { margin-top: 8px; }
.alert-item::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: currentColor; }
.alert-bad  { background: color-mix(in srgb, var(--bad) 9%, transparent); border-color: color-mix(in srgb, var(--bad) 28%, transparent); color: var(--bad-ink); }
.alert-warn { background: color-mix(in srgb, var(--warn) 9%, transparent);  border-color: color-mix(in srgb, var(--warn) 28%, transparent);  color: var(--warn-ink); }
.alert-info { background: color-mix(in srgb, var(--accent) 9%, transparent); border-color: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--accent-ink); }

.kpi-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-size: 1.95rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.kpi-of { margin-left: 8px; color: var(--muted); font-size: 0.84rem; font-weight: 600; letter-spacing: 0; }
.progress { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 14%, transparent); overflow: hidden; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--good)); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.progress-fill.is-late { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.pace-line { color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.pace-line b { color: var(--text); }
.pace-line small { color: var(--faint); }
.pace-ok { color: var(--good); font-size: 0.84rem; font-weight: 650; }

.notify-cta {
  display: inline-flex; align-items: center; gap: 10px; width: 100%; margin-top: 14px; padding: 12px 16px; text-align: left;
  border-radius: var(--r); border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent-ink);
  font: 650 0.88rem var(--font); cursor: pointer; transition: background .15s, border-color .15s;
}
.notify-cta:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.notify-cta span { margin-left: auto; }
.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-top: 14px; }
.chart-box { position: relative; }
#week-table { table-layout: auto; margin: 0; }
#week-table th, #week-table td { border: 0; border-bottom: 1px solid var(--border); padding: 9px 8px; text-align: left; }
#week-table th { background: none; }
#week-table tr:last-child td { border-bottom: 0; }

/* === 7. TABLEAU DES NOTES === */
.notes-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
#assignments-table { margin: 0; border-collapse: separate; border-spacing: 0; }
#assignments-table th, #assignments-table td { border: 0; border-bottom: 1px solid var(--border); padding: 6px 4px; }
#assignments-table tbody tr:last-child td { border-bottom: 0; }
#assignments-table th { background: var(--surface-2); padding: 10px 4px; }
#assignments-table th:first-child, #assignments-table td:first-child {
  position: sticky; left: 0; z-index: 2; width: 150px; padding-left: 14px; text-align: left;
  background: var(--surface); border-right: 1px solid var(--border); box-shadow: 8px 0 14px -12px rgba(0,0,0,0.9);
}
#assignments-table th:first-child { background: var(--surface-2); }
#assignments-table th:not(:first-child), #assignments-table td:not(:first-child) { width: 76px; }
#assignments-table tbody tr:hover td { background-color: color-mix(in srgb, var(--ink-wash) 2%, transparent); }
#assignments-table tbody tr:hover td:first-child { background: var(--surface-hover); }
.empty-cell { background: var(--sunken) !important; }
.subject-link { cursor: pointer; font-weight: 700; transition: color .15s; }
.subject-link:hover { color: var(--accent); }
.grade-moy { font-size: 1.1rem; font-weight: 800; margin-left: 3px; }

.note-display {
  width: 100%; min-height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 11px; cursor: pointer; border: 1px solid transparent; transition: transform .08s, box-shadow .15s, filter .15s;
}
.note-display:hover { box-shadow: inset 0 0 0 1px var(--border-strong); filter: brightness(1.18); }
.note-display:active { transform: scale(0.96); }
.note-display.is-empty { border: 1px dashed color-mix(in srgb, var(--muted) 18%, transparent); background: transparent !important; }
.note-display.is-empty:hover { border-color: var(--accent); box-shadow: none; filter: none; background: var(--accent-soft) !important; }
.note-add { color: var(--faint); font-size: 1.25rem; font-weight: 500; line-height: 1; }
.note-display.is-empty:hover .note-add { color: var(--accent); }
.note-date { display: block; color: color-mix(in srgb, var(--muted) 62%, transparent); font-size: 0.7rem; font-weight: 600; }
.note-val { display: block; margin-top: 1px; font-size: 1.08rem; font-weight: 800; }
.note-attente { display: block; margin-top: 1px; color: var(--text); font-size: 0.78rem; font-weight: 700; }
.note-neutre { display: block; margin-top: 1px; color: var(--muted); font-size: 0.92em; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.note-badge { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 4px; background: color-mix(in srgb, var(--ink-wash) 14%, transparent); color: color-mix(in srgb, var(--ink-wash) 85%, transparent); font-size: 0.58em; font-weight: 800; letter-spacing: 0.4px; vertical-align: middle; text-decoration: none; }

.notes-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 12px 4px 28px; color: var(--muted); font-size: 0.78rem; }
.notes-legend .lg { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.lg-bad { background: var(--bad); } .lg-warn { background: var(--warn); } .lg-good { background: var(--good); } .lg-top { background: var(--accent); }
.lg-wait { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.lg-txt b { color: var(--text); }
/* Mode de réalisation du devoir (modeRealisation, 00-calculs.js), dans la
   couleur de la note : encadrée = à la main, soulignée = espace de formation. */
.real-main { padding: 0 3px; border: 1.5px solid currentColor; border-radius: 4px; }
.real-ligne { text-decoration: underline 2px; text-underline-offset: 3px; }

/* Résultats Canvas (renderCanvas, 07-notes.js) */
.cv-bloc { margin: 0 0 28px; }
.cv-titre { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 0 4px 12px; font-size: 1.1rem; font-weight: 800; }
.cv-titre .ico { width: 19px; height: 19px; color: var(--accent); align-self: center; }
.cv-titre small { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.cv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cv-kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.cv-kpi-label { color: var(--muted); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.cv-kpi b { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cv-kpi small { color: var(--muted); font-size: 0.74rem; }
.cv-urgent { margin-bottom: 14px; padding: 12px 14px; background: var(--surface); border: 2px solid var(--bad); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.cv-urgent.cv-urgent-vide { border: 1px solid var(--border); }
.cv-urgent-tete { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.cv-urgent-tete b { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; font-weight: 800; color: var(--bad); }
.cv-urgent-vide .cv-urgent-tete b { color: var(--text); }
.cv-urgent-tete .ico { width: 18px; height: 18px; }
.cv-urgent-tete small { color: var(--muted); font-size: 0.74rem; }
.cv-urgent-nb { padding: 0 8px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.8rem; }
.cv-urgent p { margin: 6px 0 0; color: var(--good); font-size: 0.88rem; font-weight: 650; }
.cv-urgent-liste { margin: 8px 0 0; padding: 0; list-style: none; }
.cv-urgent-liste li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.cv-urgent-quand { flex: 0 0 3.6em; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.cv-urgent-quand b { font-size: 1.05rem; font-weight: 800; }
.cv-urgent-quand small, .cv-urgent-nom small { color: var(--muted); font-size: 0.74rem; }
.cv-urgent-nom { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cv-urgent-nom b { font-weight: 700; overflow-wrap: anywhere; }
.cv-delai { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; background: var(--wash-2); color: var(--text); font-size: 0.78rem; font-weight: 750; white-space: nowrap; }
.cv-delai.cv-delai-proche { background: var(--grade-warn-bg); color: var(--warn); }
.cv-delai.cv-delai-retard { background: var(--bad); color: #fff; }
.cv-tag.cv-urgent-tag { background: var(--bad); color: #fff; }
.tab-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.62rem; font-weight: 800; line-height: 16px; text-align: center; letter-spacing: 0; }
.cv-graphes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cv-graphe { min-width: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.cv-graphe h3 { margin: 0 0 8px; font-size: 0.9rem; font-weight: 750; }
.cv-toile { position: relative; height: 240px; }
.cv-toile-barres { height: 180px; }
.cv-cours { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.cv-cours + .cv-cours { margin-top: 10px; }
.cv-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cv-cours-nom { font-weight: 750; font-size: 1rem; }
.cv-moy { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cv-compteurs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 8px; color: var(--muted); font-size: 0.78rem; }
.cv-tag { padding: 1px 7px; border-radius: 999px; background: var(--wash-2); color: var(--muted); font-size: 0.7rem; font-weight: 650; white-space: nowrap; }
.cv-tag.cv-manquant { background: var(--grade-bad-bg); color: var(--bad); }
.cv-tag.cv-retard { background: var(--grade-warn-bg); color: var(--warn); }
.cv-tag.cv-avenir { background: var(--accent-soft); color: var(--accent); }
.cv-liste { margin: 0; padding: 0; list-style: none; }
.cv-devoir { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 0.86rem; }
.cv-date { flex: 0 0 3.2em; color: var(--muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.cv-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-res { flex: 0 0 auto; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.cv-note { margin: 10px 4px 0; color: var(--muted); font-size: 0.74rem; line-height: 1.6; }
.cv-note .lg { display: inline-block; width: 10px; height: 10px; margin: 0 4px 0 8px; border-radius: 3px; vertical-align: -1px; }
.cv-note .lg:first-child { margin-left: 0; }
@media (max-width: 520px) {
  .cv-devoir { flex-wrap: wrap; row-gap: 2px; }
  .cv-nom { flex-basis: calc(100% - 4em); white-space: normal; }
  .cv-res { margin-left: auto; }
}

/* Programme par chapitre (12-programme.js) : reprend les cartes de l'onglet Canvas. */
.pg-bilan { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.pg-bilan > b { font-size: 1.15rem; font-weight: 800; }
.pg-bilan > span { color: var(--muted); font-size: 0.86rem; }
.pg-bilan ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.86rem; }
.pg-bilan small, .pg-prochains small { color: var(--muted); }
.pg-bilan.pg-avance { border-color: var(--good); background: var(--good-bg); } .pg-bilan.pg-avance > b { color: var(--good-ink); }
.pg-bilan.pg-heure > b { color: var(--accent-ink); }
.pg-bilan.pg-retard { border-color: var(--warn); background: var(--warn-bg); } .pg-bilan.pg-retard > b { color: var(--warn-ink); }
.pg-prochains { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--accent-soft); }
.pg-prochains h3 { margin: 0 0 4px; font-size: 0.86rem; font-weight: 750; color: var(--accent-ink); }
.pg-prochains ul { margin: 0; padding-left: 18px; font-size: 0.86rem; line-height: 1.6; }
.pg-matieres { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; }
.pg-matieres .cv-cours + .cv-cours { margin-top: 0; }
.pg-compte { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.pg-barre { height: 6px; margin: 8px 0 2px; border-radius: 999px; background: var(--wash-2); overflow: hidden; }
.pg-barre i { display: block; height: 100%; border-radius: inherit; background: var(--good); transition: width .3s; }
.pg-etat { padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 750; }
.pg-etat.pg-avance { background: var(--good-bg); color: var(--good-ink); }
.pg-etat.pg-heure { background: var(--accent-soft); color: var(--accent-ink); }
.pg-etat.pg-retard { background: var(--warn-bg); color: var(--warn-ink); }
.pg-chap { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 0.86rem; }
.pg-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pg-texte b { font-weight: 650; overflow-wrap: anywhere; }
.pg-texte small { color: var(--muted); font-size: 0.74rem; }
.pg-fait .pg-texte b { color: var(--muted); }
.pg-case { position: relative; flex: 0 0 auto; width: 24px; height: 24px; cursor: pointer; }
.pg-case input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: inherit; }
.pg-coche { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border-strong); background: var(--surface); color: transparent; transition: background .15s, border-color .15s; }
.pg-coche .ico { width: 15px; height: 15px; }
.pg-case input:checked + .pg-coche { background: var(--good); border-color: var(--good); color: #fff; }
.pg-case input:focus-visible + .pg-coche { box-shadow: var(--ring); }
.pg-case input:disabled { cursor: default; }
.pg-case input:disabled:not(:checked) + .pg-coche { opacity: .55; }
.pg-chap-retard .pg-coche { border-color: var(--warn); }
@media (max-width: 520px) { .pg-matieres { grid-template-columns: 1fr; } }

/* === 8. GRAPHIQUES === */
.chart-container { position: relative; background: none; border: 0; padding: 0; }
.graph-title { cursor: pointer; transition: color .15s; }
.graph-title:hover { color: var(--accent); }
.graph-title:hover .icon-btn { background: var(--accent-soft); color: var(--accent); }

/* === 9. RÉGLAGES, NOTIFICATIONS, ACCÈS === */
#push-card { grid-column: 1 / -1; }
#push-card-body { max-width: 720px; }
.push-intro { margin: -4px 0 14px; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.push-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: 0.88rem; font-weight: 650; }
.push-status small { color: var(--muted); font-weight: 500; }
.push-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.push-status.on .dot { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 18%, transparent); }
.push-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.push-row label { font-size: 0.9rem; font-weight: 650; }
.push-row label small { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.push-row select { width: auto; min-width: 100px; }
.push-group-title { margin: 20px 0 2px; color: var(--muted); font-size: 0.72rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row b { display: block; font-size: 0.9rem; font-weight: 650; }
.switch-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.77rem; }
.push-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.push-actions .action-btn { margin: 0; }
.push-note { padding: 13px 15px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 0.87rem; line-height: 1.55; }
.push-note ol { margin: 8px 0 0; padding-left: 20px; }
.push-muted { margin: 0; color: var(--muted); font-size: 0.87rem; line-height: 1.55; }

.access-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; font-size: 0.9em; }
.access-list li { border-radius: 10px !important; }
.access-table-wrapper { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }
.access-table { width: 100%; table-layout: auto; margin: 0; font-size: 0.85rem; border: none; }
.access-table th { text-align: left; padding: 8px 10px; background: var(--surface-2); border: none; border-bottom: 1px solid var(--border); }
.access-table td { text-align: left; padding: 8px 10px; border: none; border-bottom: 1px solid color-mix(in srgb, var(--muted) 8%, transparent); vertical-align: top; line-height: 1.35; }
.access-table tr:last-child td { border-bottom: none; }
.text-unverified { color: var(--bad) !important; }
.text-verified { color: var(--good) !important; font-weight: bold; }
.text-no-rights { color: var(--warn) !important; font-style: italic; }
.tbl-btn { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 3px 8px; border-radius: 7px; cursor: pointer; transition: background .15s; font-size: 0.8rem; }
.tbl-btn:hover { background: color-mix(in srgb, var(--ink-wash) 8%, transparent); }
.tbl-btn.edit-btn { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tbl-btn.save-btn { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); font-weight: bold; }
.tbl-btn.del-btn { color: var(--bad); border-color: transparent; }
.tbl-btn.del-btn:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
select.mini-select { width: auto; min-height: 0; height: auto; padding: 3px 26px 3px 6px; border-radius: 7px; font-size: 0.8rem; background-color: var(--surface-2); background-position: right 6px center; }

/* === 10. MODULES MÉTIER (bac, niveaux, référentiel, jalons, solveur…) === */
/* === SIMULATEUR BAC === */
.bac-disclaimer { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; font-size: 0.9em; color: var(--muted); line-height: 1.5; }
.bac-disclaimer b { color: var(--text); }
.bac-real-txt { color: var(--good); font-weight: bold; }
.bac-est-txt { color: var(--accent2); font-weight: bold; }

.bac-main { text-align: center; padding: 20px 15px; margin-top: 18px; border-width: 2px; }
.bac-main-num { font-size: 3.2rem; font-weight: 700; line-height: 1; }
.bac-slash { font-size: 1.2rem; color: var(--muted); font-weight: 400; margin-left: 4px; }
.bac-mention { display: inline-block; margin-top: 12px; padding: 6px 18px; border-radius: 20px; color: var(--mc, var(--accent)); background: color-mix(in srgb, var(--mc, var(--accent)) 16%, transparent); font-weight: bold; font-size: 0.95rem; }
.bac-sub { display: flex; justify-content: center; gap: 30px; margin-top: 20px; flex-wrap: wrap; }
.bac-sub > div { display: flex; flex-direction: column; gap: 2px; }
.bac-sub span { font-size: 0.8rem; color: var(--muted); }
.bac-sub b { font-size: 1.5rem; color: var(--text); }
.bac-sub small { font-size: 0.75rem; color: var(--muted); }
.bac-coverage { margin-top: 16px; font-size: 0.78rem; color: var(--muted); }

.bac-pct { font-size: 0.75rem; background: var(--accent); color: white; padding: 2px 10px; border-radius: 12px; vertical-align: middle; margin-left: 6px; font-weight: bold; }
.bac-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.bac-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bac-grp td { color: var(--accent2); font-weight: bold; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 14px; border-bottom: none; }
.bac-lbl { font-size: 0.9rem; }
.bac-coef { width: 42px; text-align: center; color: var(--muted); font-size: 0.82rem; }
.bac-in { width: 78px; padding: 6px 8px; text-align: center; border-radius: 8px; border: 1px solid var(--border); background: color-mix(in srgb, var(--ink-wash) 5%, transparent); color: var(--text); font-size: 0.95rem; font-weight: bold; box-sizing: border-box; }
.bac-in:focus { outline: none; border-color: var(--accent); }
.bac-est { border-left: 3px solid var(--accent2); }
.bac-auto { width: 78px; padding: 6px 8px; text-align: center; border-radius: 8px; border: 1px solid var(--border); border-left: 3px solid var(--good); background: color-mix(in srgb, var(--good) 8%, transparent); color: var(--good); font-size: 0.95rem; font-weight: bold; box-sizing: border-box; }
.bac-auto-empty { color: var(--muted); border-left-color: var(--muted); background: color-mix(in srgb, var(--ink-wash) 4%, transparent); }
.bac-src { display: block; font-size: 0.7rem; color: var(--muted); font-weight: normal; margin-top: 2px; }
.bac-missing { color: var(--accent2); font-style: italic; }
.bac-spe-select { background: color-mix(in srgb, var(--ink-wash) 4%, transparent); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 6px 0 4px; }
.bac-spe-select label { font-size: 0.85rem; color: var(--text); display: block; margin-bottom: 6px; }
.bac-spe-select select { width: 100%; padding: 8px; border-radius: 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.bac-spe-select small { display: block; margin-top: 6px; font-size: 0.75rem; color: var(--muted); line-height: 1.4; }
/* === NIVEAUX SCOLAIRES === */
#level-tab { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--good) 35%, transparent); max-width: 170px; }
#level-tab #level-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; display: inline-block; vertical-align: bottom; }
#level-tab.level-archive { background: color-mix(in srgb, var(--warn) 15%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

.level-badge { font-size: 0.5em; font-weight: bold; letter-spacing: 0.5px; text-transform: uppercase; background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); padding: 3px 9px; border-radius: 20px; margin-left: 12px; white-space: nowrap; text-shadow: none; vertical-align: middle; }
.level-badge-archive { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--accent2); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

.level-intro { font-size: 0.85rem; color: var(--muted); line-height: 1.55; background: color-mix(in srgb, var(--ink-wash) 4%, transparent); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin: 0 0 18px; }
.level-intro b { color: var(--good); }
.level-h3 { color: var(--accent); font-size: 0.95rem; margin: 0 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }

.level-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px; border-radius: 8px; background: color-mix(in srgb, var(--ink-wash) 3%, transparent); border: 1px solid var(--border); margin-bottom: 6px; flex-wrap: wrap; }
.level-row.is-default { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 7%, transparent); }
.level-row-main { flex: 1; min-width: 180px; }
.level-row-main small { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 4px; }
.level-viewing { color: var(--accent2); font-weight: bold; }
.level-name-input { background: transparent; border: 1px solid transparent; color: var(--text); font-weight: bold; font-size: 0.95rem; padding: 4px 6px; border-radius: 6px; width: 100%; }
.level-name-input:hover { border-color: var(--border); }
.level-name-input:focus { border-color: var(--accent); background: var(--sunken); outline: none; }
.level-row-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.level-default-badge { font-size: 0.75rem; color: var(--good); font-weight: bold; white-space: nowrap; }
.tbl-btn[disabled] { opacity: 0.3; cursor: not-allowed; }

.level-new-box { background: var(--sunken); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.level-lbl { display: block; font-size: 0.8rem; color: var(--accent2); font-weight: bold; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.level-radio { display: block; font-size: 0.9rem; padding: 6px 4px; cursor: pointer; line-height: 1.4; }
.level-radio input { width: auto; margin-right: 6px; vertical-align: middle; }
.level-radio small { color: var(--muted); font-size: 0.78rem; }
.level-scope-hint { font-size: 0.85rem; color: var(--muted); background: color-mix(in srgb, var(--ink-wash) 4%, transparent); border-radius: 8px; padding: 8px 10px; margin-bottom: 14px; }
.level-scope-hint b { color: var(--good); }

@media (max-width: 700px) {
  /* placé après les règles #level-tab ci-dessus pour les neutraliser sur mobile */
  #level-tab #level-tab-label { display: none; }
  #level-tab { max-width: none; }
}

/* Identification de l'élève dans les écrans d'administration */
.modal-subject { font-size: 0.9rem; color: var(--accent2); font-weight: bold; margin-top: 3px; }
.level-h3-who { font-weight: normal; font-size: 0.85rem; color: var(--muted); }
.card-who { display: inline-block; margin-top: 6px; color: var(--accent2); font-weight: bold; }

/* Simulateur bac: matières suivies qu'aucun poste du barème ne peut accueillir */
.bac-orphelines { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--accent2); border-left-width: 3px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 8%, transparent); font-size: 0.85rem; }
.bac-orphelines b { color: var(--accent2); display: block; margin-bottom: 6px; }
.bac-orphelines div { color: var(--text); }
.bac-orphelines small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.45; }
.bac-1ere { color: var(--good); font-weight: bold; }

/* Référentiel des matières: menu déroulant et modèles de programme */
.ref-lbl { display: block; font-size: 0.8rem; color: var(--accent2); margin-bottom: 5px; font-weight: bold; }
.ref-hint { color: var(--muted); font-weight: normal; font-style: italic; }
.ref-groupe { margin-bottom: 16px; }
.ref-groupe-titre { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent2); font-weight: bold; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ref-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.ref-item:hover { background: color-mix(in srgb, var(--ink-wash) 6%, transparent); }
.ref-item input { width: auto; margin: 0; flex: none; }
.ref-item span { flex: 1; }
.ref-item em { font-size: 0.72rem; color: var(--good); font-style: normal; }
.ref-item.ref-deja span { color: var(--muted); }
.ref-apply { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* === ÉDITEUR MULTI-JALONS (attendus) === */
.jalon-help { font-size: 0.8rem; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.jalon-head { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; padding: 0 2px 4px; }
.jalon-rows { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.jalon-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; align-items: center; }
.jalon-row input { width: 100%; box-sizing: border-box; margin: 0; padding: 8px; }
.jalon-del { background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid var(--bad); color: var(--bad); border-radius: 8px; cursor: pointer; height: 34px; font-size: 0.9rem; padding: 0; }
.jalon-del:hover { background: color-mix(in srgb, var(--bad) 25%, transparent); }
.jalon-gen { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--ink-wash) 3%, transparent); }
.jalon-gen > summary { cursor: pointer; font-weight: bold; color: var(--accent2); font-size: 0.9rem; }
.jalon-gen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.jalon-gen-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--muted); }
.jalon-gen-grid input, .jalon-gen-grid select { margin: 0; padding: 7px; box-sizing: border-box; }

/* === SIMULATEUR BAC : SCÉNARIOS & SOLVEUR === */
.bac-scenarios { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
.bac-scenarios label { font-size: 0.85em; color: var(--muted); }
.bac-scenarios select { padding: 6px 8px; border-radius: 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); min-width: 170px; }
.bac-scenarios .action-btn { margin: 0; padding: 6px 10px; font-size: 0.82em; }
.bac-scenarios .bac-sc-del { border-color: var(--bad); color: var(--bad); }
.bac-scenarios small { flex-basis: 100%; color: var(--muted); font-size: 0.76em; }

.bac-solver-card h2 { margin-bottom: 6px; }
.bac-solver-intro { font-size: 0.85em; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.bac-solver-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.bac-solver-table td { border: none; border-bottom: 1px solid var(--border); padding: 9px 6px; text-align: left; font-size: 0.92em; }
.bac-solver-table tr:last-child td { border-bottom: none; }
.bac-solver-table td:first-child { white-space: nowrap; font-weight: bold; width: 1%; padding-right: 18px; }
.bac-solver-table td small { display: block; font-weight: normal; color: var(--muted); font-size: 0.8em; }
.solver-ok  td:last-child { color: var(--good); }
.solver-dur td:last-child { color: var(--accent2); }
.solver-ko  td:last-child { color: var(--bad); }

/* === COMPARAISON DES NIVEAUX === */
.level-cmp-table { width: 100%; border-collapse: collapse; table-layout: auto; margin-top: 8px; font-size: 0.9em; }
.level-cmp-table th { text-align: left; padding: 6px 8px; background: color-mix(in srgb, var(--ink-wash) 5%, transparent); border: none; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: bold; }
.level-cmp-table td { text-align: left; padding: 8px; border: none; border-bottom: 1px solid color-mix(in srgb, var(--ink-wash) 6%, transparent); }
.level-cmp-up { color: var(--good); font-weight: bold; }
.level-cmp-down { color: var(--bad); font-weight: bold; }
.level-cmp-na { color: var(--muted); }
.level-cmp-note, .level-cmp-empty { display: block; margin-top: 8px; color: var(--muted); font-size: 0.78em; line-height: 1.5; }

/* === 11. AJUSTEMENTS (après les modules métier) === */
/* Champs compacts des modules: pas de hauteur minimale de champ plein écran */
input.bac-in, .jalon-row input, input.level-name-input, .jalon-gen-grid input, .jalon-gen-grid select { min-height: 0; }
.bac-in, .bac-auto { border-radius: 9px; }
.bac-disclaimer, .level-intro, .level-scope-hint { border-radius: var(--r); }
.bac-main { border-radius: var(--r-xl); }
.level-new-box, .level-row, .bac-spe-select, .bac-scenarios { border-radius: var(--r); }
.bac-pct { background: var(--accent-soft); color: var(--accent-ink); }
/* Pastille de niveau: dans la ligne d'infos sous le nom, plus dans le titre */
.title-meta .level-badge { margin-left: 0; font-size: 0.68rem; padding: 2px 8px; }
#level-tab { background: color-mix(in srgb, var(--good) 10%, transparent); border-color: color-mix(in srgb, var(--good) 32%, transparent); max-width: 190px; }
#level-tab.level-archive { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* Explication du simulateur repliée par défaut: l'essentiel d'abord */
details.bac-disclaimer > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); }
details.bac-disclaimer > summary::-webkit-details-marker { display: none; }
.bac-how { margin-left: auto; color: var(--accent); font-size: 0.8rem; font-weight: 650; }
details.bac-disclaimer[open] .bac-how { color: var(--muted); }
.bac-how-body { margin-top: 10px; }
.bac-scenarios select { flex: 1 1 170px; }

/* === COMPOSANTS COMMUNS (ajoutés avec les thèmes clair/sombre) === */
/* Icônes (00-icones.js) */
.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.action-btn .ico { width: 17px; height: 17px; }
.tbl-btn .ico { width: 15px; height: 15px; vertical-align: -3px; }
.card h2 > .ico, .section-title > .ico { width: 19px; height: 19px; color: var(--accent); }
.head-btn { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: all .15s; flex: none; }
.head-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--wash); }

/* Listes homogènes : fiche profil, accès, sauvegardes */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-main { display: flex; align-items: center; flex-wrap: wrap; column-gap: 8px; min-width: 0; font-weight: 650; font-size: 0.9rem; overflow-wrap: anywhere; }
.list-main > .ico { width: 16px; height: 16px; color: var(--muted); }
.list-main small { flex-basis: 100%; color: var(--muted); font-weight: 500; font-size: 0.76rem; }
.list-actions { display: flex; gap: 2px; flex: none; }
.list-empty { padding: 14px 2px; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.icon-action { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.icon-action:hover { background: var(--wash-2); color: var(--text); }
.icon-action.danger:hover { background: var(--bad-bg); color: var(--bad); }
.icon-action .ico { width: 17px; height: 17px; }
.pill .ico { width: 13px; height: 13px; vertical-align: -2px; }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* Pastille de couleur d'une matière */
.subj-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 8px; }
.list-main .subj-dot { margin-right: 0; }

/* Tableau des notes (bureau) : cellule matière */
.subject-link { display: inline-flex; align-items: center; padding: 0; border: 0; background: none; color: var(--text); font: 700 0.9rem/1.25 var(--font); text-align: left; cursor: pointer; }
.subject-link:hover { color: var(--accent); }
.subj-moy { display: block; margin-top: 4px; color: var(--muted); font-size: 0.78rem; }
.subj-moy b { font-size: 1.05rem; font-weight: 800; }
.note-val .ico { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }

/* Notes en liste (téléphone) : une carte par matière, les notes en pastilles */
#notes-list { display: none; }
.subj-card { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.subj-card + .subj-card { margin-top: 10px; }
.subj-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0 2px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.subj-head .subj-dot { margin-right: 0; }
.subj-name { flex: 1; min-width: 0; font-weight: 700; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-count { padding: 2px 8px; border-radius: 999px; background: var(--wash-2); color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.subj-avg { min-width: 46px; text-align: right; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.subj-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gchip { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; height: 48px; padding: 0 8px; border: 1px solid transparent; border-radius: 12px; font: inherit; cursor: pointer; transition: transform .08s; }
.gchip b { display: inline-flex; align-items: center; gap: 3px; font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.gchip small { color: var(--muted); font-size: 0.64rem; font-weight: 600; }
.gchip.neutre b { text-decoration: line-through; text-decoration-color: var(--faint); }
.gchip.attente b { font-size: 0.74rem; }
.gchip .ico { width: 13px; height: 13px; }
.gchip.add { background: transparent; border: 1px dashed var(--border-strong); color: var(--faint); }
.gchip.add .ico { width: 18px; height: 18px; }
.gchip.add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.gchip:active { transform: scale(0.95); }

/* État vide */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; text-align: center; color: var(--muted); line-height: 1.5; }
.empty-state > .ico { width: 34px; height: 34px; color: var(--faint); }
.empty-state b { color: var(--text); font-size: 1rem; }
.empty-state .action-btn { margin-top: 6px; }

/* Apparence : automatique / clair / sombre */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 650 0.8rem var(--font); cursor: pointer; transition: background .15s, color .15s; }
.theme-opt .ico { width: 20px; height: 20px; }
.theme-opt:hover { color: var(--text); }
.theme-opt[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.theme-opt[aria-pressed="true"] .ico { color: var(--accent); }

/* Simulateur bac : postes encore sans note */
.bac-attente { color: var(--faint); font-style: italic; }
.bac-grp small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.72rem; font-weight: 500; text-transform: none; letter-spacing: 0; }
.bac-orphelines b .ico { width: 16px; height: 16px; vertical-align: -3px; }
.bac-disclaimer summary .ico { color: var(--accent); }
.bac-solver-table .ico { width: 15px; height: 15px; vertical-align: -3px; }

/* === 12. MOBILE === */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-main { grid-column: 1 / -1; }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
  #main-content { padding: 0 14px 28px; }
  /* Un ancêtre flouté piégerait la barre du bas (position: fixed) : on retire le flou ici. */
  .app-top { margin: 0 -14px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .header-top { gap: 10px; }
  .app-identity { flex: 1 1 0; }
  .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 0.88rem; }
  #main-title { font-size: 1.02rem; }
  .header-controls { display: contents; }
  .app-identity { order: 1; flex: 1 1 calc(100% - 100px); }
  .head-btns { order: 2; }
  .tabs-right { order: 3; flex: 1 1 55%; min-width: 0; }   /* base > reliquat de la ligne 1 : passe à la ligne */
  .tabs-right .chip { flex: 1 1 0; min-width: 0; max-width: none; justify-content: center; }
  .font-size-control-btn { order: 4; flex: none; padding: 0 8px; }

  /* Navigation en bas d'écran, à portée de pouce */
  .app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; margin: 0;
    padding: 6px 6px calc(6px + var(--safe-b));
    background: var(--glass-nav); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--border);
  }
  .main-tabs { justify-content: space-around; gap: 2px; overflow: visible; }
  .tab-btn { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 4px; padding: 7px 2px 6px; border-radius: 12px; font-size: 0.64rem; font-weight: 650; }
  .tab-btn .ico { width: 22px; height: 22px; }
  .tab-btn.active::after { display: none; }
  .tab-btn.active { background: var(--accent-soft); color: var(--text); }
  .tab-text { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  /* Sept onglets visibles (Synthèse et Canvas compris) : texte resserré pour que « Réglages » tienne (renderCanvas). */
  .main-tabs.serre .tab-btn { padding-left: 0; padding-right: 0; font-size: 0.58rem; letter-spacing: -0.02em; }

  .main-content-area { padding-top: 16px; }
  .card { padding: 16px; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 12px; gap: 6px; }
  .kpi-label { font-size: 0.62rem; letter-spacing: 0.04em; }
  .kpi-value { font-size: 1.35rem; }
  .kpi-main { padding: 14px; gap: 10px; }
  .kpi-main .kpi-label { font-size: 0.72rem; }
  .kpi-main .kpi-value { font-size: 1.8rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .notes-scroll { display: none; }
  #notes-list { display: block; }
  #assignments-table th:first-child, #assignments-table td:first-child { width: 118px; padding-left: 10px; }
  #assignments-table th:not(:first-child), #assignments-table td:not(:first-child) { width: 66px; }

  #undo-bar { left: 10px; right: 10px; transform: none; max-width: none; bottom: calc(var(--nav-h) + 10px + var(--safe-b)); }
  .bac-scenarios label { display: none; }
  .bac-scenarios select { min-width: 0; flex: 1 1 100%; }
  .access-table th, .access-table td { padding: 8px 6px; font-size: 0.9em; }
  #level-tab #level-tab-label { display: inline; }
}

/* Fenêtres en panneau qui monte du bas, comme une app native */
@media (max-width: 640px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-content { max-width: 100% !important; width: 100% !important; max-height: 92vh; border-radius: 24px 24px 0 0; border-bottom: 0; padding-bottom: var(--safe-b); animation: sheet .3s cubic-bezier(.2,.8,.2,1); }
  .modal-header { position: relative; padding-top: 22px; }
  .modal-header::before { content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 38px; height: 4px; border-radius: 4px; background: var(--border-strong); }
  #fs-modal .modal-content { height: 88vh !important; }
  .modal-actions .action-btn { min-height: 46px; }
}
@keyframes sheet { from { transform: translateY(60px); opacity: 0.4; } to { transform: none; opacity: 1; } }

/* === 13. MOUVEMENTS RÉDUITS === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Groupe de boutons de l'en-tête, bouton « danger » (ajouts de la refonte) */
.head-btns { display: flex; gap: 6px; }
.danger-btn { background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.danger-btn:hover { filter: none; background: color-mix(in srgb, var(--bad) 18%, transparent); }
.state-icon .ico { width: 40px; height: 40px; color: var(--accent); }
.chip .ico { width: 16px; height: 16px; color: var(--muted); }
.notify-cta .ico { color: var(--accent); }
.jalon-gen > summary .ico { vertical-align: -3px; }
/* Tableaux du simulateur : lignes simples, libellés à gauche (comme les autres listes) */
.bac-table td { border-width: 0 0 1px 0; }
.bac-table tr:last-child td { border-bottom: 0; }
.bac-table .bac-lbl, .bac-table .bac-grp td { text-align: left; }
.bac-table .bac-grp td { padding-top: 16px; }
/* Cases de notes : les mentions textuelles restent discrètes à côté des notes */
.note-val.attente { font-size: 0.74rem; color: var(--text); }
.note-val.neutre { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); font-weight: 700; }
/* Bouton Google : blanc dans les deux thèmes, donc toujours bordé */
.google-btn { border: 1px solid var(--border-strong); }
