/* ═══════════════════════════════════════════════════════════
   Nafhan Family Tree — Main Stylesheet
   Mobile-first, Inter font, Dark navy + Gold design system
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Primary */
    --deep-navy:   #1a1a2e;
    --royal-blue:  #16213e;
    --ocean-blue:  #0f3460;
    /* Accent */
    --gold:        #d4af37;
    --gold-light:  #f0e68c;
    --gold-dim:    rgba(212,175,55,0.15);
    /* Text */
    --text-primary:   #ffffff;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --error:   #ef4444;
    --info:    #3b82f6;
    /* Neutral */
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-800: #1e293b;
    /* Shadows */
    --shadow-sm:  0 2px 4px rgba(0,0,0,0.12);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.18);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.24);
    --shadow-gold: 0 0 20px rgba(212,175,55,0.35);
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
    /* Sizing */
    --header-h: 60px;
    --bottom-nav-h: 60px;
    --node-w: 130px;
    --node-h: 170px;
    --node-w-lg: 160px;
    --node-h-lg: 200px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--deep-navy);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--royal-blue); }
::-webkit-scrollbar-thumb { background: var(--ocean-blue); border-radius: 3px; }

/* ── Header ──────────────────────────────────────────────── */
#app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--royal-blue);
    border-bottom: 1px solid rgba(212,175,55,0.2);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.75rem;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-logo {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.header-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.icon-btn:active { background: rgba(255,255,255,0.04); transform: scale(0.95); }

.badge {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--error);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* User avatar in header */
.header-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.15s;
}
.header-avatar:hover { transform: scale(1.08); }

/* ── Breadcrumb ──────────────────────────────────────────── */
#breadcrumb-bar {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    height: 36px;
    background: rgba(15,52,96,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.25rem;
    z-index: 99;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
#breadcrumb-bar::-webkit-scrollbar { display: none; }

.crumb {
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.crumb:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.crumb.active { color: var(--gold); font-weight: 600; cursor: default; }
.crumb-sep { color: var(--text-muted); font-size: 0.7rem; }

/* ── Tree Canvas ─────────────────────────────────────────── */
#tree-container {
    position: fixed;
    top: calc(var(--header-h) + 36px);
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    background: var(--deep-navy);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(15,52,96,0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(26,26,46,0.5) 0%, transparent 60%);
}
#tree-container.dragging { cursor: grabbing; }

#tree-canvas {
    position: absolute;
    top: 0; left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    #tree-container { bottom: var(--bottom-nav-h); }
}

/* ── Tree Node ───────────────────────────────────────────── */
.tree-node {
    position: absolute;
    width: var(--node-w);
    background: var(--royal-blue);
    border: 2px solid rgba(212,175,55,0.3);
    border-radius: 14px;
    padding: 1rem 0.75rem 0.875rem;
    text-align: center;
    cursor: pointer;
    transition:
        transform 0.5s var(--ease-out),
        box-shadow 0.15s,
        border-color 0.15s,
        opacity 0.5s var(--ease-out);
    box-shadow: var(--shadow-sm);
    user-select: none;
    will-change: transform;
}

.tree-node:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
    z-index: 10;
}

.tree-node.center-node {
    border: 3px solid var(--gold);
    box-shadow: var(--shadow-gold);
    cursor: default;
    z-index: 5;
    background: linear-gradient(135deg, var(--royal-blue), var(--ocean-blue));
}
.tree-node.center-node:hover { transform: none !important; }

.tree-node.ghost-node {
    opacity: 0.65;
    border: 2px dashed var(--warning);
    background: rgba(245,158,11,0.06);
}

.tree-node.deceased-node {
    border-color: rgba(148,163,184,0.4);
    background: rgba(30,41,59,0.8);
}

.tree-node.highlight-pulse {
    animation: pulse-gold 2s ease;
}

@keyframes pulse-gold {
    0%   { box-shadow: 0 0 0 0 rgba(212,175,55,0.6); }
    50%  { box-shadow: 0 0 0 16px rgba(212,175,55,0); }
    100% { box-shadow: var(--shadow-sm); }
}

/* Photo */
.node-photo-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    overflow: hidden;
    border: 2px solid rgba(212,175,55,0.4);
    background: var(--ocean-blue);
    position: relative;
}

.center-node .node-photo-wrap { border-color: var(--gold); box-shadow: var(--shadow-gold); }
.deceased-node .node-photo-wrap { border-color: #475569; filter: grayscale(1); }
.ghost-node .node-photo-wrap { opacity: 0.7; }

.node-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.node-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold);
}

/* Name */
.node-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.2rem;
    word-break: break-word;
}
.center-node .node-name { font-size: 0.875rem; }
.ghost-node .node-name { font-style: italic; color: var(--text-secondary); }

.node-year {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Badges */
.node-badges {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.node-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}
.badge-admin    { background: rgba(212,175,55,0.2); color: var(--gold); }
.badge-subadmin { background: rgba(59,130,246,0.2); color: #93c5fd; }
.badge-verified { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.badge-ghost    { background: rgba(245,158,11,0.2); color: var(--warning); }
.badge-deceased { background: rgba(100,116,139,0.3); color: #94a3b8; }
.badge-me       { background: rgba(212,175,55,0.3); color: var(--gold); }

/* View card button (shows on hover of node) */
.node-view-btn {
    display: none;
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.3rem;
    background: var(--gold-dim);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 6px;
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s;
}
.tree-node:hover .node-view-btn { display: block; }
.tree-node.center-node .node-view-btn { display: block; }
.node-view-btn:hover { background: rgba(212,175,55,0.25); }

/* ── Connection Lines SVG ────────────────────────────────── */
#connection-svg {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    overflow: visible;
}

.conn-parent-child { stroke: #475569; stroke-width: 2; fill: none; }
.conn-spouse       { stroke: var(--gold); stroke-width: 3; fill: none; }
.conn-sibling      { stroke: #475569; stroke-width: 2; fill: none; stroke-dasharray: 6,4; }
.conn-ghost        { stroke: var(--warning); stroke-width: 2; fill: none; stroke-dasharray: 6,4; opacity: 0.6; }

/* ── Control Bar (Desktop) ───────────────────────────────── */
#control-bar {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22,33,62,0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 90;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 767px) { #control-bar { display: none; } }

.ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, transform 0.1s;
}
.ctrl-btn:hover { background: rgba(212,175,55,0.15); color: var(--gold); }
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.12); margin: 0 0.25rem; }
.ctrl-zoom-val { font-size: 0.75rem; color: var(--text-secondary); min-width: 36px; text-align: center; }

/* ── Mobile Bottom Nav ───────────────────────────────────── */
#mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--royal-blue);
    border-top: 1px solid rgba(212,175,55,0.15);
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding: 0 0.5rem;
}
@media (max-width: 767px) { #mobile-nav { display: flex; } }

.nav-btn {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    transition: color 0.12s;
    font-family: inherit;
}
.nav-btn span { font-size: 0.6rem; color: inherit; }
.nav-btn:hover { color: var(--gold); }
.nav-btn.active { color: var(--gold); }
.nav-btn.add-btn {
    color: var(--gold);
    font-size: 1.75rem;
}

/* ── Search Panel ────────────────────────────────────────── */
#search-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5rem 1rem 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
#search-panel.open {
    opacity: 1;
    pointer-events: all;
}

.search-box {
    background: var(--royal-blue);
    border-radius: 16px;
    padding: 1.25rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--ocean-blue);
    border-radius: 10px;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}
.search-input::placeholder { color: var(--text-muted); }

.search-icon { color: var(--text-muted); font-size: 1.1rem; }

.search-results { max-height: 300px; overflow-y: auto; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s;
}
.search-result-item:hover { background: rgba(255,255,255,0.06); }

.search-result-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--ocean-blue);
    flex-shrink: 0;
    border: 1.5px solid rgba(212,175,55,0.3);
}
.search-result-photo img { width: 100%; height: 100%; object-fit: cover; }

.search-result-info .name { font-weight: 600; font-size: 0.9rem; }
.search-result-info .meta { font-size: 0.75rem; color: var(--text-muted); }

.search-empty { text-align: center; color: var(--text-muted); padding: 1.5rem 0; font-size: 0.875rem; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--royal-blue);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s var(--ease-out);
    position: relative;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    background: var(--royal-blue);
    z-index: 1;
    border-radius: 20px 20px 0 0;
}

.modal-title { font-size: 1.125rem; font-weight: 700; }

.close-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s;
    font-family: inherit;
}
.close-btn:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); }

.modal-body { padding: 1.5rem; }

/* ── Member Card ─────────────────────────────────────────── */
.member-card .photo-section {
    text-align: center;
    margin-bottom: 1.25rem;
}

.member-card .large-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 0.75rem;
    border: 3px solid var(--gold);
    box-shadow: var(--shadow-gold);
    background: var(--ocean-blue);
}
.member-card .large-photo img { width: 100%; height: 100%; object-fit: cover; }
.member-card .large-photo.deceased { filter: grayscale(1); border-color: #475569; }
.member-card .large-photo .initials {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; color: var(--gold);
}

.member-card .member-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
.member-card .member-nickname {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.info-grid {
    display: grid;
    gap: 0.5rem;
    margin: 1rem 0;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 0.875rem;
}
.info-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
}
.info-row .icon { width: 20px; text-align: center; flex-shrink: 0; }
.info-row .label { color: var(--text-muted); font-size: 0.75rem; margin-right: auto; }
.info-row .value { color: var(--text-primary); }

.fun-fact {
    background: var(--gold-dim);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0.75rem 0;
    font-style: italic;
}
.fun-fact::before { content: '"'; color: var(--gold); font-size: 1.25rem; }
.fun-fact::after  { content: '"'; color: var(--gold); font-size: 1.25rem; }

.relationship-badge {
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
    color: #93c5fd;
    text-align: center;
    margin: 0.75rem 0;
}
.relationship-badge .rel-label { font-weight: 600; }

.card-actions {
    display: flex;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s, opacity 0.15s;
    white-space: nowrap;
    text-decoration: none;
    flex: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-primary  { background: var(--gold); color: #1a1a2e; }
.btn-primary:hover  { background: var(--gold-light); box-shadow: 0 4px 12px rgba(212,175,55,0.3); }

.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-secondary:hover { background: rgba(255,255,255,0.14); }

.btn-danger   { background: rgba(239,68,68,0.2); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.35); }

.btn-success  { background: rgba(16,185,129,0.2); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.35); }

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn-full { width: 100%; flex: none; }

/* ── Add Member Modal ────────────────────────────────────── */
.form-step { display: none; }
.form-step.active { display: block; }

.step-indicator {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.step-dot {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    transition: background 0.3s;
}
.step-dot.done { background: var(--gold); }

.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-label .required { color: var(--gold); margin-left: 0.15rem; }

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.25);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}
.form-input.error { border-color: var(--error); }
.form-input.valid { border-color: var(--success); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-hint  { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.form-error { font-size: 0.75rem; color: #fca5a5; margin-top: 0.35rem; }
.form-valid { font-size: 0.75rem; color: #6ee7b7; margin-top: 0.35rem; }

.char-counter { font-size: 0.7rem; color: var(--text-muted); text-align: right; }

/* Photo upload zone */
.photo-upload-zone {
    border: 2px dashed rgba(212,175,55,0.3);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: rgba(0,0,0,0.15);
    position: relative;
}
.photo-upload-zone:hover { border-color: var(--gold); background: var(--gold-dim); }
.photo-upload-zone.drag-over { border-color: var(--gold); background: rgba(212,175,55,0.1); }
.photo-upload-zone input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.photo-upload-zone .upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.photo-upload-zone .upload-label { font-size: 0.875rem; color: var(--text-secondary); }
.photo-upload-zone .upload-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.photo-preview-wrap { position: relative; display: inline-block; }
.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
    display: block;
}
.photo-remove-btn {
    position: absolute;
    top: 0; right: 0;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--error);
    border: none;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* ── Notifications Panel ─────────────────────────────────── */
#notif-panel {
    position: fixed;
    top: var(--header-h);
    right: 0;
    width: 360px;
    max-height: calc(100vh - var(--header-h));
    background: var(--royal-blue);
    border-left: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 0 0 0 16px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease-out);
}
#notif-panel.open { transform: translateX(0); }
@media (max-width: 767px) {
    #notif-panel { width: 100%; border-radius: 0; }
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    background: var(--royal-blue);
    z-index: 1;
}
.notif-header-title { font-weight: 700; }
.notif-actions { display: flex; gap: 0.5rem; }
.notif-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
.notif-actions button:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.notif-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.12s;
    cursor: default;
}
.notif-item.unread { background: rgba(212,175,55,0.04); }
.notif-item:hover  { background: rgba(255,255,255,0.04); }

.notif-item-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.notif-type-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.notif-title     { font-size: 0.875rem; font-weight: 600; flex: 1; }
.notif-unread-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    margin-top: 0.35rem;
}
.notif-message { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; }
.notif-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.35rem; }
.notif-btn-row { display: flex; gap: 0.375rem; margin-top: 0.5rem; }
.notif-btn-row .btn { font-size: 0.75rem; padding: 0.35rem 0.75rem; }

/* ── Profile Dropdown ────────────────────────────────────── */
#profile-dropdown {
    position: fixed;
    top: calc(var(--header-h) + 4px);
    right: 1rem;
    background: var(--royal-blue);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 220px;
    overflow: hidden;
    display: none;
    animation: slideDown 0.2s var(--ease-out);
}
#profile-dropdown.open { display: block; }

@keyframes slideDown {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.profile-info {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.profile-info .p-name  { font-weight: 700; font-size: 0.9rem; }
.profile-info .p-email { font-size: 0.75rem; color: var(--text-muted); }
.profile-info .p-role  { margin-top: 0.35rem; }

.dropdown-menu a, .dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}
.dropdown-menu a:hover, .dropdown-menu button:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}
.dropdown-menu .icon { width: 20px; text-align: center; }

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: var(--royal-blue);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s var(--ease-out) forwards;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: all;
    white-space: nowrap;
}
.toast.success { border-color: rgba(16,185,129,0.4); color: #6ee7b7; }
.toast.error   { border-color: rgba(239,68,68,0.4);  color: #fca5a5; }
.toast.info    { border-color: rgba(59,130,246,0.4); color: #93c5fd; }
.toast.hiding  { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn  { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-10px); opacity: 0; } }

/* ── Loading overlay ─────────────────────────────────────── */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--deep-navy);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: opacity 0.4s;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }

.spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(212,175,55,0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { color: var(--text-muted); font-size: 0.875rem; }

/* ── Utility ─────────────────────────────────────────────── */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

.text-gold    { color: var(--gold); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }

.flex         { display: flex; }
.items-center { align-items: center; }
.gap-2        { gap: 0.5rem; }
.gap-3        { gap: 0.75rem; }

/* ── Ghost confirmation animation ─────────────────────────── */
@keyframes ghostConfirm {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); opacity: 0.65; }
    50%  { box-shadow: 0 0 0 20px rgba(16,185,129,0); opacity: 1; border-style: solid; }
    100% { box-shadow: var(--shadow-sm); opacity: 1; }
}
.tree-node.confirming { animation: ghostConfirm 0.8s var(--ease-out) forwards; }

/* ── Desktop large nodes ─────────────────────────────────── */
@media (min-width: 1024px) {
    .tree-node { width: var(--node-w-lg); }
    .node-photo-wrap { width: 74px; height: 74px; }
    .node-name { font-size: 0.875rem; }
    .center-node .node-name { font-size: 1rem; }
}

/* ── Link modal (Find Yourself) ──────────────────────────── */
.link-hint {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.875rem;
    color: #93c5fd;
    line-height: 1.5;
    margin-bottom: 1rem;
}
