/* ============================================================
   Système de design — d'après Genealogie.dc.html (Claude Design)
   Thèmes Sépia / Lin / Encre · polices Newsreader + Mulish
   ============================================================ */

/* --- Thèmes (variables) --- */
[data-theme="sepia"] {
  --paper:#F1E7D6; --card:#FBF5E9; --ink:#2C2113; --soft:#7A6A52;
  --line:#E4D7BF; --accent:#B0572F; --gold:#9C7C2E; --backdrop:#C9BBA4;
  --theme-name:"Sépia";
}
[data-theme="lin"] {
  --paper:#F6F2EA; --card:#FFFFFF; --ink:#33302A; --soft:#88826F;
  --line:#E9E2D4; --accent:#7C8A5E; --gold:#B08C3A; --backdrop:#D9D3C5;
  --theme-name:"Lin";
}
[data-theme="bleu"] {
  --paper:#ECF1F7; --card:#FAFCFE; --ink:#1F2A38; --soft:#6B7789;
  --line:#DBE3EC; --accent:#3A6EA5; --gold:#C0883A; --backdrop:#C2CEDC;
  --theme-name:"Bleu";
}
[data-theme="encre"] {
  --paper:#241C12; --card:#2F2618; --ink:#F1E7D2; --soft:#B0A083;
  --line:#41351F; --accent:#D78B4C; --gold:#CBA24B; --backdrop:#16110A;
  --theme-name:"Encre";
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: 'Mulish', system-ui, sans-serif;
  color: var(--ink, #2C2113);
  background: radial-gradient(120% 100% at 50% 0%,
              var(--backdrop, #C9BBA4) 0%,
              color-mix(in oklab, var(--backdrop, #C9BBA4) 78%, #000 22%) 100%);
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: 'Newsreader', Georgia, serif; }

::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

a { color: var(--accent); text-decoration: none; }

/* ============================================================
   Coquille « app » (colonne type mobile, cadrée sur desktop)
   ============================================================ */
.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;            /* app-shell : hauteur d'écran → .app-scroll défile seul,
                                la bottom-nav reste en bas sans position:fixed */
  margin: 0 auto;
  background: var(--paper, #F1E7D6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sidebar { display: none; }

/* Tablette : cadre arrondi façon « carte » */
@media (min-width: 480px) and (max-width: 1023px) {
  body { padding: 24px 16px; }
  .app {
    height: min(900px, calc(100dvh - 48px));   /* tient dans l'écran → footer en bas de la carte */
    border-radius: 34px;
    box-shadow: 0 40px 80px -20px rgba(40,28,12,.55), 0 0 0 1px rgba(255,255,255,.05) inset;
  }
}

/* --- Sidebar (desktop) --- */
.sidebar {
  width: 256px; flex: none; height: 100%; overflow-y: auto;
  background: color-mix(in oklab, var(--card) 70%, var(--paper) 30%);
  border-right: 1px solid var(--line);
  flex-direction: column; padding: 22px 16px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; text-decoration: none; }
.side-logo { font-size: 24px; }
.side-title { display: block; font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.05; }
.side-sub { display: block; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--soft); margin-top: 3px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px; color: var(--soft); font-size: 14px; font-weight: 700; text-decoration: none; }
.side-nav a .ico { width: 22px; text-align: center; font-size: 17px; }
.side-nav a.active { background: var(--accent); color: #FBF5E9; box-shadow: 0 6px 14px -6px color-mix(in oklab, var(--accent) 60%, transparent); }
.side-nav a:not(.active):hover { background: color-mix(in oklab, var(--accent) 9%, transparent); color: var(--ink); }
.side-nav-sm a { padding: 8px 14px; font-size: 13px; font-weight: 600; }
.side-section { margin-top: 22px; }
.side-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--soft); margin: 0 8px 10px; }
.side-stats { display: flex; gap: 20px; padding: 0 8px; }
.side-stats .num { display: block; font-family: 'Newsreader', serif; font-size: 24px; color: var(--ink); line-height: 1; }
.side-stats .cap { display: block; font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--soft); margin-top: 3px; }
.side-foot { margin-top: auto; padding-top: 18px; }
.theme-swatches { display: flex; gap: 8px; padding: 0 8px; }
.theme-swatches .sw { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.theme-swatches .sw.active { border-color: var(--ink); }

/* Pied de sidebar : utilisateur connecté + point de thème */
.side-user { display: flex; align-items: center; gap: 9px; padding: 0 8px; }
.side-user-link { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; text-decoration: none; color: inherit; border-radius: 10px; padding: 4px 6px; margin: 0 -6px; }
.side-user-link:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.side-ava { width: 30px; height: 30px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff; overflow: hidden; }
.side-ava.has-photo { background: var(--card); }
.side-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-user-name { font-weight: 700; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-theme { margin-left: auto; flex: none; border: none; background: transparent; cursor: pointer; padding: 6px; border-radius: 50%; display: flex; }
.side-theme:hover { background: color-mix(in oklab, var(--accent) 12%, transparent); }
.side-theme .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 25%, transparent); transition: background .2s; }

/* --- En-tête --- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 18px 20px 12px;
  background: linear-gradient(var(--paper), color-mix(in oklab, var(--paper) 92%, transparent));
  position: sticky; top: 0; z-index: 20;
}
.app-header .left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.app-title { font-family:'Newsreader',serif; font-size: 21px; font-weight: 500; color: var(--ink); letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 34px; height: 34px; flex: none; border: none; border-radius: 50%;
  background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.1); display: flex; align-items: center; justify-content: center;
}
.theme-btn {
  height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 40px;
  background: transparent; color: var(--soft); font-size: 11px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; cursor: pointer;
  display: flex; align-items: center; gap: 6px; flex: none;
}
.theme-btn .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }

/* --- Zone de contenu défilante --- */
.app-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* fill-mode "backwards" (et non "both") : garde l'anti-flash au chargement
   sans conserver de transform après l'animation — sinon ce transform résiduel
   ferait que les modales position:fixed se calent sur .app-body, pas le viewport. */
.app-body { padding: 4px 20px 28px; animation: fadeUp .4s ease backwards; }

/* Page d'accueil : contenu centré verticalement et horizontalement dans le
   viewport (min-height:100% → hauteur définie de .app-scroll, flex:1). */
.app-body-center {
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  min-height: 100%;
  padding-bottom: 40px;
}
.home-hero { width: 100%; max-width: 440px; text-align: center; }

/* --- Bottom nav --- */
.app-nav {
  position: sticky; bottom: 0; z-index: 25;
  display: flex; align-items: stretch; justify-content: space-around;
  padding: 8px 12px 14px;
  background: linear-gradient(color-mix(in oklab, var(--paper) 0%, transparent), var(--paper) 38%);
}
.app-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 10px; border-radius: 14px; color: var(--soft);
  font-size: 10px; font-weight: 700; letter-spacing: .3px; text-decoration: none;
}
.app-nav a .ico { font-size: 19px; }
.app-nav a.active { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }

/* ============================================================
   Composants
   ============================================================ */
.eyebrow { margin: 6px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent); }
.h-display { margin: 0 0 18px; font-family:'Newsreader',serif; font-size: 32px; font-weight: 500; line-height: 1.1; color: var(--ink); }
.h-display em { font-style: italic; color: var(--soft); }
.h-section { margin: 24px 0 12px; font-family:'Newsreader',serif; font-size: 20px; font-weight: 500; color: var(--ink); }
.label-up { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--soft); }

/* Section pliable (ex. Sources) */
.fold { margin: 24px 0 0; }
.fold > .fold-sum { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px 2px; }
.fold > .fold-sum::-webkit-details-marker { display: none; }
.fold > .fold-sum .label-up { margin: 0; }
.fold > .fold-sum::after { content: '›'; margin-left: auto; font-size: 22px; line-height: 1; color: var(--soft); transition: transform .2s ease; }
.fold[open] > .fold-sum::after { transform: rotate(90deg); }
.fold-body { padding-top: 8px; }

/* Lignes chiffrées (page d'analyse) */
.an-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.35; }
.an-row:last-of-type { border-bottom: none; }
.an-num { flex: none; font-family:'Newsreader',serif; font-size: 20px; font-weight: 600; color: var(--ink); }
.an-num.accent { color: var(--accent); }
/* Lignes d'événements en double */
.dup-ev { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px dashed var(--line); }
.dup-ev:last-child { border-bottom: none; }
.dup-ev .grow { display: flex; flex-direction: column; min-width: 0; }
.dup-ev.keep { background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.dup-place { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-desc { font-size: 12px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-acts { flex: none; display: flex; align-items: center; gap: 6px; }
.dup-acts form { margin: 0; }
.muted { color: var(--soft); }

/* Stat cards */
.stats { display: flex; gap: 10px; margin-bottom: 22px; }
.stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px; }
.stat .num { font-family:'Newsreader',serif; font-size: 30px; font-weight: 500; color: var(--ink); line-height: 1; }
.stat .cap { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--soft); margin-top: 5px; }

/* Avatars (initiales) */
.av { border-radius: 50%; color: #FBF5E9; display: inline-flex; align-items: center; justify-content: center;
      font-family:'Newsreader',serif; font-weight: 500; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.av-xl { width: 96px; height: 96px; font-size: 38px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), 0 10px 24px -12px rgba(0,0,0,.4); }
.av-lg { width: 72px; height: 72px; font-size: 28px; }
.av-md { width: 48px; height: 48px; font-size: 18px; }
.av-sm { width: 40px; height: 40px; font-size: 15px; }
.av-photo { overflow: hidden; background: var(--card, #fff); }
.av-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Bouton accent plein */
.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--accent); color: #FBF5E9; border-radius: 14px;
  padding: 14px 18px; font-family:'Mulish',sans-serif; font-size: 15px; font-weight: 800;
  letter-spacing: .3px; text-align: center;
  box-shadow: 0 10px 22px -10px color-mix(in oklab, var(--accent) 60%, transparent);
}
.btn-block { width: 100%; display: block; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; font-weight: 700; }
.btn-danger { background: #b3261e; color: #fff; box-shadow: 0 10px 22px -10px rgba(179,38,30,.6); }
/* Bouton recherche FamilySearch (couleur de la marque) */
.fs-btn { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
    background: #1c6ea4; color: #fff; box-shadow: 0 10px 22px -10px rgba(28,110,164,.55); }
.fs-btn:hover { background: #185f8e; }
.fs-ico { font-size: 15px; line-height: 1; }
/* Boutons d'import (couleur distincte pour les différencier des autres actions) */
.btn-import { background: #2f7d78; color: #fff; box-shadow: 0 10px 22px -10px rgba(47,125,120,.55); }
.btn-import:hover { background: #286a66; }
/* Choix de rôle d'un collaborateur (boutons radio en cartes, avec explication) */
.role-pick { display: flex; flex-direction: column; gap: 8px; }
.role-opt { display: block; position: relative; border: 1.5px solid var(--line); border-radius: 12px;
    padding: 11px 12px 11px 40px; cursor: pointer; transition: border-color .15s, background .15s; }
.role-opt input { position: absolute; left: 14px; top: 14px; accent-color: var(--accent); }
.role-opt:hover { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.role-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, var(--card)); }
.role-opt .role-t { display: block; font-weight: 800; font-size: 14px; color: var(--ink); }
.role-opt .role-d { display: block; font-size: 12px; color: var(--soft); margin-top: 2px; line-height: 1.45; }
.btn-link { background: none; border: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 8px; font-size: 13px; }

/* Carte CTA dégradé */
.cta-card {
  width: 100%; text-align: left; border: none; cursor: pointer; display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 70%, #000 30%));
  border-radius: 20px; padding: 18px 20px; margin-bottom: 24px;
  box-shadow: 0 10px 24px -10px color-mix(in oklab, var(--accent) 60%, transparent);
}
.cta-card .k { display: block; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,.7); }
.cta-card .v { display: block; font-family:'Newsreader',serif; font-size: 21px; font-weight: 500; color: #FBF5E9; margin-top: 3px; }
.cta-card .arrow { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.cta-icon { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; flex: none; }
.cta-journal { background: linear-gradient(135deg, var(--gold), color-mix(in oklab, var(--gold) 70%, #000 30%)); box-shadow: 0 10px 24px -10px color-mix(in oklab, var(--gold) 60%, transparent); }

/* Liste de personnes (lignes) */
.person-row {
  width: 100%; text-align: left; border: none; cursor: pointer; background: transparent;
  padding: 10px 4px; display: flex; align-items: center; gap: 13px;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.person-row .nm { font-family:'Newsreader',serif; font-size: 17px; font-weight: 500; color: var(--ink); }
.person-row .sb { font-size: 12px; font-weight: 600; color: var(--soft); margin-top: 1px; }
.person-row .chev { color: var(--soft); font-size: 18px; margin-left: auto; }
.person-row .grow { flex: 1; min-width: 0; }

/* Carte (entourée) */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}
.card + .card { margin-top: 12px; }

/* Champs de formulaire */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--soft); margin: 0 0 6px 2px; }
.input, input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 13px;
  padding: 13px 15px; font-family:'Newsreader',serif; font-size: 17px; color: var(--ink); outline: none;
}
textarea { font-family:'Mulish',sans-serif; font-size: 15px; line-height: 1.5; resize: vertical; }
.input:focus, input:focus, textarea:focus, select:focus { border-color: var(--accent); }
/* Selects : flèche personnalisée + appearance native masquée */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237A6A52' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; background-size: 12px;
}
.input-error, .input-error:focus { border-color: #b3261e; background: color-mix(in srgb, #b3261e 5%, var(--card)); }
.form-error { margin: 10px 2px 0; font-size: 12.5px; font-weight: 700; color: #b3261e; line-height: 1.45; white-space: pre-line; }

/* Champ lieu avec autocomplétion + recherche en ligne */
.place-input { position: relative; }
.place-input input { width: 100%; padding-right: 46px; }
.place-online { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: none; cursor: pointer;
    border-radius: 10px; background: color-mix(in srgb, var(--ink) 6%, transparent); font-size: 16px; line-height: 1; }
.place-online:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.place-online.loading { opacity: .5; pointer-events: none; }
.place-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 6; overflow: hidden;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 30px -12px rgba(20,12,4,.45); max-height: 260px; overflow-y: auto; }
.place-suggest .ps-head { font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--soft); padding: 8px 12px 4px; }
.place-suggest button { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
    padding: 9px 12px; font-family:'Mulish',sans-serif; font-size: 13px; color: var(--ink); }
.place-suggest button:hover, .place-suggest button.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.place-suggest .ps-empty { padding: 10px 12px; font-size: 12px; color: var(--soft); }
.row-2 { display: flex; gap: 12px; }
.row-2 > * { flex: 1; }

/* Barre de recherche */
.searchbar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 40px; padding: 11px 16px; margin: 4px 0 8px; }
.searchbar input { flex: 1; min-width: 0; border: none; background: transparent; padding: 0; font-family:'Mulish',sans-serif; font-size: 15px; font-weight: 600; }
.searchbar input:focus { border: none; outline: none; }
.searchbar .ico { flex: none; color: var(--soft); font-size: 22px; line-height: 1; }

/* Contrôle segmenté + puces */
.segmented { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 40px; padding: 4px; margin: 4px 0 20px; }
.segmented a { flex: 1; text-align: center; padding: 9px 0; border-radius: 30px; font-size: 13px; font-weight: 700; color: var(--soft); text-decoration: none; }
.segmented a.active { background: var(--accent); color: #FBF5E9; }
.segmented .seg-ico { display: none; font-size: 18px; line-height: 1; }
.focus-chip .chip-short { display: none; }

/* --- Vue carte mobile/tablette (jusqu'au seuil sidebar 1024px) :
       onglets en icônes, libellés compacts --- */
@media (max-width: 1023px) {
    .segmented { gap: 2px; padding: 3px; margin: 4px 0 8px; }   /* moins d'écart sous les onglets */
    .segmented a { padding: 8px 0; }
    .segmented .seg-lbl { display: none; }
    .segmented .seg-ico { display: inline-block; }
    .tb-hide-mobile { display: none !important; }
    /* Barre de niveaux sur une seule ligne : presets ±1…±5 remplacés par la modale « Niveaux ±N » */
    .tree-toolbar { margin-top: 0; gap: 6px; flex-wrap: nowrap; }
    .seg-mini { display: none; }
    .seg-more .sm-pre { display: inline; }
    .focus-chip { flex: none; min-width: 0; padding-left: 4px; }
    .focus-chip .chip-full { display: none; }
    .focus-chip .chip-short { display: inline-block; vertical-align: middle; max-width: 38vw;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.chip { display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 30px; border: 1px solid var(--line); background: var(--card); color: var(--soft); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--accent); color: #FBF5E9; border-color: var(--accent); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
/* Chips contenant un bouton radio (choix obligatoire sans JS) */
.chip input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { background: var(--accent); color: #FBF5E9; border-color: var(--accent); }

/* Badges de rôle */
.badge { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .5rem; border-radius: 999px; background: var(--line); color: var(--soft); }
.badge-owner { background: color-mix(in oklab, var(--accent) 18%, var(--card)); color: var(--accent); }
.badge-editor { background: color-mix(in oklab, var(--gold) 20%, var(--card)); color: var(--gold); }
.badge-viewerplus { background: color-mix(in oklab, var(--gold) 14%, var(--card)); color: var(--gold); }
.badge-create { background: #e6f4ea; color: #2e7d32; }
.badge-update { background: #fff4e5; color: #9a6700; }
.badge-delete { background: #fdecea; color: #b3261e; }
.badge-merge  { background: #eef1f5; color: #506176; }
.badge-import { background: color-mix(in oklab, var(--accent) 16%, var(--card)); color: var(--accent); }
.badge-export { background: #eee; color: #555; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 12px; margin: 0 0 14px; font-weight: 600; font-size: 14px; }
.flash-ok { background: color-mix(in oklab, var(--accent) 14%, var(--card)); color: var(--accent); }
.flash-err { background: #fdecea; color: #b3261e; }

/* Chronologie */
.timeline { position: relative; padding-left: 4px; }
.tl-row { display: flex; gap: 16px; }
.tl-year { flex: none; width: 64px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; padding-top: 1px; }
.tl-y { font-family:'Newsreader',serif; font-size: 17px; font-weight: 600; color: var(--accent); line-height: 1.05; }
.tl-dm { font-family:'Newsreader',serif; font-size: 9px; font-weight: 500; color: var(--soft); line-height: 1.15; }
.tl-rail { flex: none; display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent); margin-top: 4px; }
.tl-line { flex: 1; width: 2px; background: var(--line); }
.tl-body { flex: 1; padding-bottom: 22px; }
.tl-title { font-family:'Newsreader',serif; font-size: 17px; font-weight: 500; color: var(--ink); line-height: 1.25; }
.tl-place { font-size: 12px; font-weight: 400; color: var(--soft); margin-top: 2px; }
/* Personne citée dans un titre de chronologie : lien vers sa fiche */
.tl-person { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.tl-person:hover { color: var(--accent); text-decoration-color: var(--accent); }
.tl-desc { font-size: 13px; color: var(--ink); line-height: 1.5; margin-top: 3px; white-space: pre-line; }
/* Notes sur la frise : pastille dorée + corps en retrait */
.tl-dot-note { background: var(--gold); box-shadow: 0 0 0 4px color-mix(in oklab, var(--gold) 22%, transparent); }
.tl-note { font-size: 14px; line-height: 1.55; color: var(--ink); margin-top: 4px;
    border-left: 2px solid color-mix(in oklab, var(--gold) 55%, transparent); padding-left: 10px; }
/* Événements de proches : pastille neutre, titre légèrement estompé */
.tl-dot-rel { width: 10px; height: 10px; background: var(--soft);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--soft) 16%, transparent); margin-top: 5px; }
.tl-row-rel .tl-title { color: var(--soft); font-style: italic; }
/* Âge de la personne à l'événement (sous le mois/jour) */
.tl-age { font-family:'Mulish',sans-serif; font-size: 9px; font-weight: 800; font-style: normal; color: var(--soft); white-space: nowrap; margin-top: 1px; }
/* Section « Sans date » : cartes simples sous la frise */
.tl-undated { display: flex; flex-direction: column; gap: 10px; }
.tl-card { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--card); }
.tl-card .tl-note { margin-top: 6px; }
/* Date affichée en tête d'une note + champs de saisie de dates */
.note-date { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.note-dates-row { display: flex; gap: 8px; margin-top: 6px; }
.note-dates-row input { flex: 1; min-width: 0; }

/* Galerie médias */
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.media-tile { position: relative; }
.media-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; }
.media-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: center; padding: 8px; }
.media-doc .ic { font-size: 30px; }
.media-doc .nm { font-size: 10px; color: var(--soft); word-break: break-word; line-height: 1.2; }
/* Légende / titre éditable sous chaque média */
.media-cap { margin-top: 5px; }
.media-cap-in { width: 100%; border: 1px solid transparent; border-radius: 7px; background: transparent; padding: 3px 6px;
    font-size: 11px; line-height: 1.3; color: var(--ink); text-align: center; cursor: text; transition: border-color .15s, background .15s; }
.media-cap-in::placeholder { color: var(--soft); font-style: italic; }
.media-cap-in:hover { border-color: var(--line); }
.media-cap-in:focus { outline: none; border-color: var(--accent); background: var(--card); text-align: left; }
.media-cap-in.saved { border-color: color-mix(in oklab, #2e7d32 55%, var(--line)); }
.media-cap-in.err { border-color: #c0392b; }
.media-cap-ro { display: block; margin-top: 5px; font-size: 11px; line-height: 1.3; color: var(--soft); text-align: center; word-break: break-word; }

/* Notes internes (privées, propriétaire/admin) — liste multi-notes sur un seul champ */
.int-notes { background: color-mix(in oklab, var(--gold) 7%, var(--card)); border: 1px solid color-mix(in oklab, var(--gold) 28%, var(--line)); }
.int-notes-head { margin-bottom: 9px; }
.int-notes-title { font-size: 12px; font-weight: 800; letter-spacing: .3px; color: var(--ink); }
.int-notes-title .muted { font-weight: 700; }
.int-notes-new { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.int-notes-input { width: 100%; box-sizing: border-box; resize: vertical; min-height: 52px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--card); padding: 9px 12px; font-family: inherit; font-size: 14px; line-height: 1.5; color: var(--ink); }
.int-notes-input:focus { outline: none; border-color: var(--accent); }
.int-notes .int-notes-add { align-self: flex-start; padding: 8px 16px; font-size: 13px; }
.int-notes-list { display: flex; flex-direction: column; gap: 8px; }
.int-notes-empty { font-size: 12px; margin: 2px 0; }
.int-note { display: flex; align-items: flex-start; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.int-note-main { flex: 1; min-width: 0; }
.int-note-date { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .4px; color: var(--accent); margin-bottom: 3px; }
.int-note-body { font-size: 14px; line-height: 1.5; color: var(--ink); word-break: break-word; }
.int-note-del { flex: none; border: 1px solid var(--line); background: var(--paper); color: var(--soft); border-radius: 8px;
    padding: 4px 8px; font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; white-space: nowrap; }
.int-note-del:hover { border-color: #c0392b; color: #c0392b; }
.int-note-del.confirm { background: #c0392b; border-color: #c0392b; color: #fff; }
.int-notes-status { min-height: 16px; margin-top: 8px; font-size: 11px; font-weight: 700; }
.int-notes-status.ok { color: #2e7d32; }
.int-notes-status.err { color: #c0392b; }
.media-actions { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 4px; }
.media-actions form { margin: 0; }

/* Boutons d'action en icône (notes, documents, lightbox) */
.icon-act { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
    transition: background .15s, border-color .15s, color .15s; }
.icon-act:hover { background: var(--accent); border-color: var(--accent); color: #FBF5E9; }
.icon-act.icon-danger:hover { background: #b3261e; border-color: #b3261e; color: #fff; }
.note-acts { display: flex; align-items: center; gap: 8px; }
.note-acts form { margin: 0; }

/* Mention d'une personne dans une note : lien vers sa fiche */
.note-mention { color: var(--accent); font-weight: 600; text-decoration: none; }
.note-mention:hover { text-decoration: underline; }

/* Auto-complétion « @ » dans la saisie de note */
.mention-pop { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin-top: 4px;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16); max-height: 220px; overflow-y: auto; }
.mention-item { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left;
    padding: 9px 12px; background: none; border: 0; cursor: pointer; font: inherit; }
.mention-item + .mention-item { border-top: 1px solid var(--line); }
.mention-item.is-active, .mention-item:hover { background: color-mix(in oklab, var(--accent) 12%, var(--card)); }
.mention-item .mn-n { color: var(--ink); }
.mention-item .mn-y { color: var(--soft); font-size: 12px; margin-left: auto; }
.note-edit { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.icon-act.icon-sm { width: 28px; height: 28px; font-size: 12px; }
/* Actions d'édition sur un événement de la timeline (fiche) */
.tl-title:has(.tl-acts) { display: flex; align-items: flex-start; gap: 8px; }
.tl-title-txt { flex: 1; min-width: 0; }
.tl-acts { flex: none; display: flex; align-items: center; gap: 6px; }
.tl-acts form { margin: 0; }

/* Tuile image cliquable (ouvre la lightbox) */
.media-open { display: block; width: 100%; padding: 0; border: none; background: none; cursor: pointer; position: relative; border-radius: 12px; }
.media-open img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; transition: filter .15s; }
.media-open:hover img { filter: brightness(.93); }
.media-badge { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #FBF5E9;
    font-size: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px -1px rgba(0,0,0,.4); }
.media-del { position: absolute; top: 5px; right: 5px; margin: 0; }
.media-del .icon-act { width: 28px; height: 28px; font-size: 12px; background: color-mix(in srgb, var(--paper) 82%, transparent); }

/* Lightbox média */
.lightbox { position: fixed; inset: 0; z-index: 95; visibility: hidden; }
.lightbox.open { visibility: visible; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(20,12,4,.55); opacity: 0; transition: opacity .25s ease; }
.lightbox.open .lb-backdrop { opacity: 1; }
/* Panneau type bottom sheet (comme les modales d'ajout) */
.lb-sheet { position: absolute; left: 50%; bottom: 0; width: min(680px, 100%); max-height: 92vh; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 18px max(18px, env(safe-area-inset-bottom)); overflow-y: auto;
    box-shadow: 0 -18px 50px -20px rgba(20,12,4,.6);
    transform: translate(-50%, 100%); transition: transform .34s cubic-bezier(.32,.72,0,1); }
.lightbox.open .lb-sheet { transform: translate(-50%, 0); }
.lb-stage { position: relative; display: inline-block; line-height: 0; max-width: 100%; touch-action: none; user-select: none; }
.lb-img { max-width: 100%; max-height: 62vh; border-radius: 12px; display: block; }
.lb-stage .crop-box[hidden] { display: none; }
.lb-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .lb-sheet { transition: none; } }

/* Modale de confirmation (suppression) — au-dessus de tout */
.confirm-modal { position: fixed; inset: 0; z-index: 120; visibility: hidden; }
.confirm-modal.open { visibility: visible; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(20,12,4,.55); opacity: 0; transition: opacity .25s ease; }
.confirm-modal.open .confirm-backdrop { opacity: 1; }
.confirm-box { position: absolute; left: 50%; bottom: 0; width: min(460px, 100%); box-sizing: border-box; text-align: center;
    background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 22px max(22px, env(safe-area-inset-bottom));
    box-shadow: 0 -18px 50px -20px rgba(20,12,4,.6);
    transform: translate(-50%, 100%); transition: transform .34s cubic-bezier(.32,.72,0,1); }
.confirm-modal.open .confirm-box { transform: translate(-50%, 0); }
.confirm-ic { width: 52px; height: 52px; margin: 8px auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 24px; background: color-mix(in srgb, #b3261e 14%, var(--card)); }
.confirm-msg { margin: 0 0 20px; font-size: 18px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) { .confirm-box { transition: none; } }

/* Recadrage / rotation d'avatar */
.crop-modal { position: fixed; inset: 0; z-index: 130; visibility: hidden; }
.crop-modal.open { visibility: visible; }
.crop-backdrop { position: absolute; inset: 0; background: rgba(20,12,4,.6); opacity: 0; transition: opacity .2s ease; }
.crop-modal.open .crop-backdrop { opacity: 1; }
.crop-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-46%); opacity: 0;
    width: min(360px, calc(100% - 28px)); box-sizing: border-box; text-align: center;
    background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 20px 20px max(20px, env(safe-area-inset-bottom));
    box-shadow: 0 24px 60px -18px rgba(20,12,4,.6); transition: transform .28s cubic-bezier(.32,.72,0,1), opacity .28s ease; }
.crop-modal.open .crop-box { transform: translate(-50%,-50%); opacity: 1; }
.crop-title { margin: 0 0 14px; font-size: 19px; font-weight: 500; color: var(--ink); }
.crop-stage { position: relative; margin: 0 auto 14px; border-radius: 14px; overflow: hidden; background: #1c1710; touch-action: none; }
.crop-canvas { display: block; cursor: grab; }
.crop-canvas:active { cursor: grabbing; }
.crop-ring { position: absolute; inset: 0; pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(20,12,4,.42) inset; border-radius: 50%; }
.crop-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.crop-controls .crop-zoom { flex: 1; accent-color: var(--accent); }
.crop-actions { display: flex; gap: 10px; }
.crop-actions .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) { .crop-box { transition: none; } }
.lb-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 22px; border: none; cursor: pointer;
    background: transparent; color: var(--ink); font-family:'Mulish',sans-serif; font-size: 13px; font-weight: 700; text-decoration: none; }
.lb-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.lb-btn.accent { background: var(--accent); color: #FBF5E9; }
.lb-btn.accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.lb-btn.danger { color: #b3261e; }
.lb-btn.danger:hover { background: color-mix(in srgb, #b3261e 12%, transparent); }
.lb-icon { width: 38px; padding: 0; justify-content: center; font-size: 17px; }
.lb-x { position: absolute; top: 12px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); cursor: pointer;
    background: rgba(20,12,4,.62); color: #fff; font-size: 21px; line-height: 1; z-index: 5; padding: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 12px -2px rgba(0,0,0,.6); }
.lb-x:hover { background: rgba(20,12,4,.85); }

/* Éditeur d'image (recadrage) */
.crop-stage { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; }
.crop-stage img { max-width: 100%; display: block; border-radius: 8px; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; }
.crop-handle { position: absolute; width: 16px; height: 16px; background: #fff; border: 1px solid var(--accent); border-radius: 50%; }
.crop-handle.tl { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-handle.tr { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-handle.bl { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-handle.br { right: -8px; bottom: -8px; cursor: nwse-resize; }

/* État vide */
.empty { text-align: center; padding: 40px 16px; color: var(--soft); }
.empty .big { font-size: 40px; opacity: .5; }
.empty p { font-family:'Newsreader',serif; font-size: 17px; color: var(--ink); margin: 12px 0 4px; }

/* Toast */
.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 700; padding: 11px 18px; border-radius: 30px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.5); z-index: 40; animation: toastIn .3s ease both; }

/* ===== Bottom sheets (modales montant du bas) ===== */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,12,4,.45); opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease; z-index: 90; }
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet { position: fixed; left: 50%; bottom: 0; width: min(560px, 100%); z-index: 91; visibility: hidden;
    background: var(--paper); border-radius: 22px 22px 0 0;
    padding: 8px 22px max(24px, env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto;
    box-shadow: 0 -18px 50px -20px rgba(20,12,4,.6);
    transform: translate(-50%, 100%); transition: transform .34s cubic-bezier(.32,.72,0,1), visibility 0s linear .34s; }
.sheet.open { transform: translate(-50%, 0); visibility: visible; transition: transform .34s cubic-bezier(.32,.72,0,1), visibility 0s; }
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 16px; }
.sheet-title { font-size: 20px; font-weight: 600; color: var(--ink); }
.sheet-close { flex: none; width: 34px; height: 34px; border: none; border-radius: 50%; cursor: pointer;
    background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--soft); font-size: 22px; line-height: 1; }
.sheet-close:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink); }
.sheet-file { width: 100%; font-size: 14px; }
/* Zone de dépôt de fichier (avec aperçu) */
.filedrop { display: block; position: relative; border: 1.5px dashed var(--line); border-radius: 14px; padding: 22px 16px;
    text-align: center; cursor: pointer; background: color-mix(in srgb, var(--ink) 2%, var(--card)); transition: border-color .2s, background .2s; }
.filedrop:hover, .filedrop.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.filedrop-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.filedrop [hidden] { display: none !important; }   /* prime sur les display des classes ci-dessous */
.filedrop-empty { display: block; }
.filedrop-ic { display: block; font-size: 26px; color: var(--accent); margin-bottom: 6px; }
.filedrop-main { display: block; font-weight: 700; font-size: 14px; color: var(--ink); }
.filedrop-sub { display: block; font-size: 11px; color: var(--soft); margin-top: 3px; }
.filedrop-preview { display: flex; align-items: center; gap: 12px; text-align: left; }
.filedrop-thumb { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; flex: none; background: var(--line); }
.filedrop-doc { width: 60px; height: 60px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 26px; flex: none; background: color-mix(in srgb, var(--gold) 22%, var(--card)); }
.filedrop-info { min-width: 0; flex: 1; }
.filedrop-name { display: block; font-weight: 700; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filedrop-meta { display: block; font-size: 11px; color: var(--soft); margin-top: 2px; }
.filedrop-clear { flex: none; font-size: 12px; }
html.sheet-lock, html.sheet-lock body { overflow: hidden; }
html.sheet-lock .app-scroll { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }

/* Centres / détail arbre */
.center-stack { text-align: center; }
.center-focus {
  display: inline-flex; flex-direction: column; align-items: center; gap: 9px;
  background: linear-gradient(150deg, var(--card), color-mix(in oklab, var(--card) 86%, var(--gold) 14%));
  border: 1.5px solid var(--accent); border-radius: 20px; padding: 18px 22px; cursor: pointer;
  box-shadow: 0 12px 26px -14px color-mix(in oklab, var(--accent) 55%, transparent);
}
.mini-card { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; width: 142px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 11px 9px; cursor: pointer; text-decoration: none; }
.mini-card .nm { font-family:'Newsreader',serif; font-size: 14px; font-weight: 500; color: var(--ink); text-align: center; line-height: 1.1; }
.mini-card .yr { font-size: 10px; font-weight: 700; color: var(--soft); }
.connector { width: 1px; height: 22px; background: var(--line); margin: 6px auto; }

/* Centrage des pages auth / landing */
.center-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 28px 18px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; width: 100%; max-width: 400px; box-shadow: 0 30px 70px -30px rgba(40,28,12,.5); }
.auth-card .brand { display: block; font-family:'Newsreader',serif; font-size: 24px; color: var(--ink); margin-bottom: 4px; }
.auth-card h1 { font-family:'Newsreader',serif; font-weight: 500; font-size: 26px; margin: 6px 0 18px; }
.stack > * + * { margin-top: 14px; }

/* ============================================================
   Arbre — barre d'outils + conteneur family-chart
   ============================================================ */
.tree-toolbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }
.seg-mini { display: inline-flex; align-items: center; gap: 3px; height: 34px; box-sizing: border-box;
    background: var(--card); border: 1px solid var(--line); border-radius: 30px; padding: 3px; }
.seg-mini a { padding: 5px 12px; border-radius: 24px; font-size: 12px; font-weight: 700; color: var(--soft); text-decoration: none; }
.seg-mini a.active { background: var(--accent); color: #FBF5E9; }
.seg-more { display: inline-flex; align-items: center; height: 34px; box-sizing: border-box; padding: 0 16px;
    border: 1px solid var(--line); border-radius: 30px; background: var(--card); white-space: nowrap;
    font-size: 12px; font-weight: 800; color: var(--soft); cursor: pointer; }
.seg-more .sm-pre { display: none; }   /* libellé « Niveaux » affiché seulement sur mobile */
.seg-more:hover { border-color: var(--accent); color: var(--accent); }

/* Modale « nombre de niveaux » : sélecteur défilant de chiffres */
.lvl-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; }
.lvl-modal[hidden] { display: none; }
.lvl-backdrop { position: absolute; inset: 0; background: rgba(20,12,4,.46); backdrop-filter: blur(2px); }
.lvl-sheet { position: relative; width: min(280px, 88vw); background: var(--card); border: 1px solid var(--line);
    border-radius: 22px; box-shadow: 0 24px 60px -20px rgba(20,12,4,.6); padding: 16px; }
.lvl-head { text-align: center; font-family: 'Newsreader', serif; font-size: 17px; color: var(--ink); margin-bottom: 12px; }
.lvl-scroll { height: 210px; overflow-y: auto; scroll-snap-type: y mandatory; border: 1px solid var(--line);
    border-radius: 16px; padding: 84px 0; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
            mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent); }
.lvl-opt { display: block; width: 100%; border: none; background: transparent; cursor: pointer;
    scroll-snap-align: center; height: 42px; font-family: 'Newsreader', serif; font-size: 18px; font-weight: 600;
    color: var(--soft); transition: color .15s ease, transform .15s ease; }
.lvl-opt:hover { color: var(--ink); }
.lvl-opt.sel { color: var(--accent); font-size: 24px; font-weight: 800; transform: scale(1.05); }
.lvl-foot { margin-top: 12px; }
body.lvl-open { overflow: hidden; }

/* Modale d'actions sur une personne (recherche) — feuille du bas */
.pa-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.pa-modal[hidden] { display: none; }
.pa-backdrop { position: absolute; inset: 0; background: rgba(20,12,4,.46); backdrop-filter: blur(2px); }
.pa-sheet { position: relative; width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--line); border-bottom: none;
    border-radius: 24px 24px 0 0; box-shadow: 0 -18px 50px -18px rgba(20,12,4,.55);
    padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
    animation: pa-up .24s cubic-bezier(.22,.61,.36,1); }
.pa-sheet::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 12px; }
@keyframes pa-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .pa-sheet { animation: none; } }
/* Mêmes infos et même ordre que le panneau latéral de l'arbre */
.pa-av { display: flex; justify-content: center; }
.pa-av .av { width: 64px; height: 64px; font-size: 22px; }
.pa-name { text-align: center; font-family: 'Newsreader', serif; font-size: 19px; color: var(--ink); margin-top: 10px; }
.pa-sub { text-align: center; font-size: 13px; font-weight: 600; color: var(--soft); margin-top: 2px; }
.pa-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* Légende des différentes vues, sous le cadre de l'arbre */
.tree-legend { margin: 18px 2px 4px; }
.tree-legend .tlg-title { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
    color: var(--soft); margin: 0 2px 10px; }
.tlg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.tlg-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line);
    border-radius: 14px; background: var(--card); text-decoration: none; transition: border-color .15s ease, background .15s ease; }
.tlg-item:hover { border-color: var(--accent); }
.tlg-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card));
    box-shadow: inset 0 0 0 1px var(--accent); }
.tlg-ico { font-size: 18px; line-height: 1.1; flex: none; }
.tlg-txt { min-width: 0; }
.tlg-name { display: block; font-weight: 800; font-size: 13px; color: var(--ink); }
.tlg-desc { display: block; font-size: 12px; color: var(--soft); margin-top: 2px; line-height: 1.3; }
.focus-chip { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 40px; padding: 5px 14px 5px 6px; text-decoration: none; }
.focus-chip .serif { font-size: 15px; color: var(--ink); }

.tree-marks { display: inline-flex; align-items: center; gap: 5px; }
.tag-ico { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 1px 3px -1px rgba(0,0,0,.3); }
.tag-ico svg { width: 14px; height: 14px; display: block; }
.tag-photo { background: var(--accent); }
.tag-note { background: var(--gold); }
.tag-gazette { background: #6f7e8c; }
.tag-recit { background: #8a6f9c; }
.tag-memoire { background: #7a8a5e; }

/* Bouton « La Gazette » (modale d'actions) : teinte douce, liée au badge Gazette */
.btn.pa-gz { background: #eef1f4; color: #46505c; border: 1px solid #d8dee5; }
.btn.pa-gz:hover { background: #e4e9ef; border-color: #c7cfd8; }

/* Filtre avancé (recherche) */
.filter-ico { width: 17px; height: 17px; vertical-align: -3px; margin-right: 6px; }
.filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
    padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; margin-left: 4px; }
.facet-row { display: flex; gap: 8px; flex-wrap: wrap; }
.facet { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 1px solid var(--line);
    border-radius: 30px; background: var(--card); color: var(--soft); font-size: 13px; font-weight: 700; cursor: pointer; }
.facet.on { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.facet-years { display: flex; align-items: center; gap: 10px; }
.facet-years input { width: 130px; }
.facet-years .sep { color: var(--soft); }
.facet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.mini-card .tree-marks { margin-top: 3px; }
.person-row .tree-marks { margin-right: 4px; }

/* Conteneur family-chart (vue Arbre) */
.fc-tree { position: relative; width: 100%; height: 72vh; min-height: 480px; border: 1px solid var(--line); border-radius: 18px;
    overflow: hidden; background: radial-gradient(70% 60% at 50% 34%, color-mix(in oklab, var(--card) 55%, transparent) 0%, transparent 72%); }
/* Vue carte mobile/tablette : zone d'arbre plus basse pour moins de vide. */
@media (max-width: 1023px) { .fc-tree { height: 52vh; min-height: 340px; } }
@media (min-width: 1024px) { .fc-tree { height: calc(100vh - 290px); min-height: 460px; } }

/* Contrôles de zoom (bas droite) */
.fc-count { position: absolute; top: 14px; left: 14px; z-index: 6; pointer-events: none;
    background: var(--card); border: 1px solid var(--line); border-radius: 40px; padding: 6px 14px;
    font-size: 12px; font-weight: 800; color: var(--ink); letter-spacing: .2px;
    box-shadow: 0 6px 18px -8px rgba(20,12,4,.4); }
.fc-count::before { content: "👥 "; }

.fc-zoom { position: absolute; bottom: 16px; right: 16px; display: flex; align-items: center; gap: 5px;
    background: var(--card); border: 1px solid var(--line); border-radius: 40px; padding: 5px;
    box-shadow: 0 10px 26px -10px rgba(20,12,4,.42); z-index: 6; }
.fc-zoom button { min-width: 36px; height: 36px; border: none; border-radius: 50%; background: transparent;
    color: var(--ink); font-size: 19px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fc-zoom button[data-z="reset"] { min-width: 48px; font-size: 12px; font-weight: 800; color: var(--soft); border-radius: 24px; margin: 0 -2px; }
.fc-zoom button[data-z="out"], .fc-zoom button[data-z="in"] { min-width: 34px; font-size: 24px; font-weight: 800; }
.fc-zoom button.accent { background: var(--accent); color: #FBF5E9; font-size: 24px; font-weight: 900; }
.fc-zoom button.fc-half { background: #2f9e44; color: #fff; font-size: 18px; font-weight: 700; line-height: 1; margin-right: 3px; }
.fc-zoom .fc-zoom-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
/* Liens (family-chart est thémé sombre → on force une couleur visible sur fond clair) */
.fc-tree .link { stroke: color-mix(in oklab, var(--ink) 42%, transparent); stroke-width: 1.5px; }
.fc-tree .link.f3-path-to-main { stroke: var(--accent); }

/* Cartes HTML personnalisées */
.fc-card { position: relative; box-sizing: border-box; width: 308px; display: flex; align-items: center; gap: 14px;
    padding: 11px 13px; border-radius: 15px; border: 1px solid var(--line); color: var(--ink); cursor: pointer;
    pointer-events: auto;   /* family-chart met .card_cont en pointer-events:none ; on réactive l'interaction */
    box-shadow: 0 7px 18px -11px rgba(20,12,4,.45); }
.fc-card.card-male       { background: color-mix(in srgb, #6f8088 30%, var(--card)); }   /* bleu-gris pâle */
.fc-card.card-female     { background: color-mix(in srgb, #b27f73 32%, var(--card)); }   /* rose-terre pâle */
.fc-card.card-genderless { background: color-mix(in srgb, #a59079 28%, var(--card)); }   /* sable pâle */
.fc-card.fc-main { box-shadow: 0 0 0 2.5px var(--accent), 0 10px 22px -10px rgba(20,12,4,.5);
    animation: fc-main-glow 2.6s ease-in-out infinite; }
/* Halo très léger qui « respire » pour repérer la carte active */
@keyframes fc-main-glow {
    0%, 100% { box-shadow: 0 0 0 2.5px var(--accent), 0 10px 22px -10px rgba(20,12,4,.5); }
    50%      { box-shadow: 0 0 0 2.5px var(--accent), 0 10px 24px -9px rgba(20,12,4,.55),
                           0 0 16px 2px color-mix(in oklab, var(--accent) 38%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .fc-card.fc-main { animation: none; } }
/* Wrapper de positionnement (porte le centrage), pour glisser l'indicateur DERRIÈRE la carte. */
.fc-cardpos { position: relative; width: 308px; }
/* Indicateur d'ascendants non affichés — « mini-tree » de family-chart (SVG : deux rects
   père/mère + traits gris). PAS de z-index → la carte (après dans le DOM) passe devant. */
.fc-asc { position: absolute; top: -18px; right: 16px; width: 54px; height: auto; display: block; pointer-events: none; }
/* En arbre horizontal, l'indicateur d'ascendants « au-dessus » n'a plus de sens. */
.fc-h .fc-asc { display: none; }
.fc-av { flex: none; width: 58px; height: 58px; border-radius: 50%; overflow: hidden;
    background: color-mix(in srgb, var(--card) 70%, #fff); display: flex; align-items: center; justify-content: center; }
.fc-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-av-default { width: 100%; height: 100%; opacity: .28;
    background: center 62% / 78% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232C2113'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0 2c-5 0-9 2.7-9 6v2h18v-2c0-3.3-4-6-9-6z'/%3E%3C/svg%3E"); }
.fc-info { flex: 1; min-width: 0; line-height: 1.2; padding-right: 6px; }
.fc-given   { font-family:'Newsreader',serif; font-size: 19px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-surname { font-family:'Newsreader',serif; font-size: 19px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.fc-dates   { font-family:'Newsreader',serif; font-size: 19px; font-weight: 500; color: var(--soft); margin-top: 5px; }
.fc-marks { position: absolute; bottom: 7px; right: 9px; display: flex; gap: 4px; }
.fc-mark { width: 21px; height: 21px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.fc-mark svg { width: 13px; height: 13px; display: block; }
.fc-mark-photo { background: var(--accent); }
.fc-mark-note  { background: var(--gold); }
.fc-fiche { position: absolute; top: 6px; right: 7px; width: 22px; height: 22px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
    background: color-mix(in srgb, var(--card) 60%, #fff); color: var(--ink); font: italic 800 14px/22px 'Newsreader', serif;
    text-align: center; text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); }
.fc-fiche:hover { background: var(--accent); color: #FBF5E9; }

/* ====== Médaillons (cf. exemple 11 « Card styling ») : photo ronde + nom ====== */
.fc-medaillon .fc-cardpos { width: auto; }
.fc-medaillon .fc-asc { right: auto; left: 50%; transform: translateX(-50%); top: -14px; width: 46px; }
.fc-card.fc-med { width: 134px; flex-direction: column; align-items: center; gap: 8px;
    background: transparent; border: none; box-shadow: none; padding: 0; overflow: visible; }
.fc-card.fc-med .fc-med-photo { width: 92px; height: 92px; border-radius: 50%; overflow: hidden;
    border: 3px solid var(--line); background: var(--card); box-shadow: 0 6px 16px -8px rgba(20,12,4,.5);
    transition: transform .2s ease, box-shadow .2s ease; }
.fc-card.fc-med .fc-med-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-card.fc-med .fc-med-photo .fc-av-default { display: block; width: 100%; height: 100%; opacity: .28; }
.fc-card.fc-med.card-male       .fc-med-photo { border-color: rgb(120,159,172); }
.fc-card.fc-med.card-female     .fc-med-photo { border-color: rgb(196,138,146); }
.fc-card.fc-med.card-genderless .fc-med-photo { border-color: #c8bca8; }
.fc-card.fc-med:hover .fc-med-photo { transform: scale(1.06); }
.fc-card.fc-med .fc-med-label { text-align: center; max-width: 134px; }
.fc-card.fc-med .fc-med-name { font-family: 'Newsreader', serif; font-size: 15px; color: var(--ink); line-height: 1.15; }
.fc-card.fc-med .fc-med-name b { font-weight: 600; letter-spacing: .2px; }
.fc-card.fc-med .fc-med-dates { font-family: 'Newsreader', serif; font-size: 12px; color: var(--soft); margin-top: 2px; }
/* Carte active : on met en avant la photo, pas le conteneur transparent. */
.fc-card.fc-med.fc-main { box-shadow: none; animation: none; }
.fc-card.fc-med.fc-main .fc-med-photo { transform: scale(1.12);
    box-shadow: 0 0 0 3px var(--accent), 0 0 18px 2px color-mix(in oklab, var(--accent) 40%, transparent); }
.fc-card.fc-med .fc-marks { top: 4px; left: 4px; right: auto; bottom: auto; }
.fc-card.fc-med .fc-fiche { top: 2px; right: 8px; }

/* Panneau latéral d'une carte (bouton « i ») */
.fc-side { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 90%); z-index: 30;
    background: var(--card); border-left: 1px solid var(--line); box-shadow: -14px 0 36px -18px rgba(20,12,4,.5);
    transform: translateX(102%); transition: transform .28s ease; overflow-y: auto; }
.fc-side.open { transform: none; }
.fc-side-close { position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border: none; cursor: pointer;
    border-radius: 50%; background: transparent; color: var(--soft); font-size: 22px; line-height: 1; }
.fc-side-close:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.fc-side-body { padding: 30px 22px 22px; text-align: center; }
.fc-side-body.is-tl { padding-left: 11px; padding-right: 11px; }   /* frise : marges latérales réduites */
.fc-side-av { width: 96px; height: 96px; margin: 6px auto 14px; border-radius: 50%; overflow: hidden;
    background: color-mix(in srgb, var(--ink) 8%, var(--card)); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--line); }
.fc-side-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-side-av .fc-av-default { display: block; width: 100%; height: 100%; opacity: .3;
    background: center/58% no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23000" d="M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0 2c-5 0-9 2.5-9 6v2h18v-2c0-3.5-4-6-9-6z"/></svg>'); }
.fc-side-name { font-family:'Newsreader',serif; font-size: 21px; color: var(--ink); line-height: 1.2; }
.fc-side-surname { font-family:'Newsreader',serif; font-size: 21px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.fc-side-dates { font-family:'Newsreader',serif; font-size: 15px; color: var(--soft); margin-top: 6px; }
.fc-side-badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 16px 0 4px; }
.fc-side-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 700; color: #FBF5E9; }
.fc-side-badge svg { width: 14px; height: 14px; display: block; }
.fc-side-badge.badge-photo { background: var(--accent); }
.fc-side-badge.badge-note  { background: var(--gold); }
.fc-side-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
/* Chronologie affichée dans le panneau */
.fc-side-tlhead { display: flex; align-items: center; gap: 8px; text-align: left; margin-bottom: 10px; }
.fc-side-back { flex: none; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
    background: var(--card); color: var(--ink); font-size: 20px; line-height: 1; }
.fc-side-back:hover { background: var(--accent); color: #FBF5E9; border-color: var(--accent); }
.fc-side-tlname { font-family:'Newsreader',serif; font-size: 16px; font-weight: 600; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-side-tl { text-align: left; }
.fc-side-tl .timeline { padding-left: 0; }
.fc-side-tl .tl-year { width: 56px; }
.fc-side-tl .tl-body { padding-bottom: 16px; }

/* ============================================================
   DESKTOP : sidebar + zone principale large
   (placé en fin de fichier pour primer sur les règles mobiles)
   ============================================================ */
@media (min-width: 1024px) {
  body { padding: 0; background: var(--paper); }
  .app { max-width: none; width: 100%; height: 100vh; min-height: 0; margin: 0; border-radius: 0; box-shadow: none; flex-direction: row; }
  .sidebar { display: flex; }                  /* sidebar visible */
  .app-nav { display: none !important; }       /* bottom-nav masquée */
  .has-sidebar .app-header .theme-btn { display: none; }
  .app-header { height: 54px; padding: 0 32px; }
  .app-title { font-size: 24px; }
  .app-body { max-width: 1120px; padding: 2px 40px 64px; }
  .app-body-wide { max-width: none; }   /* l'onglet Arbre occupe toute la largeur */
  /* Pages sans sidebar (ex. « Mes arbres ») : on centre la colonne de contenu
     dans la fenêtre au lieu de la coller au bord gauche. */
  body:not(.has-sidebar) .app-body { margin-left: auto; margin-right: auto; }
}

/* ============================================================
   IMPRESSION : on masque la navigation et les actions,
   on déplie le contenu sur fond blanc.
   ============================================================ */
@media print {
  .sidebar, .app-header, .app-nav, .theme-btn, .no-print,
  .fc-zoom, .sheet, .sheet-backdrop, .lightbox, .confirm-modal { display: none !important; }
  html, body { background: #fff !important; }
  .app, .app-main, .app-scroll { display: block !important; overflow: visible !important; height: auto !important; min-height: 0 !important; }
  .app { max-width: none !important; width: auto !important; margin: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
  .app-body { max-width: none !important; padding: 0 !important; margin: 0 !important; animation: none !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #bbb !important; }
  .person-row { break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
}

/* Boutons d'action du récit (Copier / Imprimer / Régénérer) — uniformes desktop & mobile */
.st-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.st-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding-left: 8px; padding-right: 8px; }
.st-actions .st-ico { font-size: 16px; line-height: 1; flex: none; }
@media (max-width: 480px) {
    .st-actions { gap: 6px; }
    .st-actions .btn { font-size: 12px; padding-left: 4px; padding-right: 4px; }
}

/* Footer (bottom-nav) : en flux, dernier enfant de l'app-shell → toujours visible
   en bas, sans position:fixed (cf. .app en hauteur d'écran). */
@media (max-width: 1023px) {
    .app-nav {
        border-top: 1px solid var(--line);
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
}

/* Récits générés (sur la fiche) */
.story-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 11px 14px; margin-bottom: 8px; }
.story-card > summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; }
.story-card > summary::-webkit-details-marker { display: none; }
.story-card > summary::marker { content: ''; }
.story-sum-t { font-family: 'Newsreader', serif; font-weight: 600; font-size: 15px; color: var(--ink); }
.story-sum-m { font-size: 12px; white-space: nowrap; }
.story-text { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-family: 'Newsreader', serif; font-size: 15px; line-height: 1.6; color: var(--ink); }

/* Cartes de statistiques (suivi des coûts) — hauteur uniforme */
.cost-stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.cost-stats .card { display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 14px 8px; min-height: 72px; margin: 0; }
.cost-stats .card .v { font-family: 'Newsreader', serif; font-size: 20px; color: var(--ink); line-height: 1.1; white-space: nowrap; }
.cost-stats .card .k { font-size: 11px; color: var(--soft); margin-top: 4px; }

/* Rangée d'actions de la fiche (Chronologie / Imprimer / Modifier) — uniformes */
.fiche-actions { display: flex; gap: 8px; margin: 14px 0 8px; }
.fiche-actions .btn { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 12px 8px; white-space: nowrap; }
.fiche-actions .fa-ico { font-size: 16px; line-height: 1; flex: none; }
@media (max-width: 600px) {
    /* Sur mobile : on ne garde que les logos des 4 boutons du haut de la fiche. */
    .fiche-actions .btn span:not(.fa-ico) { display: none; }
    .fiche-actions .btn { gap: 0; padding: 12px 4px; }
    .fiche-actions .fa-ico { font-size: 19px; }
}
@media (max-width: 430px) {
    .fiche-actions { gap: 6px; }
}
