:root {
  --papier: #f6f1e7;
  --carte: #fffdf8;
  --encre: #1f2d27;
  --doux: #5b6b62;
  --pale: #8c968f;
  --accent: #a8502f;
  --accent-fonce: #8a3f24;
  --accent-pale: #f3e2d8;
  --vert: #2f5d4a;
  --vert-pale: #e3ece6;
  --filet: #e2d9c8;
  --filet-fort: #cdbfa6;
  --rouge: #a3271d;
  --ombre: 0 1px 2px rgba(31,45,39,.06), 0 4px 14px rgba(31,45,39,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--papier); color: var(--encre); font: 15px/1.55 var(--sans); min-height: 100vh; }
a { color: var(--accent-fonce); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
.cache { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- en-tete ----------------------------------------------------------- */
.entete { background: var(--encre); color: #f2ede2; position: sticky; top: 0; z-index: 20; }
.entete-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 22px; padding: 0 20px; height: 58px; }
.marque { font: 20px/1 var(--serif); color: #fff; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #d9d3c6; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.actif { background: rgba(255,255,255,.14); color: #fff; }
.compte { position: relative; }
.compte > button { background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--carte); color: var(--encre); border: 1px solid var(--filet); border-radius: 12px; box-shadow: var(--ombre); min-width: 210px; padding: 6px; z-index: 30; }
.menu a, .menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--papier); }
.menu hr { border: 0; border-top: 1px solid var(--filet); margin: 6px 0; }
@media (max-width: 760px) {
  .entete-in { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .compte { margin-left: auto; }
}

/* --- page --------------------------------------------------------------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.titre-page { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.titre-page h1 { margin: 0; }
.sous { color: var(--doux); margin: 4px 0 0; }
.carte { background: var(--carte); border: 1px solid var(--filet); border-radius: 14px; padding: 20px; box-shadow: var(--ombre); }
.grille { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.vide { text-align: center; color: var(--doux); padding: 40px 20px; border: 1px dashed var(--filet-fort); border-radius: 14px; }
.retour { display: inline-block; margin-bottom: 14px; color: var(--doux); text-decoration: none; }
.retour:hover { color: var(--encre); }
.meta { color: var(--doux); font-size: 13px; }

/* --- boutons et formulaires -------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--filet-fort); background: var(--carte); color: var(--encre); padding: 9px 16px; border-radius: 999px; font: 500 14px/1.2 var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--encre); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.btn.discret { border-color: transparent; background: transparent; color: var(--doux); }
.btn.discret:hover { color: var(--encre); border-color: var(--filet); }
.btn.danger { color: var(--rouge); border-color: #e6c3bd; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
form.formulaire { display: grid; gap: 14px; }
.champ { display: grid; gap: 5px; }
.champ > span { font-weight: 600; font-size: 13px; color: var(--doux); }
.champ small { color: var(--pale); font-size: 12px; }
input[type=text], input[type=password], input[type=date], input[type=email], input[type=tel], input[type=search], textarea, select {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--filet-fort); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
.ligne { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.erreur { background: #fbeae7; color: var(--rouge); border-radius: 10px; padding: 10px 14px; }
.succes { background: var(--vert-pale); color: var(--vert); border-radius: 10px; padding: 10px 14px; }
.note { background: var(--accent-pale); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
details.plus { margin-top: 18px; }
details.plus summary { cursor: pointer; color: var(--doux); font-size: 13px; }
details.plus[open] summary { margin-bottom: 10px; }

/* --- connexion --------------------------------------------------------- */
.ecran-seul { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ecran-seul .carte { width: 100%; max-width: 420px; padding: 34px; }
.ecran-seul h1 { text-align: center; }
.ecran-seul .sous { text-align: center; margin-bottom: 22px; }

/* --- vignettes --------------------------------------------------------- */
.album { display: block; text-decoration: none; color: inherit; background: var(--carte); border: 1px solid var(--filet); border-radius: 14px; overflow: hidden; box-shadow: var(--ombre); transition: transform .15s; }
.album:hover { transform: translateY(-2px); }
.album .couv { aspect-ratio: 4 / 3; background: var(--filet) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--doux); }
.album .couv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album .info { padding: 12px 14px; }
.album .info strong { display: block; font: 17px/1.3 var(--serif); }
.mosaique { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.mosaique button { padding: 0; border: 0; background: var(--filet); border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
.mosaique img { width: 100%; height: 100%; object-fit: cover; display: block; }
.depot { border: 2px dashed var(--filet-fort); border-radius: 14px; padding: 22px; text-align: center; color: var(--doux); margin-bottom: 18px; }
.depot.survol { border-color: var(--accent); background: var(--accent-pale); }
.progression { height: 6px; background: var(--filet); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progression > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* --- visionneuse ------------------------------------------------------- */
.visionneuse { position: fixed; inset: 0; background: rgba(14,20,17,.94); z-index: 50; display: flex; flex-direction: column; }
.visionneuse .haut { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: #ddd; gap: 10px; }
.visionneuse .centre { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; }
.visionneuse img { max-width: 100%; max-height: 100%; object-fit: contain; }
.visionneuse .fleche { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.visionneuse .fleche:hover { background: rgba(255,255,255,.25); }
.visionneuse .g { left: 14px; } .visionneuse .d { right: 14px; }
.visionneuse .bas { padding: 12px 16px 18px; color: #eee; text-align: center; min-height: 54px; }
.visionneuse .btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.visionneuse input { max-width: 520px; }

/* --- recettes ---------------------------------------------------------- */
.filtres { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filtres input { max-width: 320px; }
.filtres select { max-width: 220px; }
.recette-carte { display: flex; gap: 14px; text-decoration: none; color: inherit; background: var(--carte); border: 1px solid var(--filet); border-radius: 14px; padding: 12px; box-shadow: var(--ombre); }
.recette-carte .vign { width: 84px; height: 84px; border-radius: 10px; background: var(--accent-pale); flex: none; overflow: hidden; display: flex; align-items: center; justify-content: center; font: 30px/1 var(--serif); color: var(--accent); }
.recette-carte .vign img { width: 100%; height: 100%; object-fit: cover; }
.recette-carte strong { font: 17px/1.3 var(--serif); display: block; }
.recette { display: grid; gap: 26px; grid-template-columns: minmax(240px, 340px) 1fr; }
@media (max-width: 760px) { .recette { grid-template-columns: 1fr; } }
.recette .photo { border-radius: 14px; overflow: hidden; background: var(--accent-pale); }
.recette .photo img { width: 100%; display: block; }
.recette ul.ingredients { padding-left: 18px; }
.recette ol.etapes { padding-left: 20px; }
.recette ol.etapes li { margin-bottom: 10px; }
.pastilles { display: flex; gap: 14px; flex-wrap: wrap; color: var(--doux); margin: 6px 0 18px; }

/* --- membres ----------------------------------------------------------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--vert-pale); color: var(--vert); display: inline-flex; align-items: center; justify-content: center; font: 600 16px/1 var(--sans); overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.grand { width: 120px; height: 120px; font-size: 40px; }
.membre { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; background: var(--carte); border: 1px solid var(--filet); border-radius: 14px; padding: 14px; box-shadow: var(--ombre); }
.membre strong { display: block; }
.profil-tete { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
dl.fiche { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.fiche dt { color: var(--doux); font-weight: 600; font-size: 13px; padding-top: 2px; }
dl.fiche dd { margin: 0; white-space: pre-wrap; }
.trombi { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- accueil ----------------------------------------------------------- */
.anniv { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.anniv li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--filet); padding-bottom: 8px; }
.anniv li:last-child { border-bottom: 0; }
.mini-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mini-photos a { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--filet); display: block; }
.mini-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.liste-simple { list-style: none; padding: 0; margin: 0; }
.liste-simple li { padding: 7px 0; border-bottom: 1px solid var(--filet); }
.liste-simple li:last-child { border-bottom: 0; }

/* --- arbre ------------------------------------------------------------- */
.arbre-zone { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
@media (max-width: 960px) { .arbre-zone { grid-template-columns: 1fr; } }
.toile { position: relative; background: var(--carte); border: 1px solid var(--filet); border-radius: 14px; height: 640px; overflow: hidden; box-shadow: var(--ombre); touch-action: none; cursor: grab; }
.toile.glisse { cursor: grabbing; }
.toile svg { width: 100%; height: 100%; display: block; user-select: none; }
.toile .outils { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; }
.toile .outils button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--filet-fort); background: var(--carte); cursor: pointer; font: 600 16px/1 var(--sans); color: var(--encre); }
.toile .outils button.large { width: auto; padding: 0 12px; font-size: 13px; }
.toile .legende { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--pale); }
.boite rect.fond { fill: #fff; stroke: var(--filet-fort); stroke-width: 1.2; }
.boite.f rect.fond { fill: #fbf3f0; }
.boite.m rect.fond { fill: #f1f5f2; }
.boite.focus rect.fond { stroke: var(--accent); stroke-width: 2.5; }
.boite.membre-lie rect.marque { fill: var(--vert); }
.boite { cursor: pointer; }
.boite:hover rect.fond { stroke: var(--encre); }
.boite text { font-family: var(--sans); fill: var(--encre); }
.boite text.nom { font-weight: 600; font-size: 13px; }
.boite text.dates { font-size: 11.5px; fill: var(--doux); }
.boite text.initiale { font-size: 15px; font-weight: 600; fill: var(--vert); }
.boite circle.rond { fill: var(--vert-pale); }
.lien-arbre { fill: none; stroke: var(--filet-fort); stroke-width: 1.6; }
.lien-union { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 0; opacity: .6; }
.panneau h2 { margin-bottom: 4px; }
.panneau .groupe { margin-top: 16px; }
.panneau .groupe h3 { font: 600 12px/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--doux); margin-bottom: 8px; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puces a { background: var(--papier); border: 1px solid var(--filet); border-radius: 999px; padding: 4px 11px; text-decoration: none; color: var(--encre); font-size: 13.5px; }
.puces a:hover { border-color: var(--encre); }
.recherche-arbre { position: relative; }
.suggestions { position: absolute; left: 0; right: 0; top: 100%; background: var(--carte); border: 1px solid var(--filet); border-radius: 10px; box-shadow: var(--ombre); z-index: 10; max-height: 260px; overflow: auto; }
.suggestions button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; }
.suggestions button:hover, .suggestions button.choisi { background: var(--papier); }

/* --- modale ------------------------------------------------------------ */
.voile { position: fixed; inset: 0; background: rgba(20,28,24,.45); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modale { background: var(--carte); border-radius: 16px; width: 100%; max-width: 560px; padding: 26px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modale h2 { margin-bottom: 16px; }
.lien-copie { display: flex; gap: 8px; }
.lien-copie input { font: 13px/1.4 ui-monospace, Consolas, monospace; }

table.tableau { width: 100%; border-collapse: collapse; }
table.tableau th, table.tableau td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--filet); vertical-align: middle; }
table.tableau th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.etiquette { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--vert-pale); color: var(--vert); }
.etiquette.off { background: #eee; color: #777; }
.journal { font-size: 13px; }
.journal li { display: flex; gap: 12px; }
.journal time { color: var(--pale); white-space: nowrap; }

.meta.bloc { display: block; margin-top: 2px; }
.visionneuse .tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 10px; }
.visionneuse .tag { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px 6px 3px 11px; }
.visionneuse .tag a { color: #fff; text-decoration: none; }
.visionneuse .tag button { background: none; border: 0; color: #ccc; cursor: pointer; font: 600 13px/1 var(--sans); padding: 2px 5px; }
.visionneuse .tag button:hover { color: #fff; }
.visionneuse .recherche-arbre { width: 240px; }
.visionneuse .recherche-arbre input { background: rgba(255,255,255,.95); padding: 6px 10px; }
.visionneuse .suggestions { top: auto; bottom: 100%; color: var(--encre); }
.meta-clair { color: #bbb; font-size: 13px; }
.recette ul.ingredients li.intertitre { list-style: none; margin: 12px 0 4px -18px; font-weight: 600; color: var(--doux); }
