/*
 * Suivi : feuille de style unique, en CSS simple (aucune chaîne de construction,
 * aucune police ni ressource externe). Thème clair et sombre automatiques
 * (prefers-color-scheme) ; le mode session est toujours sombre (.theme-sombre).
 */

/* 1. Jetons */
:root {
  color-scheme: light dark;
  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --surface-2: #F2F4F7;
  --surface-3: #E8EBF0;
  --line: #E3E6EB;
  --line-strong: #CBD1DA;
  --ink: #12151B;
  --ink-2: #394050;
  --muted: #5B6271;
  --accent: #3355D6;
  --accent-ink: #FFFFFF;
  --accent-soft: #ECF0FD;
  --accent-strong: #2341B0;
  --red: #B42318;   --red-soft: #FDECEA;
  --amber: #9A4600; --amber-soft: #FFF1DE;
  --violet: #6331A6; --violet-soft: #F3ECFB;
  --green: #136C41; --green-soft: #E4F4EA;
  --teal: #0B6874;  --teal-soft: #E1F3F5;
  --gray: #5B6271;  --gray-soft: #EDEFF3;
  --ring: #3355D6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
  --r: 12px;
  --r-lg: 16px;
  --tap: 44px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not(.theme-clair) {
    --bg: #0E1014;
    --surface: #161920;
    --surface-2: #1C2029;
    --surface-3: #262B36;
    --line: #272C37;
    --line-strong: #3A4150;
    --ink: #ECEEF3;
    --ink-2: #C8CDD7;
    --muted: #9BA2B0;
    --accent: #7D96FF;
    --accent-ink: #0A1130;
    --accent-soft: #1D2547;
    --accent-strong: #A3B4FF;
    --red: #FF8F85;   --red-soft: #3A1916;
    --amber: #FFB866; --amber-soft: #33240E;
    --violet: #C6A5FF; --violet-soft: #281D3E;
    --green: #6FD69E; --green-soft: #12301F;
    --teal: #72D4E0;  --teal-soft: #0F2E31;
    --gray: #A3AAB7;  --gray-soft: #232832;
    --ring: #A3B4FF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
  }
}

/* Mode session : toujours sombre (mode concentration) */
.theme-sombre {
  color-scheme: dark;
  --bg: #0E1014; --surface: #161920; --surface-2: #1C2029; --surface-3: #262B36;
  --line: #272C37; --line-strong: #3A4150; --ink: #ECEEF3; --ink-2: #C8CDD7; --muted: #9BA2B0;
  --accent: #7D96FF; --accent-ink: #0A1130; --accent-soft: #1D2547; --accent-strong: #A3B4FF;
  --red: #FF8F85; --red-soft: #3A1916; --amber: #FFB866; --amber-soft: #33240E;
  --violet: #C6A5FF; --violet-soft: #281D3E; --green: #6FD69E; --green-soft: #12301F;
  --teal: #72D4E0; --teal-soft: #0F2E31; --gray: #A3AAB7; --gray-soft: #232832;
  --ring: #A3B4FF; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
}

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.01em; font-weight: 700; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
img, svg { max-width: 100%; }
.ico { flex: none; vertical-align: middle; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lien-evitement { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--surface); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lien-evitement:focus { top: 12px; }

/* 3. Mise en page générale */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--surface) 263px, var(--line) 263px, var(--line) 264px, transparent 264px); }
.nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 14px;
}
.marque { display: flex; align-items: center; gap: 10px; padding: 2px 8px; color: var(--ink); font-weight: 700; }
.marque:hover { text-decoration: none; }
.marque small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, #4A6BEA, #2341B0); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.nav-liens { display: flex; flex-direction: column; gap: 2px; }
.nav a.item {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 10px;
  border-radius: 10px; color: var(--ink-2); font-weight: 500;
}
.nav a.item:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.item.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.nav a.item .nb { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav a.item.on .nb { color: inherit; }
.nav-titre { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.nav-bas { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.recherche { position: relative; }
.recherche .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.recherche input { width: 100%; padding-left: 38px; }

.topbar { display: none; }
.main { min-width: 0; width: 100%; max-width: 1180px; padding: 22px 32px 56px; display: flex; flex-direction: column; gap: 18px; }
#contenu { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.saisie {
  display: flex; gap: 8px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px; box-shadow: var(--shadow);
}
.saisie:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.saisie > .ico { margin-left: 8px; color: var(--muted); }
.saisie input { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none; padding-left: 4px; }
.saisie input:focus-visible { outline: none; }
.astuce { font-size: 12px; color: var(--muted); padding: 0 6px; margin-top: -10px; }
kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--ink-2); }

/* 4. Composants */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card.compacte { padding: 6px 20px; }
.entete { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; justify-content: space-between; }
.entete > div { min-width: 0; }
.sous-titre { color: var(--muted); font-size: 14px; margin-top: 4px; }
.fil { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fil a { color: var(--muted); }
.fil a:hover { color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pile { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.vide { text-align: center; color: var(--muted); padding: 28px 12px; }
.vide b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 14px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ok { background: var(--green-soft); border-color: transparent; color: var(--green); font-weight: 650; }
.btn.ok:hover { filter: brightness(.97); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 650; }
.btn.dark:hover { opacity: .9; }
.btn.danger { color: var(--red); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icone { padding: 0; width: var(--tap); }
.btn.big { min-height: 48px; padding: 0 18px; font-size: 15px; }
.btn.plein { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

input, select, textarea {
  font: 15px/1.3 var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
  min-height: var(--tap); max-width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
input[type=file] { padding: 6px; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: 600 13px var(--font); margin-right: 10px; padding: 7px 12px; border-radius: 8px; border: 0; background: var(--surface-3); color: var(--ink); cursor: pointer; }
textarea { width: 100%; min-height: 110px; resize: vertical; }
::placeholder { color: var(--muted); opacity: .85; }
.champ { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.champ > input, .champ > select, .champ > textarea { font-weight: 400; width: 100%; }
.champ .aide { font-weight: 400; color: var(--muted); font-size: 12px; }
.case { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-size: 14px; }
.grille-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grille-form .large { grid-column: 1 / -1; }

.flash, .err { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r); font-size: 14px; font-weight: 500; }
.flash { background: var(--green-soft); color: var(--green); }
.err { background: var(--red-soft); color: var(--red); }

/* Pastilles : urgence (u-*), statut (st-*), réception (etat-*) */
.pastille {
  --c: var(--gray); --c-soft: var(--gray-soft);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--c-soft); color: var(--c); font-size: 12px; font-weight: 650; line-height: 1.5; white-space: nowrap;
}
.pastille.point::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pastille.plein { background: var(--c); color: var(--surface); }
.u-retard, .st-bloque, .etat-panne, .urgent { --c: var(--red); --c-soft: var(--red-soft); }
.u-semaine, .etat-retard, .a-decider { --c: var(--amber); --c-soft: var(--amber-soft); }
.u-sans_nouvelles { --c: var(--violet); --c-soft: var(--violet-soft); }
.u-plus_tard, .st-attente_volontaire { --c: var(--gray); --c-soft: var(--gray-soft); }
.st-a_faire { --c: var(--accent-strong); --c-soft: var(--accent-soft); }
.st-attente_retour { --c: var(--teal); --c-soft: var(--teal-soft); }
.st-fait, .etat-ok { --c: var(--green); --c-soft: var(--green-soft); }

/* Tuiles de synthèse du tableau */
.tuiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tuile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink);
  position: relative; overflow: hidden; min-width: 0;
}
.tuile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--gray)); }
.tuile:hover { text-decoration: none; border-color: var(--c, var(--line-strong)); }
.tuile b { font-size: 28px; line-height: 1.1; color: var(--c, var(--ink)); font-variant-numeric: tabular-nums; }
.tuile span { font-size: 13px; color: var(--muted); font-weight: 500; }
.tuile.zero b { color: var(--muted); }

/* Groupes et lignes de sujets */
.groupe { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--c); scroll-margin-top: 80px; }
.groupe:first-child { margin-top: 10px; }
.groupe .compte { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--c-soft); letter-spacing: 0; }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
.ligne:last-child { border-bottom: 0; }
.ligne::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 4px; background: var(--c, transparent); }
.titre-ligne { flex: 1 1 300px; min-width: 0; }
.titre-ligne > a { color: var(--ink); font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 3px; font-size: 13px; color: var(--muted); }
.meta .quand { color: var(--c); font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Menus déroulants (details) : bulle au bureau, feuille du bas au téléphone */
details.choix { position: relative; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details.choix[open] > summary { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-strong); }
.pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; box-shadow: var(--shadow-lg);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: max-content; max-width: 340px;
}
.pop.gauche { left: 0; right: auto; }
.pop .titre-pop { width: 100%; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pop .ligne-pop { display: flex; gap: 8px; width: 100%; }
.pop .ligne-pop input { flex: 1; }
.pop input:not([type=checkbox]) { width: 100%; }
.pop .ligne-pop input { width: auto; }

/* Tableau : en-tête et témoin de réception */
.bonjour { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }

/* Corbeille */
.card.corbeille { padding: 0; overflow: hidden; border-color: var(--amber-soft); }
.corbeille > summary { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--amber-soft); color: var(--amber); font-weight: 650; min-height: var(--tap); }
.corbeille > summary::after { content: "Afficher"; margin-left: auto; font-size: 13px; font-weight: 500; }
.corbeille[open] > summary::after { content: "Masquer"; }
.corbeille-liste { padding: 4px 20px 12px; }
.mail { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.mail:last-child { border-bottom: 0; }
.mail .apercu { grid-column: 1 / -1; min-width: 0; }
.mail .apercu b { font-size: 15px; overflow-wrap: anywhere; }
.mail .extrait { margin-top: 4px; color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
.mail .boutons { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }

/* Pôle : grands dossiers en tuiles */
.dossiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dossier-tuile {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 600; min-width: 0;
}
.dossier-tuile:hover { border-color: var(--accent); text-decoration: none; background: var(--surface); }
.dossier-tuile .ico { color: var(--muted); }
.dossier-tuile span:not(.nb) { min-width: 0; overflow-wrap: anywhere; }
.dossier-tuile .nb { margin-left: auto; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.dossier-tuile.nouveau { border-style: dashed; color: var(--muted); background: transparent; justify-content: center; width: 100%; font: inherit; font-weight: 600; cursor: pointer; }

/* Badge d'initiales d'un pôle (teinte stable par pôle) */
.ini {
  --h: 225;
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: hsl(var(--h) 75% 94%); color: hsl(var(--h) 50% 30%);
  font-size: 11px; font-weight: 750; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center;
}
.ini.grand { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
@media (prefers-color-scheme: dark) {
  :root:not(.theme-clair) .ini { background: hsl(var(--h) 35% 22%); color: hsl(var(--h) 80% 82%); }
}
.theme-sombre .ini { background: hsl(var(--h) 35% 22%); color: hsl(var(--h) 80% 82%); }
.titre-pole { display: flex; align-items: center; gap: 12px; }
.code { font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }

/* Dossier : liste + fiche */
.dossier-grille { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.liste-sujets { display: flex; flex-direction: column; gap: 8px; }
.sujet-carte { display: block; padding: 12px 14px 12px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); position: relative; box-shadow: var(--shadow); }
.sujet-carte::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--c); }
.sujet-carte:hover { text-decoration: none; border-color: var(--line-strong); }
.sujet-carte.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sujet-carte b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.sujet-carte .meta { margin-top: 6px; }
.traite { display: flex; gap: 8px; align-items: center; min-height: 36px; color: var(--muted); font-size: 14px; }
.traite .ico { color: var(--green); }
.fiche { display: flex; flex-direction: column; gap: 20px; }
.chiffres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chiffre { background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.chiffre .muted { font-size: 12px; }
.chiffre b { display: block; font-size: 15px; margin-top: 2px; overflow-wrap: anywhere; }
.colonnes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.section-titre { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.tache { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 10px; border-radius: 10px; cursor: pointer; }
.tache:hover { background: var(--surface-2); }
.tache.faite span { text-decoration: line-through; color: var(--muted); }
.piece { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); min-width: 0; }
.piece span { min-width: 0; overflow-wrap: anywhere; }
.piece:hover { background: var(--surface-2); text-decoration: none; }
.ajout { display: flex; gap: 8px; }
.ajout input { flex: 1; }
.chrono { display: flex; flex-direction: column; gap: 14px; }
.evt { position: relative; padding-left: 20px; }
.evt::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.evt::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: -14px; width: 1px; background: var(--line); }
.evt:last-child::after { display: none; }
.evt .texte { white-space: pre-line; overflow-wrap: anywhere; margin-top: 2px; }
.depliable > summary { display: inline-flex; }
.depliable[open] > summary { margin-bottom: 14px; }

/* Gestion des pôles */
.liste-poles { display: flex; flex-direction: column; }
.pole-ligne { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pole-ligne:last-child { border-bottom: 0; }
.pole-ligne .nom { font-weight: 650; overflow-wrap: anywhere; }
.pole-ligne .outils { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }
.pole-ligne .outils .btn { height: var(--tap); }
.majuscules { text-transform: uppercase; }
.majuscules::placeholder { text-transform: none; }
.pole-ligne .edition { grid-column: 1 / -1; display: none; }
.pole-ligne:has(details[open]) .edition { display: flex; }
.pole-ligne:target { scroll-margin-top: 80px; }
.pole-ligne .outils form { display: contents; }
.panneau { background: var(--surface-2); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.zone-danger { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.zone-danger p { font-size: 13px; color: var(--muted); }

/* Recherche */
.resultat { display: flex; flex-direction: column; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.resultat:last-child { border-bottom: 0; }
.resultat a { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
mark { background: var(--amber-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Connexion */
.connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.connexion form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; padding: 28px; }

/* Mode session */
.session { min-height: 100vh; padding: 20px 16px 40px; display: flex; flex-direction: column; align-items: center; gap: 18px; background: radial-gradient(900px 420px at 50% -10%, #1B2550, transparent 70%), var(--bg); }
.s-col { width: 100%; max-width: 860px; min-width: 0; }
.s-haut { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chips { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: thin; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); display: inline-flex; align-items: center; font-size: 13px; font-weight: 500; }
.chip:hover { text-decoration: none; background: var(--surface-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.progression { height: 6px; border-radius: 999px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.progression div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--violet)); }
.s-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow-lg); }
.s-card h1 { font-size: 30px; line-height: 1.2; overflow-wrap: anywhere; }
.s-notes { color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; color: var(--muted); font-size: 13px; }

/* 5. Petits écrans */
@media (max-width: 960px) {
  .dossier-grille { grid-template-columns: minmax(0, 1fr); }
  .colonnes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { display: block; background: none; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30;
    padding: 8px 12px 8px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .marque { padding: 0; margin-right: auto; }
  .nav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px 16px; }
  .nav > .marque { display: none; }
  .js .nav { display: none; }
  .js.nav-ouverte .nav { display: flex; }
  .main { padding: 16px 16px 48px; gap: 14px; }
  #contenu { gap: 14px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; border-radius: 14px; }
  .card.compacte { padding: 4px 16px; }
  .tuiles { gap: 8px; }
  .tuile { padding: 12px; }
  .tuile b { font-size: 24px; }
  .tuile span { font-size: 12px; line-height: 1.3; }
  .mail { grid-template-columns: minmax(0, 1fr); }
  .grille-form { grid-template-columns: minmax(0, 1fr); }
  .chiffres { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .chiffres .chiffre:last-child { grid-column: 1 / -1; }
  .titre-ligne { flex-basis: 100%; }
  .astuce { display: none; }
  .saisie .btn span { display: none; }
  .s-card { padding: 20px; border-radius: 18px; }
  .s-card h1 { font-size: 24px; }
  .pole-ligne { grid-template-columns: auto minmax(0, 1fr); }
  .pole-ligne .outils { grid-column: 1 / -1; justify-content: flex-start; }
  /* Menus : feuille posée en bas de l'écran */
  .pop, .pop.gauche {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; max-width: none;
    padding: 16px; border-radius: 18px; z-index: 40;
  }
  .pop .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .nav, .topbar, .saisie, .astuce, .actions, details.choix { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; }
}
