/* DA volontairement minimale, en sombre : noir, gris, blanc, police système, aucun effet. */
:root {
  color-scheme: dark;
  --fond: #0f0f0f;
  --texte: #ededed;
  --texte-2: #a6a6a6;
  --texte-3: #6e6e6e;
  --ligne: #262626;
  --gris: #1a1a1a;
  --survol: #d0d0d0;
  --voile: rgba(0, 0, 0, .6);
  --danger: #ff6b6b;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --largeur: 1400px;
  --marge: clamp(16px, 3vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 var(--police);
  overflow-x: hidden;
}
body.bloque { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--texte); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; }

/* ---------- barre ---------- */
.barre { position: sticky; top: 0; z-index: 30; background: var(--fond); border-bottom: 1px solid var(--ligne); }
.barre-interieur {
  max-width: var(--largeur); margin: 0 auto; padding: 12px var(--marge);
  display: flex; align-items: center; gap: 16px;
}
.marque { color: inherit; text-decoration: none; white-space: nowrap; }
.marque strong { font-weight: 600; }
.recherche {
  flex: 1; max-width: 420px; margin-left: auto; height: 36px; padding: 0 10px;
  border: 1px solid var(--ligne); border-radius: 4px; background: var(--fond); outline: none;
}
.recherche:focus { border-color: var(--texte); }
.btn-panier { height: 36px; padding: 0 12px; border: 1px solid var(--texte); border-radius: 4px; background: var(--fond); white-space: nowrap; }
.btn-panier:hover { background: var(--gris); }
#compteur { font-variant-numeric: tabular-nums; }

/* ---------- intro ---------- */
main { max-width: var(--largeur); margin: 0 auto; padding: 0 var(--marge) 48px; }
.intro { padding: 28px 0 12px; }
.intro h1 { margin: 0 0 4px; font-size: 24px; }
.intro p { margin: 0; color: var(--texte-2); max-width: 70ch; }

.vues-session { display: flex; gap: 20px; border-bottom: 1px solid var(--ligne); margin-bottom: 4px; }
.vues-session[hidden], #catalogue-vue[hidden], .planches-vue[hidden], .fiche-vues[hidden] { display: none; }
.vues-session button { padding: 12px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--texte-2); font-weight: 500; }
.vues-session button[aria-current="page"] { color: var(--texte); border-bottom-color: var(--texte); }
.planches-vue { padding-top: 12px; }
.planches-vue > p { margin: 0 0 14px; color: var(--texte-2); font-size: 14px; }
.grille-planches { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.planche-carte { padding: 0; border: 1px solid var(--ligne); background: var(--fond); text-align: left; }
.planche-carte img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--gris); }
.planche-carte span { display: block; padding: 9px 11px; font-size: 14px; font-weight: 500; }
.planche-carte:hover { border-color: var(--texte); }

/* ---------- filtres ---------- */
.filtres {
  position: sticky; top: var(--haut-barre, 61px); z-index: 20;
  margin: 0 calc(var(--marge) * -1); padding: 8px var(--marge) 0;
  background: var(--fond); border-bottom: 1px solid var(--ligne);
}
.segment, .puces { display: flex; flex-wrap: wrap; gap: 0 18px; }
.segment button, .puces button {
  padding: 8px 0; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--texte-2); white-space: nowrap;
}
.segment button { font-weight: 500; }
.segment button:hover, .puces button:hover { color: var(--texte); }
.segment button[aria-checked="true"], .puces button[aria-checked="true"] { color: var(--texte); border-bottom-color: var(--texte); }
.puces button { font-size: 14px; }
.puces button:disabled { color: var(--texte-3); opacity: .5; cursor: default; }
.puces-sous button { font-size: 13px; }
.nb { margin-left: 5px; font-size: 12px; color: var(--texte-3); font-variant-numeric: tabular-nums; }

.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0; }
.resume p { margin: 0; color: var(--texte-2); font-size: 14px; }
.resume strong { color: var(--texte); font-weight: 600; }
.interrupteur { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--texte-2); cursor: pointer; }
.interrupteur input { margin: 0; accent-color: var(--texte); }

/* ---------- grille ---------- */
.grille { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.carte { position: relative; border: 1px solid var(--ligne); background: var(--fond); }
.carte[data-etat="tout"], .carte[data-etat="partiel"] { outline: 2px solid var(--texte); outline-offset: -1px; }
.vignette { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: var(--gris); position: relative; }
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.carte[data-univers="fairytail"] .vignette img { object-fit: contain; }
.vignette.sans-image::after { content: "Aperçu indisponible"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--texte-3); font-size: 13px; }
.coche {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--texte); border-radius: 3px;
  background: var(--fond); color: transparent;
}
.coche svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; }
.coche .moins { display: none; }
.carte[data-etat="tout"] .coche, .carte[data-etat="partiel"] .coche { background: var(--texte); color: var(--fond); }
.carte[data-etat="partiel"] .coche .plein { display: none; }
.carte[data-etat="partiel"] .coche .moins { display: block; }
.legende { padding: 8px 10px 10px; display: flex; flex-direction: column; min-width: 0; }
.legende .nom { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legende .meta { font-size: 12px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.etat-vide { text-align: center; padding: 60px 16px; color: var(--texte-2); }
.etat-vide p { margin: 0 0 12px; }
.chargement { text-align: center; padding: 60px 0; color: var(--texte-3); }
.suite { height: 1px; }
.pied { border-top: 1px solid var(--ligne); color: var(--texte-3); font-size: 13px; text-align: center; padding: 20px var(--marge); }
.pied p { margin: 0; }

/* ---------- boutons ---------- */
.btn { height: 40px; padding: 0 16px; border: 1px solid var(--texte); border-radius: 4px; font-weight: 500; }
.btn-principal { background: var(--texte); color: var(--fond); }
.btn-principal:hover { background: var(--survol); }
.btn-principal:disabled { opacity: .35; cursor: not-allowed; }
.btn-principal.retirer, .btn-fantome { background: var(--fond); color: var(--texte); }
.btn-principal.retirer:hover, .btn-fantome:hover { background: var(--gris); }
.btn-fantome:disabled { opacity: .35; cursor: not-allowed; }
.btn-large { width: 100%; height: 44px; }
.fermer { width: 32px; height: 32px; padding: 0; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--texte-2); flex: none; }
.fermer:hover { color: var(--texte); }

/* ---------- fiche ---------- */
.fiche {
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--ligne); border-radius: 0; background: var(--fond); color: var(--texte); overflow: hidden;
}
.fiche::backdrop { background: var(--voile); }
.fiche-corps { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, 1fr); max-height: calc(100vh - 34px); }
.fiche-visuel { position: relative; background: var(--gris); aspect-ratio: 1; max-height: calc(100vh - 34px); }
.fiche-visuel img { width: 100%; height: 100%; object-fit: contain; }
.fiche-vues { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; background: var(--fond); border: 1px solid var(--ligne); white-space: nowrap; }
.fiche-vues button { border: 0; padding: 7px 10px; background: none; font-size: 12px; }
.fiche-vues button[aria-pressed="true"] { background: var(--texte); color: var(--fond); }

.planche-dialog { width: min(1250px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--ligne); background: var(--fond); color: var(--texte); }
.planche-dialog::backdrop { background: var(--voile); }
.planche-tete, .planche-navigation { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 14px; }
.planche-tete { border-bottom: 1px solid var(--ligne); }
.planche-dialog img { display: block; max-width: 100%; max-height: calc(100vh - 130px); margin: auto; object-fit: contain; }
.planche-navigation { border-top: 1px solid var(--ligne); }
.planche-navigation button { border: 0; background: none; padding: 6px 0; }
.planche-navigation a { color: var(--texte-2); font-size: 13px; text-decoration: underline; text-align: center; }
.planche-navigation button:disabled { opacity: .35; cursor: default; }
.fiche-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--texte); border-radius: 4px; background: var(--fond); font-size: 18px; line-height: 1;
}
.fiche-nav:hover { background: var(--gris); }
.fiche-nav:disabled { visibility: hidden; }
.fiche-prec { left: 12px; }
.fiche-suiv { right: 12px; }
.fiche-infos { position: relative; padding: 24px; display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.fiche-infos .fermer { position: absolute; top: 14px; right: 14px; }
.fiche-meta { margin: 0 40px 4px 0; font-size: 13px; color: var(--texte-3); }
.fiche-infos h2 { margin: 0 40px 0 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.fiche-ref { margin: 4px 0 0; font: 12px var(--mono); color: var(--texte-3); overflow-wrap: anywhere; }
.fiche-aide { margin: 16px 0 8px; font-size: 14px; color: var(--texte-2); }
.pieces { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ligne); }
.pieces[hidden] { display: none; }
.piece { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ligne); cursor: pointer; }
.piece[data-vue="true"] .piece-texte strong { text-decoration: underline; }
.piece img { width: 44px; height: 44px; object-fit: cover; background: var(--gris); }
.piece-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.piece-texte strong { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.piece-texte code { font: 11px var(--mono); color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case { width: 20px; height: 20px; border: 1px solid var(--texte); border-radius: 3px; display: grid; place-items: center; color: transparent; flex: none; }
.case svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; }
.piece[aria-checked="true"] .case { background: var(--texte); color: var(--fond); }
.fiche-actions { margin-top: 16px; display: flex; }
.fiche-actions .btn { flex: 1; height: 44px; }

/* ---------- selection (panneau) ---------- */
.voile { position: fixed; inset: 0; z-index: 40; background: var(--voile); }
.panier {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(420px, 100vw);
  background: var(--fond); border-left: 1px solid var(--ligne);
  display: flex; flex-direction: column; transform: translateX(101%);
}
.panier.ouvert { transform: none; }
.panier-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ligne); }
.panier-tete h2 { margin: 0; font-size: 18px; }
.panier-sous-titre { margin: 2px 0 0; font-size: 13px; color: var(--texte-3); }
.panier-vue { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panier-vue[hidden] { display: none; }
.panier-liste { flex: 1; overflow: auto; padding: 4px 20px 16px; }
.panier-groupe { margin: 16px 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-3); }
.ligne { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--ligne); }
.ligne-ouvrir { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; }
.ligne img { width: 44px; height: 44px; object-fit: cover; background: var(--gris); flex: none; }
.ligne-texte { min-width: 0; display: flex; flex-direction: column; }
.ligne-texte strong { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-texte span { font-size: 12px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-retirer { width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--texte-3); display: grid; place-items: center; flex: none; }
.ligne-retirer:hover { color: var(--danger); }
.ligne-retirer svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.panier-vide { text-align: center; color: var(--texte-3); padding: 48px 16px; font-size: 14px; }
.panier-vide strong { display: block; color: var(--texte); font-weight: 500; margin-bottom: 4px; }
.panier-pied { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--ligne); background: var(--fond); }
.panier-pied .btn-principal { flex: 1; }

.formulaire { display: flex; flex-direction: column; gap: 12px; padding: 14px 20px 0; flex: 1; overflow: auto; }
.formulaire .panier-pied { margin: auto -20px 0; position: sticky; bottom: 0; }
.retour { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--texte-2); font-size: 14px; }
.retour:hover { color: var(--texte); }
.recap { margin: 0; font-size: 14px; color: var(--texte-2); }
.champ { display: flex; flex-direction: column; gap: 4px; }
.champ > span { font-size: 13px; color: var(--texte-2); }
.champ input, .champ textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--ligne); border-radius: 4px; background: var(--fond); outline: none; }
.champ textarea { resize: vertical; min-height: 90px; }
.champ input:focus, .champ textarea:focus { border-color: var(--texte); }
.champ input[aria-invalid="true"] { border-color: var(--danger); }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.erreur { margin: 0; font-size: 14px; color: var(--danger); }
.erreur a, .lien-copier { color: inherit; }
.lien-copier { background: none; border: 0; padding: 0; font-size: inherit; text-decoration: underline; }

.merci { justify-content: center; padding: 24px; gap: 8px; }
.merci h3 { margin: 0; font-size: 20px; }
.merci p { margin: 0; color: var(--texte-2); }
.merci-ref { margin-bottom: 12px !important; }
.merci-ref strong { font-family: var(--mono); font-weight: 500; color: var(--texte); }
.merci .btn { align-self: flex-start; }

/* ---------- message bref ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translateX(-50%);
  padding: 8px 14px; background: var(--texte); color: var(--fond); font-size: 14px;
  max-width: calc(100vw - 32px); text-align: center; visibility: hidden;
}
.toast.visible { visibility: visible; }

/* ---------- petits ecrans ---------- */
@media (max-width: 900px) {
  .fiche { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; }
  .fiche-corps { grid-template-columns: 1fr; max-height: none; height: 100%; overflow-x: hidden; overflow-y: auto; }
  .fiche-visuel { max-height: none; }
  .fiche-infos { overflow: visible; }
}
@media (max-width: 640px) {
  .barre-interieur { flex-wrap: wrap; gap: 10px; }
  .recherche { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .btn-panier { margin-left: auto; }
  .segment, .puces { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .segment::-webkit-scrollbar, .puces::-webkit-scrollbar { display: none; }
  .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* ---------- numero de session ---------- */
body.verrouille .barre, body.verrouille main, body.verrouille .pied { display: none; }
.porte { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.porte[hidden] { display: none; }
.porte-boite { width: min(320px, 100%); display: flex; flex-direction: column; gap: 8px; }
.porte-boite h1 { margin: 0 0 16px; font-size: 20px; }
.porte-boite label { font-size: 13px; color: var(--texte-2); }
.porte-boite input {
  height: 44px; padding: 0 12px; border: 1px solid var(--ligne); border-radius: 4px; background: var(--fond);
  font-size: 18px; letter-spacing: .12em; font-variant-numeric: tabular-nums; outline: none;
}
.porte-boite input:focus { border-color: var(--texte); }
.porte-boite input[aria-invalid="true"] { border-color: var(--danger); }
.porte-boite .btn { margin-top: 4px; height: 44px; }
.lien-session { padding: 0; border: 0; background: none; color: var(--texte-3); font-size: 13px; white-space: nowrap; }
.lien-session:hover { color: var(--texte); text-decoration: underline; }

/* sorts : video dans la fiche, badge sur la carte */
.fiche-visuel video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--gris); }
.fiche-visuel img[hidden], .fiche-visuel video[hidden] { display: none; }
.badge-video { position: absolute; left: 8px; bottom: 8px; padding: 2px 7px; border-radius: 3px; font-size: 11px; line-height: 16px; background: rgba(0, 0, 0, .62); color: #fff; pointer-events: none; }

/* ── Revue des assets (mode revue par session) ─────────────────────────────── */
.btn-revue { height: 36px; padding: 0 12px; border: 1px solid var(--ligne); border-radius: 4px; background: var(--fond); color: var(--texte-2); white-space: nowrap; }
.btn-revue:hover { background: var(--gris); color: var(--texte); }

.revue { width: min(1100px, 96vw); max-width: 96vw; height: min(92vh, 900px); padding: 0; border: 1px solid var(--ligne); border-radius: 6px; background: var(--fond); color: var(--texte); }
.revue::backdrop { background: var(--voile); }
.revue[open] { display: grid; grid-template-rows: auto 1fr auto; }

.revue-entete { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--ligne); }
.revue-progres { font-variant-numeric: tabular-nums; font-weight: 600; }
.revue-compteurs { color: var(--texte-2); font-size: 13px; }
.revue-compteurs .c-v { color: #6bd07a; }
.revue-compteurs .c-x { color: var(--danger); }
.revue-io { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.revue-io .btn { height: 32px; padding: 0 12px; font-size: 13px; }

.revue-corps { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; background: var(--gris); }
.revue-visuel { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.revue-visuel img { max-width: 100%; max-height: 100%; object-fit: contain; }
.revue[data-statut="v"] .revue-corps { box-shadow: inset 0 0 0 3px #6bd07a; }
.revue[data-statut="x"] .revue-corps { box-shadow: inset 0 0 0 3px var(--danger); }
.revue-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 1px solid var(--ligne); border-radius: 50%; background: rgba(15,15,15,.75); color: var(--texte); font-size: 20px; line-height: 1; }
.revue-nav:hover { background: var(--gris); }
.revue-nav:disabled { opacity: .3; cursor: not-allowed; }
.revue-prec { left: 12px; } .revue-suiv { right: 12px; }

.revue-pied { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "info actions" "comm comm"; gap: 10px 16px; padding: 12px 16px; border-top: 1px solid var(--ligne); }
.revue-info { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.revue-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.revue-info code { font-family: var(--mono); font-size: 12px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.revue-actions { grid-area: actions; display: flex; gap: 8px; }
.revue-valide, .revue-invalide { background: var(--fond); }
.revue-valide[aria-pressed="true"] { background: #6bd07a; color: #06210c; border-color: #6bd07a; }
.revue-invalide[aria-pressed="true"] { background: var(--danger); color: #2a0606; border-color: var(--danger); }
.revue-commentaire { grid-area: comm; width: 100%; resize: vertical; min-height: 40px; padding: 8px 10px; border: 1px solid var(--ligne); border-radius: 4px; background: var(--gris); color: var(--texte); font: inherit; }

@media (max-width: 640px) {
  .revue { width: 100vw; max-width: 100vw; height: 100vh; border: 0; border-radius: 0; }
  .revue-pied { grid-template-columns: 1fr; grid-template-areas: "info" "actions" "comm"; }
  .revue-actions .btn { flex: 1; }
}

/* ── Rangement : dossiers (un niveau) et noms personnalisés, par session ───── */
.carte .ranger {
  position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--texte-2); border-radius: 3px;
  background: var(--fond); color: var(--texte-2); opacity: .75;
}
.carte .ranger svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.carte .ranger:hover, .carte .ranger:focus-visible { opacity: 1; color: var(--texte); border-color: var(--texte); }
.carte .ranger[aria-pressed="true"] { opacity: 1; background: var(--texte); color: var(--fond); border-color: var(--texte); }
.legende .origine, .legende .dossiers { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legende .origine { color: var(--texte-3); }
.legende .origine::before { content: "↳ "; }
.legende .dossiers { color: var(--texte-2); }
.fiche-origine { margin: 4px 0 0; font-size: 13px; color: var(--texte-2); overflow-wrap: anywhere; }
.fiche-origine[hidden] { display: none; }
.fiche-actions { gap: 8px; }
.fiche-actions .btn-fantome { flex: 0 0 auto; }

.puces-dossiers { display: flex; align-items: center; gap: 0 18px; flex-wrap: wrap; border-top: 1px solid var(--ligne); }
.puces-dossiers[hidden] { display: none; }
.puces-titre { font-size: 12px; color: var(--texte-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 0; white-space: nowrap; }
#f-dossiers { display: flex; flex-wrap: wrap; gap: 0 18px; min-width: 0; }
.puces .puces-gerer { margin-left: auto; font-size: 13px; color: var(--texte-3); text-decoration: underline; }
.puces .puces-gerer:hover { color: var(--texte); }

.ranger { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--ligne); border-radius: 6px; background: var(--fond); color: var(--texte); }
.ranger::backdrop { background: var(--voile); }
.ranger[open] { display: flex; flex-direction: column; }
.ranger-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--ligne); }
.ranger-titres { min-width: 0; }
.ranger-titres h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.ranger-titres .fiche-meta { margin: 0 0 2px; }
.ranger-corps { padding: 14px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.ranger-origine { margin: -4px 0 0; font-size: 13px; color: var(--texte-2); overflow-wrap: anywhere; }
.ranger-origine code { display: block; font: 12px var(--mono); color: var(--texte-3); }
.champ-titre { margin: 4px 0 0; font-size: 13px; color: var(--texte-2); }
.ranger-dossiers, .dossiers-liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ligne); }
.ranger-dossier { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ligne); cursor: pointer; }
.ranger-dossier input { margin: 0; width: 18px; height: 18px; accent-color: var(--texte); flex: none; }
.ranger-dossier span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranger-vide { padding: 12px 0; color: var(--texte-3); font-size: 14px; border-bottom: 1px solid var(--ligne); }
.ranger-nouveau { display: flex; gap: 8px; }
.ranger-nouveau input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--ligne); border-radius: 4px; background: var(--fond); outline: none; }
.ranger-nouveau input:focus { border-color: var(--texte); }
.ranger-nouveau .btn { height: 36px; }
.ranger-aide { margin: 0; font-size: 12px; color: var(--texte-3); }
.ranger-pied { display: flex; justify-content: space-between; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--ligne); }
.dossiers-liste li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--ligne); }
.dossier-nom { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 4px; background: none; outline: none; }
.dossier-nom:hover { border-color: var(--ligne); }
.dossier-nom:focus { border-color: var(--texte); }
.dossiers-liste .nb { white-space: nowrap; margin: 0; }
.dossiers-liste .btn { height: 30px; padding: 0 10px; font-size: 13px; }
.dossiers-liste .btn.danger { border-color: var(--danger); color: var(--danger); }
@media (max-width: 640px) {
  .ranger { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border: 0; border-radius: 0; }
  .dossiers-liste li { flex-wrap: wrap; }
  .puces .puces-gerer { margin-left: 0; }
}

/* rangement multiple : depuis la selection ou les fiches affichees */
.lien-ranger { padding: 0; border: 0; background: none; font-size: 14px; color: var(--texte-2); text-decoration: underline; white-space: nowrap; }
.lien-ranger:hover { color: var(--texte); }
.lien-ranger[hidden] { display: none; }
.resume { gap: 12px 20px; }
.resume .interrupteur { margin-left: auto; }
.ranger-multi-aide { margin: 0; font-size: 13px; color: var(--texte-2); }
.ranger[data-mode="un"] .ranger-multi-aide { display: none; }
.ranger[data-mode="multi"] .champ, .ranger[data-mode="multi"] .ranger-origine { display: none; }
.ranger-dossier input:indeterminate { opacity: .7; }
.ranger-dossier .nb { font-variant-numeric: tabular-nums; }
