/* Kinnected shared styles.
   Light theme: purple and teal palette. Dark theme: red accent on charcoal. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
  --purple: #534AB7;
  --purple-600: #433BA0;
  --purple-50: #F1F0FA;
  --teal: #1D9E75;
  --teal-50: #E8F6F1;
  --amber: #C98A1B;
  --amber-50: #FBF3E2;
  --bg: #F0F2FA;
  --surface: #FFFFFF;
  --blue-grey: #DCE3EC;
  --blue-grey-50: #EEF2F7;
  --text: #1F1D2B;
  --text-2: #4F4D63;
  --text-3: #7D7B92;
  --border: var(--blue-grey);
  --radius: 16px;
  --radius-sm: 10px;
  --hero-grad: linear-gradient(120deg, #534AB7 0%, #6A5FD0 55%, #1D9E75 130%);
  --brand-grad: linear-gradient(135deg, #534AB7, #1D9E75);
  --side-bg: #FFFFFF;
  --side-border: #DCE3EC;
  --side-text: #4F4D63;
  --side-muted: #7D7B92;
  --side-hover: #EEF2F7;
  --side-active-bg: #F1F0FA;
  --side-active-text: #534AB7;
  --side-label: #7D7B92;
  --side-foot-border: #DCE3EC;
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Dark theme (set by data-theme="dark" on <html>) */
:root[data-theme="dark"] {
  --purple: #E0503A;
  --purple-600: #C43C24;
  --purple-50: #3A1F1B;
  --teal: #9FB0BE;
  --teal-50: #26313A;
  --amber: #E0A84A;
  --amber-50: #3A2E16;
  --bg: #13171B;
  --surface: #1C2227;
  --blue-grey: #2E373F;
  --blue-grey-50: #232A30;
  --text: #E9EDF0;
  --text-2: #B6C0C8;
  --text-3: #8C98A2;
  --border: #2E373F;
  --hero-grad: linear-gradient(120deg, #2B3238 0%, #3D4B57 60%, #C43C24 150%);
  --brand-grad: linear-gradient(135deg, #C43C24, #7A2A1C);
  --side-bg: #0E1215;
  --side-border: #222A31;
  --side-text: #C9D2D9;
  --side-muted: #8C98A2;
  --side-hover: rgba(255,255,255,.06);
  --side-active-bg: #E0503A;
  --side-active-text: #FFFFFF;
  --side-label: #8C979F;
  --side-foot-border: rgba(255,255,255,.12);
}
/* Dark option: charcoal sidebar with red accents on a light content area, as in the Lineago-style screenshot */
:root[data-theme="dark"] {
  --purple: #C43C24;
  --purple-600: #A3301C;
  --purple-50: #FBEDEA;
  --teal: #3D4B57;
  --teal-50: #E7ECF0;
  --amber: #B7791F;
  --amber-50: #FBF3E2;
  --bg: #EEF2F5;
  --surface: #FFFFFF;
  --blue-grey: #D5DDE4;
  --blue-grey-50: #E8EEF3;
  --text: #1E2226;
  --text-2: #4A545D;
  --text-3: #7A848D;
  --border: #D5DDE4;
  --hero-grad: linear-gradient(120deg, #2B3238 0%, #3D4B57 60%, #C43C24 150%);
  --brand-grad: linear-gradient(135deg, #C43C24, #7A2A1C);
  --side-bg: #2B3238;
  --side-border: #3A444C;
  --side-text: #C9D2D9;
  --side-muted: #8C979F;
  --side-hover: rgba(255,255,255,.06);
  --side-active-bg: #C43C24;
  --side-active-text: #FFFFFF;
  --side-label: #8C979F;
  --side-foot-border: rgba(255,255,255,.12);
}
:root[data-theme="dark"] .person-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.4); }
:root[data-theme="dark"] .edge { stroke: #4A565F; }
:root[data-theme="dark"] .tree-wrap,
:root[data-theme="dark"] .date-chip { background: var(--blue-grey-50); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 16px; font-family: var(--font-body); font-weight: 600; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.main { padding: 24px 32px 48px; min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--side-bg); border-right: 1px solid var(--side-border); padding: 24px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); display: grid; place-items: center; color: #fff; font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.brand-name { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; color: var(--side-label); letter-spacing: .08em; text-transform: uppercase; padding: 0 12px; margin: 6px 0 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; }
.nav a:hover { background: var(--side-hover); color: var(--text); }
.nav a.active { background: var(--side-active-bg); color: var(--side-active-text); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--teal-50); color: var(--teal); padding: 1px 8px; border-radius: 999px; }
.nav-storage { margin: 2px 12px 10px 42px; font-size: 12px; color: var(--side-muted); }
.nav-storage-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.nav-storage small { display: block; margin-top: 6px; font-size: 11px; color: var(--side-muted); }
.nav-storage .storage-bar { background: var(--side-border); }
.nav-storage .storage-bar span { background: var(--purple); }
.nav-storage.warn { color: #C0392B; }
.nav-storage.warn .storage-bar span { background: #E8453C; }
.sidebar-foot { margin-top: auto; padding: 12px; border: 1px solid var(--side-foot-border); border-radius: var(--radius); display: flex; align-items: center; gap: 10px; }
.sidebar-foot .avatar { background: var(--teal-50); color: var(--teal); }
.user-name { font-weight: 600; font-size: 14px; color: var(--text); }
:root[data-theme="dark"] .sidebar .user-name, :root[data-theme="dark"] .sidebar .brand-name { color: #FFFFFF; }
.user-meta { font-size: 12px; color: var(--text-3); }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.crumb { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.topbar .meta { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.search { flex: 1; max-width: 480px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px; color: var(--text-3); }
.search input { border: none; outline: none; background: none; flex: 1; color: var(--text); font-size: 15px; }
.search svg { width: 16px; height: 16px; }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); position: relative; }
.icon-btn svg { width: 18px; height: 18px; }
.dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); border: 2px solid var(--surface); }

/* Light / dark switch in the top bar */
.theme-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.theme-toggle button { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.theme-toggle button.active { background: var(--purple); color: #fff; }

/* ---------- Page hero (photo background, dark overlay) ---------- */
.page-hero { position: relative; background: url('hero.jpg') center / cover no-repeat, var(--hero-grad); color: #fff; border-radius: var(--radius); padding: 56px 32px; text-align: center; margin-bottom: 20px; overflow: hidden; }
.page-hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(20,24,28,.55), rgba(20,24,28,.7)); }
.page-hero > * { position: relative; }
.page-hero h1 { color: #fff; font-size: 44px; line-height: 1.1; margin: 12px 0 8px; }
.page-hero p { color: rgba(255,255,255,.85); max-width: 560px; margin: 0 auto; font-size: 15px; }
.hero-tag { display: inline-block; background: var(--purple); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 6px 12px; border-radius: 2px; }
.hero-search { max-width: 640px; margin: 24px auto 0; display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 999px; padding: 14px 22px; box-shadow: 0 10px 30px rgba(0,0,0,.18); color: var(--text-3); }
.hero-search input { border: none; outline: none; flex: 1; font-size: 15px; color: var(--text); background: none; }
.sort-row { display: flex; gap: 18px; justify-content: center; margin: 16px 0 22px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.sort-row button { color: var(--text-3); font-weight: 600; }
.sort-row button:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn { padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-600); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.small-link { font-size: 13px; color: var(--purple); font-weight: 600; }

/* ---------- Hero (dashboard) ---------- */
.hero { background: var(--hero-grad); color: #fff; border-radius: 22px; padding: 32px 36px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-bottom: 24px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero h1 { color: #fff; font-size: 34px; margin-bottom: 8px; }
.hero p { opacity: .85; max-width: 520px; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.22); color: #fff; border-color: #fff; }
.hero .btn-primary { background: #fff; color: var(--purple); }
.hero .btn-primary:hover { background: var(--purple-50); color: var(--purple-600); }
.hero-stats { display: flex; gap: 12px; position: relative; z-index: 1; }
.stat { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius); padding: 14px 18px; min-width: 110px; text-align: center; }
.stat strong { display: block; font-family: var(--font-head); font-size: 26px; font-weight: 700; }
.stat span { font-size: 12px; opacity: .85; }

/* ---------- Quick tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface); transition: transform .15s ease, border-color .15s ease; display: flex; flex-direction: column; gap: 12px; }
.tile:hover { transform: translateY(-2px); border-color: var(--purple); }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.tile-icon svg { width: 20px; height: 20px; }
.tile p { font-size: 13px; color: var(--text-3); }
.tone-purple .tile-icon { background: var(--purple-50); color: var(--purple); }
.tone-teal .tile-icon { background: var(--teal-50); color: var(--teal); }
.tone-amber .tile-icon { background: var(--amber-50); color: var(--amber); }
.tone-mix .tile-icon { background: linear-gradient(135deg, var(--purple-50), var(--teal-50)); color: var(--purple); }

/* ---------- Cards and grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-head .link { color: var(--purple); font-weight: 600; font-size: 13px; }
.card-head .link:hover { text-decoration: underline; }
.card-head .meta { font-size: 12px; color: var(--text-3); }
.stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.section-gap { margin-top: 24px; }

/* ---------- Avatars and tags ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar.purple { background: var(--purple-50); color: var(--purple); }
.avatar.teal { background: var(--teal-50); color: var(--teal); }
.avatar.amber { background: var(--amber-50); color: var(--amber); }
.avatar.lg { width: 56px; height: 56px; font-size: 16px; }
.avatar.xl { width: 72px; height: 72px; font-size: 22px; }
img.avatar { object-fit: cover; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.tag-birthday { background: var(--amber-50); color: var(--amber); }
.tag-anniv { background: var(--teal-50); color: var(--teal); }
.tag-memorial { background: var(--purple-50); color: var(--purple); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.chip:hover { border-color: var(--purple); color: var(--purple); }
.chip.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip svg { width: 15px; height: 15px; }
.empty { font-size: 13px; color: var(--text-3); padding: 8px 0; }
.bio { color: var(--text-2); font-size: 14px; }
.footnote { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 28px; }

/* ---------- Dashboard: this week ---------- */
.week-list { display: flex; flex-direction: column; gap: 4px; }
.week-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); }
.week-item:hover { background: var(--bg); }
.date-chip { width: 52px; text-align: center; border-radius: 10px; padding: 6px 0; background: var(--blue-grey-50); border: 1px solid var(--border); flex-shrink: 0; }
.date-chip b { display: block; font-size: 18px; line-height: 1; font-family: var(--font-head); }
.date-chip small { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.week-info { flex: 1; min-width: 0; }
.week-info strong { display: block; font-weight: 600; }
.week-info span { font-size: 13px; color: var(--text-3); }

/* ---------- Composer and feed ---------- */
.composer { display: flex; gap: 12px; align-items: center; }
.composer input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 11px 18px; outline: none; background: var(--bg); font-size: 15px; }
.composer input:focus { border-color: var(--purple); background: var(--surface); }
.composer-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.post { padding: 20px 0; border-top: 1px solid var(--border); }
.post:first-child { border-top: none; padding-top: 0; }
.post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.post-head strong { display: block; font-weight: 600; }
.post-head span { font-size: 12px; color: var(--text-3); }
.post-body { color: var(--text-2); margin-bottom: 12px; }
.post-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.post-actions { display: flex; gap: 18px; font-size: 13px; color: var(--text-3); }
.post-actions button { color: var(--text-3); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.post-actions button:hover, .post-actions button.liked { color: var(--purple); }
.post-actions svg { width: 16px; height: 16px; }

/* ---------- Photos ---------- */
.photo { border-radius: var(--radius-sm); aspect-ratio: 4/3; background: linear-gradient(135deg, var(--purple-50), var(--teal-50)); display: grid; place-items: center; color: var(--purple); font-size: 12px; font-weight: 600; }
.photo.p2 { background: linear-gradient(135deg, var(--teal-50), #D6EFE5); color: var(--teal); }
.photo.p3 { background: linear-gradient(135deg, var(--amber-50), #F4E2B8); color: var(--amber); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.photo-ph { aspect-ratio: 1/1; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--purple-50), var(--teal-50)); display: grid; place-items: center; color: var(--purple); font-size: 12px; font-weight: 600; }
.photo-ph:nth-child(3n+2) { background: linear-gradient(135deg, var(--teal-50), #D6EFE5); color: var(--teal); }
.photo-ph:nth-child(3n) { background: linear-gradient(135deg, var(--amber-50), #F4E2B8); color: var(--amber); }
.vault { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vault .photo { aspect-ratio: 1/1; font-size: 11px; }

/* ---------- Events (dashboard) ---------- */
.event { display: flex; gap: 14px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 10px; align-items: center; }
.event:last-child { margin-bottom: 0; }
.event-date { width: 56px; flex-shrink: 0; border-radius: 12px; overflow: hidden; text-align: center; border: 1px solid var(--border); }
.event-date .m { background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 0; letter-spacing: .08em; }
.event-date .d { font-family: var(--font-head); font-size: 22px; font-weight: 700; padding: 4px 0 6px; }
.event-info { flex: 1; min-width: 0; }
.event-info strong { display: block; font-weight: 600; }
.event-info span { font-size: 12px; color: var(--text-3); display: block; }
.rsvp { font-size: 12px; font-weight: 600; color: var(--purple); border: 1px solid var(--purple); padding: 5px 12px; border-radius: 999px; }
.rsvp:hover { background: var(--purple); color: #fff; }
.rsvp.done { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- Tree preview (dashboard) ---------- */
.tree-wrap { background: var(--blue-grey-50); border-radius: var(--radius-sm); padding: 10px; }
.tree-wrap svg { width: 100%; height: auto; display: block; }
.tree-legend { display: flex; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.tree-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.lg-p::before, .lg-purple::before { background: var(--purple); }
.lg-t::before, .lg-teal::before { background: var(--teal); }
.lg-a::before, .lg-amber::before { background: var(--amber); }

/* ---------- Members row (dashboard) ---------- */
.members { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; }
.member { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 72px; }
.member .avatar { width: 56px; height: 56px; font-size: 16px; }
.member span { font-size: 12px; color: var(--text-2); font-weight: 600; text-align: center; }

/* ---------- Members directory: photo cards in rows of five ---------- */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.person-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.person-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,34,38,.08); }
.person-card .avatar.lg { width: 100%; height: 170px; border-radius: 0; font-size: 42px; font-family: var(--font-head); font-weight: 700; }
.pc-info { padding: 14px 12px 16px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.pc-info strong { font-weight: 600; font-size: 15px; color: var(--text); }
.pc-info span { font-size: 13px; color: var(--text-3); }
.pc-info small { font-size: 12px; color: var(--text-2); }
.person-card .tag { position: absolute; top: 10px; right: 10px; }
.members-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head .who { flex: 1; min-width: 200px; }
.profile-head h1 { font-size: 34px; }
.profile-head p { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.profile-head .actions { display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0; overflow-x: auto; }
.tab { padding: 12px 16px; font-weight: 600; font-size: 13px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); }
.panel { display: none; }
.panel.active { display: block; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.facts dt { color: var(--text-3); }
.facts dd { font-weight: 600; }
.facts a { color: var(--purple); }
.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.link-row:hover { border-color: var(--purple); }
.link-row span { font-size: 12px; color: var(--text-3); margin-left: auto; }

/* ---------- Timeline (vertical with a centre line) ---------- */
.timeline { display: flex; flex-direction: column; gap: 14px; border-left: 2px solid var(--blue-grey); padding-left: 20px; margin-left: 6px; }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -27px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--purple); border: 2px solid var(--surface); }
.tl-item b { font-size: 12px; color: var(--purple); letter-spacing: .08em; text-transform: uppercase; }
.tl-item p { font-size: 15px; }

/* ---------- Memories ---------- */
.comment { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: none; padding-top: 0; }
.comment strong { font-size: 14px; }
.comment span { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.comment p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.comment-form textarea { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 72px; resize: vertical; outline: none; background: var(--bg); font-size: 14px; }
.comment-form textarea:focus { border-color: var(--purple); background: var(--surface); }
.comment-form .btn { align-self: flex-end; }

/* Beige "paper" for the Our story and About cards: light beige, dark charcoal */
:root { --paper: #EEEBE6; }
:root[data-theme="dark"] { --paper: #272C32; }
.paper { background: var(--paper); border: 1px solid var(--border); }

/* ---------- Storage meter (Settings page) ---------- */
.storage { margin-top: 10px; }
.storage-bar { height: 6px; background: var(--blue-grey); border-radius: 999px; overflow: hidden; }
.storage-bar span { display: block; height: 100%; background: var(--purple); border-radius: 999px; }
.storage-bar.warn span { background: #E8453C; }
.storage-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.storage-head strong { font-weight: 600; }
.storage-head.warn, .storage-head.warn svg { color: #E8453C; }
.storage-used { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.storage-btn { display: inline-block; margin-top: 10px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--purple); font-size: 13px; font-weight: 600; }
.storage-btn:hover { background: var(--purple-50); }

/* ---------- Family tree page ---------- */
.tree-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.seg button.active { background: var(--purple); color: #fff; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); margin-left: auto; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.tree-canvas { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: auto; }
.tree-canvas svg { display: block; min-width: 100%; }
.node { cursor: pointer; }
.node:hover .node-box { stroke: var(--purple); }
.node-box { fill: var(--surface); stroke-width: 1.5; }
.node-name { font-family: var(--font-body); font-size: 13px; font-weight: 600; fill: var(--text); }
.node-years { font-family: var(--font-body); font-size: 11px; fill: var(--text-3); }
.edge { stroke: #B9C4CE; stroke-width: 1.5; fill: none; }
.edge-spouse { stroke: var(--purple); stroke-width: 1.5; stroke-dasharray: 3 3; }

/* ---------- Light / dark switch in the top bar ---------- */

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .person-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .grid, .grid-2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .person-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 14px; gap: 14px; border-right: none; border-bottom: 1px solid var(--side-border); }
  .sidebar .nav { flex-direction: row; }
  .nav-label, .sidebar-foot, .brand-sub, .nav-storage { display: none; }
  .main { padding: 18px 16px 40px; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero h1 { font-size: 28px; }
  .hero-stats { flex-wrap: wrap; }
  .page-hero { padding: 40px 20px; }
  .page-hero h1 { font-size: 32px; }
  .search { display: none; }
  .top-actions .btn { display: none; }
  .person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr; }
  .vault { grid-template-columns: repeat(2, 1fr); }
}
