/* ===== Polices ===== */
/* Inter (texte) et Outfit (titres), sous licence SIL OFL — voir fonts/*-OFL.txt.
   Servies depuis le site, jamais depuis un CDN : aucune requête vers un tiers,
   donc aucune adresse IP d'élève transmise à Google. Fichiers variables Google
   Fonts, sous-ensembles latin et latin-ext (œ, æ, caractères accentués rares). */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Outfit"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Outfit"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("fonts/outfit-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ===== Base ===== */
:root {
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Outfit", "Inter", system-ui, sans-serif;
  --font-code: ui-monospace, "Cascadia Code", Consolas, monospace;
  --bg: #f1f5f9;
  --panel: #ffffff;
  --column: #e8edf3;
  --ink: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --border: #d7dee8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .12);
  /* Colonne unique de l'application : page d'accueil, pages du professeur et
     en-tête s'y alignent tous, sur la largeur héritée de l'accueil. Ne
     s'applique pas aux tableaux, dont le plan de travail va d'un bord à
     l'autre. Changer ces deux valeurs déplace toute la mise en page. */
  --page-max: 1080px;
  --page-gutter: 1.5rem;
}
/* Sur un petit écran, la gouttière prend le pas sur la largeur : on resserre
   pour rendre au contenu les quelques pixels qui comptent encore. */
@media (max-width: 520px) { :root { --page-gutter: 1.1rem; } }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }
.container { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 1.5rem var(--page-gutter); }
/* overscroll-behavior : un glissement horizontal arrivé en bout de tableau ne
   doit pas déclencher le « retour » du navigateur sur mobile. */
.board-main { padding: 1rem; overflow-x: auto; overscroll-behavior-x: contain; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
h4 { font-size: .85rem; margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

a { color: var(--accent); }
.muted { color: var(--muted); }
code { background: #eef2f7; padding: .1em .35em; border-radius: 4px; font-size: .95em; }

.site-footer {
  text-align: center; padding: .8rem; font-size: .8rem; color: var(--muted);
}
.site-footer a { color: var(--muted); }

/* ===== Boutons, formulaires ===== */
.btn {
  display: inline-block; border: none; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  padding: .5rem .9rem; border-radius: 8px; font-size: .9rem; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: .9rem; padding: .2rem .4rem; border-radius: 6px;
}
.icon-btn:hover { background: rgba(0,0,0,.07); color: var(--ink); }

input, textarea, select {
  font: inherit; color: inherit;
  padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); width: 100%;
}
textarea { resize: vertical; }
label { font-size: .85rem; font-weight: 600; display: block; }
.stack { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
/* le width: 100% par défaut donnerait au select une base de la largeur du
   formulaire : il écraserait le champ texte, seul à pouvoir se réduire. */
.inline-form input { flex: 1 1 0; min-width: 0; }
.inline-form select { flex: 0 0 auto; width: auto; }
.inline-form label, .inline-form .btn { flex: 0 0 auto; }
/* champ + select sur une ligne : en dessous de ~14rem pour le champ, on passe
   le select et le bouton à la ligne plutôt que de réduire le champ à néant.
   Le `>` laisse hors de portée les champs imbriqués, qui se dimensionnent eux-mêmes. */
.inline-form:has(select) { flex-wrap: wrap; }
.inline-form:has(select) > input { flex-basis: 14rem; }
/* Sélecteur de catégorie : la liste et le champ « nouvelle catégorie » qu'elle
   révèle ne font qu'un seul élément de la ligne, qui passe à la ligne d'un bloc. */
.category-field { display: flex; gap: .5rem; align-items: center; flex: 0 1 auto; min-width: 0; }
.category-field input { flex: 1 1 11rem; }
/* Aide sous un titre de section : sa marge basse doublerait l'espacement. */
.form-hint { margin: .5rem 0 0; }
.inline-fields { display: flex; gap: 1rem; flex-wrap: wrap; }
.inline-fields label { flex: 1; min-width: 200px; }
.inline { display: inline; }
.grow { flex: 1; }
.code-area, .code-input { font-family: var(--font-code); }

/* ===== Messages ===== */
.msg { padding: .6rem .9rem; border-radius: 8px; font-size: .9rem; }
.msg-error { background: #fee2e2; color: #991b1b; }
.msg-warning { background: #fef3c7; color: #92400e; }
.msg-success { background: #dcfce7; color: #166534; }

/* ===== Écrans d'accès ===== */
.join-card {
  max-width: 400px; margin: 8vh auto 0; background: var(--panel);
  padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center;
}
.join-card .code-input, .join-panel .code-input { text-align: center; font-size: 1.2rem; letter-spacing: .15em; }
.pin-input { letter-spacing: .5em; }
.who-grid { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 1rem 0; }
.btn-who { font-size: 1rem; }
.teacher-link { margin-top: 1.5rem; font-size: .9rem; }

/* ===== En-tête de l'application ===== */
/* Le fond et l'ombre tiennent toute la largeur, le contenu s'aligne sur la
   colonne de la page : la marque tombe à l'aplomb du titre, sur l'accueil
   comme ailleurs. Les marges verticales restent portées par l'en-tête
   lui-même — l'intérieur ne gère que l'axe horizontal. */
.site-header { background: var(--panel); box-shadow: var(--shadow); padding: .65rem 0; }
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-gutter);
}

.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-logo { display: block; }
.brand-name { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.site-header .btn-sm { white-space: nowrap; }

/* Navigation du professeur : les deux sections qu'il fréquente restent
   visibles, tout le reste (export, archives, compte) tient dans le menu ⋮.
   Sous 640 px les onglets s'y replient à leur tour. */
.site-header-actions { display: flex; align-items: center; gap: .3rem; }
.site-nav { display: flex; gap: .15rem; }
.site-nav-link {
  padding: .35rem .7rem; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-size: .9rem; font-weight: 600; white-space: nowrap;
}
.site-nav-link:hover { background: var(--column); color: var(--ink); }
.site-nav-link.active { background: var(--column); color: var(--accent); }
.site-menu-btn { font-size: 1.15rem; line-height: 1; padding: .3rem .5rem; }
/* Deux classes : les réglages génériques de .pop-panel sont déclarés plus bas
   dans la feuille et l'emporteraient à égalité de spécificité. */
.site-menu .pop-panel { width: 220px; padding: .45rem; }
.site-menu-user {
  margin: .15rem .55rem .45rem; font-size: .78rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.menu-item {
  display: block; width: 100%; text-align: left; padding: .45rem .55rem;
  border: none; border-radius: 8px; background: transparent; color: var(--ink);
  text-decoration: none; font: inherit; font-size: .9rem; cursor: pointer;
}
.menu-item:hover { background: var(--column); }
.menu-sep { border: none; border-top: 1px solid var(--border); margin: .4rem .2rem; }
.site-menu-nav { display: none; }
@media (max-width: 640px) {
  .site-nav { display: none; }
  .site-menu-nav { display: block; }
}

/* ===== Page d'accueil ===== */
/* main s'étire (flex: 1) : sans cela, sur un grand écran, une bande de fond
   grise resterait coincée entre les fonctionnalités et le pied de page. */
main.landing { display: flex; flex-direction: column; }
/* Même colonne que .container, sans ses marges verticales : les sections de
   l'accueil (hero, fonctionnalités) portent les leurs, et leur fond va d'un
   bord à l'autre. */
.landing-inner { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-gutter); }

/* Le hero se règle sur son contenu, qui est court : pas de hauteur d'écran
   imposée, qui creuserait d'immenses marges sur un grand écran. Ses marges
   suivent la taille de la fenêtre — largeur (l'écran est grand, on aère) et
   hauteur (la fenêtre est basse, on resserre) — bornées par clamp. Le
   formulaire reste ainsi au-dessus de la ligne de flottaison jusqu'à
   360 x 560, et le bandeau des fonctionnalités déborde juste assez pour
   inviter à défiler. */
.hero {
  padding: clamp(2.25rem, 4.5vw + 2.5vh, 8.5rem) 0;
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(40rem 24rem at 0% 110%, rgba(37, 99, 235, .06), transparent 60%);
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 380px);
  gap: 4.5rem; align-items: center; width: 100%;
}
.hero-eyebrow {
  display: inline-block; margin: 0 0 1.4rem; padding: .3rem .85rem; border-radius: 999px;
  background: rgba(37, 99, 235, .1); color: var(--accent);
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
}
.hero-title {
  font-size: clamp(2.1rem, 4.4vw, 3.1rem); line-height: 1.1; letter-spacing: -.025em;
  margin: 0 0 1.2rem; max-width: 15ch;
}
.hero-lead { margin: 0; font-size: 1.08rem; line-height: 1.65; color: var(--muted); max-width: 33rem; }

.join-panel {
  background: var(--panel); border-radius: 18px; padding: 2.2rem 2rem;
  box-shadow: 0 18px 45px -20px rgba(15, 23, 42, .35), 0 2px 6px rgba(15, 23, 42, .05);
  text-align: center;
}
.join-panel-title { font-size: 1.25rem; margin-bottom: .35rem; }
.join-panel-sub { margin: 0 0 1.4rem; }
.join-panel .stack { gap: .75rem; }
.join-panel .code-input { padding: .8rem .6rem; }
.join-panel .btn { padding: .7rem .9rem; font-size: 1rem; }

/* Fonctionnalités : bandeau clair pleine largeur, sous la ligne de flottaison */
.features {
  flex: 1; background: var(--panel); border-top: 1px solid var(--border); padding: 4.5rem 0;
}
.features-title { text-align: center; font-size: 1.6rem; margin: 0 0 .6rem; }
.features-lead { text-align: center; color: var(--muted); margin: 0 auto 3rem; max-width: 40rem; }
.features-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem;
}
.features-grid li {
  border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem 1.6rem;
  background: linear-gradient(180deg, rgba(241, 245, 249, .55), rgba(241, 245, 249, 0));
}
.feat-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.9rem; height: 2.9rem; margin-bottom: 1rem;
  border-radius: 12px; background: rgba(37, 99, 235, .1); color: var(--accent);
}
.feat-title { font-size: 1.05rem; margin: 0 0 .45rem; }
.feat-desc { margin: 0; font-size: .92rem; line-height: 1.6; color: var(--muted); }

.landing-footer {
  display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center;
  background: var(--panel); border-top: 1px solid var(--border); padding: 1.4rem 1rem;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .hero-title { max-width: none; }
  .features { padding: 3.5rem 0; }
  .features-lead { margin-bottom: 2.2rem; }
  .features-grid { gap: 1.8rem; }
}
/* Petits écrans : on resserre ce qui peut l'être — et on sacrifie la pastille
   décorative — pour que le bouton « Rejoindre » reste au-dessus de la ligne de
   flottaison, même sur un écran de 560 px de haut. */
@media (max-width: 520px) {
  .hero-eyebrow { display: none; }
  .hero-title { font-size: 1.75rem; margin-bottom: .7rem; }
  .hero-lead { font-size: .97rem; line-height: 1.55; }
  .hero-grid { gap: 1.5rem; }
  .join-panel { padding: 1.5rem 1.2rem; }
  .join-panel-sub { margin-bottom: 1rem; }
  .features { padding: 2.8rem 0; }
  .features-title { font-size: 1.4rem; }
}

/* ===== Panneaux (dashboard, snippets) ===== */
.panel {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.board-tile { display: flex; flex-direction: column; }
.board-tile.archived { opacity: .6; }
.board-tile-sub { margin: .1rem 0 .5rem; }
.board-tile-actions { margin-top: auto; padding-top: .3rem; }
.dash-section { margin-bottom: 1.8rem; }
.dash-section-title { font-size: 1.05rem; margin: 0 0 .8rem; padding-bottom: .35rem; border-bottom: 2px solid var(--border); }
.member-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .7rem; }
.chip-name { background: var(--column); color: var(--ink); border-radius: 999px; padding: .12rem .55rem; font-size: .78rem; }
.chip-name.inactive { opacity: .55; text-decoration: line-through; }
.board-tile-empty { margin: 0 0 .7rem; }
.access-code { font-size: 1.3rem; letter-spacing: .12em; }
.member-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 1rem; }
.member-table th, .member-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.member-table tr.inactive td { opacity: .5; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.pin-recap { background: #fef9c3; border: 1px solid #fde047; border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
.pin-recap table { border-collapse: collapse; }
.pin-recap td, .pin-recap th { padding: .2rem .8rem .2rem 0; text-align: left; }
.pin-flash { background: #fef9c3; padding: .1rem .4rem; border-radius: 6px; font-size: .85rem; }
.activity-line { margin: .25rem 0; font-size: .9rem; }
.danger-zone { border: 1px solid #fecaca; }
.badge {
  display: inline-block; background: var(--column); color: var(--muted);
  border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; font-weight: 600;
}
.badge-prof { background: var(--accent); color: var(--accent-ink); }

/* ===== En-tête de tableau ===== */
.board-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--panel); box-shadow: var(--shadow);
}
.board-header-left, .board-header-right { display: flex; align-items: center; gap: .8rem; }
.board-header-left { min-width: 0; }
/* Un filet sépare la marque du titre du tableau : deux noms côte à côte, dont
   un seul désigne la page. Le nom de l'app cède d'ailleurs la place avant
   que le titre ne soit tronqué — l'identité de l'app n'est pas ce qu'on lit ici. */
.board-header .brand { border-right: 1px solid var(--border); padding-right: .8rem; }
@media (max-width: 900px) { .board-header .brand-name { display: none; } }
.board-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tabs { display: flex; gap: .2rem; flex-shrink: 0; }
.tab {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .3rem .7rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .9rem;
}
.tab.active { background: var(--column); color: var(--ink); font-weight: 600; }
.tab-icon { display: inline-flex; color: var(--muted); }
.tab-icon svg { width: 1.15rem; height: 1.15rem; display: block; }
.tab.active .tab-icon { color: var(--accent); }
/* Menu burger : replie le nom d'utilisateur et le bouton « Quitter »
   dans un panneau, pour laisser de la place au titre sur petit écran */
.board-menu { display: none; }
.board-menu-panel { display: flex; flex-direction: column; align-items: stretch; gap: .5rem; width: 200px; }
.board-menu-panel .badge { align-self: flex-start; }
@media (max-width: 640px) {
  .tab-label { display: none; }
  .board-header-right { display: none; }
  .board-menu { display: block; }
}

/* ===== Colonnes et cartes ===== */
.columns {
  display: flex; gap: .8rem; align-items: flex-start; min-height: 70vh;
}
.column {
  background: var(--column); border-radius: var(--radius); padding: .5rem;
  width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: .5rem;
}
.column-add { background: transparent; border: 2px dashed var(--border); }
.column-add summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .3rem; list-style: none; }
.column-header { display: flex; align-items: center; gap: .4rem; padding: .2rem .3rem; cursor: grab; }
.column-header h3 { flex: 1; cursor: pointer; font-size: .95rem; padding: .15rem .3rem; border-radius: 6px; }
.column-header h3:hover { background: rgba(0,0,0,.06); }
.column-header .count { color: var(--muted); font-size: .8rem; }
.cards { display: flex; flex-direction: column; gap: .5rem; min-height: 8px; }
.card-item {
  background: var(--panel); border-radius: 8px; box-shadow: var(--shadow);
  padding: .55rem .65rem; cursor: pointer;
}
.card-item:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
/* L'appui long qui démarre un déplacement ne doit pas sélectionner le texte
   de la carte ni ouvrir le menu contextuel du mobile. */
.card-item, .column-header { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sortable-ghost { opacity: .4; }
.card-title { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.card-labels { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .35rem; }
.label-pill {
  color: #fff; font-size: .68rem; font-weight: 700; padding: .1rem .5rem;
  border-radius: 999px; white-space: nowrap;
}
.card-meta { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; font-size: .75rem; color: var(--muted); }
.card-meta .spacer { flex: 1; }
.avatar {
  background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 700;
  border-radius: 50%; width: 1.5rem; height: 1.5rem; display: inline-flex;
  align-items: center; justify-content: center; text-transform: uppercase;
}
.card-add summary { cursor: pointer; color: var(--muted); font-size: .85rem; padding: .2rem .3rem; list-style: none; }
.card-add summary:hover { color: var(--ink); }

/* Quand le tableau ne tient pas à l'écran, le glissement horizontal fait
   basculer d'une colonne à l'autre : chaque colonne est un point d'ancrage.
   scroll-padding-left reprend le padding de .board-main pour que la colonne
   ancrée se pose à la même distance du bord que la première au repos. */
@media (max-width: 1024px) {
  .board-main { scroll-snap-type: x proximity; scroll-padding-left: 1rem; }
  .column { scroll-snap-align: start; }
}
/* Sur mobile, une colonne occupe presque tout l'écran : ancrage strict, et
   un geste ne franchit qu'une colonne à la fois. */
@media (max-width: 640px) {
  .board-main { scroll-snap-type: x mandatory; }
  .column { scroll-snap-stop: always; }
}
/* Pendant un glisser-déposer, l'ancrage ramènerait sans cesse le tableau sur
   la colonne la plus proche et empêcherait le défilement automatique. */
body.dragging .board-main { scroll-snap-type: none; }

/* ===== Modale carte ===== */
dialog#modal {
  border: none; border-radius: 14px; box-shadow: 0 12px 44px rgba(15,23,42,.32);
  padding: 0; width: min(1180px, 95vw); max-height: 90vh; overflow: hidden;
}
dialog#modal::backdrop { background: rgba(15, 23, 42, .5); }
.modal-inner {
  display: flex; flex-direction: column;
  padding: 1.1rem 1.3rem 0; max-height: 90vh; overflow: hidden;
}
.modal-header { flex: 0 0 auto; display: flex; align-items: flex-start; gap: .5rem; }
.modal-title {
  font-size: 1.25rem; font-weight: 800; border-color: transparent; background: transparent;
  padding: .2rem .35rem;
}
.modal-title:hover { background: var(--column); }
.modal-title:focus { background: var(--panel); border-color: var(--accent); }
.modal-close { font-size: 1.05rem; }
.modal-sub { flex: 0 0 auto; margin: .1rem 0 1rem .4rem; font-size: .82rem; }

/* Chaque colonne défile indépendamment ; l'en-tête reste fixe en haut */
.modal-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 0;
}
.modal-main { min-width: 0; min-height: 0; overflow-y: auto; padding: 0 1.6rem 1.2rem 0; }
.modal-aside {
  min-width: 0; min-height: 0; overflow-y: auto;
  border-left: 1px solid var(--border); padding: 0 0 1.2rem 1.5rem;
}
.aside-title { margin-bottom: .7rem; }
/* Écrans moyens : colonnes de largeurs égales, pour que la zone de gauche
   ne devienne jamais plus étroite que celle des commentaires */
@media (max-width: 960px) {
  .modal-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* En pile (mobile) : on revient à un défilement unique de la carte */
  .modal-inner { display: block; overflow-y: auto; padding-bottom: 1.4rem; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-main, .modal-aside { overflow: visible; min-height: 0; }
  .modal-main { padding: 0; }
  .modal-aside {
    border-left: none; border-top: 1px solid var(--border);
    padding: 1rem 0 0; margin-top: .5rem;
  }
}

/* Encadrés de section */
.box {
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel);
  padding: .85rem 1rem; margin-bottom: 1rem;
}
.box-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.box-head h4 { margin: 0; }
.small { font-size: .85rem; }
.empty-hint {
  border: none; background: var(--column); color: var(--muted); cursor: pointer;
  text-align: left; width: 100%; padding: .5rem .7rem; border-radius: 8px; font-size: .88rem;
}
.empty-hint:hover { background: #dde5ef; }

/* Bloc méta (membres / étiquettes / échéance) */
.meta-row { display: flex; flex-wrap: wrap; gap: .9rem 1.6rem; margin-bottom: 1rem; }
.meta-block { display: flex; flex-direction: column; gap: .35rem; }
.meta-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.meta-inline { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; min-height: 1.9rem; }
.avatar-row { display: inline-flex; gap: .25rem; }
.pill-row { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.due-input { width: auto; padding: .35rem .5rem; }

/* Popovers (details) */
.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 7px; border: 1px dashed var(--border);
  background: var(--column); color: var(--muted); font-size: 1.05rem; line-height: 1;
}
.mini-btn:hover { color: var(--ink); border-color: var(--muted); }
.pop-panel {
  position: absolute; z-index: 40; top: calc(100% + 5px); left: 0;
  width: 260px; max-height: 340px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15,23,42,.2); padding: .7rem;
}
.pop-right .pop-panel { left: auto; right: 0; }
.pop-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: center; margin-bottom: .5rem; }
.picker-row {
  display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left;
  border: none; background: transparent; cursor: pointer; padding: .3rem; border-radius: 8px;
}
.picker-row:hover { background: var(--column); }
.picker-swatch { flex: 1; }
.picker-avatar { display: flex; align-items: center; gap: .5rem; flex: 1; }
.picker-check { color: var(--accent); font-weight: 800; }
.pop-add { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; border-top: 1px solid var(--border); padding-top: .6rem; }

/* Code lié */
.code-link { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
.code-link:hover { background: var(--column); }
.code-link-title { flex: 1; overflow-wrap: anywhere; }

/* Checklists */
.checklist { margin-top: 1rem; }
.checklist:first-of-type { margin-top: .3rem; }
.checklist-head { display: flex; align-items: center; gap: .4rem; }
.cl-title-wrap { display: inline-flex; align-items: center; gap: .4rem; flex: 1; min-width: 0; }
.cl-icon { color: var(--muted); }
.cl-title { cursor: pointer; padding: .1rem .35rem; border-radius: 6px; }
.cl-title:hover { background: var(--column); }
.cl-progress { display: flex; align-items: center; gap: .5rem; margin: .45rem 0; }
.cl-percent { font-size: .72rem; color: var(--muted); width: 2.6rem; }
.cl-bar { flex: 1; height: 8px; background: var(--column); border-radius: 999px; overflow: hidden; }
.cl-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.cl-bar-fill.full { background: #0ea472; }
.cl-items { list-style: none; padding: 0; margin: .3rem 0 0; display: flex; flex-direction: column; }
.cl-item { display: flex; align-items: center; gap: .5rem; padding: .2rem; border-radius: 6px; }
.cl-item:hover { background: var(--column); }
.cl-item:hover .cl-del { opacity: 1; }
.cl-check { border: none; background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--accent); padding: 0; }
.cl-item.done .cl-text { text-decoration: line-through; color: var(--muted); }
.cl-text { flex: 1; cursor: pointer; font-size: .9rem; padding: .2rem .25rem; border-radius: 4px; overflow-wrap: anywhere; }
.cl-text:hover { background: #dde5ef; }
.cl-del { opacity: 0; }
.cl-add { display: flex; gap: .4rem; margin-top: .5rem; }
.cl-add input { flex: 1; }
.cl-edit { display: flex; gap: .4rem; align-items: center; width: 100%; }
.cl-edit input { flex: 1; }

/* Commentaires (colonne de droite, compacts) */
.comment-form { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .9rem; }
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.comment { display: flex; gap: .5rem; }
.comment-avatar { flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: .4rem; font-size: .8rem; margin-bottom: .2rem; }
.comment-head .cmt-del { margin-left: auto; }
.md-comment { font-size: .88rem; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; }
.comment-empty { padding: .2rem 0; }

/* ===== Markdown et code ===== */
.md { font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.md p { margin: .4rem 0; }
.md pre { margin: .5rem 0; }
.codehilite { position: relative; border-radius: 8px; overflow: auto; }
.codehilite pre { margin: 0; padding: .75rem 1rem; font-size: .85rem; }
.code-copy {
  position: absolute; top: .4rem; right: .4rem; font-size: .72rem;
  border: none; border-radius: 6px; padding: .2rem .5rem; cursor: pointer;
  background: rgba(255,255,255,.85); color: var(--ink);
}
.snippet-code .codehilite pre { font-size: .9rem; }
.snippet-tile h3 a { text-decoration: none; color: var(--ink); }

/* Description repliable */
.md-wrap { position: relative; }
.md-wrap.collapsed .md {
  max-height: 8.5em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
}
.md-toggle { margin-top: .5rem; border: none; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; font-size: .85rem; padding: 0; }
.md-toggle:hover { text-decoration: underline; }

/* Badge checklist terminée sur la carte */
.meta-done { color: #0ea472; font-weight: 600; }

/* ===== Barres de défilement fines ===== */
* { scrollbar-width: thin; scrollbar-color: #c3ccd8 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c3ccd8; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a8b3c2; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Visionneuse d'archives ===== */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2rem 1rem; text-align: center; margin-top: 1rem;
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
}
.drop-zone.over { border-color: var(--accent); background: var(--column); }
.drop-zone p { margin: 0; }
.purge-list { margin: .5rem 0 1rem; padding-left: 1.2rem; }
.purge-list li { margin: .25rem 0; }
/* Le tableau archivé réutilise .columns / .column / .card-item : il lui faut le
   défilement horizontal que .board-main donne aux tableaux vivants. */
.archive-scroll {
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: .5rem 0 1rem; margin-bottom: 1rem;
}
/* Les onglets de l'archive sont des boutons (rien à atteindre : tout est dans
   le fichier ouvert), il faut donc annuler l'apparence native du bouton. */
.archive-tabs { margin: .8rem 0; }
.archive-tabs .tab { border: none; background: transparent; cursor: pointer; font: inherit; font-size: .9rem; }
.archive-tabs .tab.active { background: var(--column); }
/* Bouton qui doit se lire comme un lien : liste de snippets, retour arrière. */
.link-btn {
  border: none; background: transparent; padding: 0; cursor: pointer;
  font: inherit; color: var(--accent); text-align: left;
}
.link-btn:hover { text-decoration: underline; }
.snippet-tile .link-btn { color: var(--ink); font-family: var(--font-display); }
/* Dans la fiche carte, « Code lié » est un bouton : même allure que le lien
   des tableaux vivants, sur toute la largeur de l'encadré. */
button.code-link { width: 100%; border: none; background: transparent; cursor: pointer; font: inherit; text-align: left; }
button.code-link:hover { background: var(--column); }
/* Repli des archives aux formats 1 et 2, qui ne portent pas le HTML rendu :
   le markdown source est affiché tel quel, retours à la ligne préservés. */
.archive-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0; }
.archive-snippet { margin-bottom: 1.2rem; }
.archive-snippet:last-child { margin-bottom: 0; }
.archive-code {
  background: var(--column); border-radius: 8px; padding: .7rem .9rem;
  overflow-x: auto; font-family: var(--font-code); font-size: .85rem;
}
/* Titre de carte en lecture seule : même allure que le champ éditable des
   tableaux vivants, sans le survol qui suggérerait qu'on peut le modifier. */
.modal-title-static { font-size: 1.25rem; font-weight: 800; margin: .2rem .35rem; flex: 1; min-width: 0; }
#archive-board .card-item { cursor: pointer; }

/* ===== Accès élève : reprise de session, activation ===== */
.hero-side { display: grid; gap: 1rem; align-content: center; }
.resume-panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 1.2rem 1.4rem; box-shadow: var(--shadow);
}
.resume-list { list-style: none; padding: 0; margin: .6rem 0 .8rem; display: grid; gap: .4rem; }
.resume-list .btn { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; }
.resume-board { font-weight: 600; }
/* Le prénom sous lequel on navigue, affiché en permanence dans l'en-tête : sur
   un poste partagé, c'est le seul signal qui prévient l'arrivant. */
.identity { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.identity strong { color: var(--ink); }
.btn-who-new { display: inline-flex; flex-direction: column; gap: .1rem; }
.who-tag { font-size: .7rem; font-weight: 600; opacity: .75; }
.pin-once {
  font-size: 2.4rem; letter-spacing: .3em; text-align: center;
  margin: 1rem 0; font-family: var(--font-code);
}

/* ===== Sections repliables (panneaux du prof) ===== */
.section-summary, .sub-summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .6rem;
}
.section-summary::-webkit-details-marker, .sub-summary::-webkit-details-marker { display: none; }
/* Chevron tourné par l'état ouvert : le seul repère qui dise que ça se replie. */
.section-summary::before, .sub-summary::before {
  content: "›"; font-size: 1.1em; line-height: 1; color: var(--muted);
  transition: transform .15s ease;
}
details[open] > .section-summary::before, details[open] > .sub-summary::before {
  transform: rotate(90deg);
}
.section-summary h2 { margin: 0; }
.section-details[open] > .section-summary { margin-bottom: .75rem; }
.sub-summary {
  margin-top: 1rem; font-family: var(--font-display); font-weight: 600; color: var(--ink);
}
.sub-summary:hover { color: var(--accent); }

/* ===== Registre d'élèves ===== */
.student-picker { margin-top: .5rem; }
/* Filtre à gauche, sans étiquette : un « toutes les classes » se comprend seul. */
.picker-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.picker-head select { width: auto; flex: 0 0 auto; min-width: 12rem; }
/* Une ligne par élève : une grille en colonnes rendait la lecture d'une liste
   de prénoms bien plus pénible qu'un simple empilement. */
.picker-list {
  list-style: none; margin: 0; padding: .25rem;
  max-height: 17rem; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
}
.picker-item + .picker-item { border-top: 1px solid var(--border); }
.picker-item > label {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .4rem .5rem; border-radius: 6px; cursor: pointer; font-weight: 400;
}
.picker-item > label:hover { background: var(--column); }
.picker-item input[type="checkbox"] { width: auto; flex: 0 0 auto; margin: 0; }
.picker-name { flex: 1; min-width: 0; }
.picker-class, .picker-state { font-size: .8rem; flex: 0 0 auto; }
.picker-item.is-member > label { opacity: .5; cursor: default; }
.picker-item.is-member > label:hover { background: transparent; }
.picker-item[hidden] { display: none; }
.badge-ok { background: #dcfce7; color: #166534; }

/* ===== Divers ===== */
/* Seule page de texte suivi du site : elle se lit, elle ne se balaie pas. La
   colonne commune y donnerait des lignes de 130 caractères, alors on borne la
   justification — les autres pages, faites de cartes et de tableaux, occupent
   toute la largeur sans y perdre. */
.prose {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem 2rem; max-width: 46rem; margin: 0 auto;
}
.prose li { margin: .3rem 0; }
details > summary::-webkit-details-marker { display: none; }
