/* Семейное древо — стили. Тёплая бумажная палитра, тёмная тема, мобильная вёрстка. */
:root {
  --bg: #f3f0eb; --paper: #ffffff; --ink: #242323; --muted: #6b6560; --line: #e2dbd3; --line-strong: #cfc6bc; --grid: #e3ddd6; --soft: #f7f4f0;
  --accent: #812f34; --accent-hover: #6e272c; --accent-soft: #f8efed; --accent-ink: #ffffff;
  --doc: #2f6b41; --doc-bg: #e9f2ea; --fam: #355a85; --fam-bg: #eaf0f7; --hyp: #9a640b; --hyp-bg: #fbf1dc; --unk: #7d7772; --unk-bg: #efedea; --no: #a23a40; --no-bg: #f8e9e7;
  --m: #4a6f9a; --f: #b05570; --u: #8a8580;
  --shadow-sm: 0 1px 2px rgba(40, 30, 20, .06); --shadow: 0 10px 30px rgba(40, 30, 20, .14);
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --top-h: 60px; --bottom-h: 64px; --detail-w: 440px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1918; --paper: #252321; --ink: #ece7e2; --muted: #a59e97; --line: #3a3633; --line-strong: #4a4541; --grid: #2b2826; --soft: #2d2a28;
    --accent: #e0898f; --accent-hover: #ea9ca1; --accent-soft: #3b2a2b; --accent-ink: #1a1918;
    --doc: #6fbf86; --doc-bg: #1f3326; --fam: #86aee0; --fam-bg: #1f2a38; --hyp: #e3b65a; --hyp-bg: #3a2f17; --unk: #a09a95; --unk-bg: #2f2c2a; --no: #ec8a8f; --no-bg: #3d2224;
    --m: #86aee0; --f: #e48ea8; --u: #8f8984;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
button { font: inherit; color: inherit; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- кнопки и поля --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); font: 500 14px/1 var(--sans); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--accent); }
.icon-btn.danger:hover { color: var(--no); background: var(--no-bg); }
.x-mini { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.x-mini:hover { background: var(--soft); color: var(--ink); }
.x-mini.armed { background: var(--no); color: #fff; }
.link-like { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-align: left; display: inline-flex; align-items: center; gap: 8px; font: inherit; }
.link-like:hover { text-decoration: underline; }
input, select, textarea { font: 15px/1.4 var(--sans); color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; min-height: 42px; transition: border-color .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--paper); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea { resize: vertical; min-height: 72px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.fld.wide, .ro-field.wide { grid-column: 1 / -1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2.mt { margin-top: 12px; }
.inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.ro-field .lbl { font-size: 12px; color: var(--muted); }
.ro-field .val { font-size: 15px; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.empty { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.n { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--soft); color: var(--muted); font: 600 12px/1.5 var(--sans); text-align: center; }

/* --- чипы статусов --- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 20px; background: var(--soft); color: var(--muted); font: 600 12px/1.2 var(--sans); white-space: nowrap; }
.chip.st-doc { color: var(--doc); background: var(--doc-bg); }
.chip.st-fam { color: var(--fam); background: var(--fam-bg); }
.chip.st-hyp { color: var(--hyp); background: var(--hyp-bg); }
.chip.st-unk { color: var(--unk); background: var(--unk-bg); }
.chip.root { color: var(--accent); background: var(--accent-soft); }
.chip.hypc { color: var(--hyp); background: var(--hyp-bg); }

/* --- аватары --- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; background: var(--soft); color: var(--muted); font: 600 13px/1 var(--sans); border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sex-M { box-shadow: inset 0 -3px 0 var(--m); } .avatar.sex-F { box-shadow: inset 0 -3px 0 var(--f); }
.avatar:has(img) { box-shadow: none; }
.av-xs { width: 22px; height: 22px; font-size: 10px; } .av-sm { width: 32px; height: 32px; } .av-md { width: 44px; height: 44px; font-size: 15px; }
.avatar.me { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* --- оболочка --- */
.boot, .detail-loading { display: grid; place-items: center; height: 100%; min-height: 200px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.shell { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: calc(8px + var(--safe-t)); min-height: var(--top-h); background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin-right: 8px; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.logo.big { width: 52px; height: 52px; border-radius: 15px; }
.brand-name { font: 400 19px/1.1 var(--serif); white-space: nowrap; }
.tabs { display: flex; gap: 2px; }
.tab { display: flex; align-items: center; gap: 7px; padding: 0 12px; height: 40px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.tab:hover { color: var(--ink); background: var(--soft); }
.tab.on { color: var(--accent); background: var(--accent-soft); }
.count:empty { display: none; }
.count { min-width: 19px; padding: 0 5px; border-radius: 10px; background: var(--hyp); color: var(--paper); font: 700 11px/19px var(--sans); text-align: center; }
.search { position: relative; margin-left: auto; width: 280px; }
.search input { padding-left: 36px; background: var(--soft); min-height: 40px; }
.search-ic { position: absolute; left: 11px; top: 11px; color: var(--muted); pointer-events: none; }
.search-toggle { display: none; }
.search-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 320px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 40; max-height: 70vh; overflow: auto; }
.sr { display: block; width: 100%; border: 0; background: none; padding: 8px; border-radius: 10px; text-align: left; cursor: pointer; }
.sr.on, .sr:hover { background: var(--soft); }
.sr-row { display: flex; align-items: center; gap: 10px; }
.sr-row b { display: block; font-weight: 600; font-size: 14px; }
.sr-row small { color: var(--muted); font-size: 12px; }
.sr-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--hyp-bg); color: var(--hyp); }
.sr-empty { padding: 12px; color: var(--muted); font-size: 14px; }
.add-btn { flex: none; }
.user-btn { list-style: none; cursor: pointer; padding: 3px; border-radius: 50%; }
.user-btn::-webkit-details-marker { display: none; }

/* меню */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; top: calc(100% + 6px); right: 0; min-width: 250px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 50; display: grid; gap: 1px; }
.menu-pop button, .menu-pop .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; min-height: 42px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; color: var(--ink); text-decoration: none; font-size: 14px; }
.menu-pop button:hover, .menu-pop .menu-item:hover { background: var(--soft); }
.menu-pop .danger { color: var(--no); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-who b { display: block; } .menu-who small { color: var(--muted); }

.main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; position: relative; overflow: hidden; }
body.has-detail .main { grid-template-columns: minmax(0, 1fr) var(--detail-w); }
.stage { min-width: 0; min-height: 0; overflow: auto; position: relative; }
body[data-view="tree"] .stage { overflow: hidden; }
.bottom { display: none; }

/* --- граф --- */
.canvas { position: absolute; inset: 0; background-image: radial-gradient(var(--grid) 1.2px, transparent 1.2px); background-size: 24px 24px; }
svg.graph { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
svg.graph.dragging { cursor: grabbing; }
.vp { transform-origin: 0 0; }
.vp.anim { transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
.node { cursor: pointer; transition: opacity .15s; }
.card { fill: var(--paper); stroke: var(--line-strong); stroke-width: 1.2; transition: stroke .15s; }
.node:hover .card { stroke: var(--accent); }
/* Вместо прямоугольной обводки браузера — подсветка самой карточки. */
.node:focus, .node:focus-visible, .ghost:focus { outline: none; }
.node:focus-visible .card { stroke: var(--accent); stroke-width: 2.6; stroke-dasharray: none; }
.ghost:focus-visible rect { fill: var(--accent-soft); stroke-dasharray: none; }
.node.me .card { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.av-bg { fill: var(--soft); }
.sex-M .av-bg { fill: color-mix(in srgb, var(--m) 22%, var(--paper)); }
.sex-F .av-bg { fill: color-mix(in srgb, var(--f) 22%, var(--paper)); }
.av-text { font: 600 15px var(--sans); fill: var(--ink); opacity: .75; }
.node.dead .t-name { fill: color-mix(in srgb, var(--ink) 82%, var(--paper)); }
.band { fill: var(--grid); opacity: .5; }
.band-label { font: 600 13px var(--sans); fill: var(--muted); letter-spacing: .03em; }
svg.focused:not(.hovering) .node:not(.kin), svg.focused:not(.hovering) .edge:not(.kin) { opacity: .42; }
.node.selected .card { stroke: var(--accent); stroke-width: 2.6; }
.node.ps-hyp .card { stroke-dasharray: 6 4; }
.node.ps-unk .card { stroke-dasharray: 2 4; }
.node.match .card { stroke: var(--hyp); stroke-width: 3; }
.stripe { fill: var(--u); } .sex-M .stripe { fill: var(--m); } .sex-F .stripe { fill: var(--f); }
.avatar-ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.t-sur { font: 600 10.5px var(--sans); fill: var(--muted); letter-spacing: .04em; }
.t-name { font: 15px var(--serif); fill: var(--ink); }
.t-years { font: 11.5px var(--sans); fill: var(--muted); }
.t-badge { font: 600 12px var(--sans); fill: var(--accent); }
.hyp-badge rect { fill: var(--hyp-bg); }
.hyp-badge text { fill: var(--hyp); font: 700 11px var(--sans); }
.edge { fill: none; stroke-width: 1.9; transition: opacity .15s; }
.union { stroke-width: 1.4; }
.s-doc { stroke: var(--doc); } .s-fam { stroke: var(--fam); } .s-hyp { stroke: var(--hyp); stroke-dasharray: 7 5; } .s-unk { stroke: var(--unk); stroke-dasharray: 2 5; }
svg.hovering .node:not(.lit), svg.hovering .edge:not(.lit) { opacity: .16; }
.union-hit { stroke: transparent; stroke-width: 14; }
.union-year { font: 600 11px var(--sans); fill: var(--muted); }
.union-g.ended .edge { opacity: .55; }
.ghost { cursor: pointer; }
.ghost rect { fill: var(--paper); stroke: var(--accent); stroke-dasharray: 4 3; stroke-width: 1.3; }
.ghost text { fill: var(--accent); font: 600 13px var(--sans); }
.ghost:hover rect { fill: var(--accent-soft); stroke-dasharray: none; }
.zoom { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.zoom .icon-btn { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.legend-float { position: absolute; left: 14px; top: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; background: color-mix(in srgb, var(--paper) 90%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-size: 12px; color: var(--muted); max-width: calc(100% - 28px); pointer-events: none; }
.legend-float span { display: inline-flex; align-items: center; gap: 6px; }

/* --- страницы (люди, гипотезы, лента, семья) --- */
.page { padding: 28px 32px 48px; max-width: 1280px; margin: 0 auto; }
.page.narrow { max-width: 820px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font: 400 30px/1.2 var(--serif); display: flex; align-items: center; gap: 10px; }
.page-head .lead { color: var(--muted); margin: 6px 0 0; max-width: 62ch; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 10px; margin-bottom: 14px; }
.people-list { display: grid; gap: 6px; }
.person-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; padding: 10px 14px; min-height: 64px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.person-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.person-row.on { border-color: var(--accent); background: var(--accent-soft); }
.pr-main { min-width: 0; }
.pr-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-main small { color: var(--muted); font-size: 13px; }
.pr-meta { display: flex; gap: 6px; align-items: center; }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; color: var(--muted); text-align: center; }

/* гипотезы */
.chips-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; white-space: nowrap; font-size: 14px; }
.chip-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--soft); border-radius: 16px; padding: 12px; display: grid; gap: 10px; }
.board-col header { display: flex; align-items: center; justify-content: space-between; }
.col-hint { margin: -4px 0 2px; color: var(--muted); font-size: 12.5px; }
.hyp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.hyp-stack { display: grid; gap: 8px; margin-bottom: 10px; }
.hyp-card { display: grid; gap: 8px; width: 100%; text-align: left; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--line); border-left: 4px solid var(--hyp); background: var(--paper); cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.hyp-card:hover { box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.hyp-card.hs-supported { border-left-color: var(--fam); }
.hyp-card.hs-confirmed { border-left-color: var(--doc); }
.hyp-card.hs-rejected { border-left-color: var(--unk); opacity: .78; }
.hyp-card.hs-rejected .hyp-title { text-decoration: line-through; text-decoration-color: var(--muted); }
.hyp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hyp-status { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--sans); color: var(--hyp); text-transform: uppercase; letter-spacing: .05em; }
.hyp-status .dot, .seg .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.hyp-status.hs-supported, .seg.hs-supported { color: var(--fam); }
.hyp-status.hs-confirmed, .seg.hs-confirmed { color: var(--doc); }
.hyp-status.hs-rejected, .seg.hs-rejected { color: var(--unk); }
.seg.hs-open { color: var(--hyp); }
.hyp-score { display: inline-flex; gap: 8px; font: 600 12.5px var(--sans); }
.hyp-score .pro { color: var(--doc); } .hyp-score .con { color: var(--no); }
.hyp-score .cm { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.hyp-title { font: 400 17px/1.35 var(--serif); }
.hyp-statement { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hyp-people { display: flex; flex-wrap: wrap; gap: 5px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 20px; background: var(--soft); font-size: 12.5px; }
.person-chip.big { padding: 2px 2px 2px 4px; font-size: 14px; }
.person-chip.big .link-like { padding: 4px 4px; }
.hyp-next { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.hyp-next b { color: var(--ink); font-weight: 600; }
.hyp-card.compact .hyp-title { font-size: 15px; }

/* лента */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.feed-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--muted); }
.feed-ic.a-create, .feed-ic.a-photo { background: var(--doc-bg); color: var(--doc); }
.feed-ic.a-delete { background: var(--no-bg); color: var(--no); }
.feed-ic.a-comment, .feed-ic.a-evidence, .feed-ic.a-status { background: var(--hyp-bg); color: var(--hyp); }
.feed-body small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.feed-body .link-like { color: var(--ink); }

/* карточки-разделы (семья, MCP) */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 16px; }
.card h2 { font: 400 21px/1.3 var(--serif); margin-bottom: 12px; }
.card h3 { font-size: 13px; color: var(--muted); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.row-end { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-card { display: grid; gap: 4px; text-align: left; padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; }
.role-card small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.role-card.on { border-color: var(--accent); background: var(--accent-soft); }
.invite-result { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--doc-bg); }
.invite-result p { margin: 0 0 10px; }
.copy-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-line code, .copy-line pre { flex: 1 1 260px; min-width: 0; padding: 9px 11px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; margin: 0; white-space: pre-wrap; }
.invite-row, .member-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.member-row select { width: auto; min-width: 140px; }
.invite-row small { display: block; color: var(--muted); font-size: 12.5px; }
.examples { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.tool-list { display: grid; gap: 6px; }
.tool-list div { display: grid; grid-template-columns: 190px 1fr; gap: 10px; font-size: 14px; }
.tool-list code { font: 13px ui-monospace, Menlo, monospace; color: var(--accent); }

/* --- панель подробностей --- */
.detail { background: var(--paper); border-left: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; min-height: 0; position: relative; }
.detail-head { position: sticky; top: 0; z-index: 3; background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 16px 14px; }
.detail-bar { display: flex; align-items: center; gap: 6px; margin: 0 -6px 6px; }
.kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .07em; }
.save-state { margin-left: auto; color: var(--muted); font-size: 12px; }
.detail-title { font: 400 22px/1.25 var(--serif); overflow-wrap: anywhere; }
.detail-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.kin-rel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-top: 6px; font-size: 14px; }
.kin-rel b { font-weight: 600; color: var(--accent); }
.kin-rel span { color: var(--muted); }
.kin-rel span::before { content: '— '; }
.title-fld textarea { font: 400 20px/1.3 var(--serif); background: transparent; border-color: transparent; padding: 6px; margin-left: -6px; min-height: 0; resize: none; overflow: hidden; }
.title-fld textarea:hover { border-color: var(--line); }
.title-fld textarea:focus { border-color: var(--accent); background: var(--paper); }
.title-fld > span { display: none; }
.person-top { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; }
.detail-avatar { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; border: 1px solid var(--line); background: var(--soft); padding: 0; cursor: pointer; display: grid; place-items: center; }
.detail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ph-add { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.quick .btn { padding: 0 6px; }
.detail-body { padding: 4px 16px 40px; }
.block { border-bottom: 1px solid var(--line); padding: 14px 0; }
.block-title { display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px/1.4 var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; }
.sec { padding: 0; }
.sec > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 14px 0; cursor: pointer; min-height: 48px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary .block-title { margin: 0; }
.sec > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.sec[open] > summary::after { transform: rotate(45deg); }
.sec-body { padding-bottom: 16px; }
.meta-foot { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }
.detail-empty { padding: 32px 20px; display: grid; gap: 12px; justify-items: start; }

/* --- вкладки и блоки карточки человека --- */
.person-head { padding-bottom: 0; }
.ptabs { display: flex; gap: 2px; margin: 12px -16px 0; padding: 0 12px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
.ptabs::-webkit-scrollbar { display: none; }
.ptab { position: relative; display: inline-flex; align-items: center; gap: 5px; flex: none; min-height: 46px; padding: 0 7px; border: 0; background: none;
  color: var(--muted); font: 500 14px var(--sans); cursor: pointer; white-space: nowrap; }
.ptab:hover { color: var(--ink); }
.ptab.on { color: var(--accent); font-weight: 600; }
.ptab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2.5px; border-radius: 2px; background: var(--accent); }
.ptab .n { background: var(--soft); }
.ptab.on .n { background: var(--accent-soft); color: var(--accent); }
.detail-body { display: grid; gap: 12px; padding-top: 14px; }
.pcard { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; min-height: 32px; }
.pcard-head h3 { display: flex; align-items: center; gap: 8px; font: 600 13px/1.3 var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pcard-head h3 .ic { color: var(--accent); }
.facts { display: grid; gap: 0; margin: 0; }
.fact { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; padding-top: 0; }
.fact dt { color: var(--muted); font-size: 13px; }
.fact dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.notes-wrap { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.notes-label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.notes-view { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.notes-view.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.link-like.small, .small { font-size: 13px; }
.empty.small { margin: 0 0 6px; font-size: 13px; }
/* семья */
.kin-group { margin-bottom: 10px; }
.kin-group:last-child { margin-bottom: 0; }
.kin-group h4 { font: 600 12.5px var(--sans); color: var(--muted); margin: 0 0 4px; }
.kin { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.kin.managing { grid-template-columns: minmax(0, 1fr) 150px auto; }
.kin-who { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 8px; margin: 0 -8px; border: 0; border-radius: 12px; background: none; cursor: pointer; text-align: left; }
.kin-who:hover { background: var(--soft); }
.kin-text { min-width: 0; display: grid; }
.kin-text b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kin-text small { color: var(--muted); font-size: 12.5px; }
.kin-extra { display: inline-flex; align-items: center; gap: 4px; }
.kin select { min-height: 36px; font-size: 13px; padding: 5px 28px 5px 9px; }
.add-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.add-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 12px 0 9px; border-radius: 17px; border: 1px dashed var(--line-strong);
  background: none; color: var(--accent); font: 500 13px var(--sans); cursor: pointer; }
.add-chip:hover { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.spouse .union-box { margin: 4px 0 10px; }
.add-slot { margin-top: 6px; }
.add-line { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 0 10px; border: 1px dashed var(--line-strong); border-radius: 12px;
  background: none; color: var(--accent); font: 500 14px var(--sans); cursor: pointer; }
.add-line:hover { border-color: var(--accent); background: var(--accent-soft); }
.add-slot .res-form { margin-top: 0; }
/* места жительства — лента времени */
.timeline { position: relative; display: grid; gap: 2px; padding-left: 4px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 10px; bottom: 10px; width: 2px; background: var(--line); border-radius: 1px; }
.tl-item { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 6px 0; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--accent); margin-top: 4px; position: relative; z-index: 1; }
.tl-main b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.tl-when { display: block; color: var(--accent); font: 600 12px var(--sans); }
/* контакты */
.con-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.con-act { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.con-act.static { background: var(--soft); color: var(--muted); }
a.con-act:hover { background: var(--accent); color: var(--accent-ink); }
.con-main { min-width: 0; }
/* гипотезы в карточке */
.mention-list { display: grid; gap: 2px; }
.mention { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; align-items: start; width: 100%; padding: 8px; margin: 0 -8px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; }
.mention:hover { background: var(--soft); }
.mention .hyp-status { margin-top: 5px; }
.mention b { display: block; font: 400 15px/1.35 var(--serif); }
.mention small { color: var(--muted); font-size: 12.5px; }
.person-chip.subject { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.hyp-people .also { color: var(--muted); font-size: 12px; align-self: center; }
.subject-row { display: flex; align-items: center; gap: 8px; }
.subject-row select { flex: 1; }
.chip.me-chip { color: var(--doc); background: var(--doc-bg); }
.me-badge rect { fill: var(--doc-bg); }
.me-badge text { fill: var(--doc); font: 700 10.5px var(--sans); }
/* семья и доступ */
.segmented.two { grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.inline.tight { margin-top: 0; }
pre.cred { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); font: 13px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; }
.member-card { padding: 4px 0 12px; border-bottom: 1px solid var(--line); }
.member-card .member-row { border-bottom: 0; }
.member-edit { margin: 0 0 4px 56px; }
.member-actions { display: flex; align-items: center; gap: 4px; }
/* фото */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.thumb { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--soft); display: flex; flex-direction: column; }
.thumb.main { border-color: var(--accent); }
.thumb-img { all: unset; cursor: zoom-in; display: block; aspect-ratio: 1; background: var(--bg); }
.thumb-img:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-bar { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 0 10px; }
.main-badge { font: 600 11.5px var(--sans); color: var(--accent); }
.thumb input { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 13px; min-height: 38px; }
.cap-ro { padding: 6px 10px 8px; font-size: 13px; color: var(--muted); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 18px; text-align: center; cursor: pointer; display: grid; justify-items: center; gap: 4px; color: var(--muted); font-size: 13px; transition: background .15s, border-color .15s; }
.drop b { color: var(--ink); font-size: 15px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.progress { height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; margin-bottom: 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* родственники и ссылки */
.rel-group { margin-bottom: 14px; }
.rel-group h4 { font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.rel-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 6px; align-items: center; margin-bottom: 4px; }
.rel-row select { font-size: 13px; min-height: 38px; padding: 6px 28px 6px 9px; }
.rel-who { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px; margin-left: -6px; border-radius: 10px; cursor: pointer; text-align: left; min-width: 0; }
.rel-who:hover { background: var(--soft); }
.rel-who b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-who small { color: var(--muted); font-size: 12px; }
.rel-who > span { min-width: 0; }
.spouse { margin-bottom: 8px; }
.union-line { display: flex; align-items: center; gap: 8px; margin: -2px 0 4px 48px; color: var(--muted); font-size: 13px; }
.union-line .union-sum { flex: 1; min-width: 0; }
.union-box { margin: 6px 0 10px 48px; padding: 12px; border-radius: 12px; background: var(--soft); }
.union-box input, .union-box select, .union-box textarea { background: var(--paper); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 0 8px; }
.btn.ghost:hover { background: var(--accent-soft); }
.res-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.res-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--muted); }
.res-main b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.res-main small { color: var(--muted); font-size: 12.5px; }
.res-note { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: pre-wrap; }
.con-kind { display: block; text-transform: uppercase; letter-spacing: .05em; font-size: 11px !important; font-weight: 600; }
.con-val { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 2px; }
.res-form { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.res-form .btnrow { justify-content: flex-start; }
.con-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px; }
.hint.privacy { margin: 0 0 8px; }
.link-existing { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.link-existing .btn { justify-self: start; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.link-row a { display: inline-flex; align-items: center; gap: 5px; overflow-wrap: anywhere; line-height: 1.35; }
.link-row small { display: block; color: var(--muted); font-size: 12px; }
.link-form { display: grid; gap: 8px; margin-top: 12px; }
.link-form .btn { justify-self: start; }

/* гипотеза: статус и доводы */
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 13px; background: var(--soft); }
.seg { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 0; border-radius: 10px; background: none; cursor: pointer; font: 500 13px var(--sans); color: var(--muted); padding: 0 6px; }
.seg .dot { opacity: .7; }
.seg.on { background: var(--paper); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg.on.hs-open { color: var(--hyp); } .seg.on.hs-supported { color: var(--fam); } .seg.on.hs-confirmed { color: var(--doc); } .seg.on.hs-rejected { color: var(--ink); }
.seg:not(.on) { color: var(--muted); }
.seg:disabled { cursor: default; }
.people-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.people-chips select { width: auto; min-width: 220px; font-size: 14px; }
.ev-grid { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ev-col { border-radius: 14px; padding: 12px; }
.ev-col.ev-for { background: var(--doc-bg); }
.ev-col.ev-against { background: var(--no-bg); }
.ev-col h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.ev-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 700 15px/1 var(--sans); }
.ev-for .ev-mark { background: var(--doc); } .ev-against .ev-mark { background: var(--no); }
.ev-item { background: var(--paper); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.ev-text { font-size: 14px; white-space: pre-wrap; }
.ev-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ev-meta a { display: inline-flex; align-items: center; gap: 4px; }
.ev-meta .x-mini { margin-left: auto; width: 30px; height: 30px; }
.ev-form { display: grid; gap: 6px; margin-top: 8px; }
.ev-form textarea, .ev-form input { background: var(--paper); }
.ev-form .btn { justify-self: start; }

/* обсуждение */
.comments { border-bottom: 0; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.c-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.c-head .x-mini { margin-left: auto; width: 30px; height: 30px; }
.c-text { white-space: pre-wrap; font-size: 14.5px; margin-top: 2px; overflow-wrap: anywhere; }
.c-form { display: grid; gap: 8px; margin-top: 10px; }
.c-form .btn { justify-self: end; }

/* --- вход --- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand h1 { font: 400 26px/1.2 var(--serif); }
.auth-form { display: grid; gap: 14px; }
.auth-form .fld { font-size: 13px; }
.form-err:empty { display: none; }
.form-err { color: var(--no); background: var(--no-bg); padding: 9px 12px; border-radius: 10px; margin: 0; font-size: 14px; }
.invite-note { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }

/* --- уведомление --- */
#toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper);
  border-radius: 14px; padding: 11px 12px 11px 16px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); font-size: 14px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.err { background: var(--no); color: #fff; }
#toast button { min-height: 34px; padding: 0 12px; border-radius: 9px; background: transparent; color: inherit; border: 1px solid currentColor; font-weight: 600; cursor: pointer; }

/* --- просмотр фото --- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(12, 10, 8, .92); display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); touch-action: pan-y; }
.lb-stage { display: grid; place-items: center; min-height: 0; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-cap { display: grid; justify-items: center; gap: 2px; color: #eee; text-align: center; padding-top: 12px; font-size: 14px; }
.lb-cap small { color: #aaa; }
.lb-cap a { color: #f0b5b8; }
.lightbox .icon-btn { color: #fff; background: rgba(255, 255, 255, .1); position: absolute; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.lb-close { top: calc(14px + var(--safe-t)); right: 14px; }
.lb-prev { left: 14px; top: 50%; }
.lb-next { right: 14px; top: 50%; transform: scaleX(-1); }

/* --- нижний лист (мобильный) --- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .35); display: grid; align-items: end; animation: fade .15s; }
.sheet { background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + var(--safe-b)); display: grid; gap: 6px; animation: up .22s cubic-bezier(.2, .7, .2, 1); }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); justify-self: center; margin: 4px 0 8px; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 12px; min-height: 60px; border: 0; background: none; border-radius: 12px; text-align: left; cursor: pointer; }
.sheet-item:hover { background: var(--soft); }
.sheet-item b { display: block; }
.sheet-item small { color: var(--muted); }
.sheet-item .ic { color: var(--accent); }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* --- планшеты --- */
@media (max-width: 1180px) {
  :root { --detail-w: 400px; }
  .tab span:not(.count) { display: none; }
  .tab { padding: 0 10px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { width: 220px; }
}
@media (max-width: 960px) {
  body.has-detail .main { grid-template-columns: minmax(0, 1fr); }
  body.has-detail .detail { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(var(--detail-w), 100%); z-index: 30; box-shadow: var(--shadow); }
  .page { padding: 22px 20px 40px; }
}

/* --- телефоны --- */
@media (max-width: 760px) {
  :root { --top-h: 56px; }
  body { font-size: 16px; }
  input, select, textarea { font-size: 16px; } /* без автоприближения в iOS */
  .shell { grid-template-rows: auto minmax(0, 1fr) auto; }
  .top { padding: 6px 8px 6px 12px; padding-top: calc(6px + var(--safe-t)); gap: 4px; }
  .tabs, .add-btn { display: none; }
  .brand-name { font-size: 18px; }
  .search { width: auto; margin-left: auto; }
  .search > input, .search > .search-ic { display: none; }
  .search-toggle { display: inline-grid; }
  .search.open { position: fixed; inset: 0 0 auto 0; padding: 8px 10px; padding-top: calc(8px + var(--safe-t)); background: var(--paper); z-index: 60; border-bottom: 1px solid var(--line); }
  .search.open > input { display: block; padding-left: 38px; }
  .search.open > .search-ic { display: block; left: 22px; top: calc(19px + var(--safe-t)); }
  .search.open > .search-toggle { display: none; }
  .search.open .search-res { position: fixed; top: calc(62px + var(--safe-t)); left: 0; right: 0; bottom: 0; min-width: 0; max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; background: var(--paper); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); min-height: calc(var(--bottom-h) + var(--safe-b)); position: relative; z-index: 20; }
  .bnav { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; position: relative; min-height: 56px; }
  .bnav.on { color: var(--accent); }
  .bnav .count { position: absolute; top: 4px; left: calc(50% + 6px); }
  .fab { justify-self: center; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); cursor: pointer; }
  .bottom:not(:has(.fab)) { grid-template-columns: repeat(4, 1fr); }

  body.has-detail .detail { position: fixed; inset: 0; width: auto; top: 0; z-index: 70; border: 0; animation: up .25s cubic-bezier(.2, .7, .2, 1); padding-bottom: var(--safe-b); }
  .detail-head { position: static; padding: 6px 12px 12px; padding-top: calc(6px + var(--safe-t)); }
  .detail-body { padding: 0 14px 40px; }
  .person-top { grid-template-columns: 64px minmax(0, 1fr); }
  .detail-avatar { width: 64px; height: 64px; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .rel-row { grid-template-columns: minmax(0, 1fr) auto; }
  .rel-row select { grid-column: 1 / -1; grid-row: 2; }
  .rel-row .x-mini { grid-row: 1; grid-column: 2; }
  .segmented { grid-template-columns: 1fr 1fr; }
  .ptabs { margin: 10px -12px 0; padding: 0 6px; }
  .fact { grid-template-columns: 110px minmax(0, 1fr); }
  .kin.managing { grid-template-columns: minmax(0, 1fr) auto; }
  .kin.managing select { grid-column: 1 / -1; grid-row: 2; }
  .member-edit { margin-left: 0; }
  .member-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .union-line, .union-box { margin-left: 0; }
  .con-grid { grid-template-columns: 1fr; }
  .res-row { grid-template-columns: 34px minmax(0, 1fr); }
  .res-row .row-actions { grid-column: 2; }

  .page { padding: 16px 14px 28px; }
  .page-head { flex-direction: column; }
  .page-head h1 { font-size: 26px; }
  .page-head .btn { display: none; }
  .toolbar { grid-template-columns: 1fr; }
  .person-row { grid-template-columns: auto minmax(0, 1fr); padding: 10px 12px; }
  .pr-meta { grid-column: 2; flex-wrap: wrap; }
  .board, .hyp-grid { grid-template-columns: 1fr; }
  .role-cards { grid-template-columns: 1fr; }
  .member-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .member-row select, .member-row > .chip { grid-column: 2 / -1; justify-self: start; }
  .tool-list div { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 16px; border-radius: 16px; }
  .legend-float { left: 8px; top: 8px; font-size: 11px; gap: 4px 10px; padding: 6px 10px; }
  .zoom { right: 10px; bottom: 10px; }
  #toast { bottom: calc(var(--bottom-h) + 14px + var(--safe-b)); }
  body.has-detail #toast { bottom: calc(16px + var(--safe-b)); }
  .lb-prev, .lb-next { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .top, .bottom, .detail, .zoom, .legend-float { display: none !important; } .shell { display: block; } .canvas { position: static; height: 100vh; } }
