/* Church Directory — every colour and font comes from CSS variables set by theme.js */
:root {
  --paper: #faf8f3; --card: #fdfcf9; --ink: #1d1b17; --muted: #77726a; --line: #e2ddd2; --line2: #ece8df;
  --accent: #2f5d50; --accent-ink: #fff; --soft: #e5ebe5; --soft2: #eff2ee;
  --hf: 'Lora', Georgia, serif; --bf: 'Inter', system-ui, sans-serif; --hw: 500;
  --r: 16px; --top: 64px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 10px 30px -18px rgb(0 0 0 / .22);
  --shadow2: 0 2px 4px rgb(0 0 0 / .05), 0 18px 40px -20px rgb(0 0 0 / .3);
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px) }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--bf); -webkit-font-smoothing: antialiased; min-height: 100dvh }
h1, h2, h3 { font-family: var(--hf); font-weight: var(--hw); line-height: 1.15; letter-spacing: -.005em; margin: 0 }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px }
a:hover { text-decoration-color: currentColor }
p { margin: 0 }
img { display: block; max-width: 100% }
button, input, select, textarea { font: inherit; color: inherit }
[hidden] { display: none !important }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 99 }
.skip:focus { left: 8px }
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.muted { color: var(--muted) }
.small { font-size: 14px }
.grow { flex: 1 }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; display: inline-flex; gap: 6px; align-items: center }
.hint { color: var(--muted); font-size: 13.5px; display: block; margin-top: 4px }

/* ---------- boot ---------- */
.boot { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted) }
.boot-mark { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite }
@keyframes spin { to { transform: rotate(1turn) } }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 18px; padding: 0 max(18px, calc((100vw - 1240px) / 2));
  background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line2) }
.loading .top:empty { display: none }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0 }
.brand img, .brand .mark { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none }
.brand .mark { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink) }
.brand .mark .i { width: 24px; height: 24px }
.brand span { display: flex; flex-direction: column; min-width: 0 }
.brand b { font-family: var(--hf); font-weight: var(--hw); font-size: 18px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.brand small { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted) }
.tabs { display: flex; gap: 2px; margin-left: auto }
.tabs a, .iconbtn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; text-decoration: none; font-size: 15px; color: var(--muted); font-weight: 500; white-space: nowrap }
.tabs a:hover, .iconbtn:hover { color: var(--ink); background: var(--soft2) }
.tabs a.on, .iconbtn.on { color: var(--ink); background: var(--soft) }
.tools { display: flex; gap: 2px }
.iconbtn { padding: 9px; background: none; border: 0; cursor: pointer }
.bottom { display: none }

main { display: block; max-width: 1240px; margin: 0 auto; padding: 22px 18px 80px; outline: none }
main:focus, main:focus-visible { outline: none }
body.full main { max-width: none; padding: 0 }
body.bare .top, body.bare .bottom { display: none }

@media (max-width: 860px) {
  .tabs { display: none }
  .tools { margin-left: auto }
  .bottom { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line2) }
  .bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; text-decoration: none; font-size: 11.5px; color: var(--muted); border-radius: 10px }
  .bottom a .i { width: 22px; height: 22px }
  .bottom a.on { color: var(--ink); background: var(--soft) }
  main { padding-bottom: 110px }
}
@media (max-width: 520px) { .brand small { display: none } .brand b { font-size: 16.5px } .top { gap: 8px } }

/* ---------- common ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 11px; border: 1px solid var(--line); background: var(--card);
  text-decoration: none; cursor: pointer; font-weight: 500; font-size: 15px; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s }
.btn:hover { background: var(--soft2); border-color: color-mix(in srgb, var(--ink) 22%, transparent) }
.btn:active { transform: translateY(1px) }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)) }
.btn.ghost { background: transparent }
.btn.danger { color: #b42318; border-color: color-mix(in srgb, #b42318 35%, transparent) }
.btn.danger:not(.ghost) { background: #b42318; color: #fff }
.btn.small { padding: 6px 11px; font-size: 14px; border-radius: 9px }
.btn.busy { opacity: .6; pointer-events: none }
.btn:disabled { opacity: .55 }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.actions.center { justify-content: center; margin-top: 18px }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14.5px; margin: 0 0 14px -4px; padding: 4px 6px; border-radius: 8px }
.crumb:hover { color: var(--ink); background: var(--soft2) }
.eyebrow { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px }
.sub { color: var(--muted); margin-top: 6px }
.page-head { margin: 10px 0 20px }
.page-head h1 { font-size: clamp(30px, 4.5vw, 42px) }
.sect { font-size: 20px; margin: 28px 0 12px }
.badge { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .04em; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--ink) }
.badge.gone { background: var(--line2); color: var(--muted) }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; background: color-mix(in srgb, #e9b949 18%, var(--card)); border: 1px solid color-mix(in srgb, #e9b949 45%, transparent); font-size: 14.5px; margin-bottom: 16px }
.banner .i { color: #a77b0b; margin-top: 2px }
.empty { text-align: center; padding: 60px 16px; max-width: 560px; margin: 0 auto }
.empty h2 { font-size: 28px; margin-bottom: 10px }
.empty p { color: var(--muted); margin-bottom: 8px }
.empty-art { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; background: var(--soft); color: var(--accent) }
.empty-art .i { width: 40px; height: 40px }
.noresults { text-align: center; color: var(--muted); padding: 40px 0 }

/* avatars */
.av { --s: 44px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden;
  background: var(--t, var(--accent)); color: #fff; font-family: var(--hf); font-size: calc(var(--s) * .38); letter-spacing: .02em; font-weight: 500; user-select: none }
.av img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28% }
.av:has(img) { background: var(--line2) }
.av.sm { --s: 34px } .av.md { --s: 46px } .av.lg { --s: 64px } .av.xl { --s: 84px } .av.xxl { --s: 136px; box-shadow: 0 0 0 5px var(--card), var(--shadow2) }
.av.empty { background: var(--line2); color: var(--muted) }
.av.fam { background: var(--soft); color: var(--accent) }
.av.fam .i { width: 18px; height: 18px }

/* toolbar + filter */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 18px }
.filter, .picker { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; padding: 0 12px; height: 44px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s }
.filter:focus-within, .picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft) }
.filter input, .picker input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; font-size: 16px }
.filter .i, .picker > .i { color: var(--muted) }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--card); border: 1px solid var(--line) }
.seg > * { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px; border: 0; background: none; cursor: pointer; color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500 }
.seg > *:hover { color: var(--ink) }
.seg > .on { background: var(--accent); color: var(--accent-ink) }
.seg input[type=radio] { position: absolute; opacity: 0; pointer-events: none }
.seg.small > * { padding: 5px 10px; font-size: 14px }
.seg.wide { display: flex } .seg.wide > * { flex: 1; justify-content: center }

/* ---------- families page ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 0 22px }
.hero h1 { font-size: clamp(36px, 6vw, 58px); letter-spacing: -.015em }
.hero-logo { width: clamp(84px, 14vw, 132px); height: auto; aspect-ratio: 1; object-fit: contain; border-radius: 50% }
.letters { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 8px }
.letters a { min-width: 30px; text-align: center; padding: 4px 6px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px }
.letters a:hover { background: var(--soft); color: var(--ink) }
.lgroup { margin-top: 18px }
.letter { font-size: 22px; color: var(--muted); padding: 0 0 8px; margin-bottom: 14px; border-bottom: 1px solid var(--line2) }
.fgrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) }
.fcard { display: flex; flex-direction: column; text-decoration: none; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s }
.fcard:hover { transform: translateY(-2px); box-shadow: var(--shadow2) }
.fphoto { aspect-ratio: 16 / 10; background: var(--line2); overflow: hidden; position: relative }
.fphoto img { width: 100%; height: 100%; object-fit: cover }
.fphoto.none { background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--t) 22%, var(--card)), color-mix(in srgb, var(--t) 10%, var(--card))); display: grid; place-items: center }
.stack { display: flex; justify-content: center; gap: 8px; padding: 0 12px }
.stack .av { box-shadow: 0 0 0 3px var(--card) }
.stack.tight { gap: 0 } .stack.tight .av { margin: 0 -5px }
.fphoto.sm { aspect-ratio: 1; width: 92px; border-radius: 12px }
.fphoto.sm .av { --s: 30px; margin: 0 -6px }
.fphoto.xs { aspect-ratio: 1; width: 40px; border-radius: 10px; flex: none }
.fphoto.xs .av { --s: 18px; font-size: 8px; margin: 0 -4px; box-shadow: 0 0 0 2px var(--card) }
.fbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 3px }
.fbody h3 { font-size: 22px }
.fbody .names { font-weight: 600 }
.fbody .kids { color: var(--muted); font-size: 14.5px }
.fbody .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13.5px; margin-top: 6px }
.fbody .meta span { display: inline-flex; gap: 5px; align-items: center }
.flist { display: flex; flex-direction: column; gap: 12px }
.frow { display: flex; gap: 16px; padding: 14px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r) }
.frow-main { flex: 1; min-width: 0 }
.frow h3 { font-size: 21px; margin-bottom: 8px }
.frow h3 a { text-decoration: none }
.frow h3 span { font-family: var(--bf); font-size: 16px; font-weight: 600 }
.frow-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 4px 22px; font-size: 14.5px }
.frow .who p { margin-bottom: 3px }
.frow .who .muted { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; text-decoration: none }
@media (max-width: 640px) { .frow-cols { grid-template-columns: 1fr } .frow-photo { display: none } }

/* contact lines */
.ct { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; text-decoration: none; word-break: break-word }
.ct .i { margin-top: 3px; color: var(--muted) }
.ct em { font-style: normal; color: var(--muted); font-size: 13px; margin-left: 2px; align-self: center }
.ct:hover span { text-decoration: underline; text-underline-offset: 3px }

/* ---------- a family ---------- */
.family { display: flex; flex-direction: column; gap: 22px }
.fhead { display: grid; gap: 26px; align-items: center }
.fhead.has-photo { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) }
.fhead-photo { border-radius: 20px; overflow: hidden; box-shadow: var(--shadow2); aspect-ratio: 4 / 3; background: var(--line2) }
.fhead-photo img { width: 100%; height: 100%; object-fit: cover }
.fhead h1 { font-size: clamp(32px, 5vw, 52px); margin-bottom: 10px }
.fhead h1 span { color: var(--muted) }
.fhead .anniv { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); margin-bottom: 16px }
@media (max-width: 760px) { .fhead.has-photo { grid-template-columns: 1fr } }
.contact-card { display: flex; flex-wrap: wrap; gap: 4px 34px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r) }
.members { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)) }
.mcard { display: flex; gap: 16px; padding: 16px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); text-decoration: none; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; min-width: 0 }
.mcard:hover { transform: translateY(-2px); box-shadow: var(--shadow2) }
.mcard > div { min-width: 0 }
.mcard h3 { font-size: 21px; margin: 1px 0 3px }
.mcard .role { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600 }
.mcard .badge { margin: 2px 0 4px }
.mcard .small { display: flex; gap: 7px; align-items: center; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere }
.mcard .small .i { width: 15px; height: 15px }
.mcard.add { align-items: center; justify-content: center; color: var(--muted); border-style: dashed; box-shadow: none; background: transparent; min-height: 110px }
.linked h2, .notes h2, .rels h2 { font-size: 22px; margin-bottom: 12px }
.chips { display: flex; flex-wrap: wrap; gap: 10px }
.fchip, .pchip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; background: var(--card); border: 1px solid var(--line2); border-radius: 999px; text-decoration: none; min-width: 0; transition: border-color .15s, background .15s }
.fchip { border-radius: 14px; padding: 7px 14px 7px 8px }
.fchip .duo .av:nth-child(2) { margin-left: -10px }
.fchip:hover, .pchip:hover { border-color: var(--line); background: var(--soft2) }
.fchip > span:not(.av), .pchip > span:not(.av) { display: flex; flex-direction: column; line-height: 1.25; min-width: 0 }
.fchip b, .pchip b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.fchip small, .pchip small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.notes p { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); padding: 14px 18px }

/* ---------- people ---------- */
.plist { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); overflow: clip }
.phead-row { position: sticky; top: var(--top); z-index: 5; display: grid; grid-template-columns: 46px minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.2fr) minmax(0, .7fr); gap: 14px; padding: 9px 14px;
  background: color-mix(in srgb, var(--card) 92%, var(--paper)); border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; backdrop-filter: blur(8px) }
.phead-row + .prow { border-top: 0 }
@media (max-width: 760px) { .phead-row { grid-template-columns: 46px minmax(0, 1fr) auto } .phead-row span:nth-child(4), .phead-row span:nth-child(5) { display: none } }
.prow { display: grid; grid-template-columns: auto minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.2fr) minmax(0, .7fr); gap: 14px; align-items: center; padding: 9px 14px; text-decoration: none; border-top: 1px solid var(--line2) }
.prow:first-child { border-top: 0 }
.prow:hover { background: var(--soft2) }
.pn { display: flex; flex-direction: column; min-width: 0 }
.pn b { font-weight: 600 }
.pn i { color: var(--muted); font-style: normal }
.pn small, .pc, .pe, .pb { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
@media (max-width: 760px) { .prow { grid-template-columns: auto minmax(0, 1fr) auto } .pe, .pb { display: none } }

/* ---------- a person ---------- */
.person { display: flex; flex-direction: column; gap: 22px }
.phead { display: flex; gap: 30px; align-items: center; padding: 6px 0 4px }
.phead h1 { font-size: clamp(32px, 5vw, 50px); margin: 6px 0 4px }
.badges { display: flex; gap: 6px; flex-wrap: wrap }
.formal { color: var(--muted); margin-bottom: 4px }
.yourrel { display: inline-flex; gap: 8px; align-items: center; margin: 6px 0 2px; padding: 5px 12px; border-radius: 99px; background: var(--soft); font-size: 15px }
.phead .actions { margin-top: 14px }
@media (max-width: 640px) { .phead { flex-direction: column; align-items: flex-start; gap: 16px } .av.xxl { --s: 112px } }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px }
.pcard, .ecard { background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); padding: 18px 20px }
.pcard h2 { font-size: 13px; font-family: var(--bf); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px }
dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 18px; margin: 0 }
dt { color: var(--muted) }
dd { margin: 0 }
.rels-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px }
.rels-head h2 { margin: 0 }
.rgroup { margin: 12px 0 0 }
.rgroup h3 { font-size: 13px; font-family: var(--bf); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px }
.rwrap { display: inline-flex; align-items: center; gap: 2px }
.ix { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px }
.ix:hover { background: var(--soft); color: var(--ink) }
.ix .i { width: 16px; height: 16px }
.pfoot { padding-top: 8px; border-top: 1px solid var(--line2); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center }
.pfoot .i { width: 16px; height: 16px }

/* ---------- birthdays ---------- */
.soon { background: var(--soft2); border: 1px solid var(--line2); border-radius: 20px; padding: 18px 20px; margin-bottom: 24px }
.soon h2 { font-size: 22px; margin-bottom: 12px }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px }
.month { background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); padding: 16px 18px }
.month.now { border-color: var(--accent) }
.month h2 { font-size: 22px; margin-bottom: 10px }
.evs { display: flex; flex-direction: column; gap: 4px }
.soon .evs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 18px }
.ev { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 12px; text-decoration: none }
.ev:hover { background: var(--soft2) }
.day { width: 44px; flex: none; text-align: center; line-height: 1 }
.day b { display: block; font-family: var(--hf); font-size: 22px; font-weight: var(--hw) }
.day small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted) }
.evt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3 }
.evt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.evt small { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13.5px }
.evt small .i { width: 14px; height: 14px }
.duo { display: inline-flex }
.duo .av:nth-child(2) { margin-left: -10px; box-shadow: 0 0 0 2px var(--card) }
.today { margin-left: auto; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--accent); color: var(--accent-ink) }

/* ---------- tree ---------- */
.treepage { position: relative; height: calc(100dvh - var(--top)); display: flex; flex-direction: column }
@media (max-width: 860px) { .treepage { height: calc(100dvh - var(--top) - 70px - env(safe-area-inset-bottom)) } }
.tree-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 18px; border-bottom: 1px solid var(--line2); background: var(--paper); z-index: 2 }
.tree-who { flex: 0 1 320px; min-width: 200px; height: 42px; padding-left: 5px }
.tree-who input { font-weight: 600 }
.tree-from { color: var(--muted); font-size: 14.5px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap }
.tree-from b { color: var(--ink); font-weight: 600 }
.zoom { margin-left: auto; display: flex; gap: 2px; padding: 3px; border-radius: 12px; border: 1px solid var(--line); background: var(--card) }
.zoom button { border: 0; background: none; padding: 7px; border-radius: 9px; cursor: pointer; color: var(--muted); display: grid }
.zoom button:hover { background: var(--soft); color: var(--ink) }
.tree-sample { padding: 8px 18px 0 }
.tree-sample .banner { margin: 0; padding: 7px 12px; font-size: 13.5px }
.tree-host { flex: 1; position: relative; min-height: 0 }
.tree-canvas { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 0); background-size: 26px 26px }
.tree-canvas.dragging { cursor: grabbing }
.tree-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform }
.tree-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none }
.ln { fill: none; stroke: color-mix(in srgb, var(--ink) 38%, var(--paper)); stroke-width: 1.7; stroke-linecap: round }
.ln.couple { stroke: color-mix(in srgb, var(--accent) 60%, var(--paper)); stroke-width: 2.2 }
.ln.ended { stroke-dasharray: 5 6 }
.ring .bg { fill: var(--card); stroke: color-mix(in srgb, var(--accent) 50%, var(--paper)); stroke-width: 1.5 }
.ring .o { fill: none; stroke: var(--accent); stroke-width: 1.5 }
.ring.ended .o { stroke: var(--muted); stroke-dasharray: 2 2 }
.yr { font: 600 11px var(--bf); fill: var(--muted); text-anchor: middle; letter-spacing: .04em }
.tnode { position: absolute; display: flex; align-items: center; gap: 11px; padding: 0 12px 0 9px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); text-decoration: none; cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .15s }
.tnode:hover { box-shadow: var(--shadow2); border-color: color-mix(in srgb, var(--ink) 25%, transparent) }
.tnode .av { --s: 46px }
.tnode .tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.22 }
.tnode .tx > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.tnode b { font-size: 15.5px; font-weight: 650 }
.tnode .tx span { font-size: 13.5px; color: color-mix(in srgb, var(--ink) 80%, var(--paper)) }
.tnode .tx span i { color: var(--muted); font-style: italic; font-size: 12.5px }
.tnode small { font-size: 12px; color: var(--muted) }
.tnode.inlaw { background: color-mix(in srgb, var(--card) 55%, var(--paper)); border-style: dashed }
.tnode.gone .av { filter: grayscale(1); opacity: .75 }
.tnode.gone b, .tnode.gone .tx span { color: var(--muted) }
.tnode.focus { border: 2px solid var(--accent); box-shadow: 0 0 0 5px var(--soft), var(--shadow2) }
.tnode.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent), var(--shadow2) }
.tup { position: absolute; top: -36px; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer; color: var(--accent); box-shadow: var(--shadow); padding: 0 }
.tup:hover { background: var(--accent); color: var(--accent-ink) }
.tup .i { width: 16px; height: 16px; stroke-width: 2.4 }
.up-ex { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--accent); vertical-align: -5px }
.up-ex .i { width: 13px; height: 13px; stroke-width: 2.4 }
.tree-hint { position: absolute; left: 16px; bottom: 12px; font-size: 13px; color: var(--muted); background: color-mix(in srgb, var(--paper) 85%, transparent); padding: 4px 10px; border-radius: 8px; pointer-events: none }
.tree-note { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14.5px; z-index: 2 }
.tree-panel { position: absolute; right: 16px; top: 76px; width: 330px; max-width: calc(100% - 32px); background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow2);
  padding: 18px; z-index: 3; display: flex; flex-direction: column; gap: 10px; animation: rise .18s ease-out }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } }
.tree-panel .x { position: absolute; right: 10px; top: 10px; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; display: grid }
.tree-panel .x:hover { background: var(--soft) }
.tp-head { display: flex; gap: 14px; align-items: center; padding-right: 24px }
.tp-head h3 { font-size: 22px }
.tp-rel { padding: 8px 12px; border-radius: 12px; background: var(--soft); font-size: 15px }
.tp-ct .ct { padding: 3px 0; font-size: 15px }
.tree-panel .small { display: flex; gap: 8px; align-items: center; color: var(--muted) }
.tp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px }
@media (max-width: 600px) {
  .tree-sample { display: none }
  .tree-from { order: 3; flex-basis: 100%; font-size: 13.5px }
  .tree-bar .seg > * { padding: 6px 9px }
  .tree-panel { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-width: none; max-height: 60%; overflow: auto }
  .tree-hint { display: none }
  .tree-bar { padding: 10px 12px; gap: 8px }
  .tree-who { flex: 1 1 100% }
  .zoom { margin-left: auto }
}
.chooser { margin: 0 0 10px }
.picker.big { height: 54px; border-radius: 14px; max-width: 640px }
.picker.big input { font-size: 18px }
.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px }
.line-card { display: flex; gap: 14px; align-items: center; padding: 12px 14px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); text-decoration: none; transition: box-shadow .15s, transform .15s }
.line-card:hover { box-shadow: var(--shadow2); transform: translateY(-1px) }
.line-card > span:last-child { display: flex; flex-direction: column }
.line-card b { font-weight: 600 }
.line-card small { color: var(--muted) }
.line-card .duo .av:nth-child(2) { margin-left: -14px }

/* picker dropdown */
.pick-list { position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 40; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow2); padding: 6px; max-height: 340px; overflow: auto; min-width: 280px }
.pick-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left }
.pick-item > span:not(.av) { display: flex; flex-direction: column; min-width: 0; line-height: 1.25 }
.pick-item b { font-weight: 600 }
.pick-item small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.pick-item.on, .pick-item:hover { background: var(--soft) }
.pick-item.new { color: var(--accent); font-weight: 600; padding: 10px }
.picker.inline { flex: 1 1 260px; height: 38px }

/* ---------- related ---------- */
.rpick { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 26px }
.rslot { flex: 1 1 280px; display: flex; flex-direction: column; gap: 6px }
.rlabel { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600 }
.rslot .picker { height: 58px; padding-left: 6px; border-radius: 16px }
.rslot .picker input { font-size: 17px; font-weight: 600 }
.swap { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; display: grid; place-items: center; margin-bottom: 6px; color: var(--muted) }
.swap:hover { color: var(--ink); background: var(--soft) }
.rel-result { text-align: center; padding: 10px 10px 6px }
.rel-eyebrow { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600 }
.rel-result h2 { font-size: clamp(28px, 4.6vw, 44px); margin: 8px auto 8px; max-width: 900px }
.rel-result h2 a { text-decoration: none }
.rel-result h2 em { font-style: italic; color: var(--accent) }
.rel-back { font-size: 18px; margin-bottom: 4px }
.rel-none { text-align: center; padding: 30px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r) }
.rel-none h2 { margin-bottom: 8px }
.pathwrap { overflow-x: auto; margin: 22px -18px 0; padding: 14px 18px 22px; display: flex }
.pathdiag { position: relative; flex: none; margin: 0 auto }
.pathdiag .tnode { cursor: pointer }
.plabel { position: absolute; transform: translate(-50%, -50%); background: var(--paper); border: 1px solid var(--line2); border-radius: 99px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; text-transform: lowercase }
.pathlist { display: none; list-style: none; padding: 0; margin: 18px 0 0 }
.pathlist li { display: flex; justify-content: center }
.pstep { gap: 6px; align-items: center; color: var(--muted); font-size: 13px; padding: 4px 0; text-transform: lowercase }
.pstep .i { width: 14px; height: 14px }
@media (max-width: 700px) { .pathwrap { display: none } .pathlist { display: block } }

/* ---------- forms ---------- */
.editor { max-width: 860px; display: flex; flex-direction: column; gap: 16px }
.ehead { display: flex; align-items: center; gap: 22px; margin-bottom: 4px }
.ehead h1 { font-size: clamp(28px, 4vw, 38px) }
.ecard { display: flex; flex-direction: column; gap: 12px; margin: 0; min-width: 0 }
fieldset.ecard { padding-top: 14px }
legend { font-family: var(--hf); font-size: 20px; padding: 0 6px; margin-left: -6px }
.fsec { font-size: 13px; font-family: var(--bf); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 6px }
.fsec:first-child { margin-top: 0 }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0 }
.lbl { font-size: 14px; font-weight: 600 }
.field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea, .date input, .date select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); outline: 0; font-size: 16px; transition: border-color .15s, box-shadow .15s }
.field input:focus, .field select:focus, .field textarea:focus, .date input:focus, .date select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft) }
.field textarea { resize: vertical }
.field .seg { align-self: flex-start }
.ecard > .btn { align-self: flex-start }
.editor ~ .ecard { margin-top: 16px; max-width: 860px }
.fgrid2, .fgrid3 { display: grid; gap: 12px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start }
.fgrid3 { grid-template-columns: repeat(3, minmax(0, 1fr)) }
@media (max-width: 640px) { .fgrid2, .fgrid3 { grid-template-columns: 1fr } }
.date { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .65fr) minmax(0, .85fr); gap: 6px }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; padding: 6px 0 }
.check input { width: 18px; height: 18px; accent-color: var(--accent) }
.check.lead { margin-top: -6px }
.ebar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 12px 0; background: linear-gradient(transparent, var(--paper) 30%); z-index: 4 }
@media (max-width: 860px) { .ebar { bottom: 70px } }
.adv summary { cursor: pointer; color: var(--muted); font-size: 14.5px }
.adv[open] summary { margin-bottom: 10px }
.photo-field { display: flex; align-items: center; gap: 16px }
.pf-img { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: var(--soft2); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); flex: none }
.pf-img .i { width: 30px; height: 30px }
.pf-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28% }
.photo-field.wide .pf-img { width: 180px; height: 120px; border-radius: 14px }
.photo-field.busy .pf-img { opacity: .5; animation: pulse 1s ease-in-out infinite alternate }
@keyframes pulse { to { opacity: .25 } }
.pf-btns { display: flex; flex-wrap: wrap; gap: 6px }
.kid { display: grid; grid-template-columns: 1.1fr 1.1fr auto 1.6fr auto; gap: 10px; align-items: end; padding-bottom: 12px; border-bottom: 1px solid var(--line2); margin-bottom: 4px }
.kid [data-rmkid] { margin-bottom: 4px }
.ablock, .newfields { display: flex; flex-direction: column; gap: 12px }
.ablock > .picker { flex: none; height: 46px }
.or { color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 12px }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line2) }
.chosen { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft2) }
.chosen > span:not(.av) { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0 }
.chosen b { font-weight: 600 } .chosen small { color: var(--muted) }
.kids-existing { display: flex; flex-direction: column; gap: 6px }
.kids-existing:empty { display: none }
.kidx { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line2); border-radius: 12px; cursor: pointer; background: var(--paper) }
.kidx input { width: 18px; height: 18px; accent-color: var(--accent); flex: none }
.kidx > span:not(.av) { display: flex; flex-direction: column; line-height: 1.3 }
.kidx b { font-weight: 600 } .kidx small { color: var(--muted) }
.married-known { padding: 2px }
a.contact-card.add { align-items: center; gap: 10px; color: var(--muted); border-style: dashed; background: transparent; text-decoration: none }
a.contact-card.add:hover { color: var(--ink); background: var(--soft2) }
@media (max-width: 760px) { .kid { grid-template-columns: 1fr 1fr } .kid [data-rmkid] { justify-self: start } }
.mlist { display: flex; flex-direction: column; gap: 4px }
.mrow { display: flex; align-items: center; gap: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line2) }
.mrow > span:not(.av) { flex: 1; display: flex; flex-direction: column; line-height: 1.25 }
.mrow small { color: var(--muted) }
.addrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px }
.color { display: flex; align-items: center; gap: 10px }
.color input { width: 48px; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--paper); cursor: pointer }
.color code { color: var(--muted); font-size: 14px }

/* modal */
.modal { border: 0; padding: 0; border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45); width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 40px) }
.modal::backdrop { background: rgb(20 18 14 / .42); backdrop-filter: blur(3px) }
.modal form { padding: 22px; display: flex; flex-direction: column; gap: 14px }
.modal h2 { font-size: 24px }
.modal .actions { justify-content: flex-end; margin-top: 4px }
.modal .newp { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; background: var(--soft2) }
.modal .picker { position: relative }
.modal .pick-list { position: absolute }
.confirm p { color: var(--muted) }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none }
@media (max-width: 860px) { #toasts { bottom: 90px } }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow2); font-size: 15px; animation: rise .2s ease-out; transition: opacity .4s, transform .4s; max-width: 92vw }
.toast.bad { background: #b42318; color: #fff }
.toast.out { opacity: 0; transform: translateY(6px) }

/* search palette */
.palette { position: fixed; inset: 0; z-index: 90; background: rgb(20 18 14 / .35); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 12px 12px }
.pal-box { width: min(620px, 100%); background: var(--card); border-radius: 20px; box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45); overflow: hidden; animation: rise .15s ease-out }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 60px; border-bottom: 1px solid var(--line2) }
.pal-in .i { color: var(--muted); width: 22px; height: 22px }
.pal-in input { flex: 1; border: 0; outline: 0; background: none; font-size: 19px }
kbd { font: 12px var(--bf); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px }
.pal-list { max-height: 55vh; overflow: auto; padding: 6px }
.pal-item { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px; text-decoration: none }
.pal-item > span:not(.av) { display: flex; flex-direction: column; line-height: 1.25; min-width: 0 }
.pal-item b { font-weight: 600 }
.pal-item small { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.pal-item.on, .pal-item:hover { background: var(--soft) }
.pal-empty { padding: 18px 14px; color: var(--muted) }

/* ---------- print ---------- */
.print-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 0 20px; border-bottom: 1px solid var(--line2); margin-bottom: 24px }
.print-bar .crumb { margin: 0 }
.print-bar p { flex: 1; color: var(--muted) }
.print { background: #fff; color: #111; padding: 40px; border-radius: 6px; box-shadow: var(--shadow2); font-size: 13px; line-height: 1.4; max-width: 900px; margin: 0 auto }
.cover { text-align: center; padding: 70px 0 90px; border-bottom: 1px solid #ddd; margin-bottom: 30px }
.cover img { width: 150px; height: 150px; object-fit: contain; margin: 0 auto 24px; border-radius: 50% }
.cover h1 { font-size: 40px }
.cover h2 { font-size: 22px; color: #555; margin-top: 8px; font-family: var(--bf); font-weight: 400; letter-spacing: .14em; text-transform: uppercase }
.cover p { margin-top: 14px; color: #444 }
.cover .addr { font-size: 13px; color: #666 }
.cover .private { margin-top: 40px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #888 }
.pentries { columns: 2; column-gap: 34px }
.pentry { break-inside: avoid; padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid #e6e6e6; overflow: hidden }
.pentry img { float: right; width: 92px; height: 70px; object-fit: cover; border-radius: 4px; margin: 0 0 6px 10px }
.pentry h3 { font-size: 17px; margin-bottom: 3px; color: #111 }
.pentry h3 span { font-family: var(--bf); font-size: 14px; font-weight: 600 }
.pentry p { color: #333 }
.pentry ul { list-style: none; padding: 0; margin: 4px 0 0 }
.pentry li { color: #333 }
@media print {
  @page { margin: 0.5in }
  body { background: #fff }
  .top, .bottom, .noprint, #toasts, .banner { display: none !important }
  main { padding: 0; max-width: none }
  .print { box-shadow: none; padding: 0; max-width: none }
  .cover { break-after: page; border: 0; padding-top: 2in }
}

.import-status { padding: 8px 12px; border-radius: 10px; background: var(--soft2) }
.import-status.ok { background: color-mix(in srgb, #3a8a4f 14%, var(--card)) }
.import-status.bad { background: color-mix(in srgb, #b42318 12%, var(--card)); color: #b42318 }
.imports .mrow > .i { color: var(--muted); width: 22px; height: 22px }

/* family page: at home + family tree */
.sect-h { font-size: 22px; margin: 4px 0 -8px }
.kin .rels-head { flex-wrap: wrap; margin-bottom: 12px }
.kin .rels-head .actions { gap: 6px }
.ftree-wrap { position: relative; height: clamp(340px, 56vh, 600px); border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; background: var(--paper) }
.ftree { position: absolute; inset: 0 }
.ftree-tools { position: absolute; right: 10px; top: 10px; z-index: 2; display: flex; gap: 2px; padding: 3px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow) }
.ftree-tools > * { border: 0; background: none; padding: 7px; border-radius: 9px; cursor: pointer; color: var(--muted); display: grid; place-items: center }
.ftree-tools > *:hover { background: var(--soft); color: var(--ink) }
.tree-canvas.embed { touch-action: pan-y }
.kin .hint { margin-top: 8px }
