:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1d2430;
  --muted: #5d6675;
  --border: #e2ddd2;
  --primary: #1f3a5f;
  --primary-ink: #ffffff;
  --accent: #b5832a;
  --danger: #b3261e;
  --ok: #2e7d4f;
  --warn-bg: #fff4dc;
  --warn-ink: #7a5300;
  --chip: #e8eef6;
  --chip-ink: #1f3a5f;
  --c-event: #1f6fb2;
  --c-bday: #c2185b;
  --c-anniv: #8e44ad;
  --c-care: #2e7d4f;
  --c-task: #b5832a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --surface: #1b212b; --surface-2: #232a36; --text: #e9edf3; --muted: #a3acba;
    --border: #2e3644; --primary: #8fb4e3; --primary-ink: #0d1726; --accent: #e0b25a;
    --danger: #f2817a; --ok: #6fcf97; --warn-bg: #3a2f17; --warn-ink: #f3d08a;
    --chip: #253246; --chip-ink: #bcd3f0; --c-event: #6aaee8; --c-bday: #f48fb1; --c-anniv: #c39bd3;
    --c-care: #6fcf97; --c-task: #e0b25a; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --surface: #1b212b; --surface-2: #232a36; --text: #e9edf3; --muted: #a3acba;
  --border: #2e3644; --primary: #8fb4e3; --primary-ink: #0d1726; --accent: #e0b25a;
  --danger: #f2817a; --ok: #6fcf97; --warn-bg: #3a2f17; --warn-ink: #f3d08a;
  --chip: #253246; --chip-ink: #bcd3f0; --c-event: #6aaee8; --c-bday: #f48fb1; --c-anniv: #c39bd3;
  --c-care: #6fcf97; --c-task: #e0b25a; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body.noscroll { overflow: hidden; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 0 16px calc(96px + var(--safe-b)); max-width: 820px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0px)) 0 10px;
}
.topbar .titles { flex: 1; min-width: 0; }
.topbar .church { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { text-decoration: none; font-size: 1.6rem; line-height: 1; padding: 4px 8px 4px 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px;
  font-size: .72rem; color: var(--muted); text-decoration: none;
}
.tabbar a.on { color: var(--primary); font-weight: 600; }
.tabbar svg, .sidebar svg, .menu svg { width: 24px; height: 24px; }
.menu-btn .badge-dot[data-n]::after { top: -2px; right: -4px; }
.badge-dot { position: relative; }
.badge-dot[data-n]::after {
  content: attr(data-n); position: absolute; top: -4px; right: -10px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .65rem;
  font-weight: 700; line-height: 17px; text-align: center;
}

/* Phones: no bottom bar (it collides with the Netlify badge). The sidebar becomes a pull-out menu,
   opened with the shepherd's-crook button at the top left. */
.tabbar { display: none !important; }
.menu-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 42px; height: 42px; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer;
}
.menu-btn img { width: 38px; height: 38px; border-radius: 10px; display: block; }
.drawer-bg { position: fixed; inset: 0; z-index: 39; background: rgba(10, 15, 25, .45); }
@media (max-width: 899px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 2px; position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
    width: min(300px, 84vw); padding: calc(16px + env(safe-area-inset-top, 0px)) 12px calc(20px + var(--safe-b));
    background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 30px rgba(0, 0, 0, .25);
  }
  .sidebar.open { transform: none; }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; font-weight: 700; }
  .sidebar .brand img { width: 34px; height: 34px; border-radius: 8px; }
  .sidebar a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 1.02rem; }
  .sidebar a.on { background: var(--chip); color: var(--chip-ink); font-weight: 600; }
  .sidebar svg { width: 24px; height: 24px; }
}
@media (min-width: 900px) {
  .menu-btn, .drawer-close, .drawer-bg { display: none !important; }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px; width: 230px; flex-shrink: 0; padding: 20px 12px;
    position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--border); background: var(--surface);
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; }
  .sidebar .brand img { width: 34px; height: 34px; border-radius: 8px; }
  .sidebar a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--text); text-decoration: none;
  }
  .sidebar a.on { background: var(--chip); color: var(--chip-ink); font-weight: 600; }
  .main { padding: 8px 32px 48px; }
}

/* ---------- building blocks ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 0 0 14px; overflow: hidden;
}
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.card-head h2 { flex: 1; font-size: 1.02rem; }
.card-head a { font-size: .9rem; text-decoration: none; }
.card-body { padding: 4px 16px 14px; }
.empty { color: var(--muted); padding: 6px 16px 16px; font-size: .95rem; }

.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border);
  color: inherit; text-decoration: none; min-height: 56px; background: none; width: 100%; text-align: left;
  border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer;
}
.card-head + .row, .card > .row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: .88rem; margin-top: 1px; overflow-wrap: anywhere; }
.chev { color: var(--muted); font-size: 1.3rem; }
.when { flex-shrink: 0; text-align: right; font-size: .85rem; color: var(--muted); min-width: 64px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.t-event { background: var(--c-event); } .t-birthday { background: var(--c-bday); }
.t-anniversary { background: var(--c-anniv); } .t-care { background: var(--c-care); } .t-task { background: var(--c-task); }

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--chip); color: var(--chip-ink); vertical-align: middle; white-space: nowrap;
}
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip.private { background: var(--surface-2); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 0 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.icon-btn { background: none; border: 0; font-size: 1.3rem; padding: 6px 8px; cursor: pointer; color: var(--muted); }
.fab {
  position: fixed; right: 18px; bottom: calc(76px + var(--safe-b)); z-index: 9; width: 56px; height: 56px;
  border-radius: 50%; border: 0; background: var(--primary); color: var(--primary-ink); font-size: 1.9rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25); cursor: pointer;
}
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }

.seg { display: flex; background: var(--surface-2); border-radius: 11px; padding: 3px; margin: 0 0 14px; overflow-x: auto; }
.seg button {
  flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 9px; font-size: .9rem;
  font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.search {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); margin: 0 0 12px;
}
.banner {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius);
  background: var(--warn-bg); color: var(--warn-ink); margin: 0 0 14px; font-size: .93rem;
}
.banner .grow { flex: 1; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; padding: 4px 16px 14px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.contact-actions { display: flex; gap: 8px; padding: 0 16px 14px; flex-wrap: wrap; }

/* prayer cards */
.prayer { padding: 14px 16px; border-top: 1px solid var(--border); }
.card > .prayer:first-child, .card-head + .prayer { border-top: 0; }
.prayer .p-title { font-weight: 600; font-size: 1.02rem; }
.prayer .p-for { color: var(--muted); font-size: .9rem; }
.prayer .p-details { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.prayer .p-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: .82rem; color: var(--muted); }
.prayer .p-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* tasks */
.checkbox {
  width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--muted); background: none;
  flex-shrink: 0; cursor: pointer; display: grid; place-items: center; color: var(--primary-ink); padding: 0;
}
.task.done .checkbox { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .row-title { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--danger); font-weight: 600; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px; }
.cal-head h2 { flex: 1; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); padding: 4px 8px 10px; }
.cal-dow { text-align: center; font-size: .72rem; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-day {
  aspect-ratio: 1 / 1; border: 0; background: none; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; padding-top: 6px; gap: 3px; cursor: pointer; font-size: .92rem;
  min-height: 40px;
}
.cal-day.out { color: var(--muted); opacity: .45; }
.cal-day.today { font-weight: 800; color: var(--primary); }
.cal-day.sel { background: var(--primary); color: var(--primary-ink); }
.cal-day .dots { display: flex; gap: 2px; }
.cal-day .dot { width: 6px; height: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 16px 12px; font-size: .78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* group chat */
.chat-list { max-height: 55vh; overflow-y: auto; padding: 4px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-day { align-self: center; font-size: .72rem; color: var(--muted); margin: 8px 0 2px; }
.bubble { max-width: 82%; align-self: flex-start; background: var(--surface-2); border-radius: 16px 16px 16px 4px; padding: 8px 12px; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-radius: 16px 16px 4px 16px; }
.bubble.mine a { color: inherit; }
.bubble .who { font-size: .75rem; font-weight: 700; color: var(--c-event); margin-bottom: 2px; }
.bubble .at { font-size: .68rem; opacity: .7; text-align: right; margin-top: 2px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; min-height: 44px; max-height: 140px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 16px; resize: vertical; }

/* follow-up stages */
.stage-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* more menu */
.menu a { display: flex; align-items: center; gap: 14px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 380px; text-align: center; }
.login-box img { width: 84px; height: 84px; border-radius: 20px; margin-bottom: 10px; }
.login-box h1 { margin-bottom: 4px; }
.login-box p { color: var(--muted); margin: 0 0 20px; }
.login-box form { text-align: left; }
.login-box .btn { width: 100%; margin-top: 6px; }

/* forms + modal */
.field { margin: 0 0 14px; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font-size: 16px;
}
.field textarea { resize: vertical; min-height: 90px; }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
.check input { width: 22px; height: 22px; }
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 15, 25, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.sheet form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
@media (min-width: 640px) { .modal { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; padding: 14px 16px 8px; }
.sheet-head h2 { flex: 1; }
.sheet-body { padding: 8px 16px; overflow-y: auto; flex: 1; }
.sheet-foot {
  display: flex; gap: 8px; align-items: center; padding: 12px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); z-index: 60;
  background: #1d2430; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: .93rem;
  max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.splash { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.splash img { border-radius: 16px; margin: 0 auto; }

/* printable pages (public prayer list, meeting minutes) */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .sidebar, .tabbar, .fab, .topbar, .no-print, .banner, .drawer-bg { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  .print-only { display: block; }
  .row, .prayer { border-color: #ccc; }
}

/* ---------- Phase 7: Home feed, coming-up strip, conversations */
.feed .feed-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px 16px; border: 0; border-top: 1px solid var(--border);
  background: transparent; color: inherit; text-align: left; text-decoration: none; font: inherit; cursor: pointer; }
.feed div.feed-item { cursor: default; }
.feed .feed-item:first-of-type { border-top: 0; }
.feed .feed-item.new { background: color-mix(in srgb, var(--c-event) 7%, transparent); box-shadow: inset 3px 0 0 var(--c-event); }
.feed .feed-item.pinned { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.feed-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 1.1rem; }
.feed-main { flex: 1; min-width: 0; }
.feed-kind { font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
.feed-title { font-weight: 650; line-height: 1.3; }
.feed-text { color: var(--muted); font-size: .93rem; margin-top: 3px; overflow-wrap: anywhere; }
.feed-text.pre { color: var(--text); }
.feed-new { display: inline-block; background: var(--c-event); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .68rem; font-weight: 700; vertical-align: 1px; }
.feed .chev { align-self: center; }
.strip-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 8px; }
.strip-head h2 { font-size: 1rem; margin: 0; }
.strip-head a { font-size: .9rem; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 4px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.strip-card { flex: none; width: 148px; scroll-snap-align: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 12px; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.strip-date { display: flex; align-items: baseline; gap: 6px; color: var(--c-event); margin-bottom: 4px; }
.strip-date span { font-size: .78rem; text-transform: uppercase; font-weight: 700; letter-spacing: .03em; }
.strip-date b { font-size: 1.3rem; }
.strip-title { font-weight: 650; font-size: .93rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.strip-sub { font-size: .78rem; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--chip); color: var(--chip-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; margin-right: 10px; }
.prayer.is-new { box-shadow: inset 3px 0 0 var(--c-event); }
.access-row select { flex: none; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; }

/* ---------- Phase 8: address lookup, maps, prayer lists */
.addr { position: relative; }
.addr-sugg { position: absolute; left: 0; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); margin-top: 4px; overflow: hidden; }
.addr-sugg button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; }
.addr-sugg button:first-child { border-top: 0; }
.addr-sugg button:hover, .addr-sugg button:focus { background: var(--surface-2); }
.addr-map .mini-map { margin-top: 8px; }
.mini-map { display: block; width: 100%; border: 0; border-radius: 10px; background: var(--surface-2); margin: 8px 0 4px; }
.addr-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.people-map { height: min(62vh, 520px); border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2); z-index: 0; }
.pin { width: 22px; height: 22px; border-radius: 50%; background: var(--c-event); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
  color: #fff; font: 700 11px/16px system-ui, sans-serif; text-align: center; }
.pin-new { background: var(--accent); }
.pin-church { width: 28px; height: 28px; background: #fff; border-color: var(--primary); font-size: 15px; line-height: 22px; }
.leaflet-popup-content a { color: #1f6fb2; }
@media print { .list-item .p-actions, .mini-map, .addr-links { display: none !important; } }
.mini-map { position: relative; overflow: hidden; text-decoration: none; }
.mini-map .mm-tiles { position: absolute; left: 50%; top: 50%; }
.mini-map .mm-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; }
.mini-map .mm-pin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -18px 0 0 -9px; background: #d93025;
  border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.mini-map .mm-credit { position: absolute; right: 4px; bottom: 2px; font-size: 10px; color: #333; background: rgba(255,255,255,.75); padding: 0 4px; border-radius: 4px; }

/* ---------- Phase 9 */
.form-heading { margin: 14px 0 2px; }
.form-heading label { font-size: 1rem; }
.fam-row { gap: 8px; }
.fam-role { flex: none; max-width: 150px; min-height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 6px; font: inherit; font-size: .88rem; }
.pin-me { width: 16px; height: 16px; border-radius: 50%; background: #1f6fb2; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(31,111,178,.35); }
.maplibregl-popup-content { color: #1d2430; font: 14px/1.4 system-ui, sans-serif; }
.maplibregl-popup-content a { color: #1f6fb2; }
.mini-map .maplibregl-ctrl-attrib { font-size: 10px; }

/* ---------- Phase 10: Bible reading, study notes, devotions, document reader */
.bible .card-body { padding-top: 14px; }
.bible { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-size: 1.08rem; line-height: 1.65; }
.bible .bch { font-family: inherit; font-size: 1.25rem; margin: 6px 0 8px; }
.bible .bhead { font-family: system-ui, sans-serif; font-size: .92rem; font-weight: 700; margin: 16px 0 6px; color: var(--muted); }
.bible .bp { margin: 0 0 10px; }
.bible .bq { margin: 0 0 6px; padding-left: 1.4em; text-indent: -1.4em; }
.bible .bq .q2 { display: inline-block; padding-left: 1.6em; text-indent: 0; }
.bible .vn { font-family: system-ui, sans-serif; font-size: .62em; font-weight: 700; color: var(--c-event); margin-right: 3px; }
.bible .bq.first .vn, .bible .bp:first-of-type .vn:first-child { font-size: .9em; }
.bible small { font-size: .78em; letter-spacing: .03em; }
.bible sup.fn { font-family: system-ui, sans-serif; font-size: .6em; color: var(--muted); }
.snote { margin: 4px 0 12px; border-left: 3px solid var(--c-event); background: var(--surface-2); border-radius: 0 10px 10px 0; font-family: system-ui, sans-serif; font-size: .9rem; line-height: 1.5; }
.snote > summary { cursor: pointer; padding: 6px 10px; font-weight: 600; color: var(--c-event); list-style: none; }
.snote > summary::-webkit-details-marker { display: none; }
.snote-body { padding: 0 12px 8px; }
.snote-body p { margin: 0 0 8px; }
.devo { margin: 14px 0 18px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-family: system-ui, sans-serif; font-size: .95rem; line-height: 1.55; }
.devo-head { font-weight: 700; margin-bottom: 6px; }
.devo p { margin: 0 0 8px; }
.bfns { font-family: system-ui, sans-serif; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 10px; padding-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip-btn.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.check-btn { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: transparent; color: #fff; font-weight: 700; margin-right: 10px; cursor: pointer; }
.check-btn.on { background: var(--ok); border-color: var(--ok); }
.daynav { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.daynav select { min-height: 40px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 8px; font: inherit; }
.doc-text { font-size: 1.02rem; line-height: 1.6; }
.bible-intro h4 { margin: 14px 0 4px; }
.bible-intro p { margin: 0 0 10px; line-height: 1.55; }
.snote-gist { font-weight: 400; color: var(--muted); margin-left: 4px; }
a.sref { color: var(--c-event); text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; }
a.fnref, a.fnback { color: var(--c-event); text-decoration: none; font-weight: 700; padding: 0 1px; }
.proof-ref { margin: 8px 0 2px; font-weight: 600; }
.proof-text { margin: 0 0 4px 1.2em; font-size: .92em; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--accent) 40%, transparent); } 100% { background: transparent; } }
.bible .hl { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; }
.bible sup.fn a { color: var(--c-event); text-decoration: none; }
.bfns a { color: var(--c-event); text-decoration: none; }

/* ---- Phase 12: reader View settings, confession links */
.topbar .view-btn { flex: none; }
.conf-refs { margin: 2px 0 10px; font-family: system-ui, sans-serif; font-size: .82rem; line-height: 1.6; color: var(--muted); }
.conf-refs a, a.cref { color: var(--c-prayer, #8a5a00); text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; }
.snote.conf { border-left-color: var(--c-prayer, #b07a1a); }
.vref { font-family: system-ui, sans-serif; font-weight: 700; font-size: .85rem; margin: 14px 0 4px; color: var(--muted); }
.vref.hl { color: var(--text); }
.lit-slot.now { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.svc-date { padding: 8px 16px 4px; border-top: 1px solid var(--border); }
.svc-day { font-weight: 700; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.svc-slot { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: .92rem; }
.svc-who { display: inline-block; margin: 2px 10px 0 0; }
.link-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: .8rem; }
mark.conf-hl, .conf-hl-key { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.proof-ref.hl { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; }

/* ---- Phase 13: personal tools */
.dot.t-mine, .legend .t-mine { background: #8e6bbf; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); font-weight: 700; font-size: .85rem; margin-right: 10px; }
/* Tasks */
.todo-add { display: flex; gap: 8px; margin: 0 0 12px; }
.todo-add input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.todo { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); transition: opacity .25s, transform .25s; }
.card .todo:first-of-type { border-top: 0; }
.todo.checking { opacity: .3; transform: translateX(14px); }
.todo-check { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--muted); background: none; color: #fff; font-size: .8rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.todo-check:hover { border-color: var(--primary); }
.todo.done .todo-check, .todo.checking .todo-check { background: var(--ok, #2e7d4f); border-color: var(--ok, #2e7d4f); }
.todo-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.todo-title { font-weight: 500; overflow-wrap: anywhere; }
.todo.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-sub { font-size: .8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.todo-sub:empty { display: none; }
.due.late { color: var(--danger); font-weight: 600; }
.due.today { color: var(--accent); font-weight: 600; }
.star { color: var(--accent); }
/* Notes */
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0 0 14px; }
.note-card { display: block; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; min-height: 90px; }
.note-card:hover { border-color: var(--primary); }
.note-card-title { font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }
.note-card-snip { font-size: .86rem; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note-card-meta { font-size: .75rem; margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.nc-yellow { background: color-mix(in srgb, #f4d35e 18%, var(--surface)); } .nc-green { background: color-mix(in srgb, #6fcf97 16%, var(--surface)); }
.nc-blue { background: color-mix(in srgb, #6fa8dc 18%, var(--surface)); } .nc-pink { background: color-mix(in srgb, #f28dbb 16%, var(--surface)); }
.nc-purple { background: color-mix(in srgb, #a98bd6 18%, var(--surface)); }
.note-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
.note-bar select { width: auto; max-width: 160px; padding: 6px 8px; font-size: .85rem; }
.note-title-in { width: 100%; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.35rem; font-weight: 700; padding: 4px 0 8px; outline: none; }
.note-tools { display: flex; gap: 2px; flex-wrap: wrap; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 0; margin-bottom: 8px; position: sticky; top: 64px; background: inherit; z-index: 2; }
.note-tools .btn { min-width: 36px; padding: 4px 8px; }
.note-body-in { width: 100%; min-height: 240px; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.02rem; line-height: 1.6; resize: none; outline: none; padding: 0; }
.note-tags-in { width: 100%; border: 0; border-top: 1px dashed var(--border); background: none; color: var(--muted); font: inherit; font-size: .88rem; padding: 10px 0 0; outline: none; }
.note-view-title { margin: 0 0 8px; font-size: 1.35rem; }
.note-view { font-size: 1.02rem; line-height: 1.6; cursor: text; overflow-wrap: anywhere; }
.note-view p { margin: 0 0 10px; }
.note-view .note-h { margin: 14px 0 6px; }
.note-view blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; font-style: italic; }
.note-view ul, .note-view ol { margin: 0 0 10px; padding-left: 22px; }
.note-view li.check-li { list-style: none; margin-left: -22px; display: flex; gap: 8px; align-items: flex-start; }
.note-view li.check-li input { margin-top: 5px; width: 17px; height: 17px; flex: none; }
.note-view li.check-li.done span { text-decoration: line-through; color: var(--muted); }
.note-view mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.note-view code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.note-view hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
a.fnref, sup.fnmark { vertical-align: super; font-size: .72em; line-height: 0; }
a.fnref.cite-n { margin-left: 1px; }
sup.fnmark { color: var(--muted); }
