/* Rossmoine Family Tree — visual design. Colours are tokens; dark mode redefines them. */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bg: #eef1f5;
  --canvas: #f5f7fa;
  --dot: rgba(60, 72, 88, 0.14);
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --surface-3: #e9edf2;
  --border: #e1e5eb;
  --border-strong: #ccd3dc;
  --text: #17202b;
  --text-2: #4b5664;
  --text-3: #7e8997;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #e8efff;
  --accent-ring: rgba(37, 99, 235, 0.3);
  --male: #2f6fd0;
  --male-soft: #dce8fb;
  --female: #c93f78;
  --female-soft: #fbe2ec;
  --neutral: #6f7b89;
  --neutral-soft: #e7eaef;
  --ok: #15924a;
  --ok-soft: #dcf5e5;
  --warn: #c76f05;
  --warn-soft: #fdf0d5;
  --muted-st: #858f9d;
  --danger: #dc2626;
  --danger-soft: #fde4e4;
  --line: #a3adbb;
  --line-faint: #c9d0d9;
  --spouse: #d9679a;
  --card-shadow: rgba(23, 32, 43, 0.075);
  --toast: #1e2632;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 22px 60px rgba(16, 24, 40, 0.2), 0 6px 16px rgba(16, 24, 40, 0.08);
  --fan-l1: 79%; --fan-l2: 83%; --fan-l3: 86.5%; --fan-l4: 89%; --fan-l5: 91%; --fan-l6: 92.5%; --fan-l7: 94%;
  --fan-s: 62%;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1115; --canvas: #12161b; --dot: rgba(255, 255, 255, 0.065); --surface: #1a1f26; --surface-2: #20262e;
    --surface-3: #29303a; --border: #2b323c; --border-strong: #3a434f; --text: #e7ebf0; --text-2: #a8b2be; --text-3: #7b8695;
    --accent: #5b8def; --accent-2: #93b4ff; --accent-soft: #1d2a44; --accent-ring: rgba(91, 141, 239, 0.38);
    --male: #79a6ee; --male-soft: #1e3050; --female: #ee88b2; --female-soft: #452035; --neutral: #a2acb8; --neutral-soft: #2a313b;
    --ok: #3cc673; --ok-soft: #163625; --warn: #f0a63a; --warn-soft: #3a2a12; --muted-st: #8a95a3; --danger: #f87171; --danger-soft: #3c1c1c;
    --line: #586373; --line-faint: #39414c; --spouse: #e383ac; --card-shadow: rgba(0, 0, 0, 0.35); --toast: #2b323d;
    --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.55), 0 6px 16px rgba(0, 0, 0, 0.35);
    --fan-l1: 34%; --fan-l2: 30%; --fan-l3: 27%; --fan-l4: 24%; --fan-l5: 22%; --fan-l6: 20%; --fan-l7: 18%; --fan-s: 42%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1115; --canvas: #12161b; --dot: rgba(255, 255, 255, 0.065); --surface: #1a1f26; --surface-2: #20262e;
  --surface-3: #29303a; --border: #2b323c; --border-strong: #3a434f; --text: #e7ebf0; --text-2: #a8b2be; --text-3: #7b8695;
  --accent: #5b8def; --accent-2: #93b4ff; --accent-soft: #1d2a44; --accent-ring: rgba(91, 141, 239, 0.38);
  --male: #79a6ee; --male-soft: #1e3050; --female: #ee88b2; --female-soft: #452035; --neutral: #a2acb8; --neutral-soft: #2a313b;
  --ok: #3cc673; --ok-soft: #163625; --warn: #f0a63a; --warn-soft: #3a2a12; --muted-st: #8a95a3; --danger: #f87171; --danger-soft: #3c1c1c;
  --line: #586373; --line-faint: #39414c; --spouse: #e383ac; --card-shadow: rgba(0, 0, 0, 0.35); --toast: #2b323d;
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.55), 0 6px 16px rgba(0, 0, 0, 0.35);
  --fan-l1: 34%; --fan-l2: 30%; --fan-l3: 27%; --fan-l4: 24%; --fan-l5: 22%; --fan-l6: 20%; --fan-l7: 18%; --fan-s: 42%;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.icon { flex: none; display: block; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-track { background: transparent; }

#app { height: 100vh; display: flex; flex-direction: column; }
.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--text-3); text-align: center; }
.boot.error { color: var(--text-2); }
.boot-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar {
  height: 58px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 12px 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--border); z-index: 6; position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(135deg, #2f6fe0, #5b4fd6); box-shadow: 0 2px 6px rgba(47, 111, 224, 0.35);
}
.brand-text b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.brand-count { display: block; font-size: 12px; color: var(--text-3); }
.views { margin: 0 auto; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.btn-group { display: flex; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button:hover { color: var(--text); background: var(--surface-3); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.on .icon { color: var(--accent); }
.seg.small button { padding: 3px 9px; font-size: 12.5px; }
.seg.tabs { display: flex; margin-bottom: 16px; }
.seg.tabs button { flex: 1; justify-content: center; }

.searchbox {
  display: flex; align-items: center; gap: 8px; width: 240px; height: 36px; padding: 0 8px 0 11px; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 9px; color: var(--text-3); cursor: text; transition: border-color 0.15s, background 0.15s;
}
.searchbox:hover { border-color: var(--border-strong); background: var(--surface); }
.searchbox span { flex: 1; text-align: left; }
kbd {
  font: 600 11px var(--font); color: var(--text-3); background: var(--surface); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}

.btn {
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  white-space: nowrap; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
:root[data-theme="dark"] .btn.primary:hover { color: #0d1626; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(0.93); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.danger-text { color: var(--danger) !important; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; flex: none; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.32; cursor: default; background: transparent; }
.icon-btn.small { width: 30px; height: 30px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; }
.link-btn.muted { color: var(--text-3); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ---------- main area ---------- */
.main { flex: 1; display: flex; min-height: 0; position: relative; }
.canvas {
  flex: 1; position: relative; overflow: hidden; min-width: 0;
  background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px); background-size: 24px 24px;
}
.canvas.is-timeline { background-image: none; }
.stage { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.panning .stage { cursor: grabbing; }
.canvas.is-timeline .stage { display: none; }
.panel { width: 0; flex: none; overflow: hidden; background: var(--surface); border-left: 1px solid var(--border); transition: width 0.24s cubic-bezier(0.3, 0.7, 0.2, 1); }
.main.panel-open .panel { width: 424px; }

.ctxbar { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; align-items: center; gap: 10px; pointer-events: none; z-index: 4; }
.ctxbar > * { pointer-events: auto; }
.ctx-nav, .ctx-text, .ctx-tools, .zoombar, .legend-toggle, .legend-body {
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
.ctx-nav { display: flex; border-radius: 10px; padding: 2px; }
.ctx-text { border-radius: 10px; padding: 5px 13px 6px; min-width: 0; }
.ctx-title { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.ctx-sub { font-size: 12px; color: var(--text-3); }
.ctx-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 4px 5px 4px 10px; }
.ctx-tools:empty { display: none; }
.tool-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.zoombar { position: absolute; left: 14px; bottom: 14px; display: flex; align-items: center; border-radius: 11px; padding: 3px; z-index: 4; box-shadow: var(--shadow-md); }
.zoom-label { min-width: 54px; height: 32px; border: 0; background: none; cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--text-2); border-radius: 7px; }
.zoom-label:hover { background: var(--surface-2); }
.zoom-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.zoombar .icon-btn { width: 32px; height: 32px; }

.legend { position: absolute; right: 14px; bottom: 14px; z-index: 4; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
.legend-toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.legend-body { display: none; border-radius: 12px; padding: 10px 14px; font-size: 12.5px; color: var(--text-2); box-shadow: var(--shadow-md); }
.legend.open .legend-body { display: block; }
.lg-row { display: flex; align-items: center; gap: 9px; padding: 3px 0; }
.lg-badge { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex: none; }
.lg-badge.confirmed { background: var(--ok); }
.lg-badge.theory { background: var(--warn); }
.lg-badge.unknown { background: var(--surface); color: var(--muted-st); border: 1.5px dashed var(--muted-st); }
.lg-line { width: 26px; border-top: 2px solid var(--line); flex: none; }
.lg-line.dashed { border-top-style: dashed; }
.lg-heart { color: var(--spouse); width: 26px; display: grid; place-items: center; }
.lg-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.lg-dot.sex-M { background: var(--male-soft); border: 2px solid var(--male); }
.lg-dot.sex-F { background: var(--female-soft); border: 2px solid var(--female); margin-left: 8px; }

/* ---------- person cards (SVG) ---------- */
.card { cursor: pointer; }
.card .card-shadow { fill: var(--card-shadow); }
.card .card-bg { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; transition: stroke 0.15s; }
.card.status-theory .card-bg { stroke: color-mix(in srgb, var(--warn) 70%, var(--border-strong)); stroke-dasharray: 6 4; stroke-width: 1.3; }
.card.status-unknown .card-bg { fill: var(--surface-2); stroke-dasharray: 2 3; stroke-width: 1.3; }
.card.status-unknown .card-name { fill: var(--text-2); }
.card:hover .card-bg { stroke: var(--accent); stroke-dasharray: none; }
.card .card-ring { fill: none; stroke: transparent; stroke-width: 3; transition: stroke 0.2s; }
.card.is-family .card-ring { stroke: var(--accent-ring); stroke-width: 2.5; }
.card.is-selected .card-ring { stroke: var(--accent); stroke-width: 3; }
.card.is-selected .card-bg { stroke: var(--accent); stroke-dasharray: none; stroke-width: 1.4; }
.card.is-home .card-bg { stroke: var(--accent); stroke-width: 2; stroke-dasharray: none; }
.card .avatar { fill: var(--neutral-soft); }
.card.sex-M .avatar { fill: var(--male-soft); }
.card.sex-F .avatar { fill: var(--female-soft); }
.card .avatar-text { font: 650 14px var(--font); fill: var(--neutral); letter-spacing: 0.02em; }
.card.sex-M .avatar-text { fill: var(--male); }
.card.sex-F .avatar-text { fill: var(--female); }
.card-name { font: 600 13.5px var(--font); fill: var(--text); }
.card-years { font: 12px var(--font); fill: var(--text-2); }
.card-rel { font: 600 11.5px var(--font); fill: var(--accent); }
.card-rel.rel-spouse, .card-rel.rel-in-law, .card-rel.rel-step, .card-rel.rel-marriage { fill: var(--text-3); }
.badge circle { fill: var(--ok); }
.badge path { stroke: #fff; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.badge text { font: 800 11px var(--font); fill: #fff; }
.badge-theory circle { fill: var(--warn); }
.badge-unknown circle { fill: var(--surface); stroke: var(--muted-st); stroke-width: 1.3; stroke-dasharray: 2 2; }
.badge-unknown text { fill: var(--muted-st); }
.card-add { opacity: 0; transition: opacity 0.15s; }
.card:hover .card-add, .card.is-selected .card-add { opacity: 1; }
.card-add circle { fill: var(--accent); stroke: var(--canvas); stroke-width: 3; }
.card-add path { stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.card-add:hover circle { fill: var(--accent-2); }
.slot { cursor: pointer; }
.slot-bg { fill: transparent; stroke: var(--border-strong); stroke-dasharray: 5 4; stroke-width: 1.3; transition: fill 0.15s, stroke 0.15s; }
.slot-text { font: 600 13px var(--font); fill: var(--text-3); }
.slot:hover .slot-bg { stroke: var(--accent); fill: var(--accent-soft); }
.slot:hover .slot-text { fill: var(--accent); }
.entering { animation: fadein 0.34s ease both; }
@keyframes fadein { from { opacity: 0; } }
.leaving { opacity: 0; transition: opacity 0.22s; pointer-events: none; }
.lod-low .card-years, .lod-low .card-rel, .lod-low .card-add, .lod-low .slot-text { display: none; }
/* Viewers and contributors: no "+" on cards and no empty "Add father" slots (main.ts mayEdit). */
.read-only .card-add, .read-only .slot { display: none; }
.read-only .fan-slot.empty { pointer-events: none; }
/* Map mode when zoomed far out: cards become tinted blocks so the shape of the tree stays readable. */
.lod-tiny .card text, .lod-tiny .card image, .lod-tiny .card .avatar, .lod-tiny .card .card-shadow, .lod-tiny .badge, .lod-tiny .heart { display: none; }
.lod-tiny .card .card-bg { stroke: none; fill: color-mix(in srgb, var(--neutral) 32%, var(--surface)); }
.lod-tiny .card.sex-M .card-bg { fill: color-mix(in srgb, var(--male) 42%, var(--surface)); }
.lod-tiny .card.sex-F .card-bg { fill: color-mix(in srgb, var(--female) 40%, var(--surface)); }
.lod-tiny .card.status-unknown .card-bg { fill: color-mix(in srgb, var(--neutral) 18%, var(--surface)); }
.lod-tiny .card.is-home .card-bg, .lod-tiny .card.is-selected .card-bg { fill: var(--accent); }
.lod-tiny .card.is-selected .card-ring { stroke-width: 30px; }
.lod-tiny .caption { font-size: 110px; }
.edge, .spouse, .slot-bg { vector-effect: non-scaling-stroke; }
.show-gaps .card:not(.gap) { opacity: 0.22; }
.show-gaps .card.gap .card-bg { stroke: var(--warn); stroke-width: 2.2; stroke-dasharray: none; }

.edge { fill: none; stroke: var(--line); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.edge.dashed { stroke-dasharray: 5 4.5; stroke-linecap: butt; }
.edge.faint { stroke: var(--line-faint); }
.spouse { fill: none; stroke: var(--spouse); stroke-width: 1.7; }
.spouse.dashed { stroke-dasharray: 5 4; }
.heart circle { fill: var(--canvas); stroke: var(--spouse); stroke-width: 1.3; }
.heart path { fill: var(--spouse); }
.edges { transition: opacity 0.25s ease; }
.edges.fading { opacity: 0; transition: none; }
.caption { font: 650 14px var(--font); fill: var(--text-3); letter-spacing: 0.01em; }

/* ---------- fan chart ---------- */
.fan-slot { cursor: pointer; }
.fan-slot path { stroke: var(--canvas); stroke-width: 2; transition: filter 0.15s; }
.fan-slot.lineage-0 { --h: 214; }
.fan-slot.lineage-1 { --h: 178; }
.fan-slot.lineage-2 { --h: 36; }
.fan-slot.lineage-3 { --h: 334; }
.fan-slot.gen-1 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l1)); }
.fan-slot.gen-2 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l2)); }
.fan-slot.gen-3 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l3)); }
.fan-slot.gen-4 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l4)); }
.fan-slot.gen-5 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l5)); }
.fan-slot.gen-6 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l6)); }
.fan-slot.gen-7 path { fill: hsl(var(--h) var(--fan-s) var(--fan-l7)); }
.fan-slot.status-theory path, .fan-slot.status-unknown path { fill-opacity: 0.62; }
.fan-slot:hover path { filter: brightness(0.93) saturate(1.2); }
.fan-slot.empty path { fill: var(--surface-2); stroke: var(--border-strong); stroke-dasharray: 4 3; stroke-width: 1.2; }
.fan-slot.empty:hover path { fill: var(--accent-soft); stroke: var(--accent); filter: none; }
.fan-slot.is-selected path { stroke: var(--accent); stroke-width: 3; }
.fan-name { font: 600 13px var(--font); fill: var(--text); pointer-events: none; }
.fan-years { font: 11.5px var(--font); fill: var(--text-2); pointer-events: none; }
.fan-plus { font: 600 20px var(--font); fill: var(--text-3); pointer-events: none; }
.fan-center { cursor: default; }
.fan-center circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.fan-center-name { font: 650 15px var(--font); fill: var(--text); }
.fan-center-years { font: 12.5px var(--font); fill: var(--text-2); }
.fan-key { stroke: none; }
.fan-key.lineage-0 { fill: hsl(214 var(--fan-s) var(--fan-l1)); }
.fan-key.lineage-1 { fill: hsl(178 var(--fan-s) var(--fan-l1)); }
.fan-key.lineage-2 { fill: hsl(36 var(--fan-s) var(--fan-l1)); }
.fan-key.lineage-3 { fill: hsl(334 var(--fan-s) var(--fan-l1)); }
.fan-key-text { font: 12.5px var(--font); fill: var(--text-2); }

/* ---------- side panel ---------- */
.profile { width: 424px; height: 100%; display: flex; flex-direction: column; }
.profile-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.profile-top { display: flex; gap: 14px; align-items: flex-start; position: relative; }
.profile-avatar { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }
.avatar-el {
  display: inline-grid; place-items: center; border-radius: 50%; font-weight: 650; overflow: hidden; flex: none; letter-spacing: 0.02em;
  background: var(--neutral-soft); color: var(--neutral); user-select: none;
}
.avatar-el.sex-M { background: var(--male-soft); color: var(--male); }
.avatar-el.sex-F { background: var(--female-soft); color: var(--female); }
.avatar-el img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-cam {
  position: absolute; right: -3px; bottom: -3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); opacity: 0; transition: opacity 0.15s; box-shadow: var(--shadow-sm);
}
.profile-avatar:hover .avatar-cam, .profile-avatar:focus-visible .avatar-cam { opacity: 1; }
.profile-title { flex: 1; min-width: 0; }
.profile-title h2 { margin: 2px 0 3px; font-size: 19px; line-height: 1.25; font-weight: 680; letter-spacing: -0.015em; overflow-wrap: anywhere; padding-right: 26px; }
.profile-life { color: var(--text-2); font-size: 13px; margin-bottom: 9px; }
.profile-close { position: absolute; top: -6px; right: -8px; }
.profile-actions { display: flex; gap: 8px; margin-top: 15px; align-items: center; }
.profile-actions .icon-btn { margin-left: auto; border-color: var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap;
}
.chip.small { height: 20px; font-size: 11px; padding: 0 7px; }
.chip.clickable, .chip.toggle { cursor: pointer; }
.chip.clickable:hover { border-color: var(--accent); color: var(--accent); }
.chip.toggle.on { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip .count { margin-left: 2px; }
.rel-chip { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; cursor: pointer; }
.rel-chip:hover, .rel-chip.on { background: var(--accent); color: #fff; }
.home-chip { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.status-chip .chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-chip.status-confirmed { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.status-chip.status-theory { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.status-chip.status-unknown { color: var(--muted-st); background: var(--surface-2); border-style: dashed; }
.ptabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); flex: none; }
.ptab {
  border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--text-3); padding: 11px 8px 10px; border-bottom: 2px solid transparent;
  cursor: pointer; display: flex; gap: 6px; align-items: center; margin-bottom: -1px;
}
.ptab:hover { color: var(--text); }
.ptab.on { color: var(--text); border-bottom-color: var(--accent); }
.count { font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 7px; line-height: 1.5; }
.count.warn { background: var(--warn-soft); color: var(--warn); }
.profile-body { flex: 1; overflow-y: auto; padding: 14px 14px 32px; scrollbar-gutter: stable; }
.profile-empty { margin: auto; text-align: center; color: var(--text-3); padding: 60px 40px; display: grid; justify-items: center; }
.profile-empty h3 { color: var(--text); margin: 12px 0 4px; }
.card-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 10px; margin-bottom: 12px; }
.card-sec h3 { margin: 0 2px 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); font-weight: 750; }
.fact { display: flex; gap: 12px; padding: 5px 2px; align-items: baseline; }
.fact-label { width: 46px; color: var(--text-3); font-size: 13px; flex: none; }
.fact-value { flex: 1; font-size: 13.5px; }
.fam-label { font-size: 12px; font-weight: 650; color: var(--text-2); margin: 12px 2px 4px; }
.family h3 + .fam-label { margin-top: 2px; }
.fam-sub { font-size: 12px; color: var(--text-3); margin: 6px 8px 0; font-style: italic; }
.fam-kids { margin: 2px 0 6px 22px; padding-left: 8px; border-left: 2px solid var(--border); }
.prow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; position: relative; min-width: 0; }
.prow.clickable { cursor: pointer; }
.prow.clickable:hover { background: var(--surface-2); }
.prow-text { flex: 1; min-width: 0; }
.prow-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-icon { color: var(--spouse); display: grid; margin-right: -4px; }
.tag { font-size: 10px; font-weight: 750; text-transform: uppercase; color: var(--text-3); background: var(--surface-3); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.row-action { width: 28px; height: 28px; opacity: 0; }
.prow:hover .row-action { opacity: 0.75; }
.row-action:hover { opacity: 1 !important; color: var(--danger); }
.add-row {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 1px dashed var(--border-strong); background: transparent; color: var(--text-3);
  font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 9px; cursor: pointer; margin: 4px 0; transition: 0.15s;
}
.add-row:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.add-row.small { padding: 4px 8px; font-size: 12.5px; }
.status-explain { margin: 0 2px 8px; font-size: 13px; color: var(--text-2); }
.research-stats { display: flex; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.stat-link {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.stat-link:hover { border-color: var(--accent); color: var(--accent); }
.q-list { margin: 8px 2px 2px; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.q-list li::marker { color: var(--warn); }
.q-list li + li { margin-top: 3px; }
.path-card { border-color: var(--accent-ring); background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
.path { list-style: none; margin: 0; padding: 0 2px; }
.path li { position: relative; padding: 3px 0 7px 20px; }
.path li::before { content: ""; position: absolute; left: 5px; top: 12px; bottom: -4px; border-left: 2px solid var(--accent-ring); }
.path li.last::before { display: none; }
.path li::after { content: ""; position: absolute; left: 1px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.path-via { display: block; font-size: 11.5px; color: var(--text-3); }
.path-name { border: 0; background: none; padding: 0; font-weight: 650; color: var(--accent-2); cursor: pointer; text-align: left; }
.path-name:hover { text-decoration: underline; }
.path-name small { color: var(--text-3); font-weight: 400; margin-left: 6px; }

/* research notes */
.notes-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.note-run { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.note-run-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: var(--accent-2); margin-bottom: 6px; flex-wrap: wrap; }
.note-run-head .muted { text-transform: capitalize; font-weight: 500; }
.note-h { margin: 14px 0 6px; font-size: 11.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); font-weight: 750; }
.note-h.q { color: var(--warn); }
.note-h.src { color: var(--accent-2); }
.note-h.facts { color: var(--ok); }
.note-meta { margin-left: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-3); }
.note-p { margin: 6px 0; font-size: 13.5px; line-height: 1.58; white-space: pre-line; overflow-wrap: anywhere; }
.note-list { margin: 4px 0 8px; padding-left: 18px; }
.note-list li { margin: 6px 0; font-size: 13.5px; line-height: 1.58; overflow-wrap: anywhere; }
.note-list li::marker { color: var(--text-3); }
.note-list.q li::marker { color: var(--warn); }
.evidence {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; height: 19px;
  vertical-align: 1px; max-width: 100%; cursor: help;
}
.evidence.confirmed { background: var(--ok-soft); color: var(--ok); }
.evidence.inferred { background: var(--warn-soft); color: var(--warn); }
.evidence-why { font-weight: 500; opacity: 0.85; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 2px; }
.src-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--accent-soft);
  color: var(--accent-2); text-decoration: none; vertical-align: 1px; line-height: 1.6;
}
.src-chip:hover { background: var(--accent); color: #fff; }
.src-chip b { font-weight: 650; white-space: nowrap; }
.src-chip span { opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.notes-edit { display: flex; flex-direction: column; gap: 10px; }
.notes-area { min-height: 420px; font-size: 13px; }
.sources { display: flex; flex-direction: column; gap: 14px; }
.src-group h4 { display: flex; align-items: center; gap: 8px; margin: 0 2px 6px; font-size: 13px; }
.src-item { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; }
.src-text { flex: 1; min-width: 0; }
.src-context { font-size: 13px; overflow-wrap: anywhere; }
.src-url { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-item .icon-btn { width: 30px; height: 30px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); }
.input {
  height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text);
  font: inherit; outline: none; transition: border-color 0.15s, box-shadow 0.15s; width: 100%; min-width: 0;
}
textarea.input { height: auto; padding: 9px 11px; line-height: 1.5; resize: vertical; }
select.input { padding-right: 6px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--text-3); }
.row-life { display: grid; grid-template-columns: 96px 1fr; gap: 10px; }
.row2 { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.row2 .seg, .edit-form .seg { width: fit-content; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.form-error:empty { display: none; }
.form-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); background: var(--surface-2); padding: 9px 11px; border-radius: 9px; margin: 0; }
.form-note .icon { margin-top: 2px; color: var(--accent); }
.form-actions { display: flex; gap: 8px; align-items: center; }
.form-actions.sticky { position: sticky; bottom: -32px; background: var(--surface); padding: 12px 0 14px; margin-bottom: -14px; border-top: 1px solid var(--border); }
.spacer { flex: 1; }
.dupes:empty { display: none; }
.dupes { border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); border-radius: 10px; padding: 6px; }
.dupes-title { display: flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 650; color: var(--warn); margin: 2px 4px 4px; }
.dupes .prow .btn { margin-left: auto; }
.pick-list { max-height: 330px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.whoami-list .prow.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.whoami-modal { width: min(480px, calc(100vw - 32px)); }
button.prow { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.prow:hover, button.prow:focus-visible { background: var(--surface-2); }
button.prow .prow-name { flex: 1; min-width: 0; }

/* ---------- modals, menus, toasts ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13, 19, 28, 0.42); display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 20px 20px; z-index: 50; animation: fadein 0.14s ease; backdrop-filter: blur(2px);
}
.modal-backdrop.closing { opacity: 0; transition: opacity 0.14s; }
.modal {
  width: 520px; max-width: 100%; max-height: 84vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 15px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop 0.17s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } }
.modal.nudge { animation: nudge 0.28s ease; }
@keyframes nudge { 30% { transform: scale(1.012); } 60% { transform: scale(0.996); } }
.modal.wide { width: 1000px; }
.modal.add-relative { width: 580px; }
.modal.confirm { width: 470px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 16px 6px 22px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 680; letter-spacing: -0.01em; }
.modal-sub { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.modal-body { padding: 10px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 15px 15px; flex: none; }
.confirm-text p { margin: 0 0 10px; color: var(--text-2); }
.confirm-text p:first-child { color: var(--text); font-weight: 600; }
.palette-modal { width: 640px; }
.palette-modal .modal-body { padding: 0; }
.palette-search { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.palette-input { width: 100%; height: 46px; border: 0; outline: 0; font-size: 16px; background: transparent; color: var(--text); padding: 0 6px; }
.palette-input::placeholder { color: var(--text-3); }
.palette-list { max-height: 58vh; overflow-y: auto; padding: 6px; }
.palette-list .prow { cursor: pointer; }
.palette-list .prow.active { background: var(--accent-soft); }
.menu {
  position: fixed; z-index: 60; min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; animation: pop 0.12s ease;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; font-size: 13.5px; color: var(--text);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left;
}
.menu-item .icon { color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item:disabled { opacity: 0.45; cursor: default; background: none; }
.menu-label { flex: 1; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.icon-space { width: 16px; flex: none; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 70; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 300px; max-width: min(600px, 90vw); padding: 9px 9px 9px 14px; background: var(--toast);
  color: #eef2f7; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastin 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2); pointer-events: auto;
}
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: 0.18s; }
.toast-success .toast-icon { color: #4ade80; }
.toast-error .toast-icon { color: #f87171; }
.toast-info .toast-icon { color: #93b4ff; }
.toast-text { flex: 1; }
.toast-action { border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 650; border-radius: 8px; padding: 5px 12px; cursor: pointer; white-space: nowrap; }
.toast-action:hover { background: rgba(255, 255, 255, 0.24); }
.toast-close { border: 0; background: none; color: #9aa5b4; cursor: pointer; padding: 5px; display: grid; border-radius: 6px; }
.toast-close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

/* ---------- timeline ---------- */
.timeline { position: absolute; inset: 0; padding: 76px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.tl-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.tl-title { font-weight: 650; color: var(--text-2); }
.tl-legend { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.tl-legend .sw { margin-left: 8px; }
.tl-scroll { flex: 1; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; position: relative; box-shadow: var(--shadow-sm); }
.tl-head { position: sticky; top: 0; z-index: 3; display: flex; background: var(--surface); border-bottom: 1px solid var(--border); height: 36px; }
.tl-name-head { width: 300px; flex: none; padding: 10px 14px; font-size: 11.5px; font-weight: 750; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; }
.tl-axis { position: relative; flex: 1; margin-right: 22px; }
.tl-axis span { position: absolute; top: 10px; transform: translateX(-50%); font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.tl-body { position: relative; min-width: 760px; }
.tl-grid { position: absolute; left: 300px; right: 22px; top: 0; bottom: 0; pointer-events: none; }
.tl-grid i { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.tl-row { display: flex; align-items: center; height: 34px; cursor: pointer; position: relative; }
.tl-row:hover { background: var(--surface-2); }
.tl-row.is-selected { background: var(--accent-soft); }
.tl-name { width: 300px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 14px; overflow: hidden; }
.tl-name .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; flex: none; }
.tl-name .sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral); }
.dot.sex-M { background: var(--male); }
.dot.sex-F { background: var(--female); }
.tl-track { flex: 1; position: relative; height: 100%; margin-right: 22px; }
.tl-bar { position: absolute; top: 10px; height: 14px; border-radius: 7px; background: var(--ok); }
.tl-bar.status-theory { background: var(--warn); }
.tl-bar.status-unknown { background: var(--muted-st); }
.tl-bar.est-start { -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%); mask-image: linear-gradient(90deg, transparent, #000 45%); }
.tl-bar.est-end { -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent); mask-image: linear-gradient(90deg, #000 55%, transparent); }
.tl-bar.living { border-radius: 7px 3px 3px 7px; }
.tl-row.is-selected .tl-bar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.tl-probe { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); pointer-events: none; z-index: 2; }
.tl-probe-label {
  position: absolute; transform: translateX(-50%); background: var(--danger); color: #fff; font-size: 12px; font-weight: 650;
  padding: 3px 10px; border-radius: 999px; pointer-events: none; z-index: 4; white-space: nowrap; box-shadow: var(--shadow-md);
}
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.status-confirmed { background: var(--ok); }
.sw.status-theory { background: var(--warn); }
.sw.status-unknown { background: var(--muted-st); }
.sw.est { background: linear-gradient(90deg, transparent, var(--text-3)); }
.empty-note { padding: 26px; text-align: center; color: var(--text-3); font-size: 13.5px; line-height: 1.5; }

/* ---------- overview ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.tile { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.tile-value { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.tile-label { font-size: 12px; color: var(--text-2); font-weight: 650; }
.tile-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ov-sec { margin-bottom: 20px; }
.ov-sec h3 { font-size: 14px; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.ov-sec > p { margin: -4px 0 8px; }
.stack-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack-bar i.status-confirmed { background: var(--ok); }
.stack-bar i.status-theory { background: var(--warn); }
.stack-bar i.status-unknown { background: var(--muted-st); }
.stack-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.name-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 32px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-n { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.ov-list { max-height: 310px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.gap-note { font-size: 11.5px; color: var(--warn); font-weight: 650; white-space: nowrap; }
.todo-item, .issue { display: block; width: 100%; text-align: left; border: 0; background: none; font-size: 13px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.todo-item:hover, .issue:hover { background: var(--surface-2); }
.todo-item ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); }
.todo-item li::marker { color: var(--warn); }
.issue { display: flex; gap: 8px; align-items: flex-start; }
.issue .icon { color: var(--warn); margin-top: 2px; }
.ok-note { display: flex; gap: 8px; align-items: center; color: var(--ok); font-weight: 600; margin: 0; }
.foot-note { margin: 4px 0 0; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.sc-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.about p { color: var(--text-2); }
.welcome { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; }
.welcome-card { text-align: center; background: var(--surface); padding: 36px 44px; border-radius: 18px; box-shadow: var(--shadow-md); border: 1px solid var(--border); display: grid; justify-items: center; gap: 6px; }
.welcome-card .icon { color: var(--accent); }
.welcome-card h2 { margin: 8px 0 0; }
.welcome-card p { color: var(--text-2); margin: 0 0 12px; }

/* ---------- smaller windows ---------- */
@media (max-width: 1380px) { .view-label { display: none; } .seg.views button { padding: 7px 10px; } }
@media (max-width: 1180px) {
  .searchbox { width: 40px; padding: 0; justify-content: center; }
  .searchbox span, .searchbox kbd { display: none; }
  .main.panel-open .panel { position: absolute; right: 0; top: 0; bottom: 0; width: 424px; box-shadow: var(--shadow-lg); z-index: 8; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) { .brand-text { display: none; } .ov-grid { grid-template-columns: 1fr; } .top-actions .btn.primary { padding: 0 10px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- lineage report ---------- */
.modal.report-modal { width: 900px; max-height: 90vh; }
.report-wrap { background: #f5f7fa; border-radius: 12px; padding: 22px 18px; }
.path-card .btn { margin-top: 10px; }

/* ---------- printing ---------- */
@media print {
  @page { size: landscape; margin: 0.35in; }
  html, body { background: #fff !important; overflow: visible; }
  .topbar, .panel, .ctxbar, .zoombar, .legend, .toasts, .modal-backdrop, .menu { display: none !important; }
  #app, .main { height: auto; display: block; }
  .canvas { width: 100%; height: 7.6in; background: #fff !important; background-image: none !important; }
  .timeline { position: static; padding: 0; }
  .tl-scroll { overflow: visible; border: 0; box-shadow: none; }
  .card .card-shadow { display: none; }
  body.printing-report #app, body.printing-report .toasts { display: none !important; }
  body.printing-report .modal-backdrop { display: block !important; position: static; padding: 0; background: none; backdrop-filter: none; }
  body.printing-report .modal { width: auto; max-height: none; box-shadow: none; border: 0; animation: none; }
  body.printing-report .modal-head, body.printing-report .modal-foot { display: none; }
  body.printing-report .modal-body { overflow: visible; padding: 0; }
  body.printing-report .report-wrap { background: #fff; padding: 0; }
}

/* ---- Lasting Stone product pages (accounts, My trees, sharing, proposals, media, tags) ---------------------- */
/* The body never scrolls (the tree screen needs that), so these pages scroll themselves (Mike, 2026-10-19: the
   Account page's bottom couldn't be reached). The sticky top bar sticks to this scroller. */
.page { flex: 1 1 auto; min-height: 0; overflow-y: auto; background: var(--bg); color: var(--text); font-family: var(--font); }
.page-card { max-width: 420px; margin: 8vh auto 40px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-md); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.page-card h1 { font-size: 22px; margin: 6px 0 0; }
.page-brand { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.page-links { font-size: 14px; color: var(--text-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-top { position: sticky; top: 0; z-index: 5; }
.page-top .brand { text-decoration: none; color: inherit; }
/* Tabs: they look like buttons (Mike: plain links weren't obviously clickable), the current page is filled. */
/* The same segmented look as the chart-type switcher (.seg), so they read as one set of tabs. */
.page-nav { display: flex; gap: 2px; margin-left: 8px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; }
.page-nav a { color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13.5px; padding: 6px 14px;
  border-radius: 8px; white-space: nowrap; }
.page-nav a:hover { color: var(--text); background: var(--surface-3); }
.page-nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.page-top .top-actions { margin-left: auto; }
.page-main { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
.page-main.narrow { max-width: 560px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-section { margin-top: 36px; display: flex; flex-direction: column; gap: 10px; }
.page-section h2 { font-size: 17px; margin: 0; }
.btn.wide { width: 100%; justify-content: center; }
.tree-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.tree-card { display: flex; gap: 12px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); }
.tree-card:hover { border-color: var(--accent); }
.tree-card-icon { color: var(--accent); }
.tree-card-text { display: flex; flex-direction: column; gap: 2px; }
.trash-row, .member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.invite-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.invite-form .input { flex: 1 1 200px; }
.invite-result { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.invite-result .input, .key-once .input { flex: 1 1 260px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.key-once { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.key-once p { flex-basis: 100%; margin: 0; }
.switch-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.switch-row span { display: flex; flex-direction: column; gap: 2px; }
/* "Let Claude use your family tree?" (/oauth/authorize): rendered by the server, no script but the theme. */
.page-card.consent { max-width: 480px; }
.consent-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.consent-group legend { padding: 0; margin-bottom: 4px; }
.connect-url { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.connect-url .input { flex: 1 1 260px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.modal.wide-modal { width: min(760px, 96vw); }
.proposal-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; width: 100%; text-align: left; padding: 10px;
  margin-bottom: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; flex-wrap: wrap; }
.proposal-row.status-proposed { border-color: var(--accent); }
.proposal-person { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin: 8px 0; }
table.diff { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.diff th, table.diff td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.diff td.was { color: var(--text-3); text-decoration: line-through; }
table.diff td.now { color: var(--ok); font-weight: 600; }
.diff-notes { white-space: pre-wrap; font-size: 12px; background: var(--surface-2); padding: 8px; border-radius: 8px; max-height: 260px; overflow: auto; }
.change-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--border); }
.change-row .change-label { flex: 1 1 260px; }
.change-row.reverted .change-label { text-decoration: line-through; color: var(--text-3); }
.media-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media-card { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.media-card img, .media-card video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--surface-3); cursor: pointer; }
.media-card audio { width: 100%; }
.media-pending { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--text-3); font-size: 13px; }
.media-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.presence-wrap { display: flex; align-items: center; }
.presence { display: flex; gap: 4px; }
.presence-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--ok-soft); color: var(--ok); border: 2px solid var(--ok); }
/* ---- waiting for your approval: red, for the people who can approve (nobody else ever gets the data) -------------- */
.count-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font: 700 11px/1 var(--font); letter-spacing: 0; }
.btn.alert { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.btn.alert:hover { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }
.btn.bell { position: relative; padding: 0 9px; }
.btn.bell .count-badge { position: absolute; top: -7px; right: -7px; box-shadow: 0 0 0 2px var(--surface); }
.page-nav a.nav-notify { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.reject { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, var(--border-strong)); }
.btn.reject:hover { background: var(--danger-soft); }
/* the chart: a red ring and a "Needs approval" pill on the card (map mode: the whole card turns red) */
.card .approval-ring { fill: none; stroke: var(--danger); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.card .approval-pill rect { fill: var(--danger); }
.card .approval-pill text { font: 700 10.5px var(--font); fill: #fff; letter-spacing: 0.01em; }
.lod-tiny .card.needs-approval .card-bg { fill: var(--danger); }
@media print { .approval-mark { display: none !important; } }
/* the person panel: a red banner under the name with the proposed change, Approve and Reject */
.approval-banner { flex: none; margin: 10px 14px 0; padding: 10px 12px; border: 1.5px solid var(--danger); border-radius: 12px;
  background: var(--danger-soft); max-height: 42vh; overflow-y: auto; }
.approval-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--danger); font-size: 13px; }
.approval-head b { font-size: 13.5px; }
.approval-head span { color: var(--text-2); }
.approval-item { border-top: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); margin-top: 8px; padding-top: 8px; }
.approval-item p { margin: 4px 0; font-size: 13px; }
.approval-who { overflow-wrap: anywhere; }
.approval-banner table.diff { background: var(--surface); border-radius: 8px; }
.approval-banner .diff-notes { background: var(--surface); max-height: 140px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* the Notifications page (and the bell's dialog in a tree), and the chips on My trees */
.waiting-list { margin-top: 20px; }
.modal .waiting-list { margin-top: 4px; }
.waiting-tree { margin: 0 0 22px; }
.waiting-head { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 8px; overflow-wrap: anywhere; }
.waiting-item { display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 6px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.15s; }
.waiting-item:hover { border-color: var(--danger); }
.waiting-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; }
.waiting-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.waiting-go { display: inline-flex; align-items: center; color: var(--danger); font-weight: 650; font-size: 13px; flex: none; }
.waiting-more { display: inline-block; margin-top: 2px; font-weight: 600; font-size: 13.5px; }
.chip-waiting { align-self: flex-start; margin-top: 5px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--danger); color: #fff; }
@media (max-width: 640px) {
  .approval-banner { margin: 8px 10px 0; max-height: 34dvh; }
  .waiting-go { font-size: 0; }  /* the arrow is enough on a phone */
  .page-nav a.nav-notify { gap: 4px; }
}
.tag-code { font-family: ui-monospace, Consolas, monospace; font-size: 26px; letter-spacing: 2px; margin: 4px 0; }
@media (max-width: 600px) {
  .page-card { margin: 16px; padding: 20px; }
}

/* ---- phones (Mike, 2026-10-16: most relatives arrive on a phone, from an NFC tag or an invite link) ----------- */
#app { height: 100dvh; }  /* iOS Safari: 100vh includes the address bar and cuts off the bottom */
.boot { height: 100dvh; }
.sheet-handle { display: none; }
.menu { max-height: calc(100dvh - 16px); overflow-y: auto; }

/* Touch screens have no hover: show the controls a mouse would reveal, hide keyboard hints. */
@media (hover: none) {
  .card-add { opacity: 1; }
  .avatar-cam { opacity: 1; }
  .row-action { opacity: 0.75; }
  .menu-item kbd, .searchbox kbd { display: none; }
  button.prow { padding: 11px 10px; }  /* thumb-sized rows */
}

@media (max-width: 640px) {
  /* Top bar: two rows. Row 1 = logo + actions (icons only); row 2 = the six chart views. */
  .topbar { height: auto; flex-wrap: wrap; gap: 6px 8px; padding: 6px 8px; }
  .topbar .brand-logo { width: 30px; height: 30px; }
  .top-actions { margin-left: auto; gap: 4px; flex: none; }
  .page-top .brand-text { display: block; }  /* the chart bar keeps only the logo (the <=860px rule above) */
  /* The chart's buttons go icon-only (the full labels are in their tooltips and the menu). */
  .topbar:not(.page-top) .top-actions .btn { font-size: 0; gap: 0; padding: 0 8px; height: 34px; }
  .topbar:not(.page-top) .top-actions .icon-btn { width: 32px; height: 34px; }
  .searchbox { width: auto; height: 34px; padding: 0 8px; }
  .searchbox span, .searchbox kbd { display: none; }
  .presence .presence-dot:nth-child(n + 3) { display: none; }
  .presence-dot { width: 24px; height: 24px; font-size: 10px; }
  .page-top .top-actions .muted { display: none; }
  .views { order: 3; flex-basis: 100%; margin: 0; display: flex; justify-content: space-between; overflow-x: auto; }
  .seg.views button { flex: 1; justify-content: center; padding: 7px 0; }

  /* Chart chrome. */
  .ctxbar { top: 8px; left: 8px; right: 8px; gap: 6px; flex-wrap: wrap; }
  .ctx-title { max-width: 52vw; font-size: 13.5px; }
  .ctx-sub, .tool-label { display: none; }
  .legend { right: 8px; bottom: 8px; }
  .legend-body { max-width: calc(100vw - 24px); }
  .ctx-tools { padding: 3px; }
  .zoombar { left: 8px; bottom: 8px; }
  .zoombar > :nth-child(1), .zoombar > :nth-child(3), .zoombar > :nth-child(4) { display: none; }  /* pinch instead */

  /* The person panel becomes a bottom sheet sharing the screen with the chart. */
  .main { flex-direction: column; }
  .panel { width: 100%; height: 0; border-left: 0; transition: height 0.24s cubic-bezier(0.3, 0.7, 0.2, 1); display: flex; flex-direction: column; }
  .main.panel-open .panel { position: relative; top: auto; right: auto; bottom: auto; width: 100%; height: 56%;
    border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 28px rgba(16, 24, 40, 0.16); z-index: 8; }
  .main.panel-open.sheet-full .panel { height: 100%; border-radius: 0; }
  .main.sheet-full .canvas { flex: 0 0 0; }
  .sheet-handle { display: grid; place-items: center; flex: none; height: 22px; border: 0; background: none; cursor: pointer; }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: var(--border-strong); }
  .profile { width: 100%; flex: 1; min-height: 0; height: auto; }
  .profile-head { padding: 6px 14px 12px; }
  .profile-title h2 { font-size: 17px; }
  .ptabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .ptab { flex: none; }

  /* Dialogs slide up from the bottom, full width. */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.wide-modal, .modal.add-relative, .modal.confirm, .modal.report-modal, .palette-modal {
    width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .modal-head { padding: 14px 12px 4px 16px; }
  .modal-body { padding: 8px 14px 16px; }
  .modal-foot { border-radius: 0; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
  table.diff { display: block; overflow-x: auto; font-size: 12px; }
  .row2 { grid-template-columns: 1fr; gap: 10px; }  /* Sex above Research status */
  .invite-form .input, .invite-form select { flex: 1 1 100%; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid { grid-template-columns: minmax(0, 1fr); }  /* plain 1fr grows to its widest line */
  .ov-sec h3 { flex-wrap: wrap; }

  /* Toasts at the top, so the bottom sheet never hides them. */
  .toasts { top: 8px; bottom: auto; width: calc(100vw - 16px); }
  .toast { min-width: 0; width: 100%; }

  /* iOS zooms the page when a field under 16px gets focus. */
  .input, input, select, textarea, .palette-input { font-size: 16px; }

  /* Product pages: the tabs get their own row under the logo and Sign out. */
  .page-nav { order: 3; flex-basis: 100%; margin-left: 0; overflow-x: auto; }
  .page-nav a { flex: 1; text-align: center; padding: 8px 6px; }
  .top-name { display: none; }
  .page-main { padding: 16px 12px 48px; }
  .page-head h1 { font-size: 22px; }
  .tree-grid { grid-template-columns: 1fr; }
}

/* ---- sign-in-style pages: brand panel + form (Mike, 2026-10-17: they should feel like the app) ------------------ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(400px, 560px); }
.auth-brand { position: relative; overflow: clip; min-height: 0; display: flex; flex-direction: column; gap: 28px; padding: 36px 44px;
  background: radial-gradient(var(--dot) 1.1px, transparent 1.2px) 0 0 / 22px 22px, var(--canvas);
  border-right: 1px solid var(--border); }
.auth-brand::after { content: ""; position: absolute; inset: auto -20% -40% auto; width: 70%; height: 70%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 18%, transparent), transparent); }
.auth-logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 16px; width: fit-content; }
.auth-pitch { max-width: 460px; }
.auth-tagline { font-size: clamp(26px, 3vw, 36px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 10px; }
.auth-pitch .muted { font-size: 16px; margin: 0; }
.auth-peek { flex: 1; display: flex; flex-direction: column; justify-content: center; margin: 0 auto;
  width: min(100%, 780px, calc((100vh - 360px) * 1.6)); width: min(100%, 780px, calc((100dvh - 360px) * 1.6));
  position: relative; z-index: 1; }
.auth-foot { margin: 0; font-size: 13px; color: var(--text-3); position: relative; z-index: 1; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--bg); }
.auth .page-card { width: 100%; max-width: 420px; margin: 0; padding: 30px; gap: 14px; box-shadow: var(--shadow-lg); border-radius: 18px; }
.auth .page-card h1 { font-size: 24px; letter-spacing: -0.015em; margin: 0; }
.auth .page-card > .muted { margin: -6px 0 4px; }
.auth .form { display: flex; flex-direction: column; gap: 12px; }
.auth .btn.primary.wide { height: 44px; font-size: 15px; }
.code-input { text-transform: uppercase; letter-spacing: 0.12em; font-family: ui-monospace, Consolas, monospace; }
.steps { display: flex; gap: 6px; margin: -2px 0 2px; }
.steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.steps span.on { background: var(--accent); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 16px 18px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row;
    align-items: center; justify-content: space-between; }
  .auth-brand::after, .auth-peek, .auth-pitch .muted { display: none; }
  .auth-pitch { display: none; }
  .auth-foot { font-size: 12px; text-align: right; }
  .auth-panel { place-items: start center; padding: 22px 14px 40px; }
  .auth .page-card { padding: 22px; box-shadow: var(--shadow-md); }
}

/* ---- Admin (staff): waitlist + visits. Charts follow the dataviz rules: one series each, thin rounded columns,
   hairline grid, hover tooltip, a table view; colours from the theme tokens (checked in both modes). --------------- */
.admin-tabs { display: inline-flex; }
.admin-tabs a { color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13.5px; padding: 6px 14px; border-radius: 8px; }
.admin-tabs a:hover { color: var(--text); background: var(--surface-3); }
.admin-tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--text-3); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.chart-card { padding: 16px 18px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.chart-head h3 { margin: 0; font-size: 15px; }
.chart-head .muted { font-size: 12.5px; }
.chart-plot { position: relative; margin-top: 8px; }
.cols { width: 100%; height: auto; display: block; }
.cols .grid { stroke: var(--border); stroke-width: 1; }
.cols .axis { fill: var(--text-3); font: 11px var(--font); }
.cols .bar { fill: var(--accent); }
.cols .hit { fill: transparent; cursor: default; }
.cols .hit:hover { fill: color-mix(in srgb, var(--accent) 7%, transparent); }
.chart-plot .tip { position: absolute; top: -4px; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: none;
  background: var(--toast); color: #eef2f7; font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 8px; box-shadow: var(--shadow-md); }
.daily-table { margin-top: 12px; }
.daily-table summary { cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child { overflow-wrap: anywhere; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charts { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .stat-value { font-size: 26px; } .admin-tabs { width: 100%; } .admin-tabs a { flex: 1; text-align: center; } }

/* ---- Account: invitation codes ------------------------------------------------------------------------------- */
.code-new { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent-soft); }
.code-new .tag-code { margin: 0; color: var(--text); }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.code-row .code-hint { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.chip-status { font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.chip-status.open { background: var(--accent-soft); color: var(--accent); }
.chip-status.used { background: var(--ok-soft); color: var(--ok); }

/* ---- My trees ------------------------------------------------------------------------------------------------- */
.page-sub { margin: 2px 0 0; font-size: 15px; }
.tree-card { padding: 18px; gap: 14px; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.tree-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tree-card-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #2f6fe0, #5b4fd6); color: #fff; box-shadow: 0 2px 6px rgba(47, 111, 224, 0.3); }
.tree-card-text { flex: 1; min-width: 0; }
.tree-card-text b { font-size: 15.5px; }
.tree-card-go { color: var(--text-3); }
.tree-card:hover .tree-card-go { color: var(--accent); }

/* ---- Share: the shareable link, big enough to read and send from a phone ----------------------------------------- */
.share-link { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; border: 1px solid var(--accent);
  background: var(--accent-soft); margin-top: 8px; }
.share-link-url { margin: 0; font: 600 15px/1.5 ui-monospace, Consolas, monospace; color: var(--text); word-break: break-all;
  user-select: all; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.share-link-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-link-actions .btn { height: 42px; padding: 0 18px; font-size: 14.5px; }
.share-link .muted { margin: 0; }
.share-link-for { margin: 0; font-weight: 650; color: var(--accent); }
.invite-or { margin: 10px 0 6px; }
.connect-url { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }
.connect-url .share-link-url { flex: 1 1 260px; }
/* Tree settings: deleting stays behind a small button until asked for */
.danger-reveal { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
/* ---- Delete your account (account page), the Terms / Privacy links, GEDCOM import preview ---- */
.plan-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
/* ---- Two-step sign-in, backup codes, the Reload bar, storage used, Admin messages (2026-10-20) ---- */
.two-step { display: grid; gap: 12px; justify-items: start; }
.two-step > .form, .two-step > p { justify-self: stretch; }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.two-step-qr { background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--border); }
.two-step-key { font-size: 13px; letter-spacing: 0.04em; user-select: all; word-break: break-all; }
.backup-codes { display: grid; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; justify-self: stretch; }
.backup-codes p { margin: 0; }
.backup-list { margin: 0; padding-left: 26px; columns: 2; column-gap: 28px; font-size: 15px; }
.backup-list code { letter-spacing: 0.06em; user-select: all; }
.update-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; display: flex; gap: 10px;
  align-items: center; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--toast); color: #fff;
  box-shadow: var(--shadow-lg); width: max-content; max-width: calc(100vw - 24px); font-weight: 600; }
.update-bar .btn.ghost { color: #fff; }
.storage-line { display: grid; gap: 6px; padding-bottom: 6px; }
.storage-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.storage-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.message-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px;
  background: var(--surface); }
.message-card.unread { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.message-card .msg-body { white-space: pre-wrap; margin: 0; }
.message-list { display: grid; gap: 10px; }
/* ---- Search records (2026-10-20) ---- */
.src-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.records-modal { width: min(760px, calc(100vw - 24px)); }
.records { display: grid; gap: 12px; }
.records-sources { display: grid; gap: 10px; }
.record-source { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.record-source.off { opacity: 0.6; }
.record-source-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.record-covers { font-size: 12px; color: var(--text-3); font-weight: 400; }
.record-list { display: grid; gap: 8px; margin-top: 6px; }
.record-list:empty { display: none; }
.record-hit { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 8px 0;
  border-top: 1px solid var(--border); }
.record-text { display: grid; gap: 2px; min-width: 0; }
.record-title { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.record-title:hover { text-decoration: underline; }
.record-meta { font-size: 12px; color: var(--text-3); }
.record-snippet { font-size: 12.5px; color: var(--text-2); }
.record-notice { font-size: 11.5px; color: var(--text-3); margin: 2px 0 0; }
.records-h { margin: 6px 0 0; font-size: 15px; }
.records-links { display: flex; flex-wrap: wrap; gap: 8px; }
.records-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; font-size: 13px; background: var(--surface-2); }
.records-link:hover { background: var(--surface-3); }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.legal-links { margin: 18px 0 0; text-align: center; }
.legal-links a, .agree a { color: inherit; }
.agree { margin: 10px 0 0; text-align: center; }
.import-report { display: grid; gap: 10px; }
.import-report .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.import-report .stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.import-report .stat b { display: block; font-size: 20px; }
.import-report ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.danger-zone { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.danger-zone h3, .danger-zone p { margin: 0; }
@media (max-width: 640px) { .share-link-actions .btn { flex: 1 1 auto; } .share-link-url { font-size: 14px; } }
/* ---- Head shots: framed avatars, the photo viewer (opened from the head shot) and the framing editor ---- */
.avatar-el { position: relative; overflow: hidden; }
.avatar-el img.framed { position: absolute; max-width: none; object-fit: fill; }
.framed-box { position: relative; display: block; overflow: hidden; border-radius: 50%; background: var(--surface-3); flex: none; }
.framed-box img { display: block; }
.media-card { position: relative; }
.media-card.is-main img { box-shadow: 0 0 0 2px var(--accent); }
.media-badge { position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); pointer-events: none; }
.modal.doc-viewer { width: min(1100px, 96vw); max-height: 92vh; }
.doc-view { display: grid; gap: 12px; }
.doc-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.media-stage { display: grid; min-height: 40vh; }
.doc-frame { max-height: 64vh; overflow: auto; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); cursor: zoom-in; display: grid; place-items: center; }
.doc-full { max-width: 100%; max-height: 64vh; display: block; }
.doc-frame:not(.zoomed) .doc-full { height: min(58vh, 560px); width: auto; object-fit: contain; }
.doc-frame.zoomed { cursor: zoom-out; place-items: start; }
.doc-frame.zoomed .doc-full { max-width: none; max-height: none; width: auto; height: auto; }
.media-view-clip { width: 100%; max-height: 64vh; border-radius: 10px; background: #000; }
.media-view-voice { display: grid; place-items: center; align-content: center; gap: 14px; min-height: 30vh; color: var(--text-3);
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.doc-title { font-weight: 650; font-size: 15px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.main-chip { margin-left: 8px; vertical-align: 2px; background: var(--accent-soft); color: var(--accent); }
.media-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.media-thumb { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); cursor: pointer; text-align: left; color: inherit; font: inherit; width: 88px; flex: none; }
.media-thumb:hover, .media-thumb:focus-visible { border-color: var(--accent); }
.media-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: 6px; background: var(--surface); display: block; }
.media-thumb .media-badge { top: 6px; left: 6px; font-size: 9.5px; padding: 1px 6px; }
.media-thumb .media-cap { font-size: 11.5px; line-height: 1.25; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.media-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.media-thumb.add { display: grid; place-items: center; align-content: center; color: var(--accent); border-style: dashed; min-height: 84px; }
.media-strip-icon { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 6px; background: var(--surface); color: var(--text-3); }
.modal.framer-modal { width: min(440px, 96vw); }
.framer { display: grid; justify-items: center; gap: 12px; }
.framer > p { margin: 0; text-align: center; }
.framer-view { position: relative; overflow: hidden; border-radius: 14px; background: var(--surface-3); cursor: grab; touch-action: none; user-select: none; max-width: 100%; }
.framer-view.dragging { cursor: grabbing; }
.framer-view:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.framer-img { pointer-events: none; }
.framer-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(10, 14, 20, 0.55); border: 2px solid rgba(255, 255, 255, 0.85); pointer-events: none; }
.framer-zoom-row { display: flex; align-items: center; gap: 10px; width: min(300px, 100%); color: var(--text-3); }
.framer-zoom { flex: 1; accent-color: var(--accent); }
.framer-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.framer-preview { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.framer-mini { width: 42px; height: 42px; }
.framer-note { margin: 0; min-height: 1.3em; text-align: center; }
/* ---- Sync from the desktop app (owners): the dry-run report and the upload progress ---- */
.sync { display: grid; gap: 12px; }
.sync-steps { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14px; display: grid; gap: 6px; }
.sync-report { display: grid; gap: 10px; max-height: min(62vh, 640px); overflow-y: auto; padding-right: 4px; }
.sync-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.sync-tile { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 2px; }
.sync-tile b { font-size: 20px; letter-spacing: -0.01em; }
.sync-tile span { font-size: 12.5px; color: var(--text-2); }
.sync-tile.good b { color: var(--ok); }
.sync-tile.warn { border-color: var(--warn); }
.sync-tile.warn b { color: var(--warn); }
.sync-section { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; background: var(--surface); }
.sync-section summary { cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.sync-list { margin-top: 8px; max-height: 260px; overflow-y: auto; font-size: 13px; }
.sync-list ul { margin: 0; padding-left: 18px; columns: 2 220px; }
.sync-list p { margin: 4px 0; }
.sync-check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin-top: 8px; }
.sync-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.sync .bar { height: 10px; }
/* ---- AI-proposed photos and scans in the review dialog (approvers only until approved) ---- */
.proposal-images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.proposal-image { margin: 0; width: 150px; display: grid; gap: 6px; }
.proposal-image img, .proposal-image-ph { width: 150px; height: 180px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; font-size: 12.5px;
  color: var(--text-2); text-align: center; padding: 0; }
.proposal-image figcaption { display: grid; gap: 3px; font-size: 12.5px; line-height: 1.35; }
.proposal-image figcaption .chip { justify-self: start; }
.source-link { display: inline-block; margin-top: 4px; }
