/* Arbre — structure commune. Chaque version redéfinit les jetons et habille les fiches. */
:root {
  --bg: #f2f2ef; --surface: #ffffff; --surface-2: #f6f6f3; --ink: #1d2128; --ink-2: #5e6470; --line: #d6d8dc;
  --accent: #2e5c8a; --on-accent: #fff; --error: #b3261e; --warning: #a86200; --info: #3b6b8f;
  --link-c: #9aa1ab; --link-hi: var(--accent); --link-w: 1.6px; --sel: var(--accent);
  --node-bg: var(--surface); --node-ink: var(--ink); --node-line: var(--line);
  --font-d: system-ui, sans-serif; --font-b: system-ui, sans-serif;
  --r: 8px; --r-lg: 14px; --shadow: 0 10px 30px rgba(20, 24, 32, .14);
  --panel-w: 410px; --mm-node: #9aa1ab; --mm-sel: #2e5c8a; --mm-view: #1d2128;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body.arbre { margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-b); -webkit-font-smoothing: antialiased; }
body.booting .node, body.booting .links { transition: none !important; animation: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-2); }
kbd { font: 600 11px/1 var(--font-b); padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--ink-2); }

/* ---------- Grille infinie */
.vp { position: fixed; inset: 0; overflow: hidden; cursor: grab; touch-action: none; outline: none; background-color: var(--bg); }
body.panning .vp { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.links { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.links.fresh { animation: links-in .5s ease-out; }
@keyframes links-in { from { opacity: 0; } }
.link { fill: none; stroke: var(--link-c); stroke-width: var(--link-w); stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s, opacity .2s; }
.link.p-adoptif { stroke-dasharray: 7 5; }
.link.p-beau, .link.p-tuteur, .link.p-nourricier { stroke-dasharray: 2 5; }
.link.union { stroke-width: calc(var(--link-w) * 1.6); }
.link.u-pacs { stroke-dasharray: 10 4; }
.link.u-libre { stroke-dasharray: 5 5; }
.link.u-fiancailles { stroke-dasharray: 1 6; }
.link.union.is-ended { opacity: .55; }
.link.union-break { stroke-width: 2; }
.link.aux { stroke-dasharray: 1 6; stroke-width: 1.4; opacity: .7; }
body.hide-aux .link.aux { display: none; }
body.has-sel .link { opacity: .35; }
body.has-sel .link.in-line { opacity: 1; stroke: var(--link-hi); }

/* ---------- Fiches (style neutre, chaque version l'habille) */
.nodes { position: absolute; left: 0; top: 0; }
.node {
  position: absolute; left: 0; top: 0; width: var(--nw); height: var(--nh); padding: 0; margin: 0;
  display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--node-line);
  background: var(--node-bg); color: var(--node-ink); border-radius: var(--r);
  transition: transform .55s cubic-bezier(.2, .75, .2, 1), opacity .2s, box-shadow .2s, border-color .2s;
}
.node:focus-visible { outline: 3px solid var(--sel); outline-offset: 3px; }
.node-photo, .av, .portrait { display: grid; place-items: center; overflow: hidden; flex: none; background: hsl(var(--h, 200) 30% 82%); color: hsl(var(--h, 200) 35% 26%); }
.node-photo img, .av img, .portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mono { font-weight: 600; letter-spacing: .02em; }
.node-text { display: flex; flex-direction: column; min-width: 0; }
.node-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.node-name .last { text-transform: uppercase; }
.node-dates { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.node-flag { position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border-radius: 50%; display: none; border: 2px solid var(--bg); }
.node.has-error .node-flag { display: block; background: var(--error); }
.node.has-warning .node-flag { display: block; background: var(--warning); }
body.has-sel .node:not(.in-line) { opacity: .55; }
.node.is-sel { box-shadow: 0 0 0 3px var(--sel), var(--shadow); opacity: 1; z-index: 2; }
body.zoom-far .node-dates { visibility: hidden; }

/* ---------- Barre du haut */
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 16px; pointer-events: none; }
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.tree-title { border: 0; background: transparent; padding: 0; font: 600 18px/1.2 var(--font-d); width: 17ch; max-width: 100%; text-overflow: ellipsis; border-bottom: 1px dashed transparent; }
.tree-title:hover, .tree-title:focus { border-bottom-color: var(--ink-2); outline: none; }
.tree-count { font-size: 12px; color: var(--ink-2); }
.search { position: relative; flex: 1; max-width: 400px; margin: 0 auto; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px 0 12px; box-shadow: var(--shadow); }
.search > .i { color: var(--ink-2); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 8px; outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
.search-results li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--surface-2); }
.search-results li span { display: flex; flex-direction: column; line-height: 1.25; }
.search-results small { color: var(--ink-2); }
.bar-actions { display: flex; gap: 8px; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow); transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-primary:hover { border-color: transparent; filter: brightness(1.08); }
.btn-danger { background: var(--error); color: #fff; border-color: transparent; }
.btn-sm { padding: 5px 11px; font-size: 13px; box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn.danger, .menu .danger { color: var(--error); }
.btn-fix { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.icon-only { padding: 8px 10px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-checks { position: relative; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; line-height: 20px; text-align: center; color: #fff; background: var(--info); }
.badge.lv-error { background: var(--error); }
.badge.lv-warning { background: var(--warning); }
.mini { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); }
.mini:hover { background: var(--surface-2); color: var(--ink); }
.mini .i { width: 16px; height: 16px; }

.menu { position: fixed; top: 62px; right: 16px; z-index: 30; min-width: 280px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: var(--r); text-align: left; color: var(--ink); text-decoration: none; font-size: 14px; }
.menu button:hover, .menu a:hover, .menu :focus-visible { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* ---------- Dock bas : zoom, historique, mini-carte */
.dock { position: fixed; left: 16px; bottom: 16px; z-index: 15; display: flex; gap: 8px; }
.zoom { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); overflow: hidden; }
.zoom button { border: 0; background: none; padding: 8px 10px; display: grid; place-items: center; color: var(--ink); }
.zoom button:hover { background: var(--surface-2); }
.zoom button:disabled { opacity: .35; cursor: default; }
.zoom-val { min-width: 62px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.minimap { position: fixed; left: 16px; bottom: 66px; z-index: 15; width: 200px; height: 130px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); cursor: crosshair; touch-action: none; }

/* ---------- Panneaux latéraux */
.panel, .checks { position: fixed; z-index: 18; top: 66px; right: 12px; bottom: 12px; width: var(--panel-w); max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: panel-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } }
.panel-scroll { overflow: auto; padding: 20px 22px 28px; flex: 1; overscroll-behavior: contain; }
.pp-head { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding-right: 26px; }
.pp-close { position: absolute; top: -8px; right: -10px; }
.pp-portrait { padding: 0; border: 0; background: none; border-radius: 50%; }
.pp-portrait:disabled { cursor: default; }
.portrait { width: 92px; height: 92px; border-radius: 50%; font-size: 28px; }
.pp-id h2 { margin: 0; font: 600 24px/1.15 var(--font-d); text-wrap: balance; }
.pp-id h2 .last { text-transform: uppercase; }
.pp-id p { margin: 4px 0 0; }
.pp-born { color: var(--ink-2); font-style: italic; }
.pp-life { color: var(--ink-2); font-size: 14px; }
.pp-job { font-size: 14px; }
.pp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.pp-sec { margin-top: 22px; }
.pp-sec h3 { margin: 0 0 10px; font: 600 15px/1.3 var(--font-d); display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.pp-sec h3 small { color: var(--ink-2); font-weight: 400; font-size: 12px; }
.pp-sec h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.facts { margin: 0; display: grid; gap: 8px; }
.fact { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.fact dt { color: var(--ink-2); font-size: 13px; padding-top: 1px; }
.fact dd { margin: 0; }
.fact .place { display: block; color: var(--ink-2); font-size: 13px; }
.bio p { margin: 0 0 10px; max-width: 62ch; }
.fam-block { margin-bottom: 16px; }
.rel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 4px; }
.rel-row .chip { flex: 1; min-width: 0; }
.rel-tools { display: flex; opacity: 0; transition: opacity .15s; }
.rel-row:hover .rel-tools, .rel-row:focus-within .rel-tools { opacity: 1; }
.rel-meta { flex-basis: 100%; margin: 0 0 6px 48px; font-size: 13px; color: var(--ink-2); }
.rel-meta .ended { color: var(--ink); }
.group-label { flex-basis: 100%; margin: 6px 0 2px; font-size: 12px; color: var(--ink-2); font-style: italic; }
.chip { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border: 1px solid transparent; border-radius: var(--r); background: none; text-align: left; }
.chip:hover { background: var(--surface-2); border-color: var(--line); }
.chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.chip-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-text small { color: var(--ink-2); font-size: 12px; }
.av { width: 36px; height: 36px; border-radius: 50%; font-size: 13px; }
.add-line { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; margin-top: 2px; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; border-radius: var(--r); cursor: pointer; }
.add-line:hover { background: var(--surface-2); }
.add-line .i { width: 15px; height: 15px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-2); font-size: 12px; border-style: dashed; cursor: pointer; }
.thumb-add:hover { color: var(--accent); border-color: var(--accent); }
.docs { list-style: none; margin: 0 0 6px; padding: 0; }
.docs li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.docs li.muted { border: 0; font-size: 13px; }
.doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column; }
.doc-name small { color: var(--ink-2); font-size: 12px; }

/* ---------- Vérification */
.ck-head { display: flex; justify-content: space-between; align-items: center; }
.ck-head h2 { margin: 0; font: 600 22px/1.2 var(--font-d); }
.ck-intro { color: var(--ink-2); margin: 6px 0 14px; font-size: 14px; }
.ck-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.ck-tabs button { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--surface); padding: 5px 10px; border-radius: 999px; font-size: 13px; }
.ck-tabs button b { font-weight: 600; color: var(--ink-2); }
.ck-tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ck-tabs button[aria-selected="true"] b { color: inherit; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.issues:empty { display: none; }
.issue { border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: var(--r); padding: 10px 12px; background: var(--surface); }
.issue.lv-error { border-left-color: var(--error); }
.issue.lv-warning { border-left-color: var(--warning); }
.issue-head { display: flex; align-items: center; gap: 8px; }
.lv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex: none; }
.lv-error .lv-dot { background: var(--error); }
.lv-warning .lv-dot { background: var(--warning); }
.issue p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.issue-people { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 6px; }
.issue-people .chip { padding: 3px 8px 3px 3px; }
.issue-people .av { width: 28px; height: 28px; font-size: 11px; }
.issue-fixes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.issues.live { margin-top: 14px; }

/* ---------- Écran vide */
.empty { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; pointer-events: none; }
.empty-card { pointer-events: auto; max-width: 440px; margin: 16px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.empty-card h2 { margin: 0 0 8px; font: 600 24px/1.2 var(--font-d); }
.empty-card p { color: var(--ink-2); margin: 0 0 18px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Dialogues */
.dlg { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); }
.dlg::backdrop { background: rgba(20, 22, 28, .45); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlg-in .22s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
@keyframes dlg-in { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 34px); margin: 0; }
.dlg-head { position: relative; padding: 18px 56px 12px 22px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font: 600 21px/1.2 var(--font-d); }
.dlg-sub { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.dlg-head .mini { position: absolute; top: 14px; right: 14px; }
.dlg-body { padding: 16px 22px; overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); }
.dlg-foot .btn { box-shadow: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fld { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; min-width: 0; }
.grid2 .fld { margin: 0; }
.fld > span, .fld legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; }
.fld small { font-weight: 400; }
.fld input:not([type=checkbox]):not([type=radio]), .fld select, .fld textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.fld [aria-invalid="true"] { border-color: var(--error) !important; }
.fld textarea { resize: vertical; line-height: 1.5; }
.fld select[size] { padding: 4px; }
.fld select[size] option { padding: 5px 6px; border-radius: 4px; }
.fld input + select { margin-top: 4px; }
.fld.check { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; }
.fld.check span { color: var(--ink); font-weight: 400; font-size: 14px; }
.hint { font-style: normal; font-size: 12px; color: var(--ink-2); min-height: 1em; }
.hint .bad { color: var(--error); }
.seg { border: 0; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.seg legend { margin-bottom: 5px; width: 100%; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-pick { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.photo-pick .portrait { width: 76px; height: 76px; font-size: 24px; margin: 0; box-shadow: none; border-radius: 50%; }
.photo-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-btns label { cursor: pointer; }
.ctx-box { padding: 12px 14px 2px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface-2); }
.keys { display: grid; gap: 8px; margin: 0 0 14px; }
.keys div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: baseline; }
.keys dt { color: var(--ink-2); font-size: 13px; }
.keys dd { margin: 0; font-size: 14px; }

/* Visionneuse photo */
.dlg-light { width: min(1000px, calc(100vw - 24px)); background: #15161a; color: #eee; border: 0; }
.dlg-light figure { margin: 0; position: relative; }
.dlg-light img { display: block; max-width: 100%; max-height: calc(100dvh - 150px); margin: 0 auto; object-fit: contain; }
.dlg-light figcaption { display: flex; gap: 10px; align-items: center; padding: 10px 16px; }
.dlg-light .cap { flex: 1; background: transparent; border: 0; border-bottom: 1px solid #444; color: #eee; padding: 6px 0; }
.light-count { color: #999; font-size: 13px; font-variant-numeric: tabular-nums; }
.light-tools { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 0 16px 14px; }
.light-tools .btn { background: #26282e; color: #eee; border-color: #3a3c44; }
.light-tools .muted { color: #999; font-size: 13px; margin-right: auto; }
.light-nav { position: absolute; top: 40%; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.light-nav.prev { left: 12px; } .light-nav.next { right: 12px; }

/* Toasts */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; background: var(--ink); color: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); font-size: 14px; animation: toast-in .25s ease-out; max-width: calc(100vw - 32px); }
.toast .btn { color: var(--surface); }
.toast .btn:hover { background: rgba(255, 255, 255, .12); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Petits écrans */
@media (max-width: 900px) {
  .btn-primary span, .btn-checks span { display: none; }
  .search kbd { display: none; }
}
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand { flex: 1; }
  .tree-title { font-size: 16px; }
  .panel, .checks { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; height: 72dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; animation-name: sheet-in; }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
  .minimap { display: none; }
  body.panel-open .dock, body.panel-open .minimap { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 92px 1fr; }
  .rel-tools { opacity: 1; }
  .keys div { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Sources (import GEDCOM), corrections groupées, repli des familles */
.sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sources li { display: flex; flex-direction: column; font-size: 13.5px; line-height: 1.35; }
.sources span { color: var(--ink-2); }
.sources small { color: var(--ink-2); font-size: 12px; font-style: italic; }
.dock { flex-wrap: wrap; max-width: calc(100vw - 32px); }
.bulk { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.folds { position: absolute; left: 0; top: 0; }
.fold { position: absolute; left: 0; top: 0; z-index: 3; min-width: 24px; height: 24px; translate: -50% -50%; padding: 0 6px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 700 12px/1 var(--font-b);
  transition: transform .55s cubic-bezier(.2, .75, .2, 1), opacity .2s; opacity: .55; }
.fold .i { width: 14px; height: 14px; }
.fold:hover, .fold:focus-visible, .fold.is-folded { opacity: 1; }
body.zoom-far .fold:not(.is-folded) { opacity: 0; pointer-events: none; }

/* Lecture des documents */
.ocr-status { margin: 0 0 8px; }
.ocr-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-bottom: 14px; }
.ocr-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.bad { color: var(--error); }
.mini.is-read { color: var(--accent); }
.sugs { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 8px; }
.sug { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r); padding: 9px 12px; }
.sug.st-diff { border-left-color: var(--warning); }
.sug-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.sug-head small { color: var(--ink-2); font-size: 12px; }
.st-diff .sug-head small { color: var(--warning); }
.sug-vals { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.3fr); align-items: center; gap: 8px; margin-top: 6px; }
.sug-cur { color: var(--ink-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-cur:not(:empty) { text-decoration: line-through; text-decoration-color: rgba(127, 127, 127, .5); }
.sug-vals .i { color: var(--ink-2); }
.sug-vals input { width: 100%; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.sug-vals input[aria-invalid="true"] { border-color: var(--error); }
.ocr-h { margin: 16px 0 6px; font: 600 14px/1.3 var(--font-d); color: var(--ink-2); }
.ocr-dates { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ocr-dates li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 13px; }
.ocr-dates span { color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ocr-text { margin-top: 14px; }
.ocr-text summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
.ocr-text textarea { width: 100%; margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font: 12.5px/1.5 var(--font-n, monospace); resize: vertical; }
@media (max-width: 760px) { .sug-vals { grid-template-columns: 1fr; } .sug-vals .i { display: none; } .ocr-dates li { grid-template-columns: 1fr; } }

/* Recherche en ligne */
.ocr-h small { font: 400 12px/1.3 var(--font-b, inherit); color: var(--ink-2); margin-left: 6px; }
.cands, .web-recs, .web-links, .web-check, .batch-why { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cand { display: flex; align-items: center; gap: 12px; justify-content: space-between; border: 1px solid var(--line); border-left: 4px solid var(--ink-2); border-radius: var(--r); padding: 9px 12px; }
.cand p { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.cand.lv-sur { border-left-color: var(--accent); }
.cand.lv-probable { border-left-color: var(--warning); }
.cand .lv { font-size: 12px; color: var(--ink-2); margin-left: 6px; }
.web-recs li, .web-links li { display: grid; gap: 2px; font-size: 13.5px; }
.web-recs small, .web-links small { color: var(--ink-2); font-size: 12px; }
.web-links { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.web-links a, .web-recs a { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.web-links a:hover, .web-recs a:hover, .sources a:hover { text-decoration: underline; }
.sources a { color: inherit; }
.batch-why { gap: 2px; font-size: 13px; margin-bottom: 10px; }
.batch-p { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.batch-p h3 { margin: 0 0 2px; font-size: 15px; }
.batch-p .muted { margin: 0 0 6px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.web-check li { display: flex; align-items: center; gap: 10px; }
.web-check li span { flex: 1; }
.web-check small { color: var(--ink-2); }

/* Recoupements */
.hints { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); font-style: italic; }
.cand.lv-ecart { border-left-color: var(--warning); }
.cand.done { opacity: .75; }
.cand-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.cand .ok, .oa-list .ok { color: var(--accent); font-size: 13px; }
.kin-h { margin: 12px 0 6px; font-size: 13.5px; color: var(--ink-2); }
.web-kin .cands { gap: 6px; }
.oa-list { list-style: none; margin: 6px 0 4px; padding: 0 0 0 10px; border-left: 2px solid var(--line); display: grid; gap: 4px; }
.oa-list li { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; }
.web-recs .link { justify-self: start; font-size: 12.5px; }
.batch-details { margin: 4px 0 10px; font-size: 13px; }
.batch-details summary { cursor: pointer; color: var(--ink-2); }
@media (max-width: 760px) { .cand { flex-direction: column; align-items: stretch; } .cand-acts { justify-content: flex-start; } }

/* Retirer photos et sources */
.thumb-wrap { position: relative; }
.thumb-wrap .thumb { width: 100%; }
.thumb-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: rgba(10, 8, 30, .72); color: #fff; border-radius: 50%; opacity: 0; transition: opacity .15s; }
.thumb-wrap:hover .thumb-del, .thumb-del:focus-visible { opacity: 1; }
@media (hover: none) { .thumb-del { opacity: 1; } }
.thumb-del:hover { color: var(--error); }
.sources li { position: relative; padding-right: 30px; }
.src-del { position: absolute; top: 0; right: 0; opacity: .45; }
.sources li:hover .src-del, .src-del:focus-visible { opacity: 1; }
.src-del:hover { color: var(--error); }
/* Fratrie liée directement (sans parents connus) */
.link.sib-bracket { stroke-linejoin: round; stroke-dasharray: 2 5; stroke-width: 1.6; }

.kin-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.kin-group { border-top: 1px solid var(--line); padding: 6px 0; }
.kin-group summary { cursor: pointer; font-size: 13.5px; }
.kin-group summary small { color: var(--ink-2); margin-left: 6px; }
.kin-group .cands { margin-top: 6px; }

/* Fratries compactes : cadre autour de la pile */
.stack-frame { fill: rgba(255, 255, 255, .025); stroke: currentColor; stroke-opacity: .22; stroke-width: 1.2; stroke-dasharray: 3 6; color: var(--ink-2); }

/* Vue ciblée (ascendance / descendance) */
.focus-bar { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: 0 8px 30px rgba(0, 0, 0, .35); font-size: 13.5px; max-width: calc(100vw - 32px); }
.focus-bar > .i { color: var(--accent); flex: none; }
.focus-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .focus-bar { top: 64px; font-size: 12.5px; } .focus-bar [data-act^="focus-a"], .focus-bar [data-act^="focus-d"] { display: none; } }
