:root {
  color-scheme: light;
  --canvas: #f5f7f3;
  --surface: #fff;
  --surface-soft: #f8faf7;
  --ink: #192a22;
  --forest: #184432;
  --forest-deep: #123727;
  --muted: #57665e;
  --quiet: #66756d;
  --line: #e3e9e2;
  --line-strong: #d4dfd5;
  --sage: #eaf3ea;
  --sage-ink: #305d43;
  --gold: #f5edda;
  --gold-ink: #765620;
  --blue: #e9eff1;
  --blue-ink: #3b5f6c;
  --rose: #f5e9e7;
  --rose-ink: #884f49;
  --radius: 15px;
  --shadow: 0 2px 6px #18382706;
  --body-font: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display-font: 'Lora', Georgia, 'Times New Roman', serif;
  --sidebar-width: 235px;
  --node-width: 156px;
  --node-height: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-padding-top: 84px; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 400 1rem/1.5 var(--body-font); }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
button, a, input, textarea, select { outline-offset: 3px; }
:focus-visible { outline: 2px solid #357c51; }
h1, h2, h3, p { margin: 0; }
svg { vertical-align: middle; }
.icon { display: inline-block; flex: 0 0 auto; width: 1.2rem; height: 1.2rem; }
.sr-only, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 30; padding: 10px 14px; border-radius: 8px; color: white; background: var(--forest); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; inset-block-start: 0; display: flex; flex-direction: column; gap: 0; height: 100dvh; min-height: 0; padding: 24px 15px 18px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; margin: 0 7px 30px; padding: 0; border: 0; text-align: left; text-decoration: none; background: transparent; }
.brand-mark { display: grid; flex: 0 0 41px; width: 41px; height: 41px; place-items: center; border: 1px solid #265441; border-radius: 11px; color: #f1dda1; background: var(--forest); }
.brand-mark .icon { width: 24px; height: 24px; }
.brand-copy { display: grid; min-width: 0; gap: 1px; line-height: 1.2; }
.brand-copy strong, .brand-copy b { color: var(--forest-deep); font: 700 1.44rem/1.12 var(--display-font); letter-spacing: -.045em; }
.brand-copy small, .brand-copy > span { color: var(--muted); font-size: .75rem; letter-spacing: .01em; }
.workspace-switch { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; min-height: 60px; margin-bottom: 26px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 11px; color: var(--forest-deep); text-align: left; text-decoration: none; background: var(--surface-soft); }
.workspace-switch:hover { border-color: var(--line-strong); background: var(--sage); }
.workspace-switch > :last-child { margin-left: auto; color: var(--quiet); }
.workspace-switch > :last-child .icon { width: 15px; height: 15px; }
.workspace-icon { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 8px; color: var(--sage-ink); background: #e3eee2; }
.workspace-icon .icon { width: 18px; height: 18px; }
.workspace-text { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; line-height: 1.28; }
.workspace-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-text strong, .workspace-text b { font-size: .8125rem; font-weight: 730; }
.workspace-text small { color: var(--muted); font-size: .75rem; }
.nav-label { margin: 0 10px 8px; color: var(--quiet); font-size: .75rem; font-weight: 740; letter-spacing: .07em; text-transform: uppercase; }
.nav-list { display: grid; gap: 3px; margin: 0 0 23px; padding: 0; list-style: none; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid transparent; border-radius: 8px; color: #46574d; text-align: left; text-decoration: none; background: transparent; font-size: .875rem; font-weight: 580; }
.nav-item:hover { color: var(--forest); background: var(--surface-soft); }
.nav-item[aria-current='page'], .nav-item.active { border-color: #deebde; color: var(--forest); background: var(--sage); font-weight: 760; }
.nav-item .icon { width: 18px; height: 18px; }
.sidebar-footer { margin-top: auto; }
.privacy-note { display: flex; align-items: flex-start; gap: 9px; padding: 11px; border: 1px solid #e8eee5; border-radius: 10px; color: var(--muted); background: #f5f8f3; font-size: .75rem; line-height: 1.4; }
.privacy-note strong { display: block; margin-bottom: 2px; color: var(--forest); font-size: .8125rem; }
.privacy-note .privacy-icon { display: grid; flex: 0 0 16px; place-items: center; }
.privacy-note .privacy-icon .icon { width: 16px; height: 16px; color: var(--sage-ink); }
.sidebar-scrim, .mobile-menu { display: none; }

.main-shell { min-width: 0; }
.topbar { position: sticky; z-index: 6; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 68px; padding: 0 31px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-leading, .topbar-actions { display: flex; align-items: center; gap: 15px; min-width: 0; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: .875rem; }
.breadcrumbs > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs strong, .breadcrumbs [aria-current], #breadcrumb-current { color: var(--ink); font-weight: 700; }
.breadcrumbs .icon { width: 13px; height: 13px; color: var(--quiet); }
.search-trigger { display: flex; align-items: center; gap: 9px; min-height: 37px; min-width: 204px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); text-align: left; background: var(--surface-soft); font-size: .8125rem; }
.search-trigger:hover { border-color: var(--line-strong); color: var(--forest-deep); background: var(--sage); }
.search-trigger .icon { width: 16px; height: 16px; }
.search-hint { margin-left: auto; padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--quiet); background: white; font: 500 .75rem/1.3 var(--body-font); }
.header-avatar { display: grid; flex: 0 0 auto; width: 36px; height: 36px; place-items: center; padding: 0; border: 1px solid #dceadd; border-radius: 50%; color: var(--forest); background: #e7f0e5; font-size: .75rem; font-weight: 760; }
button.header-avatar:hover { background: #dcebdc; }
.header-avatar .icon { width: 18px; height: 18px; }
.reminder-button { position: relative; color: var(--forest-deep); background: var(--surface-soft); }
.reminder-button > span:first-child { display: grid; place-items: center; }
#reminder-count { position: absolute; top: -4px; right: -4px; display: grid; min-width: 16px; height: 16px; place-items: center; padding: 0 3px; border: 1px solid #fff; border-radius: 9px; color: white; background: var(--forest); font-size: .65rem; }
.content { width: 100%; max-width: 1660px; min-height: calc(100dvh - 68px); margin-inline: auto; padding: 27px 31px 36px; }
#view { min-width: 0; }

.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 252px; overflow: hidden; border: 1px solid #1d4c36; border-radius: 18px; color: #fff; background: #1d4835; }
.hero::before { position: absolute; z-index: -2; inset: 0; background: url('assets/retreat.webp') center 54% / cover no-repeat; content: ''; }
.hero::after { position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #173e2efc 3%, #183f2fea 31%, #17402c84 56%, #142f2330 86%), linear-gradient(0deg, #1a3b2c65, transparent 37%); content: ''; }
.hero-content { width: min(700px, 100%); padding: 26px 34px 27px; }
.hero-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; color: #efdca4; font-size: .75rem; font-weight: 760; letter-spacing: .095em; text-transform: uppercase; }
.hero-eyebrow .icon { width: 15px; height: 15px; }
.hero-eyebrow > span:empty { display: inline-block; width: 19px; height: 1px; background: currentColor; }
.hero h1 { position: relative; width: fit-content; color: #fffef6; font: 700 clamp(2rem, 3.55vw, 3.18rem)/1.13 var(--display-font); letter-spacing: -.034em; text-wrap: balance; }
.hero p { max-width: 450px; margin-top: 9px; color: #edf3e9; font-size: .9375rem; line-height: 1.55; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; color: #f0f2df; font-size: .9375rem; }
.hero-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { width: 15px; height: 15px; }
.hero-leader .member-link { color: #fff9db; text-decoration: underline; text-underline-offset: 2px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-caption { position: absolute; right: 16px; bottom: 15px; display: inline-flex; align-items: center; gap: 6px; max-width: 36%; padding: 4px 8px; border: 1px solid #ffffff43; border-radius: 5px; color: white; background: #132d20a8; font-size: .75rem; text-align: right; }
.hero-caption .icon { width: 14px; height: 14px; }

.button, .icon-button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; color: var(--forest); text-align: center; text-decoration: none; background: var(--surface); font-size: .875rem; font-weight: 720; line-height: 1.28; }
.button .icon, .icon-button .icon { width: 17px; height: 17px; }
.button.primary { border-color: var(--forest); color: #fff; background: var(--forest); }
.button.primary:hover { border-color: #245f47; background: #245f47; }
.button.secondary { border-color: var(--line-strong); color: var(--forest); background: var(--surface); }
.button.secondary:hover, .button.ghost:hover, .icon-button:hover { border-color: #c9dacb; color: var(--forest-deep); background: var(--sage); }
.button.ghost { color: var(--forest); background: transparent; }
.button.light { border-color: #f9f6e9; color: var(--forest-deep); background: #fbf7eb; }
.button.light:hover { border-color: #efdfa9; background: #efdfa9; }
.hero .button.ghost, .hero .button.secondary, .hero .button.hero-outline { border-color: #ffffff5e; color: #fff; background: #ffffff14; }
.hero .button.ghost:hover, .hero .button.secondary:hover, .hero .button.hero-outline:hover { border-color: #fff9; background: #ffffff26; }
.hero :focus-visible { outline-color: #ffe8a6; }
.button.small { min-height: 35px; padding: 6px 10px; }
.button.danger { border-color: #f1d4d0; color: #8c362e; background: #fff6f4; }
.button.danger:hover { border-color: #e5b2a8; background: #f9dfda; }
.icon-button { flex: 0 0 39px; width: 39px; min-height: 39px; padding: 0; border-color: var(--line); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-block: 17px 19px; }
.metric { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 88px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius); text-align: left; text-decoration: none; background: var(--surface); box-shadow: var(--shadow); }
:is(button, a).metric:hover { border-color: #bdcfbf; background: #fcfefb; }
.metric-icon, .quick-icon, .avatar, .node-avatar { display: grid; flex: 0 0 41px; width: 41px; height: 41px; place-items: center; border-radius: 10px; color: var(--sage-ink); background: var(--sage); }
.metric-icon .icon { width: 21px; height: 21px; }
:is(.metric, .quick-action):nth-child(2) :is(.metric-icon, .quick-icon), [data-tone='gold'] :is(.metric-icon, .quick-icon), :is(.metric-icon, .quick-icon, .avatar, .node-avatar)[data-tone='gold'] { color: var(--gold-ink); background: var(--gold); }
:is(.metric, .quick-action):nth-child(3) :is(.metric-icon, .quick-icon), [data-tone='blue'] :is(.metric-icon, .quick-icon), :is(.metric-icon, .quick-icon, .avatar, .node-avatar)[data-tone='blue'] { color: var(--blue-ink); background: var(--blue); }
.metric:nth-child(4) .metric-icon, [data-tone='rose'] :is(.metric-icon, .quick-icon), :is(.metric-icon, .quick-icon, .avatar, .node-avatar)[data-tone='rose'] { color: var(--rose-ink); background: var(--rose); }
.metric-copy { display: grid; min-width: 0; gap: 1px; }
.metric-value { color: var(--forest-deep); font: 700 1.62rem/1.07 var(--display-font); letter-spacing: -.035em; }
.metric-label { color: var(--muted); font-size: .875rem; line-height: 1.28; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(280px, 1fr); align-items: start; gap: 17px; }
.overview-rail { display: grid; gap: 17px; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; padding: 17px 17px 14px; }
.panel-heading > * { min-width: 0; }
.panel-title { color: var(--forest-deep); font: 700 1.42rem/1.22 var(--display-font); letter-spacing: -.026em; }
.panel-subtitle { margin-top: 4px; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.tree-panel { position: relative; }
.tree-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 13px; padding: 0 17px 11px; }
.segmented { display: inline-flex; max-width: 100%; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.segmented :is(a, button) { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 8px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); text-decoration: none; background: transparent; font-size: .875rem; font-weight: 650; }
.segmented :is(a, button):hover { color: var(--forest); }
.segmented :is(a, button):is([aria-pressed='true'], [aria-selected='true'], .active) { border-color: var(--line); color: var(--forest-deep); background: white; box-shadow: 0 1px 2px #133c2810; }
.tree-filter select { appearance: none; min-height: 36px; max-width: 100%; padding: 5px 28px 5px 9px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--forest-deep); background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23435d4d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 7px center / 16px no-repeat; font-size: .875rem; }
.segmented .icon { width: 15px; height: 15px; }
.tree-view-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 420px); margin-bottom: 12px; }
.tree-view-switch .button { justify-content: center; min-height: 44px; text-align: center; white-space: normal; }
.tree-view-switch .button[aria-pressed='true'] { border-color: var(--forest); color: white; background: var(--forest); }
.tree-browse { display: grid; gap: 12px; padding: 14px; }
.tree-browse-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tree-browse-filters .field :is(input, select) { min-height: 44px; }
.tree-browse-search { grid-column: 1 / -1; }
.tree-browse-count, .mobile-family-empty { color: var(--muted); font-size: .875rem; }
.tree-browse-generation + .tree-browse-generation { margin-top: 16px; }
.tree-browse-generation h2 { margin-bottom: 6px; color: var(--forest-deep); font: 700 1.125rem/1.25 var(--display-font); }
.tree-browse-generation ul, .mobile-family-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tree-browse-person, .mobile-family-person {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-inline-start: 4px solid var(--chi-stroke, var(--mobile-family-branch));
  border-radius: 9px;
  text-align: left;
  background: var(--surface);
}
:is(.tree-browse-person, .mobile-family-person):hover { background: var(--surface-soft); }
.tree-browse-person > span:nth-child(2), .mobile-family-copy { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
:is(.tree-browse-person, .mobile-family-copy) :is(strong, small) { display: block; }
:is(.tree-browse-person, .mobile-family-copy) small { margin-top: 2px; color: var(--muted); font-size: .8125rem; }
.tree-browse-person > .icon { flex: 0 0 16px; color: var(--forest); }
.tree-browse-more { display: flex; justify-content: center; margin-top: 12px; }
.tree-browse-family-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tree-browse-family-actions .button { flex: 1 1 auto; min-height: 44px; }
.mobile-family { display: grid; gap: 10px; }
.mobile-family-focus, .mobile-family-section { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.mobile-family-focus { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; border-inline-start: 4px solid var(--mobile-family-branch); background: var(--sage); }
.mobile-family-focus .mobile-family-copy { flex-basis: 142px; }
.mobile-family-focus h2 { color: var(--forest-deep); font: 700 1.25rem/1.25 var(--display-font); }
.mobile-family-profile { min-height: 44px; }
.mobile-family-avatar { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 8px; font-size: .8125rem; font-weight: 700; }
:is(.tree-browse-person > .avatar, .mobile-family-avatar) { color: var(--life-ink); background: var(--life-avatar); }
.mobile-family-heading { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; color: var(--forest-deep); font-size: 1rem; }
.mobile-family-heading .icon { width: 17px; height: 17px; }
.mobile-family-role, .mobile-family-group-title { color: var(--forest); font-size: .8125rem; font-weight: 700; }
.mobile-family-group + .mobile-family-group { margin-top: 10px; }
.mobile-family-group-title { margin: 0 0 5px; overflow-wrap: anywhere; }
.tree-key { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; color: var(--muted); font-size: .75rem; }
.tree-key > span { display: inline-flex; align-items: center; gap: 5px; }
.tree-key i { display: inline-block; width: 13px; border-top: 2px solid #749d80; }
.tree-key :is(i.dashed, i.spouse, .line-dash) { width: 13px; border-top: 2px dashed #9e864e; }
.tree-viewport { position: relative; min-width: 0; min-height: 318px; max-height: 540px; overflow: auto; overscroll-behavior: contain; border-block: 1px solid var(--line); color: var(--forest); background-color: #f7faf5; background-image: radial-gradient(#b7c9b978 1px, transparent 1px); background-size: 17px 17px; scrollbar-color: #bbcbbe #edf2eb; scrollbar-width: thin; }
.overview-grid .tree-viewport { min-height: 270px; max-height: 340px; }
.tree-viewport.dragging { cursor: grabbing; user-select: none; }
.tree-space { position: relative; min-width: 100%; min-height: 100%; overflow: hidden; }
.tree-world { position: relative; transform-origin: top left; }
.tree-lines { position: absolute; inset: 0; display: block; pointer-events: none; overflow: visible; }
.tree-lines path, .tree-lines line, .tree-lines polyline { fill: none; stroke: #88a88d; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tree-lines :is(.spouse, .partner, .marriage) { stroke: #9b8049; stroke-dasharray: 4 3; }
.tree-lines :is(.tree-family-line, .tree-marriage-line) { stroke: var(--chi-stroke); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tree-lines .tree-base-casing { stroke: #f7faf5; stroke-width: 4.8; vector-effect: non-scaling-stroke; }
.tree-lines .tree-marriage-line { stroke-dasharray: 5 4; stroke-width: 2.4; }
.tree-family-junction { fill: var(--chi-stroke); stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.tree-connection-key, .tree-branch-key { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 13px; }
.tree-connection-key { padding: 0 17px 8px; }
.tree-connection-key .tree-key, .tree-branch-key { font-size: .8125rem; }
.tree-connection-key .tree-key i { border-color: #596b80; }
.tree-key .tree-key-dot { width: 7px; height: 7px; border: 0; border-radius: 50%; background: #596b80; }
.tree-branch-key { color: var(--ink); }
.tree-branch-key span { display: inline-flex; align-items: center; gap: 5px; }
.tree-branch-key i { width: 17px; border-top: 3px solid var(--chi-stroke); border-radius: 2px; }
.tree-with-route > .tree-connection-key { padding-top: 2px; }
.tree-node, .life-swatch, .tree-browse-person, .mobile-family-avatar { --life-background: #e7f2e9; --life-border: #a4c0aa; --life-accent: #447658; --life-avatar: #d3e8d7; --life-ink: #214a32; }
:is(.tree-node, .life-swatch, .tree-browse-person, .mobile-family-avatar)[data-life='deceased'] { --life-background: #f5e6de; --life-border: #d2ad98; --life-accent: #a06043; --life-avatar: #ecd3c5; --life-ink: #634030; }
:is(.tree-node, .life-swatch, .tree-browse-person, .mobile-family-avatar)[data-life='unknown'] { --life-background: #eef1f4; --life-border: #abb7c3; --life-accent: #697a8c; --life-avatar: #dce4ec; --life-ink: #304454; }
.tree-node { position: absolute; display: flex; align-items: center; gap: 6px; width: var(--node-width); height: var(--node-height); padding: 6px 7px; border: 1px solid var(--life-border); border-inline-start: 3px solid var(--life-accent); border-radius: 9px; color: var(--life-ink); text-align: left; background: var(--life-background); box-shadow: 0 2px 4px #13362410; }
.tree-node::after { position: absolute; right: 7px; bottom: 5px; width: 15px; height: 2px; border-radius: 2px; background: var(--chi-stroke); content: ''; }
.tree-node:hover, .tree-node:focus-visible { z-index: 2; border-color: var(--life-accent); }
.tree-node[aria-pressed='true'], .tree-node.selected { z-index: 1; outline: 2px solid #588369; outline-offset: 2px; }
.node-avatar { flex-basis: 31px; width: 31px; height: 31px; border-radius: 50%; font-size: .6875rem; font-weight: 780; }
.tree-node .node-avatar { color: var(--life-ink); background: var(--life-avatar); }
.node-copy { display: grid; min-width: 0; gap: 3px; outline: 0; }
.node-name { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .875rem; font-weight: 740; line-height: 1.14; }
.node-date { color: var(--muted); font-size: .75rem; line-height: 1.14; }
.life-marker { margin-inline-end: 4px; color: var(--life-ink); font-weight: 750; }
.tree-life-key { display: flex; flex-wrap: wrap; gap: 6px 15px; padding: 0 17px 10px; color: var(--muted); font-size: .875rem; }
.tree-life-key > span { display: inline-flex; align-items: center; gap: 6px; }
.life-swatch { display: grid; width: 15px; height: 15px; place-content: center; border: 1px solid var(--life-border); border-inline-start: 3px solid var(--life-accent); border-radius: 3px; color: var(--life-ink); background: var(--life-background); font-style: normal; font-weight: 700; line-height: 1; }
.tree-person-icon { position: relative; display: block; flex: 0 0 31px; }
.tree-gender { display: inline-grid; flex: 0 0 16px; width: 16px; height: 16px; place-items: center; border-radius: 50%; color: #3c4846; background: #e7ece9; }
.tree-gender[data-gender='male'] { color: #214d74; background: #d9eafb; }
.tree-gender[data-gender='female'] { color: #713858; background: #f5deeb; }
.tree-gender .icon { width: 12px; height: 12px; stroke-width: 2; }
.tree-person-icon > .tree-gender { position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border: 1px solid var(--life-background); }
.tree-with-route { --route-blue: #1d4ed8; --route-ink: #19398a; --route-border: #93b5fb; --route-gold: #9a5400; border-color: var(--route-border); }
.tree-with-route .tree-viewport { border-color: #c3d6fb; background-color: #f4f8ff; background-image: radial-gradient(#8da9d574 1px, transparent 1px); }
.tree-route-indicator { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 6px; color: #fff; background: var(--route-blue); font-size: .875rem; font-weight: 740; white-space: nowrap; }
.tree-route-indicator .icon { width: 15px; height: 15px; }
.tree-with-route .segmented button[aria-pressed='true'] { border-color: #acc7ff; color: var(--route-ink); background: #e3edff; }
.tree-route-legend { color: var(--route-ink); font-weight: 740; }
.tree-route-swatch { width: 19px; border-top: 4px solid var(--route-blue); }
.tree-route-swatch.is-alternate { border-top: 3px dashed var(--route-gold); }
.tree-with-route .tree-base-lines { opacity: .18; }
.tree-with-route .tree-route-casing { stroke: #fff; stroke-width: 8; vector-effect: non-scaling-stroke; }
.tree-with-route .tree-route-line { stroke: var(--route-blue); stroke-width: 4.5; vector-effect: non-scaling-stroke; }
.tree-with-route .tree-route-line[data-edge='partner'] { stroke-dasharray: 7 5; }
.tree-with-route .tree-route-line[data-edge='alternate'] { stroke: var(--route-gold); stroke-width: 3.2; stroke-dasharray: 5 4; }
.tree-with-route .tree-node[data-route-role=''] { opacity: .69; }
.tree-with-route .tree-node[data-route-role='']:is(:hover, :focus-visible) { opacity: 1; }
.tree-node[data-route-role='member'] { border-color: var(--route-blue); }
.tree-node[data-route-role='endpoint'] { border-color: var(--route-blue); box-shadow: 0 0 0 2.5px var(--route-blue), 0 0 0 5px #d5e5ff; }
.tree-node[data-route-role='ancestor'] { border-color: var(--route-gold); box-shadow: 0 0 0 2px var(--route-gold); }
.tree-with-route .tree-node.tree-focused { outline-color: var(--route-ink); outline-offset: 4px; }
.tree-route-tag { position: absolute; top: -10px; right: 5px; padding: 2px 6px; border-radius: 5px; color: white; background: var(--route-blue); font-size: .6875rem; font-weight: 750; line-height: 1.2; }
.tree-node[data-route-role='ancestor'] .tree-route-tag { background: var(--route-gold); }
.tree-route-tag.tree-family-tag { background: var(--chi-stroke); }
.tree-family-view .tree-toolbar { padding-top: 13px; }
.tree-route-summary { display: grid; gap: 12px; padding: 16px 17px 12px; border-bottom: 1px solid #d2e1ff; background: #f2f6ff; }
.tree-with-route .tree-toolbar { padding-top: 9px; }
.tree-route-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 12px; }
.tree-route-header h2 { color: var(--route-ink); font: 700 1.35rem/1.25 var(--display-font); }
.tree-route-header p, .tree-route-facts p { color: var(--muted); font-size: .875rem; }
.tree-route-header p { margin-top: 4px; }
.tree-route-actions, .tree-route-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tree-route-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tree-route-facts > div { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); overflow-wrap: anywhere; }
.tree-route-facts h3 { margin: 0 0 5px; color: var(--forest-deep); font-size: .875rem; }
.tree-route-address { grid-column: 1 / -1; }
.tree-route-address > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; }
.tree-route-address strong { color: var(--forest-deep); }
.tree-jump { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 28px; padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--forest-deep); background: white; font-size: .875rem; font-weight: 680; text-align: left; overflow-wrap: anywhere; }
.tree-jump:hover { background: var(--sage); }
.tree-jump .icon { flex: 0 0 12px; width: 12px; height: 12px; }
.tree-route-only .generation-tag, .tree-family-view .generation-tag { left: 8px; }
.tree-route-only .tree-viewport { min-height: 0; }
@media (max-width: 560px) {
  .tree-route-summary { padding: 12px 10px; }
  .tree-route-facts, .tree-route-address > div { grid-template-columns: minmax(0, 1fr); }
  .tree-connection-key { padding-inline: 10px; }
}
.generation-tag { position: absolute; left: 17px; align-content: center; min-height: 23px; padding: 2px 6px; transform: translateY(-50%); border: 1px solid #dee8dc; border-radius: 5px; color: #47644f; background: #eef4eb; font-size: .75rem; font-weight: 690; white-space: nowrap; }
.tree-controls { position: absolute; z-index: 3; right: 11px; bottom: 11px; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--forest-deep); background: #fffffff5; box-shadow: 0 2px 7px #1637271a; font-size: .75rem; font-weight: 700; }
.tree-viewport > .tree-controls { position: sticky; bottom: 11px; width: max-content; margin-left: auto; margin-right: 11px; }
.tree-controls :is(button, .button, .icon-button) { flex-basis: 29px; width: 29px; min-height: 29px; padding: 0; border: 1px solid transparent; border-radius: 5px; color: var(--forest-deep); background: transparent; }
.tree-controls button:hover { border-color: var(--line); background: var(--sage); }
.tree-controls .icon { width: 16px; height: 16px; }
.tree-controls output, .tree-controls > span { min-width: 38px; text-align: center; }
.tree-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; min-height: 37px; padding: 7px 17px; color: var(--muted); font-size: .75rem; }
.tree-footer .icon { width: 14px; height: 14px; }

.event-list, .quick-list { display: grid; margin: 0; padding: 0 16px; list-style: none; }
.event-row { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 59px; padding: 8px 0; border: 0; border-top: 1px solid #edf0eb; color: var(--ink); text-align: left; text-decoration: none; background: transparent; }
.event-row:first-child { border-top-color: transparent; }
:is(button, a).event-row:hover .event-name { color: #1e693e; text-decoration: underline; text-underline-offset: 3px; }
.event-date { display: grid; flex: 0 0 46px; min-height: 45px; align-content: center; place-items: center; gap: 0; padding: 3px 2px; border-radius: 8px; color: var(--forest); background: var(--sage); text-align: center; font-size: .75rem; line-height: 1.23; }
.event-date strong, .event-date b { font-size: 1.03rem; font-weight: 790; }
.event-date small { font-size: .75rem; }
.event-row[data-kind='memorial'] .event-date, .event-date.memorial, .event-date[data-tone='gold'] { color: var(--gold-ink); background: var(--gold); }
.event-row > .icon:last-child { width: 15px; height: 15px; color: var(--quiet); }
.event-copy { display: grid; flex: 1 1 auto; gap: 3px; min-width: 0; }
.event-name { display: block; color: var(--ink); font-size: .875rem; font-weight: 740; line-height: 1.25; overflow-wrap: anywhere; }
.event-detail { display: block; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.events-footer { display: flex; justify-content: flex-start; margin: 5px 16px 0; padding: 7px 0 8px; border-top: 1px solid #edf0eb; }
.events-footer .button { margin-left: -7px; }
.quick-list { padding-bottom: 10px; }
.quick-action { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 5px 3px; border: 0; border-radius: 7px; color: var(--forest-deep); text-align: left; text-decoration: none; background: transparent; font-size: .875rem; font-weight: 680; }
.quick-action:hover { background: var(--surface-soft); }
.quick-action > .icon:last-child { width: 16px; height: 16px; margin-left: auto; color: var(--quiet); }
.quick-icon { flex-basis: 31px; width: 31px; height: 31px; border-radius: 7px; }
.quick-icon .icon { width: 16px; height: 16px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 2px 0 18px; }
.page-heading > * { min-width: 0; }
.page-heading h1 { color: var(--forest-deep); font: 700 clamp(2rem, 3.8vw, 2.9rem)/1.15 var(--display-font); letter-spacing: -.035em; }
.page-heading p { margin-top: 5px; color: var(--muted); }
.page-heading-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filter-bar > .field:first-child { flex: 1 1 220px; }
.field { display: grid; align-content: start; gap: 5px; min-width: 0; color: var(--ink); }
.field > label, label.field > span:first-child, .field > .label { font-size: .875rem; font-weight: 700; }
.field small, .field-hint { color: var(--muted); font-size: .75rem; }
.field :is(input:not([type='checkbox']):not([type='radio']), select, textarea), input[type='search'] { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: white; font-size: 1rem; }
.field :is(input, select, textarea):focus, input[type='search']:focus { border-color: #70a37a; outline: 2px solid #70a37a60; outline-offset: 1px; }
.field select { appearance: none; padding-right: 31px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23435d4d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 8px center / 16px no-repeat; }
.field select[multiple] { padding-right: 10px; background-image: none; }
.field textarea { min-height: 90px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #68766d; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; top: 50%; left: 11px; width: 16px; height: 16px; transform: translateY(-50%); color: var(--quiet); pointer-events: none; }
.field .input-icon input { padding-left: 34px; }
.table-scroll { min-width: 0; overflow-x: auto; }
.member-table { width: 100%; border-collapse: collapse; text-align: left; }
.member-table th, .member-table td { padding: 11px 15px; border-bottom: 1px solid var(--line); text-align: left; }
.member-table th { color: var(--muted); background: var(--surface-soft); font-size: .8125rem; font-weight: 730; }
.member-table td { font-size: .875rem; }
.member-table tr:last-child td { border-bottom: 0; }
.member-table tbody tr:hover { background: #f9fbf7; }
.member-identity { display: flex; align-items: center; gap: 9px; }
.member-link { display: inline-flex; align-items: center; gap: 9px; min-width: 0; padding: 0; border: 0; color: var(--forest-deep); text-align: left; text-decoration: none; background: transparent; font-size: .875rem; font-weight: 740; }
.member-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.member-meta { display: block; color: var(--muted); font-size: .75rem; }
.avatar { flex-basis: 34px; width: 34px; height: 34px; border-radius: 50%; font-size: .75rem; font-weight: 750; }
:is(.avatar, .detail-avatar)[data-gender='female'] { color: var(--gold-ink); background: var(--gold); }
.card-list { display: grid; gap: 12px; min-width: 0; }
.card-list .event-row { padding: 11px 15px; }
.calendar-toolbar { align-items: center; justify-content: space-between; }
.month-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--forest-deep); font-size: .875rem; }
.month-nav .icon-button { flex-basis: 34px; width: 34px; min-height: 34px; }
.month-nav strong { text-align: center; min-width: 95px; }
.calendar-events { padding-block: 8px; }
.calendar-group:not(:first-child) { margin-top: 10px; }
.calendar-group h3 { padding: 6px 10px; border-radius: 6px; color: var(--forest-deep); background: var(--surface-soft); font-size: .875rem; }
.calendar-events .event-date { flex-basis: 49px; }
.calendar-panel .tree-footer { border-top: 1px solid var(--line); }
.empty-state { display: grid; min-height: 110px; place-content: center; justify-items: center; gap: 8px; padding: 19px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--forest-deep); }
.empty-state .icon { width: 25px; height: 25px; color: var(--sage-ink); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 15px; }
.setting-card { display: grid; align-content: start; gap: 13px; padding: 16px; }
.setting-card .panel-heading { padding: 0; }
.setting-card h2 { color: var(--forest-deep); font: 700 1.4rem/1.25 var(--display-font); }
.setting-card p { max-width: 58ch; color: var(--muted); font-size: .875rem; }
.setting-card :is(.button, .field) { justify-self: start; max-width: 100%; }
.setting-card .field, .setting-card form { width: 100%; }
.setting-card form { display: grid; gap: 10px; }
.setting-card .link-row .button { min-height: 36px; padding: 7px 9px; }

#dialog { width: min(630px, calc(100% - 28px)); max-width: none; max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line-strong); border-radius: 15px; color: var(--ink); background: var(--surface); box-shadow: 0 20px 74px #0b231f55; }
#dialog::backdrop { background: #152a2180; }
.modal-content { display: grid; min-height: 0; }
.dialog-heading { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: white; }
.dialog-heading h2 { color: var(--forest-deep); font: 700 1.52rem/1.2 var(--display-font); letter-spacing: -.02em; }
.dialog-heading p { margin-top: 5px; color: var(--muted); font-size: .875rem; }
.dialog-body { padding: 16px 18px; }
.dialog-body > p + p { margin-top: 8px; }
.dialog-actions { position: sticky; z-index: 1; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); background: #fafbf9; }
.dialog-body .dialog-actions { margin: 14px -18px -16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .span-2, .form-error { grid-column: 1 / -1; }
.form-error { padding: 10px; border: 1px solid #ebc8c1; border-radius: 7px; color: #8c362e; background: #fff5f2; font-size: .875rem; }
.spouse-picker { min-width: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-soft); }
.spouse-picker summary { min-height: 38px; padding: 8px 10px; color: var(--forest-deep); font-size: .875rem; font-weight: 700; cursor: pointer; }
.partner-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 8px; max-height: 162px; overflow: auto; padding: 5px 9px 8px; border-top: 1px solid var(--line); background: white; }
.partner-options label, .duplicate-confirm { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 31px; color: var(--ink); font-size: .875rem; }
.partner-options input, .duplicate-confirm input { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; accent-color: var(--forest); }
.duplicate-confirm { padding: 8px; border: 1px solid #e8d9b6; border-radius: 7px; background: #fbf5e5; }
.detail-top { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.detail-avatar { display: grid; flex: 0 0 60px; width: 60px; height: 60px; place-items: center; border-radius: 50%; color: var(--forest); background: var(--sage); font: 700 1.28rem/1 var(--display-font); }
.detail-top h3, .detail-top strong { color: var(--forest-deep); font: 700 1.45rem/1.3 var(--display-font); letter-spacing: -.02em; }
.detail-top p { margin-top: 3px; color: var(--muted); font-size: .875rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-block { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: .875rem; overflow-wrap: anywhere; }
.detail-block h3, .detail-block dt, .detail-block > span:first-child { color: var(--muted); font-size: .75rem; font-weight: 750; }
.detail-block dd { margin: 0; }
.detail-bio, .detail-relations, .dialog-body > .link-row { margin-top: 10px; }
.detail-bio p { white-space: pre-wrap; }
.link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.link-row :is(a, button) { padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--forest); background: white; font-size: .8125rem; }
.relationship-result { margin-top: 13px; padding: 13px; border: 1px solid #dcebdc; border-radius: 9px; color: var(--forest-deep); background: var(--sage); }
.relation-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 17px; }
#relationship-output { padding: 0 17px 17px; }
.address-result { margin-top: 16px; }
.address-directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.address-direction { min-width: 0; padding: 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-soft); overflow-wrap: anywhere; }
.address-direction p { margin-bottom: 6px; color: var(--muted); font-size: .875rem; }
.address-direction strong { color: var(--forest-deep); font: 700 1.25rem/1.3 var(--display-font); }
.address-direction small { display: block; margin-top: 4px; color: var(--muted); font-size: .8125rem; }
.address-note { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.address-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.field small, .field-note { color: var(--muted); font-size: .875rem; font-weight: 400; }
.relationship-title { display: flex; align-items: flex-start; gap: 9px; }
.relationship-title > .icon { margin-top: 4px; }
.relationship-title p { color: var(--muted); font-size: .875rem; }
.relationship-result h3, .relationship-result strong { margin-bottom: 6px; font: 700 1.16rem/1.35 var(--display-font); }
.path-list { display: grid; gap: 7px; margin: 8px 0 0; padding: 0; list-style: none; }
.path-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .875rem; }
.path-step > .icon { width: 15px; height: 15px; color: var(--sage-ink); }
.path-step small { display: block; color: var(--muted); font-size: .75rem; }
.lineage-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.lineage-pair > div { min-width: 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: white; overflow-wrap: anywhere; }
.lineage-pair small { display: block; color: var(--muted); font-size: .8125rem; }
.lineage-anchors { margin-top: 12px; }
.lineage-anchors h4 { margin: 0 0 6px; font-size: .9rem; }
.lineage-anchors ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lineage-anchors li { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: white; overflow-wrap: anywhere; }
.lineage-anchors p { margin-top: 3px; color: var(--muted); font-size: .875rem; }
.lineage-anchors p :is(.member-link, strong) { color: var(--forest-deep); font-size: inherit; font-weight: 650; }
.lineage-path { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line-strong); }
.lineage-path summary { width: fit-content; cursor: pointer; font-size: .875rem; font-weight: 700; }
.search-results { display: grid; gap: 3px; max-height: min(385px, 47dvh); margin: 9px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.search-result { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 43px; padding: 6px; border: 1px solid transparent; border-radius: 7px; color: var(--forest-deep); text-align: left; background: white; font-size: .875rem; }
.search-result:hover, .search-result[aria-selected='true'] { border-color: var(--line); background: var(--surface-soft); }
.search-result small { display: block; color: var(--muted); }
.search-result > .icon:last-child { width: 15px; height: 15px; margin-left: auto; color: var(--quiet); }
.toast { position: fixed; z-index: 15; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 40px); padding: 10px 13px; border: 1px solid #42705a; border-radius: 9px; color: #fff; background: var(--forest-deep); box-shadow: 0 4px 15px #102c2360; font-size: .875rem; }
.toast .icon { width: 17px; height: 17px; }
.tree-node.tree-focused { z-index: 1; outline: 2px solid #588369; outline-offset: 2px; }
.tree-lines .partner-line { stroke: #9b8049; stroke-dasharray: 4 3; }

@media (min-width: 801px) { .topbar .mobile-menu { display: none; } }

@media (max-width: 1220px) {
  :root { --sidebar-width: 213px; }
  .sidebar { padding-inline: 12px; }
  .topbar, .content { padding-inline: 24px; }
  .overview-grid { grid-template-columns: minmax(0, 1.85fr) minmax(263px, 1fr); gap: 13px; }
  .overview-rail { gap: 13px; }
  .metric { gap: 8px; padding-inline: 11px; }
}

@media (max-width: 1030px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .topbar, .content { padding-inline: 18px; }
  .metrics { gap: 9px; }
  .metric { padding-inline: 8px; }
  .metric-icon { flex-basis: 34px; width: 34px; height: 34px; }
  .metric-icon .icon { width: 18px; height: 18px; }
}

@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 12; top: 0; left: 0; width: min(270px, calc(100vw - 56px)); padding: 17px 14px; visibility: hidden; transform: translateX(-100%); transition: transform 180ms ease, visibility 180ms ease; }
  .sidebar-scrim { position: fixed; z-index: 11; inset: 0; width: 100%; height: 100%; border: 0; background: #122a2199; }
  body.menu-open { overflow: hidden; }
  body.menu-open .sidebar { visibility: visible; transform: translateX(0); }
  body.menu-open .sidebar-scrim { display: block; }
  .mobile-menu { display: inline-flex; }
  .topbar { min-height: 61px; }
  .content { min-height: calc(100dvh - 61px); padding-block: 17px 27px; }
  .topbar-leading, .topbar-actions { gap: 9px; }
  .hero { min-height: 235px; }
}

@media (max-width: 560px) {
  .topbar, .content { padding-inline: 12px; }
  .topbar { min-height: 56px; }
  .topbar-leading, .topbar-actions { gap: 7px; }
  .breadcrumbs { gap: 4px; font-size: .8125rem; }
  .breadcrumbs .icon { width: 11px; height: 11px; }
  .search-trigger { display: grid; min-width: 39px; width: 39px; height: 39px; place-items: center; padding: 0; }
  .search-trigger :is(.search-label, .search-hint) { display: none; }
  .header-avatar { width: 34px; height: 34px; }
  .content { padding-top: 12px; }
  .hero { min-height: 244px; border-radius: 13px; }
  .hero-content { padding: 19px 15px; }
  .hero::before { background-position: 61% 56%; }
  .hero::after { background: linear-gradient(90deg, #153c2cf9 0%, #153c2cdc 50%, #153c2c83 100%); }
  .hero-eyebrow { font-size: .75rem; }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.45rem); }
  .hero p { font-size: .875rem; }
  .hero-actions { margin-top: 13px; }
  .hero-actions .button { min-height: 36px; padding: 6px 8px; font-size: .8125rem; }
  .hero-actions .button > .icon { width: 15px; height: 15px; }
  .hero-caption { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-block: 11px; }
  .metric { gap: 8px; min-height: 64px; padding: 8px; border-radius: 10px; }
  .metric-value { font-size: 1.3rem; }
  .metric-label { font-size: .8125rem; }
  .overview-rail { grid-template-columns: minmax(0, 1fr); }
  .panel { border-radius: 11px; }
  .panel-heading { padding: 12px 10px 10px; }
  .panel-title { font-size: 1.24rem; }
  .panel-subtitle { font-size: .8125rem; }
  .panel-actions .button { min-height: 34px; padding-inline: 7px; font-size: .75rem; }
  .panel-actions .button .icon { width: 14px; height: 14px; }
  .tree-toolbar { padding: 0 10px 8px; }
  .tree-footer { padding-inline: 10px; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; gap: 9px; }
  .page-heading h1 { font-size: 2rem; }
  .page-heading p { font-size: .875rem; }
  .filter-bar { gap: 8px; padding: 10px; }
  .filter-bar .field { flex: 1 1 130px; }
  .filter-bar .field:first-child { flex-basis: 100%; }
  .member-table { min-width: 530px; }
  .member-table th, .member-table td { padding: 8px; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .setting-card { padding: 12px; }
  #dialog { width: calc(100% - 14px); max-height: calc(100dvh - 15px); }
  .dialog-heading, .dialog-body, .dialog-actions { padding-inline: 12px; }
  .dialog-body .dialog-actions { margin-inline: -12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .partner-options { grid-template-columns: minmax(0, 1fr); }
  .toast { right: 8px; bottom: 8px; max-width: calc(100% - 16px); }
}

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

@media (max-width: 430px) {
  .breadcrumbs .breadcrumb-space,
  .breadcrumbs .breadcrumb-separator { display: none; }
}

.table-scroll { position: relative; }
.mobile-member-summary { display: none; }
@media (max-width: 560px) {
  .relation-fields, .address-directions, .lineage-pair { grid-template-columns: minmax(0, 1fr); }
  table.member-table { min-width: 0; }
  .member-table :is(th, td):nth-child(3),
  .member-table :is(th, td):nth-child(4) { display: none; }
  .mobile-member-summary:not(:empty) { display: block; }
}

.stats-page { display: grid; gap: 14px; min-width: 0; }
.stats-scope { display: flex; align-items: end; gap: 15px; padding: 14px; }
.stats-scope-fields { display: grid; flex: 1 1 auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.stats-scope > .stats-item { flex: 0 1 210px; min-height: 42px; }
.stats-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stats-group { --stats-tint: var(--sage); --stats-accent: var(--sage-ink); padding: 13px; }
.stats-group[data-tone='blue'] { --stats-tint: var(--blue); --stats-accent: var(--blue-ink); }
.stats-group[data-tone='gold'] { --stats-tint: var(--gold); --stats-accent: var(--gold-ink); }
.stats-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--forest-deep); font: 700 1.1rem/1.3 var(--display-font); }
.stats-group-title > span { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 8px; color: var(--stats-accent); background: var(--stats-tint); }
.stats-group-title .icon { width: 17px; height: 17px; }
.stats-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.stats-age-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats-age-summary > div { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.stats-age-summary span, .stats-age > p { color: var(--muted); font-size: .875rem; }
.stats-age-summary strong { color: var(--forest-deep); font-size: 1.1rem; }
.stats-age .stats-age-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-age .stats-age-items.age-data { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reminder-list { padding-inline: 0; }
.reminder-note { margin-top: 12px; color: var(--muted); font-size: .875rem; }
@media (max-width: 720px) {
  .stats-age .stats-age-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stats-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; min-height: 40px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); text-align: left; background: var(--surface-soft); font-size: .875rem; line-height: 1.28; }
.stats-item > span { min-width: 0; overflow-wrap: anywhere; }
.stats-item > strong { flex: 0 0 auto; color: var(--forest-deep); font-size: 1.06rem; font-variant-numeric: tabular-nums; }
.stats-item:hover { border-color: #a4bfac; background: var(--sage); }
.stats-item[aria-pressed='true'] { border-color: #8cac96; color: var(--forest-deep); background: var(--sage); font-weight: 700; }
.stats-details:focus { outline: 2px solid #8cac96; outline-offset: 2px; }
.stats-member-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0 17px 14px; gap: 7px 14px; list-style: none; }
.stats-member-list > li { min-width: 0; padding: 6px 0 5px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.stats-member-list .member-link { max-width: 100%; white-space: normal; text-align: left; }
.stats-member-list small { display: block; color: var(--muted); font-size: .8125rem; }
.stats-empty { padding: 0 17px 15px; color: var(--muted); font-size: .875rem; }
.stats-method { padding: 10px 14px; color: var(--muted); font-size: .875rem; }
.stats-method > summary { color: var(--forest); font-weight: 700; cursor: pointer; }
.stats-method > p { max-width: 82ch; margin-top: 6px; }

@media (max-width: 830px) {
  .stats-scope { flex-direction: column; align-items: stretch; gap: 10px; }
  .stats-scope > .stats-item { flex-basis: auto; }
}
@media (max-width: 580px) {
  .stats-page, .stats-groups { gap: 8px; }
  .stats-groups, .stats-member-list { grid-template-columns: minmax(0, 1fr); }
  .stats-group, .stats-scope { padding: 10px; }
  .stats-member-list, .stats-empty { padding-inline: 10px; }
}
@media (max-width: 360px) {
  .stats-scope-fields { grid-template-columns: minmax(0, 1fr); gap: 7px; }
}
