:root {
  --bg: #f6f5f2;  /* gris chaud : fond < colonne < trait < texte secondaire, écarts réguliers */
  --surface: #ffffff;
  --surface-2: #edebe6;
  --ink: #1d1d1b;
  --muted: #6e6b65;
  --line: #dfdcd5;
  --accent: #0f7b6c;
  --accent-ink: #ffffff;
  --accent-soft: #e1f0ed;
  --danger: #a33a2a;
  --warn-bg: #fbf1dc;
  --ok-bg: #e1f0ed;
  --err-bg: #f6e2de;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --pptx: #b8532e;
  --docx: #2c5aa0;
}
:root { color-scheme: light dark; }
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #171716; --surface: #21211f; --surface-2: #2a2a27; --ink: #ecebe7; --muted: #a09e98;
    --line: #3a3a36; --accent: #5cc6b5; --accent-ink: #10201b; --accent-soft: #16332f;
    --danger: #e08a7a; --warn-bg: #3a3122; --ok-bg: #16332f; --err-bg: #3d2622;
    --shadow: none; --pptx: #e08a62; --docx: #86a9e0;
  }
}
:root[data-theme=dark] {
    --bg: #171716; --surface: #21211f; --surface-2: #2a2a27; --ink: #ecebe7; --muted: #a09e98;
    --line: #3a3a36; --accent: #5cc6b5; --accent-ink: #10201b; --accent-soft: #16332f;
    --danger: #e08a7a; --warn-bg: #3a3122; --ok-bg: #16332f; --err-bg: #3d2622;
    --shadow: none; --pptx: #e08a62; --docx: #86a9e0;
  }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Navigation */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand small { font-weight: 400; color: var(--muted); margin-left: .35rem; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; justify-content: flex-end; }
.nav a { padding: .35rem .7rem; border-radius: 6px; color: var(--muted); text-decoration: none; }
.nav a.active, .nav a:hover { background: var(--surface-2); color: var(--ink); }
.who { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--muted); }
.who form { margin: 0; }

main { width: 100%; margin: 0; padding: 1.5rem clamp(16px, 2.2vw, 40px) 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* Éléments */
.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: .45rem .85rem; border-radius: 6px;
  font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: .25rem .55rem; font-size: .8rem; }
.btn-link { border: 0; background: none; color: var(--muted); padding: .1rem .3rem; cursor: pointer; font: inherit; }
.btn-link:hover { color: var(--danger); }
.inline { display: inline; margin: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); font: inherit;
}
input[type=file] { font: inherit; color: var(--muted); }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
.field { margin-bottom: .85rem; }
.field .helptext, .helptext { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.errorlist { color: var(--danger); margin: .25rem 0; padding-left: 1rem; font-size: .85rem; }
.row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .4rem; border-radius: 4px; letter-spacing: .03em; }
.tag-pptx { color: var(--pptx); border: 1px solid currentColor; }
.tag-docx { color: var(--docx); border: 1px solid currentColor; }
.tag-pdf { color: #a3262a; border: 1px solid currentColor; }
.chip { display: inline-block; font-size: .75rem; background: var(--surface-2); padding: .05rem .45rem; border-radius: 99px; margin: .1rem .15rem .1rem 0; font-family: ui-monospace, Menlo, monospace; }


.messages { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.messages li { padding: .6rem .85rem; border-radius: 6px; background: var(--surface-2); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.messages .success { background: var(--ok-bg); }
.messages .warning { background: var(--warn-bg); }
.messages .error { background: var(--err-bg); }

.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Liste des tableaux */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.board-tile { display: block; text-decoration: none; color: inherit; }
.board-tile:hover { border-color: var(--accent); }
.board-tile h2 { margin-bottom: .35rem; }

/* Kanban */
.kanban { display: flex; gap: .85rem; align-items: flex-start; overflow-x: auto; padding-bottom: .5rem; }
.column { background: var(--surface-2); border-radius: var(--radius); width: 290px; flex: 0 0 290px; padding: .6rem; }
.column-head { display: flex; align-items: center; gap: .35rem; margin-bottom: .5rem; }
.column-head input { background: transparent; border: 1px solid transparent; font-weight: 700; padding: .2rem .35rem; }
.column-head input:focus { background: var(--surface); border-color: var(--line); }
.column-count { font-size: .78rem; color: var(--muted); }
.cards { min-height: 48px; display: flex; flex-direction: column; gap: .45rem; border-radius: 6px; padding: 2px; }
.cards.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .55rem .6rem;
  display: flex; gap: .55rem; align-items: flex-start; cursor: grab; box-shadow: var(--shadow);
}
.kcard.dragging { opacity: .45; }
.kcard input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; flex: none; }

.kcard-title { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }

.kcard form { margin: 0; }
.add-card { margin-top: .5rem; display: flex; gap: .35rem; }
.add-card select { font-size: .82rem; padding: .3rem; }
.add-column { flex: 0 0 220px; }

.login { max-width: 360px; margin: 10vh auto; }
.column.file-over { outline: 2px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft); }
.add-card select { flex: 1; min-width: 0; }
.vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem 1rem; }
.var { margin: 0; font-weight: 400; }
.var-name { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .2rem; font-family: ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }

/* En-tête du tableau et menu ⋮ */




.menu { position: relative; }



.menu-list { position: absolute; top: 36px; left: 0; z-index: 20; min-width: 190px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .3rem; }
.menu-list form { margin: 0; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink);
  font: inherit; font-size: .9rem; padding: .45rem .65rem; border-radius: 5px; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.menu-danger { color: var(--danger); }

/* Barre de génération */
.generate-actions { display: flex; gap: .5rem; align-items: center; margin: 0; }
.btn-icon { padding: .45rem .55rem; position: relative; }
.btn-count { font-size: .72rem; font-weight: 700; background: var(--surface-2); border-radius: 99px; padding: 0 .4rem; }


/* Fenêtres */
.dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog-sm { width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(20, 20, 18, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.1rem .5rem; }
.dialog-head h2 { margin: 0; }
.dialog-close { font-size: 1.1rem; }
.dialog-body { padding: .25rem 1.1rem 1rem; max-height: 65vh; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 600; }

/* Aperçu */
.dialog-lg { width: min(1100px, calc(100vw - 32px)); }
.preview-body { max-height: 78vh; background: var(--surface-2); padding: 1rem; }
.preview-page { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: .6rem; }
.preview-docx .preview-page { max-width: 720px; margin-left: auto; margin-right: auto; }
.preview-status { padding: 2rem; text-align: center; color: var(--muted); }
.preview-error { color: var(--danger); font-size: .85rem; }
.preview-pptx .preview-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .6rem; }
.preview-pptx .preview-page { margin: 0; }


/* ===== Tableau plein écran (façon Trello) ===== */
:root { --col-w: clamp(272px, 17vw, 340px); }
body.is-board { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.is-board .topbar { flex: none; }
body.is-board main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: .9rem 0 0; }
body.is-board .messages { flex: none; padding-left: clamp(16px, 2.2vw, 40px); padding-right: clamp(16px, 2.2vw, 40px); }
body.is-board .messages { margin-bottom: .6rem; }



body.is-board .kanban {
  flex: 1; min-height: 0; align-items: flex-start; gap: .75rem;
  overflow-x: auto; overflow-y: hidden;
  padding: 0 clamp(16px, 2.2vw, 40px) .9rem;
  scroll-padding-inline: clamp(16px, 2.2vw, 40px);
}
body.is-board .kanban.is-panning { cursor: grabbing; user-select: none; }
body.is-board .kanban::after { content: ""; flex: 0 0 1px; } /* marge droite en fin de défilement */
body.is-board .column {
  flex: 0 0 var(--col-w); width: var(--col-w); max-height: 100%;
  display: flex; flex-direction: column;
}
body.is-board .column-head, body.is-board .column .add-card { flex: none; }
body.is-board .cards { flex: 0 1 auto; min-height: 48px; overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 2px 2px; }
body.is-board .add-column { flex: 0 0 var(--col-w); }
body.is-board .empty { margin: 0 clamp(16px, 2.2vw, 40px) .75rem; }

/* Barres de défilement discrètes */
body.is-board .kanban, body.is-board .cards { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
body.is-board .kanban::-webkit-scrollbar { height: 12px; }
body.is-board .cards::-webkit-scrollbar { width: 8px; }
body.is-board .kanban::-webkit-scrollbar-thumb, body.is-board .cards::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }

@media (min-width: 2200px) { :root { --col-w: 340px; } }
@media (max-width: 700px) { :root { --col-w: 85vw; }  }


/* ===== En-tête du tableau : sélecteur façon Pipedrive + actions à droite ===== */

.board-switch { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.board-switch-btn {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .55rem;
  padding: .35rem .6rem .35rem .45rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); max-width: min(56vw, 640px);
}
.board-switch-btn::-webkit-details-marker { display: none; }
.board-switch-btn:hover, .board-menu[open] .board-switch-btn { background: var(--surface-2); }
.board-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { flex: none; color: var(--muted); transition: transform .15s; }
.board-menu[open] .caret { transform: rotate(180deg); }
.board-menu-list { top: calc(100% + 6px); min-width: 320px; max-width: 420px; padding: .35rem; }
.board-menu-boards { max-height: 50vh; overflow-y: auto; }
.board-item { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.board-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item.is-current { font-weight: 600; }
.board-item svg { color: var(--accent); flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: .35rem .2rem; }
.menu-accent { color: var(--accent); font-weight: 600; }
.btn-icon { display: inline-flex; align-items: center; gap: .35rem; }



/* ===== Menu utilisateur ===== */
.user-menu { margin-left: .5rem; }
.user-btn { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .5rem;
  padding: .3rem .55rem .3rem .3rem; border-radius: 99px; color: var(--ink); font-size: .92rem; }
.user-btn::-webkit-details-marker { display: none; }
.user-btn:hover, .user-menu[open] .user-btn, .user-btn.active { background: var(--surface-2); }
.user-menu-list { left: auto; right: 0; top: calc(100% + 6px); min-width: 210px; }
a.menu-item { text-decoration: none; }
.menu-item.is-current { font-weight: 600; background: var(--surface-2); }

/* ===== En-tête du tableau : tous les contrôles à la même hauteur ===== */
:root { --head-h: 44px; }
.board-switch-btn { height: var(--head-h); box-sizing: border-box; }








/* ===== Sélecteur de tableau dans la barre du haut ===== */
.topbar .board-switch-btn { height: 38px; padding: .2rem .55rem .2rem .4rem; max-width: min(42vw, 520px); }
.topbar .board-switch-btn .board-name { font-size: 1rem; }
.topbar .board-switch-btn.active { border-color: var(--accent); }

.nav { align-items: center; }

/* ===== Barre d'outils du tableau ===== */
.board-toolbar {
  flex: none; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: 0 clamp(16px, 2.2vw, 40px); margin-bottom: .85rem;
}
.brief {
  flex: 1 1 420px; min-width: 260px; max-width: 900px; display: flex; align-items: center; gap: .6rem;
  height: 48px; padding: 0 1rem; margin: 0; font-weight: 400; cursor: text;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); color: var(--accent);
}
.brief:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.brief-input { flex: 1; border: 0 !important; outline: none; background: transparent !important;
  font-size: 1.05rem; padding: 0 !important; color: var(--ink); height: 100%; }
.brief-input::placeholder { color: var(--muted); }

.toolbar-spacer { flex: 1 1 0; }
.board-toolbar .generate-actions { gap: .5rem; }
.board-toolbar .generate-actions .btn { height: 48px; border-radius: 10px; font-size: 1rem; }
.board-toolbar .btn-icon { padding: 0 .85rem; gap: .45rem; }
.board-toolbar .btn-icon svg { width: 20px; height: 20px; }
.board-toolbar .btn-count { font-size: .82rem; padding: .05rem .5rem; }
.btn-generate { min-width: 260px; justify-content: center; font-size: 1.05rem !important; letter-spacing: .01em;
  box-shadow: 0 2px 8px rgba(47, 93, 80, .3); }
@media (max-width: 1100px) { .btn-generate { min-width: 200px; } .toolbar-spacer { display: none; } }

/* ===== Cartes : hauteur unique, titre seul ===== */
.kcard { height: 48px; flex: none; align-items: center; padding: 0 .5rem 0 .6rem; }
.kcard input[type=checkbox] { margin-top: 0; }
.kcard-title { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font: inherit;
  font-weight: 600; font-size: .92rem; color: var(--ink); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard-title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ===== Fiche brique ===== */

/* Cartes : titre à gauche, case à droite */
.kcard { padding: 0 .65rem 0 .8rem; gap: .6rem; }
.kcard input[type=checkbox] { order: 2; margin: 0; }

/* « Que voulez-vous construire ? » : texte posé sur le fond, même taille que « Générer » */
.brief { background: transparent; border: 0; box-shadow: none; padding: 0 .25rem; border-radius: 0;
  border-bottom: 1px solid transparent; }
.brief:hover { border-bottom-color: var(--line); }
.brief:focus-within { box-shadow: none; border-bottom-color: var(--accent); }
.brief-input { font-size: 1.05rem; font-weight: 600; }
.brief-input::placeholder { font-weight: 600; }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--err-bg); }
.brief input.brief-input { font-size: 1.05rem; font-weight: 600; letter-spacing: .01em; }

/* ===== Recherche / filtre ===== */
.brief { border-bottom: 1px solid var(--line); color: var(--muted); }
.brief:hover { border-bottom-color: var(--muted); }
.brief:focus-within { border-bottom-color: var(--accent); color: var(--accent); }
.brief-clear { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.brief-clear:hover { background: var(--surface-2); color: var(--ink); }
.brief-clear[hidden] { display: none; }
.kcard[hidden] { display: none !important; }
body.is-filtering .brief { border-bottom-color: var(--accent); }

/* ===== Boutons secondaires sur le fond de la page ===== */
.board-toolbar .btn-icon { background: var(--bg); border-color: var(--line); }
.board-toolbar .btn-icon:hover { background: var(--surface-2); }
.board-toolbar .btn-icon .btn-count { background: var(--surface-2); }

/* ===== Pied de colonne : bouton + proéminent, flèche bibliothèque ===== */
.col-foot { flex: none; margin-top: .5rem; }
.split { display: flex; gap: 2px; }
.split-main { flex: 1; margin: 0; }
.btn-add { width: 100%; height: 40px; justify-content: center; gap: .4rem; font-weight: 600; font-size: .95rem;
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); border-radius: 8px; }
.btn-add:hover { background: var(--accent); filter: brightness(1.08); }
.split .split-main .btn-add { border-radius: 8px 0 0 8px; }
.split-caret { width: 40px; padding: 0; border-radius: 0 8px 8px 0; list-style: none; }
.split-menu summary::-webkit-details-marker { display: none; }
.split-menu { position: relative; flex: none; }
.split-menu .menu-list { min-width: 240px; }

/* Aperçu : compteur vert et blanc, œil vert quand des diapositives sont sélectionnées */
.board-toolbar .btn-preview .btn-count { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.board-toolbar .btn-preview.has-slides { color: var(--accent); border-color: var(--accent); }

/* Bouton + seul */
.btn-add svg { flex: none; }

/* Champ de recherche : même rendu que « Générer » */
.brief input.brief-input { font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.brief input.brief-input::placeholder { color: #5f5e59; font-weight: 600; opacity: 1; }
.brief input.brief-input::-webkit-search-cancel-button { display: none; }

/* Poignée de déplacement des colonnes */
.col-grip { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 26px;
  color: var(--muted); cursor: grab; border-radius: 4px; opacity: .55; }
.column:hover .col-grip { opacity: 1; }
.col-grip:hover { background: var(--surface); color: var(--ink); }
.column.col-dragging { opacity: .4; outline: 2px dashed var(--accent); outline-offset: -2px; }

/* Compteur masqué à 0 */
.btn-count[hidden] { display: none; }

/* Menu ⋮ des colonnes */
.col-menu { flex: none; }
.col-menu-btn { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; color: var(--muted); }
.col-menu-btn::-webkit-details-marker { display: none; }
.col-menu-btn:hover, .col-menu[open] .col-menu-btn { background: var(--surface); color: var(--ink); }
.col-menu-list { left: auto; right: 0; top: 32px; min-width: 200px; z-index: 30; }
.menu-disabled { color: var(--muted); cursor: not-allowed; opacity: .6; }

/* Zone de clic élargie autour de la case à cocher (carré transparent de toute la hauteur de la carte) */
.kcard { padding-right: 0; }
.kcard-check { order: 2; flex: none; align-self: stretch; width: 52px; margin: 0 0 0 -.3rem; display: flex;
  align-items: center; justify-content: center; cursor: pointer; border-radius: 0 6px 6px 0; }
.kcard-check:hover { background: var(--accent-soft); }
.kcard-check input[type=checkbox] { margin: 0; pointer-events: none; }

/* Pied de colonne vide (compte utilisateur) : rien à afficher */
.col-foot:not(:has(*)) { display: none; }

/* Barre de défilement d'une colonne : espace réservé, elle ne recouvre jamais les cartes */
body.is-board .cards { scrollbar-gutter: stable; overflow-x: hidden; padding: 2px 6px 2px 2px; }
body.is-board .kcard { width: 100%; min-width: 0; box-sizing: border-box; }

/* Lecture seule (compte utilisateur) */
.column-title { flex: 1; font-weight: 700; padding: .2rem .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban.is-readonly .kcard { cursor: default; }

/* Liste des tableaux : crayon d'édition au survol de chaque ligne */
.board-row { display: flex; align-items: center; border-radius: 5px; }
.board-row .board-item { flex: 1; min-width: 0; }
.board-row:hover { background: var(--surface-2); }
.board-row:hover .board-item { background: transparent; }
.board-edit { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  margin-right: .25rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .12s; }
.board-row:hover .board-edit, .board-edit:focus-visible { opacity: 1; pointer-events: auto; }
.board-edit:hover { background: var(--surface); color: var(--accent); }
@media (hover: none) { .board-edit { opacity: 1; pointer-events: auto; } }

/* Liste des tableaux : la coche et le crayon partagent la même place à droite */
.board-slot { flex: none; position: relative; width: 34px; height: 30px; margin-right: .2rem;
  display: inline-flex; align-items: center; justify-content: center; }
.board-slot .board-check { color: var(--accent); transition: opacity .12s; }
.board-slot .board-edit { position: absolute; inset: 0; width: auto; height: auto; margin: 0; }
.board-row:hover .board-slot .board-check { opacity: 0; }

/* Fenêtre Paramètres : actions du tableau */
.settings-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.settings-actions .btn { gap: .4rem; }

/* ===== Survol de la liste des tableaux, façon Pipedrive ===== */
.board-menu-list { padding: .35rem 0; }
.board-menu-list .menu-sep { margin: .35rem 0; }
.board-menu-list > .menu-item { border-radius: 0; padding-left: .9rem; padding-right: .9rem; }
.board-row { border-radius: 0; }
.board-row .board-item { border-radius: 0; padding-left: .9rem; }
.board-row.is-current { background: transparent; }
.board-row:hover { background: var(--accent); }
.board-row:hover .board-item, .board-row:hover .board-item .board-item-name { color: var(--accent-ink); font-weight: 700; background: transparent; }
.board-row:hover .tag { color: var(--accent-ink); border-color: rgba(255,255,255,.75); }
.board-slot { margin-right: .55rem; width: 28px; height: 26px; }
.board-row:hover .board-slot .board-check { opacity: 0; }
.board-slot .board-edit { inset: 0; border-radius: 6px; background: #fff; color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.board-slot .board-edit:hover { background: #fff; color: var(--accent); }
.board-slot .board-edit svg { width: 15px; height: 15px; }
.board-menu-list > .menu-item:hover { background: var(--surface-2); }
.board-row .board-item, .board-row .board-item.is-current { background: transparent; color: var(--ink); }
.board-row .board-item.is-current { font-weight: 700; }
.board-slot .board-edit { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.board-slot .board-edit svg { flex: none; width: 16px !important; height: 16px !important; }

/* Droits d'accès */







.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }



/* Visibilité du tableau (barre du haut) */


/* Variables */


/* « Votre document est prêt ! » */
.dialog-ready { width: min(820px, calc(100vw - 32px)); position: relative; }
.ready-close { position: absolute; top: .6rem; right: .7rem; z-index: 2; }
.ready-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.6rem; padding: 1.6rem; align-items: center; }






@keyframes spin { to { transform: rotate(360deg); } }
.ready-side { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.ready-side h2 { margin: .2rem 0 0; font-size: 1.5rem; }
.ready-ok { color: var(--accent); }
.ready-file { margin: 0 0 .6rem; word-break: break-all; }
.btn-download { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.05rem; padding: .75rem 1.5rem; margin-top: .3rem; }
@media (max-width: 640px) { .ready-grid { grid-template-columns: 1fr; } }

/* Page Équipe : recherche / ajout par e-mail et onglets façon WhatsApp */
.team { padding-top: 1rem; }
.team-add { display: flex; gap: .5rem; align-items: stretch; margin: 0; }
.team-search { flex: 1; display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 .8rem; background: var(--bg); color: var(--muted); }
.team-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.team-search input { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none;
  font-size: 1rem; padding: .7rem 0; color: var(--ink); }
.team-plus { width: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }







.team-empty { margin: .8rem 0 0; border: 0; }

/* Fenêtre des identifiants */
.cred-row { display: flex; align-items: center; gap: .6rem; margin: .45rem 0; }
.cred-row > span { width: 95px; flex: none; }
.cred-row code { font-size: 1.05rem; padding: .25rem .5rem; background: var(--surface-2); border-radius: 6px; user-select: all; }
.cred-body { width: 100%; box-sizing: border-box; margin-top: .7rem; font: inherit; font-size: .85rem; resize: vertical; }

/* Variables image */





.image-thumb { width: 44px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.image-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }


/* Nouveau tableau : Créer / Importer */
.dialog-import { width: min(560px, calc(100vw - 32px)); }
.dialog-import.is-importing { width: min(980px, calc(100vw - 32px)); }
.seg { display: inline-flex; margin: 0 1.25rem; padding: 3px; background: var(--surface-2); border-radius: 9px; gap: 2px; }
.seg-btn { border: 0; background: none; font: inherit; font-weight: 600; padding: .4rem 1.1rem; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 1.4rem 1rem; text-align: center; color: var(--muted); }
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop p { margin: .4rem 0 .9rem; color: var(--ink); }
.import-choose { margin-top: 1rem; display: grid; gap: .4rem; }
.import-pick { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: .55rem .8rem; }
.import-pick:hover { background: var(--surface-2); }
.import-pick.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
[data-import-recap] { margin-top: 1rem; }
.import-head { display: flex; gap: .8rem; align-items: flex-end; }
.import-cols { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .4rem; max-height: 46vh; align-items: flex-start; }
.import-col { flex: 0 0 210px; background: var(--surface-2); border-radius: 8px; padding: .45rem; max-height: 44vh; overflow-y: auto; }
.import-col-head { font-weight: 700; font-size: .82rem; padding: .15rem .3rem .45rem; }
.import-item { display: flex; align-items: center; gap: .4rem; background: var(--surface); border-radius: 6px; padding: .35rem .45rem; margin-bottom: .3rem; font-size: .85rem; }
.import-item.is-missing { background: #fdecea; color: #8c1d18; }
.import-status { width: 1rem; text-align: center; color: var(--accent); font-weight: 700; }
.import-item.is-missing .import-status { color: #b3261e; }
.import-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-checked { color: var(--accent); }
.import-progress { margin-top: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.import-progress .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.import-progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.import-errors { margin: .9rem 0 0; padding: .55rem .8rem .55rem 1.6rem; background: #fdecea; color: #8c1d18; border-radius: 6px; }

/* Bouton « + » de colonne, discret */
.col-foot .btn-add { background: var(--surface-2); color: var(--accent); border: 1px solid transparent; box-shadow: none; }
.col-foot .btn-add:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); filter: none; }
.split .split-main .btn-add { border-radius: 8px 0 0 8px; }
.col-foot .split-caret { width: 32px; padding: 0; color: var(--muted); }
.split:has(.split-caret) { gap: 1px; }

/* « Votre document est prêt ! » sans aperçu */
.dialog-ready.dialog-ready { width: min(460px, calc(100vw - 32px)); }
.ready-single { grid-template-columns: 1fr; text-align: center; padding: 2rem 1.8rem 1.8rem; }
.ready-single .ready-side { align-items: center; }
.col-foot .btn-add { background: rgba(0, 0, 0, .06); }

/* Bouton « + » : survol en gris plus foncé */
.col-foot .btn-add:hover { background: rgba(0, 0, 0, .13); color: var(--accent); border-color: transparent; }
/* Cadre du nom du tableau en gris léger */
.topbar .board-switch-btn, .topbar .board-switch-btn.active { border-color: var(--line); }
/* Cadenas des tableaux « Admins uniquement » dans la liste */

/* Titres de colonne en majuscules */
/* Survols en gris (liste des tableaux et menu Visibilité) */
.board-row:hover { background: var(--surface-2); }
.board-row:hover .board-item, .board-row:hover .board-item .board-item-name { color: var(--ink); font-weight: inherit; }
.board-row:hover .board-item.is-current .board-item-name { font-weight: 700; }
.board-row:hover .tag { color: inherit; border-color: currentColor; }
.board-row:hover .tag-pptx { color: var(--pptx); } .board-row:hover .tag-docx { color: var(--docx); } .board-row:hover .tag-pdf { color: #a3262a; }
.board-slot .board-edit:hover { color: var(--ink); background: #fff; }

/* Bouton « Générer » : remplissage de gauche à droite pendant le traitement */
.btn-generate { position: relative; overflow: hidden; isolation: isolate; }
.btn-generate::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(255, 255, 255, .28);
  transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.btn-generate.is-loading { cursor: progress; }
.btn-generate.is-loading::before { animation: gen-fill 10s linear forwards; }
.btn-generate.is-done::before { transform: scaleX(1); animation: gen-done .3s ease-out; }
.btn-generate.is-emptying::before { animation: gen-empty .5s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes gen-empty { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* Calée sur les durées mesurées : ~1 s pour un document courant, ~2,5 s pour un tableau complet.
   10 % à 0,3 s (ouverture de la fenêtre Variables), 75 % à 1,3 s, 90 % à 2,8 s, puis vers 95 %. */
@keyframes gen-fill {
  0%   { transform: scaleX(0);   animation-timing-function: ease-out; }
  3%   { transform: scaleX(.10); animation-timing-function: cubic-bezier(.3, .6, .5, 1); }
  13%  { transform: scaleX(.75); animation-timing-function: ease-out; }
  28%  { transform: scaleX(.90); animation-timing-function: ease-out; }
  100% { transform: scaleX(.95); }
}
@keyframes gen-done { from { transform: scaleX(.95); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .btn-generate.is-loading::before { animation-duration: 0s; transform: scaleX(.94); } }

/* Fenêtre de résultat : fondu avec léger agrandissement (« Fade in & Scale ») */
dialog.dialog-ready[open] { animation: modal-in .35s cubic-bezier(.2, .8, .3, 1) .15s both; }
dialog.dialog-ready[open]::backdrop { animation: backdrop-in .35s ease .15s both; }
@keyframes modal-in { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.dialog-ready[open], dialog.dialog-ready[open]::backdrop { animation: none; } }
/* En attente (fenêtre Variables ouverte) : avance et recule un peu autour de son point, comme impatient */
.btn-generate.is-paused::before { animation: gen-wait 1s ease-in-out infinite; }
.btn-generate.is-resumed::before { animation: gen-fill-resume 10s linear forwards; }
@keyframes gen-wait {  /* un pas en arrière, puis un pas en avant (1 %) */
  0%, 100% { transform: scaleX(var(--from, .2)); }
  50% { transform: scaleX(calc(var(--from, .2) - .01)); }
}
/* Après « Valider » : 75 % à 1 s, 90 % à 2,5 s, puis vers 95 %. */
@keyframes gen-fill-resume {
  0%   { transform: scaleX(var(--from, .1)); animation-timing-function: cubic-bezier(.3, .6, .5, 1); }
  10%  { transform: scaleX(.75); animation-timing-function: ease-out; }
  25%  { transform: scaleX(.90); animation-timing-function: ease-out; }
  100% { transform: scaleX(.95); }
}
@media (prefers-reduced-motion: reduce) { .btn-generate.is-paused::before { animation: none; transform: scaleX(var(--from, .2)); } }
.btn-generate.is-paused { cursor: pointer; }

/* Snackbar (bas de l'écran, apparaît de bas en haut) */
.snackbar { position: fixed; left: 50%; bottom: 24px; z-index: 1000; display: flex; align-items: center; gap: 1rem;
  max-width: calc(100vw - 32px); padding: .8rem .9rem .8rem 1.2rem; border-radius: 10px;
  background: #262624; color: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.25); font-size: .95rem;
  transform: translate(-50%, calc(100% + 40px)); opacity: 0; transition: transform .35s cubic-bezier(.2,.8,.3,1), opacity .25s ease; }
.snackbar.is-visible { transform: translate(-50%, 0); opacity: 1; }
.snackbar[hidden] { display: none; }
.snackbar a { color: #9fe0c8; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.snackbar a:hover { color: #c6f2e2; }
.snackbar-close { border: 0; background: none; color: rgba(255,255,255,.7); font-size: 1rem; cursor: pointer; padding: .2rem .4rem; border-radius: 6px; }
.snackbar-close:hover { color: #fff; background: rgba(255,255,255,.12); }
@media (prefers-reduced-motion: reduce) { .snackbar { transition: none; } }

/* Paramètres du tableau : chiffres clés */
.board-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0 0 1rem; }
.board-stats > div { background: var(--surface-2); border-radius: 8px; padding: .55rem .7rem; display: flex; flex-direction: column; gap: .1rem; }
.board-stats strong { font-size: 1.15rem; }
.board-stats span { font-size: .78rem; color: var(--muted); }

/* Corps de colonne : défilement unique (briques libres, sections, répertoires) */
body.is-board .column-body { flex: 0 1 auto; min-height: 48px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding: 2px 6px 2px 2px;
  display: flex; flex-direction: column; gap: .45rem; }
body.is-board .column-body .cards { overflow: visible; flex: none; padding: 2px; scrollbar-gutter: auto; }
body.is-board .column-body > .cards:first-child:not(:has(.kcard)) { min-height: 8px; }

/* Section : intertitre au sein d'une colonne */
.ksection { display: flex; flex-direction: column; gap: .4rem; margin-top: .35rem; }

.ksection-title { flex: 1; min-width: 0; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ksection > .cards:not(:has(.kcard)) { min-height: 34px; }

/* Répertoire : repliable et filtrable */
.kfolder { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }






.kfolder-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }






.kfolder-filter input[type=search] { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; padding: .35rem 0; font-size: .85rem; }
.kgroup-empty { margin: 0; padding: .55rem; border: 1px dashed var(--line); border-radius: 6px; text-align: center; font-size: .8rem; color: var(--muted); }
.cards:has(.kcard) > .kgroup-empty { display: none; }
.cards.drop-target > .kgroup-empty { border-color: var(--accent); color: var(--accent); }
.group-menu .col-menu-btn { width: 26px; height: 26px; }
.ksection[hidden], .kfolder[hidden] { display: none; }
.import-group { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .45rem .2rem .25rem; }
.import-group.import-folder { text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--ink); }
.import-item.is-nested-1 { margin-left: .6rem; } .import-item.is-nested-2 { margin-left: 1.2rem; }

/* Page de connexion (inspirée de la sobriété de Todoist) */
body.is-login { background: var(--surface); }
body.is-login main { max-width: none; padding: 0; }
body.is-login .messages { display: none; }
.auth { max-width: 1080px; margin: 0 auto; padding: 28px 32px 48px; min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; }
.auth-logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.auth-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 72px; align-items: center; padding-top: 24px; }
.auth-form h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 1.6rem; }
.auth-field { position: relative; display: block; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem .45rem; margin: 0 0 .9rem;
  background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.auth-field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.auth-field > span { display: block; font-size: .78rem; font-weight: 600; color: var(--ink); margin-bottom: .1rem; }
.auth-field input { width: 100%; border: 0 !important; outline: none; box-shadow: none !important; background: transparent !important; padding: .15rem 0 !important;
  font-size: 1rem; color: var(--ink); }
.auth-field input::placeholder { color: var(--muted); opacity: .75; }
.auth-field:has(.auth-eye) input { padding-right: 2.4rem !important; }
.auth-eye { position: absolute; right: .55rem; bottom: .45rem; border: 0; background: none; color: var(--muted); cursor: pointer; padding: .25rem; border-radius: 6px; }
.auth-eye:hover, .auth-eye.is-on { color: var(--ink); }
.auth-submit { width: 100%; justify-content: center; padding: .8rem 1rem; font-size: 1rem; border-radius: 10px; margin-top: .3rem; }
.auth-error { margin: 0 0 1rem; padding: .65rem .8rem; border-radius: 8px; background: #fdecea; color: #8c1d18; font-size: .9rem; }
.auth-help { margin: 1.2rem 0 0; font-size: .85rem; color: var(--muted); line-height: 1.45; }
.auth-key { display: inline-block; padding: .4rem .6rem; border-radius: 6px; background: var(--bg-soft, #f4f1ea); font: 600 1rem/1.4 ui-monospace, Consolas, monospace; letter-spacing: .06em; user-select: all; }
.auth-narrow { width: 100%; max-width: 400px; margin: 48px auto 0; }  /* forgot your password: form only */
.auth-ready { margin: 0 0 1rem; padding: .65rem .8rem; border-radius: 8px; background: var(--accent-soft); color: var(--ink); font-size: .9rem; line-height: 1.45; }
.auth-copy { width: 100%; justify-content: center; margin-top: .6rem; border-radius: 10px; }
.auth-art svg { width: 100%; height: auto; max-height: 72vh; display: block; }
@media (max-width: 860px) {
  .auth { padding: 20px 16px 32px; }
  .auth-grid { grid-template-columns: 1fr; gap: 0; align-items: start; padding-top: 40px; }
  .auth-art { display: none; }
}
.snackbar-action { border: 0; background: none; color: #9fe0c8; font: inherit; font-weight: 700; cursor: pointer; padding: .25rem .5rem; border-radius: 6px; }
.snackbar-action:hover { background: rgba(255,255,255,.12); color: #c6f2e2; }
.snackbar-action[hidden] { display: none; }

/* ---- Répertoire : une carte comme une brique, avec une icône liste qui ouvre son panneau ---- */
.kfolder { background: none; border: 0; border-radius: 0; }
.kfolder-card { display: flex; align-items: center; gap: .5rem; height: 48px; box-sizing: border-box; padding: 0 .35rem 0 .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.kfolder.is-open .kfolder-card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kfolder-card.drop-target { border-color: var(--accent); background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: 1px; }

.kfolder-title { flex: 1; min-width: 0; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


.kfolder-open { flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.kfolder-open:hover, .kfolder.is-open .kfolder-open { background: var(--surface-2); color: var(--ink); }
.kfolder.has-hits .kfolder-card { border-color: var(--accent); }
/* Panneau des briques du répertoire, au-dessus des colonnes */
.kfolder-pop { position: fixed; z-index: 50; display: flex; flex-direction: column; gap: .55rem; padding: .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.18); overflow-y: auto; }
.kfolder-pop[hidden] { display: none; }



.kfolder-pop .cards { min-height: 48px; }
.kfolder-pop .kgroup-empty { padding: .9rem .6rem; }
.kfolder-filter { display: flex; align-items: center; gap: .4rem; margin: 0; padding: 0 0 0 .55rem; border: 1px solid var(--line);
  border-radius: 6px; color: var(--muted); background: var(--bg); }

/* ---- Section : barre comme une brique sans case à cocher, repliable (v / >) ---- */
.ksection { gap: .45rem; margin-top: .15rem; }

.ksection-bar { display: flex; align-items: center; gap: .45rem; height: 44px; box-sizing: border-box; padding: 0 .3rem 0 .75rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.ksection-bar.drop-target { border-color: var(--accent); background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: 1px; }
.ksection-title { flex: 1; min-width: 0; border: 0; background: none; padding: 0; font: inherit; font-size: .8rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink); text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ksection-toggle { flex: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.ksection-toggle:hover { background: var(--surface); color: var(--ink); }
.ksection-toggle svg { transition: transform .15s ease; }
.ksection.is-collapsed .ksection-toggle svg { transform: rotate(-90deg); }  /* « v » → « > » */
.ksection-body { display: flex; flex-direction: column; gap: .45rem; padding-left: .6rem; border-left: 2px solid var(--line); margin-left: .35rem; }
.ksection.is-collapsed:not(.is-search-open) .ksection-body { display: none; }
.ksection > .ksection-body > .cards:not(:has(.kcard)):not(:has(.kgroup-empty)) { min-height: 6px; }

/* Glisser-déposer : briques en cours de déplacement et listes ciblées */
.kcard.dragging { opacity: .4; }
.cards.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 6px; }
body.is-board .column-body > .cards:first-child { min-height: 10px; }


.drop-line { position: fixed; z-index: 70; height: 3px; border-radius: 3px; background: var(--accent); pointer-events: none;
  }
.drop-line[hidden] { display: none; }
.column-body.drop-target { background: var(--accent-soft); border-radius: 6px; }
.cards.drop-target { outline: none; }
/* ⋮ des répertoires et sections : visible au survol (plus de place pour le nom) */
.kfolder-card .group-menu, .ksection-bar .group-menu { opacity: 0; transition: opacity .12s; }
.kfolder-card:hover .group-menu, .ksection-bar:hover .group-menu, .group-menu[open], .group-menu:focus-within { opacity: 1; }
@media (hover: none) { .kfolder-card .group-menu, .ksection-bar .group-menu { opacity: 1; } }

/* Répertoire et section sans menu ⋮ ni icône dossier ; pastilles en exposant */
.kfolder-card { padding-left: .8rem; cursor: grab; }
.ksection-bar { cursor: grab; }
.kfolder-open, .ksection-toggle { position: relative; }
.kbadge { position: absolute; top: -2px; right: -4px; min-width: 17px; height: 17px; box-sizing: border-box; padding: 0 4px;
  border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 800; line-height: 17px;
  text-align: center; box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.kbadge[hidden] { display: none; }
.ksection-bar .kbadge { box-shadow: 0 0 0 2px var(--surface-2); }
.ksection:not(.is-collapsed) .ksection-toggle .kbadge { display: none; }  /* section : seulement repliée */

.group-dragging { opacity: .45; }
.group-foot { display: flex; align-items: center; gap: .5rem; }




.org-switch { max-height: 40vh; overflow-y: auto; }
.org-switch .menu-item { display: flex; align-items: center; gap: .35rem; width: 100%; text-align: left; }
.org-check { width: 1em; flex: none; color: var(--green, #16a34a); font-weight: 700; }
/* Titres de colonne, section, répertoire : soulignés au survol comme les briques ; clic → fenêtre d'édition */
.column-title-btn { border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer; min-width: 0; }
.column-title-btn:hover, .ksection-title[data-group-edit]:hover, .kfolder-title[data-group-edit]:hover {
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.group-adds { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.group-adds [hidden] { display: none; }
#dlg-group select option:disabled { color: #9ca3af; }
/* Sections et répertoires mêlés aux briques dans une même liste */
.cards > .ksection, .cards > .kfolder { flex: none; }

/* Messages : pile de snackbars en bas de l'écran */
.snack-stack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1001; display: flex; flex-direction: column-reverse;
  align-items: center; gap: .5rem; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.snack { pointer-events: auto; display: flex; align-items: center; gap: 1rem; max-width: min(720px, calc(100vw - 32px));
  padding: .8rem .9rem .8rem 1.2rem; border-radius: 10px; background: #262624; color: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.25); font-size: .95rem;
  transform: translateY(calc(100% + 40px)); opacity: 0; transition: transform .35s cubic-bezier(.2,.8,.3,1), opacity .25s ease; }
.snack.is-visible { transform: none; opacity: 1; }
.snack-warning { box-shadow: inset 4px 0 0 #e0a43a, 0 8px 28px rgba(0,0,0,.25); }
.snack-error { box-shadow: inset 4px 0 0 #e2674f, 0 8px 28px rgba(0,0,0,.25); }
.snack a { color: #9fe0c8; font-weight: 700; }
body.is-login .snack-stack { display: none; }
.snack-stack[popover] { inset: auto auto 24px 50%; margin: 0; padding: 0; border: 0; background: none; overflow: visible; }
@media (prefers-reduced-motion: reduce) { .snack { transition: none; } }

/* Bouton Tout décocher + menu Sélection (deux étages) */
.sel-tool { display: inline-flex; flex-direction: column; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: visible; flex: none; }
.sel-tool-main { border: 0; background: none; height: 26px; display: flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; border-radius: 10px 10px 0 0; padding: 0 .9rem; }
.sel-tool-main:hover, .sel-tool-more:hover { background: var(--surface-2, #f1efea); }
.sel-menu { position: relative; }
.sel-tool-more { list-style: none; display: flex; align-items: center; justify-content: center; gap: .3rem; height: 22px; padding: 0 .7rem;
  border-top: 1px solid var(--line); font-size: .76rem; font-weight: 700; color: var(--muted); cursor: pointer; border-radius: 0 0 10px 10px; white-space: nowrap; }
.sel-tool-more::-webkit-details-marker { display: none; }
.sel-count { min-width: 1.2em; padding: 0 .3em; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; line-height: 1.35; text-align: center; }
.sel-menu-list { left: 0; right: auto; min-width: 310px; top: calc(100% + 6px); }
.menu-item[disabled] { opacity: .45; cursor: default; }
.menu-hint { margin-left: auto; padding-left: .8rem; font-size: .75rem; color: var(--muted); }
.menu-check { display: inline-block; width: 14px; height: 14px; margin-right: .5rem; border: 1.5px solid var(--muted); border-radius: 3px; vertical-align: -2px; }
.is-on .menu-check { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px #fff; }
[data-multi-toggle] { display: flex; align-items: center; white-space: nowrap; }

/* Briques choisies pour un déplacement groupé */
.kcard.is-picked { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--accent-soft); }
body.is-multi .kcard { cursor: pointer; }

/* Panneau d'un répertoire : filtre + case « tout », sans ligne de titre */
.kfolder-tools { display: flex; align-items: center; gap: .5rem; margin: 0; }  /* écart au-dessus des briques = marge du bas */
.kfolder-tools .kfolder-filter { flex: 1; margin: 0; }
.kfolder-all { flex: none; display: flex; align-items: center; justify-content: center; width: 52px; height: 34px; cursor: pointer; }  /* dans le filtre, au droit des cases des briques */
.kfolder-all input { appearance: none; display: grid; place-content: center; width: 18px; height: 18px; margin: 0; cursor: pointer;
  border: 2px solid var(--muted); border-radius: 4px; background: transparent; }  /* case « tout » : fond transparent */
.kfolder-all input:checked, .kfolder-all input:indeterminate { border-color: var(--accent); background: var(--accent); }
.kfolder-all input:checked::after { content: ""; width: 9px; height: 5px; margin-top: -2px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.kfolder-all input:indeterminate::after { content: ""; width: 8px; height: 2px; background: #fff; }
.kfolder-all input:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.kfolder-filter input[type=search]::-webkit-search-cancel-button { display: none; }
.kfolder-filter .brief-clear { width: 24px; height: 24px; }
/* Briques d'un répertoire : un cran plus petites que celles du tableau (effet de profondeur) */
.kfolder-pop .kcard { height: 40px; padding-left: .65rem; }
.kfolder-pop .kcard-title { font-size: .84rem; }
.kfolder-pop .kcard input[type=checkbox] { width: 16px; height: 16px; }
/* Briques d'un répertoire : un niveau en dessous, à l'échelle du champ de filtrage ; « tout cocher » aligné sur leurs cases */

/* Titre de section : même police et graisse que les briques, sans majuscules forcées */
.ksection-title { text-transform: none !important; letter-spacing: normal !important; font-size: .92rem !important; font-weight: 600 !important; color: var(--ink) !important; }

/* Aperçu : bouton gris (vert au survol), nombre de diapositives / pages en exposant */
.board-toolbar .btn-preview, .board-toolbar .btn-preview.has-slides { position: relative; color: var(--ink); border-color: var(--line); overflow: visible; }
.board-toolbar .btn-preview:hover { color: var(--accent); border-color: var(--accent); }
.board-toolbar .btn-preview .btn-count { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; box-sizing: border-box; padding: 0 .35rem;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg, #f5f3ef); margin: 0; }
.board-toolbar .btn-preview .btn-count[hidden] { display: none; }

/* Recherche principale : loupe verte, soulignement vert quand le champ est actif */
.brief > svg { color: var(--accent); }
.brief:focus-within, body.is-filtering .brief { border-bottom: 2px solid var(--accent); margin-bottom: -1px; }
/* Snackbars colorées selon le type de message */
.snack-warning { background: #7a4d0b; box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.snack-error { background: #8a2a1b; box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.snack-success a, .snack-success .snackbar-action { color: #c6f2e2; }
.snack-warning a, .snack-warning .snackbar-action, .snack-error a, .snack-error .snackbar-action { color: #fff; text-decoration: underline; }

/* Bouton Sélection : même fond que la page */
.sel-tool { background: transparent; }
/* Recherche principale : survol vert (et non noir) */
.brief:hover { border-bottom-color: var(--accent); }
.brief:hover > svg { color: var(--accent); }

/* Logo de l'organisation en haut à gauche */
.brand-logo { height: 22px; max-width: 150px; object-fit: contain; display: block; }
/* Cadre arrondi comme le « A » : fond de la couleur du logo ; logo sur fond blanc → bordure grise */
.brand-logo-frame { display: inline-flex; align-items: center; height: 30px; padding: 0 8px; border-radius: 8px; box-sizing: border-box; }
.brand-logo-frame.is-light { border: 1px solid var(--line); }



/* Effet « gelée » quand le nombre de pages augmente */
@keyframes jelly {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.35, .75); }
  45% { transform: scale(.8, 1.25); }
  60% { transform: scale(1.12, .9); }
  75% { transform: scale(.95, 1.05); }
  100% { transform: scale(1, 1); }
}
.btn-count.is-jelly { animation: jelly .6s ease both; }
@media (prefers-reduced-motion: reduce) { .btn-count.is-jelly { animation: none; } }

/* Icônes de format, discrètes (façon Google Drive) : D bleu (Word), P rouge (PowerPoint), page orange (PDF) */
.ficon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; border-radius: 4px;
  color: #fff; font: 700 11px/1 Inter, system-ui, sans-serif; letter-spacing: 0; border: 0 !important; padding: 0 !important;
  vertical-align: -3px; }
.ficon-sm { width: 15px; height: 15px; font-size: 9.5px; border-radius: 3px; vertical-align: -2px; }
.ficon-docx { background: #4285f4; }
.ficon-pptx { background: #d9472b; }
.ficon-pdf { background: #f29900; }
.ficon svg { display: block; }
.ficon-sm svg { width: 9px; height: 9px; }
.board-row:hover .ficon { color: #fff; }
/* Icônes de format, version discrète : fond blanc, lettre et bordure colorées ; PDF : cadre rouge transparent */
.ficon { background: var(--surface) !important; border: 1.5px solid currentColor !important; }
.ficon-docx { color: #3b78e7; }
.ficon-pptx { color: #d9472b; }
.ficon-pdf { color: #c5221f; background: transparent !important; width: auto; min-width: 26px; padding: 0 3px !important; font-size: 8.5px; letter-spacing: .02em; }
.ficon-sm.ficon-pdf { min-width: 22px; font-size: 7.5px; }
.board-row:hover .ficon-docx { color: #3b78e7; } .board-row:hover .ficon-pptx { color: #d9472b; } .board-row:hover .ficon-pdf { color: #c5221f; }
/* Icônes de format : même cadre pour les trois (extension écrite, bordure fine, fond transparent) */
.ficon-docx, .ficon-pptx, .ficon-pdf { background: transparent !important; width: auto; min-width: 32px; padding: 0 3px !important; font-size: 8.5px; letter-spacing: .02em; }
.ficon-sm.ficon-docx, .ficon-sm.ficon-pptx, .ficon-sm.ficon-pdf { min-width: 28px; font-size: 7.5px; }
.ficon-docx, .ficon-pptx, .ficon-pdf { width: 34px; min-width: 34px; }
.ficon-sm.ficon-docx, .ficon-sm.ficon-pptx, .ficon-sm.ficon-pdf { width: 30px; min-width: 30px; }
/* Icônes de format (version finale) : P (.pptx) et W (.docx) dans un carré à bordure fine ; .pdf : carré rouge plein, page blanche */
.ficon-docx, .ficon-pptx, .ficon-pdf { width: 18px; min-width: 18px; padding: 0 !important; font-size: 11px; letter-spacing: 0; }
.ficon-sm.ficon-docx, .ficon-sm.ficon-pptx, .ficon-sm.ficon-pdf { width: 15px; min-width: 15px; font-size: 9.5px; }
.ficon-pdf { background: #c5221f !important; border-color: #c5221f !important; color: #fff !important; }
.board-row:hover .ficon-pdf { color: #fff; }
.ficon-pdf svg { color: #fff !important; width: 11px; height: 11px; }
.ficon-pdf svg path { stroke: #fff !important; }
.ficon-sm.ficon-pdf svg { width: 9px; height: 9px; }
/* .pdf : même format que P et W (fond transparent, bordure rouge), page rouge à l'intérieur */
.ficon-pdf { background: transparent !important; border-color: #c5221f !important; color: #c5221f !important; }
.ficon-pdf svg { color: #c5221f !important; }
.ficon-pdf svg path { stroke: #c5221f !important; }
.board-row:hover .ficon-pdf { color: #c5221f; }
/* .pdf : pastille texte « PDF », fond transparent, bordure rouge */
.ficon-pdf { width: auto !important; min-width: 26px !important; padding: 0 3px !important; font-size: 8.5px !important; letter-spacing: .02em; }
.ficon-sm.ficon-pdf { min-width: 22px !important; font-size: 7.5px !important; }
/* Listes déroulantes : pastilles texte PPTX / DOCX / PDF, toutes de la même largeur */
.ficon.ficon-pill { width: 34px !important; min-width: 34px !important; padding: 0 !important; height: 16px; font-size: 8px !important; letter-spacing: .03em; border-radius: 4px; }
/* .pdf : « PDF » écrit dans un carré rouge de même taille que P et W */
.ficon-pdf { width: 18px !important; min-width: 18px !important; padding: 0 !important; font-size: 6px !important; letter-spacing: -.01em !important; font-weight: 800; }
.ficon-sm.ficon-pdf { width: 15px !important; min-width: 15px !important; font-size: 5px !important; }

/* Découper une brique */
.split-choice { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .45rem; cursor: pointer; }
.split-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.split-choice input { margin-top: .2rem; accent-color: var(--accent); }
.split-choice > span { display: flex; flex-direction: column; gap: .1rem; }
.split-ranges { margin: .3rem 0 .2rem; padding: .6rem .7rem; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; gap: .45rem; }
.split-ranges[hidden] { display: none; }
.split-quick { display: flex; gap: .6rem; align-items: center; }
.split-row { display: flex; align-items: center; gap: .6rem; }
.split-row label { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
.split-row input { width: 5rem; }
.split-del { color: var(--muted); }
/* Fiche brique : diapositives hors de la plage utilisée */
.preview-page.is-excluded { opacity: .28; filter: grayscale(1); }
.brick-range[hidden] { display: none; }
.brick-range input[type=number] { width: 4.6rem !important; flex: none; }
.brick-range [data-range-total] { white-space: nowrap; }

/* Fenêtre Variables : rendu minimaliste, ordre alphabétique, sections par préfixe (Client.Nom…) */
.vars { display: flex; flex-direction: column; gap: .15rem; }
.vars .var { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: .75rem; padding: .3rem 0; border: 0; background: none; }
.vars .var-name { font-size: .88rem; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: .4rem; min-width: 0; overflow-wrap: anywhere; }
.vars .var input[type=text] { width: 100%; height: 34px; padding: 0 .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font: inherit; font-size: .9rem; }
.vars .var input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }


.var-group { margin: .5rem 0 .2rem; padding-left: .75rem; border-left: 2px solid var(--line); }
.var-group-name { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .1rem; }
.image-field { display: flex; align-items: center; gap: .3rem; height: 34px; padding: 0 .25rem 0 .3rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.image-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.image-field .image-thumb { width: 26px; height: 24px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 4px; overflow: hidden; background: var(--surface-2); border: 0; }
.image-field .image-thumb:empty { display: none; }
.image-field .image-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.image-btn { flex: none; width: 28px; height: 28px; border: 0; border-radius: 5px; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.image-btn:hover { background: var(--surface-2); color: var(--ink); }
.image-btn[hidden] { display: none; }
.vars .var-name { font-family: inherit !important; }
.vars .var { grid-template-columns: 160px 1fr; }
.var-group .var { grid-template-columns: calc(160px - .75rem - 2px) 1fr; }

/* Référentiels (Contact…) : choix unique, champs dépliables (admins) */
.ref-pick { display: flex; align-items: center; gap: .3rem; }
.ref-pick select { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 0 .5rem; font: inherit; font-size: .9rem; }
.ref-pick select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Contact1, Contact2… : une ligne par numéro, « (1) » discret au bout de l'intitulé ; chacune se déplie seule.
   Le nom du groupe n'est écrit que sur la 1re ligne, et sur une ligne dépliée. */
.ref-row-name { display: flex; align-items: center; }
.ref-num { margin-left: auto; padding-right: .6rem; font-size: .78rem; font-weight: 400; color: var(--muted); }
.ref-slot { display: flex; flex-direction: column; gap: .45rem; }
.ref-slot:not(.is-open) .ref-row-group { visibility: hidden; }
.list-io-spacer { flex: none; width: 63px; }
/* Choix dans une liste : bouton à l'allure d'une liste déroulante, panneau flottant (reflists.js) */
.ref-choice { flex: 1; min-width: 0; }
.ref-open { width: 100%; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.ref-open span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-open svg { flex: none; color: var(--muted); }
.ref-open:focus-visible, .ref-open[aria-expanded=true] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick-results [role=option]:focus { outline: none; background: var(--accent-soft); }
/* Libellé de la Fiche : en tête des Champs dépliés, sur fond gris (il nomme la Fiche, il ne va pas dans le document) */
.vars .var-label input[type=text] { background: rgba(0, 0, 0, .06); color: var(--muted); font-style: italic; font-weight: 400; }
.vars .var-label .var-name { color: var(--muted); font-style: italic; font-weight: 400; }
/* Liste d'un Groupe : choix de la même taille que « Choisir… » */
[data-ref-options] [role=option] { font-size: .9rem; }
.ref-save { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; }
.ref-save [hidden] { display: none; }
.ref-add { display: inline-flex; align-items: center; gap: .3rem; }
/* Liste d'un groupe : bouton à deux côtés, télécharger (gauche) / charger (droite) */
.list-io { flex: none; display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.list-io-btn { width: 30px; height: 26px; padding: 0; border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.list-io-btn + .list-io-btn { border-left: 1px solid var(--line); }
.list-io-btn:hover { background: var(--surface-2); color: var(--ink); }
.ref-toggle svg { transition: transform .15s ease; }
.ref-toggle.is-open svg { transform: rotate(180deg); }
.ref-fields { margin: .1rem 0 .3rem; padding: .2rem 0 .2rem .7rem; border-left: 2px dashed var(--line); }
.ref-fields[hidden] { display: none; }
.var-group-ref > .var-group-name { display: none; }

/* Recherche d'images : champ « liste déroulante » + panneau (filtre, onglets, résultats) */
.vars .var[hidden] { display: none; }
[data-pick-field] { position: relative; }
.image-open { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: .55rem; border: 0; background: none;
  padding: 0 .35rem; font: inherit; font-size: .9rem; color: var(--muted); text-align: left; cursor: pointer; }
.image-open:focus-visible { outline: none; }
.image-field:has(.image-open:focus-visible), .image-field:has(.image-open[aria-expanded=true]) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.image-placeholder { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-caret { flex: none; color: var(--muted); }
.image-field .image-caption { display: none; }
.has-image .image-placeholder { display: none; }
.has-image .image-field .image-thumb { width: auto; height: 34px; max-width: 140px; background: none; border-radius: 4px; }
.has-image .image-field .image-thumb img { width: auto; height: 100%; max-width: 140px; object-fit: contain; background: transparent; }
.has-image .image-field .image-caption { display: block; flex: 1; min-width: 0; font-size: .78rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.has-image .image-field [data-image-browse] { display: none; }
.pick-panel { position: fixed; z-index: 1000; display: flex; flex-direction: column; gap: .35rem; padding: .45rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.16); }
.pick-panel[hidden] { display: none; }
.vars .pick-panel input.pick-filter { flex: none; width: 100%; height: 36px; padding: 0 .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font: inherit; font-size: .88rem; }
.vars .pick-panel input.pick-filter:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick-tabs { display: flex; align-items: center; gap: .25rem; }
.pick-tabs[hidden] { display: none; }
.pick-tabs button { border: 0; background: none; font: inherit; font-size: .78rem; font-weight: 600; color: var(--muted); padding: .2rem .6rem; border-radius: 999px; cursor: pointer; }
.pick-tabs button.is-on { background: var(--accent-soft); color: var(--accent); }
.pick-credit { margin-left: auto; font-size: .72rem; color: var(--muted); }
.pick-results { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0; list-style: none; }
.pick-results [role=option] { display: flex; align-items: center; gap: .6rem; padding: .35rem .45rem; border-radius: 6px; cursor: pointer; }
.pick-results [role=option]:hover, .pick-results [aria-selected=true] { background: var(--accent-soft); }
.pick-results [role=option] img { width: 28px; height: 28px; flex: none; object-fit: contain; border-radius: 5px; background: #fff; border: 1px solid var(--line); }
.pick-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-domain { margin-left: auto; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.pick-empty { padding: .45rem .5rem; font-size: .82rem; color: var(--muted); grid-column: 1 / -1; }
.pick-results.is-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; align-content: start; }
.pick-results.is-photos [role=option] { flex-direction: column; align-items: stretch; gap: .15rem; padding: .2rem; }
.pick-results.is-photos [role=option] img { width: 100%; height: 72px; object-fit: cover; border: 0; border-radius: 5px; }
.pick-author { font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fenêtre Variables : champs de la hauteur d'une brique, espacés comme les briques */
.vars { gap: .45rem; }
.vars .var { padding: 0; }
.vars .var input[type=text], .ref-pick select { height: 46px; }
.image-field { height: 46px; padding: 0 .3rem 0 .35rem; }
.var-group { margin: .3rem 0; display: flex; flex-direction: column; gap: .45rem; }
.var-group-name { margin-bottom: -.2rem; }
.ref-fields { display: flex; flex-direction: column; gap: .45rem; }
.ref-fields[hidden] { display: none; }

/* Texte trop long dans un champ image : coupé avec « … » */
.vars .var > * { min-width: 0; }
.image-field { min-width: 0; overflow: hidden; }
.image-open, .image-placeholder, .image-caption { min-width: 0; }

/* Groupes de variables : titre mis en valeur, variables du groupe en retrait */
.var-group { position: relative; padding-left: 1.1rem; border-left: 0; margin: .45rem 0 .2rem; }
.var-group::before { content: ""; position: absolute; left: .3rem; top: 1.55rem; bottom: .15rem; border-left: 2px solid var(--line); border-radius: 2px; }
.var-group-name { margin: 0 0 -.1rem -1.1rem; font-size: .8rem; font-weight: 700; letter-spacing: .05em; color: var(--ink); }
.vars .var-group .var { grid-template-columns: calc(160px - 1.1rem) 1fr; }
.var-group-ref { padding-left: 0; }
.var-group-ref::before { display: none; }
.var-group-ref .ref-fields { margin-left: .3rem; padding-left: .8rem; }
.vars .var-group-ref .ref-fields .var { grid-template-columns: calc(160px - 1.1rem - 2px) 1fr; }
.vars .var-group-ref [data-ref-row] { grid-template-columns: 160px 1fr; }

/* Pas de typologie (image, liste, Excel) ni de marque « à compléter » dans la fenêtre Variables */


/* En-tête de la fenêtre Variables */
.vars-head { align-items: flex-start; gap: .6rem; }
.vars-title { display: flex; align-items: center; gap: .7rem; flex: 1; min-width: 0; }
.vars-icon { flex: none; color: var(--accent); }
.vars-head h2 { font-size: 1.45rem; line-height: 1.2; margin: 0; }
.vars-sub { margin: .15rem 0 0; font-size: .85rem; color: var(--muted); }
.vars-head-btn { flex: none; width: 30px; height: 30px; padding: 0; font-size: 1.1rem; line-height: 1; margin-top: .2rem; }
.vars-head .dialog-close { margin-top: .2rem; }
.var-group-name { display: flex; align-items: center; gap: .6rem; }

/* Noms de groupe : casse d'origine (pas de majuscules forcées) */
.vars .var-group-name { text-transform: none; letter-spacing: 0; font-size: .88rem; font-weight: 600; color: var(--ink); }

/* Groupe Client : d'abord un champ unique (nom + logo Logo.dev), puis les champs du groupe */
.var-group.is-searching { padding-left: 0; }
.var-group.is-searching::before, .var-group.is-searching > :not([data-client-search]) { display: none; }
.vars .var-group.is-searching > .client-search { grid-template-columns: 160px 1fr; }
.vars .client-field input.client-input { flex: 1; min-width: 0; height: 100%; border: 0 !important; box-shadow: none !important; padding: 0 .35rem; background: transparent; font: inherit; font-size: .9rem; }
.client-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.client-field .image-caret { margin-right: .35rem; }
.pick-results .pick-none { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: .2rem; padding-top: .5rem; }
.var-group:not(.is-searching) > [data-client-search] { display: none; }
.vars-head-btn { display: inline-flex; align-items: center; justify-content: center; }
.vars-head-btn svg { display: block; }

/* Image choisie : survol, puis aperçu en grand au clic */
.has-image .image-field .image-thumb { cursor: zoom-in; border-radius: 4px; transition: transform .15s ease, box-shadow .15s ease; }
.has-image .image-field .image-thumb:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--accent); }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1400px); max-height: 92vh; overflow: visible; cursor: zoom-out; }
dialog.lightbox::backdrop { background: rgba(10, 10, 10, .78); }
dialog.lightbox img { display: block; width: min(90vw, 1100px); height: auto; max-height: 84vh; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.45); background: #fff; }
.lightbox-caption { margin: .6rem 0 0; text-align: center; color: #f2f2f2; font-size: .85rem; }
.lightbox-close { position: absolute; top: -.4rem; right: -2.4rem; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 1rem; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.28); }

/* Bouton Variables : même gabarit que Sélection, à sa droite */
.vars-tool { padding: 0; font: inherit; cursor: pointer; }
.sel-tool, .vars-tool { min-width: 104px; }
.vars-tool .sel-count[hidden] { display: none; }
.vars-tool:hover .sel-tool-main, .vars-tool:hover .sel-tool-more { background: var(--surface-2, #f1efea); }

/* Fenêtre Variables : édition (onglets Sélection / Tout le tableau ; ‹ retour à la saisie) ou saisie à la génération (✎) */
.vars-scope { display: inline-flex; margin-top: .35rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vars-scope button { border: 0; background: none; padding: .25rem .75rem; font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; }
.vars-scope button + button { border-left: 1px solid var(--line); }
.vars-scope button[aria-pressed=true] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
#dlg-variables[data-mode=edit] .vars-fill, #dlg-variables[data-mode=edit] .vars-edit,
#dlg-variables[data-mode=fill] .vars-edition, #dlg-variables[data-mode=fill] .vars-scope, #dlg-variables[data-mode=fill] .vars-back,
#dlg-variables:not([data-pending]) .vars-back,
#dlg-variables[data-mode=edit] .vars-done, #dlg-variables[data-mode=edit] .vars-go, #dlg-variables[data-mode=fill] .vars-save,
#dlg-variables[data-mode=fill][data-pending] .vars-done, #dlg-variables[data-mode=fill]:not([data-pending]) .vars-go { display: none; }

/* Édition : + en bas d'une liste de Fiches ; ‹ › pour passer d'une Fiche à l'autre */
.pick-panel .ref-new { flex: none; height: 34px; margin-top: .35rem; }
.ref-step { display: inline-flex; align-self: stretch; }
.ref-step .btn { min-width: 30px; height: 100%; padding: 0 .55rem; font-size: 1.1rem; line-height: 1; }
.ref-step .btn:first-child { border-radius: 6px 0 0 6px; }
.ref-step .btn + .btn { border-radius: 0 6px 6px 0; margin-left: -1px; }

/* Bouton Variables : une seule action, pas de séparation */
.vars-tool .sel-tool-more { border-top: 0; }
/* + en bas d'une liste de Fiches : vert sur gris, comme le + des colonnes */
.pick-panel .ref-new { background: rgba(0, 0, 0, .06); color: var(--accent); border-color: transparent; box-shadow: none; }
.pick-panel .ref-new:hover { background: rgba(0, 0, 0, .13); color: var(--accent); filter: none; }
/* En-tête : de l'air entre titre, sous-titre et onglets */
.vars-sub { margin-top: .3rem; }
.vars-scope { margin-top: .85rem; }
/* Champ Date : texte + calendrier du navigateur */
.date-field { position: relative; display: flex; align-items: center; min-width: 0; }
.date-field input[type=text] { flex: 1; min-width: 0; padding-right: 2.4rem; }
.date-field [data-date-open] { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); }
.date-pick { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
/* Fenêtre Variables : même écart entre deux champs, entre un champ et un groupe, entre deux groupes */
.vars { gap: .8rem; }
.vars > .var-group { margin: 0; }
/* Textes d'attente (Entrer une valeur…, Choisir…, Choisir un logo…) : en gris */
.vars input::placeholder { color: var(--muted); opacity: 1; }
.vars .image-placeholder, .vars .ref-open.is-empty [data-ref-open-label] { color: var(--muted); }

/* Édition : nom d'une variable cliquable (souligné) → panneau « Briques » à droite */
[data-uses-name] { cursor: pointer; text-underline-offset: 2px; }
[data-uses-name]:hover, [data-uses-name]:focus-visible, .is-picked [data-uses-name] { color: var(--accent); text-decoration: underline; }  /* comme le titre d'une brique */
[data-uses-name]:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 3px; }
/* Panneau « Briques » : fenêtre élargie et centrée, variables (60 %) à leur largeur habituelle, hauteur gardée (brickside.js) */
#dlg-variables[open].has-side { width: min(1200px, calc(100vw - 32px)); display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: auto minmax(0, 1fr) auto; }  /* principale 60 %, annexe 40 % */
#dlg-variables.has-side > .dialog-body { max-height: none; }
#dlg-variables.has-side > :not(.vars-side) { grid-column: 1; }
#dlg-variables.has-side > .dialog-foot { border-radius: 0 0 0 12px; }
.vars-side { grid-column: 2; grid-row: 1 / 4; contain: size; overflow-y: auto; border-left: 1px solid var(--line);
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .8rem; }
.vars-side[hidden], .vars-side [hidden] { display: none; }
.vars-side-head { display: flex; align-items: center; gap: .6rem; min-height: 2.2rem; }
.vars-side-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.45rem; line-height: 1.2; overflow-wrap: anywhere; }
.vars-side-head .vars-head-btn { margin-top: 0; }
.vars-crumb { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.vars-side-head h2:has([data-side-crumb]:not([hidden])) .vars-crumb { color: var(--muted); }
.vars-side-head h2:has([data-side-crumb]:not([hidden])) .vars-crumb:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.vars-crumb-sep { color: var(--muted); }
.vars-side .vars-sub { margin: 0 0 .5rem; }
.side-bricks { display: flex; flex-direction: column; gap: .4rem; }
.side-brick { text-align: left; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer; }
.side-brick-on { margin-left: .5rem; color: var(--muted); font-size: .78rem; }
.side-open { align-self: flex-start; margin-top: .6rem; }
.ref-common { margin: .3rem 0 0; color: var(--muted); font-size: .8rem; }
.side-brick:hover, .side-brick:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.side-source { display: flex; flex-direction: column; gap: .8rem; }
.vars-side .viewer-stage { height: min(42vh, 420px); padding: .8rem 2.8rem 2rem; }
.vars-side .brick-sec { border-top: 0; padding-top: 0; }
.side-source .small.muted { margin: 0; }
.side-source form { align-self: stretch; }
@media (max-width: 900px) {  /* écran étroit : le panneau prend la place des variables, ✕ pour y revenir */
  #dlg-variables[open].has-side { grid-template-columns: 1fr; }
  #dlg-variables.has-side > :not(.vars-side) { display: none; }
  #dlg-variables.has-side > .vars-side { grid-column: 1; border-left: 0; contain: none; }
}

/* Fenêtre Brique : aperçu page par page à gauche, réglages rangés par thème à droite */
.dialog-brick { width: min(1180px, calc(100vw - 32px)); }
.dialog-brick, .dialog-preview { position: relative; }
.dialog-close-float { position: absolute; top: .55rem; right: .7rem; z-index: 2; }
.brick-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.4rem; max-height: none; padding-top: 1.1rem; }
.brick-body:not(:has(.brick-side)) { grid-template-columns: minmax(0, 1fr); }  /* Utilisateurs : l'aperçu seul */
.brick-main { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.brick-viewer { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.viewer-stage { position: relative; height: min(58vh, 600px); display: flex; align-items: center; justify-content: center;
  padding: 1rem 3.4rem 2.4rem; background: var(--surface-2); border-radius: 10px; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 4px; box-shadow: 0 2px 12px rgba(0, 0, 0, .14); }
.viewer-stage.is-excluded .viewer-img { opacity: .35; filter: grayscale(1); }
.viewer-stage, .viewer-stage * { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }  /* clic à côté des flèches : rien de surligné */
.viewer-img { -webkit-user-drag: none; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.viewer-nav:hover { color: var(--accent); border-color: var(--accent); }
.viewer-prev { left: .6rem; }
.viewer-next { right: .6rem; }
.viewer-count { position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); padding: .1rem .6rem; border-radius: 99px;
  background: rgba(20, 20, 18, .72); color: #fff; font-size: .78rem; font-variant-numeric: tabular-nums; }
.viewer-off { position: absolute; top: .6rem; left: .6rem; padding: .1rem .55rem; border-radius: 99px; background: var(--warn-bg); font-size: .75rem; }
.viewer-stage [hidden] { display: none; }
.brick-side { display: flex; flex-direction: column; min-width: 0; max-height: calc(min(58vh, 600px) + 8rem); overflow: hidden auto; }
.brick-sec { display: flex; flex-direction: column; gap: .45rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.brick-sec[hidden] { display: none; }
.brick-side > form > .brick-sec:first-of-type, .brick-side > .brick-sec:first-child { border-top: 0; padding-top: 0; }
.brick-sec h3 { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.brick-sec h3 svg { flex: none; color: var(--accent); }
.brick-sec h3 label { margin: 0; font: inherit; color: inherit; }
.brick-sec input[type=text], .brick-sec select { width: 100%; }
.brick-range-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; color: var(--muted); }
.brick-range-row input[type=number] { width: 4.4rem !important; }
.brick-file { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.brick-chosen { margin: 0; font-size: .8rem; color: var(--accent); overflow-wrap: anywhere; }
.brick-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.brick-btns .btn, .brick-foot .btn { display: inline-flex; align-items: center; gap: .35rem; }
.brick-btns [hidden] { display: none; }
.brick-vars { display: flex; flex-wrap: wrap; gap: .25rem; }
.brick-vars .chip { margin: 0; }
.brick-place { display: grid; grid-template-columns: minmax(0, 1fr) 4.2rem auto; gap: .4rem; align-items: center; margin: 0; }
.brick-place input[type=number] { width: 100%; }
.brick-foot { justify-content: space-between; align-items: center; }
.brick-foot form { margin: 0; }
.btn-ghost-danger { background: none; border-color: transparent; color: var(--danger); box-shadow: none; }
.btn-ghost-danger:hover { background: var(--err-bg); border-color: transparent; }
@media (max-width: 800px) {
  .brick-body { grid-template-columns: 1fr; }
  .viewer-stage { height: 45vh; padding: .6rem 2.8rem; }
  .brick-side { max-height: none; }
}
.brick-btns label.btn { margin: 0; font-weight: inherit; }  /* « Remplacer » : même taille que « Télécharger » */
.brick-btns-pair { display: grid; grid-template-columns: 1fr 1fr; }
.brick-btns-pair .btn { justify-content: center; }
.brick-upload { margin: -.25rem 0 0; font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.chip-link { border: 0; font: inherit; font-family: ui-monospace, Menlo, monospace; font-size: .75rem; color: var(--ink); cursor: pointer; }
.chip-link:hover, .chip-link:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
/* Fenêtre Brique (principale, 60 %) + Variables d'un groupe (annexe, 40 %) : collées, de même hauteur, centrées ;
   non modales (toutes deux modifiables, varsmode.js) sur un fond commun ; pas d'ombre de l'annexe sur la Brique */
body.has-pair::before { content: ""; position: fixed; inset: 0; z-index: 1000; background: rgba(20, 20, 18, .45); }
#dlg-brick.is-beside, #dlg-variables.is-beside { --pair: min(1400px, calc(100vw - 32px)); position: fixed; inset: 0; margin-top: auto; margin-bottom: auto; z-index: 1001; }
#dlg-brick.is-beside { width: calc(var(--pair) * .6); margin-left: calc((100vw - var(--pair)) / 2); margin-right: auto; border-radius: 12px 0 0 12px; }
#dlg-brick.is-beside .dialog-foot { border-radius: 0 0 0 12px; }
#dlg-variables.is-beside { width: calc(var(--pair) * .4); margin-left: calc((100vw - var(--pair)) / 2 + var(--pair) * .6); margin-right: auto;
  z-index: 1002; border-left: 0; border-radius: 0 12px 12px 0; clip-path: inset(-80px -80px -80px 0); }
#dlg-variables.is-beside .dialog-foot { border-radius: 0 0 12px 0; }
#dlg-variables[open].is-beside { display: flex; flex-direction: column; }
#dlg-variables.is-beside > .dialog-body { flex: 1; max-height: none; }
.vars-one { display: none; }
#dlg-variables[data-only] .vars-one { display: block; }
#dlg-variables[data-only] .vars-edition, #dlg-variables[data-only] .vars-scope { display: none; }
/* Annexe : « ‹ Variables / groupe », ‹ ou ✕ la referme ; ni icône, ni sous-titre, ni pied (enregistrement par Fiche) */
#dlg-variables:not(.is-beside):not(.is-focus) .vars-annex-close, #dlg-variables:not(.is-beside):not(.is-focus) .vars-group-crumb,
#dlg-variables.is-beside .vars-icon, #dlg-variables.is-beside .vars-one, #dlg-variables.is-beside > .dialog-foot { display: none; }
#dlg-variables.is-beside .vars-head h2 { color: var(--muted); }
#dlg-variables.is-beside [data-vars-only-group] { color: var(--ink); }
#dlg-variables.is-beside .vars-head-btn { margin-top: 0; }
/* Annexe alignée sur la Brique : titre à la même hauteur et de même taille, souligné ; ✕ flottante ; champs de 38 px */
#dlg-variables.is-beside .vars-head { position: relative; padding: 3rem 1.4rem .4rem; border-bottom: 0; }
#dlg-variables.is-beside .vars-title { gap: .5rem; padding-bottom: 2px; border-bottom: 2px solid var(--line); }
#dlg-variables.is-beside .vars-head h2 { font-size: 1.2rem; line-height: 1.3; }
#dlg-variables.is-beside .vars-head-btn { width: 26px; height: 26px; }
#dlg-variables.is-beside .vars-head .dialog-close { position: absolute; top: .55rem; right: .7rem; margin: 0; }
#dlg-variables.is-beside .vars-head + .dialog-body { padding: .6rem 1.4rem 1.1rem; }
#dlg-variables.is-beside .vars .var input[type=text], #dlg-variables.is-beside .image-field, #dlg-variables.is-beside .ref-open { height: 38px; }
@media (max-width: 900px) {  /* écran étroit : l'annexe passe par-dessus la Brique */
  #dlg-brick.is-beside, #dlg-variables.is-beside { width: calc(100vw - 32px); margin: auto; border-radius: 12px; clip-path: none; }
}
/* Aperçu de la sélection : grande visionneuse */
.dialog-preview { width: min(1100px, calc(100vw - 32px)); }
.dialog-preview .preview-body { max-height: none; background: none; padding: 2.4rem 1.1rem 1.1rem; }
.preview-viewer .viewer-stage { height: min(80vh, 860px); }
@media (max-width: 800px) { .preview-viewer .viewer-stage { height: 60vh; } }
.preview-body .preview-error { margin: 0 0 .5rem; }
/* Aucune brique cochée : Aperçu grisé ; fenêtre Variables sur tout le tableau, « Sélection » grisé */
.board-toolbar .btn-preview:disabled, .board-toolbar .btn-preview:disabled:hover { opacity: .45; cursor: default; color: var(--ink); border-color: var(--line); background: var(--bg); }
.board-toolbar .btn-preview:disabled .btn-count { display: none; }
.vars-scope button:disabled { opacity: .45; cursor: default; }
/* Tableau sans variable : comment créer les premières */
.vars-empty { padding: .4rem .2rem; font-size: .88rem; }
.vars-empty-title { margin: 0 0 .5rem; font-weight: 600; }
.vars-empty ol { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .45rem; color: var(--muted); }
.vars-empty .chip { color: var(--ink); }

/* Droits : bouton dans le prolongement du sélecteur, icône selon le public du tableau */
.audience { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; color: var(--muted); }
.audience svg { display: none; }
.audience[data-audience="lock"] .i-lock, .audience[data-audience="admins"] .i-person, .audience[data-audience="users"] .i-people { display: block; }
.rights-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.rights-btn:hover { background: var(--surface-2); }
.rights-btn .audience { color: var(--ink); }
.popin-notice { margin: .6rem 0; padding: .5rem .7rem; border-radius: 8px; background: var(--surface-2); font-size: .9rem; }
.popin-head { min-width: 0; }
.popin-head h2 { display: flex; align-items: center; gap: .4rem; font-size: 1.45rem; line-height: 1.2; overflow-wrap: anywhere; }
.popin-sub { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.popin-sub:empty { display: none; }
.popin-back { flex: none; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.popin-back[hidden] { display: none; }
.popin-back:hover { background: var(--surface-2); }
[data-list-only][hidden] { display: none; }
.right-list { list-style: none; margin: 0; padding: 0; }
.right-row { display: flex; align-items: center; gap: .6rem; min-height: 52px; box-sizing: border-box; padding: 0 .2rem; border-bottom: 1px solid var(--line); }
.right-row[hidden] { display: none; }
.right-row.is-off .right-email { color: var(--muted); }
.right-head { position: sticky; top: 0; z-index: 1; min-height: 32px; background: var(--surface); font-size: .78rem; font-weight: 600; color: var(--muted); }
.right-email { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; }
.right-level, .right-plus { flex: none; width: 112px; box-sizing: border-box; text-align: center; font-size: .85rem; }
.right-count { flex: none; width: 84px; text-align: center; }
.right-level { color: var(--muted); }
.right-head .right-level { font-size: inherit; }
.right-slot, .right-menu { flex: none; width: 30px; }
.popin-tools { padding: .25rem 1.1rem .7rem; }
.popin-link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.popin-link:hover { text-decoration: underline; }
.team-input { position: relative; flex: 1; min-width: 0; display: flex; }
.team-input input { width: 100%; }
.team-ghost { position: absolute; inset: 0; padding: .7rem 0; font-size: 1rem; line-height: normal; white-space: pre; overflow: hidden; pointer-events: none; color: var(--muted); }
.team-ghost span:first-child { visibility: hidden; }
.right-pill { display: inline-block; margin-left: .5rem; padding: .05rem .5rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.right-pill-off { background: var(--surface-2); color: var(--muted); }
.right-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.right-sort:hover { color: var(--ink); }
.right-link { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
.right-link:hover { color: var(--accent); text-decoration: underline; }
.right-plus { height: 32px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 1.1rem; font-weight: 700; line-height: 1; cursor: pointer; }
.right-plus:hover { filter: brightness(.92); }
.right-menu { position: relative; }
.right-menu > summary { list-style: none; cursor: pointer; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.right-menu > summary::-webkit-details-marker { display: none; }
.right-menu > summary:hover { background: var(--surface-2); }
.right-menu .menu-list { left: auto; right: 0; top: calc(100% + 4px); min-width: 210px; }
.team-member-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .8rem; }
.team-member-actions form { margin: 0; }
.team-creds { margin: .6rem 0; padding: .7rem; border: 1px solid var(--line); border-radius: 8px; }
.org-search { padding: .2rem .7rem .35rem; }
.org-search input { width: 100%; box-sizing: border-box; padding: .35rem .5rem; }
.org-switch .menu-item[hidden] { display: none; }
.brick-origin { margin: 0 0 .6rem; padding: .45rem .6rem; border-radius: 8px; background: var(--surface-2); font-size: .85rem; }
.brick-origin[hidden] { display: none; }
.brick-origin p { margin: 0; }
.brick-origin p + p { margin-top: .25rem; }

/* Colonne sans résultat pendant une recherche */
.column[hidden] { display: none !important; }
/* Brique suivie : >> discret, juste à gauche de la case */
.kcard-follow { order: 1; flex: none; margin-right: -.45rem; color: var(--line); }
.kcard-title { order: 0; }
/* Fenêtre « Suivre une brique » */
.follow-help { margin: 0 0 .8rem; }
.follow-filter { margin-bottom: .5rem; }
.follow-filter[hidden] { display: none; }
.follow-list { display: flex; flex-direction: column; gap: .3rem; min-height: 3rem; max-height: 44vh; overflow-y: auto; }
.follow-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.follow-item:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.follow-item:disabled { color: var(--muted); cursor: default; }
.follow-item[hidden] { display: none; }
.follow-item span { flex: none; font-size: .75rem; }
/* Brique cochée hors de l'écran : rond flèche qui fait glisser le tableau jusqu'à elle */
.scroll-to { position: fixed; top: 50%; z-index: 40; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); cursor: pointer; }
.scroll-to:hover { filter: brightness(1.08); }
.scroll-to[hidden] { display: none; }
.scroll-to-right { right: 14px; }
.scroll-to-left { left: 14px; }
/* Menu utilisateur : un rond gris */
.user-btn { width: 36px; height: 36px; justify-content: center; padding: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.user-btn::marker { content: ""; }
.user-btn:hover, .user-menu[open] .user-btn, .user-btn.active { background: var(--line); color: var(--ink); }
.user-who { padding: .4rem .65rem .35rem; font-size: .9rem; }
.user-who span { display: block; color: var(--muted); font-size: .78rem; }

/* Barre du haut : « A » aux couleurs du thème (× logo de l'organisation), puis tableaux et droits, à gauche */
.topbar { gap: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; flex: none; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 1.05rem; letter-spacing: 0; }
.brand-x { color: var(--muted); font-weight: 400; }
.brand .brand-logo { height: 26px; }
/* Croix de fermeture : partout celle du filtre des briques */
.dialog-close, .split-del { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 0; }
.dialog-close:hover, .split-del:hover { background: var(--surface-2); color: var(--ink); }
.snackbar-close, .lightbox-close { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border-radius: 50%; }
.snackbar-link { border: 0; background: none; padding: 0; font: inherit; color: #9fe0c8; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
/* Menu du + : petites icônes */
.menu-icon { display: flex; align-items: center; gap: .55rem; }
.menu-icon svg { flex: none; color: var(--muted); }
/* Répertoire en ordre alphabétique : A–Z discret, du gris de la marque des briques suivies */
.kfolder-az { flex: none; font-size: .62rem; font-weight: 800; letter-spacing: .02em; color: var(--line); border: 1.5px solid var(--line); border-radius: 4px; padding: 0 .2rem; line-height: 1.3; }
/* Variables image dans la fiche : icône à la place des [[ ]] */
.chip-pic { margin-right: .25rem; vertical-align: -1px; color: var(--muted); }
/* Rond flèche : discret, flèche colorée sur fond clair */
.scroll-to { background: var(--surface); color: var(--accent); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.scroll-to:hover { filter: none; border-color: var(--accent); }
/* Bouton Variables : nombre en gris, pastille transparente à bord gris */
.vars-tool .sel-count { background: transparent; color: var(--muted); border: 1px solid var(--line); line-height: 1.25; }
/* Historique en pop-in */
.history-head { margin-bottom: .8rem; }
#dlg-history .dialog-body { max-height: 70vh; }
/* Personnalisation : palette */
.brand-palette { display: flex; flex-wrap: wrap; gap: .5rem; }
.brand-color { margin: 0; cursor: pointer; }
.brand-color input { position: absolute; opacity: 0; pointer-events: none; }
.brand-color span { display: block; width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s; }
.brand-color:hover span { transform: scale(1.08); }
.brand-color input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.brand-color input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 4px; }
/* Briques : nouvelle (vert) ou mise à jour (ambre) depuis moins de 21 jours ouvrés, sur un tableau de plus de 3 mois ; enregistrée à l'instant (fond de sélection) */
.kcard-badge { display: inline-block; width: 7px; height: 7px; margin-right: .4rem; border-radius: 50%; vertical-align: 2px; }
.kcard-badge.is-new { background: #2f9e5b; }  /* vert et ambre fixes : distincts de toute couleur de thème */
.kcard-badge.is-updated { background: #e08e0b; }
.kcard.is-flash, .kfolder-card.is-flash, .ksection-bar.is-flash, .column.is-flash { background: var(--accent-soft); transition: background .4s; }
/* Fenêtre Variables, focus : une variable ou un groupe seul, « ‹ Variables / nom » */
#dlg-variables.is-focus .vars-one, #dlg-variables.is-focus .vars-fill, #dlg-variables.is-focus .vars-edition { display: none; }
#dlg-variables.is-focus .vars-head h2 { color: var(--muted); }
#dlg-variables.is-focus [data-vars-only-group] { color: var(--ink); }
/* Fenêtre d'édition d'une colonne / section / répertoire : couverture */
.group-cover .brick-file { margin: .1rem 0 .4rem; }
.group-cover p.small { margin: 0 0 .3rem; }
/* Croix : icône de taille fixe ; fiche Brique : le panneau de droite commence sous la croix flottante */
.dialog-close svg, .snackbar-close svg, .lightbox-close svg { display: block; flex: none; width: 16px; height: 16px; pointer-events: none; }
.dialog-brick .brick-side { padding-top: 1.9rem; }
/* Fenêtre annexe d'une Brique : noms de variables non cliquables (pas de panneau Briques) */
#dlg-variables.is-beside [data-uses-name] { cursor: default; color: inherit; text-decoration: none; }
/* Couverture : aperçu de sa première page */
.cover-preview { display: block; max-width: 100%; max-height: 150px; margin: .2rem 0 .5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.cover-preview[hidden] { display: none; }
/* En-têtes de colonne : majuscules, demi-gras, alignés à gauche ; menu au survol ; poignée seulement après
   « Déplacer la colonne » (board-groups.js) */
.column-title, .column-title-btn { text-transform: uppercase; letter-spacing: .02em; font-weight: 600; font-size: .9rem; padding-left: .35rem; }
.column-head .col-grip { display: none; }
.column.is-moving .col-grip { display: inline-flex; opacity: 1; color: var(--accent); }
.column.is-moving { outline: 2px dashed var(--accent); outline-offset: -2px; }
.column-head .col-menu { opacity: 0; transition: opacity .12s; }
.column:hover .col-menu, .column-head .col-menu[open], .column-head :focus-visible { opacity: 1; }
@media (hover: none) { .column-head .col-menu { opacity: 1; } }
/* Fiche brique : trois blocs (Contenu, Sur ce tableau, Actions), icônes grises, champs libellés */
.brick-sec h3 { font-size: .9rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink); }
.brick-sec h3 svg { color: var(--muted); }
.brick-field { display: flex; flex-direction: column; gap: .3rem; }
.brick-field + .brick-field { margin-top: .45rem; }
.brick-field[hidden] { display: none; }
.brick-label, .brick-field > label { margin: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.brick-place { display: flex; flex-direction: column; align-items: stretch; gap: .4rem; }
.brick-place select { width: 100%; }
.brick-place-row { display: flex; gap: .4rem; align-items: center; }
.brick-place-row input[type=number] { width: 4.6rem; flex: none; }
.brick-default { font-weight: 400; font-size: .9rem; margin-bottom: .2rem; }
/* A–Z et >> : gris du texte secondaire, en plus léger */
.kcard-follow { color: color-mix(in srgb, var(--muted) 60%, var(--surface)); }
.kfolder-az { color: color-mix(in srgb, var(--muted) 60%, var(--surface)); border-color: color-mix(in srgb, var(--muted) 45%, var(--surface)); }
/* Mobile : Générer en bas d'écran, pleine largeur ; pas de rond flèche */
@media (max-width: 700px) {
  .scroll-to { display: none !important; }
  .board-toolbar .generate-actions { position: fixed; left: 16px; right: 16px; bottom: 12px; z-index: 45; }
  .board-toolbar .generate-actions .btn-generate { flex: 1; min-width: 0; }
  .board-toolbar .generate-actions .btn-preview { background: var(--surface); }
  body.is-board .kanban { padding-bottom: 84px; }
}
/* Mode sombre : surbrillance d'édition moins saturée */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) :is(.kcard, .kfolder-card, .ksection-bar, .column).is-flash { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
}
:root[data-theme=dark] :is(.kcard, .kfolder-card, .ksection-bar, .column).is-flash { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
/* Découpage : aperçu des pages, plages avec leur titre */
#dlg-split.is-pages { width: min(820px, calc(100vw - 32px)); }
.split-thumbs { display: flex; gap: .6rem; overflow-x: auto; padding: 0 0 .5rem; margin: 0 0 .8rem; }
.split-thumbs:empty { display: none; }
.split-thumb { flex: none; width: 132px; margin: 0; }
.split-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 5px; }
.split-thumb figcaption { margin-top: .2rem; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split-thumb figcaption strong { color: var(--ink); }
.split-row .split-title { flex: 1; min-width: 0; }
/* Profil : organisation (Super Admin) */
.profile-org { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.profile-org h3 { margin: 0 0 .2rem; font-size: .95rem; }
.profile-org > p { margin: 0 0 .8rem; }
.field-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.profile-logo { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.profile-logo img { height: 34px; max-width: 140px; object-fit: contain; }
.profile-logo .btn { margin: 0; font-weight: 400; }
/* Retour d'une action : tableau masqué le temps de reprendre sa position */
.is-restoring .kanban { visibility: hidden; }
/* Colonne en déplacement : elle seule se saisit, son contenu ne réagit pas */
.column.is-moving { cursor: grab; }
.column.is-moving * { pointer-events: none; }
/* Pop-in Organisation */
.org-dialog .org-search { padding: 0 0 .6rem; }
.org-dialog .org-switch { max-height: 50vh; }
/* Liste des tableaux : alignée sur le bord droit de son bouton, en haut à droite de l'écran */
.topbar .board-menu-list { left: auto; right: 0; }
/* Déplacement d'une colonne : main ouverte au survol, serrée pendant le déplacement */
body.is-grabbing, body.is-grabbing * { cursor: grabbing !important; user-select: none; }
.column.col-dragging { opacity: .65; }
/* Flèches de bord : nombre de briques cochées hors de l'écran de ce côté */
.scroll-to .scroll-count { top: -5px; right: -5px; }

/* ===== Fiche brique, colonne de droite : titre, document, variables, actions ===== */
.brick-side .brick-title-input { width: 100%; margin: 0 0 .6rem; padding: 0 0 2px !important; border: 0 !important; border-bottom: 2px solid var(--line) !important;
  border-radius: 0 !important; background: none !important; color: var(--ink); font: inherit; font-size: 1.2rem !important; font-weight: 700; line-height: 1.3; }
.brick-side .brick-title-input:hover:not(:disabled) { border-bottom-color: var(--muted) !important; }
.brick-side .brick-title-input:focus { outline: none; border-bottom-color: var(--accent) !important; box-shadow: none !important; }
.brick-side .brick-title-input:disabled { color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; border-bottom-color: transparent !important; }
/* Suivi : icône de lien, texte, bouton vers l'original */
.brick-origin { display: flex; align-items: flex-start; gap: .5rem; flex-wrap: wrap; background: var(--accent-soft); }
.brick-origin > svg { flex: none; margin-top: .1rem; color: var(--accent); }
.brick-origin > div { flex: 1 1 calc(100% - 18px - .5rem); min-width: 0; }
.brick-origin a:not(.btn) { color: var(--accent); font-weight: 600; }
.brick-origin .btn { margin-left: calc(18px + .5rem); background: var(--surface); }
/* Document : nom, poids · auteur · date ; Remplacer… (mis en avant) et Télécharger (icône) */
.brick-doc { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.brick-doc-text { flex: 1 0 100%; min-width: 0; }
.brick-doc .brick-file { font-weight: 600; }
.brick-doc .brick-upload { margin: 0; }
.brick-doc label.btn { flex: 1; justify-content: center; margin: 0; }
.brick-doc a.btn { padding-left: .55rem; padding-right: .55rem; color: var(--muted); }
.btn-accent { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn-accent:hover { background: var(--accent-soft); }
.btn-accent[hidden] { display: none; }
.brick-side .brick-range { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.brick-side .brick-range[hidden] { display: none; }
.brick-side .brick-range label { flex: 1 0 100%; margin: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
/* Variables : nombre, pastilles (images, champs de groupe avec icône), aide repliée */
.brick-count { font-weight: 400; color: var(--muted); }
.brick-none { font-size: .85rem; color: var(--muted); }
.brick-vars .chip-link { background: var(--accent-soft); }
.brick-vars .chip-link .chip-pic { color: var(--accent); }
.vars-howto > summary { width: fit-content; cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 600; }
.vars-howto[open] > summary { margin-bottom: .5rem; }
.vars-howto-body { padding: .6rem .75rem; border-radius: 8px; background: var(--surface-2); font-size: .82rem; }
.vars-howto-body p { margin: 0; }
.vars-howto-body dl { display: grid; gap: .4rem; margin: .5rem 0 0; }
.vars-howto-body dt { margin: 0; }
.vars-howto-body dt code { font-family: ui-monospace, Menlo, monospace; }
.vars-howto-body dd { margin: 0 0 .2rem; color: var(--muted); }
.vars-howto-body dd strong { color: var(--ink); font-weight: 600; }
/* Actions : interrupteur « cochée par défaut », puis boutons ; « Déplacer… » se déplie en place */
.brick-side .brick-default { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 0; font-size: .9rem; font-weight: 400; cursor: pointer; }
.switch { appearance: none; flex: none; position: relative; width: 40px; height: 24px; margin: 0; border-radius: 99px; background: var(--muted); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.brick-move > summary { list-style: none; }
.brick-move > summary::-webkit-details-marker { display: none; }
.brick-move[open] { flex-basis: 100%; }
.brick-move[open] > summary { background: var(--surface-2); }
.brick-move .brick-place { display: grid; grid-template-columns: minmax(0, 1fr) 4.2rem auto; gap: .4rem; align-items: center; margin: .4rem 0 0; }
.brick-move .brick-place label { grid-column: 1 / -1; margin: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.brick-move .brick-place select, .brick-move .brick-place input { width: 100%; }
/* Fenêtre Variables : titre, sous-titre et portée alignés sur la liste, séparés d'elle par un filet */
#dlg-variables:not(.is-beside) .vars-head .vars-icon { display: none; }
#dlg-variables .vars-head { padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
#dlg-variables .vars-head + .dialog-body { padding-top: .9rem; }
#dlg-variables .vars-scope { margin-top: .6rem; }
