/* ============================================================
   The Family Archive — design system
   ============================================================ */
:root {
  /* Palette — custom, not default Tailwind */
  --ink-900:        #131826;
  --ink-800:        #1d2438;
  --ink-700:        #2a324a;
  --ink-600:        #424b61;
  --ink-500:        #5a6378;
  --ink-400:        #7c8497;
  --ink-300:        #aab1c0;
  --ink-200:        #d8dce4;
  --ink-100:        #ecf0f6;

  --paper:          #f7f3ec;       /* warm cream */
  --paper-soft:     #fbf8f2;
  --paper-veil:     #f1ece2;

  --brand-900:      #173028;       /* deep forest */
  --brand-700:      #1f4a3d;
  --brand-500:      #2f6b59;
  --brand-300:      #7fa597;

  --accent-700:     #b6743d;       /* burnished copper */
  --accent-500:     #cd8a4f;
  --accent-300:     #e6b88e;
  --accent-100:     #f4dec3;

  --rose-male:      #5b8fc7;       /* desaturated, sophisticated */
  --rose-male-bg:   #e3edf8;
  --rose-female:    #d27aa1;
  --rose-female-bg: #fbe3ec;

  --ok:             #2f7d6a;
  --warn:           #b6743d;
  --danger:         #b34141;

  /* Elevation — ambient layers carry a trace of forest-green so surfaces
     feel pressed into the warm paper rather than floating on neutral grey. */
  --shadow-soft:
    0 1px 1px rgba(23, 38, 33, 0.05),
    0 4px 10px -4px rgba(23, 38, 33, 0.09),
    0 12px 28px -16px rgba(23, 48, 40, 0.20);
  --shadow-lift:
    0 1px 1px rgba(23, 38, 33, 0.06),
    0 8px 18px -8px rgba(23, 48, 40, 0.18),
    0 24px 48px -20px rgba(23, 48, 40, 0.26);
  --shadow-float:
    0 2px 4px rgba(23, 38, 33, 0.07),
    0 18px 36px -12px rgba(23, 48, 40, 0.20),
    0 40px 80px -30px rgba(23, 48, 40, 0.34);
  /* Pressed-paper top highlight — layer onto a raised surface's box-shadow. */
  --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 56px;

  --font-display: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --font-sans:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out:    cubic-bezier(.16, 1, .3, 1);

  /* Forest-tinted neutrals + a brand focus ring, available for row hovers,
     weekend cells, tonal fills, and focus states. */
  --brand-600:  #285c4c;
  /* v4.68: these two were referenced (hero gradient, active "All" chip,
     line 532) but never defined, so those declarations silently failed. */
  --brand-800:  #1b3d33;
  --brand-100:  #dde9e2;
  --tint-50:    hsl(158 26% 96%);
  --tint-100:   hsl(158 28% 92%);
  --tint-200:   hsl(158 30% 85%);
  --hairline:   rgba(19, 24, 38, 0.08);
  --ring-brand: 0 0 0 3px rgba(47, 107, 89, 0.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Fraunces ships its full optical-size axis (index.html) — let the browser
     pick the right opsz per size so large headings get the display cut. */
  font-optical-sizing: auto;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; }
[hidden] { display: none !important; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-900); }

/* Global keyboard-focus fallback. Component rules with higher specificity
   still win; this guarantees nav tabs, icon buttons, chips, and the like
   show a visible ring when tabbed to. */
:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }

/* Respect reduced-motion. The app uses spring/slide animations throughout;
   this neutralizes them for users who ask the OS to minimize motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Shared utilities (used by new surfaces; safe for existing markup) ---- */
.eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-700);
}
.btn-tonal {
  background: var(--tint-200);
  color: var(--brand-900);
  border-color: transparent;
}
.btn-tonal:hover { background: hsl(158 30% 79%); }

/* ============================================================
   Reusable components
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  background: transparent;
  color: var(--ink-900);
  transition:
    transform .18s var(--ease-spring),
    background-color .2s var(--ease-out),
    border-color .2s var(--ease-out),
    box-shadow .2s var(--ease-out),
    color .2s var(--ease-out);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }

.btn-primary {
  background: var(--brand-900);
  color: var(--paper-soft);
  border-color: var(--brand-900);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 8px 18px -10px rgba(23,48,40,.6);
}
.btn-primary:hover {
  background: #0e231d;
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 12px 24px -10px rgba(23,48,40,.7);
}
.btn-secondary {
  background: var(--paper-soft);
  border-color: var(--ink-200);
  color: var(--ink-900);
  box-shadow: var(--shadow-soft);
}
.btn-secondary:hover { border-color: var(--ink-300); background: #fff; transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--ink-700);
}
.btn-ghost:hover { background: rgba(19,24,38,.05); color: var(--ink-900); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(179,65,65,.08); }
/* Keep a real downward press (matching .btn:active) even though hover now lifts
   these buttons — without this, the hover's translateY(-1px) would win on click. */
.btn-primary:active, .btn-secondary:active, .btn-tonal:active { transform: translateY(1px) scale(.99); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  box-shadow: var(--shadow-soft);
  transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out), transform .15s var(--ease-spring);
}
.icon-btn:hover { background: #fff; border-color: var(--ink-300); color: var(--ink-900); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn span { font-size: 12px; font-weight: 600; color: var(--ink-700); }

.field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px;
}
.field > span {
  font-weight: 600; color: var(--ink-700); letter-spacing: -0.005em;
}
.field input, .field select, .field textarea, .input {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  font-size: 14px;
  color: var(--ink-900);
  font-family: inherit;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out), background-color .15s var(--ease-out);
}
.field textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
.field select, select.input {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-500) 50%),
    linear-gradient(135deg, var(--ink-500) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47, 107, 89, .15);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid-zip { display: grid; grid-template-columns: 0.8fr 1.4fr 0.7fr; gap: 12px; }
@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-zip { grid-template-columns: 1fr 1fr; }
}
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0; }
.muted { color: var(--ink-500); }
.small { font-size: 12.5px; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--paper-veil);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
}

/* ============================================================
   LOGIN
   ============================================================ */
.auth-shell {
  position: relative;
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 32px;
  overflow: hidden;
}
.auth-bg { position: absolute; inset: 0; z-index: 0; }
.auth-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
}
.auth-bg-blob.a {
  top: -10%; left: -10%; width: 60vw; height: 60vw;
  background: radial-gradient(circle at 30% 30%, var(--accent-300), transparent 60%);
}
.auth-bg-blob.b {
  bottom: -20%; right: -15%; width: 70vw; height: 70vw;
  background: radial-gradient(circle at 60% 60%, var(--brand-300), transparent 60%);
}
.auth-bg-grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  opacity: .15;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.auth-card {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: min(900px, 100%);
  background: var(--paper-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.6);
}
.auth-brand {
  background: linear-gradient(155deg, var(--brand-900), var(--brand-700) 70%, #0e231d);
  color: var(--paper-soft);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 90%, rgba(230,184,142,.18), transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(127,165,151,.18), transparent 50%);
  pointer-events: none;
}
.auth-mark { width: 44px; height: 44px; color: var(--accent-300); }
.auth-eyebrow {
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-300); margin: 0;
}
.auth-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 4.5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 4px 0 6px;
}
.auth-sub { color: rgba(247, 243, 236, 0.78); margin: 0; line-height: 1.55; max-width: 32ch; }

.auth-form {
  padding: 48px;
  display: flex; flex-direction: column; gap: 16px;
  background: var(--paper-soft);
}
.auth-help {
  color: var(--ink-500); font-size: 13px;
  border-top: 1px solid var(--ink-200); padding-top: 14px; margin-top: 6px;
}
.auth-help summary { cursor: pointer; user-select: none; }
.auth-help[open] summary { color: var(--ink-700); }
.auth-help p { margin: 8px 0 0; line-height: 1.6; }
.link-btn {
  background: transparent; border: 0; padding: 0;
  color: var(--brand-700); text-decoration: underline; cursor: pointer; font: inherit;
}
.link-btn:hover { color: var(--brand-900); }

@media (max-width: 720px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px; }
  .auth-form  { padding: 32px; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: rgba(247, 243, 236, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(19,24,38,.06);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; padding: 0; color: var(--brand-900);
}
.brand svg { width: 28px; height: 28px; }
.brand div { display: flex; flex-direction: column; line-height: 1; text-align: left; }
.brand-eyebrow { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent-700); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.nav { display: flex; gap: 4px; padding-left: 12px; border-left: 1px solid var(--ink-200); margin-left: 4px; }
.nav-tab {
  background: transparent; border: 0;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--ink-500);
  font-weight: 500; font-size: 14px;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.nav-tab:hover { color: var(--ink-900); background: rgba(19,24,38,.05); }
.nav-tab.is-active { color: var(--brand-900); background: rgba(47, 107, 89, .12); }
.nav-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.nav-badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #cf5050;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--paper-soft, #f7f3ec);
}

.user-chip {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s var(--ease-out);
}
.user-chip:hover { border-color: var(--ink-300); }
.user-chip-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-300);
  background-size: cover; background-position: center;
  border: 2px solid #fff;
  flex-shrink: 0;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.1; }
.user-chip-text span:first-child { font-weight: 600; font-size: 13px; }
.user-chip-role { font-size: 11px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .08em; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  min-width: 180px;
  display: flex; flex-direction: column;
  z-index: 40;
}
.user-menu button {
  text-align: left;
  background: transparent; border: 0;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px; color: var(--ink-700);
}
.user-menu button:hover { background: rgba(19,24,38,.05); color: var(--ink-900); }
.user-menu hr { border: 0; border-top: 1px solid var(--ink-200); margin: 4px 0; }

/* ============================================================
   VIEWS / generic
   ============================================================ */
.view { min-height: calc(100vh - 65px); }
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 24px;
}
.page-head h2 {
  font-family: var(--font-display);
  /* One editorial masthead per page: lighter weight at a larger optical size
     reads as a display cut rather than just "big bold text". */
  font-weight: 400;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
/* v4.68: editorial eyebrow above every masthead — the same letterspaced
   copper device the login panel and dashboard hero use, so each page opens
   with the archive's letterhead. */
.page-head h2::before {
  content: 'The Family Archive';
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--accent-700);
  margin-bottom: 12px;
}
.page-head p { margin: 0; color: var(--ink-500); }
.dir-tools { display: flex; gap: 10px; }
.dir-tools .input { width: 220px; }

/* ============================================================
   FAMILY TREE
   ============================================================ */
.view-tree { padding: 0; }
.tree-toolbar {
  position: absolute; top: 84px; left: 24px; right: 24px;
  z-index: 20;
  display: flex; justify-content: space-between; gap: 12px;
  pointer-events: none;
}
.tree-toolbar > * { pointer-events: auto; }
.tree-toolbar-group {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}
.tree-toolbar-group .divider {
  width: 1px; height: 22px; background: var(--ink-200); margin: 0 4px;
}
#zoom-label { min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.tree-search {
  width: 240px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--ink-200);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  font-size: 14px;
  box-shadow: var(--shadow-soft);
}
.tree-filter {
  height: 36px;
  padding: 0 28px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--ink-200);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  font-size: 13px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.tree-filter:focus { outline: 2px solid var(--brand-300); outline-offset: 2px; }
.tree-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
}
.tree-filter-btn .myfam-label { white-space: nowrap; }
.tree-filter-btn[aria-pressed="true"],
.tree-filter-btn.is-active {
  background: var(--brand-100);
  border-color: var(--brand-300);
  color: var(--brand-800);
}

/* theme picker swatch + popover */
#btn-theme { position: relative; }
.theme-swatch {
  position: absolute; bottom: 4px; right: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--paper-soft);
  box-shadow: 0 0 0 1px rgba(19,24,38,.12);
}
.theme-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 24px;
  z-index: 25;
  width: 280px;
  padding: 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--ink-200);
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column; gap: 10px;
}
.theme-popover .popover-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.theme-popover input[type=color] {
  width: 100%;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--ink-200);
  background: #fff;
  cursor: pointer;
}
.theme-presets { display: flex; gap: 8px; }
.theme-presets .preset {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--p);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(19,24,38,.15);
  cursor: pointer;
  transition: transform .15s var(--ease-spring);
}
.theme-presets .preset:hover { transform: scale(1.12); }
.theme-preview { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-preview-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(19,24,38,.10);
}
.tree-search:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47, 107, 89, .15), var(--shadow-soft);
}

.tree-canvas {
  position: relative;
  width: 100%;
  height: calc(100vh - 65px);
  overflow: hidden;
  cursor: grab;
  background:
    radial-gradient(circle at 20% 0%, rgba(230, 184, 142, .20), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(127, 165, 151, .18), transparent 55%),
    var(--paper);
  background-attachment: local;
}
.tree-canvas::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle, rgba(19,24,38,.10) 1px, transparent 1.4px);
  background-size: 28px 28px;
  background-position: 0 0;
  opacity: .5;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 60%, transparent 100%);
}
.tree-canvas.is-grabbing { cursor: grabbing; }

.tree-world {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.tree-edges {
  position: absolute; top: 0; left: 0;
  overflow: visible;
  pointer-events: none;
}
.tree-edges .edge {
  fill: none;
  stroke: var(--brand-700);
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  shape-rendering: crispEdges;
  opacity: .6;
}
/* Parent → child: bold solid. The thickest, most opaque connector so the
   "this person descends from" relationship reads at a glance. */
.tree-edges .edge.family {
  stroke-width: 2.6;
  stroke-linecap: round;
  shape-rendering: auto;
  opacity: .95;
}
/* Current spouse: solid + heart at midpoint. */
.tree-edges .edge.spouse {
  stroke: var(--accent-700);
  stroke-linecap: round;
  stroke-width: 2;
  shape-rendering: auto;
  opacity: .9;
}
/* Past-marriage line: dotted + muted opacity so exes read as past. */
.tree-edges .edge.spouse.ex {
  stroke-dasharray: 1 6;
  opacity: .55;
}
/* Sibling: distinct long-dash pattern — visually different from both the bold
   solid parent line and the dotted spouse line. */
.tree-edges .edge.sibling {
  stroke: var(--ink-400);
  stroke-dasharray: 9 5;
  stroke-linecap: round;
  stroke-width: 1.8;
  shape-rendering: auto;
  opacity: .75;
}
/* ---- Relationship spotlight (v4.69) ----
   Hovering a card (or opening a profile drawer) lights every connector that
   touches that person and dims the rest of the tree, so a single person's
   place in the family reads instantly. Only opacity + stroke-width animate. */
.tree-edges .edge,
.tree-edges .spouse-heart,
.tree-edges .sibling-badge,
.tree-edges .spouse-years {
  transition: opacity .22s var(--ease-out);
}
.tree-canvas.spotlight-on .tree-edges .is-dim { opacity: .08; }
.tree-canvas.spotlight-on .tree-edges .edge.is-hot { opacity: 1; }
.tree-canvas.spotlight-on .tree-edges .edge.family.is-hot { stroke-width: 3.6; }
.tree-canvas.spotlight-on .tree-edges .edge.spouse.is-hot { stroke-width: 3; }
.tree-canvas.spotlight-on .tree-edges .edge.sibling.is-hot { stroke-width: 2.6; }
.tree-canvas.spotlight-on .node { transition: opacity .22s var(--ease-out), transform .25s var(--ease-spring), box-shadow .25s var(--ease-out), border-color .2s var(--ease-out); }
.tree-canvas.spotlight-on .node.is-backstage { opacity: .28; }
.tree-canvas.spotlight-on .node.is-kin { opacity: 1; }

/* Connection legend + hover hint — bottom-left of the canvas. */
.tree-legend {
  position: absolute;
  left: 16px; bottom: 16px;
  z-index: 5;
  padding: 10px 14px 11px;
  background: rgba(251, 248, 242, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}
.tree-legend-hint {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent-700);
  margin-bottom: 7px;
}
.tree-legend-rows { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tree-legend-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px;
  color: var(--ink-500);
}
.tree-legend-item svg { flex-shrink: 0; }
.tree-legend-item path { fill: none; stroke-linecap: round; }
.tll-family  { stroke: var(--brand-600); stroke-width: 2.6; }
.tll-spouse  { stroke: var(--accent-700); stroke-width: 2; }
.tll-ex      { stroke: var(--accent-700); stroke-width: 2; stroke-dasharray: 1 5; opacity: .6; }
.tll-sibling { stroke: var(--ink-400); stroke-width: 1.8; stroke-dasharray: 7 4; }
@media (max-width: 700px) { .tree-legend { display: none; } }

.tree-edges .spouse-heart .heart-fill {
  fill: #dc2626;
}
.tree-edges .spouse-heart.broken .heart-fill {
  fill: var(--ink-400);
}
.tree-edges .spouse-heart .heart-crack {
  fill: none;
  stroke: var(--paper-soft);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.tree-edges .spouse-years {
  font-family: var(--font-display, serif);
  font-size: 11px;
  font-weight: 600;
  fill: var(--accent-700);
  paint-order: stroke;
  stroke: var(--paper-soft);
  stroke-width: 3px;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}
.tree-nodes { position: absolute; top: 0; left: 0; }

.node {
  position: absolute;
  width: 200px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), var(--edge-highlight);
  /* overflow stays visible so absolutely-positioned siblings (memoriam
     badge above, "+" button below) aren't clipped. The photo handles its
     own corner-rounding below. */
  overflow: visible;
  border: 1px solid rgba(19,24,38,.06);
  transition:
    transform .25s var(--ease-spring),
    box-shadow .25s var(--ease-out),
    border-color .2s var(--ease-out);
  cursor: pointer;
}
.node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift), var(--edge-highlight);
  border-color: rgba(47, 107, 89, .35);
}
.node.is-selected {
  border-color: var(--brand-700);
  box-shadow: 0 0 0 3px rgba(47, 107, 89, .15), var(--shadow-lift), var(--edge-highlight);
}
/* Edit-layout mode: cards become directly grab-able. Strip the hover
   transform so the card doesn't shift under the cursor while dragging,
   and bump the cursor + outline so it's obvious cards are draggable.
   The transition on transform is disabled too — animating during a drag
   would lag behind the pointer and feel unresponsive. */
body.tree-edit-mode .tree-canvas .node {
  cursor: grab;
  transition: box-shadow .2s var(--ease-out), border-color .2s var(--ease-out);
  outline: 2px dashed rgba(47, 107, 89, .35);
  outline-offset: 4px;
}
body.tree-edit-mode .tree-canvas .node:hover { transform: none; }
body.tree-edit-mode .tree-canvas .node:active { cursor: grabbing; }
/* When an admin has unlocked the layout, give the toolbar toggle button
   an "active" visual so it's clear the tree is in edit mode. */
#btn-toggle-edit-layout.is-active {
  background: rgba(47, 107, 89, .14);
  color: var(--brand-700);
}
/* Self indicator: gold star overlayed on the photo's top-left corner. The
   gen-bar is hidden for self cards so the star is the only top-edge marker. */
.node.is-self .node-gen-bar { display: none; }
.node-self-star {
  position: absolute;
  top: 8px; left: 8px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border-radius: 999px;
  color: hsl(45 90% 52%);
  box-shadow: 0 1px 4px rgba(19,24,38,.18);
  z-index: 3;
  pointer-events: none;
}
.node-self-star svg { width: 18px; height: 18px; display: block; }
.node.is-search-match {
  box-shadow: 0 0 0 3px rgba(205,138,79,.45), var(--shadow-lift);
  border-color: var(--accent-500);
}
.node.is-faded { opacity: .35; }

/* contextual + button (admin only)
   - 44px hit target (above Apple/Material minimums)
   - Position is fixed; only opacity changes on hover so the target doesn't move
   - A pseudo-element extends the card's :hover area downward so the cursor
     never falls into a dead zone between card and button. */
.node-add {
  display: none;
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translate(-50%, 0);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--brand-900);
  color: var(--paper-soft);
  border: 3px solid var(--paper-soft);
  box-shadow:
    0 4px 10px -4px rgba(23, 48, 40, .55),
    0 14px 28px -10px rgba(23, 48, 40, .35);
  align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s var(--ease-out), background-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
  z-index: 4;
}
body.is-admin .node-add { display: inline-flex; }
/* hover bridge — extends the card's :hover region 36px below it */
body.is-admin .node::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -36px;
  height: 36px;
  z-index: 3;
  pointer-events: none;
}
body.is-admin .node:hover::after,
body.is-admin .node:focus-within::after,
body.is-admin .node.is-selected::after {
  pointer-events: auto;
}
.node:hover .node-add,
.node:focus-within .node-add,
.node.is-selected .node-add {
  opacity: 1;
  pointer-events: auto;
}
.node-add:hover {
  background: var(--accent-700);
  box-shadow:
    0 6px 14px -4px rgba(182, 116, 61, .55),
    0 18px 32px -10px rgba(23, 48, 40, .35);
}
.node-add:active { transform: translate(-50%, 1px); }
.node-add:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 3px; }
.node-add svg { width: 18px; height: 18px; }

/* expand / collapse toggle */
.node-toggle {
  position: absolute;
  top: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink-700);
  border: 1px solid rgba(19,24,38,.10);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 2px 6px -2px rgba(19,24,38,.18);
  z-index: 2;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out), transform .18s var(--ease-spring);
}
.node-toggle:hover { background: #fff; color: var(--ink-900); transform: translateY(-1px); }
.node-toggle:active { transform: translateY(0); }
.node-toggle:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }
.node-toggle svg {
  width: 12px; height: 12px;
  transition: transform .25s var(--ease-spring);
}
.node-toggle.is-collapsed {
  background: var(--accent-100);
  border-color: rgba(182, 116, 61, .35);
  color: var(--accent-700);
}
.node-toggle.is-collapsed svg { transform: rotate(-90deg); }
.node-toggle-count {
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.node.is-collapsed { box-shadow: var(--shadow-soft), 0 0 0 1px rgba(182, 116, 61, .25) inset; }

/* flags row on the card — flags scale-up via font-size since they're emoji */
.node-flags {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1;
}
.node-flag { display: inline-block; }
.node-flag-more {
  font-size: 11px;
  color: var(--ink-500);
  background: var(--paper-veil);
  padding: 2px 6px;
  border-radius: 999px;
}

/* ethnicity picker */
.ethnicity-picker {
  position: relative;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.eth-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 28px;
  align-items: center;
}
.eth-empty {
  color: var(--ink-400);
  font-size: 13px;
  padding: 0 4px;
}
.eth-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  padding: 3px 4px 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-900);
}
.eth-chip .eth-flag { font-size: 14px; line-height: 1; }
.eth-chip-x {
  background: transparent; border: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  color: var(--ink-500);
  display: grid; place-items: center;
  cursor: pointer;
}
.eth-chip-x:hover { background: rgba(19,24,38,.08); color: var(--ink-900); }
.eth-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border: 1px dashed var(--ink-200);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink-700);
  font-size: 13px;
  cursor: pointer;
}
.eth-trigger:hover { border-color: var(--brand-500); color: var(--ink-900); }
.eth-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.eth-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  font-size: 13px;
}
.eth-search:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47,107,89,.15);
}
.eth-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.eth-option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink-700);
  cursor: pointer;
  width: 100%;
}
.eth-option:hover { background: var(--paper-veil); color: var(--ink-900); }
.eth-option.is-selected {
  background: rgba(47,107,89,.10);
  color: var(--brand-900);
  font-weight: 500;
}
.eth-option .eth-flag { font-size: 18px; line-height: 1; }
.eth-option .eth-check { margin-left: auto; color: var(--brand-700); }

/* member picker (multi-select with chips) */
.member-picker {
  position: relative;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.mp-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.mp-empty { color: var(--ink-400); font-size: 13px; padding: 0 4px; }
.mp-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  padding: 3px 4px 3px 4px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-900);
}
.mp-chip-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: var(--ink-100);
}
.mp-chip-avatar.is-male { background-color: var(--rose-male-bg); }
.mp-chip-avatar.is-female { background-color: var(--rose-female-bg); }
.mp-chip-x {
  background: transparent; border: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  color: var(--ink-500);
  display: grid; place-items: center;
  cursor: pointer;
}
.mp-chip-x:hover { background: rgba(19,24,38,.08); color: var(--ink-900); }
.mp-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border: 1px dashed var(--ink-200);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink-700);
  font-size: 13px;
  cursor: pointer;
}
.mp-trigger:hover { border-color: var(--brand-500); color: var(--ink-900); }
.mp-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.mp-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  font-size: 13px;
}
.mp-search:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47,107,89,.15);
}
.mp-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.mp-show-all {
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px dashed var(--ink-200);
  border-radius: 8px;
  background: transparent;
  color: var(--brand-700);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.005em;
}
.mp-show-all:hover { border-color: var(--brand-500); background: var(--paper-veil); }
.mp-option {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink-700);
  cursor: pointer;
  width: 100%;
}
.mp-option:hover { background: var(--paper-veil); color: var(--ink-900); }
.mp-option.is-selected {
  background: rgba(47,107,89,.10);
  color: var(--brand-900);
  font-weight: 500;
}
.mp-option-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: var(--ink-100);
}
.mp-option-avatar.is-male { background-color: var(--rose-male-bg); }
.mp-option-avatar.is-female { background-color: var(--rose-female-bg); }

/* ethnicity row in profile drawer */
.kv-eth {
  display: inline-flex; align-items: center; gap: 5px;
  margin-right: 10px;
  padding: 2px 0;
}
.kv-flag { font-size: 16px; line-height: 1; }

.node-gen-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  /* Soft gradient run instead of a flat strip — reads as an inlay, not tape. */
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--gen, var(--brand-700)) 78%, #fff) 0%,
    var(--gen, var(--brand-700)) 45%,
    color-mix(in srgb, var(--gen, var(--brand-700)) 82%, #000) 100%);
  z-index: 2;
}
.node-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  /* Round only the top so it sits flush with the card's rounded top while
     the body below keeps a square edge. overflow clips the gradient overlay. */
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  overflow: hidden;
}
.node-photo.is-male   { background-color: var(--rose-male-bg); }
.node-photo.is-female { background-color: var(--rose-female-bg); }
.node-photo svg { width: 100%; height: 100%; display: block; }
.node-photo::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(19,24,38,.18));
  pointer-events: none;
}

.node-body { padding: 12px 14px 14px; }
.node-relation {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gen-edge, var(--accent-700));
}
.node-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 4px 0 2px;
  color: var(--ink-900);
}
.node-nick {
  font-size: 12.5px;
  color: var(--ink-500);
  font-style: italic;
  line-height: 1.2;
}
/* v4.29: International name (e.g. Korean / Vietnamese) shown directly
   under the display name on tree cards. Slightly smaller + muted so it
   sits as a quiet secondary line, but with normal (non-italic) weight
   to honor the script — many CJK fonts render italics awkwardly. */
.node-international-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-700);
  line-height: 1.25;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
  word-break: break-word;
}
.node-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-500);
  display: flex; align-items: center; gap: 5px;
}
.node-meta svg { width: 12px; height: 12px; }
.node-anniv {
  margin-top: 4px;
  font-size: 12px;
  color: var(--accent-700);
  display: flex; align-items: center; gap: 5px;
}
.node-anniv svg { width: 12px; height: 12px; }
.node-group {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-700, var(--ink-500));
  background: var(--gen-soft, rgba(19,24,38,.06));
  border: 1px solid var(--gen-edge, rgba(19,24,38,.12));
  border-radius: 999px;
  letter-spacing: .02em;
}
/* v4.28: 529-plan quick-link chip on the tree node card. Visible to Admin
   and Family roles when m.plan529 is set. Acts as an actual <a> — clicking
   it opens the plan portal in a new tab and stops the click from
   bubbling up to the card-opens-drawer handler. */
.node-529 {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #5a3a12;
  background: rgba(212, 165, 96, .18);
  border: 1px solid rgba(212, 165, 96, .45);
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: .02em;
  transition: background-color .12s var(--ease-out), border-color .12s var(--ease-out), transform .12s var(--ease-out);
}
.node-529:hover {
  background: rgba(212, 165, 96, .28);
  border-color: rgba(212, 165, 96, .65);
  transform: translateY(-1px);
}
.node-529:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}
.node-529-icon { font-size: 12px; line-height: 1; }
.node-529-text { line-height: 1; }

/* Non-admins cannot open the profile drawer from a tree card. */
body:not(.is-admin) .tree-nodes .node { cursor: default; }

.tree-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.tree-empty-card {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 12% 110%, rgba(230, 184, 142, 0.14), transparent 55%),
    radial-gradient(100% 130% at 92% -15%, rgba(127, 165, 151, 0.14), transparent 55%),
    #fff;
  border: 1px solid var(--hairline);
  padding: 30px 34px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift), var(--edge-highlight);
  text-align: center;
  max-width: 380px;
}
.tree-empty-card::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  opacity: .06;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.tree-empty-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 22px; margin: 0 0 6px; letter-spacing: -.015em;}
.tree-empty-card p { color: var(--ink-500); margin: 0 0 16px; }

/* ============================================================
   DRAWER
   ============================================================ */
.drawer {
  position: fixed; inset: 0;
  z-index: 50;
  pointer-events: none;
}
.drawer[aria-hidden="false"] { pointer-events: auto; }
.drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(19,24,38,.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s var(--ease-out);
}
.drawer[aria-hidden="false"] .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(440px, 92vw);
  background: var(--paper-soft);
  box-shadow: var(--shadow-float);
  transform: translateX(105%);
  transition: transform .35s var(--ease-out);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.drawer[aria-hidden="false"] .drawer-panel { transform: translateX(0); }
.drawer-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(19,24,38,.08);
  color: var(--ink-700);
  display: grid; place-items: center;
  z-index: 2;
  transition: background-color .15s var(--ease-out);
}
.drawer-close:hover { background: #fff; color: var(--ink-900); }
.drawer-close svg { width: 14px; height: 14px; }

.drawer-hero {
  position: relative;
  padding: 28px 28px 22px;
  background:
    linear-gradient(155deg, var(--brand-900), var(--brand-700) 80%);
  color: var(--paper-soft);
}
.drawer-hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 0%, rgba(230,184,142,.22), transparent 55%);
  pointer-events: none;
}
.drawer-photo {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--paper-veil);
  background-size: cover; background-position: center;
  border: 3px solid var(--paper-soft);
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.drawer-photo svg { width: 100%; height: 100%; display: block; }
.drawer-photo.is-male { background-color: var(--rose-male-bg); }
.drawer-photo.is-female { background-color: var(--rose-female-bg); }

.drawer-id { position: relative; }
.drawer-eyebrow {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-300); margin: 0 0 4px;
}
#drawer-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 26px; letter-spacing: -0.02em;
  margin: 0;
}
.drawer-nick { color: rgba(247,243,236,.72); font-style: italic; margin: 4px 0 0; font-size: 14px; }
/* v4.29: International name shown directly under the drawer H2. Matches
   the hero-area light text but in the display font and no italics, so
   CJK characters render cleanly. */
.drawer-international-name {
  color: rgba(247,243,236,.95);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  margin: 4px 0 0;
  letter-spacing: -0.005em;
}
.drawer-international-name[hidden] { display: none; }
.node-memoriam {
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: hsl(220 12% 18%);
  color: #f7f3ec;
  border: 1px solid hsl(220 12% 28%);
  z-index: 5;
  font-weight: 600;
  font-family: var(--font-display);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.node-memoriam-icon { font-size: 13px; line-height: 1; letter-spacing: 0; }
.drawer-remembering {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: rgba(247,243,236,.14);
  color: var(--accent-200);
  border: 1px solid rgba(247,243,236,.2);
}
.drawer-remembering::before { content: "🕊️"; font-size: 14px; letter-spacing: 0; }
.drawer-notes {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.55;
}

/* Gifts mini-section in profile drawer */
.gifts-mini { display: flex; flex-direction: column; gap: 14px; }
.gifts-bucket-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.gifts-bucket-head h5 {
  margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-500); font-weight: 600;
}
.gifts-bucket-total {
  font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--ink-700); font-weight: 600;
}
.gifts-rows { display: flex; flex-direction: column; gap: 6px; }
/* Inline mini-gift rows (drawer): the original flex layout. Scoped so the
   .gift-row class doesn't bleed onto the Gifts table's <tr> elements, which
   would turn the rows into flex containers and break table column alignment. */
.gifts-rows .gift-row,
.gifts-mini .gift-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--paper-soft);
  border: 1px solid var(--ink-100);
  font-size: 13px;
}
.gifts-rows .gift-row[data-direction="received"],
.gifts-mini .gift-row[data-direction="received"] { border-left: 3px solid hsl(145 55% 42%); }
.gifts-rows .gift-row[data-direction="given"],
.gifts-mini .gift-row[data-direction="given"]    { border-left: 3px solid hsl(35 80% 50%); }
.gift-row-main { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.gift-direction {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-500); font-weight: 600;
}
.gift-other { color: var(--ink-800); font-weight: 500; }
.gift-occasion { color: var(--ink-600); font-size: 12px; }
.gift-event-chip {
  font-size: 12px; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--ink-200);
  background: #fff; cursor: pointer;
}
.gift-event-chip:hover { background: var(--paper-soft); }
.gift-row-meta { display: flex; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.gift-date { color: var(--ink-500); font-size: 12px; }
.gift-amount { color: var(--ink-800); font-weight: 600; }
.gifts-net {
  text-align: right;
  font-size: 13px;
  color: var(--ink-700);
  padding-top: 6px;
  border-top: 1px dashed var(--ink-200);
}

.drawer-body {
  padding: 22px 28px 28px;
  overflow-y: auto;
  flex: 1;
}
.kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.kv > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ink-100);
  align-items: baseline;
}
.kv > div:last-child { border-bottom: 0; }
#kv-address-cell {
  display: flex; align-items: flex-start; gap: 10px;
  flex-wrap: wrap;
}
#kv-address-cell #kv-address { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.kv-copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-700);
  cursor: pointer;
  transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.kv-copy-btn:hover { background: #fff; border-color: var(--brand-500); color: var(--brand-900); }
.kv dt { font-size: 12px; color: var(--ink-500); margin: 0; text-transform: uppercase; letter-spacing: .06em; display: inline-flex; align-items: center; gap: 6px; }
.kv-emoji { font-size: 13px; line-height: 1; text-transform: none; letter-spacing: 0; margin-right: 6px; display: inline-block; }
.kv dd { margin: 0; font-size: 14px; color: var(--ink-900); word-break: break-word; }

.drawer-section { margin-top: 22px; }
.drawer-section h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  color: var(--ink-700);
}
.relation-list {
  display: flex; flex-direction: column; gap: 6px;
}
.relation-list .rel-row {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--ink-200);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}
.relation-list .rel-row:hover { background: var(--paper-soft); border-color: var(--brand-300); }
.rel-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: var(--ink-100);
  flex-shrink: 0;
}
.rel-avatar.is-male { background-color: var(--rose-male-bg); }
.rel-avatar.is-female { background-color: var(--rose-female-bg); }
.rel-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rel-info .rel-label { font-size: 11px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .08em; }
.rel-info .rel-name { font-size: 14px; font-weight: 500; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-unlink {
  display: none;
  background: transparent;
  border: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  margin-left: auto;
  color: var(--ink-400);
  cursor: pointer;
  flex-shrink: 0;
}
body.is-admin .rel-unlink { display: grid; place-items: center; }
.rel-unlink:hover { background: rgba(179,65,65,.10); color: var(--danger); }
.rel-row .rel-info { flex: 1; min-width: 0; }

.drawer-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 24px;
}

.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-preview {
  width: 64px; height: 64px;
  border-radius: 14px;
  background-size: cover; background-position: center;
  background-color: var(--paper-veil);
  border: 1px solid var(--ink-200);
  overflow: hidden;
  flex-shrink: 0;
}
.photo-preview svg { width: 100%; height: 100%; display: block; }
.photo-actions { display: flex; flex-direction: column; gap: 6px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.modal[aria-hidden="false"] { pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(19,24,38,.32);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s var(--ease-out);
}
.modal[aria-hidden="false"] .modal-backdrop { opacity: 1; }
.modal-panel {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(.97);
  background: var(--paper-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: min(560px, 92vw);
  max-height: 86vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0;
  transition: transform .25s var(--ease-out), opacity .25s var(--ease-out);
}
.modal[aria-hidden="false"] .modal-panel {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.modal-sm { width: min(420px, 92vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ink-200);
}
.modal-head h3 {
  font-family: var(--font-display); font-weight: 500; font-size: 20px;
  letter-spacing: -0.015em; margin: 0;
}
.modal-body {
  padding: 20px 22px 24px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
.modal-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.rel-fieldset {
  border: 1px dashed var(--ink-200);
  border-radius: 12px;
  padding: 14px;
  margin: 0;
  background: rgba(247, 243, 236, .6);
}
.rel-fieldset legend {
  font-size: 12px; font-weight: 600; color: var(--ink-700);
  letter-spacing: .04em; text-transform: uppercase;
  padding: 0 6px;
}
.checkbox-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: rgba(205, 138, 79, .08);
  border: 1px solid rgba(205, 138, 79, .28);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.45;
  margin-top: 8px;
}
.checkbox-row input[type=checkbox] {
  width: 16px; height: 16px;
  margin-top: 2px;
  accent-color: var(--accent-700);
  flex-shrink: 0;
}

.modal-anchor {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(47, 107, 89, .10), rgba(205, 138, 79, .10));
  border: 1px solid rgba(47, 107, 89, .25);
  border-radius: 12px;
}
.modal-anchor-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: var(--paper-veil);
  border: 2px solid #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  flex-shrink: 0;
}
.modal-anchor-avatar.is-male { background-color: var(--rose-male-bg); }
.modal-anchor-avatar.is-female { background-color: var(--rose-female-bg); }
.modal-anchor-avatar svg { width: 100%; height: 100%; display: block; }
.modal-anchor-text { display: flex; flex-direction: column; line-height: 1.2; }
.modal-anchor-eyebrow {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-500); font-weight: 600;
}
.modal-anchor-text strong {
  font-family: var(--font-display); font-weight: 500;
  font-size: 17px; letter-spacing: -0.015em; color: var(--ink-900);
  margin-top: 2px;
}

.cred-block {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  display: grid; gap: 10px;
  padding: 16px;
}
.cred-block > div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: baseline; }
.cred-block span { font-size: 12px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .08em; }
.cred-block code { font-size: 14px; font-weight: 600; color: var(--ink-900); }

/* idle warning countdown bar */
.idle-bar {
  height: 6px;
  background: var(--ink-100);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 14px;
}
.idle-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-700), var(--brand-700));
  border-radius: 999px;
  transition: width 1s linear;
}
#idle-modal .modal-panel { background: var(--paper-soft); }
#idle-countdown { font-variant-numeric: tabular-nums; color: var(--accent-700); }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px 18px 18px;
}
.admin-card {
  /* .node sets position:absolute for tree placement — override for the grid. */
  position: relative;
  transform: none;
  left: 0; top: 0;
  width: auto;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .25s var(--ease-spring), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out);
}
.admin-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(47,107,89,.35);
}
.admin-card .node-body { padding: 12px 14px 14px; }
.admin-card-actions {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--ink-100, rgba(19,24,38,.08));
}
.admin-card-actions .btn { padding: 4px 8px; font-size: 11.5px; }

/* Segmented toggle for the Members panel view-mode */
.panel-head-tools { display: inline-flex; align-items: center; gap: 10px; }
.seg {
  display: inline-flex;
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 2px;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.seg-btn:hover { color: var(--ink-900); }
.seg-btn.is-active {
  background: #fff;
  color: var(--brand-900, var(--ink-900));
  box-shadow: 0 1px 3px rgba(19,24,38,.08);
}

.admin-grid {
  display: grid; gap: 22px;
  grid-template-columns: 1fr;
}

/* ============================================================
   v4.35 — Friends + All tabs (Members page sub-tabs)
   ============================================================
   Friends used to live on their own top-level page as a card grid (v4.31).
   v4.35 folded them into the Members page as a sub-tab and switched the
   layout to list rows with expandable households (one row per friend's
   primary contact, plus indented sub-rows for spouse/kids when expanded). */

/* Sub-tabs row: mirrors .vault-tabs so the visual language stays consistent
   across the Admin and Members pages. */
.member-tabs {
  display: inline-flex; gap: 4px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.member-tab {
  padding: 7px 16px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-700);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.member-tab:hover { color: var(--ink-900); }
.member-tab.is-active {
  background: #fff;
  color: var(--brand-900);
  box-shadow: var(--shadow-soft);
}
.member-panel { display: block; }
.page-head-actions { display: inline-flex; gap: 10px; align-items: center; }

/* v4.37: wider container when the Members page is on the Friends tab so the
   Address + Phone columns get room to render on one line. Applies only
   when the Friends panel is the active sub-panel. */
#view-admin .container { max-width: 1400px; }

/* v4.37: name-cell layout — primary name + inline ethnicity flags + age
   in parens. Flags and the age use lighter weight + tighter spacing so
   they read as metadata, not as part of the name itself. */
.row-name-line {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  line-height: 1.25;
}
.row-name-text { font-weight: 600; }
.row-name-flag { font-size: 14px; line-height: 1; }
.row-name-age {
  font-size: 12px;
  color: var(--ink-500, #6b7280);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* v4.37: friend-table column hints — keep Phone + Birthday + 529 from
   wrapping; let Email + Address flex. */
.table-friends th, .table-friends td { vertical-align: middle; }
.table-friends td.muted-cell, .table-friends td .muted { color: var(--ink-500, #6b7280); }

/* v4.38: two-line address cell on the Friends tab. Street on top, City/
   State/Zip below. The flex layout keeps the copy button aligned with the
   top line so its position is consistent regardless of cell height. */
.address-multiline {
  align-items: flex-start;
  gap: 4px;
}
.address-multiline .address-lines { line-height: 1.35; }
.address-multiline .address-lines > div + div {
  color: var(--ink-500, #6b7280);
  font-size: 12.5px;
}
.address-multiline .admin-email-copy { margin-top: 2px; }

/* v4.38: inline "Event" toggle in the Members table. Sized to be tappable
   on touch without looking heavy on desktop. */
.event-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background-color .12s ease-out;
}
.event-toggle:hover { background: var(--paper-soft, #f1ece1); }
.event-toggle input { width: 16px; height: 16px; cursor: pointer; }

/* v4.37: bank / utility account numbers — monospace + tabular numerals so
   the bullets line up cleanly, with a subtle reminder color. */
/* v4.69: sensitive-number widget — masked value + peek/copy icon buttons.
   Peek auto re-masks after 12s (see sensitiveNumberHTML in app.js). */
.secret-num {
  display: inline-flex; align-items: center; gap: 6px;
}
.secret-num-value { font-variant-numeric: tabular-nums; }
.secret-num.is-revealed .secret-num-value {
  color: var(--brand-700);
  font-weight: 600;
}
.secret-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  background: var(--paper-soft);
  color: var(--ink-500);
  cursor: pointer;
  transition: transform .14s var(--ease-out), opacity .14s var(--ease-out);
}
.secret-btn:hover { color: var(--ink-900); transform: translateY(-1px); }
.secret-btn:active { transform: translateY(0) scale(.94); }
.secret-btn:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 1px; }
.secret-num.is-revealed [data-secret-reveal] {
  background: var(--tint-100);
  border-color: var(--tint-200);
  color: var(--brand-700);
}

.masked-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* Expand caret in the leftmost cell of household rows. v4.36 bumped the
   size from 18px → 28px after the original target was too small to click
   reliably on touch + cluttered icons in a dense row. */
.friend-expand-cell { width: 32px; padding-right: 0 !important; }
.friend-expand {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ink-200);
  background: #fff;
  color: var(--ink-700);
  border-radius: 6px;
  cursor: pointer;
  transition: transform .15s var(--ease-out), color .15s var(--ease-out), background-color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.friend-expand:hover {
  color: var(--brand-900);
  background: var(--paper-veil);
  border-color: var(--ink-300, var(--ink-200));
}
.friend-expand.is-open {
  transform: rotate(90deg);
  color: var(--brand-900);
  border-color: rgba(47, 107, 89, 0.45);
  background: rgba(47, 107, 89, 0.08);
}
.friend-expand svg { display: block; }

/* Primary household row: subtle hover for "click anywhere to edit". */
.friend-row { cursor: pointer; }
.friend-row:hover { background: var(--paper-veil); }

/* Sub-rows (spouse / child): indented + subtle background so the household
   grouping reads at a glance. The visual indent is done with padding +
   ::before tick on the name cell, not a real <td> indent. */
.friend-subrow { background: rgba(47, 107, 89, 0.025); cursor: pointer; }
.friend-subrow:hover { background: rgba(47, 107, 89, 0.06); }
.friend-subrow .row-name { padding-left: 26px; position: relative; }
.friend-subrow .row-name::before {
  content: "";
  position: absolute;
  left: 6px; top: 50%;
  width: 12px; height: 1px;
  background: var(--ink-200);
}
.friend-subrow-child .row-avatar { transform: scale(0.85); transform-origin: left center; }

/* Tiny pill next to spouse/child names so the role is unmistakable. */
.friend-role-pill {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  background: var(--paper-veil);
  color: var(--ink-700);
  border: 1px solid var(--ink-200);
}
.friend-role-pill.is-spouse { background: rgba(47, 107, 89, 0.10); color: #1f4a3d; border-color: rgba(47, 107, 89, 0.25); }
.friend-role-pill.is-child  { background: rgba(244, 162, 97, 0.14);  color: #a05a16; border-color: rgba(244, 162, 97, 0.30); }

/* "Type" pill in the All tab. */
.type-pill {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-veil);
  color: var(--ink-700);
  border: 1px solid var(--ink-200);
}
.type-pill.is-family { background: rgba(46, 134, 222, 0.10); color: #1d5a99; border-color: rgba(46, 134, 222, 0.25); }
.type-pill.is-friend { background: rgba(74, 184, 116, 0.10); color: #2b6e44; border-color: rgba(74, 184, 116, 0.25); }
.type-pill.is-spouse { background: rgba(47, 107, 89, 0.10); color: #1f4a3d; border-color: rgba(47, 107, 89, 0.25); }
.type-pill.is-child  { background: rgba(244, 162, 97, 0.14); color: #a05a16; border-color: rgba(244, 162, 97, 0.30); }

/* 529-plan chip — small inline link for the column cell. */
.plan529-chip {
  display: inline-block;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(47, 107, 89, 0.08);
  color: var(--brand-700);
  border: 1px solid rgba(47, 107, 89, 0.20);
  text-decoration: none;
}
.plan529-chip:hover { background: rgba(47, 107, 89, 0.16); }

/* ===== Friend modal: household roster section ===== */
.household-roster {
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 14px 16px 18px;
  margin: 14px 0 4px;
  background: var(--paper-veil);
}
.household-roster legend {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  padding: 0 8px;
  color: var(--ink-800);
}
.roster-section { margin-top: 8px; }
.roster-section + .roster-section {
  margin-top: 14px;
  border-top: 1px dashed var(--ink-200);
  padding-top: 14px;
}
.roster-section-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.roster-section-title {
  font-weight: 600;
  color: var(--ink-800);
  font-size: 13.5px;
}
.kids-list { display: flex; flex-direction: column; gap: 12px; }
.kid-row {
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.kid-row-actions {
  display: flex; justify-content: flex-end;
  margin-top: 6px;
}
.panel {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  overflow: hidden;
  /* Raised tier: soft forest-tinted shadow + pressed-paper top highlight,
     so panels read as cards set into the paper instead of flat outlines. */
  box-shadow: var(--shadow-soft), var(--edge-highlight);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ink-200);
}
.panel-head h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 18px; letter-spacing: -0.01em; margin: 0;
}
.inline-form { display: flex; gap: 6px; }
.inline-form .input { padding: 7px 10px; font-size: 13px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
#admin-rows code { font-size: 12px; padding: 2px 5px; }
#admin-rows .row-name > div:last-child > div:first-child { white-space: nowrap; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--ink-100);
}
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-500); font-weight: 600; }
/* Tinted header that holds when the body scrolls, quiet zebra, and a green
   row hover with a copper edge — the Members table no longer reads as raw HTML. */
.table thead th { background: var(--paper-soft); position: sticky; top: 0; z-index: 1; }
.table tbody tr { transition: background-color .12s var(--ease-out); }
.table tbody tr:nth-child(even) td { background: rgba(19, 24, 38, 0.018); }
.table tbody tr:hover td { background: var(--tint-50); }
.table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent-500); }
.table tr:last-child td { border-bottom: 0; }
.table .row-name { display: flex; align-items: center; gap: 10px; }
.table .row-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: var(--ink-100);
  flex-shrink: 0;
}
.table .row-avatar.is-male { background-color: var(--rose-male-bg); }
.table .row-avatar.is-female { background-color: var(--rose-female-bg); }
.role-pill {
  font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.role-pill.admin { color: var(--brand-900); background: rgba(47,107,89,.16); }
.role-pill.user  { color: var(--ink-700);  background: var(--paper-veil); }

.chip-list {
  list-style: none; padding: 12px 18px; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.group-row {
  display: flex; align-items: center; gap: 6px;
  border-radius: 10px;
  transition: background-color .12s var(--ease-out);
}
.group-row:hover { background: var(--paper-veil); }
.group-row.is-active { background: rgba(47,107,89,.10); }
.group-pick {
  flex: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: transparent;
  border: 0;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink-700);
}
.group-row.is-active .group-pick { color: var(--brand-900); font-weight: 600; }
.group-pick-name { font-size: 14px; }
.group-pick-count {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-500);
  background: #fff;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  font-variant-numeric: tabular-nums;
}
.group-row.is-active .group-pick-count {
  background: var(--brand-900);
  color: var(--paper-soft);
  border-color: var(--brand-900);
}
.group-delete {
  background: transparent;
  border: 0;
  width: 28px; height: 28px;
  border-radius: 8px;
  color: var(--ink-400);
  margin-right: 6px;
  display: grid; place-items: center;
  cursor: pointer;
}
.group-delete:hover { background: rgba(179,65,65,.10); color: var(--danger); }
.group-delete svg { width: 12px; height: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-700);
}
.chip button {
  background: transparent; border: 0; color: var(--ink-500);
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
}
.chip button:hover { background: rgba(19,24,38,.08); color: var(--ink-900); }
.chip button svg { width: 10px; height: 10px; }
.chip-empty { color: var(--ink-500); font-size: 13px; padding: 0 4px; }

/* ============================================================
   EVENTS
   ============================================================ */
/* Events page gets a wider container so the attendance dropdowns aren't cropped */
#view-events .container { max-width: 1500px; }
.event-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
}
@media (max-width: 900px) { .event-grid { grid-template-columns: 1fr; } }
.event-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 70vh;
  overflow-y: auto;
}
.event-item {
  text-align: left;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out), transform .18s var(--ease-spring);
}
.event-item:hover { border-color: var(--brand-500); transform: translateX(2px); }
.event-item.is-active {
  border-color: var(--brand-700);
  background: rgba(47, 107, 89, .06);
}
.event-item.is-past {
  background: rgba(19, 24, 38, 0.04);
}
.event-item.is-past .event-item-name { color: var(--ink-500); }
.event-item.is-past .event-item-icon { opacity: .6; }
.event-item.is-past.is-active {
  background: rgba(47, 107, 89, .08);
}
.event-item.is-past.is-active .event-item-name { color: var(--ink-900); }
.event-item-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}
.event-item-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-500);
  display: flex; gap: 6px;
}
.event-detail { padding: 0; }
.event-detail-empty {
  padding: 36px;
  text-align: center;
}
.panel-prose { padding: 0 18px; color: var(--ink-700); margin: 0 0 12px; }
.panel-body { padding: 0 18px 18px; }
.event-stats {
  display: flex; gap: 24px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--ink-200);
  margin-bottom: 16px;
}
.event-stat-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--brand-900);
  line-height: 1;
}
.event-stat-label { font-size: 12px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .08em; }

/* Net gift chip in the event list */
.event-net {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .01em;
  vertical-align: 1px;
}
.event-net.is-positive { background: rgba(94, 156, 112, .18); color: #2f6b41; }
.event-net.is-negative { background: rgba(179, 65, 65, .15); color: #8d2f2f; }

/* Toggle + actions in the event detail header */
.event-head-tools { display: inline-flex; align-items: center; gap: 8px; }

/* Event expenses: metric cards row + add form + table */
.event-metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 0 0 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ink-200);
}
.event-metric {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.event-metric-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-500);
}
.event-metric-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  line-height: 1.15;
}
.event-metric-sub {
  font-size: 11px;
  color: var(--ink-500);
}
.event-metric.is-paid    { border-color: rgba(94, 156, 112, .35); background: rgba(94, 156, 112, .06); }
.event-metric.is-paid .event-metric-value    { color: #2f6b41; }
.event-metric.is-unpaid  { border-color: rgba(179, 65, 65, .35); background: rgba(179, 65, 65, .05); }
.event-metric.is-unpaid .event-metric-value  { color: #8d2f2f; }
.event-metric.is-positive .event-metric-value { color: #2f6b41; }
.event-metric.is-negative .event-metric-value { color: #8d2f2f; }

.expense-add {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
@media (max-width: 720px) {
  .expense-add { grid-template-columns: 1fr 1fr; }
}

.expense-table th, .expense-table td { padding: 8px 8px; }
.expense-table .input.compact { padding: 6px 10px; font-size: 12.5px; }
.expense-table tr.is-paid td:first-child { box-shadow: inset 3px 0 0 #5e9c70; }
.expense-table tr.is-paid { background: rgba(94, 156, 112, .06); }
.exp-paid-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.exp-paid-toggle input { width: 16px; height: 16px; accent-color: #5e9c70; }
.expense-table tfoot td { background: var(--paper-soft); }
.attendance-add {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.attendance-add .input { max-width: 280px; }
.attendance-status, .attendance-note { padding: 6px 10px; font-size: 13px; }

/* ============================================================
   GIFTS
   ============================================================ */
.gift-tabs {
  display: inline-flex; gap: 4px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.gift-tab {
  padding: 7px 16px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-700);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.gift-tab:hover { color: var(--ink-900); }
.gift-tab.is-active {
  background: #fff;
  color: var(--brand-900);
  box-shadow: var(--shadow-soft);
}

/* gift direction pills + row tinting */
.gift-dir-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.gift-dir-pill.received { background: rgba(47,107,89,.14); color: var(--brand-900); }
.gift-dir-pill.given    { background: rgba(91,143,199,.18); color: #234a72; }
.gift-row.gift-given { background: rgba(91,143,199,.06); }
.gift-row.gift-given td:first-child { box-shadow: inset 3px 0 0 #5b8fc7; }
.gift-amount-cell {
  color: #1f6e51;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gift-amount-cell strong { color: #1f6e51; }
.gift-month td {
  background: var(--paper-veil);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-700);
  letter-spacing: -0.005em;
  padding: 8px 16px;
}
.gift-total td { background: #fff; padding: 14px 16px; border-top: 2px solid var(--ink-200); }

/* ===== Gifts → Reports dashboard ===== */
#gift-reports-panel { padding: 20px; }
.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.report-stat {
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-stat-eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-500); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.report-stat-num { font-family: var(--font-display); font-size: 30px; line-height: 1.05; color: var(--ink-900); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.report-stat-sub { font-size: 12.5px; color: var(--ink-500); line-height: 1.35; }

.report-section { margin-top: 20px; }
.report-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-200);
}
.report-section-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  color: var(--ink-900);
}
.report-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-700); }
.report-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.report-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

.report-chart-scroll { overflow-x: auto; padding-bottom: 4px; }
.report-month-chart { display: block; }
.report-month-chart .report-bar-label,
.report-month-chart .report-bar-sublabel {
  font-size: 11px;
  fill: var(--ink-500);
  font-family: inherit;
  text-transform: capitalize;
}
.report-month-chart .report-bar-sublabel { fill: var(--ink-400); font-size: 10.5px; }

.report-two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.report-list { display: flex; flex-direction: column; gap: 8px; }
.report-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--paper-soft);
  border: 1px solid transparent;
  transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}
.report-row[data-report-mid] { cursor: pointer; }
.report-row[data-report-mid]:hover { border-color: var(--brand-500); background: #fff; }
.report-row-occasion { grid-template-columns: 1fr auto; }
.report-row-avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ink-200);
}
.report-row-avatar.is-male   { background-color: var(--rose-male-bg, #d4e1ee); }
.report-row-avatar.is-female { background-color: var(--rose-female-bg, #f1d8d8); }
.report-row-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.report-row-label { font-size: 13.5px; font-weight: 600; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-row-value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-900); white-space: nowrap; }
.report-bar-wrap { position: relative; height: 6px; background: var(--ink-100, rgba(19,24,38,.06)); border-radius: 999px; overflow: hidden; display: flex; gap: 1px; }
.report-bar { height: 100%; border-radius: 999px; }
.report-bar.is-received { background: #c084fc; }
.report-bar.is-given    { background: #22c55e; }
.report-bar-stacked .report-bar { flex: 0 0 auto; }

/* event cover, icon picker, expanded attendee table */
.event-cover {
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--paper-veil);
  border-bottom: 1px solid var(--ink-200);
}
.event-month {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px;
}
.event-month-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -.005em;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 6px 4px 2px;
}
.event-item {
  display: flex; align-items: center; gap: 10px;
}
.event-item-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--paper-veil);
  border-radius: 10px;
  flex-shrink: 0;
}
.event-item-text { flex: 1; min-width: 0; }
.event-title-icon { margin-right: 8px; }
/* inline emoji input + browse button */
.emoji-input { position: relative; }
.emoji-input input {
  font-size: 22px;
  text-align: center;
  padding: 6px 36px 6px 6px;
}
.emoji-input-browse {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  display: grid; place-items: center;
  cursor: pointer;
}
.emoji-input-browse:hover { background: #fff; border-color: var(--brand-500); color: var(--brand-900); }

/* full emoji popover (phone-style) */
.emoji-popover {
  position: absolute;
  z-index: 200;
  width: 340px;
  max-height: 400px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.emoji-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  background: var(--paper-soft);
  font-size: 13px;
}
.emoji-search:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47,107,89,.15);
}
.emoji-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--ink-200);
  padding-bottom: 6px;
}
.emoji-tab {
  flex: 1;
  background: transparent;
  border: 0;
  font-size: 18px;
  padding: 6px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .12s var(--ease-out);
  line-height: 1;
}
.emoji-tab:hover { background: var(--paper-veil); }
.emoji-tab.is-active { background: rgba(47,107,89,.12); }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  overflow-y: auto;
  max-height: 280px;
  padding: 2px;
}
.emoji-cell {
  background: transparent;
  border: 0;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .1s var(--ease-out), transform .12s var(--ease-spring);
}
.emoji-cell:hover { background: var(--paper-veil); transform: scale(1.1); }
.cover-row { display: flex; gap: 14px; align-items: flex-start; }
.cover-preview {
  width: 96px; height: 64px;
  border-radius: 10px;
  background-color: var(--paper-veil);
  background-size: cover; background-position: center;
  border: 1px solid var(--ink-200);
  flex-shrink: 0;
}
.cover-actions { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.cover-actions input { padding: 7px 10px; font-size: 13px; border: 1px solid var(--ink-200); border-radius: 8px; }

.attendance-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.attendance-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.attendance-add .input { max-width: 220px; }
.attendance-add .custom-add {
  display: flex; gap: 6px; flex: 1; min-width: 220px;
}
.attendance-add .custom-add .input { max-width: 100%; flex: 1; }
.attendance-table th, .attendance-table td { padding: 8px 8px; }
.attendance-table .input.compact { padding: 6px 10px; font-size: 12.5px; }
.attendance-table select.input.compact { padding-right: 28px; }
/* Width = longest option + the dropdown chevron, nothing more. Forcing
   `width:auto` lets the select hug its widest content while still leaving
   room for the chevron the global `.field select` rule adds via padding. */
.attendance-table .attendance-status { width: auto; min-width: 0; }
.attendance-table .att-plus { width: 60px; text-align: center; padding-right: 8px; }
.attendance-table .att-meal  { width: auto; min-width: 0; }
.attendance-table .att-email { min-width: 180px; }
.attendance-table .att-note  { min-width: 120px; }
.row-avatar.guest {
  background: linear-gradient(135deg, #c9893e, #b6743d);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
}

/* status-based row highlighting */
.attendance-table tr.status-accepted { background: rgba(122, 184, 134, 0.14); }
.attendance-table tr.status-accepted td:first-child { box-shadow: inset 3px 0 0 #5e9c70; }
.attendance-table tr.status-declined { background: rgba(207, 122, 122, 0.14); opacity: .85; }
.attendance-table tr.status-declined td:first-child { box-shadow: inset 3px 0 0 #b34141; }
.attendance-table tr.status-no-show { opacity: .75; }

/* Gift-amount chip displayed in the attendance actions cell + total row */
.att-gift-amount {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1f6e51;
  background: rgba(94, 156, 112, .14);
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}
.att-gift-total { font-size: 13px; padding: 3px 10px; }
.attendance-total-row td { background: var(--paper-soft); }

/* Pinned "you" row for user-mode event detail */
.attendance-table tr.is-you-row { outline: 2px solid var(--brand-700, hsl(163 38% 30%)); outline-offset: -2px; }
.row-you-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--brand-700, hsl(163 38% 30%));
  color: #fff;
  border-radius: 999px;
  vertical-align: middle;
}

/* Read-only cells (user can't edit these rows) */
.attendance-table .att-readonly {
  display: inline-block;
  font-size: 13px;
  color: var(--ink-700, var(--ink-500));
  padding: 4px 0;
}
.attendance-table .status-pill {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.attendance-table .status-pill.status-accepted { background: rgba(94, 156, 112, .18); color: #2f6b41; }
.attendance-table .status-pill.status-invited  { background: rgba(19, 24, 38, .08); color: var(--ink-700, var(--ink-900)); }
.attendance-table .status-pill.status-declined { background: rgba(179, 65, 65, .15); color: #8d2f2f; }
.attendance-table .status-pill.status-no-show  { background: rgba(19, 24, 38, .06); color: var(--ink-500); }

.event-location-link {
  color: var(--brand-700);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.event-location-link:hover { color: var(--brand-900); border-bottom-style: solid; }

/* admin: clickable group chips + filter pill */
.chip { position: relative; }
.chip-select {
  background: transparent; border: 0;
  font: inherit; color: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0;
}
.chip.is-active {
  background: var(--brand-900);
  color: var(--paper-soft);
  border-color: var(--brand-900);
}
.chip.is-active .chip-count { color: var(--accent-300); }
.chip-count {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  background: rgba(19,24,38,.08);
  border-radius: 999px;
  color: var(--ink-700);
  letter-spacing: .04em;
}
.username-cell {
  display: inline-flex; align-items: center; gap: 6px;
}
.username-edit {
  background: transparent; border: 0;
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--ink-500);
  cursor: pointer;
}
.username-edit:hover { background: rgba(19,24,38,.06); color: var(--ink-900); }
.username-cell input { padding: 5px 8px; font-size: 13px; max-width: 180px; }

/* group membership editor */
.group-members { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px 0; }
.group-member-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  border-radius: 10px;
}
.group-add-row { padding: 12px 18px 18px; }
.group-add-row .input { max-width: 320px; }

/* ============================================================
   MY FAMILY (personalized mini-tree)
   ============================================================ */
.myfamily-tools .input { padding: 6px 32px 6px 10px; min-width: 220px; }

.myfamily-stage {
  position: relative;
  width: 100%;
  min-height: 360px;
  background: linear-gradient(180deg, #fff 0%, var(--paper-soft) 100%);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  overflow: visible;
}
.myfamily-world {
  position: relative;
  margin: 0 auto;
  /* Scale the whole mini-tree down 10% so larger families don't feel as
     cramped horizontally. Top-center origin keeps the focus row in the
     same visual spot. */
  transform: scale(0.9);
  transform-origin: 50% 0%;
}
.myfamily-edges {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
}
/* v4.69: rounded caps + antialiased rendering — the old square-cap
   crispEdges strokes read as jagged hairlines at odd zoom levels. Slightly
   quieter opacity keeps the people foregrounded over the plumbing. */
.myfamily-edges .myfamily-edge-lines path {
  fill: none;
  stroke: var(--brand-600, hsl(163 38% 30%));
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: auto;
  opacity: .62;
}
/* Past-marriage connectors: dashed + muted so a broken-heart link reads
   visually distinct from a current marriage at a glance. */
.myfamily-edges .myfamily-edge-ex path {
  stroke-dasharray: 6 6;
  stroke-linecap: round;
  shape-rendering: auto;
  opacity: .55;
}
.myfamily-edges .spouse-heart .heart-fill { fill: #dc2626; }
.myfamily-edges .spouse-heart.broken .heart-fill { fill: var(--ink-400); }
.myfamily-edges .spouse-heart .heart-crack {
  fill: none;
  stroke: var(--paper-soft);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.myfamily-nodes { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.myfamily-nodes .node {
  /* Mini-tree: never draggable, never positionable beyond what JS sets,
     no "is-self" outline change (we already place the focus center-stage). */
  cursor: pointer;
}
.myfamily-empty {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  text-align: center;
}

/* ============================================================
   PHOTO CROP MODAL
   ============================================================ */
.crop-stage {
  position: relative;
  width: 100%;
  height: 360px;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  user-select: none;
  touch-action: none;
  cursor: grab;
  margin-top: 8px;
}
.crop-stage.is-dragging { cursor: grabbing; }
.crop-stage img {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  max-width: none;
  max-height: none;
  will-change: transform;
}
.crop-mask { display: none; }
.crop-frame {
  position: absolute;
  top: var(--crop-frame-t, 0);
  left: var(--crop-frame-l, 0);
  width: var(--crop-frame, 240px);
  height: var(--crop-frame, 240px);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.95);
  /* Dim everything outside the viewfinder. */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
  pointer-events: none;
}
.crop-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px 4px;
  font-size: 12px;
  color: var(--ink-500);
}
.crop-controls input[type=range] {
  flex: 1;
  accent-color: var(--brand-700, var(--accent-700, hsl(163 38% 30%)));
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translate(-50%, 24px);
  background: var(--ink-900);
  color: var(--paper-soft);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-spring);
  z-index: 100;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
/* Severity styling so a failed save no longer looks like a success.
   Dark warm/maroon grounds keep the toast aesthetic; the inset bar + glyph
   carry the meaning. Driven by toast(msg, 'warn' | 'error'). */
.toast.is-warn  { background: #43330f; box-shadow: var(--shadow-float), inset 4px 0 0 var(--warn); }
.toast.is-error { background: #3d1a1a; box-shadow: var(--shadow-float), inset 4px 0 0 var(--danger); }
.toast.is-warn::before,
.toast.is-error::before { content: "⚠"; margin-right: 8px; opacity: .9; }

/* ============================================================
   CALENDAR
   ============================================================ */
#view-calendar .container { max-width: 1500px; }

.cal-toolbar {
  display: flex; align-items: center; gap: 10px;
}
.cal-toolbar .cal-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 21px;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  min-width: 180px;
  text-align: center;
}
.cal-toolbar #cal-year { width: 100px; padding: 6px 10px; }

/* Independent Work/Personal/Family filter chips (v4.72) */
.cal-filters { display: flex; gap: var(--space-2); margin: var(--space-2) 0; }
.cal-filter-chip {
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  padding: 5px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ink-200); background: var(--paper-soft); color: var(--ink-500);
  transition: transform .16s var(--ease-spring), background-color .2s var(--ease-out);
}
.cal-filter-chip:hover { transform: translateY(-1px); }
.cal-filter-chip.is-on[data-filter="work"]     { background: var(--brand-500);  color: #fff; border-color: var(--brand-500); }
.cal-filter-chip.is-on[data-filter="personal"] { background: var(--accent-500); color: #fff; border-color: var(--accent-500); }
.cal-filter-chip.is-on[data-filter="family"]   { background: var(--ink-700);    color: #fff; border-color: var(--ink-700); }

.cal-legend {
  display: flex; gap: 16px; align-items: center;
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--ink-500);
}
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-300);
}
.cal-dot.is-event    { background: hsl(205 60% 48%); }
.cal-dot.is-birthday { background: hsl(145 55% 42%); }
.cal-dot.is-anniv    { background: hsl(282 50% 52%); }
.cal-dot.is-holiday  { background: hsl(0 65% 52%); }
.cal-dot.is-reminder { background: hsl(35 80% 50%); }

.cal-panel { padding: 0; overflow: hidden; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--paper-soft);
  border-bottom: 1px solid var(--ink-200);
}
.cal-weekday {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-500);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(116px, 1fr);
}
.cal-cell {
  position: relative;
  border-right: 1px solid var(--ink-100, rgba(19,24,38,.08));
  border-bottom: 1px solid var(--ink-100, rgba(19,24,38,.08));
  padding: 6px 6px 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 116px;
}
.cal-cell:nth-child(7n) { border-right: none; }
/* Weekend columns (Sun = 7n-6, Sat = 7n) get a faint warm tint so the week
   has rhythm. Declared before is-other-month / is-today so those still win. */
.cal-cell:nth-child(7n-6), .cal-cell:nth-child(7n) { background: var(--paper-soft); }
.cal-cell.is-other-month { background: rgba(19,24,38,.025); }
.cal-cell.is-other-month .cal-day-num { color: var(--ink-300); }
/* Today reads warm amber — the same "happening now" language as the
   Dashboard's upcoming list, so today looks like today everywhere. */
.cal-cell.is-today {
  background: hsl(45 80% 95%);
  box-shadow: inset 0 0 0 2px hsl(45 75% 64%);
}
.cal-cell.is-today .cal-day-num {
  background: hsl(38 60% 30%);
  color: hsl(45 80% 94%);
}

.cal-cell-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 22px;
}
.cal-day-num {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-700, var(--ink-500));
}

.cal-add {
  width: 20px; height: 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-400, var(--ink-500));
  display: inline-grid; place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s var(--ease-out), background .15s var(--ease-out), color .15s var(--ease-out);
}
.cal-cell:hover .cal-add,
.cal-cell:focus-within .cal-add { opacity: 1; }
.cal-add:hover { background: var(--brand-700, hsl(163 38% 30%)); color: #fff; }

.cal-chips {
  display: flex; flex-direction: column; gap: 3px;
  overflow: hidden;
}
.cal-chip {
  display: inline-flex; align-items: center; gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  color: var(--ink-900);
  line-height: 1.25;
  transition: background .15s var(--ease-out);
}
.cal-chip:hover { background: rgba(19,24,38,.06); }
.cal-chip-icon {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}
.cal-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-chip-event {
  background: hsl(205 60% 96%);
  color: hsl(205 60% 30%);
}
.cal-chip-event:hover { background: hsl(205 60% 90%); }
.cal-chip-birthday {
  background: hsl(145 55% 94%);
  color: hsl(145 45% 28%);
}
.cal-chip-birthday:hover { background: hsl(145 55% 88%); }
.cal-chip-reminder {
  background: hsl(35 80% 95%);
  color: hsl(35 60% 32%);
  border-left: 3px solid hsl(35 80% 50%);
}
.cal-chip-reminder:hover { background: hsl(35 80% 90%); }

/* ===== Weekly time-grid view + Month/Week toggle (v4.72) ===== */
.cal-week { border: 1px solid var(--ink-200); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal-wk-head, .cal-wk-allday { display: grid; grid-template-columns: 56px repeat(7, 1fr); }
.cal-wk-head { border-bottom: 1px solid var(--ink-200); }
.cal-wk-daycol { text-align: center; padding: 6px 0; border-left: 1px solid var(--ink-100); }
.cal-wk-daycol.is-today .cal-wk-daynum { background: var(--brand-500); color:#fff; border-radius:999px; padding:1px 8px; display:inline-block; }
.cal-wk-dayname { font: 600 11px var(--font-sans); letter-spacing:.08em; text-transform:uppercase; color: var(--ink-500); }
.cal-wk-daynum { font: 600 18px var(--font-display); color: var(--ink-900); }
.cal-wk-allday { border-bottom: 1px solid var(--ink-200); min-height: 26px; }
.cal-wk-alllabel { font: 600 10px var(--font-sans); color: var(--ink-400); align-self:center; text-align:right; padding-right:6px; text-transform:uppercase; }
.cal-wk-allcell { border-left: 1px solid var(--ink-100); padding: 2px; display:flex; flex-direction:column; gap:2px; }
.cal-wk-allchip { font: 600 11px var(--font-sans); color:#fff; border-radius: var(--radius-xs); padding: 1px 6px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.cal-wk-scroll { max-height: calc(100vh - 320px); overflow-y: auto; }
.cal-wk-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); position: relative; }
.cal-wk-axis { border-right: 1px solid var(--ink-100); }
.cal-wk-hour { height: var(--hour-px); position: relative; }
.cal-wk-hour span { position:absolute; top:-7px; right:6px; font: 500 10px var(--font-sans); color: var(--ink-400); }
.cal-wk-col { position: relative; border-left: 1px solid var(--ink-100);
  background-image: repeating-linear-gradient(to bottom, transparent, transparent calc(var(--hour-px) - 1px), var(--ink-100) var(--hour-px)); }
.cal-wk-event { position:absolute; overflow:hidden; text-align:left; cursor:pointer;
  border:none; border-radius: var(--radius-xs); padding: 2px 5px; color:#fff;
  box-shadow: var(--shadow-soft); display:flex; flex-direction:column; gap:1px; }
.cal-wk-ev-time { font: 600 9px var(--font-sans); opacity:.9; }
.cal-wk-ev-title { font: 600 11px var(--font-sans); line-height:1.1; overflow:hidden; }
.cal-wk-work     { background: var(--brand-500); }
.cal-wk-personal { background: var(--accent-500); }
.cal-wk-family   { background: var(--ink-700); }
.cal-wk-now { position:absolute; left:0; right:0; height:2px; background: var(--danger); z-index:5; }
.cal-wk-now::before { content:''; position:absolute; left:-4px; top:-3px; width:8px; height:8px; border-radius:50%; background: var(--danger); }
.cal-viewtoggle { display:inline-flex; border:1px solid var(--ink-200); border-radius:999px; overflow:hidden; }
.cal-viewbtn { border:none; background: var(--paper-soft); color: var(--ink-600); font: 600 13px var(--font-sans); padding: 6px 14px; cursor:pointer; }
.cal-viewbtn.is-active { background: var(--brand-900); color: var(--paper-soft); }

/* Admin table: inline email + copy button */
.admin-email-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.admin-email-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.admin-email-copy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--ink-200);
  background: #fff;
  border-radius: 6px;
  color: var(--ink-600);
  cursor: pointer;
}
.admin-email-copy:hover { background: var(--paper-soft); color: var(--ink-800); }
.th-sort {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 0; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
}
.th-sort:hover { color: var(--brand-700); }
.th-sort-arrow { font-size: 11px; opacity: .55; }
.admin-login-flag {
  display: inline-flex; align-items: center; gap: 6px;
}
.admin-login-flag input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: hsl(145 55% 42%);
  cursor: not-allowed;
}

/* ===== Page emoji slot (admin-editable, click to open emoji picker) ===== */
.page-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  margin-right: 8px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: default;
  vertical-align: middle;
  background: transparent;
  transition: background 120ms ease, border-color 120ms ease;
  border: 1px dashed transparent;
}
body.is-admin .page-emoji {
  cursor: pointer;
}
body.is-admin .page-emoji:hover {
  background: var(--paper-soft);
  border-color: var(--ink-200);
}
body.is-admin .page-emoji.is-empty::before {
  content: '＋';
  font-size: 14px;
  color: var(--ink-400);
  font-weight: 400;
}
body:not(.is-admin) .page-emoji.is-empty { display: none; }

/* Inline emoji slot (used in the Family Tree toolbar where there's no H2). */
.page-emoji-inline {
  height: 36px;
  margin-right: 4px;
  font-size: 20px;
}
body:not(.is-admin) .page-emoji-inline { display: none; }

.nav-emoji {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  line-height: 1;
}

/* Reminder modal — generic checkbox row used for flags like
   "Hide from Dashboard". The small line below shows the rationale. */
.field-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 0;
}
.field-check input[type="checkbox"] {
  grid-row: 1 / 3;
  margin: 4px 0 0;
  width: 16px; height: 16px;
  /* Restore the native checkmark — .field input { appearance: none } strips
     it on checkboxes when this picker lives inside a .field wrapper
     (e.g. the "Deceased" toggle). */
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--brand-700, hsl(163 38% 30%));
}
.field-check > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  line-height: 1.3;
}
.field-check > small {
  font-size: 11.5px;
  color: var(--ink-500);
  line-height: 1.4;
}

/* ===== Reminder modal — custom recurrence panel =====
   Shown only when "Custom…" is picked in the Repeats dropdown. Mirrors the
   compact Google Calendar layout: "Repeat every [N] [unit]" inline, with a
   row of weekday chips that appears only when the unit is "week". */
.reminder-custom {
  margin-top: -2px;
  padding: 12px 14px;
  background: var(--paper-soft);
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
.reminder-custom-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.reminder-custom-row input[type="number"] {
  width: 72px; padding: 8px 10px;
  border: 1px solid var(--ink-200); border-radius: 8px;
  font: inherit; background: #fff;
}
.reminder-custom-row select {
  padding: 8px 10px;
  border: 1px solid var(--ink-200); border-radius: 8px;
  background: #fff; font: inherit;
}
.reminder-custom-days {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.dow-row { display: flex; gap: 6px; }
.dow-chip { cursor: pointer; }
.dow-chip input { position: absolute; opacity: 0; pointer-events: none; }
.dow-chip span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 1px solid var(--ink-200);
  font-size: 12px; font-weight: 600; color: var(--ink-700);
  user-select: none;
  transition: background .15s, color .15s, border-color .15s;
}
.dow-chip:hover span { border-color: var(--brand-300); }
.dow-chip input:checked + span {
  background: var(--brand-700); border-color: var(--brand-700); color: #f7f3ec;
}

/* ===== History view ===== */
.history-toolbar { display: flex; align-items: center; gap: 8px; }
.history-current-version {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-700);
  color: #f7f3ec;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 920px;
  margin-top: 12px;
}
.history-entry {
  position: relative;
  padding: 18px 20px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-soft);
}
.history-entry-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.history-version {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: var(--paper-soft);
  color: var(--brand-800);
  border: 1px solid var(--ink-200);
}
.history-date {
  font-size: 12px;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
}
.history-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}
.history-changes {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-700);
  font-size: 14px;
}
.history-changes li { margin-bottom: 3px; line-height: 1.5; }

.emoji-clear {
  display: block; width: calc(100% - 24px); margin: 8px 12px;
  padding: 8px 12px;
  border: 1px solid var(--ink-200); background: #fff;
  border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--ink-600);
}
.emoji-clear:hover { background: hsl(0 65% 96%); color: hsl(0 65% 38%); border-color: hsl(0 65% 80%); }

/* ===== Trip event styles ===== */
.trip-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: hsl(195 60% 92%);
  color: hsl(195 55% 30%);
  font-weight: 600;
  vertical-align: middle;
}
.trip-fieldset {
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 14px 16px 18px;
  margin: 8px 0;
}
.trip-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-600);
  font-weight: 600;
}
.trip-itinerary { margin-top: 10px; }
.trip-itinerary-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.trip-itinerary-head h4 { margin: 0; font-size: 13px; }
.trip-itinerary-rows { display: flex; flex-direction: column; gap: 8px; }
.trip-itin-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr auto;
  gap: 8px;
}
.trip-itin-row .itin-del {
  width: 32px; padding: 0;
  border: 1px solid var(--ink-200);
  background: #fff;
}

.trip-panel {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin: 12px 0;
}
.trip-panel h4 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-600);
  font-weight: 600;
}
.trip-panel .table.table-compact { font-size: 13px; }
.trip-panel .table .num { text-align: right; font-variant-numeric: tabular-nums; }
.itin-cell-date { white-space: nowrap; color: var(--ink-700); }

@media (max-width: 768px) {
  .trip-panel { grid-template-columns: 1fr; }
  .trip-itin-row { grid-template-columns: 1fr; }
}

/* ===== Dashboard view (v4.68 elevated refresh) =====
   The hero becomes an atmospheric forest-green panel — layered radial
   gradients + grain pressed into the brand palette — while the working
   panels below stay clean cream/white. Same DOM, same layout bones. */
.view-dashboard { padding-top: 24px; }
.dash-hero {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 30px 36px 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
  color: var(--paper);
  background:
    radial-gradient(110% 160% at 6% 115%, rgba(230, 184, 142, 0.20), transparent 50%),
    radial-gradient(95% 150% at 97% -25%, rgba(127, 165, 151, 0.28), transparent 56%),
    linear-gradient(158deg, #2a5a4a 0%, var(--brand-800) 52%, #16302a 100%);
  border: 1px solid rgba(23, 48, 40, 0.85);
  box-shadow: var(--shadow-lift), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  margin-bottom: 26px;
}
/* Grain layer — same feTurbulence texture the login screen uses, blended
   soft so the gradients read as atmosphere instead of vector fills. */
.dash-hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  opacity: .22;
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: -1;
}
.dash-hero-text { flex: 1; }
.dash-eyebrow {
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-300); margin: 0 0 10px; font-weight: 600;
}
#dash-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--paper);
}
.dash-hero h2 { margin: 0; }
.dash-clock { text-align: right; }
.dash-time {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--paper);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}
.dash-date { color: rgba(247, 243, 236, 0.72); font-size: 13px; margin-top: 6px; }
/* 5-day forecast row beneath the clock — translucent glass chips sitting
   on the dark hero. Today's chip is brightened so the eye lands there. */
.dash-forecast {
  display: flex; gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  font-size: 12px;
  color: var(--paper);
}
.dash-forecast-loading { padding: 4px 0; color: rgba(247, 243, 236, 0.6); }
.dash-forecast-day {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  min-width: 54px;
  padding: 8px 9px 7px;
  border-radius: var(--radius-sm);
  background: rgba(247, 243, 236, 0.08);
  border: 1px solid rgba(247, 243, 236, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.dash-forecast-day:first-child {
  background: rgba(247, 243, 236, 0.16);
  border-color: rgba(247, 243, 236, 0.26);
}
.dash-forecast-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  color: rgba(247, 243, 236, 0.62);
  text-transform: uppercase;
}
.dash-forecast-icon { font-size: 20px; line-height: 1.15; }
.dash-forecast-temps {
  display: flex; align-items: baseline; gap: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.dash-forecast-hi { font-weight: 600; color: var(--paper); }
.dash-forecast-sep { color: rgba(247, 243, 236, 0.35); }
.dash-forecast-lo { color: rgba(247, 243, 236, 0.6); }

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  gap: 18px;
}
.dash-upcoming { grid-column: 1; grid-row: 1 / span 2; }
.dash-gifts    { grid-column: 2; grid-row: 1; }
.dash-grocery  { grid-column: 2; grid-row: 2; }

.dash-panel { padding: 20px 24px 22px; border-radius: var(--radius-lg); }
.dash-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 14px;
}
.dash-panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  white-space: nowrap;
}
/* The small "meta" span next to each panel title reads as a quiet caption. */
.dash-panel-head .muted.small {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-400); font-weight: 500;
}

/* Upcoming rows: date-leaf tile + hairline separators instead of a wall of
   boxed borders. Hover lifts the row onto a tonal wash; today gets a warm
   amber leaf so "happening now" still pops without shouting. */
.dash-upcoming-list { display: flex; flex-direction: column; }
.dash-up-row {
  display: grid;
  grid-template-columns: 46px 26px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
  transition: transform 160ms var(--ease-out);
}
.dash-up-row + .dash-up-row::before {
  content: '';
  position: absolute; top: 0; left: 70px; right: 10px;
  border-top: 1px solid var(--hairline);
}
.dash-up-row:hover { background: var(--tint-50); }
.dash-up-row:hover::before,
.dash-up-row:hover + .dash-up-row::before { border-top-color: transparent; }
.dash-up-row:active { transform: scale(0.995); }
.dash-up-row:focus-visible { outline: 2px solid var(--accent-500); outline-offset: -2px; }
.dash-up-date {
  text-align: center;
  color: var(--ink-800);
  background: var(--paper-veil);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  padding: 5px 2px 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.dash-up-day {
  display: block;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dash-up-mon { display: block; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-500); margin-top: 3px; font-weight: 600; }
/* Today's items pop with a warm amber leaf + wash. */
.dash-up-row.is-today { background: hsl(45 80% 95%); }
.dash-up-row.is-today .dash-up-date {
  background: hsl(46 90% 88%);
  border-color: hsl(45 75% 72%);
  color: hsl(38 65% 26%);
}
.dash-up-row.is-today .dash-up-mon { color: hsl(38 55% 38%); }
.dash-up-row.is-today:hover { background: hsl(46 85% 92%); }
.dash-up-row.is-today::before,
.dash-up-row.is-today + .dash-up-row::before { border-top-color: transparent; }
.dash-up-icon { font-size: 19px; text-align: center; }
.dash-up-main { min-width: 0; }
.dash-up-title { font-weight: 500; color: var(--ink-900); }
.dash-up-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.dash-up-kind {
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.dash-up-kind-birthday    { background: hsl(145 55% 94%); color: hsl(145 45% 28%); }
.dash-up-kind-anniversary { background: hsl(282 50% 94%); color: hsl(282 38% 38%); }
.dash-up-kind-event       { background: hsl(205 60% 94%); color: hsl(205 60% 30%); }
.dash-up-kind-reminder    { background: hsl(35 80% 94%);  color: hsl(35 60% 32%); }
.dash-up-kind-holiday     { background: hsl(0 65% 94%);   color: hsl(0 55% 38%); }

.dash-filter-chips {
  display: flex; gap: 5px; flex-wrap: wrap;
  margin-top: 6px;
}
.dash-filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--paper-soft);
  color: var(--ink-500);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), opacity 140ms var(--ease-out);
}
/* Colored dot marker replaces the old left-border stripe — quieter idle
   state, same color story as the calendar legend. */
.dash-filter-chip::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-300);
}
.dash-filter-chip[data-kind="all"]::before { display: none; }
.dash-filter-chip:hover { transform: translateY(-1px); }
.dash-filter-chip:active { transform: translateY(0); }
.dash-filter-chip.is-active[data-kind]::before { background: rgba(255, 255, 255, 0.75); }
/* Active state: match the Calendar legend hues so the chip color and the
   list row chip color tell the same story. Each kind picks its own palette. */
.dash-filter-chip[data-kind="all"].is-active {
  background: var(--brand-800); color: #f7f3ec; border-color: var(--brand-800);
}
.dash-filter-chip[data-kind="event"].is-active {
  background: hsl(205 60% 48%); color: #fff; border-color: hsl(205 60% 48%);
}
.dash-filter-chip[data-kind="birthday"].is-active {
  background: hsl(145 55% 42%); color: #fff; border-color: hsl(145 55% 42%);
}
.dash-filter-chip[data-kind="anniversary"].is-active {
  background: hsl(282 50% 52%); color: #fff; border-color: hsl(282 50% 52%);
}
.dash-filter-chip[data-kind="holiday"].is-active {
  background: hsl(0 65% 52%); color: #fff; border-color: hsl(0 65% 52%);
}
.dash-filter-chip[data-kind="reminder"].is-active {
  background: hsl(35 80% 50%); color: #fff; border-color: hsl(35 80% 50%);
}
/* Idle chips carry their kind color as the dot marker, so the filter row
   reads as one visual system without the old border stripes. */
.dash-filter-chip[data-kind="event"]::before       { background: hsl(205 60% 48%); }
.dash-filter-chip[data-kind="birthday"]::before    { background: hsl(145 55% 42%); }
.dash-filter-chip[data-kind="anniversary"]::before { background: hsl(282 50% 52%); }
.dash-filter-chip[data-kind="holiday"]::before     { background: hsl(0 65% 52%); }
.dash-filter-chip[data-kind="reminder"]::before    { background: hsl(35 80% 50%); }

.dash-month-totals { grid-column: 2; grid-row: 2; }
.dash-grocery     { grid-column: 2; grid-row: 3; }
.dash-grid {
  grid-template-rows: auto auto auto;
}
.dash-upcoming { grid-row: 1 / span 3; }
.dash-gifts    { grid-row: 1; }
.dash-money-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.dash-money-cell {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 15px 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--paper-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.dash-money-cell.received { background: hsl(150 42% 95%); border-color: hsl(150 28% 84%); }
.dash-money-cell.given    { background: hsl(33 68% 95%);  border-color: hsl(33 45% 84%); }
.dash-money-cell.net      { background: var(--tint-50); border-color: var(--tint-200); }
.dash-money-label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-500); font-weight: 600;
}
.dash-money-cell.received .dash-money-label { color: hsl(150 35% 34%); }
.dash-money-cell.given    .dash-money-label { color: hsl(33 55% 36%); }
.dash-money-cell.net      .dash-money-label { color: var(--brand-600); }
.dash-money-amount {
  font-family: var(--font-display);
  font-size: 23px; font-weight: 500; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin-top: 5px;
  color: var(--ink-900);
}
.dash-money-cell.net .dash-money-amount { color: var(--brand-700); }

@media (max-width: 960px) {
  .dash-month-totals, .dash-grocery, .dash-gifts {
    grid-column: 1; grid-row: auto;
  }
}

.dash-gifts-list { display: flex; flex-direction: column; gap: 8px; }
.dash-gift-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--paper-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.dash-gift-title { font-size: 14px; color: var(--ink-900); font-weight: 500; }
.dash-gift-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.dash-gift-flags { display: flex; flex-direction: column; gap: 4px; }
.dash-gift-flag {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-700);
  cursor: pointer;
}
.dash-gift-flag input { accent-color: var(--brand-600); }

.dash-grocery-add {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.dash-grocery-add input {
  flex: 1;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: var(--paper-soft);
  font-size: 14px;
  color: var(--ink-900);
}
.dash-grocery-add input::placeholder { color: var(--ink-400); }
.dash-grocery-add input:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--ring-brand);
  background: #fff;
}
.dash-grocery-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  max-height: 360px; overflow-y: auto;
}
.dash-grocery-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 6px;
  border-bottom: 1px solid var(--hairline);
}
.dash-grocery-item:last-child { border-bottom: none; }
.dash-grocery-item.is-done .dash-grocery-check span {
  text-decoration: line-through;
  color: var(--ink-400);
}
.dash-grocery-item.is-done { opacity: .72; }
.dash-grocery-check { display: flex; align-items: center; gap: 9px; flex: 1; cursor: pointer; font-size: 14px; }
.dash-grocery-check input { accent-color: var(--brand-600); width: 15px; height: 15px; }
.dash-grocery-del {
  width: 24px; height: 24px;
  padding: 0; border: none; background: transparent;
  color: var(--ink-300);
  font-size: 18px; line-height: 1; cursor: pointer;
  border-radius: var(--radius-xs);
  transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.dash-grocery-del:hover { background: hsl(0 65% 96%); color: hsl(0 65% 45%); }
.dash-grocery-del:active { transform: scale(.92); }
.dash-grocery-del:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 1px; }

@media (max-width: 960px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-upcoming, .dash-gifts, .dash-grocery { grid-column: 1; grid-row: auto; }
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .dash-clock { text-align: left; }
  .dash-forecast { justify-content: flex-start; flex-wrap: wrap; }
}
.cal-chip-holiday {
  background: hsl(0 65% 96%);
  color: hsl(0 55% 38%);
  cursor: default;
}
.cal-chip-holiday:hover { background: hsl(0 65% 96%); }
.cal-chip-anniv {
  background: hsl(282 50% 96%);
  color: hsl(282 38% 38%);
}
.cal-chip-anniv:hover { background: hsl(282 50% 92%); }

/* Google Calendar event chip (read-only sync) */
.cal-chip-google {
  background: rgba(66, 133, 244, .10);
  color: hsl(215 55% 30%);
  border-left: 3px solid var(--gcal-color, #4285f4);
}
.cal-chip-google:hover { background: rgba(66, 133, 244, .18); }
.cal-chip-gicon { display: inline-flex; align-items: center; }

/* Toolbar Google button connected-indicator dot */
#cal-google-btn { position: relative; }
.cal-google-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #34A853;
  display: inline-block;
  margin-left: 2px;
}

/* Google Calendar modal */
.gcal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  padding: 4px 0 8px;
}
.gcal-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.gcal-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-300);
  display: inline-block;
}
.gcal-status-dot.is-on { background: #34A853; box-shadow: 0 0 0 3px rgba(52, 168, 83, .15); }

.gcal-setup {
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0 4px;
}
.gcal-setup summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700, var(--ink-900));
}
.gcal-steps {
  margin: 10px 0 4px;
  padding-left: 22px;
  font-size: 13px;
  color: var(--ink-700, var(--ink-500));
  line-height: 1.55;
}
.gcal-steps code {
  font-size: 12px;
  background: rgba(19,24,38,.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.gcal-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.gcal-cal-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-900);
}
.gcal-cal-row:hover { background: var(--paper-soft); }
.gcal-cal-row input[type=checkbox] {
  width: 16px; height: 16px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--ink-200);
  appearance: auto;
  accent-color: var(--accent-700);
  flex-shrink: 0;
}
.gcal-cal-swatch {
  width: 10px; height: 10px; border-radius: 3px;
  flex-shrink: 0;
}
.gcal-cal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Higher specificity than ".field select" (styles.css ~228) so the compact
   inline select isn't stretched to width:100% / stripped of its arrow. */
.gcal-cal-row .gcal-cat {
  appearance: auto;
  width: auto;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  color: var(--ink-800);
}

@media (max-width: 900px) {
  .cal-grid { grid-auto-rows: minmax(80px, 1fr); }
  .cal-chip-text { display: none; }
  .cal-chip {
    width: auto;
    padding: 2px 5px;
  }
}

/* ============================================================
   Utility
   ============================================================ */
[data-admin-only] { display: none !important; }
body.is-admin .btn[data-admin-only],
body.is-admin .nav-tab[data-admin-only],
body.is-admin button[data-admin-only] { display: inline-flex !important; }
body.is-admin label[data-admin-only] { display: flex !important; }
body.is-admin .grid-2[data-admin-only] { display: grid !important; }
body.is-admin section[data-admin-only],
body.is-admin div[data-admin-only] { display: block !important; }
/* v4.26: `is-admin` also satisfies `data-admin-only span`-style fallthroughs.
   Some elements (e.g. legend chips, .cal-legend-item span wrappers) flow as
   inline; allow them to render too. */
body.is-admin span[data-admin-only] { display: inline-flex !important; }

/* v4.26 — "Family" role. A read-only-ish tier between User and Admin.
   `data-family-allowed` opts an element into being visible to Family in
   addition to Admin. `data-family-hidden` hides an element from Family
   specifically (User still sees it). */
body.is-family .nav-tab[data-family-allowed],
body.is-family .btn[data-family-allowed],
body.is-family button[data-family-allowed] { display: inline-flex !important; }
body.is-family label[data-family-allowed] { display: flex !important; }
body.is-family section[data-family-allowed],
body.is-family div[data-family-allowed] { display: block !important; }
body.is-family [data-family-hidden] { display: none !important; }

/* Read-only calendar chips for Family: event chips render but the cursor
   indicates they aren't actionable. The `:disabled` selector handles the
   underlying state set in CalendarView.render(). */
.cal-chip.is-readonly,
.cal-chip:disabled {
  cursor: default;
  opacity: .92;
}
.cal-chip.is-readonly:hover,
.cal-chip:disabled:hover { transform: none; }

/* Admin (vault) page is even more restricted than is-admin — only the
   household head + spouse + system admin should see it. Toggled via the
   `is-vault-authorized` body class, set by Auth.refreshBodyClasses(). */
[data-vault-only] { display: none !important; }
body.is-vault-authorized .nav-tab[data-vault-only] { display: inline-flex !important; }

/* ===== Admin / vault page ===== */
.vault-tabs {
  display: inline-flex; gap: 4px;
  background: var(--paper-veil);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.vault-tab {
  padding: 7px 16px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-700);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.vault-tab:hover { color: var(--ink-900); }
.vault-tab.is-active {
  background: #fff;
  color: var(--brand-900);
  box-shadow: var(--shadow-soft);
}
.vault-panel { display: flex; flex-direction: column; gap: 14px; }

.vault-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 4px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink-200);
}
.vault-section-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  margin: 0;
  color: var(--ink-900);
}

.vault-card {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft), var(--edge-highlight);
}
.vault-card + .vault-card { margin-top: 14px; }
.vault-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.vault-card-photo {
  width: 56px; height: 56px;
  border-radius: 999px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ink-200);
  display: grid; place-items: center;
}
.vault-card-photo.is-male   { background-color: var(--rose-male-bg); }
.vault-card-photo.is-female { background-color: var(--rose-female-bg); }
.vault-card-id h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin: 0;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}
.vault-card-body { }
.vault-card-edit { display: flex; flex-direction: column; gap: 14px; }

.vault-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  margin: 0;
}
.vault-kv > div { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--ink-100); }
.vault-kv dt { font-size: 11.5px; color: var(--ink-500); margin: 0; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.vault-kv dd { margin: 0; font-size: 14px; color: var(--ink-900); word-break: break-word; font-variant-numeric: tabular-nums; }
.vault-birth { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }

.vault-edit-fieldset {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: var(--paper-soft);
}
.vault-edit-fieldset legend {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-700);
  padding: 0 6px;
}
.vault-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.vault-edit-field { display: flex; flex-direction: column; gap: 4px; }
.vault-edit-label { font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.vault-edit-field input,
.vault-edit-field select,
.vault-edit-field textarea {
  appearance: none;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink-900);
}
.vault-edit-field textarea { resize: vertical; min-height: 60px; }
.vault-edit-field input:focus,
.vault-edit-field select:focus,
.vault-edit-field textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47,107,89,.15);
}
.vault-edit-actions { display: flex; gap: 8px; }

.vault-dl-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.vault-dl-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 8px;
  align-items: center;
}
.vault-dl-row input {
  appearance: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
}
.vault-row-remove {
  padding: 4px 10px !important;
  font-size: 16px !important;
  line-height: 1 !important;
  color: var(--ink-500);
}
.vault-row-remove:hover { color: #dc2626; }

.vault-list { display: flex; flex-direction: column; gap: 10px; }
.vault-row {
  position: relative;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 14px 16px 14px 36px;
  box-shadow: var(--shadow-soft);
  transition: opacity .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
/* Drag handle pinned to the row's left gutter. Six-dot grip icon; hover
   reveals stronger color. The whole row participates in the visual lift
   while a drag is happening so the user sees what they're moving. */
.vault-drag-handle {
  position: absolute;
  left: 6px;
  top: 14px;
  width: 22px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: grab;
  color: var(--ink-300);
  transition: color .12s var(--ease-out), background-color .12s var(--ease-out);
  padding: 0;
}
.vault-drag-handle:hover { color: var(--ink-700); background: var(--paper-veil); }
.vault-drag-handle:active { cursor: grabbing; }
.vault-row.is-dragging { opacity: .55; box-shadow: 0 8px 24px rgba(19,24,38,.15); }
.vault-row.is-dragging .vault-drag-handle { cursor: grabbing; }

/* Emoji <select> in the utility editor. Slightly wider so the emoji-
   plus-label combos don't truncate ("⚡  Electricity"). */
.vault-emoji-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
}

/* Insurance-photo lightbox. Full-viewport dark overlay with the image
   sized to fit. Closed via the × button, clicking the backdrop, or Esc. */
.vault-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 32px;
}
.vault-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19,24,38,.88);
  backdrop-filter: blur(4px);
}
.vault-lightbox-img {
  position: relative;
  max-width: 95vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  background: #fff;
}
.vault-lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color .12s var(--ease-out);
}
.vault-lightbox-close:hover { background: rgba(255,255,255,.22); }
.vault-lightbox[hidden] { display: none; }

/* Make the photo thumbs in the read-side view behave like buttons even
   though they're <button>s under the hood (override default form button
   styling that would otherwise add a border + background). */
.vault-card-photo-large {
  appearance: none;
  border: 1px solid var(--ink-200);
  padding: 0;
  cursor: zoom-in;
}
.vault-row-view {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
}
.vault-row-main { min-width: 0; }
.vault-row-title { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--ink-900); margin-bottom: 4px; }
.vault-row-sub { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: center; }
.vault-row-sub a { color: var(--brand-700); text-decoration: none; }
.vault-row-sub a:hover { text-decoration: underline; }
.vault-row-actions { display: flex; gap: 6px; align-items: center; }
.vault-row-edit { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

.bank-type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-right: 4px;
}
.bank-type-pill.checking { background: rgba(47,107,89,.14); color: var(--brand-900); }
.bank-type-pill.savings  { background: rgba(91,143,199,.18); color: #234a72; }
.bank-type-pill.credit   { background: rgba(220,38,38,.12); color: #7f1d1d; }
.bank-type-pill.other    { background: var(--ink-100); color: var(--ink-700); }

.vault-card-photos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.vault-card-photo-thumb {
  display: block;
  width: 100px; height: 64px;
  border-radius: 6px;
  border: 1px solid var(--ink-200);
  background-size: cover; background-position: center;
  cursor: zoom-in;
  transition: transform .15s var(--ease-out);
}
.vault-card-photo-thumb:hover { transform: scale(1.04); border-color: var(--brand-500); }
/* Larger card photos in the read-side view so the user can actually
   read the policy / group numbers on the card without opening the
   full-size image. Caption tag overlays the bottom edge. */
.vault-card-photo-large {
  display: block;
  position: relative;
  width: min(360px, 100%);
  aspect-ratio: 1.586 / 1;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background-size: cover; background-position: center;
  background-color: #fff;
  cursor: zoom-in;
  transition: transform .15s var(--ease-out), border-color .15s var(--ease-out);
  box-shadow: var(--shadow-soft);
}
.vault-card-photo-large:hover { transform: scale(1.02); border-color: var(--brand-500); }
.vault-card-photo-caption {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(19,24,38,.7);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Compact two-column key/value grid used in Benefits + Utility cards.
   Each `<div>` is one fact (icon + label + value). */
.vault-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 4px 16px;
}
.vault-info-grid > div { padding: 1px 0; }
.vault-info-grid strong { color: var(--ink-700); font-weight: 600; }

.vault-row-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand-700);
  margin-bottom: 2px;
}

/* Multi-holder checkbox grid in the bank-account editor. */
.vault-holder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 12px;
}
.vault-holder-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 13.5px;
  cursor: pointer;
}
.vault-holder-check input[type="checkbox"] {
  width: 16px; height: 16px;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--brand-700);
  margin: 0;
}

/* Balance history block (Finance view + edit). */
.vault-balance-summary { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--ink-200); }
.vault-balance-latest { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.vault-balance-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); }
.vault-balance-value { font-family: var(--font-display); font-size: 17px; color: #16a34a; font-variant-numeric: tabular-nums; }
.vault-balance-log { margin-top: 6px; }
.vault-balance-log summary { cursor: pointer; }
.vault-balance-table { width: 100%; margin-top: 8px; border-collapse: collapse; }
.vault-balance-table th, .vault-balance-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--ink-100); font-size: 13px; }
.vault-balance-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); font-weight: 600; background: var(--paper-soft); }

.vault-balance-edit-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.vault-balance-edit-row {
  display: grid;
  grid-template-columns: 140px 140px 1fr auto;
  gap: 8px;
  align-items: center;
}
.vault-balance-edit-row input {
  appearance: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
}
.vault-balance-add-row {
  display: grid;
  grid-template-columns: 140px 140px 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--ink-200);
}
.vault-balance-add-row input {
  appearance: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
}

/* Weight / length structured-input row */
.vault-unit-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.vault-unit-row input {
  flex: 1 1 0;
  min-width: 0;
}
.vault-unit-suffix {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
}

.vault-photo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.vault-photo-slot {
  background: var(--paper-soft);
  border: 1px dashed var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vault-photo-label { font-size: 12px; font-weight: 600; color: var(--ink-700); }
.vault-photo-preview {
  width: 100%;
  aspect-ratio: 1.586 / 1; /* standard credit-card ratio */
  border-radius: 6px;
  background: #fff;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--ink-200);
}
.vault-photo-actions { display: flex; gap: 6px; }

/* ---------- v4.25 ---------- */

/* Bank-account "details" block in the Finance read view. Replaces the old
   cramped single-line "muted small" sub-row. Each row is a labelled fact
   on its own line so a glance lands cleanly on Account #, Routing #, and
   Account holder(s) — and the value font is bumped ~1.5x so this isn't
   squinting territory. The dl wrapper inherits the .vault-row's left
   padding, so we don't need any extra layout. */
.vault-bank-details {
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 4px;
  border-top: 1px dashed var(--ink-200);
}
.vault-bank-details > div { display: flex; flex-direction: column; gap: 2px; }
.vault-bank-details dt {
  margin: 0;
  font-size: 13px;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.vault-bank-details dd {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  font-weight: 500;
}
.vault-bank-title {
  font-size: 18px;
  margin-bottom: 6px;
}
.vault-bank-type { margin-bottom: 2px; }
.vault-bank-notes {
  margin-top: 10px;
  font-size: 14px;
  font-style: italic;
  white-space: pre-line;
}

/* ---------- Neighbors ---------- */

.vault-row-neighbor .vault-row-view {
  /* Two-column view header: photo + main content on the left, actions on the
     right. The neighbor-specific inner wrapper handles the photo/main split. */
}
.vault-neighbor-view {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: start;
}
.vault-neighbor-photo {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  background-color: var(--paper-soft);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--ink-200);
  box-shadow: var(--shadow-soft);
  cursor: zoom-in;
  display: grid;
  place-items: center;
  font-size: 38px;
  color: var(--ink-300);
  padding: 0;
  appearance: none;
  transition: transform .15s var(--ease-out), border-color .15s var(--ease-out);
}
.vault-neighbor-photo:hover { transform: scale(1.02); border-color: var(--brand-500); }
.vault-neighbor-photo.is-empty { cursor: default; }
.vault-neighbor-photo.is-empty:hover { transform: none; border-color: var(--ink-200); }

/* The neighbor photo slot in edit mode is a square (not credit-card ratio).
   Force the aspect-ratio override after the base .vault-photo-preview rule. */
.vault-photo-preview-neighbor {
  aspect-ratio: 1 / 1;
  max-width: 240px;
}

@media (max-width: 560px) {
  .vault-neighbor-view {
    grid-template-columns: 72px 1fr;
    gap: 10px;
  }
  .vault-neighbor-photo {
    width: 72px;
    height: 72px;
    font-size: 28px;
  }
  .vault-bank-details dd { font-size: 17px; }
}

/* ============================================================
   v4.33 — Storage diagnostic panel (History page, admin only)
   ============================================================ */
.storage-panel { margin-bottom: 24px; }
.storage-panel .panel-body { padding: 14px 18px 18px; }
.storage-headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin: 4px 0 14px;
}
.storage-headline > div {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px;
  background: var(--paper-soft);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
}
.storage-headline strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.storage-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  margin: 18px 0 6px;
}
.storage-table table.storage-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.storage-table th,
.storage-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: middle;
}
.storage-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  background: var(--paper-soft);
}
.storage-table td:nth-child(2),
.storage-table td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}
.storage-table code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  background: var(--paper-soft);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ============================================================
   v4.37  RESPONSIVE / MOBILE
   Scope: Dashboard, Events, Members (Family + Friends + All),
          Admin (Vault), plus shared chrome (topbar nav, page-head,
          tables, modals). Other pages still inherit the desktop
          layout — they're not on the prioritized list.

   Single breakpoint at 760px (typical phone-portrait + small
   tablet) plus a tighter pass at 480px. Multiple narrow break-
   points get hard to maintain on a vanilla CSS file this big;
   one mobile breakpoint that "just works" is enough for the
   target devices.
   ============================================================ */
@media (max-width: 760px) {
  /* --- Top chrome --------------------------------------------------- */
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar-left, .topbar-right { gap: 8px; }
  .topbar-left { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
  .nav {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    /* Hide the scrollbar so the nav strip looks like a chip strip,
       not a scrolling list. Users still get touch-swipe. */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-tab { flex: 0 0 auto; white-space: nowrap; }
  .user-chip { padding: 4px 8px; }
  .user-chip-text { display: none; }    /* keep avatar only on small screens */

  /* --- Page chrome (container, page-head) -------------------------- */
  .container { padding: 16px 12px 48px; }
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-head h2 { font-size: 26px; line-height: 1.14; }
  .page-head-actions { width: 100%; flex-wrap: wrap; }
  .page-head-actions .btn { flex: 1 1 auto; min-width: 0; }

  /* --- Tables: scroll horizontally inside their wrapper ------------ */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { font-size: 13px; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }

  /* --- Members page sub-tabs --------------------------------------- */
  .member-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding: 4px;
  }
  .member-tabs::-webkit-scrollbar { display: none; }
  .member-tab { flex: 0 0 auto; white-space: nowrap; }
  /* Family tab inner grid: 1 column on phones so the Groups panel
     stacks above the members table instead of squeezing beside it. */
  .admin-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head-tools {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .panel-head-tools .input { flex: 1 1 100%; min-width: 0; }

  /* --- Dashboard --------------------------------------------------- */
  .dash-hero {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .dash-clock { width: 100%; text-align: left; }
  .dash-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .dash-money-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .dash-money-amount { font-size: 18px; }
  .dash-filter-chips { flex-wrap: wrap; }

  /* --- Events page ------------------------------------------------- */
  .event-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .event-list { max-height: none; }
  .event-stats { gap: 10px; flex-wrap: wrap; }
  .event-stat-num { font-size: 22px; }
  .attendance-add {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .attendance-add .input { max-width: 100% !important; }
  .attendance-actions { flex-wrap: wrap; gap: 6px; }

  /* --- Admin / Vault page ------------------------------------------ */
  .vault-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .vault-tabs::-webkit-scrollbar { display: none; }
  .vault-tab { flex: 0 0 auto; white-space: nowrap; }
  .vault-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .vault-row-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .vault-edit-grid { grid-template-columns: 1fr; }
  .vault-info-grid { grid-template-columns: 1fr; }

  /* --- Modals ------------------------------------------------------- */
  .modal-panel {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 24px);
    margin: 12px 8px;
    border-radius: 12px;
  }
  .modal-body { padding: 14px 14px 18px; }
  .modal-head { padding: 12px 14px; }
  .grid-2, .grid-3, .grid-zip { grid-template-columns: 1fr !important; }
  .modal-actions { flex-wrap: wrap; gap: 8px; }
  .modal-actions .btn { flex: 1 1 auto; }

  /* --- Drawer (member edit slide-out) ------------------------------ */
  .drawer { width: 100vw !important; max-width: 100vw; }

  /* --- Friend list rows: smaller avatars, allow address to wrap ---- */
  .row-name { gap: 8px; }
  .row-avatar { width: 28px; height: 28px; }
  .admin-email-cell code { max-width: 140px; }
  .row-name-line { gap: 4px; }
  .row-name-text { word-break: break-word; }
}

/* --- Extra-narrow phone pass (iPhone SE et al.) ------------------- */
@media (max-width: 480px) {
  .topbar { padding: 8px 10px; }
  .brand-name { display: none; }
  .nav-tab { font-size: 13px; padding: 6px 10px; }
  .page-head h2 { font-size: 22px; }
  .container { padding: 12px 8px 40px; }
  .panel { border-radius: 12px; }
  .panel-head, .modal-head { padding: 10px 12px; }
  .vault-edit-actions .btn,
  .modal-actions .btn { padding: 10px 12px; }
}

/* ============================================================
   v4.40  MY KIDS PAGE
   Per-kid growing-up archive. Roster card grid → per-kid detail
   with four section tabs (Milestones / School / Art / Letters).
   ============================================================ */

/* Roster card grid */
.mykids-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 18px;
}
.mykids-roster-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 18px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--ink-200);
  cursor: pointer;
  text-align: center;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), border-color .15s var(--ease-out);
}
.mykids-roster-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 107, 89, 0.35);
  box-shadow: 0 8px 24px -12px rgba(19, 24, 38, 0.18);
}
.mykids-roster-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.mykids-roster-avatar svg { width: 70%; height: 70%; }
.mykids-roster-name { font-weight: 600; }
.mykids-roster-stat {
  font-size: 12px;
  color: var(--ink-500);
  background: var(--paper-soft, #f1ece1);
  padding: 2px 10px;
  border-radius: 10px;
  margin-top: 2px;
}

/* Kid detail header */
.mykids-kid-head {
  align-items: center;
  gap: 16px;
}
.mykids-kid-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mykids-kid-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.mykids-kid-avatar svg { width: 70%; height: 70%; }
.mykids-kid-head h3 { margin: 0; }
.mykids-kid-head p  { margin: 2px 0 0; }

/* Four-section tab strip (mirrors vault-tabs pattern) */
.mykids-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  margin: 0 18px;
  background: var(--paper-soft, #f1ece1);
  border-radius: 10px;
}
.mykids-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  transition: background-color .12s var(--ease-out), color .12s var(--ease-out);
}
.mykids-tab:hover { color: var(--ink-900); }
.mykids-tab.is-active {
  background: #fff;
  color: var(--brand-900);
  box-shadow: var(--shadow-soft);
}
.mykids-tab-actions {
  display: flex; justify-content: flex-end;
  padding: 10px 18px 0;
}

/* Entry list */
.mykids-entries {
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 14px 18px 22px;
}
.mykids-entry {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  padding: 16px 18px;
}
.mykids-entry-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.mykids-entry-title { margin: 0; font-size: 18px; }
.mykids-entry-meta { margin-top: 2px; }
.mykids-entry-body {
  margin: 8px 0 0;
  color: var(--ink-700);
  line-height: 1.55;
  white-space: pre-wrap;
}
.mykids-entry-photos {
  margin-top: 12px;
  display: grid;
  /* v4.55: bumped from 110px → 220px so the photos read more like a
     scrapbook than a thumb strip. Mobile breakpoint at the bottom of
     this section keeps three-up on narrow screens. */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.mykids-entry-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Photo tiles (used in both view + editor) */
.mykids-photo, .mk-photo-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover; background-position: center;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .12s var(--ease-out);
}
.mykids-photo:hover { transform: scale(1.02); }
.mykids-photo.is-missing {
  background: repeating-linear-gradient(45deg, var(--paper-soft) 0 8px, #fff 8px 16px);
}

/* Photo editor grid (in modal) */
.mykids-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.mk-photo-pending {
  position: relative;
}
.mk-photo-pending.is-failed { outline: 2px solid #ef4444; outline-offset: -2px; }
.mk-photo-img { width: 100%; height: 100%; }
.mk-photo-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(19, 24, 38, 0.78);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}
.mk-photo-badge.is-fail { background: #ef4444; }
.mk-photo-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(19, 24, 38, 0.78);
  color: #fff;
  font-size: 14px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mk-photo-remove:hover { background: #ef4444; }

@media (max-width: 760px) {
  .mykids-roster-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; }
  .mykids-tabs { margin: 0 12px; }
  .mykids-tab-actions { padding: 8px 12px 0; }
  .mykids-entries { padding: 10px 12px 18px; }
  /* On phones we keep two-up so each photo still reads big, but auto-fill
     still expands when there's only one photo. */
  .mykids-entry-photos { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   v4.41  MY KIDS POLISH
   Title emoji button, rich-text Notes editor, link chip, photo
   lightbox prev/next controls.
   ============================================================ */

/* Title input + inline emoji button */
.title-with-emoji {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.title-with-emoji input {
  flex: 1;
  min-width: 0;
}
.title-emoji-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 18px;
  line-height: 1;
}

/* Rich-text editor (Notes) */
.rich-text-editor {
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--paper-soft, #f1ece1);
  border-bottom: 1px solid var(--ink-200);
}
.rt-btn {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-700);
  cursor: pointer;
  transition: background-color .12s ease-out;
  min-width: 28px;
}
.rt-btn:hover { background: #fff; color: var(--brand-900); }
.rt-btn:active { background: rgba(47, 107, 89, 0.12); }
.rt-sep {
  width: 1px;
  height: 18px;
  background: var(--ink-200);
  margin: 0 4px;
}
.rt-surface {
  min-height: 110px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  color: var(--ink-900);
}
.rt-surface:focus {
  background: #fff;
}
.rt-surface[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-500);
  pointer-events: none;
}
.rt-surface ul, .rt-surface ol { margin: 4px 0 4px 22px; padding: 0; }
.rt-surface li { margin: 2px 0; }
.rt-surface a { color: var(--brand-900, #173028); text-decoration: underline; }

/* Rich-text body in entry cards (render side) */
.mykids-entry-body.rich { line-height: 1.55; }
.mykids-entry-body.rich ul, .mykids-entry-body.rich ol { margin: 4px 0 4px 22px; padding: 0; }
.mykids-entry-body.rich li { margin: 2px 0; }
.mykids-entry-body.rich a {
  color: var(--brand-900, #173028);
  text-decoration: underline;
}

/* Link chip on Art / Letters entries */
.mykids-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(47, 107, 89, 0.08);
  border: 1px solid rgba(47, 107, 89, 0.25);
  color: var(--brand-900);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background-color .12s, border-color .12s;
}
.mykids-link-chip:hover {
  background: rgba(47, 107, 89, 0.14);
  border-color: rgba(47, 107, 89, 0.45);
}

/* Lightbox prev/next/counter (shown only when .is-mykids is set on
   the shared #vault-lightbox element). */
#vault-lightbox.is-mykids .mk-lb-prev,
#vault-lightbox.is-mykids .mk-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-900);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background-color .15s ease-out, transform .12s ease-out;
}
#vault-lightbox.is-mykids .mk-lb-prev { left: 18px; }
#vault-lightbox.is-mykids .mk-lb-next { right: 18px; }
#vault-lightbox.is-mykids .mk-lb-prev:hover,
#vault-lightbox.is-mykids .mk-lb-next:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.05);
}
#vault-lightbox.is-mykids .mk-lb-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 99px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
#vault-lightbox.is-mykids [hidden] { display: none !important; }

@media (max-width: 760px) {
  #vault-lightbox.is-mykids .mk-lb-prev { left: 8px; }
  #vault-lightbox.is-mykids .mk-lb-next { right: 8px; }
  .rt-btn { padding: 4px 8px; }
}

/* ============================================================
   v4.42  MY KIDS — PICKER MODAL
   "Manage kids" picker: scrollable list of members with checkboxes.
   ============================================================ */
.mykids-picker-list {
  margin-top: 10px;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  background: #fff;
}
.mykids-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink-200);
  cursor: pointer;
  transition: background-color .12s ease-out;
}
.mykids-picker-row:last-child { border-bottom: 0; }
.mykids-picker-row:hover { background: var(--paper-soft, #f1ece1); }
.mykids-picker-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}
.mykids-picker-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.mykids-picker-info { min-width: 0; flex: 1; }
.mykids-picker-name { font-weight: 500; }

#mykids-picker-search { margin-bottom: 4px; }

/* Empty state on the My Kids page — the "Pick my kids" button stays
   centered and the tip line gets a max-width so it stays readable. */
#mykids-empty .tree-empty-card { text-align: center; }
#mykids-empty .tree-empty-card p { max-width: 42ch; margin-left: auto; margin-right: auto; }
#mykids-empty .btn { margin-top: 6px; }

/* ============================================================
   v4.44  FAMILY RECIPES (Wave 3a)
   Grid of recipe cards → per-recipe detail.
   ============================================================ */

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 18px;
}
.recipe-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--ink-200);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), border-color .15s var(--ease-out);
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -14px rgba(19, 24, 38, 0.22);
  border-color: rgba(47, 107, 89, 0.32);
}
.recipe-card-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover;
  background-position: center;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-500);
  font-size: 38px;
}
.recipe-card-photo .recipe-card-no-photo { opacity: 0.6; }
.recipe-card-body { padding: 12px 14px 14px; }
.recipe-card-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 4px;
}
.recipe-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.recipe-card-cat {
  background: rgba(47, 107, 89, 0.10);
  color: var(--brand-900);
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.recipe-card-from {
  font-size: 12px;
  font-style: italic;
}

/* Recipe detail layout */
.recipe-detail { padding: 18px 18px 26px; }
.recipe-detail-photo {
  /* v4.46: shrunk from 480px → 320px max so the photo doesn't dominate
     the detail page. Click-to-lightbox still works for full-size view. */
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  margin-bottom: 16px;
  cursor: zoom-in;
}
.recipe-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.recipe-detail-name {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.015em;
}
.recipe-detail-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.recipe-detail-actions { display: flex; gap: 6px; flex-shrink: 0; }

.recipe-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 28px;
  margin-top: 18px;
}
.recipe-detail-grid h4,
.recipe-notes h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
}
.recipe-ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
}
.recipe-ingredients li {
  padding: 6px 0 6px 22px;
  position: relative;
  border-bottom: 1px solid var(--ink-200);
  font-size: 14px;
  line-height: 1.45;
}
.recipe-ingredients li:last-child { border-bottom: 0; }
.recipe-ingredients li::before {
  content: '';
  position: absolute;
  left: 4px; top: 12px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-900, #173028);
  opacity: 0.7;
}
.recipe-instructions.rich,
.recipe-notes .rich {
  line-height: 1.6;
  font-size: 14.5px;
}
.recipe-instructions.rich ol,
.recipe-instructions.rich ul,
.recipe-notes .rich ol,
.recipe-notes .rich ul {
  margin: 6px 0 6px 22px;
  padding: 0;
}
.recipe-instructions.rich li,
.recipe-notes .rich li { margin: 4px 0; }

.recipe-notes {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--ink-200);
}

.recipe-photo-preview {
  width: 140px;
  height: 140px;
  border-radius: 10px;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recipe-photo-preview .recipe-photo-placeholder {
  font-size: 36px;
  opacity: 0.45;
}

@media (max-width: 760px) {
  .recipes-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; }
  .recipe-detail-grid { grid-template-columns: 1fr; gap: 18px; }
  .recipe-detail-head { flex-direction: column; }
  .recipe-detail-name { font-size: 24px; }
  .recipe-detail-photo { max-width: 100%; }
}

/* ============================================================
   v4.45  MEMORIES WALL (Wave 3b)
   Reverse-chrono feed of posts. Each post is a card with a date,
   body, optional tags, optional photo grid. Photos click-to-lightbox
   reusing MyKidsLightbox.
   ============================================================ */

.memories-panel { padding-bottom: 8px; }
.memories-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 18px 22px;
}
/* v4.69: person filter chips — same quiet pill + dot language as the
   dashboard's upcoming filters. */
.mem-people-filter {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 14px 18px 0;
}
.mem-person-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--paper-soft);
  color: var(--ink-500);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), opacity 140ms var(--ease-out);
}
.mem-person-chip:hover { transform: translateY(-1px); color: var(--ink-900); }
.mem-person-chip:active { transform: translateY(0); }
.mem-person-chip:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }
.mem-person-chip.is-active {
  background: var(--brand-800);
  border-color: var(--brand-800);
  color: var(--paper);
}
.mem-person-count {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(19, 24, 38, 0.07);
}
.mem-person-chip.is-active .mem-person-count { background: rgba(247, 243, 236, 0.2); }

/* v4.69: month headers — a serif date with a hairline rule, so the feed
   reads as a timeline rather than an undifferentiated stack. */
.mem-month-head {
  display: flex; align-items: center; gap: 14px;
  margin: 26px 2px 2px;
}
.mem-month-head:first-child { margin-top: 4px; }
.mem-month-head span {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-700);
  white-space: nowrap;
}
.mem-month-head::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--hairline);
}

.memory-post {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft), var(--edge-highlight);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.memory-post:hover {
  border-color: rgba(47, 107, 89, 0.25);
  box-shadow: var(--shadow-lift), var(--edge-highlight);
}
.memory-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.memory-date {
  font-size: 13px;
  color: var(--ink-500);
  font-weight: 500;
}
/* v4.64: post author byline */
.memory-byline { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.memory-author { font-size: 14px; font-weight: 600; color: var(--brand-900); }
.memory-byline .memory-date::before { content: '·'; margin-right: 8px; color: var(--ink-300); }
.memory-actions { display: flex; gap: 6px; flex-shrink: 0; }
.memory-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-900);
}
.memory-body.rich a {
  color: var(--brand-900, #173028);
  text-decoration: underline;
}
.memory-body.rich ul, .memory-body.rich ol { margin: 6px 0 6px 22px; padding: 0; }
.memory-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.memory-tag {
  background: rgba(47, 107, 89, 0.10);
  color: var(--brand-900);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 99px;
}
.memory-photos {
  /* v4.46: bumped min from 110 → 180 so each photo gets more presence
     in the feed. Bigger tiles also feel less Instagram-grid, more
     scrapbook. */
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

/* Composer modal — tag chips inline above the picker. */
.memory-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 22px;
}
.memory-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 10px;
  background: rgba(47, 107, 89, 0.10);
  color: var(--brand-900);
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
}
.memory-tag-x {
  border: 0;
  background: transparent;
  color: var(--brand-900);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 50%;
}
.memory-tag-x:hover { background: rgba(47, 107, 89, 0.2); }

@media (max-width: 760px) {
  .memories-feed { padding: 10px 12px 18px; }
  .memory-photos { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   v4.46  RECIPES — CATEGORY FILTER TABS
   Horizontal pill row under the panel head. Scrolls horizontally on
   mobile if there are many categories.
   ============================================================ */
.recipes-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 18px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.recipes-category-tabs::-webkit-scrollbar { display: none; }
.recipes-cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--ink-200);
  background: #fff;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  transition: background-color .12s ease-out, border-color .12s ease-out, color .12s ease-out;
  white-space: nowrap;
}
.recipes-cat-tab:hover {
  border-color: rgba(47, 107, 89, 0.32);
  color: var(--brand-900);
}
.recipes-cat-tab.is-active {
  background: var(--brand-900, #173028);
  border-color: var(--brand-900, #173028);
  color: #fff;
}
.recipes-cat-count {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  padding: 1px 7px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.recipes-cat-tab.is-active .recipes-cat-count {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   v4.46  MEMORIES — REACTIONS + COMMENTS
   Reaction quick-picks + rolled-up chips per post; threaded comment
   list with author + relative timestamp.
   ============================================================ */

.memory-reactions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-200);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.memory-reaction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* v4.64: who reacted (names), shown on its own line under the chips */
.memory-reaction-who {
  flex-basis: 100%;
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 12px; color: var(--ink-400); margin-top: 2px;
}
.mrw-item { display: inline-flex; align-items: baseline; gap: 5px; }
.mrw-emoji { font-size: 13px; }
.memory-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--paper-soft, #f1ece1);
  border: 1px solid transparent;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .12s, border-color .12s;
  font-variant-numeric: tabular-nums;
}
.memory-reaction-chip:hover { background: #eee; }
.memory-reaction-chip.is-mine {
  background: rgba(47, 107, 89, 0.12);
  border-color: rgba(47, 107, 89, 0.45);
  color: var(--brand-900);
}
.memory-reaction-chip.is-readonly { cursor: default; opacity: 0.85; }
.memory-reaction-chip[disabled] { cursor: not-allowed; }
.memory-reaction-emoji { font-size: 14px; line-height: 1; }
.memory-reaction-count { font-size: 12px; font-weight: 600; }

.memory-react-picks {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--ink-200);
  border-radius: 99px;
  background: #fff;
}
.memory-react-pick,
.memory-react-more {
  border: 0;
  background: transparent;
  padding: 3px 6px;
  border-radius: 99px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .1s ease-out, transform .1s ease-out;
}
.memory-react-pick:hover,
.memory-react-more:hover {
  background: var(--paper-soft, #f1ece1);
  transform: scale(1.15);
}
.memory-react-pick.is-mine {
  background: rgba(47, 107, 89, 0.12);
}
.memory-react-more {
  font-size: 14px;
  color: var(--ink-500);
  padding: 4px 9px;
}

/* Comments */
.memory-comments {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-200);
}
.memory-comment-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.memory-comment {
  background: var(--paper-soft, #f1ece1);
  padding: 8px 12px;
  border-radius: 10px;
}
.memory-comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.memory-comment-author { font-size: 13px; }
.memory-comment-date { margin-left: auto; }
.memory-comment-x {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink-500);
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 50%;
}
.memory-comment-x:hover { background: #e44; color: #fff; }
.memory-comment-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-900);
  white-space: pre-wrap;
}
/* v4.65: emoji reactions on a comment */
.memory-creactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.memory-creaction-chip, .memory-creaction-more {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1px solid var(--ink-200); background: var(--paper-soft); color: var(--ink-700);
  border-radius: 999px; padding: 1px 8px; font-size: 12px; line-height: 1.7; cursor: pointer;
  transition: background .15s var(--ease-out), border-color .15s var(--ease-out);
}
.memory-creaction-chip:hover, .memory-creaction-more:hover { border-color: var(--brand-300); background: var(--tint-50); }
.memory-creaction-chip.is-mine { border-color: var(--brand-500); background: var(--tint-100); color: var(--brand-900); font-weight: 600; }
.memory-creaction-count { font-variant-numeric: tabular-nums; }
.memory-creaction-more { color: var(--ink-400); }
.memory-creaction-chip[disabled] { cursor: default; opacity: .7; }
.memory-comment-add {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.memory-comment-add textarea {
  flex: 1;
  min-height: 56px;
  resize: vertical;
  padding: 8px 12px;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  background: #fff;
}
.memory-comment-add textarea:focus {
  outline: none;
  border-color: rgba(47, 107, 89, 0.45);
}

@media (max-width: 760px) {
  .recipes-category-tabs { padding: 4px 12px 12px; flex-wrap: nowrap; overflow-x: auto; }
  .memory-react-picks { flex-wrap: wrap; }
  .memory-comment-add { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   v4.47  TIME CAPSULE
   Two sections: Opened (full content), Sealed (envelope cards).
   ============================================================ */
.tcp-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 18px 18px;
}
.tcp-card {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  padding: 16px 18px;
}
.tcp-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tcp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}
.tcp-card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  margin: 2px 0 4px;
  letter-spacing: -0.015em;
}

/* Sealed: envelope-shape card with a tan paper feel + a lock icon. */
.tcp-card.is-sealed {
  padding: 0;
  overflow: hidden;
  border-color: rgba(168, 138, 90, 0.45);
  background: linear-gradient(180deg, #f7eed8 0%, #efe3c0 100%);
}
.tcp-envelope {
  position: relative;
  padding: 18px 22px 22px;
}
.tcp-envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 28px;
  background: linear-gradient(180deg, rgba(168, 138, 90, 0.28), transparent);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
}
.tcp-envelope-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
}
.tcp-envelope-lock {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(168, 138, 90, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tcp-envelope-to { font-size: 13px; }
.tcp-envelope-when {
  font-size: 14px;
  color: var(--ink-900);
  margin-top: 2px;
}
.tcp-envelope-title { margin-top: 6px; }
.tcp-card.is-sealed .tcp-card-actions {
  padding: 0 22px 16px;
  margin-top: 0;
}

/* Opened: standard card with body + photo. */
.tcp-body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-900);
  margin-top: 6px;
}
.tcp-body.rich a { color: var(--brand-900, #173028); text-decoration: underline; }
.tcp-body.rich ul, .tcp-body.rich ol { margin: 6px 0 6px 22px; padding: 0; }
.tcp-photo {
  margin-top: 14px;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover;
  background-position: center;
  cursor: zoom-in;
}
.tcp-override-tag {
  background: rgba(168, 138, 90, 0.28);
  color: #6e5125;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 760px) {
  .tcp-list { padding: 10px 12px 14px; }
  .tcp-envelope { padding: 14px 14px 18px; }
  .tcp-card-head { flex-direction: column; }
}

/* ============================================================
   v4.48  STORIES (Wave 4b)
   Card grid → click → player modal. Source pills in the editor
   switch between Record/Upload-audio/Upload-video/Embed-URL.
   ============================================================ */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 18px;
}
.story-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--ink-200);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), border-color .15s var(--ease-out);
}
.story-card:hover {
  transform: translateY(-3px);
  border-color: rgba(47, 107, 89, 0.32);
  box-shadow: 0 10px 24px -14px rgba(19, 24, 38, 0.22);
}
.story-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #2b3a55, #4a5a82);
  color: rgba(255, 255, 255, 0.92);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.story-card-thumb.is-video {
  background: linear-gradient(135deg, #6b3a55, #a04a82);
}
.story-card-kind-emoji { font-size: 44px; line-height: 1; }
.story-card-duration {
  position: absolute;
  right: 8px; bottom: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.story-card-body { padding: 12px 14px 14px; }
.story-card-title { font-weight: 600; font-size: 15px; line-height: 1.3; margin-bottom: 4px; }
.story-card-meta { margin-bottom: 6px; }
.story-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* Source pills in the editor modal */
.story-source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: var(--paper-soft, #f1ece1);
  border-radius: 10px;
}
.story-pill {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  transition: background-color .12s ease-out, color .12s ease-out;
  white-space: nowrap;
}
.story-pill:hover { color: var(--ink-900); }
.story-pill.is-active {
  background: #fff;
  color: var(--brand-900);
  box-shadow: var(--shadow-soft);
}

.story-source-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--ink-200);
  border-radius: 10px;
}
.story-source-panel input[type="file"] { display: block; }
.story-source-panel audio,
.story-source-panel video { display: block; width: 100%; margin-top: 8px; border-radius: 8px; }

.story-recorder {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.story-rec-status {
  font-size: 13px;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
}

/* Player modal */
.story-player-audio { width: 100%; }
.story-player-video {
  width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: 10px;
}
.story-player-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
}
.story-player-desc {
  margin-top: 14px;
  line-height: 1.55;
  color: var(--ink-900);
  white-space: pre-wrap;
}
.story-player-actions {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}

@media (max-width: 760px) {
  .stories-grid { grid-template-columns: 1fr; padding: 12px; }
  .story-source-pills { flex-wrap: wrap; }
  .story-pill { min-width: 130px; }
}

/* ============================================================
   v4.49  ADMIN: DOCUMENTS DRAWER + HEALTH & LEGACY LOCKER
   Documents tab on the Vault page (admin-only, peer to Family/
   Finance/Benefits/Home). Health subsection appended to each
   member's card in the Family tab.
   ============================================================ */

/* Health subsection inside Family-tab member cards */
.vault-health {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--ink-200);
}
.vault-health-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-500);
  margin: 0 0 8px;
}
.vault-kv-health dd {
  white-space: pre-wrap;
}

/* Documents toolbar */
.documents-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 0;
  align-items: center;
}
.documents-toolbar .input { min-width: 160px; flex: 1; }
.documents-toolbar select.input { max-width: 220px; }
.documents-toolbar #documents-search { max-width: 260px; flex: 2; }

/* Documents list */
.documents-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 22px;
}
.document-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  padding: 12px 14px;
}
.document-icon {
  font-size: 28px;
  line-height: 1;
  width: 36px;
  flex-shrink: 0;
  text-align: center;
}
.document-main { flex: 1; min-width: 0; }
.document-title { font-weight: 600; font-size: 15px; }
.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
}
.document-cat {
  background: rgba(47, 107, 89, 0.10);
  color: var(--brand-900);
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.document-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .documents-toolbar { flex-direction: column; align-items: stretch; padding: 12px; }
  .documents-toolbar .input,
  .documents-toolbar select.input,
  .documents-toolbar #documents-search { max-width: 100%; min-width: 0; }
  .document-row { flex-direction: column; align-items: stretch; }
  .document-actions { justify-content: flex-start; }
}

/* ============================================================
   v4.50  FAMILY NEWSLETTER (Wave 6)
   Date-bounded digest compiler. Print-friendly layout with a
   no-print toolbar; uses window.print() + the OS Save-as-PDF
   destination so no extra dependencies are needed.
   ============================================================ */

.newsletter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px 18px;
  align-items: flex-end;
}
.newsletter-controls .field { margin: 0; }
.newsletter-controls .field input { min-width: 160px; }
.newsletter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}
.newsletter-preview-panel { padding-bottom: 8px; }
.newsletter-preview {
  padding: 26px 32px 32px;
  background: #fff;
  font-family: var(--font-display, Georgia), serif;
  color: var(--ink-900);
  line-height: 1.55;
}
.newsletter-head {
  border-bottom: 2px solid var(--ink-900);
  padding-bottom: 14px;
  margin-bottom: 22px;
}
.newsletter-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.newsletter-range { margin: 0; font-size: 14px; }

.newsletter-section {
  margin-bottom: 22px;
  page-break-inside: avoid;
}
.newsletter-section h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 0.01em;
  margin: 0 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink-200);
}
.newsletter-upcoming-list,
.newsletter-list-plain {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.newsletter-upcoming-list li,
.newsletter-list-plain li {
  padding: 5px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.newsletter-upcoming-list li:last-child,
.newsletter-list-plain li:last-child { border-bottom: 0; }

.newsletter-card {
  padding: 12px 14px;
  margin-bottom: 12px;
  border-left: 3px solid var(--ink-200);
  page-break-inside: avoid;
}
.newsletter-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.newsletter-card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.newsletter-tag {
  background: rgba(47, 107, 89, 0.10);
  color: var(--brand-900);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 99px;
}
.newsletter-card-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.newsletter-body {
  font-size: 14px;
  line-height: 1.55;
  margin-top: 4px;
}
.newsletter-body.rich ul, .newsletter-body.rich ol { margin: 4px 0 4px 22px; padding: 0; }
.newsletter-body.rich a { color: var(--brand-900); text-decoration: underline; }
.newsletter-photos {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}
.newsletter-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--paper-soft, #f1ece1);
  background-size: cover;
  background-position: center;
  border-radius: 4px;
}

.newsletter-foot {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-200);
  text-align: center;
}

/* Print rules — hide the chrome and let the preview fill the page.
   v4.51: Newsletter now lives inside the Dashboard view, so print rules
   target #view-dashboard instead of the deprecated #view-newsletter. */
@media print {
  body * { visibility: hidden; }
  #view-dashboard, #view-dashboard * { visibility: visible; }
  #view-dashboard {
    position: absolute;
    inset: 0;
    background: #fff;
    padding: 0;
    margin: 0;
  }
  .no-print { display: none !important; }
  .topbar, .nav, .toast { display: none !important; }
  .newsletter-preview-panel { box-shadow: none; border: 0; border-radius: 0; }
  .newsletter-preview { padding: 0; }
  .newsletter-card { border-left-width: 2px; }
  @page { margin: 0.6in; }
}

@media (max-width: 760px) {
  .newsletter-controls { padding: 12px; flex-direction: column; align-items: stretch; }
  .newsletter-controls .field input { min-width: 0; }
  .newsletter-buttons { justify-content: stretch; }
  .newsletter-buttons .btn { flex: 1; }
  .newsletter-preview { padding: 16px 18px; }
  .newsletter-photos { grid-template-columns: repeat(3, 1fr); }
}

/* v4.51 — My Kids · Time Capsule tab. Groups capsules into Opened /
   Sealed sections, like the global Time Capsule page but scoped to one
   kid. Heading sits above each section's stack of tcp-cards. */
.mykids-capsule-section { margin: 0 0 18px; }
.mykids-capsule-section:last-child { margin-bottom: 0; }
.mykids-capsule-heading {
  margin: 12px 14px 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* =====================================================================
   v4.58  ALBUMS — owned photo collections (gallery layout B + detail)
   ===================================================================== */
.albums-gallery { display: block; }

/* v4.61: uniform square-cover grid (Meta-style) — no hero banner */
.albums-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-4); }
.album-card {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--paper-soft); border: 1px solid var(--hairline); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-soft);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.album-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.album-card:focus-visible { outline: none; box-shadow: var(--ring-brand); }
.album-card-cover {
  position: relative; aspect-ratio: 1 / 1;
  background-size: cover; background-position: center; background-color: var(--paper-veil);
  transition: transform .4s var(--ease-out);
}
.album-card-cover.is-missing { background: linear-gradient(135deg, var(--brand-300), var(--brand-500)); }
.album-card-body { padding: var(--space-3) var(--space-4) var(--space-4); }
.album-card-title { font-family: var(--font-display); font-size: 16px; margin: 0; color: var(--brand-900); }
.album-card-meta { margin: 2px 0 0; font-size: 12px; color: var(--ink-400); }

/* "Create album" tile (first grid cell) */
.album-create-tile { background: transparent; border: none; box-shadow: none; padding: 0; }
.album-create-tile:hover { box-shadow: none; }
.album-create-box {
  aspect-ratio: 1 / 1; border: 1.5px dashed var(--ink-200); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; background: var(--paper);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.album-create-tile:hover .album-create-box { border-color: var(--brand-300); background: var(--tint-50); }
.album-create-plus { font-size: 40px; line-height: 1; font-weight: 300; color: var(--brand-500); }
.album-create-tile .album-card-title { color: var(--brand-700); }

/* Album detail */
.album-back { margin-bottom: var(--space-3); }
.album-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.album-detail-title { font-family: var(--font-display); font-size: 24px; margin: 0; color: var(--brand-900); }
.album-detail-meta { margin: 2px 0 0; color: var(--ink-400); font-size: 13px; }
.album-detail-desc { margin: var(--space-3) 0 0; max-width: 60ch; line-height: 1.7; }
.album-detail-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.album-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
.album-photo {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
  background-size: cover; background-position: center; background-color: var(--paper-veil); cursor: pointer;
  transition: transform .2s var(--ease-out);
}
.album-photo:hover { transform: scale(1.02); }
.album-photo:focus-visible { outline: none; box-shadow: var(--ring-brand); }
.album-photo.is-missing { background: var(--paper-veil); }
.album-photo-x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(23, 48, 40, .6); color: #fff; cursor: pointer; line-height: 1; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.album-photo-x:hover { background: var(--danger); }

/* v4.60: cover badge + "set as cover" button on photo tiles */
.album-photo.is-cover { outline: 2px solid var(--accent-500); outline-offset: -2px; }
.album-photo-coverbadge {
  position: absolute; top: 6px; left: 6px; z-index: 1;
  background: var(--accent-700); color: #fff; font-size: 10.5px; font-weight: 700;
  letter-spacing: .02em; padding: 2px 7px; border-radius: 999px; pointer-events: none;
}
.album-photo-setcover {
  position: absolute; left: 6px; bottom: 6px; z-index: 1;
  border: none; border-radius: 999px; cursor: pointer;
  background: rgba(23, 48, 40, .62); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 9px; opacity: .92; transition: background .15s var(--ease-out), opacity .15s var(--ease-out);
}
.album-photo:hover .album-photo-setcover { opacity: 1; }
.album-photo-setcover:hover { background: var(--accent-700); }

/* v4.60: inline upload progress bar */
.album-upload-progress { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-4); }
.album-upload-progress .aup-bar {
  flex: 1; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--paper-veil); border: 1px solid var(--hairline);
}
.album-upload-progress .aup-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  transition: width .25s var(--ease-out);
}
.album-upload-progress .aup-label { font-size: 12.5px; color: var(--ink-400); white-space: nowrap; }

/* v4.62: drag-and-drop photo upload zone */
.photo-dropzone {
  display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  width: 100%; padding: var(--space-5); margin: 0 0 var(--space-4);
  border: 1.5px dashed var(--ink-200); border-radius: var(--radius);
  background: var(--paper); color: var(--ink-400); cursor: pointer; text-align: center;
  transition: border-color .18s var(--ease-out), background .18s var(--ease-out), color .18s var(--ease-out);
}
.photo-dropzone * { pointer-events: none; }   /* drag events fire on the zone, not its children */
.photo-dropzone:hover { border-color: var(--brand-300); color: var(--brand-700); }
.photo-dropzone.is-dragover {
  border-color: var(--brand-500); background: var(--tint-50); color: var(--brand-700);
  box-shadow: var(--ring-brand);
}
.photo-dropzone-icon { display: inline-flex; color: var(--brand-500); }
.photo-dropzone-text { font-size: 13.5px; }
.photo-dropzone-link { color: var(--brand-700); font-weight: 600; text-decoration: underline; }

/* Comments (album-level + per-photo) */
.album-comments, .album-photo-comments-inner { margin-top: var(--space-6); border-top: 1px solid var(--hairline); padding-top: var(--space-4); }
.album-comments-title { font-size: 14px; margin: 0 0 var(--space-3); color: var(--brand-700); text-transform: uppercase; letter-spacing: 0.04em; }
.album-comment-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.album-comment-head { display: flex; align-items: center; gap: var(--space-2); }
.album-comment-author { font-size: 13px; color: var(--brand-900); }
.album-comment-body { margin-top: 2px; line-height: 1.6; }
.album-comment-x { border: none; background: transparent; color: var(--ink-400); cursor: pointer; font-size: 14px; line-height: 1; margin-left: auto; }
.album-comment-x:hover { color: var(--danger); }
.album-comment-add { display: flex; gap: var(--space-2); align-items: flex-start; }
.album-comment-add textarea { flex: 1; }

@media (max-width: 640px) {
  .album-detail-head { flex-direction: column; }
}
