:root {
    /* Colors - Light Theme (default) */
    --bg-color: #f8fafc;
    --bg-panel: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #eff6ff;
    --node-border: #e2e8f0;
    --line-color: #cbd5e1;
    --line-active: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Layout */
    --header-height: 72px;
    --sidebar-width: 360px;
    
    /* Z-index hierarchy */
    --z-lines: 1;
    --z-nodes: 2;
    --z-header: 10;
    --z-details: 30;
    
    /* Transitions */
    --trans-fast: 150ms ease;
    --trans-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden; /* Prevent scrolling on body, handled by tree */
    display: flex;
    flex-direction: column;
    height: 100vh;
}

button {
    -webkit-user-select: none;
    user-select: none;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--node-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: relative;
    z-index: var(--z-header);
    box-shadow: var(--shadow-sm);
}

/* Search Container */
.search-container {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.search-container input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--node-border);
    border-radius: 9999px;
    background-color: var(--bg-color);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all var(--trans-fast);
    outline: none;
}

.search-container input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
    background-color: var(--bg-panel);
}

.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--node-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    list-style: none;
    z-index: var(--z-details);
}

.search-results li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--node-border);
    transition: background-color var(--trans-fast);
}

.search-results li:last-child {
    border-bottom: none;
}

.search-results li:hover {
    background-color: var(--bg-color);
    color: var(--accent-color);
}

/* Main Layout */
.app-main {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
}

/* Tree Container */
.tree-container {
    flex: 1;
    position: relative;
    cursor: grab;
    overflow: hidden;
    /* Optional dot pattern background */
    background-image: radial-gradient(var(--node-border) 1px, transparent 1px);
    background-size: 24px 24px;
}

.tree-container:active {
    cursor: grabbing;
}

/* Tree Controls (Floating) */
.tree-controls {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    z-index: var(--z-header);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-btn {
    background: var(--bg-panel);
    border: 1px solid var(--node-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--trans-fast);
}

.control-btn:hover {
    background: var(--bg-color);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.control-btn svg {
    color: var(--text-secondary);
    transition: color var(--trans-fast);
}

.control-btn:hover svg {
    color: var(--accent-color);
}

.tree-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-lines);
    pointer-events: none;
    transform-origin: 0 0;
    overflow: visible;
}

.tree-lines path {
    fill: none;
    stroke: var(--line-color);
    stroke-width: 2px;
    transition: stroke var(--trans-normal);
}

.tree-lines path.active-path {
    stroke: var(--accent-color);
    stroke-width: 3px;
}

.tree-nodes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-nodes);
    transform-origin: 0 0;
    /* transition transform controlled via JS during zoom/pan */
}

.orientation-toggle-btn {
    display: none;
}

.tree-container.selection-moving {
    cursor: wait;
}

.tree-container.selection-moving .person-node,
.tree-container.selection-moving .couple-children-toggle {
    pointer-events: none;
}

.tree-container.selection-moving .person-node.active {
    box-shadow: 0 0 0 5px rgb(15 133 136 / 12%), var(--shadow-md);
}

@media (prefers-reduced-motion: reduce) {
    .tree-nodes,
    .tree-lines {
        transition: none !important;
    }
}

/* Person Node */
.person-node {
    position: absolute;
    width: 180px;
    background: var(--bg-panel);
    border: 1px solid var(--node-border);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform var(--trans-fast), box-shadow var(--trans-fast), border-color var(--trans-fast);
    transform: translate(-50%, -50%); /* Centered on X,Y */
    user-select: none;
}

.person-node:hover {
    transform: translate(-50%, -50%) translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.person-node.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color), var(--shadow-lg);
}

.move-up-button {
    position: absolute;
    top: 50%;
    right: calc(100% + 16px);
    width: auto;
    height: 54px;
    padding: 0;
    display: flex;
    align-items: center;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    z-index: 15;
}

.move-up-tooltip {
    position: relative;
    height: 48px;
    max-width: 230px;
    margin-right: 13px;
    padding: 0 22px 0 17px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid rgb(118 157 180 / .42);
    border-radius: 999px;
    background:
        radial-gradient(circle at 22% 0%, rgb(75 111 137 / .28), transparent 48%),
        linear-gradient(145deg, #18344a, #071d31 78%);
    color: #f8fbfd;
    box-shadow:
        0 8px 18px rgb(4 20 33 / .3),
        inset 0 1px 0 rgb(255 255 255 / .2),
        inset 0 -1px 0 rgb(0 0 0 / .16);
    font-family: var(--font-body, sans-serif);
    font-size: 13px;
    font-variation-settings: normal;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    letter-spacing: .005em;
    white-space: nowrap;
    transition: box-shadow var(--trans-fast), transform var(--trans-fast);
}

.move-up-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%) rotate(45deg);
    border-top: 1px solid rgb(118 157 180 / .3);
    border-right: 1px solid rgb(118 157 180 / .3);
    background: #0a2135;
    pointer-events: none;
}

.move-up-tooltip-icon {
    position: relative;
    z-index: 1;
    color: #35bfd1;
    font-size: 24px;
    font-variation-settings: 'FILL' 0, 'wght' 650, 'GRAD' 0, 'opsz' 24;
    filter: drop-shadow(0 1px 2px rgb(0 0 0 / .22));
}

.move-up-tooltip-icon::after {
    content: '';
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: -2px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.move-up-icon {
    width: 54px;
    height: 54px;
    display: grid;
    flex: 0 0 54px;
    place-items: center;
    border: 4px solid #56c9d6;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff, #e8f1f2);
    color: #1295a7;
    box-shadow:
        0 7px 16px rgb(5 39 50 / .28),
        0 0 0 2px rgb(255 255 255 / .72),
        inset 0 1px 3px rgb(255 255 255 / .85);
    font-size: 31px;
    line-height: 1;
    transition: color var(--trans-fast), background-color var(--trans-fast), box-shadow var(--trans-fast);
}

.move-up-button:hover .move-up-tooltip,
.move-up-button:focus-visible .move-up-tooltip {
    transform: translateX(-3px);
    box-shadow: 0 10px 24px rgb(4 20 33 / .36), inset 0 1px 0 rgb(255 255 255 / .23);
}

.move-up-button:hover .move-up-icon,
.move-up-button:focus-visible .move-up-icon {
    color: #087b8b;
    border-color: #42d1df;
    background: #fff;
    box-shadow: 0 9px 20px rgb(5 39 50 / .34), 0 0 0 3px rgb(66 209 223 / .2);
}

.move-up-button:focus-visible {
    outline: none;
}

.node-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.75rem;
    border: 2px solid var(--bg-color);
    box-shadow: var(--shadow-sm);
    background-color: var(--node-border); /* fallback */
}

.node-name {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.node-year {
    position: absolute;
    top: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1;
}

.node-birth-year {
    left: 8px;
}

.node-death-year {
    right: 8px;
    text-align: center;
}

.node-death-year::after {
    content: '\271D';
    display: block;
    margin-top: 3px;
    font-size: 0.85rem;
    line-height: 1;
    color: currentColor;
}

.gender-icon {
    position: absolute;
    left: auto;
    right: 8px;
    bottom: 6px;
    transform: none;
    font-size: 1.25rem;
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 20;
    line-height: 1;
    pointer-events: none;
}

.gender-icon-male {
    color: #2563eb;
}

.gender-icon-female {
    color: #db2777;
}

.expand-toggle {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--bg-panel);
    border: 1px solid var(--node-border);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--trans-fast);
    z-index: 10;
}

.expand-toggle:hover {
    background-color: var(--bg-color);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.person-node.active .expand-toggle {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.expand-toggle .material-symbols-rounded {
    font-size: 18px;
}

.couple-children-toggle {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    background: var(--bg-panel);
    color: var(--accent-color);
    font: 700 18px/1 sans-serif;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--trans-fast);
    z-index: 12;
}

.couple-children-toggle:hover,
.couple-children-toggle:focus-visible {
    background: var(--accent-color);
    color: #fff;
    outline: none;
}

.spouse-toggle {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-panel);
    border: 1px solid var(--node-border);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--trans-fast);
    z-index: 10;
}

.spouse-toggle:hover {
    background-color: var(--bg-color);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.person-node.active .spouse-toggle {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Sidebar / Modal Details */
.person-details {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-left: 1px solid var(--node-border);
    box-shadow: -10px 0 20px -10px rgb(0 0 0 / 0.1);
    z-index: var(--z-details);
    transform: translateX(0);
    transition: transform var(--trans-normal);
    display: flex;
    flex-direction: column;
}

.person-details.hidden {
    transform: translateX(100%);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--trans-fast), color var(--trans-fast);
}

.close-btn:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.details-content {
    padding: 2.5rem 1.5rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Detailed content styling */
.detail-header {
    text-align: center;
    margin-bottom: 2rem;
}

.detail-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 4px solid var(--bg-color);
    box-shadow: var(--shadow-md);
}

.detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--node-border);
    padding-bottom: 0.25rem;
}

.detail-row {
    display: flex;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.detail-label {
    flex: 0 0 100px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

/* Back to tree button */
.back-to-tree-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    margin-top: 1.5rem;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--trans-fast), transform var(--trans-fast);
}

.back-to-tree-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.back-to-tree-btn svg {
    flex-shrink: 0;
}

/* Icon-only control buttons (used on both desktop & mobile) */
.control-btn span {
    display: inline;
}

/* ====================================
   RESPONSIVE — TABLETS & MOBILE
   ==================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 48px;
    }
    
    /* Header — Floating and compact */
    .app-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0 0.5rem;
        gap: 0.5rem;
        border-bottom: none;
        background: rgba(255, 255, 255, 0.65);
    }
    
    /* Make tree container use full screen under the transparent floating header */
    .app-main {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 0; /* Below header */
    }
    
    .search-container {
        max-width: 180px;
    }
    
    .search-container input {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    /* Tree container */
    .tree-container {
        cursor: default;
        touch-action: none;
    }
    
    .tree-container:active {
        cursor: default;
    }
    
    /* Tree Controls */
    .tree-controls {
        bottom: 1rem;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .control-btn {
        padding: 0.5rem;
        width: 40px;
        height: 40px;
    }
    
    /* Hide labels on mobile icons */
    .control-btn span {
        display: none;
    }
    
    /* COMPRESSED Person Nodes */
    .person-node {
        width: 120px;
        padding: 0.5rem 0.375rem;
        border-radius: 8px;
    }
    
    .node-avatar {
        width: 36px;
        height: 36px;
        margin-bottom: 0.375rem;
    }
    
    .node-name {
        font-size: 0.6875rem;
        line-height: 1.1;
    }
    
    .node-year {
        font-size: 0.5625rem;
    }

    .gender-icon {
        right: 5px;
        bottom: 4px;
        font-size: 0.875rem;
    }
    
    .expand-toggle {
        width: 28px;
        height: 28px;
        bottom: -14px;
        font-size: 16px;
    }
    
    .spouse-toggle {
        width: 28px;
        height: 28px;
        top: -10px;
        right: -10px;
        font-size: 16px;
    }
    
    /* Sidebar */
    .person-details {
        width: 100%;
        max-width: none;
        z-index: var(--z-details);
    }
    
    .details-content {
        padding: 3.5rem 1rem 1rem; /* Extra top padding clear header */
    }
    
    .detail-avatar {
        width: 80px;
        height: 80px;
    }
    
    .detail-name {
        font-size: 1.125rem;
    }
    
    .detail-section h3 {
        font-size: 0.625rem;
    }
    
    .detail-row {
        font-size: 0.75rem;
        flex-direction: column;
        gap: 0.125rem;
    }
    
    .detail-label {
        flex: none;
        font-size: 0.6875rem;
    }
    
    /* Search results */
    .search-results {
        max-height: 200px;
    }
    
    .search-results li {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }
}

/* ====================================
   RESPONSIVE — SMALL PHONES
   ==================================== */
@media (max-width: 480px) {
    .search-container {
        max-width: 140px;
    }
    
    /* ULTRA COMPRESSED Person Nodes */
    .person-node {
        width: 100px;
        padding: 0.375rem 0.25rem;
        border-radius: 8px;
    }
    
    .node-avatar {
        width: 32px;
        height: 32px;
        margin-bottom: 0.25rem;
    }
    
    .node-name {
        font-size: 0.625rem;
        line-height: 1.1;
    }
    
    .node-year {
        font-size: 0.5rem;
    }

    .gender-icon {
        right: 4px;
        bottom: 3px;
        font-size: 0.8rem;
    }
    
    .tree-controls {
        bottom: 0.75rem;
        gap: 0.375rem;
    }
    
    .control-btn {
        width: 38px;
        height: 38px;
        padding: 0.5rem;
    }
    
    .control-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .expand-toggle {
        width: 24px;
        height: 24px;
        bottom: -12px;
        font-size: 14px;
    }
    
    .spouse-toggle {
        width: 24px;
        height: 24px;
        top: -8px;
        right: -8px;
        font-size: 14px;
    }
}

/* Person editor */
.header-action, .primary-btn, .secondary-btn {
    border: 0;
    border-radius: 9px;
    padding: .65rem 1rem;
    font: inherit;
    cursor: pointer;
}
.header-action, .primary-btn { background: var(--accent-color); color: white; }
.secondary-btn { background: var(--accent-light); color: var(--accent-hover); }
.person-editor { width: min(720px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); margin: auto; border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); }
.person-editor::backdrop { background: rgb(15 23 42 / .55); }
.person-editor form { padding: 1.5rem; overflow-y: auto; max-height: calc(100vh - 2rem); }
.editor-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.editor-heading .close-btn { position: static; }
.editor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.parents-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.parents-intro { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); }
.parent-card { display: grid; gap: .85rem; padding: 1.1rem; border: 1px solid var(--node-border); border-radius: 12px; background: var(--surface-soft, #f8fafc); }
.parent-card h3 { margin: 0; font-family: var(--font-display, serif); }
.parents-fields label { display: flex; flex-direction: column; gap: .35rem; color: var(--text-secondary); font-size: .8rem; font-weight: 600; }
.parents-fields input, .parents-fields select { width: 100%; border: 1px solid var(--node-border); border-radius: 8px; padding: .65rem; background: white; color: var(--text-primary); font: inherit; }
.add-parents-btn { width: 100%; display: flex; align-items: center; gap: .8rem; margin: 0 0 1rem; padding: .9rem 1rem; border: 1px solid color-mix(in srgb, var(--accent-color) 35%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--accent-color) 8%, white); color: var(--text-primary); text-align: left; cursor: pointer; }
.add-parents-btn > span:first-child { display: grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 auto; border-radius: 50%; background: var(--accent-color); color: white; font-size: 1.25rem; }
.add-parents-btn strong, .add-parents-btn small { display: block; }
.add-parents-btn small { margin-top: .15rem; color: var(--text-secondary); }
.add-parents-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.editor-fields label, .login-panel label { display: flex; flex-direction: column; gap: .35rem; color: var(--text-secondary); font-size: .8rem; font-weight: 600; }
.editor-fields label.checkbox-field { flex-direction: row; align-items: center; align-self: end; min-height: 2.75rem; }
.editor-fields label.checkbox-field input { width: auto; }
.editor-fields input, .editor-fields select, .login-panel input { width: 100%; border: 1px solid var(--node-border); border-radius: 8px; padding: .65rem; background: white; color: var(--text-primary); font: inherit; }
.editor-fields select[multiple] { min-height: 8rem; }
.full-field { grid-column: 1 / -1; }
.editor-actions { display: flex; justify-content: space-between; gap: 1rem; }
.editor-submit-actions { display: flex; justify-content: flex-end; gap: .75rem; }
.person-editor.add-person-mode .optional-person-field,
.person-editor.add-person-mode #delete-person-btn,
.person-editor.add-person-mode #logout-btn { display: none; }
.person-editor.add-person-mode .editor-actions { justify-content: flex-end; }
.editor-message { min-height: 1.5rem; color: #b91c1c; }
.save-toast {
    position: fixed;
    z-index: 1000;
    right: 1.25rem;
    bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    max-width: min(360px, calc(100vw - 2rem));
    padding: .85rem 1rem;
    border-radius: 12px;
    background: #15803d;
    color: white;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity var(--trans-fast), transform var(--trans-fast);
}
.save-toast.is-visible { opacity: 1; transform: translateY(0); }
.save-toast:not(.is-error) { background: #15803d; }
.save-toast.is-error { background: #b91c1c; }
.save-toast .material-symbols-rounded { font-size: 1.25rem; }
.login-panel { display: grid; gap: 1rem; }
.edit-person-btn { margin-top: .75rem; }
.hidden { display: none !important; }
@media (max-width: 640px) {
    .app-header { gap: .5rem; padding: 0 .75rem; }
    .header-action { padding: .55rem .7rem; }
    .editor-fields, .parents-fields { grid-template-columns: 1fr; }
    .full-field { grid-column: auto; }
}
