/* Clean neutral theme: white surfaces, grey lines, near-black actions.
   Color is reserved for meaning: status dots, region dots, transit bullets and merit badges. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --subtle: #f6f7f8;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --primary: #111827;
  --primary-hover: #000000;
  --accent: #2563eb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --violet: #7c3aed;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-hover: 0 6px 20px rgba(17, 24, 39, .08);
  --shadow-lg: 0 20px 50px rgba(17, 24, 39, .16);
  --font: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: .35em 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
[hidden] { display: none !important; }
.boot { padding: 4rem; text-align: center; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar (portal) and site header (directory) ---------- */
.topbar, .site-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .65rem 1.5rem; padding-top: max(.65rem, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; text-decoration: none; color: var(--ink); white-space: nowrap; flex: none; }
.brand strong { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; gap: .15rem; }
.nav a { color: var(--muted); text-decoration: none; padding: .45rem .8rem; border-radius: 8px; font-weight: 550; font-size: .93rem; }
.nav a:hover { color: var(--ink); background: var(--subtle); }
.nav a.active { color: var(--ink); background: var(--subtle); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.top-link { color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 550; white-space: nowrap; }
.top-link:hover { color: var(--ink); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 1.3rem; text-decoration: none;
}
.icon-btn:hover { background: var(--subtle); color: var(--ink); }
.bell .count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}
.user-chip { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; padding: .2rem .6rem .2rem .2rem; border-radius: 999px; }
.user-chip:hover { background: var(--subtle); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: .76rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; max-width: 220px; }
.user-meta strong { font-size: .88rem; font-weight: 600; }
.user-meta small { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view-as { display: flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.view-as select { padding: .35rem 1.8rem .35rem .65rem; font-size: .85rem; max-width: 240px; }

.strip { display: flex; align-items: center; justify-content: center; gap: .9rem; flex-wrap: wrap; padding: .45rem 1rem; font-size: .84rem; font-weight: 550; text-align: center; background: var(--ink); color: #f3f4f6; }
.strip a { color: #fff; font-weight: 650; text-underline-offset: 3px; }
.strip.preview { position: sticky; top: 59px; z-index: 19; }
.strip.preview::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; }
.strip .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.strip .btn:hover { background: rgba(255, 255, 255, .1); border-color: #fff; }

main { outline: none; }
.page { max-width: 1240px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .muted { margin-top: .2rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---------- Buttons, pills, tags ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--subtle); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--subtle); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: .32rem .7rem; font-size: .83rem; border-radius: 7px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.link { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; font-weight: 550; }
.link:hover { text-decoration-color: var(--ink); }
.link.danger { color: var(--red); text-decoration-color: currentColor; }

/* Status pills: white with a colored dot. No tinted backgrounds. */
.pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .16rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
}
.pill.soft, .pill.muted { color: var(--muted); }
.pill.plant::before, .out-ok::before, .out-due::before, .out-overdue::before, .out-never::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; flex: none;
}
.pill.plant::before, .out-ok::before { background: var(--green); }
.out-due::before { background: var(--amber); }
.out-overdue::before { background: var(--red); }
.out-overdue { color: #b91c1c; border-color: #fecaca; }
.out-never::before { background: var(--violet); }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; border: 1px solid var(--line); font-size: .75rem; font-weight: 550; color: var(--ink-2); }

.region-tag { display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.region-tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--region); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .5rem; flex: none; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .9rem; margin-bottom: 1.4rem; }
.tile {
  display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); }
.tile span { order: -1; font-size: .8rem; font-weight: 600; color: var(--muted); }
.tile strong { font-size: 1.9rem; line-height: 1.15; letter-spacing: -.03em; font-weight: 700; }
.tile small { color: var(--muted); font-size: .8rem; }
.tile.alert strong { color: var(--red); }
.tile.warn strong { color: var(--amber); }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; margin-bottom: 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink); }
.banner.warn { display: block; border-left-color: var(--amber); }

/* ---------- Panels ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.15rem; align-items: start; }
.col { display: grid; gap: 1.15rem; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; min-width: 0; }
.panel > h2 { margin-bottom: .8rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .8rem; flex-wrap: wrap; }
.panel-head a { color: var(--ink); text-decoration: none; font-weight: 600; }
.panel-head a:hover { text-decoration: underline; }

.task-list, .activity, .plain-list, .people-list, .notif-list, .timeline { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: .65rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.task-list li:first-child { border-top: 0; }
.task-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.task-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-title:hover { text-decoration: underline; }
.icon-btn.call { font-size: 1rem; width: 32px; height: 32px; }
.activity li { padding: .6rem 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.activity li:first-child { border-top: 0; }
.activity a { font-weight: 600; color: var(--ink); text-decoration: none; }
.activity a:hover { text-decoration: underline; }
.plain-list li { padding: .3rem 0; }
.plain-list a { color: var(--ink); font-weight: 550; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--subtle); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { color: var(--ink); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.table a:hover { text-decoration: underline; }
.table.compact td { padding: .45rem .5rem; }
.table tr.inactive td { opacity: .5; }
.row-actions { display: flex; gap: .9rem; justify-content: flex-end; }

.meter { display: inline-flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.meter-bar { width: 84px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; display: inline-block; }
.meter-bar > span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }

/* ---------- Inputs, filters, cards ---------- */
input, select, textarea {
  font: inherit; font-size: .93rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: .5rem .75rem; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 24, 39, .08); }
textarea { resize: vertical; width: 100%; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.15rem; }
.filters .search { flex: 1 1 280px; }
.result-count { color: var(--muted); margin: .2rem 0 0; font-size: .88rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.church-card {
  position: relative; display: flex; flex-direction: column; gap: .3rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.05rem 1.15rem .95rem;
  transition: box-shadow .15s, border-color .15s;
}
.church-card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.church-card h3 { font-size: 1.05rem; margin-top: .3rem; font-weight: 650; }
.church-card h3 a { color: var(--ink); text-decoration: none; }
.church-card h3 a:hover { text-decoration: underline; }
.card-pastor { margin: 0; font-weight: 500; color: var(--ink-2); font-size: .92rem; }
.card-addr { margin: 0; font-size: .86rem; color: var(--muted); }
.card-meta { margin: 0; font-size: .85rem; color: var(--ink-2); }
.meta-label { color: var(--muted); font-weight: 600; margin-right: .4rem; }
.card-transit { margin: .1rem 0 0; display: flex; align-items: center; gap: .4rem; font-size: .84rem; color: var(--ink-2); }
.lang-row { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--line); }
.card-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

.lines { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.line-bullet { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; font-size: .7rem; font-weight: 800; font-family: Helvetica, Arial, sans-serif; }
.line-bullet.long { border-radius: 4px; padding: 0 5px; font-size: .62rem; }
.lines.md .line-bullet { min-width: 24px; height: 24px; font-size: .8rem; }

/* ---------- Badges ---------- */
.badge-row { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; margin: .5rem 0 .1rem; min-height: 36px; }
.badge-mini { display: inline-flex; filter: drop-shadow(0 1px 1px rgba(17, 24, 39, .18)); transition: transform .12s; }
.badge-mini:hover { transform: scale(1.15) rotate(-4deg); z-index: 1; }
.badge-more { font-size: .76rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .5rem; margin-left: .2rem; }
.badge-none { font-size: .8rem; color: var(--faint); }
.badge-svg { display: block; }

.sash { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem 1.75rem; }
.sash-group h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; margin-bottom: .65rem; }
.sash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: .75rem .35rem; }
.patch { margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; }
.patch .badge-svg { filter: drop-shadow(0 2px 3px rgba(17, 24, 39, .16)); transition: transform .15s; }
.patch:hover .badge-svg { transform: scale(1.08) rotate(-3deg); }
.patch figcaption { font-size: .72rem; font-weight: 600; line-height: 1.2; color: var(--ink-2); }
.patch figcaption small { display: block; font-weight: 600; color: var(--accent); font-size: .66rem; margin-top: 1px; }
.patch.unearned .badge-svg { opacity: .65; filter: grayscale(1); }
.patch.unearned figcaption { color: var(--faint); font-weight: 500; }

/* ---------- Church page ---------- */
.church-head { margin-bottom: 1.4rem; }
.back { display: inline-block; margin-bottom: .8rem; color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 550; }
.back:hover { color: var(--ink); }
.church-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.church-head h1, .church-title h1 { margin: .4rem 0 .15rem; }
.tag-row { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.public-link { color: var(--muted); text-decoration: none; font-weight: 550; }
.public-link:hover { color: var(--ink); }
.head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.church-page .sash-panel { margin-bottom: 1.15rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem 1rem; margin: 0; }
.fact dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.fact dd { margin: .15rem 0 0; overflow-wrap: anywhere; font-size: .93rem; }
.fact dd a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.fact.unknown dd { color: var(--faint); }
.transit { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.notes { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); white-space: pre-wrap; }
.people { margin-top: 1.15rem; padding-top: .95rem; border-top: 1px solid var(--line); }
.people h3 { margin-bottom: .4rem; }
.people-list li { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; padding: .45rem 0; }
.people-list li > .small { grid-column: 1; }
.people-list li > button { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.people .btn { margin-top: .5rem; }

.timeline li { position: relative; padding: .15rem 0 1.1rem 1.4rem; border-left: 1px solid var(--line); margin-left: .4rem; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: .4rem; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.reached::before { border-color: var(--green); background: var(--green); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: .2rem; }
.tl-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tl-del { position: absolute; right: 0; top: .2rem; opacity: 0; transition: opacity .15s; }
.timeline li:hover .tl-del, .tl-del:focus { opacity: 1; }

.dues-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.dues-year { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .65rem .3rem; border-radius: 10px; border: 1px dashed var(--line-strong); color: var(--faint); font-size: .88rem; }
.dues-year strong { color: var(--ink-2); }
.dues-year.paid { border: 1px solid var(--ink); color: var(--ink); font-weight: 650; }
.dues-year.paid span::before { content: '✓ '; color: var(--green); }

/* ---------- Forms & modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(17, 24, 39, .45); display: grid; place-items: start center; padding: 5vh 1rem; overflow-y: auto; animation: fade .12s ease-out; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: rise .16s ease-out; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.35rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.05rem; }
.modal-head .icon-btn { font-size: 1.5rem; color: var(--muted); }
.modal-body { padding: 1.15rem 1.35rem 1.35rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.field { display: flex; flex-direction: column; gap: .32rem; margin-bottom: .95rem; min-width: 0; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field-label { font-size: .83rem; font-weight: 600; color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 .9rem; }
.check { display: flex; align-items: center; gap: .45rem; margin-bottom: .7rem; font-weight: 500; }
.check input, .toggle input { accent-color: var(--ink); width: 16px; height: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.form-actions.sticky { position: sticky; bottom: -1.35rem; background: var(--surface); padding: .85rem 0 .2rem; border-top: 1px solid var(--line); }
.form-error { color: #b91c1c; border: 1px solid #fecaca; border-left: 3px solid var(--red); padding: .55rem .8rem; border-radius: 8px; font-size: .9rem; }
.form-section { border: 0; border-top: 1px solid var(--line); padding: 1rem 0 .2rem; margin: 0; }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section legend { font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 .4rem 0 0; }
.tri-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 1rem; }

/* Segmented choices (radio buttons styled as buttons) */
.choices { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.choices input[type=radio], .tri input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
.choice {
  display: inline-flex; align-items: center; gap: .35rem; padding: .48rem .85rem; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .9rem; user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.choice:hover { border-color: var(--ink); }
.choices input:checked + .choice { background: var(--ink); border-color: var(--ink); color: #fff; }
.choices input:focus-visible + .choice, .tri input:focus-visible + label, .chips input:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 2px; }
.choices.compact .choice { padding: .33rem .72rem; font-size: .85rem; }
.choices.compact input[type=date] { padding: .3rem .55rem; }
.choice-icon { font-size: 1rem; }

.tri { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; width: fit-content; max-width: 100%; }
.tri label { padding: .35rem .8rem; cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--ink-2); border-left: 1px solid var(--line); user-select: none; background: var(--surface); }
.tri label:first-of-type { border-left: 0; }
.tri input:checked + label { background: var(--ink); color: #fff; }
.tri input[value='']:checked + label { background: var(--subtle); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { padding: .3rem .72rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .84rem; font-weight: 550; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--ink); }
.chips input:checked + .chip { background: var(--chip, var(--ink)); border-color: var(--chip, var(--ink)); color: var(--chip-text, #fff); }

details.more { margin: 0 0 .95rem; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--ink); font-size: .9rem; margin-bottom: .6rem; }
.checkin { margin-top: .5rem; padding: 1.05rem 1.05rem .25rem; border-radius: 12px; border: 1px solid var(--line); border-left: 3px solid var(--ink); }
.checkin h3 { margin-bottom: .8rem; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2rem 1.85rem 1.5rem; }
.eyebrow { margin: 0; color: var(--muted); font-weight: 700; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.login-card h1 { margin-top: .2rem; font-size: 1.75rem; }
.login-card > .muted { margin-bottom: 1.35rem; }
.login-card .btn { margin-top: .3rem; padding: .7rem; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 1.25rem; margin-bottom: 1.25rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { padding: .55rem 0; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: .85rem; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.admin-grid .span-all { grid-column: 1 / -1; }
.admin-grid .panel p { margin-bottom: .85rem; }
.cadence { width: 110px; }
.temp-pass { display: flex; align-items: center; gap: .6rem; margin: .85rem 0; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; }
.temp-pass code { font-size: 1.15rem; font-weight: 700; flex: 1; }
.push-box { margin-top: .5rem; }

.notif-list li a { display: block; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; background: var(--surface); text-decoration: none; color: var(--ink); }
.notif-list li.unread a { border-left: 3px solid var(--ink); }
.notif-list p { margin: .2rem 0; color: var(--ink-2); }

/* ---------- Public directory ---------- */
.hero { max-width: 1240px; margin: 0 auto; padding: 3rem 1.5rem 1rem; }
.hero h1 { font-size: 2.4rem; letter-spacing: -.03em; }
.lead { color: var(--muted); font-size: 1.05rem; margin: .4rem 0 1.4rem; }
.search.big { width: 100%; max-width: 680px; font-size: 1.02rem; padding: .85rem 1.1rem; border-radius: 10px; }
.directory .page { padding-top: 1rem; }
.region-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.region-chips button {
  display: inline-flex; align-items: center; padding: .38rem .8rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: .86rem; font-weight: 550; cursor: pointer;
}
.region-chips button:hover { border-color: var(--ink); }
.region-chips button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.filter-row .result-count { margin: 0 0 0 auto; }
.detail .church-head .btn-row { margin-top: 1rem; }
.site-foot { border-top: 1px solid var(--line); padding: 2rem 1.5rem 3rem; max-width: 1240px; margin: 0 auto; color: var(--ink-2); }

/* Landing */
.site-nav { margin-left: auto; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .92rem; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.landing { min-height: calc(100vh - 170px); display: grid; place-items: center; padding: 4rem 1.5rem; text-align: center; }
.landing-inner { max-width: 820px; display: flex; flex-direction: column; align-items: center; }
.landing h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); line-height: 1.05; letter-spacing: -.04em; font-weight: 750; margin: .6rem 0 2.2rem; text-wrap: balance; }
.btn.cta { padding: .95rem 1.8rem; font-size: 1.05rem; border-radius: 10px; }
.landing-stats { display: flex; gap: .6rem; margin-top: 2.2rem; color: var(--muted); font-size: .9rem; }
.landing-stats span { color: var(--line-strong); }
.region-dots { display: flex; gap: 6px; margin-top: 1rem; }
.region-dots span { width: 7px; height: 7px; border-radius: 50%; opacity: .85; }
.on-landing .site-nav { visibility: hidden; }

/* Find page: quiet until an area or search is chosen */
.hero.find { padding-bottom: 0; }
.hero.find .region-chips { margin-top: 1.1rem; }
.find-prompt { color: var(--faint); margin: 1.5rem 0 3rem; font-size: .95rem; }

/* Church update form */
.update-page { padding-top: 2.25rem; }
.update-page > h1 { font-size: 2rem; margin: .3rem 0 .2rem; }
.update-page .lead { margin-bottom: .6rem; }
.update-page .profile-form { margin-top: 1.5rem; }
.update-page .form-section { padding: 1.4rem 0 .4rem; }
.update-page .form-actions { border-top: 1px solid var(--line); padding-top: 1.2rem; }
.update-page .btn.primary { padding: .75rem 1.6rem; }
.private-tag { display: inline-block; padding: 0 .4rem; border: 1px solid var(--line-strong); border-radius: 4px; font-size: .66rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); vertical-align: 1px; }
.thanks { text-align: center; padding: 3rem 0; }
.thanks .lead { margin: .6rem auto 1.4rem; max-width: 520px; }
.check-mark { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 50%; border: 2px solid var(--green); color: var(--green); display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; }
.center-row { justify-content: center; }
.change-list { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .25rem; font-size: .86rem; }
.timeline .change-list li { padding: 0; margin: 0; border: 0; }
.timeline .change-list li::before { content: none; }
.change-field { font-weight: 600; margin-right: .4rem; }
.change-old { color: var(--muted); text-decoration: line-through; }
.change-new { color: var(--ink); }
.link-box { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }

/* Web research review */
.research-list { display: grid; gap: 1rem; margin-top: 1rem; }
.research-card h3 { margin-top: .3rem; }
.research-card h3 a { color: var(--ink); text-decoration: none; }
.research-card h3 a:hover { text-decoration: underline; }
.research-card .table td { vertical-align: top; }

/* Prospects */
.prospect-toolbar { justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.prospect-toolbar .btn-row { margin-top: 0; }
.prospect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.prospect-card h3 { margin-top: .3rem; }
.prospect-card .facts { margin-bottom: .6rem; }
.prospect-card textarea { margin-top: .4rem; font-size: .88rem; }
.prospect-card select { max-width: 170px; }

/* Embedded on the association's website: the host page supplies the header and footer */
.embedded .site-head, .embedded .site-foot { display: none; }
.embedded .hero { padding-top: 1.25rem; }
.embedded .find-prompt { margin-bottom: 1.5rem; }

/* Demo home */
.demo-home { max-width: 1040px; margin: 0 auto; padding: 3.5rem 1.5rem 4rem; }
.demo-home h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.03em; margin: .4rem 0 .5rem; }
.demo-home .lead { max-width: 680px; margin-bottom: 2rem; }
.demo-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.demo-choice {
  display: flex; flex-direction: column; gap: .5rem; text-align: left; padding: 1.4rem 1.4rem 1.2rem;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  text-decoration: none; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.demo-choice:hover { border-color: var(--ink); box-shadow: var(--shadow-hover); }
.demo-choice:disabled { opacity: .6; cursor: wait; }
.demo-choice h2 { font-size: 1.1rem; }
.demo-choice p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.choice-go { margin-top: .6rem; font-weight: 650; font-size: .9rem; }
.demo-foot { margin-top: 2rem; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: .4rem; width: min(440px, calc(100% - 2rem)); }
.toast { padding: .75rem 1rem; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500; animation: rise .15s ease-out; transition: opacity .4s, transform .4s; }
.toast.warn { background: #92400e; }
.toast.error { background: #b91c1c; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .user-meta { display: none; }
}
@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
  .view-as span { display: none; }
  .top-link { display: none; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: .5rem; padding: .5rem 1rem; }
  .topbar .brand small { display: none; }
  .nav { order: 3; width: 100%; justify-content: space-around; }
  .nav a { flex: 1; text-align: center; }
  .view-as select { max-width: 200px; }
  .strip.preview { position: static; }
}
@media (max-width: 720px) {
  .view-as select { max-width: 150px; }
  .page { padding: 1.1rem 1rem 4rem; }
  .hero { padding: 1.75rem 1rem .5rem; }
  .hero h1 { font-size: 1.8rem; }
  .landing { min-height: calc(100vh - 200px); padding: 3rem 1rem; }
  h1 { font-size: 1.4rem; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .filters select { flex: 1 1 45%; }
  .filter-row .result-count { margin-left: 0; width: 100%; }
  .region-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -1rem .9rem; padding: 0 1rem 4px; scrollbar-width: none; }
  .region-chips button { flex: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile strong { font-size: 1.55rem; }
  .overlay { padding: 0; place-items: end center; }
  .modal, .modal.wide { width: 100%; border-radius: 14px 14px 0 0; max-height: 94vh; overflow-y: auto; }
  .tl-del { opacity: 1; }
  .sash-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
