/* ============================================================
   Ancestric — Product App (SPA)
   Design system: warm ivory, deep maroon, saffron & gold
   (tokens mirrored from the marketing site, self-contained)
   ============================================================ */

:root {
  --ivory: #faf6ee;
  --ivory-2: #f3ecdd;
  --paper: #fffdf8;
  --ink: #2b1416;
  --ink-soft: #5d4547;
  --maroon: #5c1a1b;
  --maroon-deep: #3d0f10;
  --saffron: #e8912d;
  --saffron-deep: #c9651a;
  --gold: #c9a227;
  --line: rgba(92, 26, 27, 0.14);
  --shadow-sm: 0 1px 2px rgba(61, 15, 16, 0.06), 0 4px 14px rgba(61, 15, 16, 0.06);
  --shadow-md: 0 2px 6px rgba(61, 15, 16, 0.08), 0 16px 40px rgba(61, 15, 16, 0.12);
  --shadow-lg: 0 8px 20px rgba(61, 15, 16, 0.12), 0 32px 80px rgba(61, 15, 16, 0.18);
  --radius: 20px;
  --font-display: "Fraunces", "Noto Serif Devanagari", Georgia, serif;
  --font-body: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;
  --font-dev: "Noto Serif Devanagari", "Fraunces", serif;
  --font-dev-body: "Noto Sans Devanagari", "Inter", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 18px; }
html.elder { font-size: 21px; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; color: var(--maroon-deep); margin: 0; }
.dev { font-family: var(--font-dev); }
.accent { color: var(--saffron-deep); font-style: italic; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-body); font-weight: 600; font-size: 1rem;
  padding: 0.85rem 1.6rem; border-radius: 999px; border: 1.5px solid transparent;
  text-decoration: none; cursor: pointer; min-height: 48px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn--primary {
  background: linear-gradient(135deg, var(--saffron) 0%, var(--saffron-deep) 100%);
  color: #fff; box-shadow: 0 6px 20px rgba(201, 101, 26, 0.35);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(201, 101, 26, 0.45); }
.btn--ghost { background: transparent; color: var(--maroon); border-color: var(--line); }
.btn--ghost:hover { background: rgba(92, 26, 27, 0.06); }
.btn--danger { background: transparent; color: #a02c2c; border-color: rgba(160, 44, 44, 0.4); }
.btn--danger:hover { background: rgba(160, 44, 44, 0.08); }
.btn--sm { padding: 0.5rem 1.15rem; font-size: 0.92rem; min-height: 40px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- OAuth sign-in buttons ---------- */
.oauth-buttons { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.2rem; }
.btn--oauth { border: 1.5px solid var(--line); }
.btn--oauth-google { background: #fff; color: #1f1f1f; }
.btn--oauth-google:hover { background: #f4f1ea; }
.btn--oauth-apple { background: #000; color: #fff; border-color: #000; }
.btn--oauth-apple:hover { background: #1d1d1f; }
.oauth-mark {
  width: 1.2rem; height: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem; line-height: 1;
}
.oauth-mark--google { color: #4285f4; font-family: var(--font-body); }
svg.oauth-mark { display: block; }
.login-divider {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--ink-soft); font-size: 0.85rem; margin: 0 0 1.2rem;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.otp-entry { display: grid; gap: 1rem; }
.otp-entry input {
  font-size: 1.35rem; font-weight: 700; letter-spacing: 0.35em;
  text-align: center; font-variant-numeric: tabular-nums;
}
.auth-callback {
  min-height: 100vh; display: grid; place-items: center; padding: 1.25rem;
  background: radial-gradient(circle at 50% 0, #fff8e9, var(--ivory));
}
.auth-callback__card { width: min(420px, 100%); text-align: center; padding: 2.5rem; }
.auth-callback__card h1 { margin: 1rem 0 0.5rem; color: var(--maroon); }
.auth-callback__card p { color: var(--ink-soft); }
.auth-callback__spinner {
  display: inline-block; width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--saffron);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 1rem;
  height: 68px; padding: 0 clamp(0.9rem, 4vw, 2rem);
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--maroon); flex-shrink: 0; }
.brand__mark { width: 32px; height: 32px; }
.brand__word { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; display: flex; flex-direction: column; line-height: 1; }
.topbar__fam {
  font-family: var(--font-display); font-weight: 600; color: var(--maroon-deep);
  font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.topbar__actions { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.topbar__actions[hidden] { display: none; }
.eldertoggle {
  font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft);
  background: var(--ivory-2); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 0.45rem 1rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 44px;
}
.eldertoggle[aria-pressed="true"] { background: var(--maroon); color: #f7ead2; border-color: var(--maroon); }

/* ---------- Layout ---------- */
.app { width: min(1160px, 94vw); margin-inline: auto; padding: 1.6rem 0 4rem; }
.screen-head { margin: 0.6rem 0 1.6rem; }
.screen-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -0.015em; }
.screen-head p { color: var(--ink-soft); margin: 0.4rem 0 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--saffron-deep); margin: 0 0 0.8rem;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--saffron); box-shadow: 0 0 0 4px rgba(232, 145, 45, 0.2); }

/* ---------- Cards & panels ---------- */
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 1.2rem; margin-bottom: 0.8rem; }

/* ---------- Heritage / stories ---------- */
.story-card { margin-bottom: 1rem; }
.story-card__head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.story-card__head h3 { margin: 0; flex: 1; }
.story-card__cat { font-size: 0.78rem; font-weight: 700; color: var(--saffron-deep); white-space: nowrap; }
.story-card__who { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.5rem; }
.story-card__body { line-height: 1.55; color: var(--ink); }
.story-card__tags { margin-top: 0.8rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag { font-size: 0.78rem; background: var(--paper-2, #f3ede2); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem; color: var(--ink-soft); }

/* ---------- Dynasty timeline ---------- */
.timeline { position: relative; padding-left: 1.4rem; }
.timeline::before { content: ""; position: absolute; left: 0.45rem; top: 0.4rem; bottom: 0.4rem; width: 2px; background: var(--line); }
.timeline__item { position: relative; padding-left: 0.6rem; margin-bottom: 1.1rem; }
.timeline__icon { position: absolute; left: -1.35rem; top: 0.1rem; font-size: 1.05rem; }
.timeline__year { display: inline-block; font-weight: 700; color: var(--saffron-deep); margin-right: 0.5rem; }
.timeline__undated { font-size: 0.72rem; color: var(--ink-soft); font-style: italic; margin-right: 0.5rem; }
.timeline__title { font-weight: 600; color: var(--ink); }
.timeline__sub { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.15rem; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: 0.95rem; color: var(--maroon); }
.field input, .field select, .field textarea {
  font: inherit; font-weight: 500; color: var(--ink);
  padding: 0.85rem 1.1rem; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--ivory);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--saffron); box-shadow: 0 0 0 4px rgba(232, 145, 45, 0.18);
}
.field textarea { resize: vertical; min-height: 90px; }
.field .hint { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.checkbox { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; margin-bottom: 1rem; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--saffron-deep); }

/* ---------- Messages / states ---------- */
.msg { border-radius: 14px; padding: 0.85rem 1.1rem; font-size: 0.95rem; margin: 0.8rem 0; }
.msg--error { background: rgba(160, 44, 44, 0.08); border: 1px solid rgba(160, 44, 44, 0.3); color: #7c2222; }
.msg--ok { background: rgba(46, 125, 50, 0.09); border: 1px solid rgba(46, 125, 50, 0.3); color: #2e5d32; }
.msg--info { background: rgba(232, 145, 45, 0.1); border: 1px solid rgba(232, 145, 45, 0.35); color: var(--maroon); }

.empty {
  text-align: center; padding: 3rem 1.5rem; color: var(--ink-soft);
  background: var(--paper); border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty__icon { font-size: 2.4rem; margin-bottom: 0.6rem; }
.empty strong { display: block; font-family: var(--font-display); font-size: 1.25rem; color: var(--maroon); margin-bottom: 0.3rem; }

.loading { display: flex; align-items: center; justify-content: center; gap: 0.8rem; padding: 3.5rem 0; color: var(--ink-soft); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--saffron-deep);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges (privacy circles) ---------- */
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.32rem 0.7rem; border-radius: 999px;
}
.badge--admin { background: var(--maroon); color: #f7ead2; }
.badge--close { background: var(--saffron-deep); color: #fff; }
.badge--extended { background: rgba(201, 162, 39, 0.18); color: #8a6d12; }
.badge--view_only, .badge--view { background: var(--ivory-2); color: var(--ink-soft); }

/* ---------- Login ---------- */
.access-screen {
  min-height: calc(100dvh - 180px); display: grid; grid-template-columns: 1fr 470px;
  gap: clamp(3rem, 8vw, 8rem); align-items: center; padding: clamp(2rem, 6vw, 5rem) 0;
}
.access-intro { max-width: 570px; }
.access-intro h1 { font-size: clamp(3rem, 6vw, 5.6rem); letter-spacing: -0.055em; margin-bottom: 1rem; }
.access-intro > p:not(.eyebrow) { max-width: 500px; color: var(--ink-soft); font-size: 1.05rem; }
.access-intro__dev { font-family: var(--font-dev); color: var(--saffron-deep) !important; font-size: 1.2rem !important; }
.access-intro ul { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin: 1.7rem 0 0; padding: 1.2rem 0 0; border-top: 1px solid var(--line); list-style: none; color: var(--ink-soft); font-size: .8rem; font-weight: 600; }
.access-intro li::before { content: "✓"; margin-right: .4rem; color: #2f7057; }
.login-wrap { max-width: 480px; margin: 4vh auto 0; }
.login-card {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 8px);
  padding: clamp(2rem, 5vw, 3rem); box-shadow: var(--shadow-lg);
}
.login-card__kicker { color: var(--saffron-deep); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.login-card h2 { margin: 0 0 .45rem; font-size: clamp(2.2rem, 4vw, 3rem); }
.login-card__greeting { font-family: var(--font-dev); font-size: 2.2rem; font-weight: 700; color: var(--maroon); margin: 0 0 0.3rem; }
.login-card__tagline { color: var(--ink-soft); font-size: .92rem; margin: 0 0 1.6rem; }
.login-card form { text-align: left; }
.login-card input { font-size: 1rem; }
.login-card input[name="code"] { letter-spacing: 0.5em; font-weight: 700; }
.login-loading { padding: 1rem; border-radius: 14px; background: var(--ivory-2); color: var(--ink-soft); font-size: .9rem; }
.access-unavailable { padding-top: .25rem; }
.access-unavailable__dot { display: inline-block; width: 9px; height: 9px; margin-right: .45rem; border-radius: 50%; background: var(--saffron); box-shadow: 0 0 0 5px rgba(232,145,45,.15); }
.access-unavailable strong { color: var(--maroon); }
.access-unavailable p { margin: .7rem 0 1.2rem; color: var(--ink-soft); font-size: .9rem; }
.access-back { display: block; margin-top: 1rem; color: var(--ink-soft); font-size: .82rem; text-align: center; text-decoration: none; }
.access-back:hover { color: var(--maroon); text-decoration: underline; }
.devotp-hint {
  font-weight: 700; color: var(--saffron-deep);
  background: rgba(232, 145, 45, 0.12); border: 1px dashed rgba(201, 101, 26, 0.5);
  border-radius: 12px; padding: 0.6rem 1rem; margin: 0.6rem 0; font-size: 0.95rem;
}

/* ---------- Families dashboard ---------- */
.famgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; margin-bottom: 2.2rem; }
.famcard {
  display: block; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.famcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(232, 145, 45, 0.45); }
.famcard__name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--maroon-deep); margin: 0; }
.famcard__dev { font-family: var(--font-dev); color: var(--saffron-deep); font-size: 0.95rem; margin: 0.15rem 0 0.8rem; }
.famcard__meta { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.9rem; }
.famcard__count { font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- Family sub-nav tabs ---------- */
.tabs-shell { position: sticky; top: 65px; z-index: 50; margin-bottom: .8rem; padding: .45rem 0; background: rgba(250,246,238,.91); backdrop-filter: blur(14px); }
.tabs {
  display: flex; align-items: center; gap: 0.4rem; overflow: visible; padding: 0;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; font: inherit; font-weight: 600; font-size: 0.9rem; text-decoration: none;
  color: var(--ink-soft); background: transparent; border: 1px solid transparent;
  border-radius: 12px; padding: 0.55rem 1rem; min-height: 42px; display: inline-flex; align-items: center;
}
.tab:hover { background: var(--ivory-2); }
.tab.is-active { background: var(--maroon); border-color: var(--maroon); color: #f7ead2; box-shadow: var(--shadow-sm); }
.tabs-more { position: relative; margin-left: auto; }
.tabs-more summary { cursor: pointer; list-style: none; }
.tabs-more summary::-webkit-details-marker { display: none; }
.tabs-more summary::after { content: "⌄"; margin-left: .45rem; font-size: .75rem; }
.tabs-more__menu { position: absolute; top: calc(100% + .5rem); right: 0; width: 210px; padding: .5rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-md); }
.tabs-more__menu a { display: block; padding: .7rem .8rem; border-radius: 9px; color: var(--ink-soft); font-size: .88rem; font-weight: 600; text-decoration: none; }
.tabs-more__menu a:hover, .tabs-more__menu a.is-active { background: var(--ivory-2); color: var(--maroon); }

/* ---------- Tree stage ---------- */
.tree-stage {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  height: calc(100dvh - 250px); min-height: 440px; overflow: hidden;
}
.tree-stage svg { width: 100%; height: 100%; touch-action: none; cursor: grab; }
.tree-stage svg.is-dragging { cursor: grabbing; }
.tree-stage__bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(92, 26, 27, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
}
.tree-toolbar {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.tree-toolbar button, .tree-toolbar a {
  width: 52px; height: 52px; border-radius: 14px; font-size: 1.3rem; font-weight: 700;
  font-family: var(--font-body); color: var(--maroon);
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  cursor: pointer; display: grid; place-items: center; text-decoration: none;
}
.tree-toolbar button:hover, .tree-toolbar a:hover { background: var(--ivory-2); }
.tree-add { position: absolute; top: 14px; right: 14px; z-index: 6; display: inline-flex; align-items: center; min-height: 44px; padding: .65rem 1rem; border-radius: 999px; background: var(--saffron); color: var(--maroon-deep); box-shadow: var(--shadow-sm); font-size: .82rem; font-weight: 700; text-decoration: none; }
.tree-add:hover { transform: translateY(-1px); }
.tree-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; max-width: 70%;
  background: rgba(255, 253, 248, 0.9); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.5rem 0.8rem; font-size: 0.78rem; color: var(--ink-soft);
}
.tree-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--paper); }
.legend-dot--elder { background: #f7ead2; border-color: rgba(201, 162, 39, 0.6); }
.legend-dot--self { background: var(--maroon); border-color: var(--maroon); }
.legend-dot--spouse { background: #f4ede0; border-style: dashed; }
.legend-dot--deceased { background: #e8e2d6; border-color: #cfc6b6; }

/* Tree SVG nodes (mirrors landing hero tree aesthetics) */
.tlink { stroke: var(--gold); stroke-width: 2; fill: none; opacity: 0.6; }
.tunion { fill: var(--saffron-deep); }
.tspouse-line { stroke: var(--saffron-deep); stroke-width: 2; opacity: 0.7; }
.tnode { cursor: pointer; }
.tnode rect { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
.tnode--elder rect { fill: #f7ead2; stroke: rgba(201, 162, 39, 0.55); }
.tnode--self rect { fill: var(--maroon); stroke: var(--maroon); }
.tnode--spouse rect { fill: #f4ede0; stroke-dasharray: 4 3; }
.tnode--deceased rect { fill: #eee8db; stroke: #d5ccbc; }
.tnode:hover rect { stroke: var(--saffron); stroke-width: 2; }
.tnode__name { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; text-anchor: middle; fill: var(--ink); pointer-events: none; }
.tnode__sub { font-family: var(--font-dev-body); font-size: 11.5px; text-anchor: middle; fill: var(--saffron-deep); pointer-events: none; }
.tnode--self .tnode__name { fill: #f7ead2; }
.tnode--self .tnode__sub { fill: #e9c88f; }
.tnode--deceased .tnode__name, .tnode--deceased .tnode__sub { fill: #8a7f72; }
.tnode__speak { font-size: 13px; cursor: pointer; }

/* ---------- Member drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(43, 20, 22, 0.4); backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(440px, 100vw); background: var(--ivory);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  overflow-y: auto; padding: 1.4rem 1.4rem 3rem;
  animation: drawerIn 0.22s ease;
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.drawer__title { font-size: 1.45rem; }
.drawer__rel { font-family: var(--font-dev); color: var(--saffron-deep); font-size: 1.05rem; margin: 0.2rem 0 0; }
.drawer__close {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 1.15rem;
  background: var(--paper); border: 1px solid var(--line); cursor: pointer; color: var(--maroon);
}
.drawer__section { border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 1.1rem; }
.drawer__section h4 { font-family: var(--font-display); color: var(--maroon); font-size: 1.05rem; margin: 0 0 0.7rem; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.95rem; }
.detail-grid dt { font-weight: 600; color: var(--ink-soft); }
.detail-grid dd { margin: 0; color: var(--ink); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.speak-btn {
  width: 100%; margin-top: 0.9rem; padding: 0.9rem; border: 0; border-radius: 14px;
  font: inherit; font-family: var(--font-dev-body); font-size: 1.1rem; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, var(--saffron), var(--saffron-deep)); cursor: pointer;
}

/* ---------- Relation panel ---------- */
.relation-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 2rem; align-items: start; }
.relhero {
  background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-deep) 100%);
  border-radius: var(--radius); padding: 2rem; color: #fff; box-shadow: var(--shadow-md);
}
.relhero__dev { font-family: var(--font-dev); font-size: clamp(2.2rem, 6vw, 3rem); font-weight: 700; color: #ffd9a0; line-height: 1.2; }
.relhero__en { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin-top: 0.2rem; }
.relhero__note { font-size: 0.9rem; color: rgba(255, 255, 255, 0.75); margin-top: 0.5rem; }
.relvariants { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.8rem; margin-top: 1.1rem; }
.relvariant {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 0.85rem 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.relvariant:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.relvariant__label { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--saffron-deep); margin-bottom: 0.2rem; }
.relvariant__term { font-family: var(--font-display); font-weight: 600; color: var(--maroon); font-size: 1.02rem; }

/* ---------- Events ---------- */
.evt-group h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.15rem; margin: 1.6rem 0 0.8rem; }
.evt {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 1rem 1.2rem; margin-bottom: 0.7rem;
}
.evt__icon {
  flex-shrink: 0; width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.35rem;
  border-radius: 13px; background: linear-gradient(135deg, rgba(232, 145, 45, 0.16), rgba(201, 162, 39, 0.14));
  border: 1px solid rgba(232, 145, 45, 0.3);
}
.evt strong { color: var(--maroon-deep); }
.evt__meta { font-size: 0.88rem; color: var(--ink-soft); }
.evt--shraadh { border-left: 5px solid var(--gold); background: linear-gradient(90deg, rgba(201, 162, 39, 0.1), var(--paper) 40%); }
.evt--shraadh .evt__icon { background: rgba(201, 162, 39, 0.2); }

/* ---------- Documents ---------- */
.doc {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 1rem 1.2rem; margin-bottom: 0.7rem;
}
.doc__icon { font-size: 1.5rem; }
.doc__body { flex: 1; min-width: 180px; }
.doc__name { font-weight: 600; color: var(--maroon-deep); overflow-wrap: anywhere; }
.doc__meta { font-size: 0.85rem; color: var(--ink-soft); }
.doc__actions { display: flex; gap: 0.5rem; }
.aadhaar-note {
  display: flex; gap: 0.7rem; align-items: flex-start;
  background: rgba(232, 145, 45, 0.1); border: 1px solid rgba(232, 145, 45, 0.35);
  border-radius: 14px; padding: 0.9rem 1.1rem; font-size: 0.92rem; color: var(--maroon); margin: 1rem 0;
}

/* ---------- Circles & invites ---------- */
.circles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
.invite-result { margin-top: 1rem; }
.invite-link-row { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
.invite-link-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; padding: 0.7rem 1rem;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--ivory); color: var(--ink);
}
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.activity li {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.7rem 1rem; font-size: 0.9rem; color: var(--ink-soft);
}
.activity strong { color: var(--maroon); }

/* ---------- Members list ---------- */
.memberrow {
  display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 0.9rem 1.2rem; margin-bottom: 0.6rem; cursor: pointer; font: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.memberrow:hover { border-color: rgba(232, 145, 45, 0.5); transform: translateY(-1px); }
.memberrow__avatar {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.3rem; background: var(--ivory-2); border: 1px solid var(--line);
}
.memberrow__name { font-weight: 600; color: var(--maroon-deep); }
.memberrow__sub { font-size: 0.86rem; color: var(--ink-soft); }
.memberrow__rel { margin-left: auto; font-family: var(--font-dev-body); color: var(--saffron-deep); font-size: 0.95rem; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.toast {
  background: var(--maroon-deep); color: #f3e6d4; border-radius: 999px;
  padding: 0.75rem 1.5rem; font-size: 0.95rem; font-weight: 500; box-shadow: var(--shadow-md);
  animation: toastIn 0.25s ease;
}
.toast--error { background: #7c2222; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Elder mode ---------- */
html.elder .edit-only { display: none !important; }
html.elder .tab, html.elder .btn { min-height: 54px; }
html.elder .tree-stage { height: calc(100dvh - 230px); }

/* ---------- UX polish (2026-08) ---------- */
.backlink { display: inline-block; margin-bottom: 0.9rem; font-weight: 600; font-size: 0.9rem; color: var(--maroon); text-decoration: none; }
.backlink:hover { text-decoration: underline; }
.count-pill { display: inline-flex; align-items: center; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); background: var(--ivory-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.8rem; margin-left: 0.7rem; vertical-align: middle; letter-spacing: 0.02em; }
.famcard__arrow { float: right; font-size: 1.15rem; color: var(--saffron-deep); opacity: 0; transform: translateX(-4px); transition: opacity 0.2s ease, transform 0.2s ease; }
.famcard:hover .famcard__arrow { opacity: 1; transform: none; }
details.card { padding: 0; overflow: hidden; }
details.card summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.6rem; padding: 1.5rem 1.6rem 0.9rem; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--maroon); }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; font-weight: 600; color: var(--saffron-deep); transition: transform 0.2s ease; }
details.card[open] summary::after { transform: rotate(45deg); }
details.card .card-body { padding: 0.4rem 1.6rem 1.6rem; }
.searchbar { position: relative; margin: 0 0 1.2rem; }
.searchbar input { width: 100%; font: inherit; font-weight: 500; color: var(--ink); padding: 0.85rem 1.1rem 0.85rem 2.9rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); }
.searchbar input:focus { outline: none; border-color: var(--saffron); box-shadow: 0 0 0 4px rgba(232, 145, 45, 0.18); }
.searchbar::before { content: "🔍"; position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1rem; opacity: 0.75; pointer-events: none; }
.memberrow--hidden { display: none !important; }
.memberrow__avatar { overflow: hidden; }
.memberrow__avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.memberrow__avatar.has-photo { background: transparent; border-color: transparent; }
.drawer__avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 0.7rem; border: 2px solid var(--line); }
.drawer__lifespan { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.2rem; }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.9rem; }
.story-card__actions { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.8rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.evt__actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.swap-btn { align-self: flex-end; margin-bottom: 1rem; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; text-align: center; padding: 1.6rem 1.2rem; border: 2px dashed var(--line); border-radius: 16px; background: var(--ivory); color: var(--ink-soft); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.dropzone:hover, .dropzone.is-dragover { border-color: var(--saffron); background: rgba(232, 145, 45, 0.08); }
.dropzone input[type="file"] { display: none; }
.file-chosen { font-size: 0.9rem; color: var(--maroon); font-weight: 600; overflow-wrap: anywhere; }
.tnode { transition: filter 0.15s ease; }
.tnode:hover { filter: drop-shadow(0 3px 6px rgba(61, 15, 16, 0.25)); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .relation-grid, .circles-grid { grid-template-columns: 1fr; }
  .access-screen { grid-template-columns: 1fr; gap: 2rem; padding-top: 2rem; }
  .access-intro { text-align: center; margin-inline: auto; }
  .access-intro > p:not(.eyebrow) { margin-inline: auto; }
  .access-intro ul { justify-content: center; }
  .login-card { width: min(100%, 500px); margin-inline: auto; }
}
@media (max-width: 720px) {
  .topbar { height: 60px; gap: 0.7rem; }
  .brand__word { font-size: 1.05rem; }
  .eldertoggle { font-size: 0; gap: 0; padding: 0.45rem 0.7rem; }
  .eldertoggle span { font-size: 1.15rem; }
  .topbar__fam { font-size: 0.95rem; }
  .form-row { grid-template-columns: 1fr; }
  /* Drawer becomes a bottom sheet */
  .drawer {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 86dvh;
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    animation: sheetIn 0.25s ease;
  }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .tree-stage { height: calc(100dvh - 300px); min-height: 380px; }
  .tree-toolbar button { width: 56px; height: 56px; }
  .tree-toolbar a { width: 56px; height: 56px; }
  .tree-legend { display: none; }
  .quick-actions { grid-template-columns: 1fr; }
  .relhero { padding: 1.5rem; }
  .drawer__avatar { width: 56px; height: 56px; }
  .count-pill { display: none; }
  .tabs-shell { top: 58px; margin-inline: -3vw; padding-inline: 3vw; }
  .tabs { gap: .1rem; overflow-x: visible; padding-bottom: .15rem; }
  .tab { font-size: .76rem; padding-inline: .55rem; }
  .tabs-more { position: static; margin-left: 0; }
  .tabs-more__menu { position: fixed; left: 4vw; right: 4vw; top: auto; bottom: 16px; width: auto; padding: .7rem; z-index: 120; }
  .tree-add { top: 10px; right: 10px; font-size: 0; width: 48px; height: 48px; padding: 0; justify-content: center; }
  .tree-add::before { content: "+"; font-size: 1.5rem; }
  .access-screen { gap: 1.2rem; padding-top: 1.2rem; }
  .access-intro .eyebrow { margin-bottom: .6rem; }
  .access-intro h1 { font-size: 2.4rem; line-height: 1.05; }
  .access-intro h1 br { display: none; }
  .access-intro__dev { margin-bottom: .3rem; font-size: 1rem !important; }
  .access-intro__copy { display: none; }
  .access-intro ul { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .toast { animation: none; }
  .btn, .famcard, .relvariant, .memberrow { transition: none; }
}
/* Persistent trust links for the authenticated family workspace. */
.app-legal{display:flex;justify-content:center;gap:.65rem;padding:1.25rem;color:var(--ink-soft);font-size:.78rem}.app-legal a{color:inherit;text-decoration:none}.app-legal a:hover{text-decoration:underline}

/* ================================================================
   LIVING ARCHIVE — PRODUCT WORKSPACE
   Mirrors the editorial system of the public experience while
   preserving dense, practical family-management interactions.
   ================================================================ */
:root {
  --ivory: #f3efe5;
  --ivory-2: #e8e1d4;
  --paper: #fbf8f1;
  --paper-2: #ede6d9;
  --ink: #19241f;
  --ink-soft: #606b65;
  --maroon: #1f4a3d;
  --maroon-deep: #16372f;
  --saffron: #d66d45;
  --saffron-deep: #b65334;
  --gold: #c8a75f;
  --line: rgba(25, 48, 39, .16);
  --shadow-sm: 0 8px 24px rgba(22, 55, 47, .07);
  --shadow-md: 0 20px 55px rgba(22, 55, 47, .12);
  --shadow-lg: 0 35px 90px rgba(13, 42, 34, .22);
  --radius: 14px;
  --font-display: "Newsreader", "Noto Serif Devanagari", Georgia, serif;
  --font-body: "Manrope", "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;
  --font-dev: "Noto Serif Devanagari", "Newsreader", serif;
  --font-dev-body: "Noto Sans Devanagari", "Manrope", sans-serif;
}

html { font-size: 17px; }
body {
  background-color: var(--ivory);
  background-image:
    linear-gradient(rgba(31, 74, 61, .026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 74, 61, .026) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  letter-spacing: -.008em;
}
h1, h2, h3 { color: var(--maroon-deep); font-weight: 500; letter-spacing: -.035em; }

.btn { border-radius: 9px; border-width: 1px; font-size: .88rem; font-weight: 800; letter-spacing: .005em; }
.btn--primary { background: var(--saffron); color: #fffaf3; box-shadow: 0 10px 28px rgba(182,83,52,.2); }
.btn--primary:hover { background: #e07950; box-shadow: 0 15px 35px rgba(182,83,52,.28); }
.btn--ghost { color: var(--maroon-deep); border-color: var(--line); }
.btn--ghost:hover { background: rgba(31,74,61,.08); }
.btn--danger { border-radius: 8px; }

.topbar {
  height: 78px;
  padding-inline: clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(22,55,47,.97);
  color: #f7f1e5;
  backdrop-filter: blur(18px) saturate(120%);
}
.topbar .brand { color: #f7f1e5; gap: .72rem; }
.topbar .brand__mark { width: 35px; height: 35px; color: #e99b78; }
.topbar .brand__word { font-size: 1.45rem; font-weight: 600; letter-spacing: -.04em; }
.topbar__fam { color: #b9c6c0; font-family: var(--font-body); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.topbar .eldertoggle { border-radius: 8px; border-color: rgba(255,255,255,.18); background: transparent; color: #e8e0d1; }
.topbar .eldertoggle:hover { background: rgba(255,255,255,.08); }
.topbar .eldertoggle[aria-pressed="true"] { background: #d66d45; border-color: #d66d45; color: #fff; }
.topbar .btn--ghost { border-color: rgba(255,255,255,.2); color: #f7f1e5; }
.topbar .btn--ghost:hover { background: rgba(255,255,255,.08); }

.app { width: min(1280px, calc(100% - 56px)); padding: 2.1rem 0 5rem; }
.app-legal { color: var(--ink-soft); letter-spacing: .05em; }
.screen-head { margin: .7rem 0 2rem; }
.screen-head h1 { font-size: clamp(2.2rem, 4vw, 3.7rem); font-weight: 500; }
.screen-head p { color: var(--ink-soft); }
.eyebrow { color: var(--saffron); font-size: .66rem; letter-spacing: .2em; }
.eyebrow::before { width: 7px; height: 7px; border-radius: 2px; background: var(--saffron); box-shadow: 0 0 0 5px rgba(214,109,69,.15); transform: rotate(45deg); }
.backlink { color: var(--maroon-deep); font-size: .76rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.count-pill { border-radius: 5px; background: var(--paper-2); }

.card {
  border-radius: 12px;
  border-color: var(--line);
  background: rgba(251,248,241,.92);
  box-shadow: none;
}
details.card summary { color: var(--maroon-deep); font-weight: 500; }
details.card summary::after { color: var(--saffron); }
.field label { color: var(--maroon-deep); font-size: .78rem; font-weight: 800; letter-spacing: .025em; }
.field input, .field select, .field textarea, .searchbar input, .invite-link-row input {
  border-radius: 8px;
  border-color: var(--line);
  background: #f8f4eb;
}
.field input:focus, .field select:focus, .field textarea:focus, .searchbar input:focus {
  border-color: var(--saffron);
  box-shadow: 0 0 0 4px rgba(214,109,69,.14);
}
.msg { border-radius: 8px; }
.badge { border-radius: 5px; letter-spacing: .06em; }
.badge--admin { background: var(--maroon-deep); }
.badge--close { background: var(--saffron); }
.badge--extended { background: rgba(200,167,95,.22); color: #725a24; }
.badge--view_only, .badge--view { background: var(--paper-2); }

/* ---------- Access / sign in ---------- */
.access-screen {
  position: relative;
  min-height: calc(100dvh - 135px);
  grid-template-columns: 1.05fr .72fr;
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: center;
  padding: clamp(2.5rem, 6vw, 5.5rem);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 15%, rgba(200,167,95,.14), transparent 30%),
    #173a31;
  box-shadow: 0 30px 80px rgba(17,50,42,.18);
  overflow: hidden;
}
.access-screen::before { content: "वंश · स्मृति · विरासत"; position: absolute; left: clamp(2.5rem, 6vw, 5.5rem); bottom: 1.35rem; color: rgba(246,239,221,.25); font-family: var(--font-dev); font-size: .73rem; letter-spacing: .13em; }
.access-intro { position: relative; z-index: 1; }
.access-intro .eyebrow { color: #e99b78; }
.access-intro h1 { color: #f8f3e8; font-size: clamp(3.8rem, 6.4vw, 6.4rem); font-weight: 500; line-height: .92; }
.access-intro > p:not(.eyebrow) { color: #b9c6c0; line-height: 1.75; }
.access-intro__dev { color: #d7b975 !important; }
.access-intro ul { border-top-color: rgba(255,255,255,.12); color: #aebdb6; }
.access-intro li::before { color: #e99b78; }
.login-card {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 14px;
  background: #fbf8f1;
  box-shadow: 22px 22px 0 rgba(214,109,69,.2), 0 30px 70px rgba(0,0,0,.22);
}
.login-card::before { content: "PRIVATE ACCESS"; display: block; margin-bottom: 1.2rem; color: var(--saffron); font-size: .62rem; font-weight: 800; letter-spacing: .2em; }
.login-card__kicker { color: var(--saffron); }
.login-card h2 { color: var(--maroon-deep); font-weight: 500; }
.login-card__greeting { color: var(--maroon-deep); }
.login-loading { border-radius: 8px; background: var(--paper-2); }
.btn--oauth { border-radius: 8px; }
.otp-entry input { letter-spacing: .3em; }
.auth-callback { background: #173a31; }
.auth-callback__card { border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-lg); }
.auth-callback__card h1 { color: var(--maroon-deep); }

/* ---------- Family dashboard ---------- */
.famgrid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1rem; }
.famcard {
  min-height: 180px;
  border-radius: 11px;
  border-color: var(--line);
  border-left: 5px solid var(--saffron);
  background: rgba(251,248,241,.9);
  box-shadow: none;
}
.famcard::before { content: "FAMILY ARCHIVE"; display: block; margin-bottom: 1.4rem; color: var(--ink-soft); font-size: .58rem; font-weight: 800; letter-spacing: .16em; }
.famcard:hover { border-color: rgba(31,74,61,.25); border-left-color: var(--saffron); box-shadow: 0 22px 50px rgba(22,55,47,.1); }
.famcard__name { color: var(--maroon-deep); font-size: 1.65rem; font-weight: 500; }
.famcard__dev { color: var(--saffron); }
.famcard__arrow { color: var(--saffron); }

/* ---------- Workspace navigation ---------- */
.tabs-shell { top: 77px; margin-bottom: 1.2rem; padding: .5rem 0; background: rgba(243,239,229,.93); }
.tabs { gap: .25rem; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: .65rem 1rem; border: 0; border-radius: 0; color: var(--ink-soft); font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tab:hover { background: rgba(31,74,61,.06); }
.tab.is-active { border-bottom: 3px solid var(--saffron); background: transparent; color: var(--maroon-deep); box-shadow: none; }
.tabs-more__menu { border-radius: 9px; background: var(--paper); }
.tabs-more__menu a { border-radius: 6px; }
.tabs-more__menu a:hover, .tabs-more__menu a.is-active { background: var(--paper-2); color: var(--maroon-deep); }

/* ---------- Family tree ---------- */
.tree-stage {
  height: min(720px, calc(100dvh - 245px));
  min-height: 520px;
  border: 1px solid rgba(31,74,61,.18);
  border-radius: 14px;
  background: #e8e1d4;
  box-shadow: 0 24px 70px rgba(22,55,47,.1);
}
.tree-stage__bg { background-color: transparent; background-image: radial-gradient(rgba(31,74,61,.16) .7px, transparent .7px); background-size: 20px 20px; }
.tree-stage svg { position: relative; z-index: 1; }
.tree-toolbar { border-radius: 8px; background: rgba(251,248,241,.95); }
.tree-toolbar button, .tree-toolbar a { border-radius: 5px; color: var(--maroon-deep); }
.tree-toolbar button:hover, .tree-toolbar a:hover { background: var(--paper-2); }
.tree-add { border-radius: 8px; background: var(--saffron); color: #fff; }
.tree-legend { border-radius: 7px; background: rgba(251,248,241,.94); }
.legend-dot { border-radius: 3px; }
.legend-dot--elder { background: #f1e3c3; }
.legend-dot--self { background: var(--maroon-deep); border-color: var(--maroon-deep); }
.legend-dot--spouse { background: #e0d9ca; }
.tlink { stroke: #b99650; }
.tunion, .tspouse-line { fill: var(--saffron); stroke: var(--saffron); }
.tnode rect { fill: #fbf8f1; stroke: rgba(31,74,61,.2); rx: 8; }
.tnode--elder rect { fill: #f1e3c3; stroke: rgba(200,167,95,.7); }
.tnode--self rect { fill: var(--maroon-deep); stroke: var(--maroon-deep); }
.tnode--spouse rect { fill: #e4ddcf; }
.tnode--deceased rect { fill: #ded8cc; }
.tnode:hover rect { stroke: var(--saffron); }
.tnode__name { fill: var(--ink); font-family: var(--font-body); }
.tnode__sub { fill: var(--saffron-deep); }
.tnode--self .tnode__name { fill: #fff; }
.tnode--self .tnode__sub { fill: #e7b795; }

/* ---------- Content surfaces ---------- */
.story-card, .evt, .doc, .memberrow, .activity li, .relvariant {
  border-radius: 9px;
  border-color: var(--line);
  background: rgba(251,248,241,.9);
  box-shadow: none;
}
.story-card { border-left: 4px solid var(--gold); }
.story-card__cat, .story-card__who, .timeline__year { color: var(--saffron); }
.tag { border-radius: 5px; background: var(--paper-2); }
.timeline::before { background: rgba(31,74,61,.2); }
.timeline__item { padding-bottom: 1.1rem; }
.relhero { border-radius: 11px; background: #302b3d; }
.relhero__dev { color: #e9b58f; }
.relvariant__label { color: var(--saffron); }
.relvariant__term { color: var(--maroon-deep); }
.evt__icon { border-radius: 7px; background: rgba(214,109,69,.12); border-color: rgba(214,109,69,.28); }
.evt--shraadh { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(200,167,95,.12), rgba(251,248,241,.9) 40%); }
.doc__name, .evt strong, .memberrow__name { color: var(--maroon-deep); }
.aadhaar-note { border-radius: 8px; background: rgba(214,109,69,.09); border-color: rgba(214,109,69,.3); color: var(--maroon-deep); }
.activity strong { color: var(--maroon-deep); }
.memberrow:hover { border-color: rgba(214,109,69,.55); }
.memberrow__avatar { background: var(--paper-2); }
.memberrow__rel { color: var(--saffron); }
.dropzone { border-radius: 9px; background: rgba(251,248,241,.55); }
.dropzone:hover, .dropzone.is-dragover { background: rgba(214,109,69,.08); border-color: var(--saffron); }

/* ---------- Drawer, feedback and empty states ---------- */
.drawer-overlay { background: rgba(9,29,24,.55); backdrop-filter: blur(4px); }
.drawer { border-left-color: rgba(31,74,61,.16); background: var(--paper); box-shadow: -24px 0 70px rgba(9,29,24,.16); }
.drawer__title { color: var(--maroon-deep); font-weight: 500; }
.drawer__rel { color: var(--saffron); }
.drawer__close { border-radius: 7px; }
.drawer__section { border-top-color: var(--line); }
.drawer__section h4 { color: var(--maroon-deep); }
.speak-btn { border-radius: 8px; }
.empty { border-radius: 12px; border-style: solid; background: rgba(251,248,241,.64); }
.empty strong { color: var(--maroon-deep); }
.toast { border-radius: 8px; background: var(--maroon-deep); }
.toast--error { background: #8b3932; }

@media (max-width: 860px) {
  .app { width: min(100% - 28px, 720px); }
  .access-screen { grid-template-columns: 1fr; min-height: auto; padding: 3.5rem 2rem 4.5rem; }
  .access-intro { text-align: left; margin: 0; }
  .access-intro > p:not(.eyebrow) { margin-inline: 0; }
  .access-intro ul { justify-content: flex-start; }
  .login-card { margin-inline: 0; }
}
@media (max-width: 720px) {
  .topbar { height: 66px; }
  .topbar .brand__mark { width: 30px; height: 30px; }
  .topbar .brand__word { font-size: 1.15rem; }
  .app { width: min(100% - 22px, 660px); padding-top: 1rem; }
  .tabs-shell { top: 65px; margin-inline: -11px; padding-inline: 11px; }
  .tab { font-size: .66rem; padding-inline: .55rem; }
  .access-screen { padding: 2.7rem 1.25rem 4rem; border-radius: 14px; }
  .access-screen::before { left: 1.25rem; }
  .access-intro h1 { color: #f8f3e8; font-size: clamp(3.1rem, 15vw, 4.8rem); }
  .access-intro h1 br { display: initial; }
  .access-intro__dev { display: block; }
  .login-card { box-shadow: 10px 10px 0 rgba(214,109,69,.2); }
  .tree-stage { height: calc(100dvh - 250px); min-height: 430px; }
  .drawer { border-radius: 14px 14px 0 0; }
}
@media (max-width: 480px) {
  .topbar__fam { display: none; }
  .access-intro__copy, .access-intro ul { display: none; }
  .access-screen { gap: 1.6rem; }
  .access-intro h1 { font-size: 3.25rem; }
  .login-card { padding: 1.45rem; }
  .famgrid { grid-template-columns: 1fr; }
  .famcard { min-height: 160px; }
}
