/* ============================================================
   Birthli — design system
   ============================================================ */
:root {
  --brand: #7c3aed;
  --brand-d: #6d28d9;
  --brand-l: #ece5fe;
  --brand-50: #f8f4ff;
  --grad: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
  --grad-soft: linear-gradient(135deg, #f3eeff 0%, #fdeefb 100%);
  --ink: #1c1830;
  --ink-2: #524f63;
  --muted: #6c6980;
  --line: #efedf6;
  --line-2: #e6e3f0;
  --bg: #f7f6fc;
  --card: #ffffff;
  --field: #fbfaff;
  --chip-bg: #f1eefb;
  --hover: #f6f3fe;
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --auth-bg: radial-gradient(130% 120% at 50% -10%, #efe6ff 0%, #fbeefb 35%, #f7f6fc 70%);
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 20px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(28, 24, 48, 0.05), 0 12px 32px -8px rgba(76, 29, 149, 0.12);
  --shadow-lg: 0 2px 6px rgba(28, 24, 48, 0.06), 0 24px 48px -12px rgba(76, 29, 149, 0.22);
  --topbar-h: 62px;
  --sidebar-w: 244px;
}

/* ---- Dark theme (toggled by .theme-dark on <html>) ---- */
.theme-dark {
  --ink: #ececf1;
  --ink-2: #c4c2ce;
  --muted: #8f8c9b;
  --bg: #141320;
  --card: #1d1b29;
  --field: #26242f;
  --chip-bg: #2a2838;
  --hover: #26242f;
  --line: #2a2838;
  --line-2: #38354a;
  --brand: #8b5cf6;
  --brand-d: #a98bff;
  --brand-l: #2c2447;
  --brand-50: #241e38;
  --ok: #4ade80;
  --ok-bg: #10331f;
  --warn: #fcd34d;
  --warn-bg: #3a2c10;
  --bad: #f87171;
  --bad-bg: #3a1a1a;
  --topbar-bg: rgba(20, 19, 32, 0.85);
  --auth-bg: radial-gradient(130% 120% at 50% -10%, #2a1f47 0%, #2a1838 35%, #141320 70%);
  --grad: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  --grad-soft: linear-gradient(135deg, #241e38 0%, #2e1d33 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 48px -12px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* ---- Accessibility ---- */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 0 0 10px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 14px; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 10px; }
a { color: var(--brand-d); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---- Visibility (driven by body.authed) ---- */
.auth-only { display: none; }
body.authed .auth-only { display: block; }
body.authed .guest-only { display: none; }

/* ============================================================
   Buttons & inputs
   ============================================================ */
.btn-primary {
  border: none;
  border-radius: var(--radius-s);
  padding: 11px 18px;
  background: var(--grad);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 6px 16px -4px rgba(124, 58, 237, 0.45);
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 22px -6px rgba(124, 58, 237, 0.55); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: default; box-shadow: none; }
.btn-block { width: 100%; }

.ghost-btn {
  background: var(--card);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ghost-btn:hover { background: var(--hover); border-color: var(--line-2); }
.ghost-btn.dark { background: var(--brand-50); color: var(--brand-d); border-color: var(--brand-l); }
.ghost-btn.dark:hover { background: var(--brand-l); }

.danger-btn {
  background: var(--card);
  color: var(--bad);
  border: 1px solid var(--bad);
  border-radius: var(--radius-s);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.danger-btn:hover { background: var(--bad-bg); }

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--ink-2);
  padding: 4px 8px;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--hover); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--field);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

label { font-weight: 600; font-size: 0.85rem; color: var(--ink-2); }

.field-row, .field-row-full { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.field-grid .field-row { margin-bottom: 0; }

.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.settings-msg { font-size: 0.85rem; color: var(--muted); }

/* ============================================================
   Auth screen
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--auth-bg);
}
.theme-fab { position: fixed; top: 16px; right: 16px; font-size: 1.2rem; }
.auth-panel { width: 100%; max-width: 400px; }
.auth-logo { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.auth-logo span, .auth-logo { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-logo-mark { -webkit-text-fill-color: initial; }
.auth-tagline { text-align: center; color: var(--muted); margin: 10px 0 16px; font-size: 1.02rem; }
.auth-trust {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
  margin: 14px 0 20px; font-size: 0.78rem; font-weight: 600;
  color: var(--brand-d); letter-spacing: 0.02em;
}
.trust-sep { color: var(--muted); font-weight: 400; }
.auth-no-list {
  text-align: center; font-size: 0.74rem; color: var(--muted);
  margin: -10px 0 18px; letter-spacing: 0.01em;
}
.auth-legal {
  text-align: center; font-size: 0.74rem; margin: -6px 0 4px;
}
.auth-legal a { color: var(--muted); text-decoration: underline; }
.auth-legal a:hover { color: var(--brand-d); }
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad); }
.auth-foot { margin-top: 16px; }

.auth-tabs { display: flex; gap: 6px; background: var(--chip-bg); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.auth-tabs .tab { flex: 1; background: transparent; border: none; border-radius: 9px; padding: 9px; font-size: 0.9rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.auth-tabs .tab.active { background: var(--card); color: var(--brand-d); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

.auth-error { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-s); padding: 9px 12px; margin: 0 0 12px; font-size: 0.86rem; }
.dev-hint { background: #ecfeff; color: #155e63; border: 1px dashed #67e8f9; border-radius: var(--radius-s); padding: 9px 12px; margin: 0 0 12px; font-size: 0.82rem; }
#auth-switch-hint, #forgot-line { margin: 12px 0 0; }

/* ============================================================
   App shell
   ============================================================ */
.app { min-height: 100vh; flex-direction: column; }
body.authed .app { display: flex; }   /* only show the app shell once logged in */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.brand { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.025em; display: inline-flex; align-items: center; gap: 9px; }
.brand { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { -webkit-text-fill-color: initial; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; }
.auth-logo-mark { width: 40px; height: 40px; border-radius: 10px; }
.auth-logo { display: flex; justify-content: center; align-items: center; gap: 10px; }
.nav-toggle { display: none; }

.child-switcher { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; }
.baby-chips { display: flex; gap: 6px; }
.baby-chip {
  background: var(--chip-bg); color: var(--ink-2); border: 1px solid transparent;
  border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.baby-chip:hover { background: var(--brand-l); }
.baby-chip.active { background: var(--brand); color: #fff; }
.chip-add { background: transparent; border: 1px dashed var(--line-2); color: var(--brand-d); border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip-add:hover { background: var(--brand-50); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.account-id { font-size: 0.85rem; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell { display: flex; flex: 1; align-items: flex-start; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #9ca3af; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: transparent; border: none; cursor: pointer;
  padding: 9px 12px; border-radius: var(--radius-s);
  font-size: 0.9rem; font-weight: 600; color: var(--ink-2);
}
.nav-item .ni { font-size: 1rem; width: 20px; text-align: center; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: var(--brand-50); color: var(--brand-d); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav-item { position: relative; }

.content { flex: 1; min-width: 0; padding: 28px; }
.content > .view { max-width: 880px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }
.view-head { margin-bottom: 18px; }
.view-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-head p { margin: 4px 0 0; }

.scrim { display: none; }

/* ============================================================
   Cards & generic blocks
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.block-head { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.summary.empty { color: var(--muted); }
#profile-summary div { margin-bottom: 4px; }
#profile-summary p { margin: 8px 0 0; }

/* Home tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; box-shadow: var(--shadow);
  font-weight: 600; color: var(--ink); transition: transform 0.12s, border-color 0.12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--brand-l); }
.tile-ic { font-size: 1.5rem; }

/* CTA (memory book) */
.cta { border: 1px solid var(--brand-l); background: var(--brand-50); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.cta strong { font-size: 1.05rem; }
.cta p { margin: 6px 0 12px; color: var(--ink-2); }
.cta-btn { border: none; border-radius: var(--radius-s); padding: 9px 16px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; }
.cta-btn:hover { background: var(--brand-d); }

/* ============================================================
   Memories
   ============================================================ */
.memory-form-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.memory-form-row input[type="date"] { flex: 0 0 160px; }
.memory-form-row input[type="text"], .memory-form-row input[type="number"] { flex: 1; min-width: 140px; }
.memory-form-row select { flex: 0 0 180px; }

.file-btn { display: inline-flex; align-items: center; padding: 10px 14px; border: 1px dashed var(--brand-l); border-radius: var(--radius-s); background: var(--brand-50); color: var(--brand-d); font-size: 0.86rem; cursor: pointer; flex: 1; min-width: 180px; }
.file-btn input[type="file"] { display: none; }

.memory-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 12px; }
.memory-card { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.memory-thumb { width: 100%; height: 160px; object-fit: cover; display: block; }
.memory-meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.memory-card-date { font-size: 0.76rem; font-weight: 700; color: var(--brand-d); }
.memory-remove, .memory-edit { position: absolute; top: 8px; width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: rgba(17,24,39,0.55); color: #fff; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.memory-remove { right: 8px; }
.memory-edit { right: 42px; }
.photo-count { position: absolute; bottom: 8px; right: 8px; background: rgba(17,24,39,0.7); color: #fff; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.memory-remove:hover { background: rgba(153,27,27,0.9); }
.memory-edit:hover { background: rgba(124,58,237,0.9); }

/* ============================================================
   Family sharing
   ============================================================ */
body.viewer .owner-only { display: none !important; }
body.viewer #profile-form input,
body.viewer #profile-form select,
body.viewer #profile-form textarea,
body.viewer #health-form input,
body.viewer #health-form select,
body.viewer #vaccine-schedule input { pointer-events: none; opacity: 0.8; }

.member-list { list-style: none; margin: 12px 0 0; padding: 0; }
.member-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }

/* ============================================================
   Milestone cards
   ============================================================ */
.ms-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.ms-chip { background: var(--chip-bg); color: var(--ink-2); border: 1px solid transparent; border-radius: 999px; padding: 7px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.ms-chip:hover { background: var(--brand-l); }
.ms-chip.reached { background: var(--brand-50); color: var(--brand-d); border-color: var(--brand-l); }
.card-preview { margin-top: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.card-img { width: 320px; max-width: 100%; aspect-ratio: 1 / 1; border-radius: 16px; box-shadow: var(--shadow); }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   Vaccination schedule
   ============================================================ */
.schedule.hidden { display: none; }
.schedule ul { list-style: none; margin: 0; padding: 0; }
.schedule li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.vaccine { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vaccine-check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.vaccine-check input { width: auto; }
.vaccine-due { display: block; font-size: 0.82rem; color: var(--muted); }
.vaccine.done { opacity: 0.6; }
.badge { font-size: 0.74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.overdue { background: var(--bad-bg); color: var(--bad); }
.badge.due-soon { background: var(--warn-bg); color: var(--warn); }
.badge.upcoming { background: #e0e7ff; color: #3730a3; }

/* ============================================================
   Shop / recommendations
   ============================================================ */
.recommendations.hidden { display: none; }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.rec-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; background: var(--card); box-shadow: var(--shadow); transition: transform 0.12s, border-color 0.12s; }
.rec-card:hover { transform: translateY(-2px); border-color: var(--brand-l); text-decoration: none; }

/* ============================================================
   Vault: health + documents
   ============================================================ */
.lock-pill { font-size: 0.68rem; font-weight: 700; background: var(--ok-bg); color: var(--ok); padding: 3px 9px; border-radius: 999px; }
.stemcell { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.stemcell legend { font-weight: 600; padding: 0 6px; color: var(--brand-d); }
.inline-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 600; }
.inline-check input { width: auto; }
.growth-svg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--field); margin-top: 8px; }

.document-list { list-style: none; margin: 14px 0 0; padding: 0; }
.document-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.doc-cat { font-size: 0.7rem; font-weight: 700; background: var(--brand-l); color: var(--brand-d); padding: 2px 8px; border-radius: 999px; }
.doc-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ============================================================
   Services + calculators
   ============================================================ */
.services-list { display: grid; gap: 12px; margin-top: 14px; }
.service-item { border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.service-item p { margin: 6px 0 10px; }
.enquire-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.enquire-form input { flex: 1; min-width: 160px; }

.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.calc { border: 1px solid var(--brand-l); border-radius: 14px; padding: 18px; background: var(--brand-50); }
.calc h3 { color: var(--brand-d); }
.calc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 0.88rem; }
.calc-row input { width: 120px; }
.calc-out { margin: 10px 0 0; font-weight: 700; color: var(--ok); min-height: 1.2em; }

/* ============================================================
   Growth journey (Home hero) — baby + its growth
   ============================================================ */
.journey-card {
  background: var(--grad);
  border-radius: var(--radius);
  padding: 22px 24px 26px;
  margin-bottom: 18px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.journey-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.journey-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.journey-age { opacity: 0.92; font-size: 0.95rem; margin-top: 2px; }
.journey-emoji { font-size: 2.4rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2)); }

.journey-track { display: flex; align-items: flex-start; }
.journey-node { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
/* connector line between nodes */
.journey-node::before {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 3px; background: rgba(255,255,255,0.25);
}
.journey-node:first-child::before { display: none; }
.journey-node.done::before, .journey-node.current::before { background: rgba(255,255,255,0.85); }
.journey-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; background: rgba(255,255,255,0.25); color: #fff; position: relative; z-index: 1;
  border: 2px solid transparent;
}
.journey-node.done .journey-dot { background: #fff; color: var(--brand-d); }
.journey-node.current .journey-dot { background: #fff; font-size: 1rem; transform: scale(1.35); box-shadow: 0 0 0 5px rgba(255,255,255,0.25); }
.journey-label { font-size: 0.66rem; margin-top: 12px; text-align: center; opacity: 0.8; line-height: 1.2; max-width: 64px; }
.journey-node.current .journey-label { opacity: 1; font-weight: 700; }

@media (max-width: 560px) {
  .journey-label { font-size: 0.58rem; }
  .journey-name { font-size: 1.35rem; }
}

/* ============================================================
   Home alerts
   ============================================================ */
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.alert { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.alert.warn { border-color: var(--warn); background: var(--warn-bg); }
.alert-ic { font-size: 1.4rem; }
.alert-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.alert-value { font-weight: 600; font-size: 0.9rem; }

/* ============================================================
   Learn
   ============================================================ */
.learn-tabs { display: flex; gap: 6px; background: var(--chip-bg); padding: 4px; border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.ltab { background: transparent; border: none; border-radius: 9px; padding: 8px 14px; font-size: 0.86rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.ltab.active { background: var(--card); color: var(--brand-d); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.article-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.12s, border-color 0.12s; }
.article-card:hover { transform: translateY(-2px); border-color: var(--brand-l); }
.article-hero { font-size: 1.8rem; }
.article-card strong { font-size: 0.98rem; }

.article-reader { line-height: 1.7; }
.article-reader h2 { margin: 14px 0 12px; }
.article-reader h3 { color: var(--brand-d); margin-top: 18px; }
.article-reader p { color: var(--ink-2); }

/* ============================================================
   Settings
   ============================================================ */
.settings-block { padding: 20px 0; border-top: 1px solid var(--line); }
.settings-block:first-of-type { border-top: none; padding-top: 0; }
.danger-zone { border-top: 1px solid #fde2e2; }

/* ============================================================
   Admin (admin.html reuses these + its own)
   ============================================================ */
.header-bar { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account { display: flex; align-items: center; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.stat-card { border: 1px solid var(--brand-l); border-radius: 12px; padding: 18px; text-align: center; background: var(--brand-50); }
.stat-val { font-size: 1.9rem; font-weight: 800; color: var(--brand-d); }
.stat-lbl { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: #9333ea; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.admin-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.role-badge { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.role-badge.admin { background: var(--brand-l); color: var(--brand-d); }
.role-badge.user { background: var(--chip-bg); color: var(--ink-2); }
.small-btn { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }

/* Admin page uses a simple centered layout */
body.admin { background: var(--bg); }
body.admin header { padding: 20px 24px; background: linear-gradient(135deg, var(--brand-d), #a855f7); color: #fff; }
body.admin .brand { color: #fff; }
body.admin header p { max-width: 1000px; margin: 8px auto 0; opacity: 0.95; }
body.admin main { padding: 24px; max-width: 1000px; margin: 0 auto; }
body.admin .ghost-btn { background: rgba(255,255,255,0.18); color: #fff; border-color: rgba(255,255,255,0.5); }
body.admin header .icon-btn { color: #fff; }
body.admin header .icon-btn:hover { background: rgba(255,255,255,0.18); }
body.admin footer { text-align: center; padding: 24px; color: var(--muted); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .account-id { display: none; }
  .topbar { gap: 10px; padding: 0 12px; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto;
    transform: translateX(-100%); transition: transform 0.2s ease; z-index: 40;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,0.35); z-index: 35; }
  .scrim.show { display: block; }
  .content { padding: 18px 14px; }
}

/* ============================================================
   Family & Community
   ============================================================ */
.card-title { margin: 0 0 4px; font-size: 1.05rem; color: var(--ink); }
.settings-msg.ok { color: #15803d; }
.settings-msg.error { color: #b91c1c; }
button.small { padding: 6px 12px; font-size: 0.82rem; }

.stack-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.stack-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack-form select, .stack-form input, .stack-form textarea { width: 100%; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink-2); }
.check-row input { width: auto; }

.tree-view { margin-top: 10px; }
.tree-me { font-size: 1.05rem; padding: 10px 14px; background: var(--grad-soft); border-radius: 12px; }
.tree-children { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px 18px; }
.tree-child { background: var(--chip-bg); color: var(--brand-d); border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; }
.tree-people { margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.tree-person, .req-row, .search-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.req-row { margin-bottom: 8px; }
.req-actions { display: flex; gap: 8px; flex-shrink: 0; }
#search-results { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.community-search { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.community-search input { flex: 1 1 120px; }
.community-search button { flex-shrink: 0; }

.ask-row { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.ask-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ask-body { margin-top: 6px; color: var(--ink-2); white-space: pre-wrap; }

.ask-dialog { border: none; border-radius: 18px; padding: 0; max-width: 460px; width: 92%; box-shadow: 0 20px 60px rgba(28,24,48,0.25); }
.ask-dialog::backdrop { background: rgba(28,24,48,0.45); }
.ask-dialog form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.ask-dialog h3 { margin: 0; }
.ask-dialog textarea { width: 100%; resize: vertical; }

@media (max-width: 560px) {
  .tree-person, .req-row, .search-row { flex-direction: column; align-items: stretch; }
  .req-actions { justify-content: flex-end; }
  .stack-form .field-row { grid-template-columns: 1fr; }
}
