/* ==========================================================================
   The Abdul Latiff Family Lineage — interface stylesheet (v0.10)
   Contemporary and calm: forest green, warm off-white, restrained gold.
   Sans-serif for the interface; serif only for identity headings.
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 px.
   Fonts are self-hosted (SIL OFL, see assets/fonts/OFL.txt) — no CDN.
   ========================================================================== */

@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(../fonts/plus-jakarta-sans-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(../fonts/fraunces-latin-opsz-normal.woff2) format("woff2"); }

:root {
  /* Colour — contrast ratios measured against --canvas unless noted */
  --green-900: #0F2A1E;
  --green-800: #173D2C;      /* primary: 11.2:1 */
  --green-700: #22543D;      /* hover */
  --green-200: #CFE0D5;
  --green-100: #E5EEE8;
  --green-50:  #F1F6F2;
  --canvas:    #FAF8F3;      /* warm off-white page */
  --surface:   #FFFFFF;
  --surface-2: #F3F0E8;      /* quiet bands, inputs on tinted panels */
  --text:      #1E241F;      /* 15.6:1 */
  --text-2:    #545B52;      /* 6.6:1 secondary */
  --border:    #E4DFD4;
  --border-2:  #CDC6B6;      /* form controls (3:1 non-text on white) */
  --gold:      #B5965A;      /* accents only, never body text */
  --gold-text: #7A5F2E;      /* 5.6:1 */
  --gold-soft: #F7F0E0;
  --danger:    #A12E2E;      /* 6.9:1 */
  --danger-soft: #FBEAE7;
  --success-soft: #E5F1E8;
  --warning-soft: #FBF2DC;
  --focus:     #1D6B47;

  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;

  --fs-xs: 0.8125rem;   /* 13px */
  --fs-sm: 0.9375rem;   /* 15px */
  --fs-md: 1.0625rem;   /* 17px body */
  --fs-lg: 1.1875rem;   /* 19px */
  --fs-xl: 1.5rem;      /* 24px */
  --fs-2xl: 2rem;       /* 32px */
  --fs-3xl: clamp(2rem, 3.4vw, 2.75rem);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 42, 30, 0.06);
  --shadow-md: 0 1px 2px rgba(15, 42, 30, 0.06), 0 8px 24px -12px rgba(15, 42, 30, 0.22);
  --shadow-lg: 0 2px 4px rgba(15, 42, 30, 0.06), 0 24px 48px -20px rgba(15, 42, 30, 0.35);

  --container: 1200px;
  --gutter: 24px;
  --header-h: 64px;
  --tap: 44px;
}
@media (max-width: 719px) { :root { --gutter: 16px; --fs-2xl: 1.75rem; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--canvas); color: var(--text);
  font-family: var(--font-sans); font-size: var(--fs-md); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
main { flex: 1; width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-8); }
main:focus { outline: none; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 700; line-height: 1.25; color: var(--green-900); margin: 0 0 var(--s-3); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s-4); }
a { color: var(--green-800); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--green-700); text-decoration-thickness: 2px; }
code { font-size: 0.9em; background: var(--surface-2); padding: 0.05em 0.35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.serif { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s-4); top: -100px; z-index: 200; background: var(--surface); color: var(--green-800); padding: var(--s-3) var(--s-4); border: 2px solid var(--green-800); border-radius: var(--r-sm); font-weight: 700; }
.skip-link:focus { top: var(--s-3); }
.muted { color: var(--text-2); }
.unknown { color: var(--text-2); }
.sep { margin: 0 0.4em; color: var(--border-2); }
.hint { color: var(--text-2); font-size: var(--fs-sm); margin: 0 0 var(--s-2); }
.hint-inline { display: block; color: var(--text-2); font-size: var(--fs-sm); }
html:not(.js) .js-only { display: none !important; }
.js .no-js-only { display: none; }

/* ---------- Banners ---------- */
.staging-banner, .demo-banner { text-align: center; font-size: var(--fs-xs); padding: var(--s-1) var(--gutter); font-weight: 600; }
.staging-banner { background: var(--warning-soft); color: #5B4515; border-bottom: 1px solid #EBDDB7; }
.demo-banner { background: #3A2E12; color: #F5E8C8; }

/* ==========================================================================
   Header: one row — identity, family navigation, account menu
   ========================================================================== */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: var(--s-5); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--green-900); margin-right: auto; min-width: 0; }
.brand:hover { color: var(--green-900); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px var(--border); }
.brand-name { font-family: var(--font-serif); font-weight: 600; font-size: 1.125rem; line-height: 1.2; letter-spacing: -0.01em; }

.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s-1); }
.primary-nav a { display: inline-flex; align-items: center; min-height: var(--header-h); padding: 0 var(--s-3); color: var(--text); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); position: relative; }
.primary-nav a:hover { color: var(--green-800); }
.primary-nav a::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.primary-nav a[aria-current="page"] { color: var(--green-800); }
.primary-nav a[aria-current="page"]::after { background: var(--green-800); }

/* Account menu (a <details> disclosure — works without JavaScript) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-3) 0 var(--s-1); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { border-color: var(--border-2); }
.menu[open] > summary { border-color: var(--green-800); }
.menu-chevron { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 2px; }
.menu[open] .menu-chevron { transform: rotate(-135deg) translateY(-1px); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--green-100); color: var(--green-800); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-xs); flex: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + var(--s-2)); width: 288px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: var(--s-2); z-index: 60; }
.menu-who { padding: var(--s-3) var(--s-3) var(--s-3); border-bottom: 1px solid var(--border); margin-bottom: var(--s-2); }
.menu-who strong { display: block; color: var(--green-900); overflow-wrap: anywhere; }
.menu-who span { font-size: var(--fs-xs); color: var(--text-2); }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list a, .menu-list button { display: flex; width: 100%; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text); text-decoration: none; font: inherit; font-size: var(--fs-sm); font-weight: 600; background: none; border: 0; cursor: pointer; text-align: left; }
.menu-list a:hover, .menu-list button:hover { background: var(--green-50); color: var(--green-800); }
.menu-list a[aria-current="page"] { background: var(--green-50); color: var(--green-800); }
.menu-group { border-top: 1px solid var(--border); margin-top: var(--s-2); padding-top: var(--s-2); }
.menu-label { display: block; padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.menu-lang { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); font-weight: 600; }
.menu-admin a { color: var(--green-900); }
.menu-admin a::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--gold); margin-right: var(--s-3); flex: none; }
.menu form { margin: 0; }

.lang-switch { display: inline-flex; border: 1px solid var(--border-2); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang-switch a { color: var(--text); text-decoration: none; min-height: 32px; min-width: 44px; padding: 0 var(--s-3); display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; }
.lang-switch a[aria-current="true"] { background: var(--green-800); color: #fff; }

.nav-toggle { display: none; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-3); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.nav-toggle-bars { width: 18px; height: 12px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; position: relative; }
.nav-toggle-bars::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; border-top: 2px solid currentColor; }

@media (max-width: 1023px) {
  .header-inner { gap: var(--s-3); }
  .nav-toggle { display: inline-flex; order: 3; }
  .menu { order: 2; }
  .menu-name { display: none; }
  .menu > summary { padding: 0 var(--s-2) 0 var(--s-1); }
  .primary-nav { order: 4; flex-basis: 100%; }
  .js .primary-nav { display: none; }
  .js .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; padding: 0 0 var(--s-3); }
  .primary-nav a { min-height: 48px; width: 100%; font-size: var(--fs-md); border-radius: var(--r-sm); padding: 0 var(--s-3); }
  .primary-nav a::after { left: 0; right: auto; top: 10px; bottom: 10px; width: 3px; height: auto; border-radius: 3px; }
  .primary-nav a[aria-current="page"] { background: var(--green-50); }
  .header-inner { flex-wrap: wrap; padding-top: var(--s-2); padding-bottom: var(--s-2); }
  .brand { flex: 1 1 0; }
}
@media (max-width: 479px) {
  .brand-name { font-size: 0.9375rem; }
  .brand-mark { width: 32px; height: 32px; }
  .nav-toggle-text { display: none; }
  .menu-panel { position: fixed; left: var(--s-3); right: var(--s-3); top: calc(var(--header-h) + var(--s-1)); width: auto; }
}

/* Administration bar — visually distinct from the family site */
.admin-bar { background: var(--green-900); color: #E9EFE9; }
.admin-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: 48px; flex-wrap: wrap; }
.admin-bar-title { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; display: inline-flex; align-items: center; gap: var(--s-2); }
.admin-bar-title::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--gold); }
.admin-bar a { color: #fff; font-size: var(--fs-sm); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); justify-content: space-between; align-items: center; padding-top: var(--s-5); padding-bottom: var(--s-5); }
.footer-motto { display: inline-flex; align-items: center; gap: var(--s-3); margin: 0; color: var(--green-900); font-weight: 600; font-size: var(--fs-sm); }
.footer-motto img { width: 32px; height: 32px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.footer-mark { font-size: var(--fs-xs); letter-spacing: 0.12em; color: var(--gold-text); font-weight: 800; }
.footer-meta { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }

/* ==========================================================================
   Page structure
   ========================================================================== */
.page-head { margin-bottom: var(--s-6); max-width: 760px; }
.page-head h1 { margin-bottom: var(--s-2); }
.page-head .lede { margin-bottom: 0; }
.page-head > p:not(.lede):not(.eyebrow) { margin: var(--s-4) 0 0; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4); max-width: none; }
.page-head-compact { margin-bottom: var(--s-5); }
.eyebrow { font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); font-weight: 700; margin-bottom: var(--s-2); }
.eyebrow a { color: inherit; }
.lede { font-size: var(--fs-md); color: var(--text-2); max-width: 46em; line-height: 1.6; }
.back-link { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); margin-bottom: var(--s-3); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; }
.back-link::before { content: "←"; }
.back-link:hover { text-decoration: underline; }
.section { margin-top: var(--s-7); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-4); }
.section-head h2 { margin: 0; }
.section-title { font-size: var(--fs-xl); }
.section-note { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }
.prose { max-width: 42em; }
.page-narrow { max-width: 720px; }
.stack-cards { display: flex; flex-direction: column; gap: var(--s-5); max-width: 720px; }
.stack-cards > .card > h2 { font-size: var(--fs-lg); margin-bottom: var(--s-4); }
.stack-cards .facts { margin: 0; }
.stack-cards .form-stack { max-width: none; }
.display-title { font-family: var(--font-serif); font-weight: 600; font-size: var(--fs-3xl); line-height: 1.12; letter-spacing: -0.015em; margin-bottom: var(--s-3); }
.display-subtitle { font-size: var(--fs-lg); color: var(--text-2); max-width: 34em; line-height: 1.5; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-sm); }
.card-tint { background: var(--green-50); border-color: var(--green-200); }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-5); border-radius: var(--r-sm); border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: var(--fs-sm); line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease; text-align: center; white-space: nowrap; }
.button-primary { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.button-primary:hover { background: var(--green-700); border-color: var(--green-700); color: #fff; text-decoration: none; }
.button-secondary { background: var(--surface); color: var(--green-800); border-color: var(--green-800); }
.button-secondary:hover { background: var(--green-50); color: var(--green-800); text-decoration: none; }
.button-quiet { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.button-quiet:hover { border-color: var(--green-800); color: var(--green-800); text-decoration: none; }
.button-ghost { background: transparent; color: var(--green-800); border-color: transparent; padding: 0 var(--s-3); }
.button-ghost:hover { background: var(--green-50); text-decoration: none; }
.button-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.button-danger:hover { background: #842323; color: #fff; }
.button-lg { min-height: 52px; font-size: var(--fs-md); padding: 0 var(--s-6); }
.button-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin: var(--s-4) 0; }
.button-row form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--green-800); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; min-height: 32px; text-align: left; }
.link-button.danger { color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: var(--s-5); max-width: 560px; }
.form-wide { max-width: 760px; }
.form-stack > .button:not(.button-block), .form-stack > button:not(.button-block) { align-self: flex-start; }
.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field > label, .field-label, .date-row label > span, .tree-field label, .tree-search label { font-weight: 700; font-size: var(--fs-sm); color: var(--text); }
.field > .hint, .field-hint { margin: calc(-1 * var(--s-1)) 0 0; }
.req { color: var(--danger); font-weight: 700; }
.opt { color: var(--text-2); font-weight: 500; }
.field-row { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-end; }
.field-row > .field { flex: 1 1 180px; }
.field-grow { flex: 2 1 260px !important; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input:not([type]), select, textarea {
  font: inherit; font-size: var(--fs-md); color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border-2); border-radius: var(--r-sm);
  min-height: 48px; padding: var(--s-2) var(--s-3); width: 100%; max-width: 100%;
}
input::placeholder, textarea::placeholder { color: #7D8279; }
textarea { min-height: 7rem; line-height: 1.5; resize: vertical; }
select { padding-right: var(--s-6); text-overflow: ellipsis; }
input:hover, select:hover, textarea:hover { border-color: #A9A291; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--green-800); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; margin: 0; }
input[type="file"] { font: inherit; font-size: var(--fs-sm); color: var(--text-2); padding: 0; max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 700; color: var(--text); background: var(--surface); border: 1.5px solid var(--border-2); border-radius: var(--r-sm); min-height: var(--tap); padding: 0 var(--s-5); margin-right: var(--s-3); cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--green-800); color: var(--green-800); }
.check { display: flex; align-items: flex-start; gap: var(--s-3); min-height: var(--tap); padding: var(--s-2) 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--green-800); flex: none; }
.fieldset, .date-fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-5); margin: 0; background: var(--surface); display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
legend { font-weight: 700; font-size: var(--fs-md); color: var(--green-900); padding: 0; }
/* Grouped sections are cards with their title inside, flush with the fields below (no border notch). */
.fieldset > legend, .date-fieldset > legend { float: left; width: 100%; margin: 0; }
.fieldset > legend + *, .date-fieldset > legend + * { clear: both; }
.date-fieldset { gap: var(--s-3); }
.date-fieldset > .hint { margin: 0; }
.date-row { display: grid; grid-template-columns: 6rem minmax(0, 1fr) 7.5rem; gap: var(--s-3); }
.date-row label { display: flex; flex-direction: column; gap: var(--s-1); }
.date-row select { padding-left: var(--s-2); padding-right: var(--s-1); }
@media (max-width: 479px) { .date-row { grid-template-columns: 4.25rem minmax(0, 1fr) 5.25rem; gap: var(--s-2); } }
.form-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); margin: 0; }
.form-links a { min-height: var(--tap); display: inline-flex; align-items: center; }

/* Choice cards (radio buttons with plain-language labels) */
.choices { display: grid; gap: var(--s-3); border: 0; padding: 0; margin: 0; min-width: 0; }
.choices legend { padding: 0; margin-bottom: var(--s-3); font-size: var(--fs-md); }
.choice { position: relative; display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border: 1.5px solid var(--border-2); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--green-800); }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--green-800); flex: none; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-weight: 700; color: var(--green-900); }
.choice-desc { color: var(--text-2); font-size: var(--fs-sm); }
.choice:has(input:checked) { border-color: var(--green-800); background: var(--green-50); box-shadow: inset 0 0 0 1px var(--green-800); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choices-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choices-inline .choice { padding: var(--s-3) var(--s-4); align-items: center; }

/* Progressive disclosure for optional sections */
.more { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-2); min-height: 56px; padding: 0 var(--s-5); font-weight: 700; color: var(--green-800); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: "+"; font-size: 1.4rem; font-weight: 500; line-height: 1; margin-left: auto; }
.more[open] > summary::after { content: "−"; }
.more > summary .opt { font-weight: 500; font-size: var(--fs-sm); }
.more-body { padding: 0 var(--s-5) var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.more .date-fieldset { border: 0; padding: 0; background: none; }

/* ---------- Flash & alerts ---------- */
.flash { border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-5); border: 1px solid; background: var(--surface); }
.flash p:last-child, .flash ul { margin-bottom: 0; }
.flash ul { padding-left: 1.2rem; margin: var(--s-1) 0 0; }
.flash a { font-weight: 700; }
.flash-success { border-color: #B7D3BF; background: var(--success-soft); }
.flash-info { border-color: var(--border-2); background: var(--surface); }
.flash-error { border-color: #E5B4AD; background: var(--danger-soft); }
.flash-warning { border-color: #E8D49E; background: var(--warning-soft); }
.error-summary h2 { font-size: var(--fs-md); margin-bottom: var(--s-1); color: var(--danger); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; font-size: var(--fs-xs); font-weight: 700; padding: 2px var(--s-2); border-radius: 999px; border: 1px solid; vertical-align: middle; line-height: 1.5; white-space: nowrap; }
.badge-confirmed, .badge-approved, .badge-admin, .badge-resolved { color: var(--green-800); border-color: var(--green-200); background: var(--success-soft); }
.badge-unverified, .badge-pending, .badge-unavailable { color: #5B4515; border-color: #E8D49E; background: var(--warning-soft); }
.badge-deceased, .badge-withdrawn, .badge-viewer, .badge-member, .badge-dismissed { color: var(--text-2); border-color: var(--border-2); background: var(--surface); }
.badge-rejected { color: var(--danger); border-color: #E5B4AD; background: var(--danger-soft); }

/* ---------- Portraits (approved photo or initials — never placeholder faces) ---------- */
.portrait { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; flex: none; background: var(--green-100); color: var(--green-800); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait-initials { font-weight: 700; letter-spacing: 0.02em; }
.portrait-sm { width: 44px; height: 44px; font-size: var(--fs-sm); }
.portrait-md { width: 56px; height: 56px; font-size: var(--fs-md); }
.portrait-lg { width: 88px; height: 88px; font-size: 1.5rem; }
.portrait-xl { width: 112px; height: 112px; font-size: 2rem; }

/* ---------- Searchable person picker ---------- */
.picker { position: relative; }
.picker-input-wrap { position: relative; }
.picker-input-wrap input { padding-left: 44px; }
.picker-input-wrap::before { content: ""; position: absolute; left: 16px; top: 50%; width: 14px; height: 14px; border: 2px solid var(--text-2); border-radius: 50%; transform: translateY(-60%); pointer-events: none; }
.picker-input-wrap::after { content: ""; position: absolute; left: 29px; top: 50%; width: 2px; height: 7px; background: var(--text-2); transform: translateY(2px) rotate(-45deg); pointer-events: none; }
.picker-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + var(--s-1)); list-style: none; margin: 0; padding: var(--s-1); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-md); box-shadow: var(--shadow-lg); max-height: 360px; overflow: auto; }
.picker-option, .combo-option { padding: var(--s-2) var(--s-3); cursor: pointer; display: flex; flex-direction: column; min-height: 52px; justify-content: center; border-radius: var(--r-sm); }
.picker-option.is-active, .picker-option:hover, .combo-option.is-active, .combo-option:hover { background: var(--green-50); }
.picker-name, .combo-name { font-weight: 700; color: var(--green-900); }
.picker-meta, .combo-meta { font-size: var(--fs-sm); color: var(--text-2); }
.picker-empty, .combo-empty { padding: var(--s-3); color: var(--text-2); }
.picker-selected { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1.5px solid var(--green-800); background: var(--green-50); border-radius: var(--r-md); }
.picker-selected-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picker-selected-name { font-weight: 700; color: var(--green-900); overflow-wrap: anywhere; }
.picker-selected-meta { font-size: var(--fs-sm); color: var(--text-2); }
.js .picker-select-fallback { display: none; }

/* Person summary card (selected person, review, confirmation) */
.person-chip { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.person-chip-text { min-width: 0; display: flex; flex-direction: column; }
.person-chip-name { font-weight: 700; font-size: var(--fs-lg); color: var(--green-900); overflow-wrap: anywhere; line-height: 1.3; }
.person-chip-meta { color: var(--text-2); font-size: var(--fs-sm); }
.person-chip .button { margin-left: auto; }
@media (max-width: 559px) { .person-chip { flex-wrap: wrap; } .person-chip .button { margin-left: 0; } }

/* ==========================================================================
   Welcome (public) & auth
   ========================================================================== */
.page-welcome main { padding-top: var(--s-7); }
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s-7); align-items: center; }
.welcome-invite { font-size: var(--fs-lg); line-height: 1.55; max-width: 32em; }
.welcome-privacy { color: var(--text-2); font-size: var(--fs-sm); max-width: 34em; }
.archival-plate { margin: 0; }
.archival-plate img { display: block; width: 100%; border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.archival-plate figcaption { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--s-3); text-align: center; }
.rule-gold { display: none; }
@media (max-width: 899px) {
  .welcome { grid-template-columns: 1fr; gap: var(--s-5); }
  .welcome-text .button-row .button { flex: 1 1 100%; }
}
.auth-panel { max-width: 480px; margin: var(--s-5) auto; }
.auth-intro { margin-bottom: var(--s-5); }
.auth-intro h1 { font-size: var(--fs-2xl); }
.facts { display: grid; gap: 0; margin: 0 0 var(--s-5); }
.facts > div { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr); gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.facts > div:first-child { border-top: 1px solid var(--border); }
.facts dt { color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts-compact > div { padding: var(--s-2) 0; }
@media (max-width: 479px) { .facts > div { grid-template-columns: 1fr; gap: 0; } }

/* ==========================================================================
   Home
   ========================================================================== */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-6) var(--s-7); align-items: center; padding: var(--s-5) 0 var(--s-7); }
.home-hero .display-subtitle { margin-bottom: 0; }
.home-greeting { font-weight: 700; color: var(--green-800); margin-bottom: var(--s-2); }
.home-plate { margin: 0; max-width: 440px; justify-self: end; }
.home-plate img { display: block; width: 100%; border-radius: var(--r-md); box-shadow: var(--shadow-md); }
@media (max-width: 899px) { .home-hero { grid-template-columns: 1fr; gap: var(--s-5); padding: var(--s-2) 0 var(--s-5); } .home-plate { justify-self: start; max-width: 320px; } }
@media (max-width: 559px) { .home-plate { max-width: 220px; } }

.start-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.start-action { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; min-width: 0; }
a.start-action:hover { border-color: var(--green-800); box-shadow: var(--shadow-md); text-decoration: none; color: var(--text); }
.start-action h2 { font-size: var(--fs-lg); margin: 0; }
.start-action p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.start-icon { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--green-50); display: inline-flex; align-items: center; justify-content: center; }
.start-icon svg { width: 24px; height: 24px; stroke: var(--green-800); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.start-go { margin-top: auto; font-weight: 700; color: var(--green-800); display: inline-flex; gap: var(--s-2); align-items: center; }
.start-go::after { content: "→"; }
.start-action-primary { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.start-action-primary h2, .start-action-primary .start-go { color: #fff; }
.start-action-primary p { color: #D7E5DB; }
.start-action-primary .start-icon { background: rgba(255, 255, 255, 0.12); }
.start-action-primary .start-icon svg { stroke: #fff; }
a.start-action-primary:hover { background: var(--green-700); color: #fff; }
.start-search { display: flex; gap: var(--s-2); margin-top: auto; }
.start-search input { min-width: 0; flex: 1; }
.start-search .button { padding: 0 var(--s-4); }
@media (max-width: 899px) { .start-actions { grid-template-columns: 1fr; } }

.start-guide { margin-top: var(--s-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.start-guide > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: 0 var(--s-5); font-weight: 700; color: var(--green-900); }
.start-guide > summary::-webkit-details-marker { display: none; }
.start-guide > summary::before { content: "?"; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.start-guide > summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; font-weight: 500; color: var(--green-800); }
.start-guide[open] > summary::after { content: "−"; }
.start-guide-body { padding: 0 var(--s-5) var(--s-5); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--fs-sm); color: var(--text-2); }
.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; background: var(--green-800); color: #fff; font-weight: 700; font-size: var(--fs-xs); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.steps strong { display: block; color: var(--text); font-size: var(--fs-md); }
.start-guide-foot { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin: var(--s-4) 0 0; padding-top: var(--s-4); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
@media (max-width: 719px) { .steps { grid-template-columns: 1fr; } }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-6); margin-top: var(--s-7); align-items: start; }
@media (max-width: 899px) { .home-grid { grid-template-columns: 1fr; } }

.founder-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-4); }
.founder { display: flex; gap: var(--s-4); align-items: center; padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.founder-name { font-size: var(--fs-lg); margin: 0; }
.founder-name a { text-decoration: none; color: var(--green-900); }
.founder-name a:hover { text-decoration: underline; }
.founder-meta { color: var(--text-2); margin: 0; font-size: var(--fs-sm); }
.founder-note { color: var(--text-2); margin: var(--s-1) 0 0; font-size: var(--fs-sm); }

.branch-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.branch-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s-1) var(--s-4); align-items: center; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); }
.branch-row:first-child { border-top: 0; }
.branch-number { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: var(--fs-xs); display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.branch-name { font-size: var(--fs-md); margin: 0; }
.branch-name a { color: var(--green-900); text-decoration: none; }
.branch-name a:hover { text-decoration: underline; }
.branch-meta { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.branch-explore { min-height: var(--tap); display: inline-flex; align-items: center; font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; text-decoration: none; }
.branch-explore::after { content: " →"; margin-left: 0.25em; }
.branch-explore:hover { text-decoration: underline; }
@media (max-width: 559px) { .branch-row { grid-template-columns: 32px minmax(0, 1fr); } .branch-explore { grid-column: 2; min-height: 32px; } }

.side-stack { display: flex; flex-direction: column; gap: var(--s-5); }
.totals dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); margin: 0; }
.totals dl > div { padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.totals dd { margin: 0; font-size: var(--fs-2xl); font-weight: 700; color: var(--green-800); line-height: 1.1; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--text-2); font-size: var(--fs-sm); }
.totals-note { color: var(--text-2); font-size: var(--fs-xs); margin: var(--s-3) 0 0; }
.recent-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.recent-list li { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.recent-list li:first-child { border-top: 0; }
.recent-kind { display: block; color: var(--text-2); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; }
.empty-state { padding: var(--s-6); background: var(--surface); border: 1px dashed var(--border-2); border-radius: var(--r-lg); max-width: 760px; margin-bottom: var(--s-5); }
.empty-state > :last-child { margin-bottom: 0; }
.empty-state h2 { font-size: var(--fs-lg); }

/* ==========================================================================
   Family Members (directory)
   ========================================================================== */
.filters { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-end; padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: var(--s-5); }
.filters .field { flex: 1 1 170px; }
.filters-actions { display: flex; gap: var(--s-2); align-items: flex-end; }
.results-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.results-count { margin: 0; color: var(--text-2); font-weight: 600; }
.view-switch { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.view-switch a, .view-switch button { min-height: 40px; padding: 0 var(--s-4); display: inline-flex; align-items: center; text-decoration: none; color: var(--text); background: transparent; border: 0; font: inherit; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.view-switch a + a, .view-switch button + button { border-left: 1px solid var(--border-2); }
.view-switch [aria-current="true"], .view-switch [aria-pressed="true"] { background: var(--green-800); color: #fff; }

.directory-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.directory-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); position: relative; }
.directory-row:first-child { border-top: 0; }
.directory-row:hover { background: var(--green-50); }
.directory-name { font-size: var(--fs-md); margin: 0; overflow-wrap: anywhere; }
.directory-name a { text-decoration: none; color: var(--green-900); }
.directory-name a::after { content: ""; position: absolute; inset: 0; }
.directory-name a:hover { text-decoration: underline; }
.directory-name a:focus-visible { outline: none; }
.directory-row:has(a:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }
.nickname { font-weight: 500; color: var(--text-2); font-size: var(--fs-sm); margin-left: 0.35em; }
.directory-meta { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 0 var(--s-4); }
.directory-kin { margin: 0; color: var(--text-2); font-size: var(--fs-sm); text-align: right; }
@media (max-width: 559px) { .directory-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 2px; } .directory-kin { grid-column: 2; text-align: left; } }

.portrait-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--s-4); }
@media (max-width: 559px) { .portrait-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); } .portrait-card a { padding: var(--s-4) var(--s-2); } }
.portrait-card a { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-5) var(--s-3); text-decoration: none; color: var(--text); border-radius: var(--r-lg); height: 100%; background: var(--surface); border: 1px solid var(--border); }
.portrait-card a:hover { border-color: var(--green-800); }
.portrait-card-name { font-weight: 700; color: var(--green-900); margin-top: var(--s-2); overflow-wrap: anywhere; }
.portrait-card-meta { color: var(--text-2); font-size: var(--fs-sm); }
.pagination { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-6); }
.pagination a { min-width: var(--tap); min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-2); border-radius: var(--r-sm); text-decoration: none; background: var(--surface); font-weight: 600; }
.pagination a[aria-current="page"] { background: var(--green-800); color: #fff; border-color: var(--green-800); }

/* ==========================================================================
   Profile
   ========================================================================== */
.profile-head { display: flex; gap: var(--s-5); align-items: flex-start; padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.profile-title { min-width: 0; flex: 1; }
.profile-name { font-family: var(--font-serif); font-weight: 600; font-size: var(--fs-3xl); line-height: 1.12; margin: 0 0 var(--s-2); overflow-wrap: anywhere; letter-spacing: -0.015em; }
.profile-nickname { color: var(--text-2); margin: 0 0 var(--s-2); }
.profile-context { color: var(--text); margin: 0 0 var(--s-3); }
.profile-status { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); align-items: center; }
.profile-actions .menu > summary { border-radius: var(--r-sm); padding: 0 var(--s-4); min-height: var(--tap); }
.profile-actions .menu-panel { left: 0; right: auto; }
.profile-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--s-5); margin-top: var(--s-5); align-items: start; }
.profile-body > section, .profile-story { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); }
.profile-story { margin-top: var(--s-5); }
.profile-body h2, .profile-story h2 { font-size: var(--fs-lg); margin-bottom: var(--s-4); }
.kin-title { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin: var(--s-5) 0 var(--s-2); font-weight: 700; }
.kin-title:first-child, h2 + .kin-title, .section-title + .kin-title { margin-top: 0; }
.kin-list { list-style: none; margin: 0 0 var(--s-2); padding: 0; }
.kin-list li { padding: var(--s-2) 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 0 var(--s-3); align-items: baseline; }
.kin-list li:last-child { border-bottom: 0; }
.kin-list a { font-weight: 600; }
.kin-inline { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); }
.kin-inline li { border: 0; }
.kin-group { margin: var(--s-3) 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.source-notes { font-size: var(--fs-sm); color: var(--text-2); }
.profile-add { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin-top: var(--s-5); padding: var(--s-4) var(--s-5); background: var(--green-50); border: 1px solid var(--green-200); border-radius: var(--r-lg); }
.profile-add p { margin: 0; }
.profile-add .button-row { margin: 0; }
.confirm-panel { padding: var(--s-5); margin-bottom: var(--s-5); background: var(--success-soft); border: 1px solid #B7D3BF; border-radius: var(--r-lg); }
.confirm-panel h2 { font-size: var(--fs-lg); margin-bottom: var(--s-1); }
.confirm-panel p { margin-bottom: var(--s-3); }
.confirm-panel .button-row { margin: 0; }
@media (max-width: 719px) {
  .profile-head { flex-direction: column; gap: var(--s-4); padding: var(--s-4); }
  .profile-body > section, .profile-story, .profile-add, .confirm-panel { padding: var(--s-4); }
  .profile-body { grid-template-columns: 1fr; }
  .profile-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-actions > .button, .profile-actions > .menu, .profile-actions > .menu > summary { width: 100%; justify-content: center; }
}

/* ==========================================================================
   Add or Update (contributions)
   ========================================================================== */
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); max-width: 900px; }
.task { display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); min-width: 0; }
.task:hover { border-color: var(--green-800); box-shadow: var(--shadow-md); color: var(--text); text-decoration: none; }
.task h2 { font-size: var(--fs-lg); margin: 0 0 var(--s-1); }
.task p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.task .start-icon { flex: none; }
.task-quiet { background: transparent; box-shadow: none; }
@media (max-width: 719px) { .task-grid { grid-template-columns: 1fr; } }
.task-person { max-width: 900px; margin-bottom: var(--s-5); }
.fieldset .date-fieldset { border: 0; padding: 0; background: none; }
.fieldset .date-fieldset legend { font-size: var(--fs-sm); }
.profile-edit-hint { margin: var(--s-2) 0 0; }
.task-foot { margin-top: var(--s-5); color: var(--text-2); font-size: var(--fs-sm); }

.flow { max-width: 760px; }
.flow > .person-chip { margin-bottom: var(--s-5); }
.flow-head { margin-bottom: var(--s-5); }
.flow-head h1 { margin-bottom: var(--s-2); }
.stepper { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: flex; gap: var(--s-2); counter-reset: st; }
.stepper li { counter-increment: st; flex: 1; display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.stepper li::before { content: ""; height: 4px; border-radius: 4px; background: var(--border); }
.stepper li[aria-current="step"] { color: var(--green-900); }
.stepper li[aria-current="step"]::before, .stepper li.is-done::before { background: var(--green-800); }
.stepper-label::before { content: counter(st) ". "; }
.relation-summary { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-4) var(--s-5); background: var(--green-50); border: 1px solid var(--green-200); border-radius: var(--r-md); color: var(--green-900); font-weight: 600; }
.relation-summary::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green-800); flex: none; }
.relation-summary .link-button { margin-left: auto; font-weight: 600; font-size: var(--fs-sm); flex: none; }
.review-list { margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.review-list > div { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); gap: var(--s-4); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); }
.review-list > div:first-child { border-top: 0; }
.review-list dt { color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }
.review-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 479px) { .review-list > div { grid-template-columns: 1fr; gap: 0; } }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; padding-top: var(--s-2); }
.form-actions .button-primary { min-width: 160px; }
.form-actions .link-button { margin-left: auto; }
.guide { margin-bottom: var(--s-5); display: flex; gap: var(--s-4); padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.guide ol { margin: 0; padding-left: 1.2rem; color: var(--text-2); }
.guide li { margin: var(--s-1) 0; }
.save-note { font-size: var(--fs-sm); color: var(--text-2); margin: 0; }

.segmented { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.segmented a { min-height: 40px; padding: 0 var(--s-4); display: inline-flex; align-items: center; border: 1px solid var(--border-2); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: var(--fs-sm); background: var(--surface); color: var(--text); }
.segmented a[aria-current="page"] { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.contrib-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); max-width: 900px; }
.contrib-row { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); flex-wrap: wrap; }
.contrib-row:first-child { border-top: 0; }
.contrib-row p { margin: 0; }
.contrib-kind { font-weight: 700; }
.contrib-status { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2); }
.review-note { background: var(--surface-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); margin-top: var(--s-2) !important; }

.error-page { padding: var(--s-7) 0; }

/* ==========================================================================
   Family tree workspace
   ========================================================================== */
.tree-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-5); margin-bottom: var(--s-4); }
.tree-head h1 { margin-bottom: var(--s-1); }
.tree-head .lede { margin: 0; }
.tree-toolbar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.tree-search { flex: 1 1 260px; display: flex; flex-direction: column; gap: var(--s-2); }
.tree-field { display: flex; flex-direction: column; gap: var(--s-2); flex: 0 1 240px; }
.tree-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: flex-end; }
.tool { min-height: 48px; min-width: 48px; padding: 0 var(--s-4); display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); background: var(--surface); color: var(--text); border: 1.5px solid var(--border-2); border-radius: var(--r-sm); font: inherit; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; text-decoration: none; white-space: nowrap; }
.tool:hover { border-color: var(--green-800); color: var(--green-800); text-decoration: none; }
.tool-primary { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.tool-primary:hover { background: var(--green-700); color: #fff; }
.tree-more { position: relative; }
.tree-more > summary { list-style: none; }
.tree-more > summary.tool { border-radius: var(--r-sm); padding: 0 var(--s-4); min-height: 48px; border: 1.5px solid var(--border-2); }
.tree-more > summary::-webkit-details-marker { display: none; }
.tree-more .menu-panel { width: 280px; }
.tree-more .menu-panel .field { padding: var(--s-2) var(--s-3); }
.view-list .tree-only { display: none !important; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: var(--s-1); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-md); box-shadow: var(--shadow-lg); max-height: 360px; overflow: auto; }

.canvas-hint { position: absolute; top: var(--s-3); left: var(--s-3); right: var(--s-3); margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-5); font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); z-index: 6; pointer-events: none; }
.canvas-hint > span { padding: var(--s-1) var(--s-3); background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border); border-radius: 999px; }
.canvas-legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin: 0; padding: var(--s-1) var(--s-3); list-style: none; background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border); border-radius: 999px; }
.canvas-legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.panel-open .canvas-legend { display: none; }
.legend-swatch { width: 18px; height: 12px; border: 1px solid var(--border-2); border-left: 4px solid var(--green-800); background: var(--surface); border-radius: 2px; }
.legend-partner { border-left-color: var(--gold); }
.tree-stage { position: relative; border: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); background: var(--surface); overflow: hidden; }
.tree-canvas { position: relative; height: clamp(480px, 68vh, 860px); overflow: hidden; cursor: grab; touch-action: none; user-select: none;
  background-color: #FCFBF8;
  background-image: radial-gradient(rgba(84, 91, 82, 0.13) 1px, transparent 1.2px);
  background-size: 24px 24px; }
.tree-canvas.is-panning { 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; }
.tree-nodes { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.tree-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); margin: 0; }
.ln-union { stroke: var(--gold); stroke-width: 2.5; fill: none; }
.ln-descent { stroke: #8C9387; stroke-width: 1.75; fill: none; stroke-linejoin: round; }
.ln-dashed { stroke-dasharray: 6 5; }
.ln-dot { fill: var(--surface); stroke: var(--gold); stroke-width: 2.5; }
.zoom-controls { position: absolute; left: var(--s-3); bottom: var(--s-3); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-md); box-shadow: var(--shadow-md); z-index: 10; overflow: hidden; }
.zoom-controls button { width: 44px; height: 44px; border: 0; background: var(--surface); color: var(--green-900); font: inherit; font-size: 1.35rem; font-weight: 600; cursor: pointer; }
.zoom-controls button + button { border-top: 1px solid var(--border); }
.zoom-controls button:hover { background: var(--green-50); }
.edge-hint { position: absolute; top: 0; bottom: 0; width: 56px; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .2s; }
.edge-hint.is-on { opacity: 1; }
.edge-hint-r { right: 0; background: linear-gradient(90deg, rgba(252, 251, 248, 0), rgba(252, 251, 248, 0.95)); }
.edge-hint-b { left: 0; right: 0; top: auto; width: auto; height: 40px; background: linear-gradient(180deg, rgba(252, 251, 248, 0), rgba(252, 251, 248, 0.95)); }

.tn { position: absolute; }
.tn-card { width: 100%; height: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 10px; text-align: left; background: var(--surface); border: 1px solid var(--border-2); border-left: 4px solid var(--green-800); border-radius: var(--r-sm); font: inherit; color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm); }
.tn-card:hover { border-color: var(--green-800); box-shadow: var(--shadow-md); }
.tn-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.tn-card.is-selected { box-shadow: 0 0 0 3px var(--gold), var(--shadow-md); }
.tn-inlaw .tn-card { border-left-color: var(--gold); }
.tn-founder .tn-card { border-left-color: var(--green-900); background: var(--green-50); }
.tn-ref .tn-card { border-style: dashed; border-left-width: 1px; background: transparent; box-shadow: none; }
.tn-private .tn-card { background: var(--surface-2); }
.tn-portrait { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--green-100); color: var(--green-800); font-weight: 700; font-size: 0.8125rem; }
.tn-portrait img { width: 100%; height: 100%; object-fit: cover; }
.tn-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.tn-name { font-weight: 700; font-size: 0.9375rem; color: var(--green-900); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tn-span, .tn-note { font-size: 0.8125rem; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-note-with { color: var(--gold-text); font-weight: 600; }
.tn-toggle { position: absolute; top: 50%; right: -18px; transform: translateY(-50%); min-width: 36px; height: 30px; padding: 0 8px; border-radius: 999px; border: 1.5px solid var(--green-800); background: var(--surface); color: var(--green-800); font: inherit; font-weight: 700; font-size: 0.8125rem; cursor: pointer; z-index: 2; }
.tn-toggle-wrap { width: 0; height: 0; z-index: 3; }
.tn-toggle-wrap .tn-toggle { top: 0; left: 0; right: auto; transform: translate(-50%, -50%); }
.tn-toggle:hover { background: var(--green-800); color: #fff; }
.tn-toggle[aria-expanded="false"] { background: var(--green-800); color: #fff; }

.tree-panel { position: absolute; top: var(--s-3); right: var(--s-3); bottom: var(--s-3); width: min(360px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: auto; padding: var(--s-5); z-index: 20; }
.panel-close { position: absolute; top: var(--s-2); right: var(--s-2); width: var(--tap); height: var(--tap); border: 0; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--text-2); cursor: pointer; border-radius: var(--r-sm); }
.panel-close:hover { background: var(--green-50); color: var(--green-800); }
.panel-head { display: flex; gap: var(--s-3); align-items: flex-start; padding-right: var(--s-6); margin-bottom: var(--s-4); }
.panel-name { font-size: var(--fs-lg); margin-bottom: var(--s-1); overflow-wrap: anywhere; }
.panel-name:focus { outline: none; }
.panel-name:focus-visible { outline: 3px solid var(--focus); }
.panel-nick { color: var(--text-2); margin: 0; font-size: var(--fs-sm); }
.panel-meta { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }
.panel-awaiting { background: var(--warning-soft); border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); }
.panel-section { border-top: 1px solid var(--border); padding-top: var(--s-3); margin-top: var(--s-3); }
.panel-subtitle { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: var(--s-1); }
.panel-list { list-style: none; margin: 0; padding: 0; }
.panel-list li { min-height: 36px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s-1); }
.panel-list .link-button { font-weight: 600; min-height: 36px; }
.panel-section .unknown { margin: 0; font-size: var(--fs-sm); }
.panel-actions { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-5); }
.panel-actions .button { width: 100%; }
.tree-help { font-size: var(--fs-sm); color: var(--text-2); margin: var(--s-3) 0 0; }
.tree-help summary { cursor: pointer; font-weight: 600; color: var(--green-800); min-height: var(--tap); display: inline-flex; align-items: center; }
@media (max-width: 719px) {
  .tree-toolbar { padding: var(--s-3); }
  .tree-list { padding: var(--s-4) var(--s-3); }
  .tree-field { flex: 1 1 100%; }
  .tree-actions { width: 100%; }
  .tree-actions > * { flex: 1 1 auto; }
  .tree-canvas { height: 70vh; }
  .canvas-legend { display: none; }
  .tree-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 75vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

/* Accessible list alternative.
   Every row uses the same three columns: 28px marker · name · count. Child lists are indented so that
   their markers sit exactly under the parent's name, and the guide line runs through the parent's marker. */
.tree-list { padding: var(--s-5) var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tree-list > h2 { font-size: var(--fs-lg); margin-bottom: var(--s-1); }
.tree-list > .hint { margin-bottom: var(--s-3); }
.lineage-list, .ln-children { list-style: none; margin: 0; padding: 0; }
.ln-children { margin-left: 13px; padding-left: 25px; border-left: 2px solid var(--border); }
.ln-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: var(--s-3); align-items: center; min-height: 52px; padding: var(--s-2) 0; border-bottom: 1px solid var(--border); list-style: none; }
.ln-sum { display: block; cursor: pointer; list-style: none; }
.ln-sum::-webkit-details-marker { display: none; }
.ln-sum:hover .ln-name { text-decoration: underline; }
.ln-sum:focus-visible { outline: none; }
.ln-sum:focus-visible .ln-row { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ln-mark { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--green-800); border-radius: 50%; color: var(--green-800); font-weight: 700; line-height: 1; }
.ln-mark::before { content: "+"; }
details[open] > summary .ln-mark { background: var(--green-800); color: #fff; }
details[open] > summary .ln-mark::before { content: "−"; }
.ln-mark-leaf, .ln-mark-ref { border: 0; background: none !important; }
.ln-mark-leaf::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); }
.ln-mark-ref::before { content: "↗"; color: var(--text-2); font-weight: 600; }
.ln-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s-3); min-width: 0; }
.ln-name { font-weight: 700; font-size: var(--fs-md); color: var(--green-900); overflow-wrap: anywhere; }
a.ln-name { color: var(--green-900); text-decoration: none; }
a.ln-name:hover { text-decoration: underline; }
.ln-meta { color: var(--text-2); font-size: var(--fs-sm); }
.ln-count { color: var(--text-2); font-size: var(--fs-sm); text-align: right; white-space: nowrap; }
.ln-body { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s-5); padding: 0 0 var(--s-2) 40px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.ln-sum > .ln-row { border-bottom: 0; }
.ln-row:has(+ .ln-body) { border-bottom: 0; }
.ln-partners, .ln-links a { display: inline-flex; align-items: center; min-height: 36px; }
.ln-partners { flex-wrap: wrap; gap: 0 0.3em; color: var(--text-2); }
.ln-links { display: inline-flex; flex-wrap: wrap; gap: 0 var(--s-4); }
.ln-links a { font-weight: 600; }
@media (max-width: 559px) {
  .ln-row { grid-template-columns: 28px minmax(0, 1fr); }
  .ln-count { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
