:root {
    --brand: #1c5d3b;
    --brand-dark: #123f28;
    --brand-light: #e8f3ec;
    --accent: #c98a2c;
    --text: #24302a;
    --muted: #6b7a71;
    --border: #d9e2dc;
    --bg: #f7f9f7;
    --white: #ffffff;
    --danger: #b3261e;
    --danger-bg: #fbeceb;
    --success: #1c5d3b;
    --success-bg: #e8f3ec;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: var(--brand-dark);
    color: var(--white);
}.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    position: relative;
}
.logo {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 700;
}
.logo:hover { text-decoration: none; }
.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}
.main-nav a { color: var(--white); }
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.3);
}
.bell-link {
    position: relative;
    font-size: 1.2rem;
    line-height: 1;
    display: inline-flex;
}
.bell-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--accent);
    color: var(--white);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 20px;
    min-width: 16px;
    text-align: center;
}
.btn-nav-cta {
    background: var(--accent);
    color: var(--white) !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
}
.btn-nav-cta:hover { text-decoration: none; opacity: 0.9; }
.btn-link { color: #cfe3d6 !important; }

/* Hamburger toggle — hidden on desktop, shown at the mobile breakpoint */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    margin: 0 auto;
    transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 16px 0;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c9c6; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bfe0cc; }

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: var(--white);
    padding: 80px 20px;
    text-align: center;
}
.hero h1 { font-size: 2.6rem; margin-bottom: 12px; }
.hero p { font-size: 1.2rem; opacity: 0.92; max-width: 600px; margin: 0 auto 28px; }
.btn-hero {
    background: var(--accent);
    color: var(--white);
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    display: inline-block;
}
.btn-hero:hover { text-decoration: none; opacity: 0.9; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    padding: 60px 20px;
    max-width: 1100px;
    margin: 0 auto;
}
.feature-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}
.feature-card .icon { font-size: 2rem; margin-bottom: 8px; }

/* Post cards (Matrimony / Yellow Pages / News) — same visual style as
   .feature-card above (large icon, bold title, description, generous
   padding), just with a button added at the bottom since these need
   to link out somewhere, unlike the purely descriptive feature cards */
.post-cards-section {
    background: var(--brand-light);
    padding: 50px 20px 60px;
}
.post-cards-heading {
    text-align: center;
    margin: 0 0 6px;
    color: var(--brand-dark);
}
.post-cards-intro {
    text-align: center;
    color: var(--muted);
    margin: 0 0 32px;
}
.post-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}
.post-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 26px rgba(0,0,0,0.1);
}
.post-card-icon { font-size: 2rem; margin-bottom: 8px; }
.post-card h3 { margin: 0 0 8px; }
.post-card p {
    color: var(--text);
    line-height: 1.55;
    margin: 0 0 20px;
    flex-grow: 1;
}
.post-card .btn { width: auto; }

/* Cards / panels */
.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin: 24px 0;
}
.panel h2 { margin-top: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px 0 16px;
}
.page-header h1 { margin: 0; }

/* Buttons */
.btn {
    display: inline-block;
    background: var(--brand);
    color: var(--white);
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--brand); border: 1px solid var(--brand); }
.btn-secondary:hover { background: var(--brand-light); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1f19; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form input { flex: 1; }

/* Message thread */
.message-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}
.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--bg);
}
.message-bubble.mine {
    align-self: flex-end;
    background: var(--brand-light);
}
.message-bubble.theirs { align-self: flex-start; }
.message-body { white-space: pre-wrap; word-break: break-word; }
.message-meta { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=search], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}
textarea { resize: vertical; min-height: 90px; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.form-narrow { max-width: 440px; margin: 40px auto; }

/* Honeypot field for spam-bot registrations: visually hidden off-screen
   (not display:none, which some bots specifically detect and skip) and
   removed from tab order. Real visitors never see or fill it in. */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Tree grid (dashboard) */
.tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.tree-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.tree-card h3 { margin: 0 0 6px; }
.tree-card .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 12px; }

/* Person cards & list */
.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.person-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.2rem;
    object-fit: cover;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-card .name { font-weight: 600; }
.person-card .dates { color: var(--muted); font-size: 0.85rem; }

/* Person profile */
.profile-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.profile-photo {
    width: 140px; height: 140px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--brand-light);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 1px var(--border);
}
.profile-photo.placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem; color: var(--brand); font-weight: 700;
}
.badge {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-right: 6px;
}

/* "Self" badge — marks the tree's designated root person wherever their
   card appears (profile page, tree nodes, person grid) */
.self-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 4px;
    vertical-align: middle;
}
.tree-node .self-badge { display: block; margin: 0 auto 4px; width: fit-content; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: 24px 0 0; }
.tabs a {
    padding: 10px 16px;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 20px 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 20px 24px; }
.timeline li::before {
    content: '';
    position: absolute; left: -7px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--brand);
}
.timeline .t-date { font-weight: 700; color: var(--brand); }
.timeline .t-place { color: var(--muted); font-size: 0.9rem; }

/* Relationship lists */
.rel-section { margin-top: 20px; }
.rel-section h4 { margin-bottom: 8px; color: var(--muted); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.05em; }

/* Tree visualization */
.canvas-nav-wrap { position: relative; }
.tree-canvas-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px 44px;
    cursor: grab;
}
.tree-canvas-wrap.dragging { cursor: grabbing; user-select: none; }
.canvas-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--brand);
    cursor: pointer;
}
.canvas-nav-btn:hover { background: var(--brand-light); }
.canvas-nav-btn.prev { left: -18px; }
.canvas-nav-btn.next { right: -18px; }
.gen-row { display: flex; justify-content: center; gap: 30px; margin-bottom: 46px; position: relative; }
.gen-label { position: absolute; left: 0; top: -20px; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }

/* Tree-chart node: circular photo avatar with the name/dates label
   underneath, in the style of a classic family-tree chart */
.tree-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
    min-width: 92px;
    max-width: 116px;
    position: relative;
}
.tree-avatar {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: var(--brand-light);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 auto;
}
.tree-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tree-avatar-initial { font-size: 1.6rem; font-weight: 700; color: var(--brand); }
.tree-node.self .tree-avatar { box-shadow: 0 0 0 3px var(--accent); }
.tree-node .name {
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.2;
    color: var(--text);
    text-decoration: none;
    display: block;
}
.tree-node a .name:hover { color: var(--brand); text-decoration: underline; }
.tree-node .dates { font-size: 0.68rem; color: var(--muted); }
.tree-node .edit-link {
    display: block;
    font-size: 0.66rem;
    color: var(--muted);
    margin-top: 2px;
}
.tree-node .edit-link:hover { color: var(--brand); text-decoration: underline; }

/* Dashed "add" placeholder (used for missing parents/grandparents/etc.) */
.tree-node.add-placeholder { text-decoration: none; }
.tree-node.add-placeholder .tree-avatar {
    border: 2px dashed var(--border);
    box-shadow: none;
    background: var(--bg);
    color: var(--muted);
    font-size: 1.8rem;
    font-weight: 700;
}
.tree-node.add-placeholder:hover .tree-avatar {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-light);
}
.tree-node.add-placeholder .name { color: var(--muted); font-size: 0.72rem; }
.tree-node.add-placeholder:hover .name { color: var(--brand); }

/* Grandparents / Great-Grandparents / Grandchildren rows: two (or more)
   side-by-side "sides", each its own small column of cards (grandparents
   and great-grandparents capped at two per side; grandchildren uncapped)
   plus a dashed "add" placeholder */
.grandparents-row, .greatgrandparents-row, .grandchildren-row { align-items: flex-start; gap: 50px; }
.grandparent-side, .grandchild-side { display: flex; flex-direction: column; align-items: center; }
.grandparent-side h5, .grandchild-side h5 {
    margin: 0 0 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 700;
}
.grandparent-side .side-cards, .grandchild-side .side-cards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Great-Grandparents row wraps onto multiple lines more readily since it
   can have up to 4 side-columns */
.greatgrandparents-row { flex-wrap: wrap; row-gap: 24px; }

/* Family unit: couple + children with visual connector lines */
.family-unit { display: flex; flex-direction: column; align-items: center; margin-bottom: 40px; }
/* Ancestor units (great-grandparents/grandparents/parents) sit inside a
   row that already provides spacing, or (for Parents) need to sit flush
   against a manually-placed connector line right after them — so they
   don't carry their own trailing margin like a normal family-unit does. */
.ancestor-unit { margin-bottom: 0; }
.family-unit .couple-row { display: flex; align-items: flex-start; gap: 8px; }
.couple-link { color: var(--accent); font-size: 1.1rem; margin-top: 28px; }
.unit-add-links { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.unit-add-links a { font-size: 0.75rem; color: var(--brand); font-weight: 600; }
.unit-add-links a.link-existing-link { color: var(--muted); font-weight: 400; }
.unit-add-links a.link-existing-link:hover { color: var(--brand); }

/* Wraps a dashed "+ Add" placeholder circle with a smaller "or link
   existing" text link underneath it, for spots where the person being
   added might already exist elsewhere in the tree (e.g. a second parent) */
.add-placeholder-wrap { display: flex; flex-direction: column; align-items: center; }
.add-placeholder-wrap .link-existing-link {
    font-size: 0.66rem;
    color: var(--muted);
    margin-top: 4px;
}
.add-placeholder-wrap .link-existing-link:hover { color: var(--brand); text-decoration: underline; }

.connector-stem { width: 2px; height: 22px; background: var(--border); }

.children-row {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 22px 0 0;
    margin: 0;
}
.children-row li {
    position: relative;
    padding: 0 18px;
    margin-top: 0;
}
/* The unified generation row (siblings incl. focus, each with their own
   nested spouse + children branch below) needs more breathing room
   between branches than a simple list of child names does */
.generation-row li { padding: 0 26px; }
.generation-row .family-unit { margin-bottom: 0; }.children-row li::before {
    content: '';
    position: absolute;
    top: -22px; left: 50%; right: 50%;
    height: 22px;
    border-top: 2px solid var(--border);
}
.children-row li:not(:first-child)::before {
    left: 0;
    border-left: 2px solid var(--border);
}
.children-row li:not(:last-child)::before {
    right: 0;
    border-right: 2px solid var(--border);
}
.children-row li::after {
    content: '';
    position: absolute;
    top: -22px; left: 50%;
    width: 2px; height: 22px;
    background: var(--border);
}


/* Media gallery */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 16px; }
.media-grid img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* Search */
.search-hero { background: var(--brand-light); padding: 40px 20px; border-radius: var(--radius); text-align: center; margin: 24px 0; }
.search-form { max-width: 700px; margin: 0 auto; }
.result-item { border-bottom: 1px solid var(--border); padding: 16px 20px; display: flex; gap: 10px; align-items: center; }
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--brand-light); }
.result-item .name { color: var(--text); }
.result-item:hover .name { color: var(--brand); }
.result-item-link { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.message-icon-link {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: var(--bg);
    border: 1px solid var(--border);
}
.message-icon-link:hover { background: var(--brand-light); border-color: var(--brand); text-decoration: none; }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }
/* Wrap any table.data-table in <div class="table-responsive"> to let it
   scroll horizontally on narrow screens instead of squeezing columns or
   breaking the page layout. */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive table.data-table { min-width: 560px; }

/* A-Z surname index */
.az-index {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 20px 0;
    padding: 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.az-index a {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
    font-size: 0.85rem;
}
.az-index a:hover { background: var(--brand); color: var(--white); text-decoration: none; }
.az-index a.active { background: var(--brand); color: var(--white); }
.az-index a.disabled { background: var(--bg); color: var(--muted); opacity: 0.5; pointer-events: none; }
.az-index a[href*="surnames.php"]:first-child { width: auto; padding: 0 12px; }

.surname-group { margin-bottom: 28px; }
.surname-group-letter {
    display: inline-block;
    background: var(--brand);
    color: var(--white);
    width: 40px; height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

.site-footer {
    background: var(--brand-dark);
    color: #cfe3d6;
    padding: 24px 20px;
    margin-top: 60px;
    text-align: center;
    font-size: 0.85rem;
}
.site-footer p { margin: 0; }

.status-pill { padding: 3px 10px; border-radius: 20px; font-size: 0.76rem; font-weight: 700; display: inline-block; }
.status-pending { background: #fdf3e2; color: #9a6a0c; }
.status-approved { background: var(--success-bg); color: var(--success); }
.status-rejected { background: var(--danger-bg); color: var(--danger); }

/* History page */
.history-page { max-width: 860px; margin: 0 auto; }
.history-page h1 { margin-bottom: 6px; }
.history-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    background: var(--brand-light);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 20px 0 32px;
}
.history-toc a { font-weight: 600; font-size: 0.88rem; }
.history-page section { margin-bottom: 36px; }
.history-page section:last-child { margin-bottom: 0; }
.history-page h2 {
    border-bottom: 2px solid var(--brand-light);
    padding-bottom: 8px;
    margin-top: 0;
    color: var(--brand-dark);
}
.history-page h3 { margin-top: 22px; color: var(--brand); }
.history-page p { line-height: 1.7; }
.history-note {
    background: var(--brand-light);
    border-left: 4px solid var(--brand);
    border-radius: 6px;
    padding: 14px 18px;
    margin: 16px 0;
}
.history-note p { margin: 0; }
.history-columns { columns: 2; column-gap: 32px; }
.history-columns li { break-inside: avoid; }

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.9rem; }
    .history-columns { columns: 1; }
}

/* ================================================================
   Mobile responsive pass — tablet breakpoint
   ================================================================ */
@media (max-width: 860px) {
    .nav-toggle { display: flex; }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--brand-dark);
        border-top: 1px solid rgba(255,255,255,0.15);
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
        z-index: 50;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    .main-nav.open { display: flex; }
    .main-nav a, .main-nav .btn-nav-cta {
        padding: 14px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        border-radius: 0;
        display: block;
    }
    .nav-user {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 14px 20px;
        border-left: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .tree-canvas-wrap { padding: 24px 40px; }
    .tree-avatar { width: 60px; height: 60px; }
    .tree-avatar-initial { font-size: 1.3rem; }
    .grandparents-row, .greatgrandparents-row, .grandchildren-row { gap: 30px; }
    .generation-row li { padding: 0 16px; }
    .children-row li { padding: 0 12px; }
}

/* ================================================================
   Mobile responsive pass — phone breakpoint
   ================================================================ */
@media (max-width: 640px) {
    .container { padding: 0 14px; }
    body { font-size: 0.95rem; }

    .header-inner { padding: 10px 14px; }
    .logo { font-size: 1.2rem; }

    .hero { padding: 48px 16px; }
    .hero h1 { font-size: 1.6rem; }
    .hero p { font-size: 1rem; }
    .btn-hero { padding: 12px 24px; font-size: 1rem; }
    .features { padding: 36px 16px; gap: 16px; }

    .panel { padding: 16px; margin: 16px 0; }
    .page-header { margin: 18px 0 12px; }
    .page-header h1 { font-size: 1.4rem; }

    .tree-grid, .person-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .review-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .media-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }

    .profile-header { gap: 14px; }
    .profile-photo, .profile-photo.placeholder { width: 96px; height: 96px; }
    .profile-photo.placeholder { font-size: 1.8rem; }

    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .tabs a { padding: 10px 12px; white-space: nowrap; font-size: 0.88rem; }

    .tree-canvas-wrap { padding: 20px 34px; }
    .canvas-nav-btn { width: 34px; height: 34px; font-size: 1.2rem; }
    .canvas-nav-btn.prev { left: 2px; }
    .canvas-nav-btn.next { right: 2px; }
    .tree-avatar { width: 52px; height: 52px; }
    .tree-avatar-initial { font-size: 1.1rem; }
    .tree-node { min-width: 76px; max-width: 96px; }
    .tree-node .name { font-size: 0.72rem; }
    .tree-node .dates { font-size: 0.62rem; }
    .grandparents-row, .greatgrandparents-row, .grandchildren-row { gap: 20px; }
    .grandparent-side .side-cards, .grandchild-side .side-cards { gap: 8px; }
    .generation-row li { padding: 0 10px; }
    .children-row li { padding: 0 8px; }
    .couple-link { margin-top: 20px; font-size: 0.95rem; }
    .unit-add-links { gap: 6px; }
    .unit-add-links a { font-size: 0.68rem; }

    .search-hero { padding: 28px 14px; }
    .az-index { padding: 10px; gap: 4px; }
    .az-index a { width: 28px; height: 28px; font-size: 0.78rem; }

    .btn { width: 100%; text-align: center; margin: 3px 0; }
    .btn-sm { width: auto; margin: 0; }
    .page-header .btn, .page-header .btn-secondary { width: auto; margin: 0; }
    .row-actions .btn, .row-actions .btn-sm { width: auto; margin: 0; }
    .form-narrow { margin: 24px auto; padding: 0 4px; }

    table.data-table th, table.data-table td { padding: 8px; font-size: 0.85rem; }
}
