/* Menorah v5 — shared design system, mobile-first.
   Base rules target phones; layout grows through min-width layers:
     ≥640px  comfortable paddings, centered modals, desktop type scale
     ≥760px  single-row nav
     ≥880px  two-column page grids
   One design language everywhere: nav with the menorah mark, card layout,
   blue accent, trust-chain links, elder rings. */

:root {
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf0fe;
  --ink: #16223b;
  --ink-2: #5b6b85;
  --ink-3: #66758d;   /* AA contrast on white — this color carries real copy */
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e3e9f2;
  --good: #16a34a;
  --good-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --violet: #7c3aed;
  --violet-soft: #f1eafd;
  --whatsapp: #1fa855;
  --discord: #5865f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 34, 59, .05), 0 4px 14px rgba(22, 34, 59, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 19px; }

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 14px 12px calc(48px + env(safe-area-inset-bottom));
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1060px; margin: 0 auto;
  padding: 8px 12px 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand svg { color: var(--accent); }
/* Phone: links become a full-width, edge-to-edge scrollable row under the brand. */
.nav-links {
  order: 3;
  flex: 1 1 100%;
  display: flex; gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 2px -12px 0;
  padding: 0 8px 6px;
  white-space: nowrap;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--ink-2); padding: 6px 11px; border-radius: 8px; font-weight: 550;
  flex: none;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; }
.nav-links a.active { background: var(--accent-soft); color: var(--accent-strong); }
.persona { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.persona select {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13.5px;
  background: var(--card); color: var(--ink); max-width: 140px;
}
.persona-label { display: none; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title .spacer, .row .spacer { flex: 1; }
.card-sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.card + .card { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.grid-map { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
/* Grid items default to min-width:auto, which lets wide content (the network
   map) force the whole column past the viewport — allow columns to shrink so
   inner scroll containers actually scroll. */
.grid-2 > *, .grid-map > * { min-width: 0; }
.grid-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.row { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; color: var(--ink-3); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2.5px 9px;
  background: #eef1f6; color: var(--ink-2); white-space: nowrap;
}
.chip-elder { background: var(--accent-soft); color: var(--accent-strong); }
.chip-webmaster { background: var(--violet-soft); color: var(--violet); }
.chip-member { background: #eef1f6; color: var(--ink-2); }
.chip-pending { background: var(--warn-soft); color: var(--warn); }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-via { background: #f2f5fa; color: var(--ink-3); font-weight: 550; }

/* ---------- avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 650; flex: none;
  width: 34px; height: 34px; font-size: 12.5px; letter-spacing: .02em;
  user-select: none;
}
.avatar.sz-24 { width: 24px; height: 24px; font-size: 9.5px; }
.avatar.sz-28 { width: 28px; height: 28px; font-size: 10.5px; }
.avatar.sz-44 { width: 44px; height: 44px; font-size: 15px; }
.avatar.sz-64 { width: 52px; height: 52px; font-size: 18px; }
.avatar.ring { box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--accent); }
.avatar.sz-24.ring { box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px var(--accent); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -7px; box-shadow: 0 0 0 2px #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-logo { border-radius: 10px; background: var(--accent); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  padding: 9px 15px; font-size: 13.5px; font-weight: 600;   /* phone-sized tap target */
  background: var(--accent); color: #fff; font-family: inherit;
  touch-action: manipulation;
}
.btn:hover { background: var(--accent-strong); }
.btn.ghost { background: #fff; color: var(--accent-strong); border-color: #c9d7f5; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.subtle { background: #eef1f6; color: var(--ink-2); }
.btn.subtle:hover { background: #e4e9f1; }
.btn.danger { background: #fff; color: var(--bad); border-color: #f3c8c8; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { background: var(--accent); }
.btn.ghost:disabled:hover { background: #fff; }

.input, .textarea, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-family: inherit; color: var(--ink);
  background: #fff; outline: none;
  font-size: 16px;   /* ≥16px stops iOS Safari from zooming the page on focus */
}
.input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 92px; resize: vertical; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.hint.ok { color: var(--good); }
.hint.err { color: var(--bad); }

/* ---------- in-flight action bar ---------- */
.busybar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100;
  display: none; overflow: hidden; background: var(--accent-soft); pointer-events: none;
}
body.busy .busybar { display: block; }
.busybar::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: var(--accent); border-radius: 3px; animation: busy-slide 1.1s ease-in-out infinite;
}
@keyframes busy-slide { from { left: -40%; } to { left: 100%; } }
/* One action at a time: while the engine recomputes, buttons wait. */
body.busy .btn { pointer-events: none; opacity: .6; }

/* ---------- trust chain ---------- */
.trustchain { margin-top: 14px; }
.trustchain .tc-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--ink-3);
  text-transform: uppercase; margin-bottom: 7px;
}
.tc-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 2px; }
.tc-pill {
  font-size: 12.5px; font-weight: 650; color: var(--ink-2);
  background: #f0f3f9; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 11px; white-space: nowrap;
}
.tc-pill.current { background: var(--accent-soft); border-color: #c9d7f5; color: var(--accent-strong); }
a.tc-pill:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-strong); }
.tc-link { display: inline-flex; align-items: center; margin: 0 2px; color: var(--good); cursor: pointer; }
.tc-link.pending { color: var(--warn); }
.tc-link svg { display: block; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 14px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: none; background: none; font: inherit; font-weight: 600; color: var(--ink-2);
  padding: 9px 12px; cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  white-space: nowrap; touch-action: manipulation;
}
.tabs button:hover { color: var(--accent-strong); }
.tabs button.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; background: #eef1f6; border-radius: 999px; padding: 1px 7px; margin-left: 5px; color: var(--ink-3); }

/* ---------- lists ---------- */
.list-row {
  display: flex; align-items: center; gap: 8px 11px; padding: 9px 2px;
  border-bottom: 1px solid #eef2f8;
  flex-wrap: wrap;   /* chips and buttons drop below the text on narrow screens */
}
.list-row:last-child { border-bottom: none; }
.list-row .name { font-weight: 600; }
.list-row .sub { font-size: 12px; color: var(--ink-3); }
.list-main { flex: 1 1 180px; min-width: 0; }
.weight-num { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--accent-strong); font-size: 13px; }

/* ---------- member grid ---------- */
.member-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px 6px; margin-top: 12px;
}
.member-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; padding: 10px 4px; border-radius: 10px; color: var(--ink);
}
.member-cell:hover { background: var(--accent-soft); text-decoration: none; }
.member-cell .name { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.member-cell .sub { font-size: 11px; color: var(--ink-3); }

/* ---------- stats ---------- */
.stats { display: flex; gap: 18px; flex-wrap: wrap; }
.stat .num { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.stat .lbl { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }

/* ---------- weight bar ---------- */
.weightbar { margin: 10px 0 4px; }
.weightbar .track {
  position: relative; height: 9px; background: #edf1f7; border-radius: 999px; overflow: visible;
}
.weightbar .fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #4f83f1); min-width: 2px;
}
.weightbar .fill.met { background: linear-gradient(90deg, #18a457, #2fc06f); }
.weightbar .tick {
  position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-3); border-radius: 2px;
}
.weightbar .tick-label { position: absolute; top: -20px; transform: translateX(-50%); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.weightbar .legend { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; flex-wrap: wrap; }

/* ---------- scale bar: a revision challenging the current statement.
   Green grows from the left (weight backing the revision), amber from the
   right (weight standing with the current statement); the gap between them
   is elder weight that hasn't weighed in. Ratifies when green > amber. */
.scalebar { margin: 14px 0 4px; }
.scalebar .track { position: relative; height: 9px; background: #edf1f7; border-radius: 999px; }
.scalebar .fill { position: absolute; top: 0; bottom: 0; min-width: 2px; }
.scalebar .fill.for { left: 0; border-radius: 999px 0 0 999px; background: linear-gradient(90deg, #18a457, #2fc06f); }
.scalebar .fill.against { right: 0; border-radius: 0 999px 999px 0; background: linear-gradient(90deg, #e6b04a, #d18f28); }
.scalebar .legend { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; margin-top: 6px; flex-wrap: wrap; }
.scalebar .legend .for-label { color: #18794b; font-weight: 600; }
.scalebar .legend .against-label { color: #9a6a14; font-weight: 600; }
.scalebar .note { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }

/* ---------- statement / revisions ---------- */
.statement-text { white-space: pre-wrap; font-size: 14px; color: #2a3a58; overflow-wrap: break-word; }
/* word diff of a proposed revision vs the current statement */
.diff-add { background: var(--good-soft); color: #135f31; border-radius: 3px; padding: 0 1px; }
.diff-del { background: var(--bad-soft); color: var(--bad); border-radius: 3px; padding: 0 1px; text-decoration: line-through; }
.revision {
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; margin-top: 12px;
  background: #fbfcfe;
}
.revision.proposed { border-color: #c9d7f5; background: #f8faff; }
.revision .rev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-dot { width: 8px; height: 8px; background: var(--ink-3); border-radius: 50%; flex: none; }

/* ---------- feed ---------- */
.feed-item { display: flex; gap: 11px; padding: 10px 2px; border-bottom: 1px solid #eef2f8; align-items: flex-start; }
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 30px; height: 30px; flex: none; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-size: 14px; background: var(--accent-soft);
}
.feed-icon.bot { background: #edf7f0; }
.feed-icon.warn { background: var(--warn-soft); }
.feed-body { flex: 1; min-width: 0; overflow-wrap: break-word; }
.feed-time { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ---------- sync log ---------- */
.synclog { font-size: 13px; }
.synclog .list-row { padding: 7.5px 2px; }
.sync-ic {
  width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.sync-ic.add, .sync-ic.role-restore { background: var(--good-soft); color: var(--good); }
.sync-ic.remove { background: var(--bad-soft); color: var(--bad); }
.sync-ic.soft-remove { background: var(--warn-soft); color: var(--warn); }
.sync-ic.pending { background: #eef1f6; color: var(--ink-3); }
.sync-ic.pending-removal { background: var(--warn-soft); color: var(--warn); }
.sync-ic.reaffirmed { background: var(--good-soft); color: var(--good); }
.sync-ic.failed { background: var(--bad-soft); color: var(--bad); }

/* ---------- platform ---------- */
.platform-ic {
  width: 34px; height: 34px; border-radius: 9px; display: inline-flex; flex: none;
  align-items: center; justify-content: center; color: #fff;
}
.platform-ic.whatsapp { background: var(--whatsapp); }
.platform-ic.discord { background: var(--discord); }
.platform-ic.sm { width: 20px; height: 20px; border-radius: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-dot.ok { background: var(--good); }
.status-dot.warn { background: #eab308; }
/* Phones: the roster scrolls sideways inside the card instead of breaking it. */
.roster-table {
  width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px;
  display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap;
}
.roster-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 650;
}
.roster-table td { padding: 7px 8px; border-bottom: 1px solid #eef2f8; }
.roster-table tr:last-child td { border-bottom: none; }

/* ---------- steps (group setup) ---------- */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-weight: 600; font-size: 13px; }
.step .dot {
  width: 26px; height: 26px; border-radius: 50%; background: #e8edf5; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700;
}
.step.active { color: var(--accent-strong); }
.step.active .dot { background: var(--accent); color: #fff; }
.step.done { color: var(--good); }
.step.done .dot { background: var(--good-soft); color: var(--good); }
.step-line { flex: 1; height: 2px; background: var(--line); min-width: 14px; border-radius: 2px; }

/* ---------- choice cards ---------- */
.choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.choice {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 13px; cursor: pointer;
  background: #fff; text-align: left; font: inherit;
  touch-action: manipulation;
}
.choice:hover { border-color: #b9cdf7; }
.choice.selected { border-color: var(--accent); background: #f8faff; box-shadow: 0 0 0 3px var(--accent-soft); }
.choice .t { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.choice .d { font-size: 12px; color: var(--ink-2); margin-top: 5px; }

/* ---------- callouts ---------- */
.callout {
  border-radius: 10px; padding: 11px 14px; font-size: 13px; margin: 10px 0;
  background: var(--accent-soft); color: #23407e; border: 1px solid #d4e0fa;
  overflow-wrap: break-word;
}
.callout.warn { background: var(--warn-soft); color: #7a4a08; border-color: #f4dfba; }
.callout.good { background: var(--good-soft); color: #135f31; border-color: #cfe9d8; }

/* ---------- search ---------- */
.search-wrap { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 300px; overflow: auto; padding: 4px;
}
.search-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; }
.search-item:hover { background: var(--accent-soft); }

/* ---------- toast & modal ---------- */
.toast-wrap {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 16px; font-size: 13.5px;
  box-shadow: 0 8px 26px rgba(22, 34, 59, .35); max-width: 560px; animation: rise .18s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Phones: modals are bottom sheets. */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(22, 34, 59, .45); z-index: 80;
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.modal {
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  width: 100%; max-width: 100%; max-height: 88vh; overflow: auto;
}

/* ---------- network map ---------- */
.map-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.map-svg { width: 100%; height: auto; display: block; min-width: 640px; }
.map-node { cursor: pointer; }
.map-node circle { fill: #dbe7fd; stroke: var(--accent); stroke-width: 1.6; }
.map-node:hover circle { fill: #c3d7fb; }
.map-node.selected circle { fill: var(--accent); }
.map-node.selected text.hdl { fill: var(--accent-strong); font-weight: 700; }
.map-node text { font-size: 11px; fill: var(--ink-2); text-anchor: middle; }
.map-node text.cnt { fill: var(--accent-strong); font-weight: 700; }
.map-node.selected text.cnt { fill: #fff; }
.map-edge { stroke: #b9c6dd; stroke-width: 1.6; fill: none; }
.map-edge.pending { stroke-dasharray: 4 4; stroke: #d9b46a; }
.map-cross { stroke: var(--accent); stroke-width: 1.1; fill: none; stroke-dasharray: 3 4; opacity: .55; }
.map-cross-hit { stroke: transparent; stroke-width: 16; fill: none; cursor: pointer; }
.map-cross-hit:hover + .map-cross, .map-cross.hover { opacity: 1; stroke-width: 2.2; }
.map-node text.kind { font-size: 9.5px; fill: var(--ink-3); }
.node-badge circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; }
.node-badge text { font-size: 9px; fill: var(--accent-strong); font-weight: 700; text-anchor: middle; }

/* network explorer: breadcrumbs + lens toggle */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.crumbs .sep { color: var(--ink-3); font-size: 12px; }
.lens-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.lens-toggle button {
  border: none; background: transparent; padding: 6px 14px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.lens-toggle button.active { background: var(--accent); color: #fff; }

/* geographic lens */
.geo-sea { fill: #f2f6fc; }
.geo-land { fill: #e4ebf6; stroke: #d3ddec; stroke-width: .6; }
.geo-grid { stroke: #dde5f0; stroke-width: .55; }
.geo-radius { fill: var(--accent); opacity: .06; }
.geo-radius-line { fill: none; stroke: var(--accent); stroke-width: .8; stroke-dasharray: 3 3; opacity: .45; }
.geo-pin { cursor: pointer; }
.geo-pin circle.dot { fill: var(--accent); stroke: #fff; stroke-width: 1.6; }
.geo-pin:hover circle.dot { fill: var(--accent-strong); }
.geo-pin.selected circle.dot { fill: var(--accent-strong); stroke: #ffd766; stroke-width: 2; }
.geo-pin.derived circle.dot { fill: #fff; stroke: var(--accent); stroke-dasharray: 2.5 2; stroke-width: 1.4; }
.geo-pin.home circle.dot { fill: var(--violet); }
.geo-pin text.hdl { font-size: 11px; font-weight: 650; fill: var(--ink); text-anchor: middle; }
.geo-pin text.kind { font-size: 9.5px; fill: var(--ink-3); text-anchor: middle; }
.geo-picker { cursor: crosshair; border: 1px solid var(--line); border-radius: 10px; width: 100%; height: auto; display: block; }

/* endorsement (dots + arrows) views */
.pair-disc { fill: #f4f7fd; stroke: #c9d7ef; stroke-width: 1.4; }
.pair-title { font-size: 13px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.pair-sub { font-size: 10px; fill: var(--ink-3); text-anchor: middle; }
.dot-person { cursor: pointer; }
.dot-person circle { fill: #fff; stroke: var(--ink-3); stroke-width: 1.2; }
.dot-person.elder circle { stroke: var(--accent); stroke-width: 2; }
.dot-person text { font-size: 8.5px; font-weight: 700; fill: var(--ink-2); text-anchor: middle; }
.dot-person text.nm { font-size: 8px; font-weight: 500; fill: var(--ink-3); }
.endorse-arrow { stroke: var(--accent); stroke-width: 1.1; fill: none; opacity: .55; }
.endorse-arrow.mutual { opacity: .85; stroke-width: 1.6; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 26px 10px; font-size: 13.5px; }
.footer { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 30px; }
.footer a { color: var(--ink-3); text-decoration: underline; }
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: #eef1f6; border-radius: 6px; padding: 1px 6px;
}
.banner-you {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent-soft);
  border: 1px solid #c9d7f5; color: var(--accent-strong); font-weight: 650;
  border-radius: 999px; font-size: 12.5px; padding: 4px 12px;
}
.demo-step { display: flex; gap: 10px; padding: 7px 0; }
.demo-step .n {
  width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent-strong); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center;
}

/* ---------- Google map (map-first views) ---------- */
.gmap-canvas { width: 100%; }
.gmap-label {
  text-shadow: 0 1px 2px #fff, 0 -1px 2px #fff, 1px 0 2px #fff, -1px 0 2px #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.map-hero { padding: 0; overflow: hidden; }
.map-hero .hero-head {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding: 14px 16px 10px;
}
.map-hero .hero-head .card-sub { flex-basis: 100%; margin-top: 0; }
.map-hero .map-host { border-top: 1px solid var(--line); }
.map-foot {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 9px 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); background: #fbfcfe;
}
.pin-strip {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 11px 16px; border-top: 1px solid var(--line); background: #f8faff;
}
.pin-strip .name { font-weight: 650; }

/* network legend chips — one per root network, click to isolate */
.net-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 650; border-radius: 999px; padding: 4px 12px;
  background: #fff; border: 1.5px solid var(--line); color: var(--ink-2);
  font-family: inherit; touch-action: manipulation;
}
.net-chip .swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.net-chip.on { border-color: currentColor; background: #f4f7fd; }
.net-chip:not(.on) { opacity: .55; }

/* kind filter chips — the bottom-up vocabulary as map filters */
.kind-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.kind-chip {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 3px 11px; touch-action: manipulation;
}
.kind-chip:hover { border-color: #b9cdf7; }
.kind-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.kind-chip .n { color: var(--ink-3); font-weight: 550; margin-left: 3px; }
.kind-chip.on .n { color: var(--accent-strong); }

/* visibility scope ladder — the parent chain as the sharing dial */
.scope-ladder { margin-top: 4px; }
.scope-rung {
  display: flex; align-items: flex-start; gap: 11px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 13px;
  margin-bottom: 8px; background: #fff; position: relative;
}
.scope-rung:hover { border-color: #b9cdf7; }
.scope-rung.selected { border-color: var(--accent); background: #f8faff; box-shadow: 0 0 0 3px var(--accent-soft); }
.scope-rung input { margin-top: 3px; accent-color: var(--accent); }
.scope-rung .t { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.scope-rung .d { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.scope-rung .aud {
  margin-left: auto; font-size: 11.5px; font-weight: 650; color: var(--ink-3);
  white-space: nowrap; padding-top: 2px;
}
.scope-rung.selected .aud { color: var(--accent-strong); }
.scope-rung.public-rung .t { color: var(--good); }
.scope-rung:not(:last-child)::after {
  content: ''; position: absolute; left: 19px; bottom: -9px; width: 2px; height: 9px;
  background: var(--line);
}
.see-preview {
  border-radius: 10px; padding: 11px 14px; font-size: 13px;
  background: var(--accent-soft); color: #23407e; border: 1px solid #d4e0fa;
}
.see-preview b { color: var(--accent-strong); }

/* ============================================================
   ≥640px — comfortable paddings, centered modals, desktop type
   ============================================================ */
@media (min-width: 640px) {
  h2 { font-size: 21.5px; }
  .container { padding: 22px 20px 60px; }
  .card { padding: 18px 20px; margin-bottom: 18px; }
  .grid-2, .grid-map { gap: 18px; }
  .avatar.sz-64 { width: 64px; height: 64px; font-size: 22px; }
  .btn { padding: 8px 14px; }
  .btn.sm { padding: 4.5px 10px; }
  .input, .textarea, select.input { font-size: 13.5px; padding: 8.5px 11px; }
  .stats { gap: 26px; }
  .stat .num { font-size: 21px; }
  .stat .lbl { font-size: 11.5px; }
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px 8px; }
  .choice-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .grid-cols { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .tabs { margin-bottom: 18px; }
  .tabs button { padding: 9px 14px; }
  .steps { margin-bottom: 20px; }
  .step-line { min-width: 18px; }
  .search-item { padding: 8px 10px; }
  .toast-wrap { left: 50%; right: auto; transform: translateX(-50%); bottom: 20px; }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { width: 460px; border-radius: 14px; padding: 22px; max-height: 90vh; }
  .map-svg { min-width: 0; }
  .footer { margin-top: 34px; }
}

/* ============================================================
   ≥760px — single-row nav
   ============================================================ */
@media (min-width: 760px) {
  .nav-inner { padding: 10px 20px; flex-wrap: nowrap; gap: 18px; }
  .nav-links {
    order: 0; flex: 1 1 auto; margin: 0; padding: 0;
    overflow: visible; white-space: normal; gap: 4px;
  }
  .persona { margin-left: 0; gap: 9px; }
  .persona-label { display: inline; }
  .persona select { max-width: 190px; }
}

/* ============================================================
   ≥880px — two-column page grids
   ============================================================ */
@media (min-width: 880px) {
  .grid-2 { grid-template-columns: 1.6fr 1fr; }
  .grid-map { grid-template-columns: 2fr 1fr; }
}
