/* Familia Jover — warm editorial look. No build step: plain CSS. */
:root {
  --paper: #f5eee2; --paper-2: #ede3d1; --card: #fffaf1; --ink: #2b2118; --ink-2: #6b5b4b; --ink-3: #9a8a77;
  --line: #e0d4c0; --accent: #b5532f; --accent-2: #8f3f20; --olive: #5f7a4a; --danger: #a63d2f; --gold: #c08a2b;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .08);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar: 60px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .6rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; transition: background .15s, transform .05s, border-color .15s; min-height: 40px; }
.btn:hover { background: #fff; border-color: #cdbd9f; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger); border-color: #e3c1ba; }
.btn.danger:hover { background: #fbeeea; }
.btn.small { padding: .35rem .8rem; min-height: 34px; font-size: 13.5px; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.wa { background: #2f8f5b; border-color: #2f8f5b; color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-row.center { justify-content: center; }
.grow { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--paper-2); }
.chip-btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: .3rem .8rem; font-size: 13px; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; white-space: nowrap; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn .n { background: var(--paper-2); border-radius: 999px; padding: 0 .45rem; font-size: 12px; color: var(--ink-2); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; text-align: left; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }
.error { color: var(--danger); margin: .5rem 0; } .warn { color: var(--ink-2); font-size: 13.5px; }

/* ---------- login / pending */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen { min-height: 100dvh; display: flex; flex-direction: column; background:
  radial-gradient(900px 500px at 85% -10%, #f0d9bd 0, transparent 60%), radial-gradient(700px 500px at -10% 110%, #dfe6cd 0, transparent 55%), var(--paper); }
.screen-top { display: flex; justify-content: flex-end; padding: 16px; }
.screen::after { content: ''; height: 60px; flex: none; }
.auth-card { margin: auto; width: min(440px, calc(100% - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow); text-align: left; }
.auth-card h1 { font-size: 30px; line-height: 1.12; margin: 22px 0 8px; }
.lede { color: var(--ink-2); margin: 0 0 18px; }
.fine { color: var(--ink-3); font-size: 13px; margin: 18px 0 0; }
.hourglass { font-size: 40px; margin-top: 18px; }
.screen .auth-card .btn-row { margin-top: 18px; }

.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--accent); white-space: nowrap; }
.brand svg { width: 30px; height: 30px; flex: none; color: var(--accent); }
.brand span { color: var(--ink); }
.brand.big svg { width: 44px; height: 44px; } .brand.big { font-size: 24px; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 14px; }
.field > span, legend { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-height: 44px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }

.btn.google { background: #fff; gap: .7rem; font-weight: 600; }
.btn.google svg { width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: .8rem; margin: 18px 0; color: var(--ink-3); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- language switch */
.lang-switch { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 3px; }
.lang-switch button { border: 0; background: transparent; padding: .25rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--ink-2); cursor: pointer; }
.lang-switch button[aria-pressed=true] { background: var(--card); color: var(--accent-2); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* ---------- app shell */
#screenApp { height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 8px 18px; min-height: var(--topbar); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.controls { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 2px; background: var(--paper-2); padding: 3px; border-radius: 999px; }
.tabs button { display: inline-flex; align-items: center; gap: .45rem; border: 0; background: transparent; padding: .45rem .95rem; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tabs button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-selected=true] { background: var(--card); color: var(--accent-2); box-shadow: 0 1px 3px rgba(60, 40, 20, .15); }
.avatar-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-weight: 600; cursor: pointer; }
.avatar-btn.has-badge::after { content: ''; position: absolute; top: -1px; right: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 46px; width: 290px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; z-index: 30; }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head span:not(.role-chip) { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.menu button { display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left; border: 0; background: none; padding: .6rem .7rem; border-radius: 10px; cursor: pointer; }
.menu button:hover { background: var(--paper-2); }
.menu button:disabled { opacity: .55; cursor: default; }
.badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 .5rem; }
.role-chip { align-self: flex-start; display: inline-block; font-size: 11.5px; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); margin-top: 4px; }
.role-chip[data-role=admin] { background: #f1d9cf; color: var(--accent-2); }
.role-chip[data-role=editor] { background: #dfe8d2; color: #44602f; }
.role-chip[data-role=pending] { background: #f3e5b8; color: #7a5a10; }
.demo-banner { background: #f3e5b8; color: #5d4408; font-size: 13px; padding: 6px 18px; text-align: center; }
#stage { flex: 1; min-height: 0; position: relative; }
.view { height: 100%; display: flex; flex-direction: column; }
.view-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 18px; }
.hint { color: var(--ink-3); font-size: 12.5px; margin-left: 4px; }
.canvas { flex: 1; min-height: 0; position: relative; margin: 0 12px 12px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  background-color: #fbf6ec; background-image: radial-gradient(circle, #e7dcc7 1px, transparent 1.4px); background-size: 22px 22px; touch-action: none; }
.canvas svg { width: 100%; height: 100%; display: block; cursor: grab; font-family: var(--sans); }
.canvas svg:active { cursor: grabbing; }
.fab { position: fixed; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 8px 22px rgba(143, 63, 32, .4); cursor: pointer; z-index: 15; }
.fab:hover { background: var(--accent-2); }

/* ---------- tree */
.legend { display: flex; gap: 6px 14px; padding: 0 18px 8px; overflow-x: auto; scrollbar-width: none; }
.legend::-webkit-scrollbar { display: none; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.legend-item i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.person { cursor: pointer; outline: none; }
.person .avatar, .onode .avatar { fill: color-mix(in srgb, var(--c) 16%, #fffaf1); stroke: var(--c); stroke-width: 2.2; transition: stroke-width .12s; }
.person:hover .avatar, .person:focus-visible .avatar, .onode:hover .avatar { stroke-width: 4; }
.person.deceased .avatar, .onode.deceased .avatar { stroke-dasharray: 3.5 3; fill: color-mix(in srgb, var(--c) 7%, #fffaf1); }
.initials { text-anchor: middle; font-weight: 600; fill: color-mix(in srgb, var(--c) 80%, #000); pointer-events: none; }
.nm { text-anchor: middle; font-weight: 600; font-size: 13px; fill: var(--ink); }
.sn { text-anchor: middle; font-size: 11.5px; fill: var(--ink-2); }
.yr { text-anchor: middle; font-size: 11px; fill: var(--ink-3); }
.person:not(.main) .nm { font-size: 12px; } .person:not(.main) .sn { font-size: 11px; }
.link { fill: none; stroke: var(--c); stroke-opacity: .5; stroke-width: 1.8; }
.pair { stroke: #a8967f; stroke-width: 2.2; } .pair.ex { stroke-dasharray: 4 4; }
.toggle { cursor: pointer; outline: none; }
.toggle rect { fill: var(--card); stroke: var(--c); stroke-width: 1.5; }
.toggle text { text-anchor: middle; font-size: 11.5px; font-weight: 600; fill: var(--c); pointer-events: none; }
.toggle:hover rect { fill: color-mix(in srgb, var(--c) 14%, var(--card)); }

/* tree search + temporary highlight */
.tree-search { position: relative; flex: 1 1 220px; max-width: 320px; }
.tree-search input { min-height: 36px; border-radius: 999px; padding: .35rem .9rem .35rem 2.2rem; font-size: 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a8a77' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat .75rem center / 16px; }
.tree-results { position: absolute; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 12; max-height: 300px; overflow: auto; }
.tree-results button { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: none; text-align: left; padding: .4rem .5rem; border-radius: 10px; cursor: pointer; }
.tree-results li[aria-selected=true] button, .tree-results button:hover { background: var(--paper-2); }
.tree-results .mini { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 18%, #fffaf1); border: 1.5px solid var(--c); color: color-mix(in srgb, var(--c) 80%, #000); }
.tree-results .none { padding: .5rem .7rem; color: var(--ink-3); font-size: 13.5px; }
.tree-svg.searching .link, .tree-svg.searching .person:not(.found), .tree-svg.searching .toggle { opacity: .4; transition: opacity .3s; }
.person.found .avatar { stroke: var(--accent); stroke-width: 5; fill: color-mix(in srgb, var(--accent) 22%, #fffaf1); }
.person.found .nm { fill: var(--accent-2); }
.person .halo { fill: none; stroke: var(--accent); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: halo 1.1s ease-out infinite; pointer-events: none; }
@keyframes halo { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* ---------- organic */
.olink { stroke: #b6a58d; stroke-width: 1.4; stroke-opacity: .8; }
.olink.spouse { stroke: var(--accent); stroke-dasharray: 3 3; stroke-opacity: .7; }
.onode { cursor: pointer; outline: none; }
.onode .oname { text-anchor: middle; font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: #fbf6ec; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.zoomed-out .oname { display: none; }

/* ---------- map */
.map-summary { padding: 10px 18px 8px; display: flex; flex-direction: column; gap: 8px; }
.map-stats { font-size: 14px; color: var(--ink-2); }
.map-stats b { color: var(--ink); font-family: var(--serif); font-size: 17px; font-weight: 600; }
.map-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.map-chips::-webkit-scrollbar { display: none; }
.map-chips.cities .chip-btn { background: transparent; font-size: 12.5px; }
.map-wrap { flex: 1; min-height: 0; position: relative; margin: 0 12px 12px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #dfe8ea; }
.map-el { position: absolute; inset: 0; }
.map-empty { position: absolute; z-index: 500; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--card); border: 1px solid var(--line); padding: 14px 18px; border-radius: 14px; max-width: 80%; text-align: center; box-shadow: var(--shadow); }
.pin-wrap { background: none; border: 0; }
.pin { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); display: grid; place-items: center; color: #fff; font: 600 14px var(--sans); }
.pin.one { width: 34px; height: 34px; margin: 3px; background: var(--olive); font-size: 12px; }
.map-popup { font-family: var(--sans); }
.map-popup strong { display: block; font-family: var(--serif); font-size: 16px; }
.map-popup small { color: var(--ink-2); display: block; margin-bottom: 6px; }
.map-popup ul { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; }
.map-popup li { padding: 3px 0; }
.leaflet-popup-content-wrapper { border-radius: 14px; }

/* ---------- list */
#view-list { overflow-y: auto; }
.list-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 18px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search-wrap { flex: 1 1 260px; }
.sel { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--ink-2); }
.sel select { width: auto; min-height: 40px; }
.chk { display: flex; align-items: center; gap: .4rem; font-size: 13.5px; color: var(--ink-2); }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.count { color: var(--ink-3); font-size: 13px; }
.list-body { padding: 8px 18px 100px; max-width: 1200px; width: 100%; margin: 0 auto; }
.group h2 { font-size: 21px; margin: 22px 0 10px; display: flex; align-items: baseline; gap: .6rem; }
.group h2 .n, .block h3 .n { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--paper-2); border-radius: 999px; padding: 0 .5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.card.deceased { opacity: .78; }
.avatar-lg, .avatar-xl { flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 600; background: color-mix(in srgb, var(--c) 16%, #fffaf1); border: 2px solid var(--c); color: color-mix(in srgb, var(--c) 80%, #000); }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; font-family: var(--serif); }
.avatar-xl.deceased { border-style: dashed; }
.card-main { min-width: 0; flex: 1; }
.card h3 { font-size: 16.5px; line-height: 1.25; font-weight: 600; margin: 0 0 3px; overflow-wrap: anywhere; }
.card .row { margin: 0; font-size: 13.5px; color: var(--ink-2); display: flex; gap: .35rem; align-items: baseline; flex-wrap: wrap; }
.ico { width: 1.2em; text-align: center; }
.soon { margin-left: auto; background: #f1d9cf; color: var(--accent-2); font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 0 .5rem; }
.actions { display: flex; flex-direction: column; gap: 6px; }
.act { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-2); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; }
.act:hover { background: var(--accent); color: #fff; }
.act.wa { background: #dcefe3; color: #1f7447; } .act.wa:hover { background: #2f8f5b; color: #fff; }
.empty { text-align: center; color: var(--ink-2); padding: 60px 0; }

/* ---------- drawer */
.drawer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(43, 33, 24, .38); opacity: 0; transition: opacity .2s; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--paper); box-shadow: -12px 0 40px rgba(43, 33, 24, .2); transform: translateX(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.open .drawer-panel { transform: none; }
.drawer-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px 22px; }
.drawer-panel > header h2 { font-size: 22px; }
.drawer-body { overflow-y: auto; padding: 8px 22px 28px; flex: 1; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.pname { font-size: 27px; line-height: 1.12; overflow-wrap: anywhere; }
.tag { display: inline-block; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); background: var(--paper-2); padding: .1rem .6rem; border-radius: 999px; }
.facts { margin: 16px 0; display: grid; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px 16px; }
.fact { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.fact:last-child { border: 0; }
.fact dt { color: var(--ink-3); font-size: 13px; } .fact dd { margin: 0; overflow-wrap: anywhere; }
.block { margin: 20px 0; }
.block h3 { font-size: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: .5rem; }
.notes { white-space: pre-wrap; margin: 0; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.person-chip { display: inline-flex; align-items: center; gap: .5rem; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); cursor: pointer; text-align: left; }
.person-chip:hover { border-color: var(--c); }
.person-chip .mini { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--c) 18%, #fffaf1); border: 1.5px solid var(--c); color: color-mix(in srgb, var(--c) 80%, #000); }
.person-chip em { font-size: 11.5px; color: var(--ink-3); font-style: normal; }
.sticky-actions { position: sticky; bottom: -28px; background: linear-gradient(transparent, var(--paper) 30%); padding: 22px 0 28px; margin-top: 16px; }
.ulist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.urow { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.who { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.who span:not(.role-chip) { color: var(--ink-2); font-size: 13px; }
.copy-row { display: flex; gap: 8px; } .copy-input { font-size: 12.5px; }

/* ---------- modal form */
.modal { border: 0; padding: 0; background: var(--paper); border-radius: 22px; width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px rgba(43, 33, 24, .35); color: var(--ink); }
.modal::backdrop { background: rgba(43, 33, 24, .45); }
.person-form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.person-form > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 6px 24px; }
.person-form > header h2 { font-size: 22px; }
.form-body { overflow-y: auto; padding: 8px 24px 12px; flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 4px; margin: 0 0 14px; }
legend { padding: 0 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; margin-bottom: 10px; }
fieldset .row3:has(> .field) { grid-template-columns: repeat(3, 1fr); }
.person-form fieldset .field { margin-bottom: 10px; }
.sub { font-size: 12.5px; color: var(--ink-3); margin: 0 0 10px; }
.check { display: flex; align-items: center; gap: .6rem; margin: 4px 0 12px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.death-box { border-left: 3px solid var(--line); padding-left: 12px; margin-bottom: 14px; }
.person-form > footer { padding: 12px 24px 18px; border-top: 1px solid var(--line); }
.status { color: var(--ink-2); margin: 0 0 8px; font-size: 13.5px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: var(--ink); color: var(--paper); padding: .7rem 1.1rem; border-radius: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: min(92vw, 460px); font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive */
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; row-gap: 8px; padding: 8px 12px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .tabs button { flex: 1; flex-direction: column; gap: 2px; font-size: 11.5px; padding: .35rem .2rem; }
  .brand { font-size: 18px; } .brand svg { width: 26px; height: 26px; }
  #btnRequestEdit .lbl { display: none; }
  #btnRequestEdit { padding: .35rem .7rem; }
  .hint { display: none; }
  .tree-search { flex-basis: 100%; max-width: none; }
  .view-toolbar { padding: 8px 12px; }
  .canvas, .map-wrap { margin: 0 8px 8px; border-radius: 16px; }
  .drawer-panel { top: auto; width: 100%; height: min(88dvh, 100%); border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .sticky-actions { bottom: -28px; }
  .modal { width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; }
  .person-form { max-height: 100dvh; height: 100dvh; }
  .row3, fieldset .row3:has(> .field) { grid-template-columns: 1fr 1fr 1fr; }
  fieldset .row3:has(> .field), .row2 { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 96px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
