/* ═══════════════════════════════════════════════════════════════
   Camina — feuille de style
   Palette (§3.2 de la documentation) : tokens à respecter à la lettre
   ═══════════════════════════════════════════════════════════════ */
:root {
  --papier:        #f3eee2;
  --papier-clair:  #f7f2e8;
  --encre:         #2f3b34;
  --encre-douce:   #5b6b60;
  --foret:         #3f7d52;
  --foret-fonce:   #2f5e3e;
  --ocre:          #c8893d;
  --ocre-clair:    #e0b878;
  --riviere:       #3a7ca5;
  --brique:        #d35438;
  --danger:        #c0533e;
  --vert-doux:     #e4efe7;
  --lignes:        rgba(47,59,52,.13);
  --blanc-carte:   #ffffff;

  --ombre-douce:   0 10px 40px -12px rgba(47,59,52,.25);
  --ombre-legere:  0 4px 18px -6px rgba(47,59,52,.18);
  --rayon:         14px;
  --rayon-modale:  20px;
  --topbar-h:      64px;   /* icône + libellé sous les icônes du header */
  --rail-w:        60px;   /* largeur du rail vertical — #drawer s'y cale */
  --icone:         26px;   /* glyphe de navigation (rail ET barre du haut) */
  --font-ui: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* ─── Couches : une seule échelle, jamais de z-index en dur ailleurs ─── */
  --z-fond-image:   250;   /* entre les tuiles (200) et les traces (400) */
  --z-anno-traits:  590;   /* traits des fiches : SOUS les épingles (markerPane 600) */
  --z-annotations:  620;
  --z-voile-zone:   750;
  --z-controles:    800;   /* contrôles Leaflet — sous les panneaux (voir plus bas) */
  --z-panneau:      900;
  --z-editeur:      950;   /* #theme-editor, #welcome */
  --z-tiroir:       990;
  --z-rail:        1000;
  --z-flyout:      1050;
  --z-selection:   1100;
  --z-barre-flot:  1150;
  --z-popover:     1180;
  --z-liste-pop:   1190;
  --z-topbar:      1200;
  --z-banniere:    1250;
  --z-ecran:       1500;   /* #layout-screen */
  --z-modale:      2000;
  --z-login:       2500;
  --z-dialogue:    3000;
  --z-lightbox:    4000;
  --z-infobulle:   4200;   /* au-dessus de la lightbox */
  --z-toast:       5000;

  /* ─── Encoches et barre d'accueil (viewport-fit=cover dans index.html) ─── */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* Hauteur de l'élément qui possède le bord bas sur mobile (voir body[data-ecran]).
     Tout ce qui est ancré en bas et ne lui appartient pas s'en décale. */
  --bas: 0px;
}

* { box-sizing: border-box; }
html, body { height: 100%; height: 100dvh; margin: 0; }
body {
  font-family: var(--font-ui);
  color: var(--encre);
  background: var(--papier);
  font-weight: 450;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
/* Les zones défilantes ne propagent pas leur inertie au document (rebond iOS) */
.drawer-body, .modal-body, #rail, #lay-rail, #lay-panel, #lay-thumbs,
.rail-flyout, .fb-pop-panel, #login-ecran { overscroll-behavior: contain; }
button { font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--encre); }
[hidden] { display: none !important; }

#app { height: 100%; display: flex; flex-direction: column; }

/* ─── Petites capitales des titres de section (§3.3) ─── */
.section-title {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--encre-douce); font-weight: 600; margin: 18px 0 8px;
}

/* ═══ Barre du haut ═══ */
#topbar, #lay-topbar {
  height: var(--topbar-h); flex: none;
  background: var(--papier-clair);
  border-bottom: 1px solid var(--lignes);
  display: flex; align-items: center; gap: 10px;
  padding: 0 calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  z-index: var(--z-topbar); position: relative;
}
#tb-left, #lay-left   { display: flex; align-items: center; gap: 10px; min-width: 0; }
#tb-center, #lay-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
/* Filet de sécurité : body { overflow: hidden } coupe le débordement au lieu de le
   faire défiler, donc un bouton de trop disparaissait purement. Ici il défile. */
#tb-right, #lay-right {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0; justify-content: flex-end;
  overflow-x: auto; scrollbar-width: none;
}
#tb-right::-webkit-scrollbar, #lay-right::-webkit-scrollbar { display: none; }
/* Sans cela les boutons se compriment jusqu'à écraser leur libellé au lieu de
   déborder — et #tb-right n'aurait jamais rien à faire défiler. */
#tb-left > *, #tb-right > *, #lay-left > *, #lay-right > * { flex: none; }
/* Découpage posé par compacterBarre() — sur mobile seul .btn-lbl est masqué */
.btn-ic { flex: none; }

/* Menu « ⋯ » posé par compacterBarre() (mobile) — display:contents en dehors
   du mobile : les boutons repris restent des boutons de barre normaux. */
.barre-actions { display: contents; }
.barre-actions > .btn { flex: none; }
.btn.menu-toggle { display: none; }

.logo { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 18px; color: var(--foret-fonce); text-decoration: none; flex: none; }
.logo img, .logo svg { height: 30px; }
/* Nom de la page, à droite du logo/Camina : titre (tronqué) + type d'écran atténué */
.page-titre {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 15px; color: var(--encre); overflow: hidden;
}
.pt-titre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.pt-sep { color: var(--encre-douce); flex: none; }
.pt-type { color: var(--encre-douce); white-space: nowrap; flex: none; }

/* Bloc global de la barre du haut (js/entete.js) : fitas, compte, à propos, avis.
   Même glyphe et même pastille que le rail — c'est la même famille de boutons,
   simplement posée en haut à droite de tous les écrans. */
.tb-btn {
  width: auto; min-width: 46px; height: auto; border: none; background: none; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 6px; color: var(--encre); cursor: pointer; position: relative; flex: none;
}
.tb-btn:hover { background: rgba(47,59,52,.07); }
.tb-btn.active { background: var(--vert-doux); color: var(--foret-fonce); }
/* Libellé sous l'icône du header (demande Robin 2026-08-17), comme .rail-lbl */
.tb-lbl {
  font-size: 10px; line-height: 1.1; text-align: center; word-break: break-word;
  max-width: 72px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.chip-carnet {
  display: inline-flex; align-items: center; gap: 7px; max-width: 320px;
  background: var(--blanc-carte); border: 1px solid var(--lignes);
  border-radius: 999px; padding: 4px 14px; font-weight: 600; font-size: 14px;
}
.chip-carnet .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.save-status { font-size: 12px; color: var(--encre-douce); white-space: nowrap; }
.save-status.ok::before { content: "✓ "; color: var(--foret); }

/* ─── Boutons ─── */
.btn {
  border: 1px solid var(--lignes); background: var(--blanc-carte);
  border-radius: 10px; padding: 7px 14px; font-size: 14px; font-weight: 550;
  cursor: pointer; transition: background .15s, transform .05s;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { background: var(--papier-clair); }
.btn:active { transform: translateY(1px); }
.btn.primary  { background: var(--ocre); border-color: var(--ocre); color: #fff; }
.btn.primary:hover { background: #b97c34; }
.btn.cta      { background: var(--brique); border-color: var(--brique); color: #fff; }
.btn.cta:hover { background: #c14a30; }
.btn.danger   { color: var(--danger); }
.btn.danger:hover { background: #f9ece9; }
.btn.ghost    { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(47,59,52,.06); }
.btn.small    { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon     { padding: 7px 9px; }
/* bascule enfoncée (panneau masqué, cadre du carnet isolé…) */
.btn.actif    { background: var(--vert-doux); color: var(--foret-fonce); }
.btn:disabled { opacity: .45; cursor: default; }

/* ═══ Zone principale ═══ */
#main { flex: 1; position: relative; min-height: 0; }
#map  { position: absolute; inset: 0; background: #dfe8dd; }
#map.amb-parchemin .leaflet-tile-pane { filter: sepia(.45) saturate(.8) brightness(1.02); }
#map.amb-encre     .leaflet-tile-pane { filter: grayscale(1) contrast(1.05); }
#map.amb-nuit      .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) brightness(.9) saturate(.7); }
#map.amb-pastel    .leaflet-tile-pane { filter: saturate(.65) brightness(1.06); }

/* ─── Mode embed (?embed=1) : carnet nu dans une iframe tierce ───
   On masque tout le chrome ; #main est flex:1 dans #app (colonne), donc la carte
   remplit d'elle-même l'iframe une fois la barre du haut retirée. Seul survit le
   bouton flottant « Ouvrir dans Camina », posé par js/vizu.js. */
body.embed #topbar,
body.embed #rail,
body.embed #drawer,
body.embed #banner,
body.embed #assistant { display: none !important; }

.cta-embed {
  position: fixed; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r));
  z-index: var(--z-topbar);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--blanc-carte, #fff); color: var(--encre);
  font-size: 13px; font-weight: 600; text-decoration: none;
  box-shadow: var(--ombre-douce, 0 2px 10px rgba(30,38,33,.25));
  border: 1px solid rgba(30,38,33,.12);
}
.cta-embed:hover { background: var(--papier-clair, #f3eee2); }
.cta-embed svg { width: 20px; height: 20px; display: block; }

.leaflet-container { font-family: var(--font-ui); }
.leaflet-control-attribution { background: rgba(247,242,232,.8) !important; color: var(--encre-douce); font-size: 10px; }
/* Leaflet se place en 1000 par défaut, soit au niveau du rail et au-dessus des
   panneaux. On le redescend ici plutôt que d'éditer vendor/leaflet.css, qui doit
   rester vierge. Le décalage --bas lui évite la barre du bas sur mobile. */
.leaflet-top, .leaflet-bottom { z-index: var(--z-controles); }
.leaflet-bottom { bottom: calc(var(--bas) + var(--safe-b)); }
.leaflet-left   { left: var(--safe-l); }
.leaflet-right  { right: var(--safe-r); }

/* ─── Étiquette de carnet sur la Grande carte ─── */
.carnet-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--papier-clair); border: 1px solid var(--lignes);
  border-radius: 999px; padding: 3px 12px 3px 8px;
  font-size: 13px; font-weight: 600; color: var(--encre);
  box-shadow: var(--ombre-legere); cursor: pointer; white-space: nowrap;
  transition: transform .12s;
}
.carnet-label:hover { transform: scale(1.05); }
.carnet-label .ic { font-size: 15px; }
.dimmed .carnet-label:not(.focused) { opacity: .35; }
.carnet-label.focused { outline: 2px solid var(--foret); }
/* En édition de la Grande carte : repère seulement, jamais une cible de clic. */
.carnet-label.discret { opacity: .45; pointer-events: none; }

/* ─── Épingle de souvenir ───
   Forme dessinée en SVG inline par pinIcon (souvenir.js) : fill/stroke viennent
   du thème ou du carnet, le contenu (numéro/picto) est posé au « centre » de la
   forme. drop-shadow (pas box-shadow : l'ombre suit la forme, pas le rectangle). */
.pin-souvenir { position: relative; cursor: pointer; }
.pin-souvenir svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 2px 3px rgba(47, 59, 52, .35)); }
.pin-souvenir .pin-num { position: absolute; transform: translate(-50%, -50%); color: #fff; font-size: 12px; font-weight: 650; }
.pin-souvenir .pin-pic { position: absolute; transform: translate(-50%, -50%); width: 16px; height: 16px; object-fit: contain; }
/* pastille de compte/numéro partagée : branche image de pinIcon, grappes, aperçu E-06 */
.pin-badge {
  position: absolute; bottom: -4px; right: -4px; background: #fff;
  border: 1px solid rgba(47, 59, 52, .25); border-radius: 999px;
  font-size: 10px; font-weight: 650; padding: 0 4px;
}
.pin-grappe {
  width: 34px; height: 34px; border-radius: 50%; background: var(--foret);
  border: 2px solid #fff; color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 650; font-size: 13px; box-shadow: var(--ombre-legere); cursor: pointer;
}

/* ═══ Contenus des tiroirs du rail ═══ */
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.section-title .count {
  background: var(--vert-doux); border-radius: 999px; padding: 1px 8px;
  color: var(--foret-fonce); letter-spacing: 0; font-weight: 600;
}

.search-box { margin-top: 10px; display: grid; gap: 6px; }
.search-box input, .search-box select {
  width: 100%; border: 1px solid var(--lignes); border-radius: 8px;
  padding: 7px 10px; background: var(--blanc-carte);
}

/* accordéon des volets */
.accordion-sec > .acc-head {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: none; padding: 10px 4px 6px; cursor: pointer;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--encre-douce); font-weight: 600;
}
.acc-head .count { margin-left: auto; background: var(--vert-doux); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--foret-fonce); letter-spacing: 0; }
.acc-head .caret { transition: transform .15s; font-size: 9px; }
.accordion-sec.closed .acc-head .caret { transform: rotate(-90deg); }
.accordion-sec.closed .acc-body { display: none; }

/* carte de carnet dans la liste */
.carnet-card {
  background: var(--blanc-carte); border: 1px solid var(--lignes);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.carnet-card:hover { box-shadow: var(--ombre-legere); }
.carnet-card.active { border-color: var(--foret); box-shadow: 0 0 0 1px var(--foret); }
.carnet-card .row1 { display: flex; align-items: flex-start; gap: 8px; }
.carnet-card .ic { font-size: 20px; line-height: 1.25; }
.carnet-card .titre { font-weight: 600; font-size: 14px; flex: 1; }
.carnet-card .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: 12px; color: var(--encre-douce); }
.carnet-card .card-actions { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
/* La Grande carte ouvre la liste : elle n'est pas un carnet parmi les autres. */
.carnet-card.monde {
  border-color: var(--foret); background: var(--papier-clair);
  margin-bottom: 12px;
}
/* Description tenue en DEUX lignes : une description générée par IA remplissait
   toute la carte. Le texte entier reste dans l'infobulle (title). */
.desc-courte {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 5px;
  font-size: 12px; line-height: 1.4; color: var(--encre-douce);
}
/* thème fourni avec Camina : non modifiable, seulement duplicable */
.chip-standard {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  background: var(--vert-doux); color: var(--foret-fonce);
  border-radius: 999px; padding: 1px 7px; flex: none; align-self: center;
}
.pastille-sync { display: inline-flex; align-items: center; gap: 4px; color: var(--ocre); font-weight: 600; }
.pastille-sync::before { content: "●"; font-size: 9px; }

/* ═══ Écran de bienvenue (P-01) ═══ */
#welcome {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: var(--z-editeur); pointer-events: none;
}
#welcome .welcome-card {
  pointer-events: auto; background: var(--papier-clair); border-radius: var(--rayon-modale);
  box-shadow: var(--ombre-douce); border: 1px solid var(--lignes);
  padding: 36px 40px; max-width: 460px; text-align: center;
}
#welcome h1 { font-size: 26px; font-weight: 650; margin: 14px 0 6px; }
#welcome p { color: var(--encre-douce); margin: 0 0 20px; line-height: 1.5; }
#welcome .welcome-btns { display: grid; gap: 10px; }

/* ═══ Bannière de mode ═══ */
/* toujours au premier plan : au-dessus du voile de zone (1080) et du cadre (1100) */
#banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: var(--z-banniere); background: var(--encre); color: var(--papier-clair);
  border-radius: 999px; padding: 8px 10px 8px 18px; font-size: 14px; font-weight: 550;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--ombre-douce);
  max-width: min(92%, 620px);
}
#banner .btn { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
/* indication discrète : l'état de l'outil vit dans le rail, pas dans un bouton */
#banner.hint {
  background: rgba(31,38,34,.82); font-size: 12.5px; font-weight: 500;
  padding: 5px 14px; box-shadow: var(--ombre-legere); pointer-events: none;
}

/* ═══ Hors ligne = ajout seulement ═══ */
/* Bandeau global (posé par entete.js) : visible quand un compte qui synchronise
   perd le réseau. Posé au-dessus des toasts pour ne pas gêner la barre du haut. */
.banniere-reseau {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(70px + var(--bas, 0px) + var(--safe-b, 0px));
  z-index: var(--z-toast); background: var(--brique); color: #fff;
  border-radius: 999px; padding: 7px 16px; font-size: 12.5px; font-weight: 550;
  box-shadow: var(--ombre-douce); max-width: 92vw; text-align: center; pointer-events: none;
}
/* Sous-panneau de design/métadonnées gelé : inerte et estompé. pointer-events:none
   neutralise aussi les contrôles construits paresseusement (popovers). */
.fige-hors-ligne { opacity: .5; pointer-events: none; filter: grayscale(.4); }
/* Note « verrouillé hors ligne » en tête d'un panneau ou d'une fiche gelés. */
.note-fige {
  margin: 0 0 10px; padding: 7px 11px; font-size: 12.5px; line-height: 1.4;
  color: var(--encre); background: rgba(178,102,73,.12);
  border: 1px solid rgba(178,102,73,.3); border-radius: 8px;
}

/* ═══ Rail latéral : les menus de tous les écrans (js/rail.js) ═══ */
#rail, #lay-rail {
  /* Collé au bord gauche, pleine hauteur (demande Robin 2026-08-17) : plus de
     gouttière ni de carte flottante, on récupère la place. Bordure droite seule. */
  position: absolute; top: 0; left: 0; bottom: 0; width: var(--rail-w);
  background: var(--papier-clair); border: 0 solid var(--lignes); border-right-width: 1px;
  border-radius: 0; box-shadow: none; z-index: var(--z-rail);
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; gap: 1px; overflow-y: auto; scrollbar-width: none;
  /* Rail continu, sans dégradé de bord (demande Robin 2026-08-17) : le défilement
     reste possible (l'éditeur aligne une vingtaine d'entrées), simplement sans flou. */
}
#rail::-webkit-scrollbar, #lay-rail::-webkit-scrollbar { display: none; }
/* E-05 : le rail est dans le flux de #lay-body, à gauche du tiroir */
#lay-rail { position: relative; top: auto; left: auto; bottom: auto; flex: none; border-radius: 0; border-width: 0 1px 0 0; box-shadow: none; }
/* Bouton de rail = icône PUIS libellé (demande Robin 2026-08-17) : disposition en
   colonne, hauteur auto, largeur du rail. Les libellés allongent chaque bouton :
   l'éditeur défile davantage (rail overflow-y:auto), ce qui est assumé. */
.rail-btn {
  width: var(--rail-w); height: auto; border: none; background: none; border-radius: 12px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 2px; color: var(--encre); position: relative; flex: none;
}
.rail-btn:hover { background: rgba(47,59,52,.07); }
.rail-btn.active { background: var(--vert-doux); color: var(--foret-fonce); }
.rail-btn svg, .tb-btn svg { width: var(--icone); height: var(--icone); }
/* Libellé sous l'icône : petit, centré, au plus deux lignes (le titre complet
   reste dans data-tip/title au survol). */
.rail-lbl {
  font-size: 10px; line-height: 1.15; text-align: center; word-break: break-word;
  max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rail-sep { width: 32px; border-top: 1px solid var(--lignes); margin: 4px 0; flex: none; }
.rail-spacer { flex: 1; }
/* pastille de compte (demandes de contact reçues, P-12 ; solde de fitas).
   Elle s'ancre sur le BOUTON, pas sur le glyphe : l'anneau de la couleur du
   fond la détache du coin de l'icône, qu'elle mord forcément un peu. */
.rail-badge, .tb-badge {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px;
  border-radius: 999px; background: var(--ocre); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; padding: 0 3px;
  box-shadow: 0 0 0 2px var(--papier-clair);
}

/* tiroir */
#drawer {
  /* collé au rail (désormais à left:0) : largeur du rail + gouttière */
  position: absolute; top: 14px; left: calc(var(--rail-w) + 10px); bottom: 14px; width: 308px;
  background: var(--papier-clair); border: 1px solid var(--lignes);
  border-radius: var(--rayon); box-shadow: var(--ombre-douce); z-index: var(--z-tiroir);
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer-head {
  padding: 14px 16px 10px; border-bottom: 1px solid var(--lignes);
  display: flex; align-items: center; gap: 8px;
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 14px 18px; }

/* ─── Assistant Camina (menu « Discussion ») : panneau latéral autonome ─── */
/* Panneau fixe à droite, SOUS la barre du haut (pour qu'elle reste cliquable et
   rebascule le panneau) et au-dessus de la carte. Pas de voile : on continue
   d'interagir avec la carte à côté. */
#assistant {
  position: fixed; top: calc(var(--topbar-h) + 12px); right: 12px; bottom: 12px;
  width: 360px; max-width: calc(100vw - 24px);
  background: var(--papier-clair); border: 1px solid var(--lignes);
  border-radius: var(--rayon); box-shadow: var(--ombre-douce); z-index: var(--z-tiroir);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in .22s cubic-bezier(.2,.9,.3,1.2);
}
.assistant-fil { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.assistant-msg {
  max-width: 85%; padding: 8px 12px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.assistant-msg.bot { align-self: flex-start; background: var(--vert-doux); color: var(--encre); border-bottom-left-radius: 4px; }
.assistant-msg.moi { align-self: flex-end; background: var(--foret); color: #fff; border-bottom-right-radius: 4px; }
.assistant-typing { opacity: .6; font-size: 18px; letter-spacing: 2px; }
.assistant-saisie {
  display: flex; align-items: flex-end; gap: 6px; padding: 10px;
  border-top: 1px solid var(--lignes); background: var(--papier);
}
.assistant-zone {
  flex: 1; resize: none; max-height: 120px; font: inherit; font-size: 14px; line-height: 1.4;
  border: 1px solid var(--lignes); border-radius: 12px; padding: 8px 10px;
  background: var(--blanc-carte); color: var(--encre);
}
.assistant-envoyer, .assistant-mic {
  flex: none; width: 38px; height: 38px; border: none; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.assistant-envoyer { background: var(--foret); color: #fff; }
.assistant-mic { background: var(--vert-doux); color: var(--encre); }
.assistant-mic.actif { background: var(--brique); color: #fff; }
/* Bouton « Faire un retour au développeur » dans l'en-tête du chat (calqué sur .modal-close). */
.assistant-retour {
  flex: none; border: none; background: none; cursor: pointer; color: var(--encre-douce);
  font-size: 17px; border-radius: 8px; padding: 3px 8px; margin: -4px 2px 0 0;
}
.assistant-retour:hover { background: var(--papier); }

/* Mobile : feuille du bas, comme le reste du langage mobile (cf. #drawer / .modal). */
@media (max-width: 720px) {
  #assistant {
    top: auto; width: auto; max-height: 72dvh;
    left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
    bottom: calc(8px + var(--safe-b));
    border-radius: var(--rayon-modale) var(--rayon-modale) var(--rayon) var(--rayon);
  }
  .assistant-saisie { padding-bottom: calc(10px + var(--safe-b)); }
}

/* formulaires du tiroir */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--encre-douce); margin-bottom: 4px; }
.field input[type=text], .field input[type=date], .field input[type=email], .field input[type=password],
.field input[type=number], .field textarea, .field select {
  width: 100%; border: 1px solid var(--lignes); border-radius: 8px;
  padding: 8px 10px; background: var(--blanc-carte);
}
.field textarea { min-height: 74px; resize: vertical; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--lignes); background: var(--blanc-carte); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; cursor: pointer; font-weight: 550;
}
.chip.active { background: var(--foret-fonce); color: #fff; border-color: var(--foret-fonce); }
.chip.small { padding: 2px 9px; font-size: 12px; }

/* ═══ Contacts et partage (P-12 / P-13) ═══ */
.onglets-compte { margin-bottom: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--lignes); }
.ligne-user { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--papier); }
.avatar-user {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--lignes);
}
.avatar-vide {
  display: flex; align-items: center; justify-content: center;
  background: var(--papier); font-size: 17px;
}
.ligne-user-infos { flex: 1; min-width: 0; }
.ligne-user-pseudo { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-user-ville { font-size: 12px; color: var(--encre-douce); }
.ligne-user-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.liste-vide { margin: 4px 0 8px; font-size: 13px; color: var(--encre-douce); }
.chip-attente { font-size: 12px; color: var(--ocre); font-weight: 600; white-space: nowrap; }
.chip-communs { font-size: 11.5px; color: var(--encre-douce); white-space: nowrap; }
.pastille-role { color: var(--foret); font-weight: 600; white-space: nowrap; }
.lien-partage-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.lien-partage-row input { flex: 1; min-width: 0; font-size: 12px; }

/* Profil public #/u/<pseudo> — plein écran, consultable sans compte */
.profil-ecran {
  position: fixed; inset: 0; height: var(--vh-visible, 100dvh);
  background: var(--papier); z-index: var(--z-modale);
  overflow-y: auto; display: flex; justify-content: center; padding: 24px 16px;
}
.profil-carte {
  background: var(--blanc-carte); border-radius: 20px; border: 1px solid var(--lignes);
  width: 560px; max-width: 100%; height: fit-content;
  padding: 28px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.profil-logo { width: 56px; }
.profil-logo svg { width: 100%; height: auto; }
.profil-photo {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--lignes); font-size: 40px;
  display: flex; align-items: center; justify-content: center;
}
.profil-pseudo { font-size: 22px; margin: 0; }
.profil-ville, .profil-description { margin: 0; color: var(--encre-douce); text-align: center; }
.profil-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-self: stretch; }
@media (max-width: 480px) { .profil-grille { grid-template-columns: 1fr; } }
.profil-grille .carnet-card { cursor: pointer; }

/* ═══ Zone de contenu partagée #ecran (fil, fitas, profil, réseau) ═══ */
/* Cohabite avec la barre du haut et le rail (demande Robin 2026-08-18) : elle
   occupe la zone de contenu (sous la barre, à droite du rail vertical sur
   ordinateur ; au-dessus de la barre du bas sur mobile). */
#ecran {
  position: absolute; inset: 0; z-index: var(--z-editeur);
  background: var(--papier); overflow-y: auto;
}
@media (min-width: 721px) { #ecran { left: var(--rail-w); } }   /* dégage le rail vertical */

/* Écrans « carte centrée » (fitas, profil, réseau) : contenu centré. */
.ecran-centre { display: flex; justify-content: center; padding: 24px 16px calc(24px + var(--bas, 0px)); }
/* Carte de contenu alignée à gauche (profil, réseau) — champs de formulaire pleins. */
.ecran-panneau {
  background: var(--blanc-carte); border: 1px solid var(--lignes); border-radius: 20px;
  width: 560px; max-width: 100%; height: fit-content; padding: 24px 22px;
}

/* ═══ Accueil `#/` : le fil d'actualité (js/accueil-fil.js), rendu dans #ecran ═══ */
/* Sur le fil, #ecran ne défile pas lui-même : chaque colonne gère son défilement. */
body[data-ecran="fil"] #ecran { overflow: hidden; }
.feed-grille { height: 100%; display: flex; flex-direction: column; }   /* mobile : une colonne à la fois */

/* Corps défilant */
/* Colonnes du fil. Mobile : une seule visible à la fois, la bascule « Mes carnets »
   (classe body.montrer-mes-carnets) passe de la communauté à mes carnets. */
.feed-col-carnets, .feed-col-communaute {
  overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px 20px; min-height: 0;
}
.feed-col-communaute { flex: 1; }
.feed-col-carnets { display: none; }
body.montrer-mes-carnets .feed-col-carnets { display: block; flex: 1; }
body.montrer-mes-carnets .feed-col-communaute { display: none; }
.feed-fil-tete { display: flex; align-items: center; gap: 10px; margin: 2px 2px 12px; }
.feed-fil-titre { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-douce); font-weight: 700; flex: 1; }
.feed-filtre {
  border: 1px solid var(--lignes); background: var(--blanc-carte); color: var(--encre);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.feed-filtre:hover { background: var(--vert-doux); }
.feed-filtre.actif { background: var(--foret); color: #fff; border-color: var(--foret); }

/* Liste + carte de publication */
.feed-liste { display: flex; flex-direction: column; gap: 14px; max-width: 640px; margin: 0 auto; }
.feed-repli-note {
  margin: 0 2px 2px; font-size: 13px; line-height: 1.45; color: var(--encre-douce);
}
/* Colonne « mes carnets » : statut de publication + bouton publier */
.feed-mien-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  border-top: 1px solid var(--lignes); padding-top: 8px;
}
.feed-statut {
  flex: 1; text-align: left; cursor: pointer; border-radius: 999px; padding: 5px 11px;
  font-size: 12px; font-weight: 600; color: var(--encre-douce);
  background: var(--papier); border: 1px solid var(--lignes);
}
.feed-statut.publie { background: var(--vert-doux); color: var(--foret-fonce); border-color: transparent; }
/* Vignette de carnet (page Carnets, home.js) : capture de la zone d'édition */
.carnet-vignette {
  border-radius: 8px; overflow: hidden; border: 1px solid var(--lignes);
  margin-bottom: 8px; aspect-ratio: 4 / 3; background: var(--vert-doux);
}
.carnet-vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Choix de portée dans la modale Partager */
.portee-choix { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-carte {
  background: var(--blanc-carte); border: 1px solid var(--lignes); border-radius: var(--rayon);
  box-shadow: var(--ombre-legere); padding: 12px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.feed-carte:hover { border-color: rgba(47,59,52,.25); }
.feed-auteur { display: flex; align-items: center; gap: 10px; }
.feed-auteur-infos { display: flex; flex-direction: column; line-height: 1.2; }
.feed-auteur-nom { font-weight: 650; font-size: 14px; }
.feed-auteur-sous { font-size: 12px; color: var(--encre-douce); }
.feed-titre-ligne { display: flex; align-items: center; gap: 8px; }
.feed-titre { font-size: 17px; font-weight: 650; }
.feed-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 13px; color: var(--encre-douce); }
/* Couverture d'aperçu (image statique générée par l'auteur via capturerZone) */
.feed-cover {
  border-radius: 10px; overflow: hidden; border: 1px solid var(--lignes); background: var(--vert-doux);
  aspect-ratio: 4 / 3;
}
.feed-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.feed-engagement { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--lignes); padding-top: 8px; }
.feed-eng-btn {
  border: none; background: none; color: var(--encre-douce); cursor: pointer;
  height: 34px; min-width: 40px; padding: 0 8px; border-radius: 9px;
  display: flex; align-items: center; gap: 5px; justify-content: center; font-size: 13px; font-weight: 600;
}
.feed-eng-btn:hover:not(:disabled) { background: rgba(47,59,52,.07); }
.feed-eng-btn svg { width: 21px; height: 21px; }
.feed-eng-btn:disabled { opacity: .45; cursor: default; }
.feed-eng-btn.aime { color: var(--brique); }
.feed-eng-btn.aime svg { fill: currentColor; }
.feed-eng-btn.enregistre { color: var(--foret); }
.feed-eng-btn.enregistre svg { fill: currentColor; }
.feed-eng-btn.repartage-actif { color: var(--foret); }
.feed-eng-nb { font-variant-numeric: tabular-nums; }
/* Bandeau « repartagé par @X » en tête d'une carte repartagée */
.feed-repartage-tag {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--encre-douce); margin-bottom: 2px;
}
.feed-repartage-tag svg { width: 16px; height: 16px; }
/* Réglage « autoriser le repartage » dans la modale Partager */
.repartage-reglage {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-size: 13.5px; cursor: pointer;
}
.repartage-reglage input { width: 16px; height: 16px; }

/* Feuille de commentaires (modale) */
.comm-liste { display: flex; flex-direction: column; gap: 12px; max-height: 46vh; overflow-y: auto; margin-bottom: 12px; }
.comm-ligne { display: flex; align-items: flex-start; gap: 9px; }
.comm-corps { flex: 1; min-width: 0; }
.comm-tete { display: flex; align-items: baseline; gap: 8px; }
.comm-pseudo { font-weight: 650; font-size: 13.5px; }
.comm-date { font-size: 11.5px; color: var(--encre-douce); }
.comm-texte { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.comm-suppr {
  flex: none; border: none; background: none; color: var(--encre-douce); cursor: pointer;
  font-size: 14px; border-radius: 8px; padding: 2px 7px;
}
.comm-suppr:hover { background: var(--papier); color: var(--danger); }
.comm-saisie { display: flex; align-items: flex-end; gap: 8px; }
.comm-zone {
  flex: 1; resize: vertical; min-height: 40px; max-height: 140px; font: inherit; font-size: 14px; line-height: 1.4;
  border: 1px solid var(--lignes); border-radius: 10px; padding: 8px 10px; background: var(--blanc-carte); color: var(--encre);
}

/* ═══ Centre de notifications (js/notifs.js) ═══ */
.notif-liste { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; margin: -4px -6px; }
.notif-ligne {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
  border-radius: 10px;
}
.notif-ligne:hover { background: rgba(47,59,52,.06); }
.notif-ligne.non-lu { background: var(--vert-doux); }
.notif-ligne.non-lu:hover { background: #d9ebdd; }
.notif-corps { flex: 1; min-width: 0; }
.notif-texte { font-size: 14px; line-height: 1.4; }
.notif-date { font-size: 11.5px; color: var(--encre-douce); margin-top: 2px; }
.notif-ligne .avatar-user { width: 38px; height: 38px; flex: none; }

/* ═══ Stories « Souvenirs » (js/stories.js) ═══ */
.stories-rangee {
  display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 2px 14px; margin: 0 -2px 8px; border-bottom: 1px solid var(--lignes);
}
.stories-rangee::-webkit-scrollbar { display: none; }
.story-cercle {
  flex: none; border: none; background: none; cursor: pointer; color: var(--encre);
  display: flex; flex-direction: column; align-items: center; gap: 5px; width: 70px; padding: 0;
}
.story-rond {
  position: relative; width: 62px; height: 62px; border-radius: 50%; overflow: hidden;
  background: var(--vert-doux); border: 2px solid var(--lignes);
  display: flex; align-items: center; justify-content: center;
}
.story-rond.actif { border-color: var(--ocre); box-shadow: 0 0 0 2px var(--papier), 0 0 0 4px var(--ocre-clair); }
.story-rond .avatar-user, .story-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.story-rond .avatar-user.avatar-vide { font-size: 26px; background: var(--papier); }
.story-picto { display: flex; align-items: center; justify-content: center; }
.story-picto img { width: 34px; height: 34px; }
.story-plus {
  position: absolute; right: -1px; bottom: -1px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--foret); color: #fff; font-size: 15px; font-weight: 700; line-height: 20px;
  border: 2px solid var(--papier);
}
.story-nom {
  font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ligne-souvenir-choix {
  display: flex; align-items: center; gap: 10px; justify-content: flex-start; text-align: left;
}
.ligne-souvenir-choix .story-img, .ligne-souvenir-choix .story-picto {
  width: 40px; height: 40px; border-radius: 8px; flex: none; overflow: hidden;
}
.ligne-souvenir-choix .story-picto img { width: 26px; height: 26px; }

/* Visionneuse plein écran */
#story-viewer {
  position: fixed; inset: 0; height: var(--vh-visible, 100dvh); z-index: var(--z-login);
  background: rgba(20,26,22,.94); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 46px 16px calc(24px + var(--safe-b));
}
.story-barres { position: absolute; top: calc(10px + var(--safe-t)); left: 16px; right: 16px; display: flex; gap: 4px; }
.story-barre { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.3); }
.story-barre.vue { background: #fff; }
.story-fermer {
  position: absolute; top: calc(10px + var(--safe-t)); right: 14px; z-index: 2;
  border: none; background: rgba(0,0,0,.3); color: #fff; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; font-size: 17px;
}
.story-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  border: none; background: rgba(0,0,0,.3); color: #fff; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%; font-size: 24px; line-height: 1;
}
.story-nav.prec { left: 10px; }
.story-nav.suiv { right: 10px; }
.story-vue { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.story-auteur { align-self: flex-start; display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 650; }
.story-auteur .avatar-user { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.story-carte {
  width: 100%; background: var(--blanc-carte); border-radius: 16px; overflow: hidden;
  box-shadow: var(--ombre-douce);
}
.story-photo { width: 100%; max-height: 62vh; object-fit: cover; display: block; }
.story-photo-picto { display: flex; align-items: center; justify-content: center; height: 240px; background: var(--vert-doux); }
.story-photo-picto img { width: 120px; height: 120px; }
.story-legende { padding: 12px 14px 16px; }
.story-titre { font-size: 18px; font-weight: 650; }
.story-date { font-size: 12.5px; color: var(--encre-douce); margin-top: 2px; }
.story-recit { font-size: 14px; line-height: 1.5; margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.story-prive { color: rgba(255,255,255,.75); font-size: 12.5px; margin: 4px 0 0; }

@media (min-width: 721px) {
  /* Ordinateur : deux colonnes (mes carnets | communauté) dans #ecran ; la
     navigation vit dans le rail partagé, plus dans une barre propre au fil. */
  .feed-grille { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; }
  .feed-col-carnets { display: block !important; border-right: 1px solid var(--lignes); }
  .feed-col-communaute { display: block !important; }
  .feed-liste { max-width: none; }   /* les colonnes bornent déjà la largeur */
  .feed-filtre { display: none; }    /* deux colonnes visibles : pas de bascule */
}

/* liste des souvenirs */
.souvenir-item {
  display: flex; align-items: center; gap: 9px; background: var(--blanc-carte);
  border: 1px solid var(--lignes); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px;
  cursor: grab;
}
.souvenir-item .ic { font-size: 17px; }
.souvenir-item .nom { flex: 1; font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.souvenir-item .date { font-size: 11px; color: var(--encre-douce); }
.souvenir-item .a-placer { color: var(--ocre); font-size: 11px; font-weight: 650; }
.souvenir-item:hover { box-shadow: var(--ombre-legere); }

/* cartes de choix (fonds, thèmes) */
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style-card {
  border: 1px solid var(--lignes); border-radius: 10px; background: var(--blanc-carte);
  padding: 8px; cursor: pointer; text-align: center; font-size: 12px; font-weight: 550;
}
.style-card .apercu { height: 52px; border-radius: 7px; margin-bottom: 6px; background: var(--vert-doux); background-size: cover; background-position: center; }
.style-card.active { border-color: var(--foret); box-shadow: 0 0 0 1px var(--foret); }

/* grille d'autocollants / pictos */
.sticker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.sticker-grid button {
  border: 1px solid transparent; background: none; font-size: 22px; border-radius: 8px;
  padding: 5px 0; cursor: pointer;
}
.sticker-grid button:hover { background: var(--blanc-carte); border-color: var(--lignes); }

/* palette de couleurs proposée */
.color-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.color-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--lignes); cursor: pointer; padding: 0; }
.color-dot.active { box-shadow: 0 0 0 2px var(--foret); }

/* ═══ Image de fond calée sur la zone cadrée ═══ */
.fond-image-pane { z-index: var(--z-fond-image); pointer-events: none; }
.fond-image { position: absolute; transform-origin: center center; }

/* ═══ Annotations sur la carte ═══ */
.anno-pane { z-index: var(--z-annotations); }
/* Le trait de liaison d'une fiche vit dans son propre pane, sous les épingles :
   dans le pane des annotations il passait devant et masquait leur numéro. */
.anno-link-pane { z-index: var(--z-anno-traits); pointer-events: none; }
.anno-link { position: absolute; }
.anno-link svg { display: block; overflow: visible; width: 100%; height: 100%; }
.anno {
  position: absolute; transform-origin: center center; cursor: grab; user-select: none;
  display: flex; align-items: center; justify-content: center;
}
.anno.locked { cursor: default; }
.anno-texte { font-weight: 600; line-height: 1.25; text-align: center; white-space: pre-wrap; word-break: break-word; }
.anno-postit {
  /* carré de papier : ombres marquées sur les bords droit et inférieur.
     Marge intérieure, arrondi, bordure et ombre sont posés en ligne par
     annotations.js et multipliés par l'échelle du zoom : tout ce qui est en
     pixels doit grossir avec la note, sinon le texte se décale et se coupe. */
  background: #fdf3b8; line-height: 1.35; white-space: pre-wrap; word-break: break-word;
  font-weight: 500; transform-origin: center; box-sizing: border-box;
}
.anno-sticker { line-height: 1; }
.anno-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anno svg { display: block; overflow: visible; width: 100%; height: 100%; }
.anno [contenteditable]:focus { outline: 1.5px dashed var(--riviere); }

/* fiche souvenir posée sur le carnet, reliée à son épingle par un trait.
   Comme le post-it : arrondi, ombre, padding et tailles de police sont posés
   en ligne par annotations.js et multipliés par l'échelle du zoom. */
.anno-fiche .fc-card {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: #fff; box-sizing: border-box; overflow: hidden;
}
.anno-fiche .fc-photo { flex: 1; min-height: 0; }
.anno-fiche .fc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anno-fiche .fc-titre {
  display: flex; align-items: center; color: var(--encre);
  font-weight: 650; line-height: 1.25; white-space: nowrap;
}
.anno-fiche .fc-titre .nom { overflow: hidden; text-overflow: ellipsis; }
.anno-fiche .fc-pic { flex: none; }
.anno-fiche .fc-date { color: var(--encre-douce); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anno-fiche.fc-clic { cursor: pointer; }
.anno-fiche .fc-poignee {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--riviere);
  box-shadow: 0 1px 4px rgba(47, 59, 52, .35); cursor: grab; z-index: 2;
}

/* sélection façon Canva */
#sel-frame {
  position: absolute; pointer-events: none; z-index: var(--z-selection);
  border: 1.5px solid var(--riviere);
}
#sel-frame .hd {
  position: absolute; width: 12px; height: 12px; background: #fff;
  border: 1.5px solid var(--riviere); border-radius: 50%; pointer-events: auto;
}
#sel-frame .hd.side { width: 16px; height: 7px; border-radius: 4px; }
#sel-frame .hd.side.v { width: 7px; height: 16px; }
#sel-frame .rot {
  position: absolute; left: 50%; bottom: -30px; transform: translateX(-50%);
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 1.5px solid var(--riviere); pointer-events: auto; cursor: grab;
}
#sel-frame .rot::after { content: ""; position: absolute; left: 50%; top: -13px; width: 1.5px; height: 13px; background: var(--riviere); }

/* ─── Barre contextuelle façon Miro : icônes + popovers ancrés ─── */
/* Largeur bornée + retour à la ligne : sans cela, sur un écran étroit, la barre
   dépassait le viewport et le clamp de select.js la collait à left: 8 en rognant
   sa moitié droite (opacité et menu ⋮ inatteignables). */
#float-bar {
  position: absolute; z-index: var(--z-barre-flot); background: var(--blanc-carte);
  border: 1px solid var(--lignes); border-radius: 12px; box-shadow: var(--ombre-douce);
  display: flex; align-items: center; gap: 2px; padding: 5px 6px;
  min-height: 46px; flex-wrap: wrap;
  max-width: min(calc(100vw - 16px - var(--safe-l) - var(--safe-r)), 520px);
}
#float-bar .fb-btn {
  border: none; background: none; border-radius: 8px; cursor: pointer;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 650; color: var(--encre); position: relative; flex: none;
}
#float-bar .fb-btn:hover { background: var(--papier); }
#float-bar .fb-btn.on { background: var(--vert-doux); color: var(--foret-fonce); }
#float-bar .fb-sep { width: 1px; align-self: stretch; background: var(--lignes); margin: 3px 4px; flex: none; }
#float-bar .fb-swatch {
  width: 20px; height: 20px; border-radius: 5px; display: inline-block;
  box-shadow: inset 0 0 0 1.5px rgba(47,59,52,.25);
}
#float-bar .fb-swatch.none { background: linear-gradient(to top right, #fff 46%, var(--danger) 47%, var(--danger) 53%, #fff 54%) !important; }
#float-bar .fb-dot { width: 15px; height: 15px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1.5px rgba(47,59,52,.15); }
#float-bar .fb-A { position: relative; font-weight: 700; font-size: 15px; line-height: 1; padding-bottom: 5px; }
#float-bar .fb-A i { position: absolute; left: -1px; right: -1px; bottom: 0; height: 3.5px; border-radius: 2px; }
#float-bar .fb-fontname {
  font-size: 13px; font-weight: 550; max-width: 108px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; padding: 0 4px;
}
#float-bar .fb-btn:has(.fb-fontname) { width: auto; }
#float-bar .fb-emoji {
  width: 46px; font-size: 17px; border: 1px solid var(--lignes); border-radius: 8px;
  padding: 3px 5px; text-align: center;
}
#float-bar input[type=color] { width: 26px; height: 26px; border: none; padding: 0; background: none; cursor: pointer; }
#float-bar input[type=range] { width: 74px; }

/* infobulle noire arrondie (Miro) — souris seulement : au doigt, iOS garde l'état
   :hover après un tap et l'infobulle reste collée par-dessus les boutons voisins */
[data-tip] { position: relative; }
@media (hover: hover) and (pointer: fine) {
  [data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%);
    background: #1f2622; color: #f4f1e8; font-size: 11.5px; font-weight: 550;
    padding: 4px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none; z-index: var(--z-infobulle);
  }
  #rail [data-tip]:hover::after { left: calc(100% + 8px); bottom: auto; top: 50%; transform: translateY(-50%); }
  /* dans la barre du haut, l'infobulle sort en DESSOUS (au-dessus, elle sortirait de l'écran) */
  #topbar [data-tip]:hover::after, #lay-topbar [data-tip]:hover::after {
    bottom: auto; top: calc(100% + 7px);
  }
}

/* panneau ancré sous un bouton de la barre (ou menu contextuel) */
.fb-pop-panel {
  position: absolute; z-index: var(--z-popover); background: var(--blanc-carte);
  border: 1px solid var(--lignes); border-radius: 12px; box-shadow: var(--ombre-douce);
  padding: 10px 12px; width: max-content; max-width: 262px; max-height: 330px; overflow-y: auto;
}
.pop-title {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--encre-douce); font-weight: 600; margin: 6px 0 6px;
}
.pop-title:first-child { margin-top: 0; }

/* grille de pastilles de couleurs */
.kdot-grid { display: flex; flex-wrap: wrap; gap: 7px; max-width: 210px; }
.kdot {
  width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1.5px rgba(47,59,52,.18);
  display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none;
}
.kdot:hover { transform: scale(1.12); }
.kdot .check { color: #fff; font-size: 13px; font-weight: 700; text-shadow: 0 0 3px rgba(0,0,0,.55); }
.kdot.none { background: linear-gradient(to top right, #fff 44%, var(--danger) 45%, var(--danger) 55%, #fff 56%); }
.kdot.none .check { color: var(--encre); text-shadow: 0 0 3px #fff; }
.kdot.custom { background: var(--papier); color: var(--encre-douce); font-size: 17px; font-weight: 650; overflow: hidden; }
.kdot.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* rangée slider « label ── valeur » */
.kslider { margin: 8px 0; min-width: 190px; }
.kslider-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 550; color: var(--encre-douce); margin-bottom: 3px; }
.kslider-head .kval { color: var(--encre); font-weight: 650; }
.kslider input[type=range] { width: 100%; accent-color: var(--foret); }

/* segmenté (styles de trait) */
.kseg { display: flex; background: var(--papier); border-radius: 9px; padding: 3px; gap: 2px; margin-bottom: 4px; }
.kseg button {
  flex: 1; border: none; background: none; border-radius: 7px; padding: 5px 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--encre);
}
.kseg button.active { background: var(--blanc-carte); box-shadow: var(--ombre-legere); color: var(--foret-fonce); }

/* liste de polices */
.kfonts { min-width: 180px; }
.kfont-row {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--encre);
}
.kfont-row:hover { background: var(--papier); }
.kfont-row.selected { background: var(--vert-doux); color: var(--foret-fonce); }

/* stepper de taille */
.ksize { display: inline-flex; align-items: center; position: relative; margin: 0 2px; }
.ksize input[type=number] {
  width: 40px; height: 30px; text-align: center; font-weight: 650; font-size: 13.5px;
  border: 1px solid var(--lignes); border-radius: 8px; background: var(--blanc-carte);
  -moz-appearance: textfield; appearance: textfield;
}
.ksize input::-webkit-outer-spin-button, .ksize input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ksize-btns { display: flex; flex-direction: column; margin-left: 2px; }
.ksize-btns button {
  border: none; background: none; cursor: pointer; font-size: 8px; line-height: 1;
  padding: 3px 4px; border-radius: 5px; color: var(--encre-douce);
}
.ksize-btns button:hover { background: var(--papier); color: var(--encre); }
.ksize-list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-liste-pop);
  background: var(--blanc-carte); border: 1px solid var(--lignes); border-radius: 10px;
  box-shadow: var(--ombre-douce); padding: 4px; max-height: 220px; overflow-y: auto; width: 58px;
}
.ksize-list button {
  display: block; width: 100%; border: none; background: none; padding: 5px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px; text-align: center;
}
.ksize-list button:hover { background: var(--papier); }
.ksize-list button.selected { background: var(--vert-doux); color: var(--foret-fonce); font-weight: 650; }

/* alignement */
.kalign { display: flex; gap: 4px; }
.kalign button { border: none; background: none; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--encre); }
.kalign button:hover { background: var(--papier); }
.kalign button.selected { background: var(--vert-doux); color: var(--foret-fonce); }

/* grille de formes */
.kshape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.kshape-grid button { border: none; background: none; border-radius: 9px; padding: 7px; cursor: pointer; color: var(--encre); display: flex; align-items: center; justify-content: center; }
.kshape-grid button:hover { background: var(--papier); }
.kshape-grid button.selected { background: var(--vert-doux); color: var(--foret-fonce); }

/* menu (image12) et listes verticales */
.kmenu { min-width: 210px; }
.kmenu-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--encre); text-align: left;
}
.kmenu-row .lbl { flex: 1; }
.kmenu-row .short { color: var(--encre-douce); font-size: 12px; }
.kmenu-row:hover { background: var(--papier); }
.kmenu-row.selected { background: var(--vert-doux); color: var(--foret-fonce); }
.kmenu-row.danger { color: var(--danger); }
.kmenu-sep { border-top: 1px solid var(--lignes); margin: 5px 2px; }

/* tailles du stylo */
.kdraw-sizes { display: flex; gap: 6px; }
.kdraw-sizes button {
  width: 34px; height: 30px; border: none; background: var(--papier); border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--encre);
}
.kdraw-sizes button.selected { background: var(--vert-doux); color: var(--foret-fonce); }

/* ─── Flyout compact du rail (image10) ─── */
.rail-flyout {
  position: absolute; z-index: var(--z-flyout);
  background: var(--blanc-carte); border: 1px solid var(--lignes); border-radius: 12px;
  box-shadow: var(--ombre-douce); padding: 6px; min-width: 168px; overflow-y: auto;
  max-height: 70vh; max-height: 70dvh;
}
.fly-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--encre); text-align: left;
}
.fly-row:hover { background: var(--papier); }
.fly-row.selected { background: var(--vert-doux); color: var(--foret-fonce); }
.fly-row .fly-ic { display: inline-flex; width: 22px; justify-content: center; flex: none; }
.fly-row .fly-lbl { flex: 1; }
.fly-row .fly-short { color: var(--encre-douce); font-size: 12px; }

/* Ombrage permanent de tout ce qui sort de la zone du carnet. La force du
   voile est posée en ligne par js/zoneshade.js (légère en édition, réglable en
   consultation) ; la valeur ci-dessous n'est qu'un repli. */
.zone-shade {
  position: absolute; pointer-events: none; z-index: var(--z-voile-zone);
  box-shadow: 0 0 0 9999px rgba(47,59,52,.16);
  outline: 1.5px dashed rgba(200,137,61,.55);
  transition: box-shadow .2s;
}

/* zone de cadrage */
.zone-rect { stroke: var(--brique); stroke-width: 2; stroke-dasharray: 8 5; fill: rgba(211,84,56,.05); }
.zone-handle { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--brique); cursor: nwse-resize; }
.zone-mask { fill: rgba(47,59,52,.35); fill-rule: evenodd; pointer-events: none; }

/* ═══ E-06 : éditeur de thèmes ═══ */
#theme-editor {
  position: absolute; top: 14px; right: 14px; bottom: 14px; width: 344px;
  background: var(--papier-clair); border: 1px solid var(--lignes);
  border-radius: var(--rayon); box-shadow: var(--ombre-douce); z-index: var(--z-editeur);
  display: flex; flex-direction: column; overflow: hidden;
}
.te-field {
  display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px;
}
.te-field > span { flex: 1; color: var(--encre-douce); font-weight: 550; }
.te-field input[type=color] { width: 30px; height: 26px; border: none; background: none; padding: 0; cursor: pointer; }
.te-field input[type=range] { width: 110px; }
.te-field select { max-width: 150px; border: 1px solid var(--lignes); border-radius: 7px; padding: 4px 6px; background: var(--blanc-carte); }
.te-hint { font-size: 12px; color: var(--encre-douce); margin: 2px 0 8px; line-height: 1.4; }
.te-group { border-bottom: 1px solid var(--lignes); padding-bottom: 8px; margin-bottom: 4px; }
.te-group:last-child { border-bottom: none; }

/* E-06 sur mobile : l'éditeur de thème prend le bord bas (voir --bas) ; la
   liste des thèmes, elle, vit dans le tiroir du rail. */
@media (max-width: 720px) {
  #theme-editor {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 56dvh; border-radius: 18px 18px 0 0;
    padding-bottom: var(--safe-b);
  }
}

/* ═══ E-01 : page de connexion (plein écran, hors application) ═══ */
#login-ecran {
  position: fixed; inset: 0; bottom: auto; height: var(--vh-visible, 100dvh);
  z-index: var(--z-login); background: var(--papier); overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: calc(18px + var(--safe-t)) calc(18px + var(--safe-r)) calc(18px + var(--safe-b)) calc(18px + var(--safe-l));
}
.login-carte {
  background: var(--blanc-carte); border: 1px solid var(--lignes);
  border-radius: 18px; box-shadow: var(--ombre-douce);
  padding: 34px 36px 26px; width: min(410px, 94vw);
}
.login-carte h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: .02em; }
.login-sous-titre { margin: 0 0 18px; font-size: 13.5px; line-height: 1.5; color: var(--encre-douce); }
.login-carte input[type=email], .login-carte input[type=password], .login-carte input[type=text] {
  width: 100%; border: 1px solid var(--lignes); border-radius: 8px;
  padding: 9px 11px; background: var(--blanc-carte); font-size: 14px;
}
.login-erreur { color: var(--brique); font-size: 13px; margin: 4px 0 8px; }
.login-oubli { text-align: right; font-size: 12.5px; margin: -4px 0 10px; }
.login-oubli a { color: var(--foret); }
.login-logo { width: 34px; height: auto; vertical-align: -5px; margin-right: 10px; }
.login-bascule { margin-top: 12px; text-align: center; font-size: 13.5px; }
.login-bascule a { color: var(--foret); font-weight: 600; }
.login-ou { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--encre-douce); font-size: 12px; }
.login-ou::before, .login-ou::after { content: ''; flex: 1; border-top: 1px solid var(--lignes); }
.login-liens { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; }
.login-liens a { color: var(--foret); }
.login-rester { display: inline-flex; align-items: center; gap: 6px; color: var(--encre-douce); cursor: pointer; }
.login-local { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--lignes); text-align: center; font-size: 13px; }
.login-local a { color: var(--encre-douce); }
.login-langue { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--encre-douce); }
.login-langue a { color: var(--foret); }
.login-langue-active { font-weight: 600; }
.login-statut { font-size: 13px; margin: 4px 0; min-height: 18px; }
.login-statut.ok { color: var(--foret); }
.login-statut.ko { color: var(--brique); }

/* ═══ Modales ═══ */
/* --vh-visible est publiée par main.js depuis visualViewport : sur iOS, le viewport
   de mise en page ne bouge pas à l'ouverture du clavier, donc sans cela la modale
   reste centrée DERRIÈRE le clavier. */
.veil {
  position: fixed; inset: 0; bottom: auto; height: var(--vh-visible, 100dvh);
  background: rgba(30,38,33,.45); z-index: var(--z-modale);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: veil-in .18s ease;
}
@keyframes veil-in { from { opacity: 0; } }
.modal {
  background: var(--blanc-carte); border-radius: var(--rayon-modale);
  box-shadow: var(--ombre-douce); width: 520px; max-width: 100%;
  max-height: calc(100vh - 40px); max-height: calc(100% - 40px);
  display: flex; flex-direction: column;
  animation: modal-in .22s cubic-bezier(.2,.9,.3,1.2);
  position: relative;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { padding: 20px 24px 0; display: flex; align-items: flex-start; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 650; flex: 1; }
.modal-close {
  border: none; background: none; font-size: 19px; cursor: pointer; color: var(--encre-douce);
  border-radius: 8px; padding: 3px 8px; margin: -4px -8px 0 0;
}
.modal-close:hover { background: var(--papier); }
.modal-body { padding: 14px 24px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 24px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal.large { width: 780px; }
.modal.small { width: 400px; }

/* M-14 : boîte de dialogue maison, toujours au-dessus */
.veil.dialog { z-index: var(--z-dialogue); }

/* fiche souvenir M-01 */
.fiche { display: grid; grid-template-columns: 200px 1fr; gap: 18px; }
.fiche-map { height: 150px; border-radius: 12px; overflow: hidden; border: 1px solid var(--lignes); }
.fiche h3 { margin: 0 0 2px; font-size: 20px; font-weight: 650; }
.fiche .dates { color: var(--encre-douce); font-size: 13px; margin-bottom: 8px; }
.fiche .recit { line-height: 1.55; font-size: 14px; white-space: pre-wrap; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 10px; }
.galerie .ph { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; cursor: pointer; border: 1px solid var(--lignes); }
.galerie .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galerie .ph .cover-star {
  position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.85);
  border: none; border-radius: 999px; font-size: 12px; cursor: pointer; padding: 2px 5px;
}

/* M-01 : mosaïque de photos pleine largeur, légende sous chaque photo
   (la .galerie compacte ci-dessus reste réservée à M-07 — création) */
.mosaique {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-top: 16px;
}
.mosaique .ph {
  position: relative; aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden;
  cursor: pointer; border: 1px solid var(--lignes);
}
.mosaique .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mosaique .ph .cover-star {
  position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.85);
  border: none; border-radius: 999px; font-size: 12px; cursor: pointer; padding: 2px 5px;
}
/* la couverture (toujours photos[0]) ouvre la mosaïque sur toute la largeur */
.mosaique .mo-cover { grid-column: 1 / -1; }
.mosaique .mo-cover .ph { aspect-ratio: 16 / 9; }
.mo-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mo-legende { font-size: 12px; color: var(--encre-douce); line-height: 1.35; overflow-wrap: break-word; }
input.mo-legende { border: 1px solid var(--lignes); border-radius: 7px; padding: 4px 8px; font-size: 12px; width: 100%; }
@media (max-width: 480px) { .mosaique { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
/* navigation d'un souvenir à l'autre : en TÊTE de la fiche (M-01) */
.fiche-nav:not(:empty) {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 0 0 10px; margin-bottom: 14px; border-bottom: 1px solid var(--lignes);
  color: var(--encre-douce); font-size: 13px;
}

/* ═══ Les fitas : écran #/fitas (solde + documentation de la monnaie) ═══ */
.fitas-solde { font-size: 40px; font-weight: 650; color: var(--foret-fonce); line-height: 1.1; }
.fitas-tarifs { display: grid; gap: 6px; align-self: stretch; }
.fitas-ligne {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--papier-clair); border: 1px solid var(--lignes);
  border-radius: 12px; padding: 9px 12px;
}
.fitas-prix {
  flex: none; min-width: 68px; font-weight: 700; font-size: 13px;
  color: var(--ocre); white-space: nowrap;
}
.fitas-prix.gain { color: var(--foret); }

/* ═══ À propos (ℹ️) : des situations, pas une liste de fonctions ═══ */
.apropos-cas { display: grid; gap: 8px; max-height: 52dvh; overflow-y: auto; }
.apropos-cas .cas {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--papier-clair); border: 1px solid var(--lignes);
  border-radius: 12px; padding: 9px 12px;
}
.apropos-cas .cas-ic { font-size: 19px; line-height: 1.3; flex: none; }
.apropos-cas .cas-situation { font-weight: 650; font-size: 13.5px; line-height: 1.4; }
.apropos-cas .cas-reponse { font-size: 13px; line-height: 1.45; color: var(--encre-douce); margin-top: 2px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(20,25,22,.92); z-index: var(--z-lightbox); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
.lightbox img { max-width: 92vw; max-height: 78vh; max-height: 78dvh; border-radius: 8px; }
.lightbox .lb-bar {
  display: flex; align-items: center; justify-content: center; gap: 14px 10px;
  flex-wrap: wrap; color: #eee; max-width: 92vw;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
}
.lightbox .lb-bar .btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.lightbox input { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 6px 10px; width: min(300px, 100%); }

/* ═══ Toasts ═══ */
#toasts { position: fixed; bottom: calc(22px + var(--bas) + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast-action {
  border: none; background: rgba(255,255,255,.18); color: inherit; font: inherit;
  font-weight: 650; border-radius: 999px; padding: 4px 12px; margin-left: 10px; cursor: pointer;
}
.toast-action:hover { background: rgba(255,255,255,.3); }
.toast {
  background: var(--encre); color: var(--papier-clair); border-radius: 999px;
  padding: 9px 20px; font-size: 14px; font-weight: 550; box-shadow: var(--ombre-douce);
  animation: toast-in .25s ease; max-width: 90vw;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ═══ E-05 : mise en page ═══ */
#layout-screen { position: fixed; inset: 0; z-index: var(--z-ecran); background: var(--papier); display: flex; flex-direction: column; }
#lay-body { flex: 1; display: flex; min-height: 0; }
/* tiroir du rail de E-05 (même contenu que #drawer : drawer-head + drawer-body) */
#lay-panel {
  width: 288px; flex: none; background: var(--papier-clair); border-right: 1px solid var(--lignes);
  display: flex; flex-direction: column; overflow: hidden;
}
#lay-stage-wrap { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 26px; }
#lay-stage {
  background: #fff; box-shadow: var(--ombre-douce); position: relative; flex: none;
  overflow: hidden;
}
.ratio-pills { display: flex; gap: 4px; background: var(--blanc-carte); border: 1px solid var(--lignes); border-radius: 999px; padding: 3px; }
.ratio-pills button { border: none; background: none; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 550; cursor: pointer; }
.ratio-pills button.active { background: var(--foret-fonce); color: #fff; }

#lay-thumbs {
  flex: none; background: var(--papier-clair); border-top: 1px solid var(--lignes);
  display: flex; gap: 10px; align-items: center; overflow-x: auto; min-height: 86px;
  padding: 10px calc(14px + var(--safe-r)) calc(10px + var(--safe-b)) calc(14px + var(--safe-l));
}
.thumb { position: relative; flex: none; height: 62px; border: 2px solid var(--lignes); border-radius: 8px; background: #fff; cursor: pointer; overflow: hidden; }
.thumb.active { border-color: var(--foret); }
.thumb .num { position: absolute; bottom: 2px; left: 5px; font-size: 10px; font-weight: 650; color: var(--encre-douce); }
.thumb .thumb-actions { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 2px; background: rgba(247,242,232,.85); }
/* Au doigt il n'y a pas de survol : les actions apparaissent sur la page courante,
   sinon ◀ ⧉ 🗑 ▶ sont purement inatteignables sur téléphone. */
@media (hover: hover) { .thumb:hover  .thumb-actions { display: flex; } }
@media (hover: none)  { .thumb.active .thumb-actions { display: flex; background: rgba(247,242,232,.6); } }
.thumb .thumb-actions button { border: none; background: none; cursor: pointer; font-size: 12px; padding: 2px 3px; border-radius: 5px; }
.thumb .thumb-actions button:hover { background: var(--blanc-carte); }
.thumb.add { display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--encre-douce); width: 46px; background: none; border-style: dashed; }
.thumb .mini { position: absolute; inset: 0; transform-origin: top left; pointer-events: none; }

/* blocs de la page */
.lay-block { position: absolute; transform-origin: center center; cursor: grab; }
.lay-block .blk-inner { width: 100%; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.blk-texte { white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.blk-carte-map { width: 100%; height: 100%; }
.blk-souvenir { border-radius: 10px; }
.blk-souvenir .bs-photo { flex: 1; min-height: 0; }
.blk-souvenir .bs-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blk-souvenir .bs-titre { font-weight: 650; }
.blk-souvenir .bs-date { color: var(--encre-douce); }
.blk-souvenir .bs-recit { overflow: hidden; }
/* QR codes d'un bloc souvenir : une vidéo ne s'imprime pas, son QR l'ouvre */
.blk-souvenir .bs-qr { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; margin: 6px 8px 0 0; vertical-align: top; }
.blk-souvenir .bs-qr-code svg { width: 100%; height: 100%; display: block; }
.blk-souvenir .bs-qr-nom { color: var(--encre-douce); max-width: 90px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-souvenir .bs-qr-vide { color: var(--encre-douce); border: 1px dashed var(--lignes); border-radius: 6px; margin-top: 6px; line-height: 1.35; }
.blk-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lay-add-btn { display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 6px; }

/* ═══ Impression WYSIWYG ═══ */
#print-root { position: absolute; left: -20000px; top: 0; background: #fff; }
.print-page { position: relative; overflow: hidden; background: #fff; }
@media print {
  body { overflow: visible; background: #fff; }
  #app, #layout-screen, #toasts, .veil, #float-bar, #sel-frame { display: none !important; }
  #print-root { position: static; left: 0; }
  .print-page { page-break-after: always; }
  .print-page:last-child { page-break-after: auto; }
}

/* ═══ Ordinateur : navigation plus généreuse (mobile inchangé) ═══ */
/* Complément exact du breakpoint mobile ci-dessous : sur ordinateur, glyphes et
   conteneurs grandissent (demande Robin 2026-08-17). Les valeurs de base de :root
   restent la version mobile. Un léger défilement vertical du rail éditeur est
   accepté (il a déjà overflow-y: auto). */
@media (min-width: 721px) {
  /* --rail-w élargi pour loger les libellés sous les icônes ; .rail-btn suit
     --rail-w (règle de base), rien à fixer ici. */
  :root { --icone: 32px; --topbar-h: 74px; --rail-w: 84px; }
  /* .tb-btn suit la règle de base (colonne, hauteur auto) ; min-width un peu plus
     large pour le glyphe de 32. */
  .tb-btn { min-width: 54px; }
}

/* ═══ Responsive (NF-04) : mobile ═══ */
@media (max-width: 720px) {
  /* ─── Propriété du bord bas : un seul élément par écran, sa hauteur va dans --bas.
         Tout le reste (contrôles Leaflet, toasts) s'en décale automatiquement. ─── */
  /* Barre du bas plus haute depuis que les icônes portent un libellé. */
  body[data-ecran="home"], body[data-ecran="vizu"], body[data-ecran="themes"],
  body[data-ecran="fil"], body[data-ecran="fitas"], body[data-ecran="compte"], body[data-ecran="reseau"] { --bas: 80px; }
  body[data-ecran="edit"]   { --bas: 82px; }
  /* E-05 : le bord bas appartient à #lay-thumbs, pas au rail — inchangé */
  body[data-ecran="layout"] { --bas: 70px; }

  /* ─── Barre du haut : une seule action garde ses mots, la principale ─── */
  #topbar, #lay-topbar { gap: 6px; }
  #tb-center, #lay-center { flex: 0 0 auto; }
  #tb-center .save-status { display: none; }
  .btn .btn-lbl { display: none; }
  .btn.primary .btn-lbl, .btn.cta .btn-lbl { display: inline; }
  .btn:has(.btn-ic) { padding: 0 10px; min-width: 44px; height: 44px; justify-content: center; }
  .btn.primary:has(.btn-ic), .btn.cta:has(.btn-ic) { padding: 0 14px; }
  /* Boutons libellés de #tb-right/#lay-right repris derrière le « ⋯ » */
  .barre-actions { display: none; }
  .btn.menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; flex: none; font-size: 18px;
  }
  /* « Camina » reste visible partout (demande Robin 2026-08-17). L'espace étant
     compté, le nom de page est plus compact et le titre tronqué plus tôt. */
  .logo { gap: 6px; font-size: 16px; }
  .page-titre { font-size: 13px; gap: 4px; }
  .pt-titre { max-width: 22vw; }
  .chip-carnet { max-width: 150px; }

  /* ─── Le rail devient une barre horizontale du bas (tous les écrans) ─── */
  /* Carte flottante arrondie (la base est collée au bord pour le rail vertical
     d'ordinateur : on rétablit ici l'allure mobile). Plus haute pour loger le
     libellé sous chaque icône. */
  #rail {
    top: auto; width: auto; height: 72px; flex-direction: row;
    left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
    bottom: calc(8px + var(--safe-b));
    border: 1px solid var(--lignes); border-radius: var(--rayon); box-shadow: var(--ombre-douce);
    padding: 0 6px; overflow-x: auto; overflow-y: hidden;
    /* 16 boutons dans ~360 px : le dégradé de bord signale qu'il y a plus à voir,
       la barre de défilement étant masquée. */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }
  /* Sur la barre horizontale, chaque bouton reste compact (largeur au contenu) */
  .rail-btn { width: auto; min-width: 52px; padding: 5px 6px; }
  .rail-sep { width: 0; border-top: none; border-left: 1px solid var(--lignes); height: 40px; margin: 0 4px; }
  .rail-spacer { flex: none; width: 8px; }            /* flex: 1 s'écrasait à 0 en débordement */
  #drawer {
    top: auto; width: auto; max-height: 55dvh;
    left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
    bottom: calc(88px + var(--safe-b));               /* 72 (rail) + 8 (marge basse) + 8 (gouttière) */
  }
  .drawer-body { padding-bottom: calc(18px + var(--safe-b)); }

  /* ─── Modales en feuille du bas, comme le reste du langage mobile ─── */
  .veil { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-height: 90dvh;
    border-radius: var(--rayon-modale) var(--rayon-modale) 0 0;
  }
  .modal.large, .modal.small { width: 100%; }
  .modal-foot { padding-bottom: calc(20px + var(--safe-b)); }
  .fiche { grid-template-columns: 1fr; }

  /* ─── E-05 : mise en page ─── */
  /* Les 7 pilules de ratio passent sur une seconde rangée défilable */
  #lay-topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding-bottom: 6px; }
  #lay-center { order: 3; flex: 1 0 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  #lay-center::-webkit-scrollbar { display: none; }
  /* Le tiroir « Ajouter » devient une feuille du bas, ouverte par le rail.
     Pas de position: relative sur #lay-body : il se cale sur #layout-screen
     (fixed, inset: 0), sinon il s'arrête au-dessus de la bande de vignettes. */
  #lay-panel {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 62dvh; z-index: var(--z-tiroir);
    border-right: none; border-top: 1px solid var(--lignes);
    border-radius: 18px 18px 0 0; box-shadow: var(--ombre-douce);
  }
  /* Le rail de E-05 reste vertical (la scène garde sa hauteur), simplement plus étroit */
  #lay-rail { width: 54px; }
  #lay-stage-wrap { padding: 12px; }
  #lay-thumbs { min-height: 70px; }
  .thumb { height: 50px; }

  /* ─── E-01 ─── */
  #login-ecran { align-items: flex-start; }
  .login-carte { padding: 26px 20px 20px; }
}

/* Sous 420 px, le titre du carnet coûte plus de place qu'il n'en vaut : son
   pictogramme suffit à l'identifier, et la barre de E-05 tient sur deux rangées
   au lieu de trois. */
@media (max-width: 420px) {
  .chip-carnet .t { display: none; }
  .chip-carnet { padding: 4px 9px; }
}

/* ═══ Cibles tactiles (NF-04) ═══ */
/* 44 px sur la navigation ; 40 px sur les outils denses, où 44 ferait déborder
   .card-actions et #float-bar. Compromis assumé. */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; padding: 7px 12px; }
  #topbar .btn, #lay-topbar .btn, .modal-foot .btn { min-height: 44px; }
  /* Le bouton de rail fait déjà 48 px : au doigt on ne l'agrandit plus autour du
     même glyphe, on garde exactement la cible de la souris. */
  .rail-btn { min-width: 48px; min-height: 44px; }
  .tb-btn   { min-width: 44px; min-height: 44px; }   /* la barre du haut ne fait que 52 px */
  .fb-btn, .kdot, .kmenu-row, .fly-row { min-height: 40px; }
  .fb-btn { min-width: 40px; }
  .thumb .thumb-actions button { min-width: 30px; min-height: 30px; font-size: 14px; }
  .btn, .rail-btn, .tb-btn, .fb-btn, .chip, .thumb, .kdot, .kmenu-row, .fly-row,
  .color-dot, .sticker-grid button, .ratio-pills button { touch-action: manipulation; }
}

/* ═══ Visite guidée (tour de l'application, js/tour.js) ═══ */
/* Le voile ne porte AUCUN fond : c'est l'ombre géante du projecteur qui assombrit
   tout sauf la cible. Sans cible (bulle centrée), la classe .sans-cible pose le
   fond sur le voile et cache le projecteur. */
.tour-veil { position: fixed; inset: 0; z-index: var(--z-modale); }
.tour-veil.sans-cible { background: rgba(47, 59, 52, .5); }
.tour-veil.sans-cible .tour-spot { display: none; }
.tour-spot {
  position: absolute; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(47, 59, 52, .5);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.tour-bulle {
  position: absolute; width: min(340px, calc(100vw - 24px));
  background: var(--blanc-carte); border-radius: var(--rayon);
  box-shadow: var(--ombre-douce); padding: 16px 18px 14px;
}
.tour-bulle h3 { margin: 0 24px 6px 0; font-size: 16px; font-weight: 650; }
.tour-bulle p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--encre-douce); }
.tour-fermer {
  position: absolute; top: 8px; right: 10px; border: 0; background: none;
  font-size: 15px; color: var(--encre-douce); cursor: pointer; padding: 4px;
}
.tour-pied { display: flex; align-items: center; gap: 8px; }
.tour-points { flex: 1; display: flex; gap: 5px; }
.tour-points span { width: 7px; height: 7px; border-radius: 50%; background: var(--lignes); }
.tour-points span.actif { background: var(--foret); }
/* Mobile : la bulle s'ancre en bas de l'écran, au-dessus de la barre d'accueil */
@media (max-width: 720px) {
  .tour-bulle {
    left: 12px !important; top: auto !important;
    bottom: calc(12px + var(--safe-b));
    width: calc(100vw - 24px);
  }
}
