/* =====================================================================
   BacProf — système visuel « cahier du BAC »
   Papier Seyès, stylo bleu, stylo rouge de correction, surligneur fluo.
   Une seule famille (Readex Pro) pour le français et l'arabe.
   ===================================================================== */
:root {
  --paper: #F6F7FB;      /* fond : feuille légèrement bleutée */
  --sheet: #FFFFFF;      /* cartes : feuille blanche */
  --ink: #141B34;        /* texte */
  --ink-2: #3A4363;
  --muted: #6A7290;
  --line: #DCE2F0;       /* bordures */
  --grid: #E4E9F6;       /* lignes Seyès */
  --grid-strong: #CFD9F0;
  --blue: #1D3BA8;       /* stylo bleu : actions */
  --blue-600: #142C86;
  --blue-50: #ECF0FD;
  --red: #D7263D;        /* stylo rouge : direct, alertes, marge */
  --red-50: #FDEDEF;
  --hl: #FFE45C;         /* surligneur */
  --hl-soft: #FFF5BF;
  --green: #0E8F6E;      /* intercalaire école, succès */
  --green-50: #E2F5EE;
  --amber: #A65F00;
  --amber-50: #FFF2D9;

  --r-sheet: 16px;
  --r-ctl: 12px;
  --r-field: 10px;
  --shadow: 0 1px 0 #E3E8F4, 0 14px 30px -22px rgba(20, 27, 52, .45);
  --shadow-lift: 0 1px 0 #E3E8F4, 0 22px 40px -24px rgba(20, 27, 52, .55);

  --font: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --fs-xs: .8125rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.1875rem; --fs-xl: 1.5rem; --fs-2xl: 2rem; --fs-3xl: 2.75rem;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 264px;
  --tabbar-h: 64px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.6; color: var(--ink); background: var(--paper); min-height: 100vh; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--blue); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .9em; background: var(--blue-50); color: var(--blue-600); padding: 2px 8px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
::selection { background: var(--hl); color: var(--ink); }
:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.end { text-align: end; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.hidden, [hidden] { display: none !important; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ok-text { color: var(--green); font-weight: 600; }
.warn-text { color: var(--amber); font-weight: 600; }
.bad-text { color: var(--red); font-weight: 600; }
.hint { color: var(--muted); font-size: var(--fs-sm); }
.ic { width: 20px; height: 20px; flex: none; }

/* Fond « Seyès » discret pour les pages */
.paper-bg, .layout-app .main, .layout-public {
  background-color: var(--paper);
  background-image: linear-gradient(rgba(214, 222, 242, .7) 1px, transparent 1px);
  background-size: 100% 32px;
}

/* ---------- Coque application ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.navtoggle { position: absolute; opacity: 0; pointer-events: none; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sheet); border-inline-end: 1px solid var(--line); padding: 20px 14px; z-index: 40; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--blue); color: #fff; font-weight: 700; font-size: 1.15rem; position: relative; overflow: hidden; }
.brand-mark::after { content: ''; position: absolute; inset-inline-start: 7px; top: 0; bottom: 0; width: 2px; background: var(--red); opacity: .9; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 1.08rem; }
.brand-tag { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.sidebar .drawer-close { display: none; }
.sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidenav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: .95rem; isolation: isolate; transition: background .2s var(--ease), color .2s; }
.sidenav a:hover { background: var(--blue-50); color: var(--blue); text-decoration: none; }
.sidenav a.active { color: var(--ink); font-weight: 600; }
.sidenav a.active .nav-label { position: relative; }
/* coup de surligneur sous la page active */
.sidenav a.active .nav-label::before { content: ''; position: absolute; inset-inline: -4px; bottom: 1px; height: .62em; background: var(--hl); border-radius: 3px 8px 4px 6px; z-index: -1; transform-origin: left center; animation: hl-swipe .5s var(--ease) .12s both; }
[dir="rtl"] .sidenav a.active .nav-label::before { transform-origin: right center; }
.sidenav a.active .ic { color: var(--blue); }
@keyframes hl-swipe { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.badge { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--red); color: #fff; font-size: .75rem; font-weight: 700; }
.sidebar-foot { border-top: 1px dashed var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text b { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: var(--fs-xs); }
.foot-actions { display: flex; flex-direction: column; gap: 2px; }
.ghost-link { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font: inherit; font-size: .9rem; background: none; border: 0; cursor: pointer; text-align: start; }
.ghost-link:hover { background: var(--blue-50); color: var(--blue); text-decoration: none; }
.ghost-link.danger:hover { background: var(--red-50); color: var(--red); }
.ghost-link .ic { width: 18px; height: 18px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.tabbar { display: none; }
.scrim { display: none; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--ink-2); background: transparent; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--blue-50); color: var(--blue); }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 56px; }
.page { flex: 1; }
.narrow { max-width: 720px; margin-inline: auto; }
.narrow-sm { max-width: 460px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.gap-lg { gap: 20px; }
.grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head .count, .count { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 9px; border-radius: 99px; background: var(--hl-soft); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; vertical-align: middle; }

/* ---------- Barre publique ---------- */
.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.publicbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1180px; width: 100%; margin: 0 auto; padding: 18px 28px; }
.publicnav { display: flex; align-items: center; gap: 6px; }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1180px; width: 100%; margin: 0 auto; padding: 22px 28px 32px; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Cartes / « feuilles » ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 26px 8px; margin: 0; }
.empty-card { margin-bottom: 16px; }

/* ---------- Alertes en ligne / toasts ---------- */
.alert { position: relative; padding: 12px 16px 12px 18px; border-radius: var(--r-field); margin-bottom: 16px; border: 1px solid transparent; font-size: .95rem; }
.alert::before { content: ''; position: absolute; inset-inline-start: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: currentColor; opacity: .7; }
.alert ul { margin: 4px 0; padding-inline-start: 18px; }
.alert-success { background: var(--green-50); color: #0B6B53; }
.alert-error { background: var(--red-50); color: #A61B2E; }
.alert-info { background: var(--blue-50); color: var(--blue-600); }
.toasts { position: fixed; z-index: 100; inset-inline-end: 20px; top: 20px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px 13px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 18px 40px -16px rgba(20, 27, 52, .6); font-size: .93rem; animation: toast-in .45s var(--ease) both; border-inline-start: 4px solid var(--hl); }
.toast-success { border-inline-start-color: #5CD6A9; }
.toast-error { border-inline-start-color: #FF7A8A; }
.toast-info { border-inline-start-color: #8FA8FF; }
.toast span { flex: 1; }
.toast-x { background: none; border: 0; color: rgba(255, 255, 255, .7); cursor: pointer; padding: 0; display: grid; }
.toast-x .ic { width: 18px; height: 18px; }
.toast.is-leaving { animation: toast-out .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: var(--r-ctl); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: transform .12s var(--ease), background .2s, box-shadow .2s, border-color .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -10px rgba(29, 59, 168, .9); }
.btn-primary:hover { background: var(--blue-600); }
.btn-accent { background: var(--hl); color: var(--ink); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08); }
.btn-accent:hover { background: #FFDB2E; }
.btn-ghost { background: var(--sheet); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger-ghost { background: var(--sheet); color: var(--red); border-color: #F4C9CF; }
.btn-danger-ghost:hover { background: var(--red-50); }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.actions.center { justify-content: center; }
.link-sm { display: inline-block; font-size: .9rem; font-weight: 500; margin-top: 6px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
input, select, textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-field); padding: 11px 13px; transition: border-color .15s, box-shadow .15s; }
input::placeholder { color: #9AA1BA; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-50); }
input:disabled { background: var(--paper); color: var(--muted); }
input[type=file] { padding: 9px; background: var(--paper); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--blue); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; }
.filters > * { width: auto; flex: 1 1 170px; }
.filters .btn { flex: 0 0 auto; }
.inline-form { padding: 0; margin-bottom: 12px; border: 0; box-shadow: none; }
.code-form { display: flex; gap: 8px; max-width: 460px; }
.code-form input { text-transform: uppercase; letter-spacing: .14em; font-weight: 600; direction: ltr; text-align: center; }
.code-form-sm { max-width: 360px; }
.code-center { margin: 14px auto; justify-content: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-inline-end: 84px; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--paper); color: var(--ink-2); font: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 6px 10px; border-radius: 8px; cursor: pointer; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 12px 10px; text-align: start; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); border-bottom-color: var(--line); }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #F8FAFF; }
tfoot th { color: var(--ink); font-size: .95rem; font-weight: 600; border: 0; }
th.end, td.end { text-align: end; }

/* ---------- Pastilles / listes ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
a.chip:hover { text-decoration: none; filter: brightness(.97); }
.chip-ok { background: var(--green-50); color: #0B6B53; }
.chip-warn { background: var(--amber-50); color: var(--amber); }
.chip-expired { background: var(--red-50); color: #B21E33; }
.chip-none { background: #EEF0F6; color: var(--muted); }
.chip-info { background: var(--blue-50); color: var(--blue-600); }
.chip-live { background: var(--red-50); color: var(--red); }
.chip-live .live-dot { width: 8px; height: 8px; }
.kv { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 0; }
.kv li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--grid-strong); font-size: .93rem; }
.kv li:last-child { border-bottom: 0; }
.kv li > span { color: var(--muted); }
.kv-compact li { padding: 6px 0; font-size: .88rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-direction: column; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.list li:last-child { border-bottom: 0; }
.list li.is-unread { font-weight: 600; }
.info-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0; color: var(--ink-2); font-size: .92rem; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet); box-shadow: var(--shadow); color: var(--ink); overflow: hidden; }
.stat::before { content: ''; position: absolute; inset-inline-start: 14px; top: 0; bottom: 0; width: 1px; background: rgba(215, 38, 61, .35); }
.stat-label, .stat-value { padding-inline-start: 10px; }
.stat-link { transition: transform .2s var(--ease), box-shadow .2s; }
.stat-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat-label { font-size: var(--fs-sm); color: var(--muted); }
.stat-value { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-alert { background: linear-gradient(180deg, var(--hl-soft), var(--sheet) 70%); border-color: #F3DE7A; }

/* ---------- Onglets ---------- */
.tabs { display: inline-flex; padding: 4px; gap: 2px; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; }
.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: .9rem; }
.tabs a:hover { text-decoration: none; background: var(--blue-50); }
.tabs a.active { background: var(--ink); color: #fff; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; border-radius: 9px; font-size: .88rem; font-weight: 500; color: var(--ink-2); transition: background .2s var(--ease), color .2s; }
.seg-present input:checked + span { background: var(--green); color: #fff; }
.seg-absent input:checked + span { background: var(--red); color: #fff; }
.seg-excused input:checked + span { background: var(--hl); color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--hl); }
.seg-wide { display: flex; }
.seg-wide label { flex: 1; text-align: center; }

/* ---------- Page d'accueil ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 26px 0 40px; }
.hero-text { position: relative; }
.eyebrow { display: inline-block; font-size: var(--fs-sm); font-weight: 500; color: var(--red); margin-bottom: 10px; }
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.08; letter-spacing: -.03em; font-weight: 600; margin-bottom: 18px; }
[dir="rtl"] .hero h1 { letter-spacing: 0; line-height: 1.3; }
.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 34em; margin-bottom: 24px; }
.hero-cards { display: grid; gap: 12px; }
.portal-card { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 4px 14px; padding: 18px 20px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet); box-shadow: var(--shadow); }
.portal-card::after { content: ''; position: absolute; inset-inline-end: -1px; top: 18px; width: 6px; height: 34px; border-radius: 4px 0 0 4px; background: var(--blue); }
[dir="rtl"] .portal-card::after { border-radius: 0 4px 4px 0; }
.portal-student::after { background: var(--hl); }
.portal-school::after { background: var(--green); }
.portal-icon { grid-row: span 3; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); }
.portal-student .portal-icon { background: var(--hl-soft); color: var(--ink); }
.portal-school .portal-icon { background: var(--green-50); color: var(--green); }
.portal-icon .ic { width: 24px; height: 24px; }
.portal-card h2 { margin: 0; font-size: var(--fs-md); }
.portal-card p { margin: 0 0 8px; color: var(--muted); font-size: .92rem; }
.portal-card .btn { justify-self: start; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 30px; }
.step { position: relative; padding: 20px 22px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet); }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--blue); color: var(--blue); font-weight: 700; margin-bottom: 10px; }
.step p { margin: 0; color: var(--muted); font-size: .93rem; }

/* ---------- Connexion universelle ---------- */
.auth-main { display: block; }
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-paper { position: relative; overflow: hidden; background: #FBFCFF; border-inline-end: 1px solid var(--line); }
.paper-lines { position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(126, 152, 214, .42) 1px, transparent 1px),
    linear-gradient(rgba(176, 194, 236, .18) 1px, transparent 1px);
  background-size: 100% 32px, 100% 8px;
  background-position: 0 23px, 0 23px;
  animation: lines-in 1.1s var(--ease) both; }
.paper-margin { position: absolute; top: 0; bottom: 0; inset-inline-start: 88px; width: 2px; background: var(--red); transform-origin: top; animation: margin-draw .9s var(--ease) .25s both; }
.paper-content { position: relative; padding: 46px 48px 46px 120px; display: flex; flex-direction: column; min-height: 100%; }
[dir="rtl"] .paper-content { padding: 46px 120px 46px 48px; }
.brand-lg .brand-mark { width: 42px; height: 42px; font-size: 1.3rem; }
.brand-lg .brand-name { font-size: 1.25rem; }
.paper-title { margin: auto 0 26px; font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 64px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); max-width: 11em; animation: rise .7s var(--ease) .45s both; }
[dir="rtl"] .paper-title { letter-spacing: 0; }
.paper-notes { list-style: none; margin: 0 0 auto; padding: 0; display: grid; gap: 0; max-width: 30em; }
.paper-notes li { position: relative; width: fit-content; line-height: 32px; font-size: 1.05rem; color: var(--blue-600); animation: rise .6s var(--ease) both; }
.paper-notes li:nth-child(1) { animation-delay: .6s; } .paper-notes li:nth-child(2) { animation-delay: .7s; } .paper-notes li:nth-child(3) { animation-delay: .8s; }
.paper-notes li::before { content: ''; position: absolute; inset-inline-start: -18px; top: 12px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--blue); }
.paper-notes li span, .paper-notes li { isolation: isolate; }
.auth[data-role="student"] .note-student, .auth[data-role="teacher"] .note-teacher, .auth[data-role="school"] .note-school { color: var(--ink); font-weight: 500; }
.auth[data-role="student"] .note-student::after, .auth[data-role="teacher"] .note-teacher::after, .auth[data-role="school"] .note-school::after {
  content: ''; position: absolute; inset-inline-start: -6px; inset-inline-end: 0; bottom: 6px; height: 14px; background: var(--hl); opacity: .85; z-index: -1; border-radius: 3px 10px 4px 8px; transform-origin: left; animation: hl-swipe .55s var(--ease) both; }
[dir="rtl"] .paper-notes li::after { transform-origin: right; }
@keyframes lines-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes margin-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(22px, 6vw, 80px); max-width: 620px; width: 100%; margin-inline: auto; }
.auth-top { display: flex; justify-content: flex-end; align-items: center; margin-bottom: auto; padding-bottom: 28px; }
.auth-brand-mobile { display: none; }
.auth-title { font-size: var(--fs-xl); margin-bottom: 18px; }
.role-tabs { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-bottom: 22px; border-bottom: 2px solid var(--grid-strong); }
.role-tab { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 6px; color: var(--muted); font-weight: 500; font-size: .95rem; border-radius: 12px 12px 0 0; transition: color .2s, background .2s; }
.role-tab:hover { text-decoration: none; color: var(--ink); background: rgba(236, 240, 253, .7); }
.role-tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.role-ink { position: absolute; bottom: -2px; height: 4px; width: calc(100% / 3); inset-inline-start: 0; border-radius: 4px; background: var(--blue); transform: translateX(var(--ink-x, 0)); transition: transform .45s var(--ease), background .3s; }
.auth[data-role="student"] .role-ink { background: #F2C400; }
.auth[data-role="school"] .role-ink { background: var(--green); }
.auth[data-role="student"] .role-tab.role-student .ic { color: #C9A200; }
.auth[data-role="teacher"] .role-tab.role-teacher .ic { color: var(--blue); }
.auth[data-role="school"] .role-tab.role-school .ic { color: var(--green); }
.role-panels { position: relative; }
.role-panel.is-entering { animation: panel-in .42s var(--ease) both; }
@keyframes panel-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .role-panel.is-entering { animation-name: panel-in-rtl; }
@keyframes panel-in-rtl { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.auth-extra p { margin: 4px 0 0; font-size: .93rem; color: var(--muted); }
.code-strip { margin-top: 26px; padding: 16px; border: 1px dashed var(--grid-strong); border-radius: var(--r-sheet); background: var(--sheet); display: grid; gap: 8px; }
.code-strip label { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.code-strip .code-form { max-width: none; }
.auth[data-role="teacher"] .code-strip, .auth[data-role="school"] .code-strip { display: none; }
.auth-panel > .install-btn { margin-top: 14px; align-self: center; }
.auth.is-app-locked .role-tabs { display: none; }

/* ---------- Pages d'inscription / adhésion ---------- */
.auth-card { padding: 30px; }
.group-intro { position: relative; overflow: hidden; color: #fff; border: 0; background: var(--blue) center / cover no-repeat; }
.group-intro::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(20, 44, 134, .96), rgba(20, 44, 134, .72)); }
.group-intro::after { content: ''; position: absolute; top: 0; bottom: 0; inset-inline-start: 26px; width: 2px; background: rgba(255, 120, 140, .8); }
.group-intro > * { position: relative; padding-inline-start: 18px; }
.group-intro .eyebrow { color: var(--hl); }
.group-intro h1 { margin-bottom: 6px; }
.group-intro .info-strip { color: rgba(255, 255, 255, .92); }
.group-teacher { opacity: .95; margin: 0; display: flex; align-items: center; gap: 10px; }
.success-card { text-align: center; padding: 40px 26px; }
.success-card .info-strip { justify-content: center; }
.success-icon { width: 76px; height: 76px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: var(--green-50); color: var(--green); font-size: 2rem; font-weight: 700; animation: pop .55s var(--ease) both; }
.success-icon.is-bad { background: var(--red-50); color: var(--red); }
.success-icon svg { width: 46px; height: 46px; }
.success-icon .draw { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .55s var(--ease) .25s forwards; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.full-card { border: 2px solid #F3DE7A; background: var(--hl-soft); }
.alt-list { display: grid; gap: 8px; }
.alt-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); transition: border-color .2s, transform .2s var(--ease); }
.alt-item:hover { text-decoration: none; border-color: var(--blue); transform: translateX(2px); }
.alt-item .chip { margin-inline-start: auto; }

/* ---------- Groupes / demandes ---------- */
.group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.group-list .card { margin: 0; }
.group-card { position: relative; padding-inline-start: 30px; }
.group-card::before { content: ''; position: absolute; top: 18px; bottom: 18px; inset-inline-start: 14px; width: 2px; border-radius: 2px; background: var(--red); opacity: .55; }
.group-card.is-off { opacity: .6; }
.group-card.is-off::before { background: var(--muted); }
.group-card-top { display: flex; justify-content: space-between; gap: 8px; }
.group-card h3 { margin-bottom: 2px; font-size: 1.05rem; }
.code-line { font-size: var(--fs-sm); color: var(--muted); }
.req-list { display: grid; gap: 16px; }
.req-card { display: grid; grid-template-columns: 1fr 300px; gap: 22px; margin: 0; }
.req-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-name h3 { margin: 0; font-size: 1.05rem; }
.req-actions { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--paper); border-radius: 14px; align-self: start; }
.pay-form { gap: 8px; }
.cred-panel { border: 2px solid #9ED9C2; background: linear-gradient(180deg, var(--green-50), var(--sheet) 65%); animation: rise .5s var(--ease) both; }
.cred-panel h2 { color: #0B6B53; }
.cred-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; padding: 14px 16px; margin: 10px 0; background: var(--sheet); border: 1px dashed #9ED9C2; border-radius: 12px; }
.cred-box > div { display: flex; flex-direction: column; gap: 4px; }
.cred-box span { font-size: var(--fs-xs); color: var(--muted); }
.cred-box code { font-size: 1.12rem; padding: 5px 11px; }
.sticky-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 18px 40px -16px rgba(20, 27, 52, .6); }
.wl-check { width: 20px; height: 20px; }

/* ---------- Abonnement / progression ---------- */
.sub-meter { margin: 6px 0 16px; }
.sub-meter-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.progress { height: 8px; margin: 10px 0; border-radius: 99px; background: var(--grid); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 99px; background: var(--green); transform-origin: left; animation: grow .9s var(--ease) .15s both; }
[dir="rtl"] .progress span { transform-origin: right; }
.progress-warn span { background: #E7A400; }
.progress-expired span, .progress-none span { background: var(--red); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Cours (élève) ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 20px; }
.course-grid .card { margin: 0; }
.course-card { position: relative; display: flex; flex-direction: column; padding-top: 26px; overflow: hidden; }
.course-card::before { content: ''; position: absolute; top: 0; inset-inline: 0; height: 6px; background: var(--green); }
.course-warn::before { background: #E7A400; }
.course-expired::before, .course-none::before, .course-banned::before { background: var(--red); }
.course-confirmed::before { background: var(--blue); }
.course-banned { opacity: .9; }
.course-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.course-subject { font-size: var(--fs-sm); font-weight: 600; color: var(--blue); }
.course-card h3 { margin: 0; font-size: 1.1rem; }
.course-card .link-sm { margin-top: auto; padding-top: 8px; }

/* ---------- Avatars / images ---------- */
.avatar { width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none; overflow: hidden; border-radius: 50%; background: var(--blue-50); color: var(--blue); font-weight: 600; font-size: 1rem; border: 2px solid var(--sheet); box-shadow: 0 0 0 1px var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 32px; height: 32px; font-size: .85rem; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 2rem; }
.with-avatar { display: inline-flex; align-items: center; gap: 12px; }
h1.with-avatar { display: flex; }
.grid-images { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.img-preview { margin: 4px 0 6px; }
.img-preview-wide { height: 130px; display: grid; place-items: center; border-radius: 12px; border: 1px dashed var(--grid-strong); background: var(--paper) center / cover no-repeat; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- École ---------- */
.school-hero { position: relative; overflow: hidden; color: #fff; border: 0; padding: 30px; background: var(--ink) center / cover no-repeat; }
.school-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 27, 52, .25), rgba(20, 27, 52, .9)); }
.school-hero.has-banner { min-height: 240px; display: flex; align-items: flex-end; }
.school-hero-inner { position: relative; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.school-hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin: 0; }
.school-hero .muted { color: rgba(255, 255, 255, .82); }
.school-hero .eyebrow { color: var(--hl); }
.teacher-block { overflow: hidden; padding-top: 0; }
.teacher-cover { height: 14px; margin: 0 -22px 14px; background: var(--blue); }
.teacher-cover.has-cover { height: 150px; background-size: cover; background-position: center; }
.teacher-cover.has-cover + .teacher-block-head { margin-top: -40px; }
.teacher-cover.has-cover + .teacher-block-head h2 { margin-top: 32px !important; }
.teacher-block-head { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pub-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pub-group { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); transition: border-color .2s, transform .2s var(--ease); }
.pub-group:hover { border-color: var(--blue); transform: translateY(-2px); }
.pub-group .btn { margin-top: auto; }
.search-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.search-bar > * { flex: 1 1 200px; }
.dash-banner { height: 170px; margin-bottom: -48px; border-radius: var(--r-sheet); background: var(--ink) center / cover no-repeat; box-shadow: var(--shadow); }
.dash-banner + .page-head { position: relative; padding: 0 20px; }
.school-li { flex-direction: row !important; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- Présences / direct ---------- */
.att-tools { display: flex; justify-content: flex-end; }
.att-list { display: flex; flex-direction: column; }
.att-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.att-name { display: flex; flex-direction: column; gap: 2px; }
.att-name .chip { align-self: flex-start; }
.live-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(215, 38, 61, .5); animation: pulse 1.6s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(215, 38, 61, .5); } 70% { box-shadow: 0 0 0 10px rgba(215, 38, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(215, 38, 61, 0); } }
.chrono { display: inline-block; padding: 4px 12px; border-radius: 99px; background: var(--ink); color: #fff; font-weight: 600; font-size: .95rem; font-variant-numeric: tabular-nums; letter-spacing: .04em; direction: ltr; }
.chrono-sm { font-size: .9rem; }
.live-start { text-align: center; padding: 46px 24px; }
.live-start-icon { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font-size: 1.8rem; box-shadow: 0 0 0 10px var(--red-50); }
.live-start-form { max-width: 460px; margin: 0 auto; align-items: center; }
.live-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.live-board { text-align: center; }
.live-board:fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--sheet); }
.live-board:fullscreen .live-qr img, .live-board:fullscreen .live-qr canvas { width: 46vh !important; height: 46vh !important; }
.live-board:fullscreen .live-code { font-size: 5.5rem; }
.live-head { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--red); font-weight: 600; margin-bottom: 14px; }
.live-qr { display: inline-block; padding: 14px; background: #fff; border: 2px solid var(--ink); border-radius: 18px; }
.live-qr img, .live-qr canvas { display: block; }
.live-code-label { margin-top: 14px; color: var(--muted); font-size: var(--fs-sm); }
.live-code { font-size: 3.2rem; font-weight: 700; letter-spacing: .1em; color: var(--blue); font-variant-numeric: tabular-nums; direction: ltr; }
.live-refresh { max-width: 280px; height: 5px; margin: 6px auto; border-radius: 99px; background: var(--grid); overflow: hidden; }
.live-refresh span { display: block; height: 100%; background: var(--hl); transition: width 1s linear; }
.live-count { font-size: 1.2rem; }
.live-list { list-style: none; margin: 0; padding: 0; max-height: 540px; overflow: auto; }
.live-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--grid); }
.live-list li.is-in { animation: rise .35s var(--ease) both; }
.live-list li.is-in .with-avatar > span:last-child { font-weight: 600; }
.live-banner-wrap { display: grid; gap: 10px; margin-bottom: 18px; }
.live-banner-wrap:empty { display: none; }
.live-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--sheet); border: 2px solid #F3B5BE; border-radius: var(--r-sheet); box-shadow: var(--shadow); animation: rise .45s var(--ease) both; }
.live-banner.is-checked { border-color: #9ED9C2; }
.live-banner.is-checked .live-dot { background: var(--green); animation: none; }
.live-banner-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 600; }
.live-banner .code-form input { max-width: 170px; }
.live-panel .card-head h2 { display: flex; align-items: center; gap: 10px; }
.live-rows { display: flex; flex-direction: column; }
.live-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.live-row:last-child { border-bottom: 0; }

/* ---------- Affiche QR ---------- */
.poster { position: relative; max-width: 520px; margin: 0 auto 22px; padding: 34px 30px 28px 56px; text-align: center; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lift);
  background-image: linear-gradient(rgba(176, 194, 236, .35) 1px, transparent 1px); background-size: 100% 32px; }
.poster::before { content: ''; position: absolute; top: 0; bottom: 0; inset-inline-start: 34px; width: 2px; background: var(--red); }
[dir="rtl"] .poster { padding: 34px 56px 28px 30px; }
.poster-brand { font-weight: 700; color: var(--blue); }
.poster-logo { margin-top: 10px; }
.poster-kicker { margin: 10px 0 4px; color: var(--red); font-weight: 600; }
.poster-title { font-size: 1.8rem; margin-bottom: 4px; }
.poster-teacher { color: var(--ink-2); font-weight: 500; }
.poster-qr { display: inline-block; margin: 12px 0; padding: 14px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; }
.poster-qr img, .poster-qr canvas { display: block; }
.poster-code { margin: 6px 0; font-size: 1.05rem; }
.poster-code b { letter-spacing: .16em; color: var(--blue); }
.poster-info { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin: 10px 0; color: var(--ink-2); font-size: .92rem; }
.poster-url { margin: 0; font-size: .75rem; color: var(--muted); word-break: break-all; }

/* ---------- Reçu ---------- */
.receipt-page { padding: 26px 16px; background: var(--paper); }
.receipt { max-width: 640px; margin: 0 auto; padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sheet); box-shadow: var(--shadow); }
.receipt-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 2px solid var(--ink); }
.receipt-head h1 { margin: 0; }
.receipt-table th { width: 40%; font-size: .9rem; }
.receipt-total th, .receipt-total td { border: 0; font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.receipt-sign { display: flex; justify-content: flex-end; margin-top: 48px; }
.receipt-sign span { min-width: 210px; padding-top: 6px; border-top: 1px solid var(--ink-2); text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Transitions de page (navigateurs compatibles) ---------- */
@view-transition { navigation: auto; }
.page { view-transition-name: page; }
::view-transition-old(page) { animation: vt-out .18s var(--ease) both; }
::view-transition-new(page) { animation: vt-in .32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-main, .grid-side, .live-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); height: 100%; transform: translateX(-104%); transition: transform .35s var(--ease); box-shadow: 0 0 60px rgba(20, 27, 52, .25); }
  [dir="rtl"] .sidebar { transform: translateX(104%); }
  .navtoggle:checked ~ .sidebar { transform: none; }
  .sidebar .drawer-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(20, 27, 52, .5); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .navtoggle:checked ~ .scrim { opacity: 1; pointer-events: auto; }
  .mobilebar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobilebar .brand { margin-inline-end: auto; }
  .me-mini { display: grid; }
  .tabbar { position: fixed; z-index: 25; inset-inline: 0; bottom: 0; display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tabbar a, .tab-more { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 500; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar a:hover { text-decoration: none; }
  .tab-ic { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 99px; transition: background .25s var(--ease); }
  .tab-ic .badge { position: absolute; top: -4px; inset-inline-end: 4px; min-width: 18px; height: 18px; font-size: .65rem; padding: 0 5px; }
  .tabbar a.active { color: var(--ink); font-weight: 600; }
  .tabbar a.active .tab-ic { background: var(--hl); animation: tab-pop .4s var(--ease); }
  @keyframes tab-pop { 0% { transform: scale(.7); } 100% { transform: scale(1); } }
  .tab-label { max-width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .layout-app .container { padding: 20px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
  .toasts { inset-inline: 16px; top: 72px; max-width: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-paper { display: none; }
  .auth-panel { justify-content: flex-start; padding-top: 22px; background-image: linear-gradient(var(--grid) 1px, transparent 1px); background-size: 100% 32px; }
  .auth-top { justify-content: space-between; margin-bottom: 20px; }
  .auth-brand-mobile { display: inline-flex; }
  .sticky-bar { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .container { padding-inline: 16px; }
  .publicbar, .footer { padding-inline: 16px; }
  .grid-2, .steps, .grid-images { grid-template-columns: 1fr; }
  .stats { gap: 10px; }
  .stat { padding: 14px 14px; }
  .stat-value { font-size: 1.4rem; }
  .req-card { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .code-form { flex-direction: column; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head > .btn, .page-head > form, .page-head > .actions { align-self: stretch; }
  .live-row { grid-template-columns: 1fr auto; }
  .live-code { font-size: 2.5rem; }
  .role-tab span { font-size: .85rem; }
  .dash-banner { height: 110px; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  @view-transition { navigation: none; }
}

/* ---------- Impression ---------- */
@media print {
  body, .layout-app .main, .layout-public { background: #fff !important; }
  .no-print, .sidebar, .tabbar, .mobilebar, .toasts, .footer, .publicbar { display: none !important; }
  .shell { display: block; }
  .container { padding: 0; max-width: none; }
  .card, .poster, .receipt { box-shadow: none; }
  a { color: inherit; }
}
.portal-card > :not(.portal-icon) { grid-column: 2; }
.portal-card .link-sm { justify-self: start; }

/* Accueil : la page de cahier */
.hero-sheet { padding: 40px 40px 34px 76px; background: #FBFCFF; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lift);
  background-image: linear-gradient(rgba(126, 152, 214, .38) 1px, transparent 1px); background-size: 100% 32px; background-position: 0 31px; overflow: hidden; }
.hero-sheet::before { content: ''; position: absolute; top: 0; bottom: 0; inset-inline-start: 46px; width: 2px; background: var(--red); transform-origin: top; animation: margin-draw .9s var(--ease) .1s both; }
[dir="rtl"] .hero-sheet { padding: 40px 76px 34px 40px; }
.hero-sheet h1 { animation: rise .7s var(--ease) .3s both; }
.hero-sheet .lead { animation: rise .7s var(--ease) .42s both; }
.hero-code { display: grid; gap: 8px; animation: rise .7s var(--ease) .54s both; }
.hero-code label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
@media (max-width: 640px) { .hero-sheet { padding: 26px 20px 24px 46px; } [dir="rtl"] .hero-sheet { padding: 26px 46px 24px 20px; } .hero-sheet::before { inset-inline-start: 26px; } }

/* Corrections après relecture visuelle */
.code-form input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; }
.live-banner-head { flex: 1 1 260px; }
.live-banner-head .chrono { margin-inline-start: auto; }
.live-banner .code-form { flex-direction: row; flex: 1 1 260px; max-width: 360px; }
.live-banner .code-form input { max-width: none; letter-spacing: .2em; }
@media (max-width: 640px) {
  .table-wrap table { min-width: 560px; }
  .live-banner .code-form { max-width: none; }
}
.auth-panel { position: relative; }
.auth-top { position: absolute; top: 28px; inset-inline: clamp(22px, 6vw, 80px); margin: 0; padding: 0; }
@media (max-width: 900px) { .auth-top { position: static; margin-bottom: 20px; } }
