:root {
    --ink: #1f2937;
    --ink-soft: #4b5563;
    --paper: #f6f1e8;
    --paper-strong: #fffdf9;
    --panel: rgba(255, 253, 249, 0.92);
    --panel-alt: #fcf7ef;
    --red: #a94734;
    --red-deep: #8d3928;
    --gold: #d3a35b;
    --gold-soft: #ead8b4;
    --line: #e8dccb;
    --line-strong: #dbcab4;
    --shadow: 0 18px 40px rgba(94, 63, 29, 0.08);
    --shadow-soft: 0 10px 24px rgba(94, 63, 29, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 32%),
        linear-gradient(180deg, #fbf7f1 0%, var(--paper) 48%, #f8f2e8 100%);
    color: var(--ink);
    font-family: "Segoe UI", Inter, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a {
    color: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 74px;
    padding: 12px max(3vw, 22px);
    border-bottom: 1px solid rgba(219, 202, 180, 0.8);
    background: rgba(255, 251, 245, 0.92);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    color: #1f1a17;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand span {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(180deg, #bf573f 0%, var(--red-deep) 100%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(169, 71, 52, 0.24);
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 3px 0;
    background: var(--ink);
    border-radius: 999px;
}

.site-header nav a,
.link-button {
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    background: none;
    border: 0;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.link-button:hover,
.link-button:focus-visible {
    color: var(--red);
}

.site-header form {
    margin: 0;
}

.nav-cta {
    color: var(--red) !important;
    font-weight: 700;
}

.language-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.language-form select {
    width: auto;
    min-width: 92px;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.92);
}

.user-chip {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    color: var(--red);
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.nav-button {
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.92);
    color: var(--red-deep);
    padding: 10px 15px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(94, 63, 29, 0.08);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-button:hover,
.nav-button:focus-visible {
    color: var(--red);
    border-color: #d2b18e;
    box-shadow: 0 10px 22px rgba(94, 63, 29, 0.11);
    transform: translateY(-1px);
}

main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 38px 24px 84px;
}

.hero {
    min-height: 520px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 56px;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-weight: 800;
    font-size: 11px;
    color: var(--red);
}

h1,
h2,
h3 {
    font-family: Georgia, serif;
    margin: 0.28em 0;
    color: #1c1714;
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(34px, 4.8vw, 56px);
    line-height: 1.04;
}

h1 em {
    color: var(--red);
    font-weight: 400;
}

h2 {
    font-size: clamp(28px, 3.3vw, 40px);
}

h3 {
    font-size: 24px;
}

.hero p,
.page-title p,
.welcome-row p {
    color: var(--ink-soft);
    font-size: 18px;
    line-height: 1.7;
    max-width: 620px;
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 14px;
    background: linear-gradient(180deg, #b7523d 0%, var(--red-deep) 100%);
    color: #fff;
    padding: 12px 18px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 26px rgba(169, 71, 52, 0.2);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.button:hover,
.button:focus-visible {
    transform: translateY(-1px);
    filter: saturate(1.03);
    box-shadow: 0 18px 30px rgba(169, 71, 52, 0.24);
}

.button.secondary {
    background: rgba(255, 255, 255, 0.82);
    color: var(--red);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft);
}

.path-card,
.panel,
.auth-card {
    background: var(--panel);
    border: 1px solid rgba(232, 220, 203, 0.88);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.path-card {
    padding: 32px;
}

.path-card strong {
    font-size: 18px;
}

.sample-path {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 24px 0;
}

.sample-path span,
.found-path span {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(94, 63, 29, 0.04);
}

.sample-path i,
.found-path i {
    color: var(--red);
    font-style: normal;
    margin-left: 14px;
}

.path-card small,
.muted {
    color: var(--ink-soft);
}

.features,
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.features article {
    padding: 28px;
    border-top: 3px solid var(--gold);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

.features b {
    color: var(--red);
}

.features p {
    color: var(--ink-soft);
    line-height: 1.65;
}

.auth-card {
    max-width: 540px;
    margin: 22px auto;
    padding: 36px;
}

.auth-card h1,
.page-title h1,
.welcome-row h1 {
    font-size: clamp(32px, 4vw, 48px);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 4px;
    color: var(--ink-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.auth-consent-note {
    margin: 0;
    font-size: 12px;
}

.whatsapp-login-card {
    max-width: 760px;
}

.whatsapp-login-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    margin-top: 22px;
}

.whatsapp-login-layout > img {
    width: 240px;
    max-width: 100%;
    height: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.registration-verification-card {
    max-width: 760px;
}

.registration-pending-note {
    padding: 12px 14px;
    border: 1px solid #dfc28e;
    border-radius: 12px;
    background: #fff7e8;
    color: #6f4c1f;
}

.registration-code-form {
    max-width: 420px;
    margin-top: 24px;
}

.registration-resend-form {
    margin-top: 10px;
}

.stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    font: inherit;
    color: var(--ink);
    box-shadow: inset 0 1px 2px rgba(31, 41, 55, 0.02);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(169, 71, 52, 0.14);
    border-color: #cfab89;
}

.flash {
    max-width: 760px;
    margin: 0 auto 26px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
}

.flash.error {
    background: #fbe8e2;
    border-color: #efc3b6;
    color: #7a2e22;
}

.flash.success {
    background: #e6f4ea;
    border-color: #bfdcc8;
    color: #265438;
}

.welcome-row,
.page-title,
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 28px;
}

.stats {
    margin: 12px 0 34px;
}

.stats article {
    background: linear-gradient(180deg, #b7523d 0%, var(--red-deep) 100%);
    color: #fff;
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 16px 28px rgba(169, 71, 52, 0.18);
}

.stats strong {
    display: block;
    font: 42px Georgia, serif;
}

.stats span {
    opacity: 0.88;
}

.panel {
    padding: 28px;
    margin-bottom: 28px;
}

.section-head h2 {
    font-size: 28px;
}

.section-head a {
    color: var(--red);
    font-weight: 700;
}

.tree-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.tree-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
}

.zoom-button {
    min-width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.zoom-reset {
    padding: 0 12px;
    width: auto;
}

.zoom-level {
    min-width: 52px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-soft);
}

.compact-head {
    margin-bottom: 14px;
}

.compact-head h2 {
    margin: 0;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
}

.person {
    text-align: center;
    padding: 18px;
    background: rgba(255, 250, 242, 0.95);
    border: 1px solid rgba(232, 220, 203, 0.8);
    border-radius: 18px;
}

.person span,
.member-list span,
.admin-table span {
    display: block;
    color: var(--ink-soft);
    font-size: 12px;
    margin-top: 5px;
}

.avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 10px;
    background: #ebc9bf;
    color: #7d3528;
    font: 700 22px Georgia, serif;
    overflow: hidden;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar.male {
    background: #c7dceb;
    color: #2a5669;
}

.avatar.other {
    background: #ddd6ed;
    color: #5b4673;
}

.two-col {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 24px;
}

.member-list {
    display: grid;
    gap: 12px;
}

.search-box {
    min-width: min(280px, 100%);
}

.member-search-tools {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-user-head {
    align-items: end;
}

.admin-user-head .muted {
    margin: 4px 0 0;
    font-size: 12px;
}

.admin-user-head .search-box {
    width: min(320px, 100%);
}

.admin-table article[hidden] {
    display: none;
}

.member-edit-selected {
    margin-bottom: 10px;
    white-space: nowrap;
}

.search-box span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.member-list article,
.admin-table article {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(232, 220, 203, 0.78);
}

.member-list .avatar {
    margin: 0;
    flex: 0 0 54px;
}

.member-list code,
.identity-code code {
    display: block;
    max-width: 100%;
    overflow: auto;
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8f1e7;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 11px;
}

.small-link,
.card-edit {
    color: var(--red);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.push-right {
    margin-left: auto;
}

.narrow {
    max-width: 860px;
}

.relation-form,
.finder {
    display: grid;
    grid-template-columns: 1fr 0.84fr 1fr auto;
    align-items: end;
    gap: 15px;
}

.finder {
    grid-template-columns: 1fr auto 1fr auto;
}

.finder > span {
    padding-bottom: 13px;
    color: var(--ink-soft);
}

.result {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(232, 220, 203, 0.84);
}

.found-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tree-panel {
    overflow: hidden;
}

.family-tree {
    position: relative;
    min-width: 760px;
    padding: 18px 28px 38px;
    overflow: auto;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-x pan-y pinch-zoom;
    overscroll-behavior: auto;
    -webkit-tap-highlight-color: transparent;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.96) 0%, rgba(250, 244, 234, 0.92) 72%);
    border: 1px solid rgba(232, 220, 203, 0.82);
    border-radius: 22px;
}

.tree-canvas {
    position: relative;
    width: max-content;
    min-width: 100%;
    transform-origin: top left;
}

.family-tree:active,
.family-tree.is-dragging {
    cursor: grabbing;
}

.family-tree.is-dragging * {
    user-select: none;
    -webkit-user-select: none;
}

.tree-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.tree-line {
    fill: none;
    stroke: #cfb283;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tree-line.spouse {
    stroke: var(--red);
    stroke-width: 2.5;
}

.tree-line.sibling {
    stroke-dasharray: 5 4;
}

.tree-generation {
    position: relative;
    z-index: 1;
    margin: 0 0 62px;
    padding: 0 18px;
}

.tree-generation:last-of-type {
    margin-bottom: 0;
}

.generation-label {
    display: block;
    text-align: center;
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 12px;
}

.tree-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 34px;
    width: max-content;
    min-width: 100%;
    margin: 0 auto;
    padding: 0 22px;
}

.tree-person {
    position: relative;
    width: 148px;
    min-height: 126px;
    text-align: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(229, 216, 197, 0.95);
    border-radius: 18px;
    box-shadow: 0 14px 26px rgba(94, 63, 29, 0.08);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.tree-person:focus-visible {
    outline: 3px solid rgba(169, 71, 52, 0.28);
    outline-offset: 3px;
}

.tree-person.is-you {
    border: 2px solid rgba(169, 67, 52, 0.78);
    background: linear-gradient(145deg, #fff7f0 0%, #fbe8dc 100%);
    box-shadow: 0 18px 36px rgba(169, 71, 52, 0.24), inset 0 0 0 3px rgba(255, 255, 255, 0.58);
}

.tree-person.is-you::before {
    content: attr(data-self-label);
    position: absolute;
    z-index: 2;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 10px;
    border-radius: 999px;
    color: #fff;
    background: var(--red);
    box-shadow: 0 5px 12px rgba(169, 71, 52, 0.22);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tree-person.is-you .avatar {
    outline: 3px solid rgba(169, 71, 52, 0.18);
    outline-offset: 3px;
}

.tree-person.is-you > strong {
    color: #7f2e24;
}

.tree-person strong {
    display: block;
    font-size: 15px;
    line-height: 1.35;
}

.tree-person span {
    display: block;
    color: var(--ink-soft);
    font-size: 11px;
    margin-top: 5px;
}

.card-edit {
    position: absolute;
    right: 10px;
    top: 9px;
    opacity: 0;
}

.tree-person:hover .card-edit,
.tree-person:focus-within .card-edit {
    opacity: 1;
}

.tree-empty {
    text-align: center;
    padding: 44px 20px;
}

.tree-empty .avatar {
    width: 72px;
    height: 72px;
}

.tree-empty p {
    color: var(--ink-soft);
}

.tree-person.group-start:not(:first-child) {
    margin-left: 75px;
}

.member-modal {
    width: min(460px, calc(100vw - 32px));
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px;
    color: var(--ink);
    background: var(--paper);
    box-shadow: 0 28px 80px rgba(40, 25, 15, 0.24);
}

.member-modal::backdrop {
    background: rgba(31, 24, 20, 0.48);
    backdrop-filter: blur(3px);
}

.member-modal h2 {
    margin: 6px 38px 18px 0;
}

.member-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    font-size: 24px;
    cursor: pointer;
}

.member-modal dl {
    margin: 0 0 22px;
}

.member-modal dl div {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.member-modal dt {
    color: var(--ink-soft);
}

.member-modal dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.consent-field {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
}

.consent-field input {
    width: auto;
    margin-top: 3px;
}

.config-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
}

.config-status.is-enabled {
    color: #28613f;
    border-color: rgba(40, 97, 63, 0.3);
    background: rgba(40, 97, 63, 0.08);
}

.mobile-verification-badge {
    display: inline-flex !important;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    margin-top: 7px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px !important;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.mobile-verification-badge.is-verified {
    color: #28613f !important;
    border-color: rgba(40, 97, 63, 0.25);
    background: rgba(40, 97, 63, 0.09);
}

.mobile-verification-badge.is-unverified {
    color: #8a5319 !important;
    border-color: rgba(153, 93, 31, 0.24);
    background: rgba(189, 126, 55, 0.1);
}

.tree-person .mobile-verification-badge {
    max-width: 100%;
    margin: 7px auto 0;
    padding: 3px 6px;
    font-size: 8px !important;
}

.whatsapp-test-form {
    margin-top: 14px;
}

.whatsapp-test-form .button {
    width: 100%;
}

.whatsapp-verification-box {
    margin-top: 24px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
}

.whatsapp-qr-layout {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 1fr;
    gap: 24px;
    align-items: start;
}

.whatsapp-qr-layout > img {
    width: 100%;
    height: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.whatsapp-code-form {
    margin-top: 18px;
}

.member-profile-panel {
    max-width: 900px;
    margin: 0 auto;
}

.member-profile-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.member-profile-summary h2 {
    margin: 0 0 4px;
}

.member-profile-summary > div > span:not(.mobile-verification-badge) {
    display: block;
    color: var(--ink-soft);
}

.member-profile-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
    margin: 24px 0;
}

.member-profile-details div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.member-profile-details dt {
    color: var(--ink-soft);
}

.member-profile-details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.member-profile-relations {
    padding-top: 8px;
}

.relationship-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.relationship-chip-list a {
    display: grid;
    gap: 2px;
    min-width: 170px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.7);
}

.relationship-chip-list span {
    color: var(--red);
    font-size: 11px;
}

.member-profile-actions {
    margin-top: 24px;
}

.account-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
    gap: 22px;
    align-items: start;
}

.account-verification-panel {
    grid-column: 1 / -1;
}

.privacy-sharing-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 249, 240, 0.82);
    cursor: pointer;
}

.privacy-sharing-option input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--red);
}

.privacy-sharing-option strong,
.privacy-sharing-option small {
    display: block;
}

.privacy-sharing-option small {
    margin-top: 5px;
    color: var(--muted);
    line-height: 1.45;
}

.birthday-feature {
    margin-bottom: 22px;
    padding: 22px 26px;
    background: linear-gradient(135deg, rgba(255, 247, 229, 0.96), rgba(255, 255, 255, 0.96));
}

.birthday-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.birthday-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(207, 178, 131, 0.55);
    border-radius: 15px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.78);
}

.birthday-card .avatar {
    flex: 0 0 auto;
}

.birthday-card strong,
.birthday-card span,
.birthday-card small {
    display: block;
}

.tree-scope-toggle {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 12px;
}

.home-dashboard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 16px;
}

.home-dashboard-actions .tree-scope-toggle {
    margin: 0;
}

.home-dashboard-actions .button {
    flex: 0 0 auto;
}

.tree-scope-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.76);
    cursor: pointer;
}

.tree-scope-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--red);
}

.tree-scope-toggle span,
.tree-scope-toggle strong,
.tree-scope-toggle small {
    display: block;
}

.tree-scope-toggle small {
    margin-top: 2px;
    color: var(--ink-soft);
}

.birthday-card span {
    color: var(--red);
    margin-top: 2px;
}

.birthday-card small {
    color: var(--ink-soft);
    margin-top: 2px;
}

@media (max-width: 680px) {
    .whatsapp-qr-layout,
    .whatsapp-login-layout {
        grid-template-columns: 1fr;
    }

    .whatsapp-qr-layout > img,
    .whatsapp-login-layout > img {
        max-width: 240px;
        margin: 0 auto;
    }

    .member-profile-details {
        grid-template-columns: 1fr;
    }

    .member-profile-details div {
        grid-template-columns: 110px 1fr;
    }

    .account-layout {
        grid-template-columns: 1fr;
    }

    .tree-scope-toggle,
    .tree-scope-toggle label {
        width: 100%;
    }

    .home-dashboard-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .home-dashboard-actions .button {
        width: 100%;
        text-align: center;
    }
}

.tree-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 18px;
    color: var(--ink-soft);
    font-size: 12px;
}

.tree-legend span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.tree-legend i {
    display: block;
    width: 30px;
    border-top: 2px solid #cfb283;
}

.tree-legend .spouse-key {
    border-color: var(--red);
    border-width: 3px;
}

.tree-legend .sibling-key {
    border-top-style: dashed;
}

.unconnected {
    border-top: 1px solid rgba(232, 220, 203, 0.84);
    margin-top: 28px;
    padding-top: 24px;
}

.unconnected > span {
    display: block;
    color: var(--ink-soft);
    font-size: 13px;
    margin: 5px 0 18px;
}

.edit-member-panel {
    max-width: 760px;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
}

.edit-member-panel form {
    margin: 0;
}

.photo-preview {
    text-align: center;
    color: var(--ink-soft);
    font-size: 12px;
}

.large-avatar {
    width: 135px;
    height: 135px;
    font-size: 48px;
    margin-bottom: 12px;
}

.identity-code {
    grid-column: 1 / -1;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
}

label small {
    font-weight: 400;
    color: var(--ink-soft);
}

.photo-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--ink-soft);
}

.settings-list {
    display: grid;
    gap: 12px;
    color: var(--ink-soft);
}

.admin-stats {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.admin-page-title {
    margin-bottom: 18px;
}

.admin-page-title h1 {
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.14;
}

.admin-page-title p {
    font-size: 13px;
    line-height: 1.5;
    max-width: 680px;
}

.admin-stats {
    gap: 10px;
    margin: 8px 0 18px;
}

.admin-stats article {
    padding: 12px 14px;
    border-radius: 12px;
}

.admin-stats strong {
    font-size: 22px;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
    gap: 18px;
    align-items: start;
}

.admin-column {
    min-width: 0;
}

.admin-panel {
    padding: 16px 18px;
    margin-bottom: 18px;
}

.admin-panel h2 {
    font-size: 17px;
    margin-bottom: 12px;
}

.admin-panel .stack {
    gap: 10px;
    margin-top: 12px;
}

.admin-panel label {
    font-size: 11px;
}

.admin-panel input,
.admin-panel select,
.admin-panel textarea {
    padding: 9px 10px;
    font-size: 12px;
    border-radius: 9px;
}

.admin-panel .button {
    padding: 9px 14px;
    font-size: 12px;
}

.admin-panel .muted {
    font-size: 11px;
}

.admin-panel .admin-table article {
    padding: 10px 0;
}

.admin-panel-form {
    max-width: none;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.admin-form-full {
    grid-column: 1 / -1;
}

.admin-table strong {
    font-size: 13px;
}

.admin-table span,
.admin-table p {
    font-size: 11px;
    line-height: 1.45;
}

.admin-table {
    display: grid;
    gap: 8px;
}

.admin-table p {
    margin: 0.7em 0 0;
    color: var(--ink-soft);
}

.relationship-table article {
    align-items: center;
}

.relationship-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.relationship-actions form {
    margin: 0;
}

.danger-link {
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--red-deep);
    padding: 0;
}

.inline-admin-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.password-reset-form {
    margin-top: 0;
}

.password-reset-form input {
    min-width: 170px;
    max-width: 190px;
    padding: 8px 9px;
}

.invite-resend-form {
    flex-wrap: wrap;
}

.invite-resend-form input {
    max-width: 260px;
    padding: 9px;
}

footer {
    text-align: center;
    padding: 28px 20px 34px;
    color: var(--ink-soft);
    border-top: 1px solid rgba(232, 220, 203, 0.84);
}

footer em {
    display: inline-block;
    margin-top: 6px;
}

@media (max-width: 980px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-form-full {
        grid-column: auto;
    }

    .site-header {
        gap: 12px;
        flex-wrap: wrap;
    }

    .site-header nav {
        gap: 14px;
    }

    .hero,
    .two-col,
    .edit-member-panel {
        grid-template-columns: 1fr;
    }

    .hero {
        gap: 28px;
        min-height: auto;
    }

    .features,
    .stats {
        grid-template-columns: 1fr;
    }

    .relation-form,
    .finder {
        grid-template-columns: 1fr;
    }

    .finder > span {
        display: none;
    }

    .welcome-row,
    .page-title,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .tree-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 800px) {
    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        flex: 0 0 auto;
    }

    .site-header nav {
        display: none;
        order: 4;
        width: 100%;
        overflow: visible;
        margin: 0;
        padding: 10px 0 4px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        white-space: normal;
    }

    .site-header.nav-open nav {
        display: flex;
    }

    .site-header nav a {
        width: 100%;
        font-size: 15px;
        padding: 2px 0;
    }

    .language-form {
        margin-left: 0;
    }

    .user-chip,
    .site-header > form:not(.language-form) {
        order: 2;
    }

    .language-form,
    .user-chip,
    .site-header > form:not(.language-form) {
        margin-top: 6px;
    }

    .tree-panel {
        padding: 14px 8px 10px;
        overflow: visible;
    }

    .family-tree {
        min-width: 100%;
        max-width: none;
        height: clamp(500px, 74dvh, 700px);
        overflow: auto;
        overscroll-behavior: auto;
        -webkit-overflow-scrolling: touch;
        padding: 14px 16px 18px;
        border-radius: 20px;
    }

    .tree-generation {
        padding: 0 12px;
    }

    .tree-row {
        gap: 20px;
        padding: 0 16px;
    }

    .tree-person {
        width: 138px;
        min-height: 118px;
        padding: 14px 10px;
    }

    .tree-person strong {
        font-size: 14px;
    }

    .tree-person span {
        font-size: 10px;
    }

    .tree-legend {
        gap: 16px;
        font-size: 11px;
        margin-top: 14px;
    }

    .tree-legend i {
        width: 22px;
    }

    .card-edit {
        opacity: 1;
    }

    .member-modal {
        width: calc(100vw - 18px);
        max-height: calc(100dvh - 20px);
        padding: 22px 18px 18px;
        border-radius: 18px;
        overflow: auto;
    }

    .member-modal dl div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    main {
        padding-top: 32px;
    }

    h1,
    .auth-card h1,
    .page-title h1,
    .welcome-row h1 {
        font-size: 34px;
    }
}
