.directory-main { padding-top: 56px; padding-bottom: 64px; min-height: 72vh; }
.directory-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 32px; }
.directory-heading h1 { margin: 0 0 16px; color: var(--forest); font-size: clamp(2rem, 4.5vw, 3.1rem); }
.directory-heading > div > p:last-child { color: var(--muted); margin: 0; }
.directory-private { flex-shrink: 0; display: inline-flex; gap: 8px; align-items: center; border: 1px solid #d7dece; border-radius: 24px; padding: 8px 14px; color: var(--forest); font-size: .73rem; background: #eef1e8; }
.directory-gate { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--cream); }
.directory-gate-art { padding: 46px; background: var(--wheat); }
.directory-gate-art .brand-mark { display: block; width: 40px; height: 40px; margin-bottom: 32px; }
.directory-gate-art h2 { color: var(--forest); font-size: 2.3rem; line-height: 1.25; }
.directory-gate-art > p:last-child { max-width: 300px; margin-bottom: 0; color: var(--muted); }
.directory-gate-form { padding: 48px 40px; align-self: center; }
.directory-gate-form h2 { color: var(--forest); font-size: 1.5rem; }
.directory-gate-form > p { color: var(--muted); font-size: .85rem; }
#family-login { display: grid; gap: 10px; }
#family-login label { font-size: .73rem; font-weight: 600; }
#family-login input { width: 100%; height: 44px; padding: 10px; background: white; border: 1px solid #cdd2c6; border-radius: 4px; }
#family-login button { margin-top: 4px; }
#directory-access-status { min-height: 1.4em; margin: 10px 0; font-size: .76rem; }
.directory-gate-form #directory-access-status.form-error { color: var(--red); }
#directory-retry { display: block; margin-bottom: 14px; background: none; border: 0; padding: 0; }
.directory-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border: 1px solid #dbe1d3; border-radius: 6px; background: #eef1e8; margin-bottom: 24px; }
.directory-intro p { margin: 0; font-size: .8rem; color: var(--forest); }
.directory-intro strong { margin-right: 5px; }
.directory-intro button, .family-results button, .family-members-heading button { border: 0; padding: 0; background: none; flex-shrink: 0; }
.family-filters { display: grid; grid-template-columns: 2.2fr 1.1fr 1.2fr .8fr 1.15fr; gap: 12px; margin-bottom: 14px; }
.family-filters label { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: .68rem; font-weight: 600; color: var(--forest); }
.family-filters input, .family-filters select { border: 1px solid #d9dccf; border-radius: 4px; width: 100%; height: 42px; min-width: 0; padding: 8px 10px; background: white; color: var(--ink); font-size: .76rem; }
.family-results { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 12px; }
.family-results p { color: var(--muted); font-size: .73rem; margin: 0; }
.family-table-wrap { border: 1px solid var(--line); border-radius: 7px; background: var(--cream); overflow: hidden; }
.family-table, .family-members, .family-history { border-collapse: collapse; width: 100%; text-align: left; }
.family-table { table-layout: fixed; }
.family-table > thead { background: var(--wheat); }
.family-table > thead th { padding: 14px 18px; font-size: .68rem; font-weight: 600; color: var(--forest); }
.family-table > thead th:first-child { width: 20%; }
.family-table > thead th:nth-child(2) { width: 29%; }
.family-table > thead th:nth-child(3) { width: 13%; }
.family-table > thead th:nth-child(4) { width: 24%; }
.family-table > thead th:last-child { width: 14%; }
.family-table th button { display: inline-flex; gap: 10px; padding: 0; background: none; border: 0; color: inherit; }
.family-table th[aria-sort] button { font-weight: 800; }
.family-table th button span { opacity: .55; }
.family-summary > td { padding: 18px 12px; border-top: 1px solid var(--line); font-size: .76rem; vertical-align: middle; overflow-wrap: anywhere; }
.family-people { color: var(--forest); line-height: 1.7; }
.family-summary:hover { background: #f1f3eb; }
.family-toggle { display: flex; gap: 12px; align-items: center; border: 0; padding: 0; background: none; color: var(--forest); text-align: left; width: 100%; }
.family-name { min-width: 0; }
.family-name strong { display: block; font-size: .82rem; line-height: 1.55; font-weight: 600; }
.family-name small { display: block; color: var(--muted); font-size: .65rem; margin-top: 3px; }
.family-chevron { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; border: 1px solid #dce1d3; background: #f0f2e9; border-radius: 50%; font-size: 1.2rem; line-height: 1; transition: transform .15s; }
.family-toggle[aria-expanded="true"] .family-chevron { transform: rotate(90deg); }
.family-contact { display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.family-contact a, .family-directory-note a { color: var(--forest); text-decoration: underline; text-decoration-color: #c1cbb5; text-underline-offset: 3px; }
.family-contact a:hover { text-decoration-color: var(--forest); }
.family-missing { color: #8c958d; }
.family-mobile-contact { display: none; }
.family-expanded > td { padding: 20px 24px 24px 52px; background: #edf0e5; border-top: 1px solid #dce1d1; }
.family-members-heading { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.family-members-heading h2 { margin: 0; font: 600 .8rem var(--sans); letter-spacing: 0; color: var(--forest); }
.family-members-heading button { font-size: .7rem; color: var(--forest); }
.family-members th { font-size: .65rem; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid #d5dccb; }
.family-members td { padding: 11px 10px; font-size: .75rem; border-bottom: 1px solid #dfe4d7; overflow-wrap: anywhere; }
.family-members th:first-child { width: 29%; }
.family-members th:nth-child(2) { width: 18%; }
.family-members th:nth-child(3) { width: 31%; }
.family-empty { text-align: center; padding: 40px 20px; }
.family-empty h2 { color: var(--forest); font-size: 1.3rem; }
.family-empty p { font-size: .8rem; color: var(--muted); margin: 0; }
.family-directory-note { margin: 18px 0 0; color: var(--muted); font-size: .7rem; }
.family-directory-note a { white-space: nowrap; }
.family-dialog { width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); color: var(--ink); box-shadow: 0 24px 90px #17281733; }
.family-dialog::backdrop { background: #15251999; }
.family-dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.family-dialog-heading p { margin: 0; }
.family-dialog-close { display: grid; place-items: center; width: 36px; height: 36px; background: var(--wheat); border: 0; border-radius: 50%; font-size: 1.4rem; color: var(--forest); }
.family-dialog h2 { color: var(--forest); font-size: 1.5rem; line-height: 1.5; margin-bottom: 18px; overflow-wrap: anywhere; }
.family-dialog dl { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.family-dialog dt { color: var(--muted); }
.family-dialog dd { margin: 0; min-width: 0; }
.family-dialog h3 { margin-bottom: 10px; font-size: 1.15rem; color: var(--forest); }
.family-history-note { font-size: .72rem; color: var(--muted); margin: 12px 0 18px; }
.family-history th { padding: 12px 8px; background: var(--wheat); color: var(--forest); font-size: .7rem; font-weight: 600; }
.family-history th small { font-weight: 400; }
.family-history td { padding: 14px 8px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.family-history td:last-child { font-weight: 700; }
.family-history-wrap { overflow-x: auto; }
.directory-noscript { padding: 20px; background: var(--wheat); }
button:disabled { cursor: wait; opacity: .65; }
@media (max-width: 900px) {
  .family-filters { grid-template-columns: repeat(4, 1fr); }
  .family-search { grid-column: 1 / -1; }
  .directory-gate-art { padding: 32px; }
  .directory-gate-form { padding: 32px; }
}
@media (max-width: 640px) {
  .directory-main { padding-top: 30px; padding-bottom: 40px; }
  .directory-heading { display: block; margin-bottom: 22px; }
  .directory-heading h1 { font-size: 2.1rem; }
  .directory-heading > div > p:last-child { font-size: .8rem; }
  .directory-private { margin-top: 18px; font-size: .65rem; }
  .directory-gate { grid-template-columns: 1fr; }
  .directory-gate-art { padding: 24px; }
  .directory-gate-art .brand-mark, .directory-gate-art > p:last-child { display: none; }
  .directory-gate-art h2 { font-size: 1.6rem; margin: 0; }
  .directory-gate-art h2 br { display: none; }
  .directory-gate-form { padding: 26px 24px; }
  .directory-intro { align-items: start; padding: 14px; }
  .directory-intro strong { display: block; }
  .directory-intro p { font-size: .72rem; }
  .directory-intro button { margin-top: 3px; font-size: .65rem; }
  .family-filters { grid-template-columns: 1fr 1fr; }
  .family-table > thead, .family-members thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .family-table, .family-table > tbody, .family-members, .family-members tbody { display: block; width: 100%; }
  .family-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; padding: 10px 12px; gap: 12px; border-top: 1px solid var(--line); }
  .family-summary > td { display: block; border: 0; padding: 0; font-size: .74rem; }
  .family-summary > td:nth-child(n + 3) { display: none; }
  .family-toggle { gap: 6px; align-items: flex-start; }
  .family-name strong { line-height: 22px; }
  .family-name small { display: none; }
  .family-members td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .62rem; margin-bottom: 3px; }
  .family-expanded { display: block; }
  .family-expanded > td { display: block; padding: 18px 16px; }
  .family-mobile-contact { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 10px 12px; margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid #d5dccb; font-size: .73rem; }
  .family-mobile-contact dt { color: var(--muted); }
  .family-mobile-contact dd { min-width: 0; margin: 0; }
  .family-members-heading { align-items: start; flex-direction: column; }
  .family-members tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; border-top: 1px solid #d5dccb; padding: 12px 0; }
  .family-members td { display: block; border: 0; padding: 0; font-size: .73rem; }
  .family-dialog { padding: 20px; }
  .family-history th, .family-history td { padding: 10px 5px; font-size: .65rem; }
  .family-directory-note { line-height: 1.8; }
}
@media (prefers-reduced-motion: reduce) { .family-chevron { transition: none; } }

/* The same correction control is present for populated and missing values. */
.directory-editable { display: inline-flex; align-items: flex-start; gap: 5px; max-width: 100%; vertical-align: middle; }
.directory-field-value { min-width: 0; overflow-wrap: anywhere; }
.directory-edit-trigger { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; margin-top: -3px; padding: 4px; border: 0; border-radius: 4px; background: transparent; color: #74836b; }
.directory-edit-trigger:hover, .directory-edit-trigger:focus-visible { background: #e3e9d9; color: var(--forest); }
.family-label-row { display: flex; align-items: flex-start; gap: 4px; }
.family-label-row .family-toggle { min-width: 0; flex: 1; }
.family-label-row > .directory-edit-trigger { margin-top: 0; }
.family-history .directory-editable { gap: 2px; align-items: center; }
.family-history .directory-edit-trigger { flex-basis: 20px; width: 20px; height: 22px; margin-top: 0; padding: 3px; }
.directory-edit-dialog { width: min(470px, calc(100% - 32px)); }
.directory-edit-dialog h2 { margin-bottom: 10px; }
.directory-edit-context { margin-bottom: 22px; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.directory-edit-label { display: block; margin-bottom: 7px; color: var(--forest); font-size: .75rem; font-weight: 600; }
.directory-edit-old { padding: 12px 14px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--muted); font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
#directory-edit-new { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cdd2c6; border-radius: 5px; background: white; color: var(--ink); font-size: .85rem; }
.directory-edit-help { margin: 7px 0 18px; color: var(--muted); font-size: .65rem; }
.directory-edit-review { margin: 18px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.7; }
.directory-edit-status { margin: 18px 0 0; padding: 14px; border-radius: 5px; background: #edf0e5; color: var(--forest); font-size: .85rem; }
#directory-edit-error { margin-top: 14px; }
@media (max-width: 640px) {
  .directory-edit-trigger { flex-basis: 28px; width: 28px; height: 28px; }
  .family-history .directory-edit-trigger { flex-basis: 20px; width: 20px; }
}
