:root {
  --bg: #07090d;
  --bg-2: #0d1219;
  --panel: rgba(18, 24, 34, 0.92);
  --panel-solid: #121822;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.32);
  --text: #eef3fb;
  --muted: #9aa8bd;
  --accent: #7dd3fc;
  --accent-2: #34d399;
  --accent-hot: #8adfff;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --glow: rgba(125, 211, 252, 0.22);
  --node-bg: rgba(18, 24, 34, 0.95);
  --node-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 14px;
  --topbar-h: 58px;
  --panel-w: 320px;
  --grid-dot: rgba(148, 163, 184, 0.14);
  /* Bond styles: equally strong, never dashed. Family = solid ink, marriage = warm double line. */
  --canvas-bg: #080b11;
  --bond-family: #b4c0d2;
  --bond-marriage: #f2b37a;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  font-size: 0.78em;
  font-family: inherit;
}

.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  width: 100%;
  position: relative;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(125,211,252,.10), transparent 55%),
    radial-gradient(700px 420px at 95% 0%, rgba(52,211,153,.07), transparent 50%),
    var(--bg);
}

/* ——— Top bar ——— */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  padding: 0.4rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: blur(16px);
  z-index: 40;
  position: relative;
  min-height: var(--topbar-h);
  min-width: 0;
}

.brand-block { flex-shrink: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px var(--glow);
  display: grid;
  place-items: center;
  color: #041018;
  font-weight: 800;
  font-size: 0.95rem;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text strong {
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}
.byline {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1 1 auto;
  justify-content: center;
  flex-wrap: wrap;
  min-width: 0;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid transparent;
}

.tool-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 0.3rem;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .12s ease;
}
.tool-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}
.tool-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.tool-btn.active,
.tool-btn[aria-pressed="true"] {
  color: #041018;
  background: linear-gradient(135deg, #8adfff, #5eead4);
  box-shadow: 0 6px 20px var(--glow);
}
.tool-btn.tool-danger:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-bg);
}
.tool-zoom {
  min-width: 3.4rem;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}
.tool-label { white-space: nowrap; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
.admin-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
  line-height: 1.15;
  max-width: 11rem;
}
.admin-badge .admin-email {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.admin-badge .admin-role {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
}
.logout-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  opacity: 0.7;
  transition: opacity .15s, color .15s, border-color .15s;
}
.logout-btn:hover {
  opacity: 1;
  color: var(--text);
  border-color: var(--line);
}
.logout-btn:disabled { opacity: 0.4; cursor: default; }

/* ——— Auth gate (unauthenticated) ——— */
body.gated {
  overflow: hidden;
}
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(125,211,252,.12), transparent 55%),
    radial-gradient(700px 420px at 95% 0%, rgba(52,211,153,.08), transparent 50%),
    var(--bg);
}
.auth-gate[hidden] { display: none !important; }
.auth-gate-card {
  width: min(100%, 24rem);
  padding: 2rem 1.75rem 1.85rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(18, 24, 34, 0.92);
  box-shadow: 0 24px 64px rgba(0,0,0,.45);
  text-align: center;
  backdrop-filter: blur(12px);
}
.auth-gate-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}
.auth-gate-brand .mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.15rem;
}
.auth-gate-brand strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.auth-gate-brand .byline {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.auth-gate-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.auth-gate-note {
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.auth-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  text-decoration: none;
  padding: 0.75rem 1rem;
  font-weight: 700;
}
.auth-google-btn svg { flex-shrink: 0; }

/* ——— Workspace ——— */
.workspace {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.canvas-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  outline: none;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  touch-action: none;
}
.canvas-viewport:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(125, 211, 252, 0.35);
}
.canvas-viewport.panning { cursor: grabbing; }
.canvas-viewport.connect-mode { cursor: crosshair; }
.canvas-viewport.space-pan { cursor: grab; }

.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
  will-change: transform;
}

.edges-layer {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  left: -50000px;
  top: -50000px;
  width: 100000px;
  height: 100000px;
}
.edges-layer .edge-hit {
  pointer-events: stroke;
  cursor: pointer;
  stroke: transparent;
  stroke-width: 14;
  fill: none;
}
/* Link strokes. --zw (set from zoom) thickens them when zoomed far out so phones stay legible. */
.edge-path,
.edge-core,
.edge-halo {
  fill: none;
  pointer-events: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.edge-path.bond-family {
  stroke: var(--bond-family);
  stroke-width: calc(3px * var(--zw, 1));
}
/* Double line = wide warm stroke + canvas-colored core: two 2px rails with a 2.5px gap. */
.edge-path.bond-marriage {
  stroke: var(--bond-marriage);
  stroke-width: calc(6.5px * var(--zw, 1));
}
.edge-core {
  stroke: var(--canvas-bg);
  stroke-width: calc(2.5px * var(--zw, 1));
}
.edge-halo {
  stroke: var(--accent);
  stroke-opacity: 0.38;
  stroke-width: calc(13px * var(--zw, 1));
  filter: drop-shadow(0 0 6px var(--glow));
}
.edges-layer .edge.selected .edge-path.bond-family { stroke: #e3eaf5; }
.edges-layer .edge.selected .edge-path.bond-marriage { stroke: #ffcd9c; }

.temp-edge {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  pointer-events: none;
  opacity: 0.85;
}

.nodes-layer {
  position: absolute;
  left: 0;
  top: 0;
}

/* ——— Person cards ——— */
.person-node {
  position: absolute;
  width: 200px;
  padding: 0.85rem 0.95rem 0.9rem;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 40%),
    var(--node-bg);
  border: 1px solid var(--line);
  box-shadow: var(--node-shadow);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow .15s ease, border-color .15s ease;
  z-index: 1;
}
.person-node:hover {
  border-color: var(--line-strong);
}
.person-node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px rgba(125,211,252,0.15), var(--node-shadow);
  z-index: 5;
}
.person-node.connect-source {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2), 0 0 0 4px rgba(52,211,153,0.18), var(--node-shadow);
}
.person-node.dragging {
  cursor: grabbing;
  opacity: 0.95;
  z-index: 10;
  transition: none;
}
.person-node:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.person-node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--node-accent, var(--accent));
}

.node-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.node-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
  color: #041018;
  background: var(--node-accent, var(--accent));
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}
.node-meta { min-width: 0; flex: 1; }
.node-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-birth {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.8;
  margin-top: 0.35rem;
  padding-left: calc(40px + 0.7rem);
}

.node-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--accent);
  opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
  z-index: 2;
}
.person-node:hover .node-handle,
.person-node.selected .node-handle,
.connect-mode .person-node .node-handle {
  opacity: 1;
  pointer-events: auto;
}
.node-handle:hover { transform: scale(1.25); background: var(--accent); }
.node-handle.right { right: -7px; top: 50%; transform: translateY(-50%); }
.node-handle.right:hover { transform: translateY(-50%) scale(1.25); }
.node-handle.left { left: -7px; top: 50%; transform: translateY(-50%); }
.node-handle.left:hover { transform: translateY(-50%) scale(1.25); }
.node-handle.top { top: -7px; left: 50%; transform: translateX(-50%); }
.node-handle.top:hover { transform: translateX(-50%) scale(1.25); }
.node-handle.bottom { bottom: -7px; left: 50%; transform: translateX(-50%); }
.node-handle.bottom:hover { transform: translateX(-50%) scale(1.25); }

/* ——— Empty / mode banners ——— */
.empty-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 15;
}
.empty-hint[hidden] { display: none !important; }
.empty-card {
  pointer-events: auto;
  text-align: center;
  padding: 2rem 2.2rem;
  max-width: 360px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 40%), var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.empty-icon {
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.empty-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.empty-card p {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.mode-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.7rem 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(12, 18, 28, 0.92);
  border: 1px solid rgba(125, 211, 252, 0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,.35), 0 0 24px var(--glow);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.mode-banner[hidden] { display: none !important; }
.banner-cancel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 650;
}
.banner-cancel:hover { background: rgba(255,255,255,0.08); }
.banner-cancel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ——— Side panel ——— */
.side-panel {
  grid-row: 2;
  grid-column: 1;
  justify-self: end;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  width: min(var(--panel-w), 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 48px rgba(0,0,0,.35);
  animation: slideIn .18s ease;
}
.side-panel[hidden] { display: none !important; }

@keyframes slideIn {
  from { transform: translateX(12px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border-color: var(--line);
}
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel-form {
  padding: 1rem 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow-y: auto;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.field em { color: var(--accent); font-style: normal; }
.field input,
.field > select,
.field textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0;
  resize: vertical;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus,
.field > select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(125, 211, 252, 0.55);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.12);
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(154, 168, 189, 0.55); }

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
  transition: transform .12s ease, box-shadow .12s ease;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.selected {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.color-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.4rem;
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.65rem 1.05rem;
  font-weight: 650;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, #8adfff, #5eead4);
  color: #041018;
  box-shadow: 0 10px 30px var(--glow);
}
.btn-ghost {
  background: rgba(255,255,255,.04);
  border-color: var(--line);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: #1a0505;
  font-weight: 700;
}
#btn-delete-person {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
  background: var(--danger-bg);
}

/* ——— Modal ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  width: min(400px, 100%);
  padding: 1.4rem 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 40%), var(--panel-solid);
  box-shadow: 0 28px 80px rgba(0,0,0,.5);
}
.modal h3 {
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.modal p {
  margin: 0 0 1.3rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

/* ——— Toast ——— */

.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  background: rgba(18, 24, 34, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  font-size: 0.88rem;
  font-weight: 600;
  pointer-events: none;
  animation: toastIn .2s ease;
}
.toast[hidden] { display: none !important; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ——— Relation picker (floating) ——— */
.rel-picker {
  position: fixed;
  z-index: 90;
  min-width: 180px;
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.rel-picker button {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}
.rel-picker button:hover,
.rel-picker button:focus-visible {
  background: rgba(125, 211, 252, 0.12);
  color: var(--accent);
  outline: none;
}
.rel-picker .rel-title {
  padding: 0.35rem 0.75rem 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rel-picker .rel-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
  padding: 0.35rem 0.75rem 0.15rem;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.bond-swatch {
  display: inline-block;
  width: 20px;
  height: 0;
  border-radius: 2px;
}
.bond-family > .bond-swatch { border-top: 3px solid var(--bond-family); }
.bond-marriage > .bond-swatch { border-top: 6px double var(--bond-marriage); }
.rel-picker button[aria-checked="true"] {
  background: rgba(125, 211, 252, 0.1);
  color: var(--accent);
}
.rel-picker button[aria-checked="true"]::after {
  content: "✓";
  float: right;
  margin-left: 0.75rem;
}
.rel-picker .rel-remove {
  margin-top: 0.3rem;
  border-top: 1px solid var(--line);
  border-radius: 0 0 9px 9px;
  color: var(--danger);
  font-weight: 600;
}
.rel-picker .rel-remove:hover,
.rel-picker .rel-remove:focus-visible {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ——— Bond legend (bottom-left, collapsible) ——— */
.bond-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem 0.6rem 0.2rem 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 18, 26, 0.72);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}
.bond-legend[hidden] { display: none; }
.focus-bar:not([hidden]) ~ .bond-legend { bottom: 60px; }
.bond-legend.collapsed { padding-right: 0.2rem; }
.bond-legend.collapsed .bond-legend-items { display: none; }
.bond-legend-toggle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
.bond-legend-toggle:hover,
.bond-legend-toggle:focus-visible { color: var(--text); background: rgba(148, 163, 184, 0.12); outline: none; }
.bond-legend-items {
  display: flex;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bond-legend-items li { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.bond-sample { overflow: visible; }
.bond-sample .edge-path.bond-family { stroke-width: 3px; }
.bond-sample .edge-path.bond-marriage { stroke-width: 6.5px; }
.bond-sample .edge-core { stroke: #0f121a; stroke-width: 2.5px; }

/* ——— Responsive ——— */
@media (max-width: 640px) {
  .side-panel { width: 100%; }
  .person-node { width: 170px; }
}


/* ——— Multi-user: switcher, badge, dialogs, phone gate ——— */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.board-switch select {
  appearance: none;
  max-width: 11rem;
  background: rgba(0,0,0,0.3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-overflow: ellipsis;
}
.board-switch select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.invite-btn[hidden], .board-switch[hidden], .admin-badge[hidden] { display: none !important; }
button.admin-badge {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.15rem 0.4rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button.admin-badge:hover { border-color: var(--line); }
.admin-role.is-member { color: var(--muted); }
.auth-phone-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  width: 100%; margin-top: 0.6rem;
  border: 1px solid var(--line); background: rgba(0,0,0,0.3); color: var(--text);
  padding: 0.5rem 0.65rem; font-size: 0.85rem;
}
.auth-phone-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-gate-hint { margin: 0.7rem 0 0; font-size: 0.78rem; color: var(--muted); }
.phone-form { text-align: left; display: grid; gap: 0.7rem; }
.phone-form .btn { width: 100%; }
.link-btn { appearance: none; background: none; border: 0; color: var(--accent); font: inherit; font-size: 0.8rem; cursor: pointer; padding: 0; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.dialog-head h3 { margin: 0; }
.modal .dialog-note, .dialog-note { color: var(--muted); font-size: 0.85rem; line-height: 1.45; margin: 0.6rem 0; }
.modal .dialog-note.small, .dialog-note.small { font-size: 0.75rem; }
.dialog-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0; }
.dialog-msg { font-size: 0.8rem; color: var(--muted); }
.dialog-msg.error { color: var(--danger); }
.dialog-msg.ok { color: #34d399; }
.dialog-sub { margin: 1rem 0 0.35rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.dialog-sub .count { color: var(--accent); }
.modal.modal-wide { width: min(100%, 36rem); max-height: 88vh; overflow-y: auto; }
.modal#profile-dialog, #profile-dialog .modal, #newboard-dialog .modal { text-align: left; }
.modal-wide { text-align: left; }
.people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.people-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,0.2);
  font-size: 0.82rem;
}
.people-list .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 10rem; }
.people-list .actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.people-list .empty { color: var(--muted); border-style: dashed; justify-content: center; }
.mini-btn {
  appearance: none; background: rgba(0,0,0,0.3); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 0.2rem 0.5rem; font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.mini-btn:hover { border-color: var(--line-strong); }
.mini-btn.danger { color: var(--danger); }
.role-tag { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.role-tag.member { color: var(--muted); }
.profile-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.9rem; margin: 0.8rem 0; font-size: 0.85rem; }
.profile-list dt { color: var(--muted); }
.profile-list dd { margin: 0; overflow-wrap: anywhere; }
#invite-emails, .modal textarea { width: 100%; box-sizing: border-box; }
[hidden]{display:none !important}


/* ——— Link card to Gmail + mobile focus mode ——— */
#link-dialog .modal { text-align: left; }
#link-dialog .dialog-row { flex-wrap: wrap; }
#link-dialog select { width: 100%; box-sizing: border-box; background: rgba(0,0,0,0.3); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.7rem; font: inherit; }
#link-msg { display: block; margin-top: 0.6rem; min-height: 1.1em; }
.focus-bar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  max-width: calc(100% - 68px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.35rem 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 18, 26, 0.88);
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  color: var(--muted);
}
.focus-bar[hidden] { display: none !important; }
.focus-label[hidden] { display: none; }
.focus-btn {
  appearance: none;
  border: 1px solid rgba(125, 211, 252, 0.4);
  background: rgba(125, 211, 252, 0.12);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.focus-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Focus mode only changes how cards are drawn; it is never written to board data. */
.canvas-viewport.focus-on .person-node.focus-out { opacity: 0; visibility: hidden; pointer-events: none; }
.canvas-viewport.focus-on .person-node.is-me { border-color: var(--accent); }
.person-node { transition: box-shadow .15s ease, border-color .15s ease, opacity .2s ease; }

/* ——— Privacy: DOB, pending cards, card pickers ——— */
.field em.muted-em { color: var(--muted); font-size: 0.72rem; }
.field-hint { color: var(--muted); font-size: 0.72rem; }
.dob-share { display: grid; gap: 0.3rem; padding: 0.55rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 10px; }
.dob-share-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.dob-share-toggle input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent, #2563eb); flex: none; }
#field-dob[readonly] { background: transparent; color: var(--muted); cursor: default; }
.self-created-note { display: grid; gap: 0.4rem; padding: 0.6rem; border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 0.8rem; }
.self-created-note[hidden], .invite-cards[hidden], .field[hidden] { display: none !important; }
.node-pending-badge {
  position: absolute; top: -9px; right: 8px; font-size: 0.62rem; letter-spacing: 0.02em;
  padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #0b1020; font-weight: 600;
}
.invite-cards { margin: 0.4rem 0 0.6rem; }
.card-select { max-width: 12rem; min-width: 0; font: inherit; font-size: 0.78rem; padding: 0.2rem 0.3rem; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: inherit; }
.card-select option { color: #111; }
.people-list .card-tag { font-size: 0.7rem; color: var(--muted); }


/* ——— Top bar: one layout at every width ———
   ☰ (views, boards, account) · brand mark · … · Center · sync · ⋮ (actions).
   Tool buttons live in .proxy-src (never shown); menu items click them via data-proxy. */
.topbar {
  flex-wrap: nowrap;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  overflow: visible;
}
.topbar .tool-group { gap: 0.1rem; padding: 0.15rem; flex-shrink: 0; }
.topbar .toolbar { flex-wrap: nowrap; flex: 1 1 auto; justify-content: flex-end; gap: 0.35rem; margin-left: 0; }
.topbar .topbar-right { flex-wrap: nowrap; gap: 0.4rem; margin-left: 0; }
.topbar .tool-btn { padding: 0.42rem 0.5rem; }
.topbar .brand-text { display: none; }
.proxy-src { display: none !important; }
.byline strong { font-weight: 750; color: var(--text); }
.center-btn .tool-label { display: inline; }

/* Cloud sync icon: gray stroke while syncing or failed, green once saved. */
.sync-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: #94a3b8;
  transition: color .2s ease;
}
.sync-icon.synced { color: var(--accent-2); }

/* Menus */
.menu-trigger { flex-shrink: 0; }
.menu-trigger[aria-expanded="true"] { color: var(--text); background: rgba(255,255,255,0.07); }
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 13.5rem;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 18, 26, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.menu-pop[hidden] { display: none !important; }
.more-menu { right: 8px; }
.nav-menu { left: 8px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.menu-item svg { color: var(--muted); flex-shrink: 0; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: rgba(255,255,255,0.06); outline: none; }
.menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.menu-item.active, .menu-item[aria-pressed="true"] { color: #8adfff; }
.menu-item.active svg, .menu-item[aria-pressed="true"] svg { color: #8adfff; }
.menu-item.danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-bg); }
.menu-label { padding: 0.45rem 0.65rem 0.2rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.menu-sep { height: 1px; margin: 0.25rem 0.3rem; background: var(--line); }
.menu-boards { display: flex; flex-direction: column; gap: 0.1rem; }
.menu-account { display: flex; flex-direction: column; min-width: 0; }
.menu-account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-account small { color: var(--muted); font-weight: 600; font-size: 0.72rem; }
.menu-group { display: flex; flex-direction: column; gap: 0.1rem; }

/* Org chart view: read-only layout, generation rows, straight connectors */
.person-node.org-out { display: none; }
.workspace.view-org .node-handle { display: none !important; }
.workspace.view-org .person-node { cursor: pointer; }
.workspace.view-org .person-node.is-focus { border-color: rgba(125, 211, 252, 0.75); box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.25), var(--node-shadow); }
.workspace.view-org .canvas-viewport {
  background-color: #0c1220;
  background-image:
    linear-gradient(rgba(125, 211, 252, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 252, 0.05) 1px, transparent 1px);
}
.edges-layer .edge-path.view-link { fill: none; stroke: rgba(125, 211, 252, 0.72); stroke-width: 1.75; }

/* ——— Add person: the new card stands out, everything else steps back ——— */
.workspace.draft-editing .person-node:not(.is-draft):not(.focus-out) {
  opacity: .28; filter: grayscale(1); pointer-events: none;
}
.workspace.draft-editing .edge-path,
.workspace.draft-editing .edge-core,
.workspace.draft-editing .edge-label,
.workspace.draft-editing .edge-label-bg { opacity: .22; }
.workspace.draft-editing .edge-hit { pointer-events: none; }
.person-node.is-draft { box-shadow: 0 0 0 2px var(--accent), 0 12px 32px rgba(0,0,0,.45); }
.rel-required { border: 0; padding: 0; margin: 0; min-width: 0; }
.rel-required legend { padding: 0; margin-bottom: .35rem; font-size: .8rem; color: var(--muted); }
.rel-required legend em { color: var(--accent); font-style: normal; }
.rel-sentence { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .85rem; }
.rel-subject { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-sentence select {
  font: inherit; color: var(--text); background: rgba(0,0,0,.3);
  border: 1px solid var(--line); border-radius: 10px; padding: .45rem .55rem; min-width: 0; max-width: 100%;
}
#field-rel-person { flex: 1 1 9rem; }
.rel-required.invalid select { border-color: #f87171; }
.field-error { color: #fca5a5; font-size: .78rem; margin-top: .35rem; display: block; }
.field-error[hidden] { display: none !important; }

/* Gender select (v8) */
.field > select { appearance: none; cursor: pointer; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field > select option { background: #111722; color: #e6edf6; }

/* ——— v9: deleted boards ——— */
.deleted-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: min(760px, calc(100% - 24px));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  padding: 0.55rem 0.7rem 0.55rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(40, 14, 16, 0.92);
  backdrop-filter: blur(8px);
  color: #fecaca;
  font-size: 0.82rem;
  line-height: 1.4;
}
.deleted-banner[hidden] { display: none !important; }
.deleted-banner-text { flex: 1 1 260px; }
.deleted-banner-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.deleted-banner .btn { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.deleted-banner .btn[hidden] { display: none; }
.deleted-list { list-style: none; margin: 0.4rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.deleted-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 0.8rem; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.deleted-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.deleted-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deleted-sub { color: var(--muted); font-size: 0.78rem; }
.deleted-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.deleted-actions .btn { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
#delete-board-dialog .field input { width: 100%; box-sizing: border-box; }
.menu-item .menu-days { margin-left: auto; padding-left: 0.6rem; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.menu-item.is-deleted:not(.active) { color: var(--muted); }
body.board-readonly .person-node { cursor: default; }

/* ——— Sign-in gate extras ——— */
.auth-gate-reassure {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}
.auth-gate-legal {
  margin: 1.25rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.auth-gate-legal a { color: var(--muted); text-decoration: none; }
.auth-gate-legal a:hover { color: var(--text); text-decoration: underline; }
.auth-gate-legal .link-btn { font-size: 0.78rem; }

/* ——— Landing (signed-out cold visitors) ——— */
.landing {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(900px 520px at 6% -8%, rgba(125,211,252,.13), transparent 55%),
    radial-gradient(760px 460px at 100% 0%, rgba(52,211,153,.09), transparent 50%),
    radial-gradient(circle, var(--grid-dot) 1px, transparent 1.2px) 0 0 / 24px 24px,
    var(--bg);
}
.landing[hidden] { display: none !important; }
.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(0.9rem + env(safe-area-inset-top, 0px)) 1.25rem 0.9rem;
}
.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
}
.landing-brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.landing-brand strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.landing-brand .byline, .auth-gate-brand .byline { display: block; }
.landing-brand .byline { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.landing-signin { padding: 0.5rem 1rem; font-size: 0.85rem; }

.landing-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding: 2.5rem 0 3rem;
}
.landing-eyebrow {
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.landing-copy h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.landing-lede {
  margin: 0 0 1.75rem;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}
.landing-cta { max-width: 26rem; }
.landing-cta-btn {
  gap: 0.6rem;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 750;
  text-decoration: none;
}
.landing-reassure {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.landing-demo {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle, rgba(148,163,184,.16) 1px, transparent 1.2px) 0 0 / 22px 22px,
    rgba(13, 18, 25, 0.85);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}
.landing-demo-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.landing-demo-lines path {
  fill: none;
  stroke: var(--bond-family);
  stroke-opacity: 0.8;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}
.landing-demo-lines path.demo-marriage { stroke: var(--bond-marriage); stroke-opacity: 1; stroke-width: 6; }
.landing-demo-lines path.demo-marriage-core { stroke: var(--bg-2); stroke-opacity: 1; stroke-width: 2.2; }
.demo-card {
  position: absolute;
  left: calc(var(--x) + 2%);
  top: calc(var(--y) + 2%);
  width: 42%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem 0.6rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--node-bg);
  box-shadow: var(--node-shadow);
}
.demo-card::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--node-accent);
}
.demo-card .node-avatar { width: 34px; height: 34px; font-size: 0.9rem; }
.demo-card > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.demo-card b { font-size: 0.88rem; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-card small { font-size: 0.7rem; color: var(--muted); }
.landing-demo figcaption {
  position: absolute;
  right: 0.8rem;
  bottom: 0.6rem;
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.85;
}

.landing-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.landing-benefits article {
  padding: 1.25rem 1.25rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.landing-benefits h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  letter-spacing: -0.015em;
}
.landing-benefits p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.landing-privacy {
  margin: 1.5rem 0 0;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.07);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.landing-privacy strong { color: var(--accent-2); }
.landing-foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.landing-foot a { color: var(--muted); text-decoration: none; }
.landing-foot a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 860px) {
  .landing-hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding: 1rem 0 2rem; }
  .landing-benefits { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .landing-main { padding: 0.75rem 1rem 1.5rem; }
  .landing-top { padding-left: 1rem; padding-right: 1rem; }
  .landing-copy h1 { font-size: 2.05rem; }
  .landing-lede { font-size: 0.98rem; }
  .landing-cta-btn { width: 100%; }
  .landing-demo { aspect-ratio: 10 / 9; }
  .demo-card { width: 45%; padding: 0.45rem 0.5rem 0.45rem 0.7rem; gap: 0.45rem; }
  .demo-card .node-avatar { width: 28px; height: 28px; font-size: 0.8rem; }
  .demo-card b { font-size: 0.76rem; }
  .demo-card small { font-size: 0.64rem; }
}

/* Org chart connectors use the same bond styles: spouse ties = marriage double line, others = family. */
.edges-layer .edge-path.view-link.bond-family { stroke: var(--bond-family); stroke-width: calc(2.5px * var(--zw, 1)); }
.edges-layer .edge-path.view-link.bond-marriage { stroke: var(--bond-marriage); stroke-width: calc(6.5px * var(--zw, 1)); }
