:root {
    color-scheme: light;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: #f4f7f5;
    color: #1f2933;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-width: 320px;
    min-height: 100%;
}

body {
    background:
        linear-gradient(
            180deg,
            #eaf1ee 0,
            #f4f7f5 230px
        );
}

button,
a {
    font: inherit;
}

.tree-app {
    display: grid;
    grid-template-rows:
        auto
        auto
        auto
        minmax(0, 1fr)
        auto;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 520px;
}

.tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    border-bottom: 1px solid #d9e1dd;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 5;
}

.tree-toolbar-title {
    min-width: 0;
}

.tree-eyebrow {
    margin: 0 0 2px;
    color: #6c7a75;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.tree-toolbar h1 {
    margin: 0;
    overflow: hidden;
    color: #182821;
    font-size: clamp(1rem, 3vw, 1.35rem);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-controls {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.control-button {
    display: inline-grid;
    min-width: 42px;
    height: 42px;
    place-items: center;
    padding: 0 11px;
    border: 1px solid #cfd9d4;
    border-radius: 11px;
    background: #fff;
    color: #244b3f;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
}

.control-button:hover,
.control-button:focus-visible {
    border-color: #93b4a8;
    outline: none;
    background: #f4faf7;
}

.control-button-wide {
    min-width: 66px;
    font-size: 0.82rem;
}

.tree-status {
    padding: 7px 18px;
    border-bottom: 1px solid #e2e8e5;
    background: rgba(247, 250, 248, 0.95);
    color: #66736e;
    font-size: 0.76rem;
}

.tree-status[hidden] {
    display: none;
}

.tree-viewport {
    position: relative;
    min-height: 360px;
    height: calc(100vh - 250px);
    height: calc(100dvh - 250px);
    overflow: hidden;
    background:
        radial-gradient(
            circle at 1px 1px,
            rgba(91, 118, 107, 0.13) 1px,
            transparent 1px
        );
    background-size: 22px 22px;
    touch-action: none;
    cursor: grab;
}

.tree-viewport.is-dragging {
    cursor: grabbing;
}

.tree-stage {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.tree-content {
    width: max-content;
    min-width: 720px;
    padding: 34px 54px 54px;
    user-select: none;
}

.tree-section {
    display: grid;
    justify-items: center;
}

.tree-section-label {
    margin: 0 0 10px;
    color: #6b7773;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.person-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 14px;
}


.couple-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.couple-link {
    width: 34px;
    height: 2px;
    flex: 0 0 34px;
    background: #aebfb7;
}

.single-family-section .children-connector {
    height: 28px;
}

.single-family-section {
    padding-bottom: 8px;
}

.person-card {
    width: 190px;
    min-height: 86px;
    border: 1px solid #d5dfda;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
        0 1px 2px rgba(21, 42, 34, 0.04),
        0 8px 20px rgba(21, 42, 34, 0.05);
    overflow: hidden;
}

.person-card.is-focus {
    border-color: #78a999;
    box-shadow:
        0 0 0 3px rgba(120, 169, 153, 0.15),
        0 10px 28px rgba(21, 42, 34, 0.08);
}

.person-card.is-missing {
    border-style: dashed;
    background: rgba(249, 250, 250, 0.88);
    box-shadow: none;
}

.person-select {
    display: block;
    width: 100%;
    min-height: 58px;
    padding: 13px 14px 9px;
    border: 0;
    background: transparent;
    color: #184f40;
    text-align: left;
    cursor: pointer;
}

.person-select:focus-visible {
    outline: 3px solid rgba(71, 139, 117, 0.25);
    outline-offset: -3px;
}

.person-name {
    display: block;
    color: #184f40;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.25;
}

.person-meta {
    display: block;
    margin-top: 5px;
    color: #77827e;
    font-size: 0.7rem;
    font-weight: 650;
}

.person-details {
    display: block;
    padding: 6px 14px 8px;
    border-top: 1px solid #edf0ee;
    color: #607069;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: right;
    text-decoration: none;
}

.person-details:hover,
.person-details:focus-visible {
    color: #174c3d;
    background: #f5faf8;
    outline: none;
}

.missing-parent-text {
    display: grid;
    min-height: 86px;
    place-items: center;
    padding: 14px;
    color: #798480;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.tree-connector {
    width: 2px;
    height: 28px;
    margin: 0 auto;
    background: #b7c7c0;
}

.family-groups {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
}

.family-group {
    min-width: 260px;
    padding: 16px;
    border: 1px solid #dbe3df;
    border-radius: 18px;
    background: rgba(250, 252, 251, 0.94);
}

.family-label {
    margin: 0 0 11px;
    color: #697772;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.children-connector {
    width: 2px;
    height: 20px;
    margin: 0 auto;
    background: #b7c7c0;
}

.children-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
}

.children-row .person-card {
    width: 168px;
}

.empty-note {
    margin: 0;
    padding: 12px;
    color: #7b8682;
    font-size: 0.78rem;
    text-align: center;
}

.marriage-context {
    margin: 8px 0 0;
    color: #6d7a75;
    font-size: 0.75rem;
    font-weight: 650;
    text-align: center;
}

.tree-help {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 8px 14px;
    border-top: 1px solid #dae2de;
    background: #fff;
    color: #74807b;
    font-size: 0.68rem;
}

/* Mobile V1 refinement */
@media (max-width: 700px) {
    html,
    body {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .tree-app {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .tree-toolbar {
        flex: 0 0 auto;
        align-items: flex-start;
        padding: 10px 10px 9px;
    }

    .tree-toolbar-title {
        min-width: 0;
        padding-top: 5px;
    }

    .tree-controls {
        gap: 5px;
    }

    .control-button {
        min-width: 40px;
        height: 40px;
        border-radius: 10px;
        padding: 0 9px;
    }

    .control-button-wide {
        min-width: 55px;
        font-size: 0.74rem;
    }

    .tree-status {
        flex: 0 0 auto;
        padding: 6px 11px;
    }

    .tree-viewport {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        overscroll-behavior: contain;
    }

    .tree-content {
        width: max-content;
        min-width: 100%;
        padding: 24px 18px 44px;
    }

    .person-card {
        width: 156px;
        min-height: 98px;
    }

    .person-select {
        min-height: 62px;
        padding: 12px 12px 9px;
    }

    .person-name {
        font-size: 0.86rem;
    }

    .person-details {
        display: grid;
        min-height: 36px;
        place-items: center end;
        padding: 6px 12px;
    }

    .missing-parent-text {
        min-height: 98px;
        padding: 12px;
    }

    .couple-link {
        width: 20px;
        flex-basis: 20px;
    }

    .children-row {
        gap: 9px;
    }

    .children-row .person-card {
        width: 142px;
    }

    .family-groups {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .family-group {
        width: max-content;
        min-width: 218px;
        padding: 13px;
    }

    .tree-help {
        flex: 0 0 auto;
        justify-content: center;
        gap: 12px;
        min-height: 32px;
        overflow: hidden;
        white-space: nowrap;
    }
}

@media (max-width: 560px) {
    .tree-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 8px 10px 9px;
    }

    .tree-toolbar-title {
        padding: 0 2px;
    }

    .tree-eyebrow {
        display: none;
    }

    .tree-toolbar h1 {
        width: 100%;
        max-width: none;
        font-size: 1rem;
    }

    .tree-controls {
        display: grid;
        grid-template-columns:
            44px
            minmax(64px, 1fr)
            44px
            minmax(58px, 0.8fr);
        width: 100%;
        gap: 6px;
    }

    .control-button,
    .control-button-wide {
        width: 100%;
        min-width: 0;
        height: 42px;
        padding: 0 8px;
    }

    .control-button-wide {
        font-size: 0.78rem;
    }

    .tree-content {
        padding: 22px 16px 40px;
    }

    .tree-help {
        padding: 7px 10px;
        font-size: 0.66rem;
    }

    .tree-help span:nth-child(2) {
        display: none;
    }
}

@media (max-width: 380px) {
    .tree-controls {
        grid-template-columns:
            42px
            minmax(58px, 1fr)
            42px
            minmax(54px, 0.8fr);
        gap: 5px;
    }

    .control-button,
    .control-button-wide {
        height: 40px;
    }

    .tree-content {
        padding-inline: 14px;
    }

    .person-card {
        width: 150px;
    }

    .children-row .person-card {
        width: 136px;
    }

    .couple-link {
        width: 16px;
        flex-basis: 16px;
    }
}

@media (max-height: 520px) and (max-width: 900px) {
    .tree-toolbar {
        gap: 6px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .tree-eyebrow {
        display: none;
    }

    .control-button,
    .control-button-wide {
        height: 38px;
    }

    .tree-content {
        padding-top: 18px;
        padding-bottom: 32px;
    }

    .tree-help {
        display: none;
    }
}


/* Mobile V1 second polish */
html,
body {
    width: 100%;
    overflow: hidden;
}

@media (max-width: 560px) {
    .tree-help span:nth-child(2) {
        display: inline;
    }

    .tree-help span:nth-child(3) {
        display: none;
    }
}


/* Public family search */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.tree-search-shell {
    position: relative;
    z-index: 12;
    padding: 9px 18px 10px;
    border-bottom: 1px solid #dfe6e2;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.tree-search-box {
    position: relative;
    width: min(520px, 100%);
    margin: 0 auto;
}

.tree-search-input {
    width: 100%;
    height: 42px;
    padding: 0 44px 0 14px;
    border: 1px solid #cbd8d2;
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: #183129;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 650;
    box-shadow: 0 1px 2px rgba(21, 42, 34, 0.03);
}

.tree-search-input::placeholder {
    color: #7a8782;
    font-weight: 550;
}

.tree-search-input:focus {
    border-color: #74a493;
    box-shadow:
        0 0 0 3px rgba(116, 164, 147, 0.15),
        0 1px 2px rgba(21, 42, 34, 0.03);
}

.tree-search-clear {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #5f6f69;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.tree-search-clear:hover,
.tree-search-clear:focus-visible {
    outline: none;
    background: #eef5f1;
    color: #184f40;
}

.tree-search-results {
    position: absolute;
    top: calc(100% - 3px);
    left: 50%;
    width: min(520px, calc(100% - 36px));
    max-height: min(430px, 58vh);
    overflow-y: auto;
    transform: translateX(-50%);
    border: 1px solid #ccd8d2;
    border-radius: 0 0 14px 14px;
    background: #fff;
    box-shadow:
        0 14px 36px rgba(21, 42, 34, 0.16),
        0 2px 4px rgba(21, 42, 34, 0.05);
}

.tree-search-empty,
.tree-search-hint {
    margin: 0;
    padding: 14px 15px;
    color: #697873;
    font-size: 0.78rem;
    line-height: 1.4;
}

.tree-search-result {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid #edf1ef;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.tree-search-result:last-child {
    border-bottom: 0;
}

.tree-search-result:hover,
.tree-search-result:focus-visible,
.tree-search-result.is-active {
    outline: none;
    background: #eef7f3;
}

.tree-search-result-name {
    display: block;
    color: #184f40;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.25;
}

.tree-search-result-meta {
    display: block;
    margin-top: 4px;
    color: #71807a;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.35;
}

@media (max-width: 700px) {
    .tree-search-shell {
        flex: 0 0 auto;
        padding: 7px 10px 8px;
    }

    .tree-search-box {
        width: 100%;
    }

    .tree-search-input {
        height: 40px;
        border-radius: 10px;
        font-size: 0.82rem;
    }

    .tree-search-results {
        width: calc(100% - 20px);
        max-height: min(470px, 62vh);
    }

    .tree-search-result {
        min-height: 58px;
        padding: 11px 13px;
    }
}

@media (max-height: 520px) and (max-width: 900px) {
    .tree-search-shell {
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .tree-search-input {
        height: 36px;
    }
}

/* Public family search polish */
.tree-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}


/* Focused sibling context — professional branch layout */
.sibling-context-section {
    width: max-content;
    max-width: none;
}

.sibling-row {
    --sibling-card-width: 176px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    width: max-content;
    margin: 0 auto;
    padding-top: 10px;
}

.sibling-branch {
    position: relative;
    flex: 0 0 var(--sibling-card-width);
    width: var(--sibling-card-width);
}

.sibling-balance {
    visibility: hidden;
    pointer-events: none;
}

.sibling-person-card {
    position: relative;
    overflow: visible;
    border: 1px solid #d7e1dc;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 1px 2px rgba(21, 42, 34, 0.03),
        0 6px 16px rgba(21, 42, 34, 0.045);
}

.sibling-person-card.is-selected {
    border-color: #72a594;
    box-shadow:
        0 0 0 3px rgba(114, 165, 148, 0.15),
        0 8px 20px rgba(21, 42, 34, 0.07);
}

.sibling-person-focus {
    display: block;
    width: 100%;
    min-height: 64px;
    padding: 11px 12px 9px;
    border: 0;
    border-radius: 13px 13px 0 0;
    background: transparent;
    color: #184f40;
    text-align: left;
    cursor: pointer;
}

.sibling-person-focus:hover,
.sibling-person-focus:focus-visible {
    outline: none;
    background: #f4faf7;
}

.sibling-person-name {
    display: block;
    font-size: 0.78rem;
    font-weight: 820;
    line-height: 1.22;
}

.sibling-person-meta {
    display: block;
    margin-top: 4px;
    color: #78847f;
    font-size: 0.62rem;
    font-weight: 650;
    line-height: 1.25;
}

.sibling-card-footer {
    display: flex;
    min-height: 33px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    border-top: 1px solid #edf1ef;
}

.selected-branch-badge {
    display: inline-flex;
    align-items: center;
    min-height: 21px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e9f5ef;
    color: #1e604d;
    font-size: 0.59rem;
    font-weight: 800;
}

.sibling-footer-spacer {
    flex: 1 1 auto;
}

.relative-branch-toggle {
    min-height: 24px;
    padding: 2px 6px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #27614f;
    font: inherit;
    font-size: 0.61rem;
    font-weight: 760;
    line-height: 1.2;
    cursor: pointer;
}

.relative-branch-toggle:hover,
.relative-branch-toggle:focus-visible {
    outline: none;
    background: #edf7f2;
}

.sibling-details {
    color: #6a7772;
    font-size: 0.59rem;
    font-weight: 720;
    text-decoration: none;
}

.sibling-details:hover,
.sibling-details:focus-visible {
    color: #184f40;
    text-decoration: underline;
    outline: none;
}

.branch-continues {
    position: absolute;
    left: 50%;
    bottom: -18px;
    width: 2px;
    height: 18px;
    transform: translateX(-50%);
    background: #b6c8c0;
}

.branch-continues::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -3px;
    width: 6px;
    height: 6px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #99b7aa;
}

.relative-family-panel {
    width: min(980px, calc(100vw - 80px));
    margin: 34px auto 8px;
    padding: 14px;
    border: 1px solid #d5e0db;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
        0 8px 24px rgba(24, 49, 41, 0.08);
}

.relative-family-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 2px 12px;
    border-bottom: 1px solid #e8eeeb;
}

.relative-family-eyebrow {
    margin: 0 0 3px;
    color: #7a8782;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.relative-family-title {
    margin: 0;
    color: #184f40;
    font-size: 0.9rem;
    line-height: 1.2;
}

.relative-family-meta {
    margin: 4px 0 0;
    color: #77847f;
    font-size: 0.65rem;
    font-weight: 650;
}

.relative-family-close {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f3f7f5;
    color: #607069;
    font-size: 1rem;
    cursor: pointer;
}

.relative-family-close:hover,
.relative-family-close:focus-visible {
    outline: none;
    background: #e7f1ec;
    color: #184f40;
}

.relative-family-groups {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    padding-top: 12px;
}

.relative-family-group {
    min-width: 0;
    padding: 10px;
    border: 1px solid #e0e7e4;
    border-radius: 12px;
    background: #fbfcfc;
}

.relative-family-group-label {
    margin: 0 0 8px;
    color: #64736d;
    font-size: 0.64rem;
    font-weight: 720;
    text-align: center;
}

.relative-family-children {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
}

.compact-person-button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 136px;
    min-height: 56px;
    padding: 8px 9px;
    border: 1px solid #d7e0dc;
    border-radius: 10px;
    background: #fff;
    color: #173b31;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(24, 49, 41, 0.04);
}

.compact-person-button:hover,
.compact-person-button:focus-visible {
    outline: none;
    border-color: #84aa9b;
    background: #f3f8f6;
}

.compact-person-name {
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.18;
}

.compact-person-meta {
    margin-top: 4px;
    color: #78847f;
    font-size: 0.56rem;
    font-weight: 650;
    line-height: 1.22;
}

@media (max-width: 700px) {
    .sibling-row {
        --sibling-card-width: 164px;
        gap: 10px;
    }

    .sibling-person-focus {
        min-height: 61px;
        padding: 10px 10px 8px;
    }

    .sibling-person-name {
        font-size: 0.74rem;
    }

    .relative-family-panel {
        width: min(620px, calc(100vw - 28px));
        margin-top: 30px;
        padding: 11px;
    }

    .relative-family-groups {
        display: grid;
        gap: 10px;
    }

    .relative-family-group {
        width: min(580px, calc(100vw - 52px));
    }

    .relative-family-children {
        max-width: min(550px, calc(100vw - 72px));
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 3px;
    }

    .compact-person-button {
        flex: 0 0 132px;
        width: 132px;
        min-height: 58px;
    }
}


/* Sibling context v3 — inline cousin branches */
.sibling-context-section {
    position: relative;
}

.sibling-row {
    align-items: flex-start;
}

.sibling-branch.is-expanded {
    margin-inline: 90px;
}

.sibling-branch.is-expanded .sibling-person-card {
    width: var(--sibling-card-width);
    margin: 0 auto;
}

.sibling-inline-tree {
    position: relative;
    width: 356px;
    margin-top: 28px;
    margin-left: 50%;
    transform: translateX(-50%);
}

.sibling-inline-tree::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -28px;
    width: 2px;
    height: 28px;
    transform: translateX(-50%);
    background: #a9c1b7;
}

.sibling-inline-family {
    position: relative;
    padding-top: 10px;
}

.sibling-inline-family + .sibling-inline-family {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed #dce6e1;
}

.sibling-inline-label {
    width: max-content;
    max-width: 300px;
    margin: 0 auto 12px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f3f8f5;
    color: #65756f;
    font-size: 0.62rem;
    font-weight: 750;
    line-height: 1.3;
    text-align: center;
}

.sibling-inline-children {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-top: 15px;
}

.sibling-inline-children::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: #b7cbc2;
}

.sibling-inline-child-node {
    position: relative;
    min-width: 0;
}

.sibling-inline-child-node::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 2px;
    height: 10px;
    transform: translateX(-50%);
    background: #b7cbc2;
}

.sibling-inline-child-node .compact-person-button {
    width: 100%;
    min-height: 60px;
}

/* The old centred panel is intentionally retired. */
.relative-family-panel {
    display: none !important;
}

@media (max-width: 700px) {
    .sibling-branch.is-expanded {
        margin-inline: 72px;
    }

    .sibling-inline-tree {
        width: 308px;
    }

    .sibling-inline-label {
        max-width: 270px;
    }

    .sibling-inline-children {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .sibling-inline-child-node .compact-person-button {
        min-height: 58px;
    }
}


/* Sibling context v4 — integrated family branches */
.sibling-branch.is-expanded {
    margin-inline: 0;
}

.sibling-branch.has-inline-family {
    flex: 0 0 auto;
    width: max-content;
    min-width: var(--sibling-card-width);
}

.sibling-branch.has-inline-family .sibling-person-card {
    width: var(--sibling-card-width);
    margin: 0 auto;
}

.inline-family-tree {
    position: relative;
    margin-top: 28px;
    margin-left: 50%;
    transform: translateX(-50%);
}

.inline-family-tree::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -28px;
    width: 2px;
    height: 28px;
    transform: translateX(-50%);
    background: #a9c1b7;
}

.inline-family-tree.is-primary {
    width: 500px;
}

.inline-family-tree.is-side {
    width: 420px;
}

.inline-family-title {
    width: max-content;
    margin: 0 auto 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eaf5ef;
    color: #215b49;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.inline-family-units {
    display: grid;
    gap: 12px;
}

.inline-family-unit {
    min-width: 0;
    padding: 10px 12px 12px;
    border: 1px solid #dce6e1;
    border-radius: 14px;
    background: rgba(250, 252, 251, 0.96);
    box-shadow:
        0 4px 14px rgba(24, 49, 41, 0.035);
}

.inline-family-tree.is-primary .inline-family-unit {
    border-color: #cfddd7;
    background: rgba(249, 252, 250, 0.98);
}

.inline-family-unit-label {
    width: max-content;
    margin: 0 auto 8px;
    color: #6a7872;
    font-size: 0.61rem;
    font-weight: 780;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.inline-family-parent-node {
    display: flex;
    justify-content: center;
}

.inline-family-parent-node .compact-person-button,
.inline-family-parent-node .compact-missing-person {
    width: 150px;
}

.compact-missing-person {
    display: grid;
    width: 150px;
    min-height: 56px;
    place-items: center;
    padding: 8px 9px;
    border: 1px dashed #d5dfda;
    border-radius: 10px;
    background: #fafbfb;
    color: #78847f;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.inline-family-connector {
    width: 2px;
    height: 18px;
    margin: 0 auto;
    background: #b2c7be;
}

.inline-family-children {
    position: relative;
    display: grid;
    grid-template-columns:
        repeat(
            var(--child-columns),
            minmax(0, 1fr)
        );
    gap: 8px;
    padding-top: 14px;
}

.inline-family-children::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 64px;
    right: 64px;
    height: 2px;
    background: #b7cbc2;
}

.inline-family-child-node {
    position: relative;
    min-width: 0;
}

.inline-family-child-node::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 2px;
    height: 10px;
    transform: translateX(-50%);
    background: #b7cbc2;
}

.inline-family-child-node .compact-person-button {
    width: 100%;
    min-height: 58px;
}

.inline-family-empty {
    margin: 9px 0 0;
    color: #7b8782;
    font-size: 0.62rem;
    font-weight: 650;
    text-align: center;
}

/*
 * V3 rendered only side branches inline and then placed the
 * selected family as a second block below the entire sibling row.
 * V4 keeps the selected family in its own sibling branch instead.
 */
.sibling-inline-tree {
    display: none !important;
}

@media (max-width: 700px) {
    .inline-family-tree.is-primary,
    .inline-family-tree.is-side {
        width: 318px;
    }

    .inline-family-children {
        grid-template-columns:
            repeat(
                min(
                    var(--child-columns),
                    2
                ),
                minmax(0, 1fr)
            );
    }

    .inline-family-children::before {
        left: 62px;
        right: 62px;
    }

    .inline-family-parent-node .compact-person-button,
    .inline-family-parent-node .compact-missing-person {
        width: 144px;
    }
}

/* Family-unit intrinsic sizing */
/*
 * Each family unit sizes itself from its own spouse/child content.
 * A one-child second marriage therefore stays compact instead of
 * stretching to the width needed by a larger first family.
 */
.inline-family-units {
    align-items: center;
}

.inline-family-unit {
    width: fit-content;
    min-width: 174px;
    max-width: 100%;
    margin-inline: auto;
}

.inline-family-children {
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
    grid-template-columns:
        repeat(
            var(--child-columns),
            112px
        );
    justify-content: center;
}

.inline-family-child-node {
    width: 112px;
}

.inline-family-child-node .compact-person-button {
    width: 112px;
}

/*
 * A single child only needs the vertical connector.
 * Do not draw an unnecessary full horizontal sibling bar.
 */
.inline-family-children:has(
    > .inline-family-child-node:only-child
)::before {
    display: none;
}

@media (max-width: 700px) {
    .inline-family-unit {
        min-width: 168px;
    }

    .inline-family-children {
        grid-template-columns:
            repeat(
                min(
                    var(--child-columns),
                    2
                ),
                132px
            );
    }

    .inline-family-child-node,
    .inline-family-child-node .compact-person-button {
        width: 132px;
    }
}

/* List / Tree view switch */
.tree-view-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: max-content;
    margin: 7px auto 0;
    padding: 3px;
    border: 1px solid #d3ddd8;
    border-radius: 10px;
    background: #f4f7f5;
}

.tree-view-button {
    min-width: 66px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #66746e;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.tree-view-button:hover,
.tree-view-button:focus-visible {
    outline: none;
    color: #184f40;
    background: #eaf3ef;
}

.tree-view-button.is-active {
    background: #fff;
    color: #184f40;
    box-shadow:
        0 1px 3px rgba(24, 49, 41, 0.10);
}

.tree-app.is-list-mode #zoom-out,
.tree-app.is-list-mode #centre-tree,
.tree-app.is-list-mode #zoom-in {
    display: none;
}

.tree-app.is-list-mode .tree-help {
    display: none;
}

.tree-viewport.is-list-mode {
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    cursor: default;
    overscroll-behavior: contain;
    background:
        linear-gradient(
            180deg,
            rgba(245, 249, 247, 0.96),
            rgba(248, 250, 249, 0.98)
        );
}

.tree-app.is-list-mode .tree-stage {
    position: static;
    inset: auto;
    width: 100%;
    min-height: 100%;
    transform: none !important;
    will-change: auto;
}

.tree-app.is-list-mode .tree-content {
    width: 100%;
    min-width: 0;
    padding: 24px 18px 42px;
    user-select: auto;
}

.family-list-content {
    width: min(780px, 100%);
    margin: 0 auto;
}

.family-list-focus,
.family-list-section {
    border: 1px solid #dbe4e0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
        0 1px 2px rgba(24, 49, 41, 0.03),
        0 8px 24px rgba(24, 49, 41, 0.035);
}

.family-list-focus {
    padding: 20px;
    border-color: #9cbcae;
}

.family-list-focus h2 {
    margin: 0;
    color: #17372d;
    font-size: 1.25rem;
    line-height: 1.2;
}

.family-list-focus-meta {
    margin: 6px 0 0;
    color: #6f7d77;
    font-size: 0.78rem;
    font-weight: 650;
}

.family-list-focus-details {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    margin-top: 14px;
    padding: 7px 12px;
    border-radius: 9px;
    background: #eaf4ef;
    color: #1e5a48;
    font-size: 0.74rem;
    font-weight: 800;
    text-decoration: none;
}

.family-list-section {
    margin-top: 14px;
    padding: 18px;
}

.family-list-section-heading {
    margin-bottom: 12px;
}

.family-list-section-heading h2 {
    margin: 0;
    color: #1b3028;
    font-size: 1rem;
}

.family-list-eyebrow {
    margin: 0 0 4px;
    color: #77857f;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.family-list-stack {
    display: grid;
    gap: 8px;
}

.family-list-person {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid #e0e7e3;
    border-radius: 11px;
    background: #fbfcfc;
}

.family-list-person.is-selected {
    border-color: #83aa9b;
    box-shadow:
        0 0 0 2px rgba(131, 170, 155, 0.12);
}

.family-list-person.is-missing {
    border-style: dashed;
    background: #fafbfb;
}

.family-list-person-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 11px 13px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

button.family-list-person-main {
    cursor: pointer;
}

button.family-list-person-main:hover,
button.family-list-person-main:focus-visible {
    outline: none;
    background: #f1f8f5;
}

.family-list-relationship {
    margin-bottom: 3px;
    color: #7a8782;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.family-list-person-name {
    color: #18503f;
    font-size: 0.82rem;
    line-height: 1.25;
}

.family-list-person-meta {
    margin-top: 4px;
    color: #74817c;
    font-size: 0.68rem;
    font-weight: 620;
    line-height: 1.3;
}

.family-list-details {
    display: grid;
    min-width: 72px;
    place-items: center;
    padding: 8px 11px;
    border-left: 1px solid #e6ebe8;
    color: #5d6c66;
    font-size: 0.7rem;
    font-weight: 760;
    text-decoration: none;
}

.family-list-details:hover,
.family-list-details:focus-visible {
    outline: none;
    background: #eef6f2;
    color: #184f40;
}

.family-list-family-stack {
    display: grid;
    gap: 12px;
}

.family-list-family {
    padding: 14px;
    border: 1px solid #dfe7e3;
    border-radius: 13px;
    background: #fafcfb;
}

.family-list-family-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.family-list-family-heading h3 {
    margin: 0;
    color: #29443a;
    font-size: 0.86rem;
}

.family-list-count {
    padding: 4px 8px;
    border-radius: 999px;
    background: #eaf3ef;
    color: #41695b;
    font-size: 0.64rem;
    font-weight: 780;
    white-space: nowrap;
}

.family-list-children-heading {
    margin: 14px 2px 7px;
    color: #67756f;
    font-size: 0.7rem;
    font-weight: 780;
}

.family-list-children {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style-position: inside;
}

.family-list-children > li::marker {
    color: #87938e;
    font-size: 0.72rem;
    font-weight: 750;
}

.family-list-empty {
    margin: 0;
    padding: 12px 2px;
    color: #7a8681;
    font-size: 0.76rem;
}

@media (max-width: 700px) {
    .tree-view-switch {
        margin-top: 6px;
    }

    .tree-view-button {
        min-width: 72px;
        height: 32px;
    }

    .tree-app.is-list-mode .tree-content {
        padding: 14px 10px 30px;
    }

    .family-list-focus {
        padding: 16px;
    }

    .family-list-section {
        padding: 14px;
        border-radius: 14px;
    }

    .family-list-person {
        grid-template-columns: minmax(0, 1fr) 62px;
    }

    .family-list-person-main {
        min-height: 62px;
    }

    .family-list-details {
        min-width: 62px;
        padding-inline: 8px;
    }
}

/* Public share action */
.tree-share-row {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 5px;
}

.tree-share-button {
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid #cedbd5;
    border-radius: 9px;
    background: #fff;
    color: #255b49;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.tree-share-button:hover,
.tree-share-button:focus-visible {
    outline: none;
    border-color: #8db0a2;
    background: #edf6f1;
}

.tree-share-feedback {
    color: #61716a;
    font-size: 0.68rem;
    font-weight: 700;
}

@media (max-width: 700px) {
    .tree-share-row {
        margin-top: 4px;
    }

    .tree-share-button {
        min-height: 34px;
        padding-inline: 14px;
    }
}

/* Full focused-tree PNG export */
.tree-export-button {
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid #cedbd5;
    border-radius: 9px;
    background: #fff;
    color: #255b49;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.tree-export-button:hover,
.tree-export-button:focus-visible {
    outline: none;
    border-color: #8db0a2;
    background: #edf6f1;
}

.tree-export-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.tree-app.is-list-mode .tree-export-button {
    display: none;
}

@media (max-width: 700px) {
    .tree-export-button {
        min-height: 34px;
        padding-inline: 14px;
    }
}


/* Three-generation export-only document */
.three-gen-export-document {
    line-height: 1.25;
}

.three-gen-export-heading {
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 1px solid #dbe5e1;
}

.three-gen-export-eyebrow {
    color: #71807a;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.three-gen-export-heading h1 {
    margin: 5px 0 0;
    color: #17372d;
    font-size: 26px;
    line-height: 1.1;
}

.three-gen-section-label {
    margin: 0 0 10px;
    color: #6f7d77;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.three-gen-top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.three-gen-top-row {
    display: flex;
    justify-content: center;
    gap: 14px;
}

.three-gen-trunk {
    width: 2px;
    height: 28px;
    margin: 0 auto 8px;
    background: #a9c2b8;
}

.three-gen-branches {
    display: grid;
    align-items: start;
    gap: 16px;
}

.three-gen-branch {
    min-width: 0;
    padding: 14px;
    border: 1px solid #d7e3de;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.76);
}

.three-gen-branch-person {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.three-gen-person-card {
    display: flex;
    min-width: 0;
    width: 190px;
    min-height: 72px;
    box-sizing: border-box;
    flex-direction: column;
    justify-content: center;
    padding: 12px 14px;
    border: 1px solid #cedbd5;
    border-radius: 11px;
    background: #fff;
}

.three-gen-person-card.is-compact {
    width: 100%;
    min-height: 60px;
    padding: 10px 11px;
}

.three-gen-person-card.is-missing {
    border-style: dashed;
    background: #fbfcfc;
}

.three-gen-person-name {
    color: #18503f;
    font-size: 13px;
    line-height: 1.22;
}

.three-gen-person-card.is-missing .three-gen-person-name {
    color: #6f7d77;
}

.three-gen-person-meta {
    margin-top: 5px;
    color: #74817c;
    font-size: 10px;
    font-weight: 650;
}

.three-gen-family-stack {
    display: grid;
    gap: 10px;
}

.three-gen-family-unit {
    min-width: 0;
    padding: 10px;
    border: 1px solid #e0e8e4;
    border-radius: 11px;
    background: #f9fbfa;
}

.three-gen-family-label {
    margin: 0 0 7px;
    color: #78857f;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.three-gen-other-parent {
    display: flex;
    justify-content: center;
}

.three-gen-family-connector {
    width: 2px;
    height: 14px;
    margin: 0 auto;
    background: #aec7bd;
}

.three-gen-grandchildren {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.three-gen-empty {
    margin: 8px 0 0;
    color: #84908b;
    font-size: 10px;
    font-weight: 650;
    text-align: center;
}

.tree-share-row {
    flex-wrap: wrap;
}

/* Adaptive three-generation export layout.
   Later rules intentionally override the first-pass export styles. */

.three-gen-sibling-rows {
    display: grid;
    gap: 28px;
}

.three-gen-sibling-row {
    position: relative;
    padding-top: 14px;
}

.three-gen-sibling-line {
    position: absolute;
    top: 0;
    left: 9%;
    right: 9%;
    height: 2px;
    background: #adc6bc;
}

.three-gen-sibling-row.is-single
.three-gen-sibling-line {
    left: 50%;
    right: auto;
    width: 2px;
    height: 14px;
}

.three-gen-branches {
    display: grid;
    align-items: start;
    gap: 18px;
}

.three-gen-branch-wrapper {
    position: relative;
    min-width: 0;
    padding-top: 14px;
}

.three-gen-branch-drop {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 14px;
    background: #adc6bc;
    transform: translateX(-1px);
}

.three-gen-branch {
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.three-gen-branch.is-without-family {
    display: flex;
    justify-content: center;
}

.three-gen-branch.is-without-family
.three-gen-person-card {
    width: min(210px, 100%);
}

.three-gen-family-stack {
    display: grid;
    gap: 12px;
}

.three-gen-family-unit {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d9e4df;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.three-gen-family-label {
    margin-bottom: 8px;
}

.three-gen-couple-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}

.three-gen-couple-row
.three-gen-person-card {
    width: 100%;
    min-height: 62px;
}

.three-gen-couple-join {
    position: relative;
    width: 2px;
    height: 16px;
    margin: 0 auto;
    background: #adc6bc;
}

.three-gen-couple-join::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 48px;
    height: 2px;
    background: #adc6bc;
    transform: translateX(-50%);
}

.three-gen-grandchildren {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.three-gen-grandchildren
.three-gen-person-card {
    flex: 0 1 126px;
    width: 126px;
    min-height: 58px;
}

.three-gen-empty {
    margin: 5px 0 0;
    font-size: 9px;
}

/* A branch with no FamilyUnits is just a person card.
   Do not create a dashboard-style empty family panel. */
.three-gen-branch.is-without-family
.three-gen-empty {
    display: none;
}

/* Three-generation visual hierarchy refinement.
   Keep Generation 2 parents visually distinct from Generation 3 children. */

.three-gen-sibling-rows {
    gap: 38px;
}

.three-gen-family-stack {
    gap: 20px;
}

.three-gen-family-unit {
    padding: 16px 14px 18px;
}

.three-gen-couple-row {
    gap: 12px;
}

.three-gen-couple-row
.three-gen-person-card {
    min-height: 74px;
    padding: 12px 13px;
}

.three-gen-couple-row
.three-gen-person-name {
    font-size: 13px;
    line-height: 1.22;
}

.three-gen-couple-row
.three-gen-person-meta {
    margin-top: 6px;
    font-size: 10px;
}

/*
 * Give the parent couple a proper visual break before their children.
 * This restores the parent -> child hierarchy that is clear in the
 * current-family PNG but became too compressed in the adaptive export.
 */
.three-gen-couple-join {
    height: 30px;
    margin: 0 auto 12px;
}

.three-gen-couple-join::before {
    width: 62px;
}

/*
 * Generation 3 is intentionally smaller and sits below a clear
 * sibling rail. The rail plus extra whitespace makes it obvious
 * that these cards are children of the couple above.
 */
.three-gen-grandchildren {
    position: relative;
    gap: 10px;
    padding-top: 18px;
}

.three-gen-grandchildren::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #adc6bc;
}

.three-gen-grandchildren
.three-gen-person-card {
    flex: 0 1 116px;
    width: 116px;
    min-height: 52px;
    padding: 8px 9px;
}

.three-gen-grandchildren
.three-gen-person-name {
    font-size: 11px;
    line-height: 1.2;
}

.three-gen-grandchildren
.three-gen-person-meta {
    margin-top: 4px;
    font-size: 9px;
}

/* Multiple families need a visible pause between family groups. */
.three-gen-family-unit
+ .three-gen-family-unit {
    margin-top: 4px;
}

/* A Generation-2 person with no family remains a full parent-level card. */
.three-gen-branch.is-without-family
.three-gen-person-card {
    min-height: 72px;
}

/* V1 public tree UX polish - 2026-10-05 */

.v1-public-tree-polish .v1-tree-action,
.v1-public-tree-polish .v1-tree-nav-action {
    min-height: 42px;
}

.v1-public-tree-polish .v1-tree-action:focus-visible,
.v1-public-tree-polish .v1-tree-nav-action:focus-visible,
.v1-public-tree-polish .v1-view-tree:focus-visible,
.v1-public-tree-polish .v1-view-list:focus-visible,
.v1-public-tree-polish .v1-tree-search-input:focus-visible {
    outline: 3px solid #17372d;
    outline-offset: 3px;
}

.v1-three-generation-export .v1-export-section-label {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    max-width: 100%;
    margin-inline: auto !important;
    padding: 7px 14px !important;
    border-radius: 999px !important;
    background: #edf6f1 !important;
    color: #315f50 !important;
    font-weight: 800 !important;
    letter-spacing: 0.08em !important;
    line-height: 1.2 !important;
}

.v1-three-generation-export .v1-export-reading-guide {
    margin: 8px 0 28px !important;
    color: #65776f !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
}

@media (max-width: 640px) {
    .v1-public-tree-polish .v1-tree-page-title {
        margin-block: 0 8px !important;
        font-size: 1.05rem !important;
        line-height: 1.25 !important;
    }

    .v1-public-tree-polish .v1-tree-primary-toolbar {
        gap: 8px !important;
    }

    .v1-public-tree-polish .v1-tree-search-wrap {
        width: 100% !important;
        margin-block: 0 !important;
    }

    .v1-public-tree-polish .v1-tree-search-input {
        min-height: 44px !important;
        font-size: 16px !important;
    }

    .v1-public-tree-polish .v1-tree-nav-controls {
        display: grid !important;
        grid-template-columns: 44px minmax(92px, 1fr) 44px minmax(72px, 0.8fr) !important;
        gap: 6px !important;
        width: 100% !important;
        align-items: stretch !important;
    }

    .v1-public-tree-polish .v1-tree-nav-controls .v1-tree-nav-action {
        min-width: 0 !important;
        min-height: 44px !important;
        padding: 8px 10px !important;
        white-space: nowrap !important;
    }

    .v1-public-tree-polish .v1-tree-view-switch {
        min-height: 44px !important;
    }

    .v1-public-tree-polish .v1-tree-download-actions {
        display: grid !important;
        grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
        align-items: stretch !important;
    }

    .v1-public-tree-polish .v1-tree-download-actions .v1-tree-action {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 0 !important;
        min-height: 48px !important;
        padding: 7px 8px !important;
        white-space: normal !important;
        text-align: center !important;
        font-size: 0.75rem !important;
        line-height: 1.18 !important;
    }

    .v1-public-tree-polish .v1-share-action {
        font-size: 0.78rem !important;
    }
}

@media (max-width: 370px) {
    .v1-public-tree-polish .v1-tree-download-actions {
        grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr) !important;
    }

    .v1-public-tree-polish .v1-tree-download-actions .v1-tree-action {
        padding-inline: 5px !important;
        font-size: 0.7rem !important;
    }
}

/* V1 structural public tree UX - 2026-10-06
   Exact-state pass based on commit 5047996. */

/* Search stays discoverable; view navigation and one-shot actions share a row. */
.tree-search-shell {
    z-index: 30;
}

.tree-action-bar {
    display: flex;
    width: min(1040px, 100%);
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 8px auto 0;
}

.tree-action-navigation {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.tree-action-bar .tree-view-switch {
    margin: 0;
}

.tree-desktop-actions {
    min-height: 44px;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
}

.tree-desktop-actions .tree-share-button,
.tree-desktop-actions .tree-export-button,
.tree-list-root-button,
.tree-more-button {
    min-height: 44px;
}

.tree-list-root-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid #cad8d2;
    border-radius: 10px;
    background: #ffffff;
    color: #245c49;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.tree-list-root-button:hover,
.tree-list-root-button:focus-visible {
    border-color: #8eafa2;
    outline: none;
    background: #edf6f1;
}

.tree-more-button {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 78px;
    padding: 8px 11px;
    border: 1px solid #cad8d2;
    border-radius: 10px;
    background: #ffffff;
    color: #245c49;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
}

.tree-more-button:hover,
.tree-more-button:focus-visible {
    border-color: #8eafa2;
    outline: none;
    background: #edf6f1;
}

.tree-orientation {
    display: flex;
    width: min(680px, 100%);
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 7px auto 0;
    color: #6e7b76;
    font-size: 0.68rem;
}

.tree-orientation-label {
    font-weight: 700;
}

.tree-orientation-recentre {
    display: inline-flex;
    min-width: 0;
    min-height: 32px;
    align-items: center;
    gap: 8px;
    padding: 5px 9px;
    border: 0;
    border-radius: 9px;
    background: #edf5f1;
    color: #275d4c;
    cursor: pointer;
}

.tree-orientation-recentre strong {
    max-width: min(360px, 48vw);
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-orientation-recentre span {
    color: #5e756c;
    font-size: 0.64rem;
    font-weight: 750;
}

.tree-orientation-recentre:hover,
.tree-orientation-recentre:focus-visible {
    outline: 2px solid #8eafa2;
    outline-offset: 2px;
    background: #e5f1eb;
}

.tree-share-feedback {
    display: block;
    width: min(680px, 100%);
    min-height: 0;
    margin: 4px auto 0;
    text-align: center;
}


.tree-list-root-button[hidden],
.tree-orientation[hidden],
.tree-action-sheet-divider[hidden],
.tree-action-sheet-item[hidden] {
    display: none !important;
}

/* List navigation belongs with the view controls, not in the top-right tree tools. */
.tree-app.is-list-mode .tree-controls {
    display: none;
}

.tree-app.is-list-mode .tree-export-button {
    display: none;
}

/* Mobile More uses a thumb-reachable bottom sheet. */
.tree-action-sheet[hidden] {
    display: none !important;
}

.tree-action-sheet {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: grid;
    align-items: end;
}

.tree-action-sheet-backdrop {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(18, 31, 26, 0.38);
    cursor: default;
}

.tree-action-sheet-panel {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: min(78vh, 620px);
    margin: 0 auto;
    overflow-y: auto;
    padding: 8px 14px max(18px, env(safe-area-inset-bottom));
    border: 1px solid #d5dfda;
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    outline: none;
    background: #ffffff;
    box-shadow: 0 -16px 44px rgba(20, 45, 36, 0.18);
}

.tree-action-sheet-handle {
    width: 42px;
    height: 4px;
    margin: 3px auto 10px;
    border-radius: 999px;
    background: #cad7d1;
}

.tree-action-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px 8px;
}

.tree-action-sheet-header h2 {
    margin: 0;
    color: #1d352d;
    font-size: 1rem;
}

.tree-action-sheet-close {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #f2f6f4;
    color: #4e655d;
    font-size: 1.25rem;
    cursor: pointer;
}

.tree-action-sheet-item {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #173f33;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 780;
    text-align: left;
    cursor: pointer;
}

.tree-action-sheet-item + .tree-action-sheet-item {
    margin-top: 8px;
}

.tree-action-sheet-item:hover,
.tree-action-sheet-item:focus-visible,
.tree-action-sheet-close:hover,
.tree-action-sheet-close:focus-visible {
    outline: none;
    background: #edf6f1;
}

.tree-action-sheet-item:focus-visible,
.tree-action-sheet-close:focus-visible {
    box-shadow: inset 0 0 0 2px #6e9e8d;
}

.tree-action-sheet-divider {
    height: 1px;
    margin: 9px 4px;
    background: #e2e9e6;
}

/* Relationship rails: quiet structure, strong cards. */
.tree-connector,
.children-connector,
.inline-family-connector,
.inline-family-tree::before,
.inline-family-children::before,
.inline-family-child-node::before {
    background: #bdcbc5;
}

.tree-connector,
.children-connector,
.inline-family-connector,
.inline-family-tree::before,
.inline-family-child-node::before {
    width: 1px;
}

.inline-family-children::before {
    height: 1px;
}

.parent-couple-row {
    gap: 0;
}

.parent-union-link {
    width: 38px;
    height: 1px;
    flex: 0 0 38px;
    background: #b8c7c0;
}

.sibling-row {
    gap: 14px;
    padding-top: 26px;
}

.sibling-branch:not(.sibling-balance)::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: -15px;
    left: 50%;
    width: 1px;
    height: 15px;
    transform: translateX(-50%);
    background: #bdcbc5;
}

.sibling-branch:not(.sibling-balance)::after {
    content: "";
    position: absolute;
    z-index: 0;
    top: -15px;
    left: -7px;
    right: -7px;
    height: 1px;
    background: #bdcbc5;
}

.sibling-branch.is-first-visible::after {
    left: 50%;
}

.sibling-branch.is-last-visible::after {
    right: 50%;
}

.sibling-branch.is-first-visible.is-last-visible::after {
    display: none;
}

.sibling-person-card {
    z-index: 1;
}

.branch-continues {
    display: none !important;
}

.relationship-children-row {
    position: relative;
    align-items: flex-start;
    padding-top: 18px;
}

.children-branch {
    position: relative;
    flex: 0 0 auto;
}

.children-branch::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: -18px;
    left: 50%;
    width: 1px;
    height: 18px;
    transform: translateX(-50%);
    background: #bdcbc5;
}

.children-branch::after {
    content: "";
    position: absolute;
    z-index: 0;
    top: -18px;
    left: -5px;
    right: -5px;
    height: 1px;
    background: #bdcbc5;
}

.children-branch.is-first-child::after {
    left: 50%;
}

.children-branch.is-last-child::after {
    right: 50%;
}

.children-branch.is-first-child.is-last-child::after {
    display: none;
}

.children-branch > .person-card {
    position: relative;
    z-index: 1;
}

.couple-row.has-external-spouse .couple-link {
    height: 0;
    background: transparent;
    border-top: 1px dashed #a9bbb3;
}

/* The selected person needs both border weight and fill; do not rely on colour alone. */
.person-card.is-focus {
    border: 3px solid #4d8774;
    background: #f0f8f4;
    box-shadow:
        0 0 0 3px rgba(77, 135, 116, 0.12),
        0 10px 28px rgba(21, 42, 34, 0.08);
}

.sibling-person-card.is-selected {
    border: 3px solid #4d8774;
    background: #f0f8f4;
    box-shadow:
        0 0 0 3px rgba(77, 135, 116, 0.12),
        0 8px 22px rgba(21, 42, 34, 0.08);
}

@media (max-width: 640px) {
    .tree-search-shell {
        padding: 8px 10px 9px;
    }

    .tree-action-bar {
        gap: 7px;
        margin-top: 7px;
    }

    .tree-action-navigation {
        flex: 1 1 auto;
        gap: 6px;
    }

    .tree-action-bar .tree-view-switch {
        flex: 1 1 auto;
        width: auto !important;
        max-width: none !important;
        min-height: 44px !important;
    }

    .tree-view-button {
        flex: 1 1 0;
        min-width: 0;
        min-height: 38px;
    }

    .tree-list-root-button {
        min-height: 44px;
        padding-inline: 10px;
        font-size: 0.69rem;
    }

    .tree-desktop-actions,
    .v1-public-tree-polish .tree-desktop-actions.v1-tree-download-actions {
        display: none !important;
    }

    .tree-more-button {
        display: inline-flex;
        flex: 0 0 auto;
        min-width: 72px;
        min-height: 44px;
    }

    .tree-orientation {
        justify-content: flex-start;
        margin-top: 6px;
    }

    .tree-orientation-recentre {
        flex: 1 1 auto;
        justify-content: space-between;
    }

    .tree-orientation-recentre strong {
        max-width: min(230px, 52vw);
    }

    .tree-share-feedback {
        font-size: 0.64rem;
    }

    .parent-union-link {
        width: 22px;
        flex-basis: 22px;
    }

    .sibling-row {
        gap: 10px;
        padding-top: 24px;
    }

    .sibling-branch:not(.sibling-balance)::before {
        top: -14px;
        height: 14px;
    }

    .sibling-branch:not(.sibling-balance)::after {
        top: -14px;
        left: -5px;
        right: -5px;
    }
}

@media (max-width: 370px) {
    .tree-action-bar {
        gap: 5px;
    }

    .tree-action-navigation {
        gap: 5px;
    }

    .tree-list-root-button {
        padding-inline: 8px;
        font-size: 0.66rem;
    }

    .tree-more-button {
        min-width: 66px;
        padding-inline: 8px;
        font-size: 0.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tree-action-sheet-panel {
        scroll-behavior: auto;
    }
}


/* Public Tree V3 shared visual system - 2026-10-08
   One relationship language now serves live browsing, current-view export,
   and ranked 3/4-generation charts.  The List view is intentionally left
   alone. */

/* The live canvas should feel like a family chart rather than graph paper. */
.tree-viewport:not(.is-list-mode) {
    background: #f6f1e7;
}

.tree-content > div {
    position: relative;
}

.tree-content > div > .tree-section,
.tree-content > div > .tree-connector {
    position: relative;
    z-index: 1;
}

/* Shared real-person card treatment. */
.person-card,
.sibling-person-card,
.compact-person-button {
    border-color: #d7d7c9;
    background: #fffdf7;
    box-shadow: 0 5px 16px rgba(35, 57, 48, 0.055);
}

.person-card:not(.is-missing):hover,
.person-card:not(.is-missing):focus-within,
.sibling-person-card:hover,
.sibling-person-card:focus-within,
.compact-person-button:hover,
.compact-person-button:focus-visible {
    border-color: #9ab7aa;
    background: #fffef9;
}

/* Missing people are absence-of-data placeholders, not ordinary people. */
.person-card.is-missing,
.compact-missing-person {
    border: 1.5px dashed #b9c2bc;
    background: #f8f5ee;
    color: #7b837e;
    box-shadow: none;
}

.person-card.is-missing .missing-parent-text {
    color: #7b837e;
}

/* Strong, consistent selected-person language. */
.person-card.is-focus,
.sibling-person-card.is-selected {
    border: 3px solid #4d8774;
    background: #f0f8f4;
    box-shadow:
        0 0 0 3px rgba(77, 135, 116, 0.09),
        0 7px 20px rgba(31, 75, 60, 0.09);
}

.selected-branch-badge {
    background: #dfeee7;
    color: #245f4d;
}

.tree-section-label,
.inline-family-title {
    color: #61716a;
    letter-spacing: 0.12em;
}

/* Expanded/selected family panels must participate in sibling-row layout.
   JS measures the rendered inline family (including the mobile breakpoint) and
   writes --inline-family-footprint before connector geometry is drawn. */
.sibling-branch.has-inline-family {
    flex: 0 0 var(
        --inline-family-footprint,
        var(--sibling-card-width)
    );
    width: var(
        --inline-family-footprint,
        var(--sibling-card-width)
    );
    min-width: var(
        --inline-family-footprint,
        var(--sibling-card-width)
    );
}

.sibling-branch.has-inline-family .sibling-person-card {
    margin-inline: auto;
}

.sibling-branch.has-inline-family .inline-family-tree {
    overflow: visible;
}

.sibling-row {
    gap: 10px;
}

.inline-family-tree.is-primary {
    width: 540px;
}

.inline-family-tree.is-side {
    width: 410px;
}

.inline-family-tree::before {
    display: none;
}

.inline-family-unit {
    border-color: #d8ded8;
    background: #fffdf8;
    box-shadow: 0 5px 16px rgba(35, 57, 48, 0.045);
}

.inline-family-tree.is-primary .inline-family-unit {
    border-color: #cbd9d2;
    background: #fffdf8;
}

.inline-family-parent-node .compact-missing-person {
    background: #f8f5ee;
}

/* Measured SVG stem from a sibling card into its own family cluster. */
.live-family-connector-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.live-family-connector-path {
    fill: none;
    stroke: #a9b8b1;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.live-family-connector-path.is-selected {
    stroke: #6f9d8b;
    stroke-width: 2.25;
}

/* Simplified sibling footers: a relative either exposes children, or the
   selected person exposes a small profile affordance. */
.sibling-card-footer {
    min-height: 30px;
    gap: 8px;
    justify-content: center;
}

.relative-branch-toggle,
.sibling-details {
    min-height: 28px;
    padding-inline: 9px;
    border-radius: 999px;
}

.sibling-details {
    color: #507166;
    font-weight: 700;
}

.tree-action-bar {
    width: min(1220px, 100%);
}

.tree-desktop-actions {
    flex-wrap: wrap;
}

.tree-orientation {
    display: none !important;
}

/* Current-view PNG keeps the measured-bounds solution, but inherits the same
   warm card language and uses slightly tighter safety margins. */
.tree-export-frame {
    position: relative;
    overflow: visible;
}

.tree-export-document {
    background: #f7f2e8 !important;
}

.tree-export-document .sibling-row {
    gap: 8px;
}

/* Keep live intrinsic family sizing in the export clone too. A fixed export
   panel width can be narrower than a six-child row. */

/* Ranked static family charts.  The graph is built completely within the
   bounded generation window before any node is positioned. */
.family-chart-export-document {
    box-sizing: border-box;
    padding: 32px 36px 42px;
    background: #f7f2e8;
    color: #17372d;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.25;
}

.family-chart-heading {
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid #d8ddd7;
}

.family-chart-eyebrow {
    color: #6f7a74;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.13em;
}

.family-chart-heading h1 {
    margin: 5px 0 0;
    color: #17372d;
    font-size: 30px;
    line-height: 1.08;
}

.family-chart-subtitle {
    margin: 6px 0 0;
    color: #68756f;
    font-size: 14px;
    font-weight: 750;
}

.family-chart-canvas {
    position: relative;
    overflow: visible;
}

.family-chart-lines,
.family-chart-nodes {
    position: absolute;
    inset: 0 auto auto 0;
}

.family-chart-lines {
    z-index: 0;
    overflow: visible;
    pointer-events: none;
}

.family-chart-nodes {
    z-index: 2;
}

.family-chart-rank-label {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid #d5dfd9;
    border-radius: 999px;
    background: #eaf2ed;
    color: #385f52;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.family-chart-node {
    position: absolute;
    box-sizing: border-box;
    width: var(--family-chart-card-width);
    overflow: visible;
    border: 1px solid #cfd5cf;
    border-radius: 12px;
    background: #fffdf7;
    color: #17372d;
    box-shadow: 0 5px 15px rgba(35, 57, 48, 0.065);
}

.family-chart-node.is-selected {
    border: 3px solid #4d8774;
    background: #f0f8f4;
    box-shadow:
        0 0 0 3px rgba(77, 135, 116, 0.10),
        0 7px 18px rgba(31, 75, 60, 0.10);
}

.family-chart-selected-pill {
    position: absolute;
    top: -12px;
    right: 10px;
    z-index: 3;
    padding: 4px 8px;
    border-radius: 999px;
    background: #dcece5;
    color: #245f4d;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.family-chart-person {
    display: flex;
    min-height: 66px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 11px 13px;
}

.family-chart-person-name {
    overflow-wrap: normal;
    word-break: normal;
    color: #174f40;
    font-size: 15px;
    font-weight: 850;
    line-height: 1.14;
}

.family-chart-person-meta {
    color: #6d7872;
    font-size: 10px;
    font-weight: 700;
}

.family-chart-families {
    border-top: 1px solid #e1e5e0;
}

.family-chart-family-row {
    display: grid;
    gap: 2px;
    min-height: 46px;
    align-content: center;
    padding: 7px 11px;
    border-bottom: 1px solid #eceeea;
    background: #fbfaf5;
}

.family-chart-family-row:last-child {
    border-bottom: 0;
    border-radius: 0 0 11px 11px;
}

.family-chart-family-row.is-external {
    border-left: 3px dashed #9fb2a9;
    background: #faf8f2;
}

.family-chart-family-row.is-missing {
    border-left: 2px dashed #b9c2bc;
    background: #f8f5ee;
}

.family-chart-family-number {
    color: #718078;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.family-chart-family-role {
    color: #7b847f;
    font-size: 8px;
    font-weight: 700;
}

.family-chart-family-name {
    overflow-wrap: normal;
    word-break: normal;
    color: #355d50;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.15;
}

.family-chart-family-row.is-missing .family-chart-family-name {
    color: #7b837e;
}

.family-chart-connector-path {
    fill: none;
    stroke: #a7b5ae;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.family-chart-connector-path.is-selected-source {
    stroke: #6f9d8b;
    stroke-width: 2.4;
}

@media (max-width: 640px) {
    .inline-family-tree.is-primary {
        width: 440px;
    }

    .inline-family-tree.is-side {
        width: 360px;
    }

    .sibling-row {
        gap: 8px;
    }
}

/* Public Tree V3.1 selected-centred generation-chart viewer - 2026-10-08 */
body.generation-chart-preview-open {
    overflow: hidden;
}

.generation-chart-preview[hidden] {
    display: none !important;
}

.generation-chart-preview {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: stretch;
}

.generation-chart-preview-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(19, 35, 29, 0.48);
}

.generation-chart-preview-panel {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(1500px, calc(100vw - 32px));
    height: min(940px, calc(100vh - 32px));
    margin: 16px auto;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid #ccd7d0;
    border-radius: 18px;
    background: #f7f2e8;
    box-shadow: 0 24px 70px rgba(15, 42, 33, 0.24);
    outline: none;
}

.generation-chart-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #d8ddd7;
    background: #fffdf8;
}

.generation-chart-preview-eyebrow {
    margin: 0 0 4px;
    color: #6f7a74;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.generation-chart-preview-header h2 {
    margin: 0;
    color: #17372d;
    font-size: 22px;
    line-height: 1.1;
}

.generation-chart-preview-header p:last-child {
    margin: 5px 0 0;
    color: #68756f;
    font-size: 13px;
    font-weight: 700;
}

.generation-chart-preview-close {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid #cbd6d0;
    border-radius: 12px;
    background: #fff;
    color: #214f41;
    font-size: 24px;
    cursor: pointer;
}

.generation-chart-preview-toolbar {
    display: flex;
    min-height: 58px;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    overflow-x: auto;
    border-bottom: 1px solid #d8ddd7;
    background: #fffdf8;
}

.generation-chart-preview-toolbar button {
    min-height: 40px;
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #c8d4cd;
    border-radius: 10px;
    background: #fff;
    color: #245f4d;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.generation-chart-preview-toolbar button:hover,
.generation-chart-preview-toolbar button:focus-visible {
    border-color: #7ea694;
    background: #f1f7f4;
}

#generation-chart-preview-zoom-label {
    min-width: 52px;
    color: #61716a;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.generation-chart-preview-toolbar-spacer {
    flex: 1 0 18px;
}

.generation-chart-preview-scroller {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    background: #efe8dc;
    cursor: grab;
    touch-action: pan-x pan-y;
    scrollbar-gutter: stable both-edges;
}

.generation-chart-preview-scroller.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.generation-chart-preview-stage {
    position: relative;
    min-width: 100%;
    min-height: 100%;
}

.generation-chart-preview-scale {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.generation-chart-preview .family-chart-export-document {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 0 !important;
    max-width: none;
}

.generation-chart-preview-help {
    padding: 9px 14px;
    border-top: 1px solid #d8ddd7;
    background: #fffdf8;
    color: #738079;
    font-size: 12px;
    text-align: center;
}

/* Readable export geometry.  Large families grow in canvas width instead of
   crushing names into narrow poster columns. */
.family-chart-person {
    min-height: 74px;
    padding: 13px 15px;
}

.family-chart-person-name {
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
    font-size: 16px;
    line-height: 1.16;
}

.family-chart-person-meta {
    font-size: 11px;
}

.family-chart-family-row {
    min-height: 50px;
    padding: 8px 13px;
}

.family-chart-family-name {
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
    font-size: 11px;
}

.family-chart-rank-label {
    min-height: 28px;
    padding: 6px 12px;
    font-size: 12px;
}

@media (max-width: 700px) {
    .generation-chart-preview-panel {
        width: 100vw;
        height: 100dvh;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .generation-chart-preview-header {
        padding: 13px 14px 11px;
    }

    .generation-chart-preview-header h2 {
        font-size: 19px;
    }

    .generation-chart-preview-toolbar {
        min-height: 56px;
        padding-inline: 10px;
    }

    .generation-chart-preview-toolbar button {
        min-height: 42px;
    }

    .generation-chart-preview-help {
        font-size: 11px;
    }
}


/* Public Tree V3.2 complete 3/5-generation charts - 2026-10-08 */
.family-chart-png-capture,
.family-chart-png-capture *,
.family-chart-png-capture *::before,
.family-chart-png-capture *::after {
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    text-shadow: none !important;
}

.family-chart-png-capture .family-chart-node,
.family-chart-png-capture .family-chart-node.is-selected {
    box-shadow: none !important;
}

.family-chart-png-capture .family-chart-selected-pill {
    box-shadow: none !important;
}

.family-chart-node {
    min-width: var(--family-chart-card-width);
}

.family-chart-person-name,
.family-chart-family-name {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.family-chart-export-document[data-generation-count="5"] .family-chart-heading h1 {
    font-size: 32px;
}

.family-chart-export-document[data-generation-count="5"] .family-chart-rank-label {
    font-size: 12px;
}

/* Public Tree V3.8 tidy live-family layout - 2026-10-09
   A visible generation stays on one horizontal rank. Subtree width is reserved
   before measured SVG connectors are drawn, so cards and rails share geometry. */
.sibling-row {
    gap: 24px;
}

/* Synthetic balance slots are retired. centreTree() centres the selected card. */
.sibling-balance {
    display: none !important;
}

/* The old CSS sibling rails used branch-box width. With variable subtree widths
   that moves stems away from their cards, so measured SVG owns these rails now. */
.sibling-branch:not(.sibling-balance)::before,
.sibling-branch:not(.sibling-balance)::after {
    display: none !important;
}

.inline-family-tree.is-primary,
.inline-family-tree.is-side {
    width: max-content;
    min-width: 0;
    max-width: none;
}

.inline-family-title {
    margin-bottom: 14px;
}

/* Multiple FamilyUnits sit side-by-side in their recorded order. A second
   marriage becomes a second branch rather than being stacked through another
   family's descendants. */
.inline-family-units {
    display: flex;
    width: max-content;
    max-width: none;
    margin-inline: auto;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
}

/* The canvas itself is the family-tree surface. Do not put a second large card
   around each spouse/children branch. */
.inline-family-unit,
.inline-family-tree.is-primary .inline-family-unit {
    flex: 0 0 auto;
    width: max-content;
    min-width: 174px;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.inline-family-unit-label {
    margin-bottom: 8px;
}

.inline-family-parent-node {
    margin-bottom: 0;
}

/* Children in one FamilyUnit are siblings and therefore remain on one rank.
   Horizontal panning is preferable to wrapping descendants onto fake rows. */
.inline-family-children {
    display: grid;
    width: max-content;
    max-width: none;
    margin-inline: auto;
    grid-template-columns:
        repeat(
            var(--child-columns),
            112px
        );
    gap: 10px;
    padding-top: 24px;
    justify-content: center;
}

.inline-family-child-node,
.inline-family-child-node .compact-person-button {
    width: 112px;
}

/* Internal connector pseudo-elements are retired in favour of the same
   measured SVG layer that draws sibling and expanded-family rails. */
.inline-family-connector,
.inline-family-children::before,
.inline-family-child-node::before {
    display: none !important;
}

.live-family-connector-path {
    stroke: #aab9b2;
    stroke-width: 1.6;
}

.live-family-connector-path.is-sibling-rail {
    stroke: #b4c2bc;
    stroke-width: 1.4;
}

.live-family-connector-path.is-family-rail {
    stroke: #a8b9b1;
    stroke-width: 1.6;
}

.live-family-connector-path.is-family-rail.is-selected {
    stroke: #6f9d8b;
    stroke-width: 2;
}

.live-family-connector-path.is-child-rail {
    stroke: #b0c0b8;
    stroke-width: 1.5;
}

@media (max-width: 700px) {
    .sibling-row {
        gap: 18px;
    }

    .inline-family-tree.is-primary,
    .inline-family-tree.is-side,
    .inline-family-units,
    .inline-family-unit {
        width: max-content;
        max-width: none;
    }

    .inline-family-units {
        gap: 22px;
    }

    .inline-family-children {
        grid-template-columns:
            repeat(
                var(--child-columns),
                112px
            );
        gap: 9px;
    }

    .inline-family-child-node,
    .inline-family-child-node .compact-person-button {
        width: 112px;
    }
}



/* Public Tree V3.9 parent/sibling rail refinement - 2026-10-09
   The parent couple and sibling rank read as one connected pedigree unit.
   Measured SVG owns the relationship lines; CSS only reserves layout space. */
.parent-context-section + .tree-connector {
    display: none;
}

.parent-context-section .tree-section-label {
    margin-bottom: 7px;
}

.parent-context-section .parent-couple-row {
    margin-bottom: 0;
}

/* Keep the spacer between parent cards but retire its painted line. The SVG
   joins the true inner card edges and drops from that union into the sibling
   rail, so line geometry cannot drift away from the cards. */
.parent-context-section .parent-union-link {
    width: 30px;
    flex-basis: 30px;
    background: transparent;
}

.sibling-context-section {
    margin-top: 18px;
}

.sibling-context-section > .tree-section-label {
    margin-bottom: 2px;
}

.sibling-context-section > .sibling-row {
    padding-top: 18px;
}

.live-family-connector-path.is-parent-union,
.live-family-connector-path.is-parent-descent {
    stroke: #9fb1a8;
    stroke-width: 1.7;
}

.live-family-connector-path.is-parent-descent {
    stroke-linecap: butt;
}

.live-family-connector-path.is-sibling-rail {
    stroke: #aebdb6;
    stroke-width: 1.5;
}

@media (max-width: 700px) {
    .parent-context-section .parent-union-link {
        width: 24px;
        flex-basis: 24px;
    }

    .sibling-context-section {
        margin-top: 14px;
    }

    .sibling-context-section > .sibling-row {
        padding-top: 16px;
    }
}

/* Scoped additions: preserve the accepted tree cards and desktop toolbar. */
.relationship-dialog { width: min(32rem, calc(100vw - 32px)); max-height: calc(100dvh - 40px); box-sizing: border-box; overflow: auto; border: 1px solid #c5d8cf; border-radius: 16px; padding: 22px; color: #17372d; background: #f8fbf9; }
.relationship-dialog::backdrop { background: rgb(12 30 23 / 55%); }
.relationship-dialog input { display: block; box-sizing: border-box; width: 100%; min-height: 44px; font-size: 16px; margin: 6px 0 16px; padding: 10px; }
.relationship-dialog button { min-height: 44px; border: 1px solid #c5d8cf; border-radius: 8px; background: white; color: #17372d; padding: 8px 12px; cursor: pointer; }
.relationship-close { float: right; }
.relationship-dialog h2 { clear: both; padding-top: 12px; }
.relationship-dialog li { padding: 8px 0; overflow-wrap: anywhere; }
.relationship-dialog a { color: #146443; }

.generation-chart-preview-toolbar { flex-wrap: wrap; overflow-x: visible; }
.generation-chart-preview-toolbar button { min-height: 44px; }

@media (max-width: 700px) { #find-relationship { display: none; } }

/* Public action alignment; retain the existing mobile action menu. */
.tree-desktop-actions { align-items: stretch; flex-wrap: wrap; }
.tree-desktop-actions > button { min-height: 44px; white-space: normal; line-height: 1.3; }
.relationship-dialog { font: inherit; }
.relationship-dialog h2 { margin: 0 0 12px; font-size: 1.35rem; }
.relationship-dialog p { line-height: 1.5; margin: 12px 0; }
.relationship-dialog input, .relationship-dialog button { font: inherit; }
.relationship-dialog label { display: block; font-weight: 600; }
.relationship-dialog input { border: 1px solid #bfd1c9; border-radius: 10px; }
.relationship-dialog form[method="dialog"] { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.relationship-close { float: none; }
.relationship-dialog button[type="submit"] { background: #315f50; color: #fff; border-color: #315f50; }
.relationship-dialog :is(button, input, a):focus-visible { outline: 3px solid #5e8b7c; outline-offset: 3px; }
