/* Thumb District preaching calendar.
   Ported from the approved "theme bar grid" mockup: churches side by side,
   a coloured theme bar per series on the left, one box per church per Sabbath,
   and a full-screen panel when a box is tapped. */

:root {
  color-scheme: light dark;
  --bg: #eef2fb;
  --card: #ffffff;
  --ink: #111827;
  --mute: #566074;
  --line: #dbe2ef;
  --hol: #dc2626;
  --unT: #0f766e;
  --baT: #6d28d9;
  --psT: #c2410c;
  --focus: #f59e0b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --card: #151b2e;
    --ink: #e8ecf6;
    --mute: #9aa3b8;
    --line: #283149;
    --unT: #5eead4;
    --baT: #c4b5fd;
    --psT: #fdba74;
  }
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 0 16px; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Header ----------------------------------------------------------------- */
.hd {
  background: #1e3a8a;
  background: linear-gradient(160deg, #2563eb, #1e3a8a);
  color: #fff;
  border-radius: 18px;
  padding: 16px;
}
.hd h1 { margin: 0; font: 600 26px/1.1 "Source Serif 4", Georgia, serif; letter-spacing: -.01em; }
.hd p { margin: 4px 0 0; font-size: 14px; opacity: .9; }
.hd { display: flex; align-items: flex-start; gap: 10px; }
.hdt { flex: 1; }
.hda:empty { display: none; }
.hbg, .hdb {
  border: 0;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  cursor: pointer;
  font: 700 15px Figtree, system-ui, sans-serif;
}
.hbg { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin: -4px -4px 0 0; position: relative; }
/* Requests waiting for the administrator, on the menu button. */
.hbgn {
  position: absolute; top: -5px; right: -5px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; border: 2px solid #1e3a8a;
  background: #dc2626; color: #fff;
  font: 700 12px/18px Figtree, system-ui, sans-serif; text-align: center;
}
.hdb { min-height: 40px; padding: 0 14px; border-radius: 999px; margin: -2px -2px 0 0; white-space: nowrap; }
.hbg:hover, .hdb:hover { background: rgba(255, 255, 255, .28); }
.hd button:focus-visible { outline-color: #fde68a; }
.hd h1:focus { outline: none; }

/* The top bar stays in reach (nav.js): once the page scrolls, the header is a
   compact bar fixed at the top, and a spacer holds its place. */
body > header.wrap { padding-top: 12px; }
.hdsp { display: none; }
body.hdfix .hdsp { display: block; height: var(--hdfull, 124px); }
body.hdfix > header.wrap {
  position: fixed; z-index: 15;
  top: 0; left: 0; right: 0;
  margin: 0 auto;
  padding-top: calc(6px + env(safe-area-inset-top));
  padding-bottom: 6px;
  background: var(--bg);
}
body.hdfix .hd { padding: 8px 12px; border-radius: 14px; align-items: center; box-shadow: 0 6px 18px rgba(15, 23, 42, .18); }
body.hdfix .hd h1 { font-size: 18px; line-height: 1.15; }
body.hdfix .hd p { display: none; }
body.hdfix .hbg, body.hdfix .hdb { margin: 0; }

/* Back to top: a round arrow in the bottom-left corner, once the page has
   scrolled down a way. */
.totop {
  position: fixed; z-index: 18;
  left: calc(16px + env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; padding: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--ink) 25%, var(--line));
  background: var(--card); color: var(--ink);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .22);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.totop.on { opacity: 1; visibility: visible; transform: none; transition: opacity .2s ease, transform .2s ease; }
.totop:hover { background: color-mix(in srgb, var(--line) 55%, var(--card)); }
.totop:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .totop, .totop.on { transition: none; transform: none; } }

/* Messages (loading, error, saved copy) ---------------------------------- */
.msg { margin: 20px 2px; color: var(--mute); font-size: 16px; }
.msg.err { color: var(--ink); }
.retry {
  display: inline-block;
  margin-top: 10px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: 700 15px Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.stale { margin: 12px 2px 0; font-size: 14px; color: var(--mute); }
.stale .retry { margin: 6px 0 0; min-height: 40px; font-size: 14px; }

/* Name search ------------------------------------------------------------ */
.srch { margin-top: 12px; }
.srow { display: flex; gap: 8px; align-items: stretch; }
.srchb { position: relative; flex: 1; min-width: 0; }
.prb, .shb {
  flex: none;
  width: 48px; min-height: 46px;
  display: grid; place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--ink) 32%, var(--line));
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.prb:hover, .prb[aria-expanded="true"], .shb:hover { background: color-mix(in srgb, var(--line) 55%, var(--card)); }
.pyr { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 4px; }
.pyl { font-weight: 700; font-size: 16px; }
.pys {
  min-height: 46px; min-width: 104px;
  padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  font: 600 17px Figtree, system-ui, sans-serif;
}
.pdlg .pyl { margin: 0; }
.pdlg .dlgp { margin-top: 16px; }
.ptr {
  position: fixed; z-index: 60;
  left: 50%; top: calc(8px + env(safe-area-inset-top));
  transform: translate(-50%, 0);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  font: 600 14px Figtree, system-ui, sans-serif;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .15);
  pointer-events: none;
}
.shb svg { display: block; }
.shn { pointer-events: none; }
.shn[hidden] { display: none; }
.pf .tfx { margin-top: 26px; border-color: var(--hol); color: var(--hol); }
.srch input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.srx {
  position: absolute;
  top: 50%; right: 4px;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--mute);
  font: 400 28px/1 Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.srx:hover { background: color-mix(in srgb, var(--line) 55%, transparent); color: var(--ink); }
.srx[hidden] { display: none; }
.srch input {
  width: 100%;
  font: 16px Figtree, system-ui, sans-serif;
  padding: 0 52px 0 14px;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 32%, var(--line));
  background: var(--card);
  color: var(--ink);
}
.whon { margin: 8px 2px 0; font-size: 14px; font-weight: 700; color: var(--mute); }
.whon:empty { display: none; }
.gx.dim { opacity: .32; }

/* Grid ------------------------------------------------------------------- */
.gxh, .gxg { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 5px; }
.gxh { position: sticky; top: var(--navh, 0px); z-index: 3; background: var(--bg); padding: 8px 0 6px; }
/* No extra space where a theme ends: inside a month every row of dates is
   --rg apart, and a theme bar ends --rg above the next one, like the boxes
   beside it. The space between months is set by the month line alone. */
.ysec { --rg: 8px; }
.gxg { margin-bottom: 0; }
.gxr {
  display: grid;
  grid-template-columns: 34px repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: var(--rg, 4px);
  align-items: start;
  scroll-margin-top: calc(var(--gxhh, 56px) + 40px + var(--navc, 72px));
}
.gxr.one { grid-template-columns: 34px minmax(0, 1fr); }
.gxh .gxr { margin: 0; }
.gxy {
  align-self: center;
  overflow: visible;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  font: 800 18px/1 Figtree, system-ui, sans-serif;
  color: var(--ink);
  letter-spacing: .01em;
}
.ysec { position: relative; }
.yrh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Church pills in the sticky header (tap to show one church) */
.gxc {
  background: var(--c);
  color: #fff;
  border-radius: 10px;
  padding: 5px 6px;
  line-height: 1.15;
}
.gxc b { display: block; font-size: 13px; }
button.gxc {
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 40px;
  width: 100%;
}
button.gxc b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.gxc.off { background: color-mix(in srgb, var(--c) 14%, var(--card)); color: var(--ct); }
button.gxc[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
button.gxc:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Month line */
/* 34px above the line: the space most months had before (24px plus the
   10px a theme used to add when it ended), now the same for every month.
   Inside a theme the row above's space folds into these 34px. A month that
   starts a new theme already has the last row's space (--rg) above it, so
   it adds only the rest. The first month on the page has nothing above. */
.gxr.mo { position: relative; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 34px; }
.gxg.mt > div > .gxr.mo:first-child { margin-top: calc(34px - var(--rg, 4px)); }
.ysec:first-of-type > .gxg.mt:first-of-type > div > .gxr.mo:first-child { margin-top: 34px; }
/* A theme that starts a month: its bar starts level with the first date,
   below the month line (34px + 1px line + 18px padding). */
.gxg.mt > .gxbar { margin-top: calc(53px - var(--rg, 4px)); }
.ysec:first-of-type > .gxg.mt:first-of-type > .gxbar { margin-top: 53px; }
.gxr.mo::before {
  content: attr(data-mon);
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  color: var(--mute);
  padding: 0 10px;
  font-size: 13px;
  line-height: 17px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sxd { display: flex; flex-direction: column; align-items: center; padding-top: 6px; line-height: 1.05; }
.sxd b { font: 800 18px Figtree, system-ui, sans-serif; }
.gxn {
  font-size: 13px;
  color: var(--mute);
  background: color-mix(in srgb, var(--line) 45%, transparent);
  border-radius: 8px;
  padding: 4px 8px;
  margin: 0 0 var(--rg, 6px) 38px;
}

/* Theme bar (tap for the theme's details) */
.gxbar {
  position: relative;
  display: block;
  width: 100%;
  background: var(--s);
  border: 0;
  border-radius: 10px;
  color: #fff;
  min-height: 44px;
  margin: 0 0 var(--rg, 4px);
  padding: 0;
  font: inherit;
}
button.gxbar { cursor: pointer; }
button.gxbar:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.gxbar span {
  position: absolute;
  top: 6px; bottom: 6px; left: 0; right: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: block;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Event bars on the right (Pastor Vacation, Camp Meeting, Evangelistic
   Meetings), drawn by placeEvents() over a gutter the grid leaves free. */
#gxw { position: relative; }
#gxw.hasev { padding-right: calc(var(--evn, 1) * 25px); }
#gxw.hasev .gxh { margin-right: calc(var(--evn, 1) * -25px); padding-right: calc(var(--evn, 1) * 25px); }
.gxev {
  position: absolute;
  right: calc(var(--lane, 0) * 25px);
  width: 20px;
  border: 0;
  border-radius: 8px;
  background: var(--e);
  color: #fff;
  padding: 0;
  font: inherit;
  cursor: pointer;
  z-index: 1;
}
.gxev:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.gxev span {
  position: absolute;
  top: 6px; bottom: 6px; left: 0; right: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: block;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gx.q > b { font-weight: 700; }
.evl { margin: 18px 0 0; font-weight: 700; }
.evl a { color: var(--ct); }

/* Boxes */
.gx {
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.25;
  height: 44px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: 6px;
  position: relative;
}
.gx > b, .gx > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx > b { font-weight: 800; }
.gx > span { font-size: 12px; color: var(--mute); }
.gx.p { background: var(--c); color: #fff; }
.gx.e { background: color-mix(in srgb, var(--c) 13%, var(--card)); }
/* A program (like the Christmas program): a soft gold, not the solid fill of the pastor's Sabbaths. */
.gx.pg { background: color-mix(in srgb, #ca8a04 16%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, #ca8a04 45%, var(--card)); }
.gx.pg > b { color: var(--ink); }
.gx.e > b { color: var(--ct); }
.gx.x { background: color-mix(in srgb, var(--line) 55%, var(--card)); color: var(--mute); }
.gx.x > b { font-weight: 700; }
.gx.q { box-shadow: inset 0 0 0 1.5px var(--line); color: var(--mute); font-size: 12px; }
button.gx { width: 100%; border: 0; text-align: left; font: inherit; font-size: 13px; color: inherit; cursor: pointer; }
button.gx.p { color: #fff; }
button.gx:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.gx .cmi { position: absolute; right: 5px; bottom: 4px; width: 16px; height: 16px; line-height: 0; color: inherit; }
.gx.e .cmi { color: var(--ct); }
.gx.cm > span { padding-right: 16px; }
/* Communion on the Friday evening before: the icon sits on the left. */
.gx.cmf .cmi { right: auto; left: 5px; }
.gx.cmf > span { padding-right: 0; padding-left: 18px; }
.fw { width: 100%; height: 100%; fill: currentColor; display: block; }

/* Full-screen panel ------------------------------------------------------ */
.scrim {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.drw {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100vw;
  background: var(--card);
  color: var(--ink);
  z-index: 21;
  box-shadow: -12px 0 40px rgba(0, 0, 0, .25);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drw.on { transform: none; visibility: visible; transition: transform .25s ease; }
.drwh { background: var(--c); color: #fff; padding: 16px 64px 18px 18px; position: relative; }
.drwh .dk { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .02em; opacity: .9; }
.dhd { margin: 4px 0 0; font: 700 22px/1.2 Figtree, system-ui, sans-serif; }
.drx {
  position: absolute; top: 12px; right: 12px;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  font: 400 30px/1 Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.drb { padding: 6px 18px 28px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.drows { max-width: 720px; }
.drows > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.drows > div > span { font-size: 14px; color: var(--mute); flex: none; }
.drows > div > b { font-size: 15px; font-weight: 600; text-align: right; }
.drows small { display: block; font-size: 13px; font-weight: 500; color: var(--mute); }
.drows .rt b { font: 600 20px/1.25 "Source Serif 4", Georgia, serif; }
.drows b.mu { color: var(--mute); font-weight: 500; font-style: italic; }
.drows .rt b.mu { font-size: 17px; }
.drows .rs { flex-wrap: wrap; row-gap: 0; }
.drows .rs > b { color: var(--ct); font-weight: 800; font-size: 16px; }
.drows .rs small.ver { display: inline; margin-left: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--mute); }
.drows .vt {
  display: block;
  flex: 1 0 100%;
  max-height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
  padding: 12px 14px;
  border-bottom: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--line) 32%, var(--card));
  color: var(--ink);
  font: 400 16px/1.6 "Source Serif 4", Georgia, serif;
  text-align: left;
}
.drows .vt.ld { color: var(--mute); font-style: italic; }
.drows .vt sup { font: 700 10px/1 Figtree, system-ui, sans-serif; color: var(--mute); margin: 0 3px 0 2px; vertical-align: super; }
.drows .vt sup:first-child { margin-left: 0; }
.drows .vt .vref { display: block; font: 800 13px/1.4 Figtree, system-ui, sans-serif; color: var(--mute); margin: 10px 0 2px; }
.drows .vt .vref:first-child { margin-top: 0; }
.drows .vt:focus-visible { outline: 2px solid var(--ct); outline-offset: 2px; }
.drows .rc b { display: inline-flex; align-items: center; gap: 7px; color: var(--ct); font-weight: 700; }
.drows .rc .fw { width: 20px; height: 20px; flex: none; }
.hn {
  display: inline-block;
  background: color-mix(in srgb, var(--line) 60%, transparent);
  color: var(--mute);
  font: 700 13px/1.45 Figtree, system-ui, sans-serif;
  font-style: normal;
  border-radius: 5px;
  padding: 0 5px;
  margin-right: 5px;
}
.sdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--s); margin-right: 7px; vertical-align: 1px; }
.dnote { margin: 14px 0 0; font-size: 13px; color: var(--mute); }

/* Theme panel */
.tdesc { max-width: 720px; margin: 12px 0 2px; font: 400 17px/1.55 "Source Serif 4", Georgia, serif; color: var(--ink); }
.tsug { max-width: 720px; margin: 10px 0 2px; font-size: 15px; color: var(--mute); }
.tsl { max-width: 720px; margin: 4px 0 0; padding: 0; list-style: none; counter-reset: tsl; }
.tsl li { counter-increment: tsl; position: relative; padding: 11px 0 11px 34px; border-bottom: 1px solid var(--line); }
.tsl li::before {
  content: counter(tsl);
  position: absolute; left: 0; top: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  color: var(--mute);
  font: 700 13px/24px Figtree, system-ui, sans-serif;
  text-align: center;
}
.tsl b { display: block; font: 600 17px/1.3 "Source Serif 4", Georgia, serif; }
.tsl b .mu { color: var(--mute); font-weight: 500; font-style: italic; }
.tsl small { display: block; margin-top: 2px; font-size: 14px; color: var(--mute); }

/* Older phones without color-mix(): plain fills instead of tints */
@supports not (background: color-mix(in srgb, red 10%, blue)) {
  .gx.e, button.gxc.off { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--c); }
  .gx.x, .gxn, .drows .vt, .hn, .tsl li::before { background: var(--line); }
}

/* Sign-in dialog ---------------------------------------------------------- */
.ascrim, .nscrim {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.nscrim { z-index: 30; }
.ascrim { z-index: 40; }
.ascrim.on, .nscrim.on { opacity: 1; pointer-events: auto; }
.dlg {
  position: fixed;
  left: 50%; top: 50%;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translate(-50%, -46%);
  background: var(--card);
  color: var(--ink);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  padding: 20px 20px 18px;
  z-index: 41;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.dlg.on { opacity: 1; visibility: visible; transform: translate(-50%, -50%); transition: opacity .2s ease, transform .2s ease; }
.dlg h2 { margin: 0 44px 12px 0; font: 600 24px/1.2 "Source Serif 4", Georgia, serif; }
.dlgs { margin: -4px 0 12px; color: var(--mute); font-size: 15px; }
.dlgx {
  position: absolute; top: 12px; right: 12px;
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: var(--bg); color: var(--ink);
  font: 400 28px/1 Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.dlg label, .navf label, .pf label { display: block; margin: 12px 0 4px; font-weight: 700; font-size: 15px; }
.dlg input, .navf input, .pf input:not([type=checkbox]) {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: 18px Figtree, system-ui, sans-serif;
}
.dlg input:focus, .navf input:focus, .pf input:not([type=checkbox]):focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.dlge { margin: 8px 0 0; min-height: 0; color: var(--hol); font-size: 15px; font-weight: 600; }
.dlge:empty { margin: 0; }
.dlgp, .dlg2 {
  width: 100%;
  min-height: 50px;
  margin-top: 14px;
  border-radius: 12px;
  font: 700 17px Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.dlgp { border: 0; background: #1e40af; color: #fff; }
.dlg2 { border: 1.5px solid #1e40af; background: transparent; color: var(--ink); }
.dlgp:disabled, .dlg2:disabled { opacity: .6; cursor: default; }
.dlgl {
  display: block;
  margin: 14px auto 0;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: #2563eb;
  font: 600 15px Figtree, system-ui, sans-serif;
  text-decoration: underline;
  cursor: pointer;
}
.dlgor { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; color: var(--mute); font-size: 14px; }
.dlgor::before, .dlgor::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Administrator menu (slides in from the left) ------------------------------- */
.nav {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--card);
  color: var(--ink);
  z-index: 31;
  box-shadow: 12px 0 40px rgba(0, 0, 0, .25);
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
  display: flex;
  flex-direction: column;
}
.nav.on { transform: none; visibility: visible; transition: transform .25s ease; }
.navh {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 12px 18px;
  background: linear-gradient(160deg, #2563eb, #1e3a8a);
  color: #fff;
  font: 600 22px/1.2 "Source Serif 4", Georgia, serif;
}
.navx {
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .22); color: #fff;
  font: 400 28px/1 Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.navb { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 0; }
.navl a {
  display: flex; align-items: center;
  min-height: 52px;
  padding: 0 18px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px; font-weight: 600;
  border-left: 4px solid transparent;
}
.navl a:hover { background: var(--bg); }
.navn {
  margin-left: 10px; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: #dc2626; color: #fff;
  font-size: 13px; font-weight: 700; line-height: 24px; text-align: center;
}
.navl a[aria-current="page"] { border-left-color: #2563eb; background: var(--bg); }
.navl a:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.navp { padding: 8px 18px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.navm { margin: 10px 0; color: var(--mute); font-size: 14px; }
.navz { margin-top: auto; padding: 16px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.navu { margin: 0 0 10px; color: var(--mute); font-size: 14px; overflow-wrap: anywhere; }
.navo {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: 700 17px Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.navv { margin: 12px 0 0; color: var(--mute); font-size: 13px; text-align: center; }

/* Rules page --------------------------------------------------------------- */
.rli { margin: 18px 2px 4px; color: var(--mute); font-size: 15px; }
.rlg h2 { margin: 22px 2px 8px; font: 600 22px/1.2 "Source Serif 4", Georgia, serif; }
.rlg ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rlr { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.rlt { margin: 0; font-size: 17px; line-height: 1.45; }
.rls { margin: 6px 0 0; color: var(--mute); font-size: 13px; }
.rlc {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px; font-weight: 700;
}
.rlc-un { background: #0f766e; }
.rlc-ba { background: #6d28d9; }
.rlc-ps { background: #c2410c; }
.rlb { max-width: 220px; }
/* Events page */
.evf { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 16px; scroll-margin-top: calc(var(--navc, 72px) + 12px); }
.evf h2 { margin: 0 0 6px; font: 600 22px/1.2 "Source Serif 4", Georgia, serif; }
.evf .mu { color: var(--mute); font-weight: 500; }
.evf label { display: block; margin: 12px 0 4px; font-weight: 700; font-size: 15px; }
.evf input, .evf select {
  width: 100%; min-height: 46px; padding: 0 12px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 32%, var(--line)); border-radius: 12px;
  background: var(--card); color: var(--ink); font: 16px Figtree, system-ui, sans-serif;
}
.evd { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.evh { margin: 12px 0 0; color: var(--mute); font-size: 14px; }
.evf .dlgp { margin-top: 14px; }
.evc { border-left: 6px solid var(--e); }
.evk { display: inline-block; margin-bottom: 4px; padding: 1px 8px; border-radius: 999px; background: var(--e); color: #fff; font-size: 12px; font-weight: 700; }
.evq { margin: 10px 0 0; font-weight: 600; }
/* The event being changed: its card and the form are marked. */
.evf.eved { border: 2px solid #1e40af; }
.evc.eved { background: var(--bg); }
.evf .rqb .dlgp { margin-top: 14px; }
.evf .rqb .dlg2 { margin-top: 14px; }
.rqs.bad { background: color-mix(in srgb, #dc2626 14%, var(--card)); }
main#rules, main#preachers, main#requests { padding-bottom: 40px; }

/* Requests page -------------------------------------------------------------- */
.rqs { margin: 16px 2px 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, #16a34a 14%, var(--card)); color: var(--ink); font-weight: 600; font-size: 15px; }
.rqn { margin: 8px 0 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--ink); font-size: 15px; font-style: italic; }
.rqb { display: flex; gap: 10px; margin-top: 4px; }
.rqb .dlgp, .rqb .dlg2 { flex: 1; min-height: 48px; margin-top: 10px; }

/* Preachers page ------------------------------------------------------------ */
.pfok { margin: 12px 2px 0; color: var(--ink); font-weight: 600; font-size: 15px; }
.prtabs { display: flex; gap: 6px; margin: 4px 0 12px; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--line) 45%, var(--card)); }
.prtab {
  flex: 1; min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--mute);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.prtab span { font-weight: 600; opacity: .75; }
.prtab[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.prtab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.prl { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.prr {
  display: grid; gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink);
  font: inherit; text-align: left;
  cursor: pointer;
}
.prr:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.prt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.prname { font-weight: 700; font-size: 18px; }
.pra {
  padding: 1px 9px; border-radius: 999px;
  background: #1e40af; color: #fff;
  font-size: 12px; font-weight: 700;
}
.pro { color: var(--mute); font-size: 15px; }
.prc { display: flex; flex-wrap: wrap; gap: 6px; }
.prc .rlc { margin: 0; }
.prp { font-size: 15px; }
.prn { color: var(--mute); }
.pf { margin: 18px 0 0; padding: 4px 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pf h2 { margin: 14px 0 4px; font: 600 22px/1.2 "Source Serif 4", Georgia, serif; }
.pfh { margin: 4px 2px 0; color: var(--mute); font-size: 14px; }
.pfc { margin: 14px 0 0; padding: 0; border: 0; }
.pfc legend { padding: 0; margin: 0 0 4px; font-weight: 700; font-size: 15px; }
.pf label.pfk, .pfk {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; margin: 0;
  font-weight: 500; font-size: 17px;
  cursor: pointer;
}
.pfk input { width: 22px; height: 22px; margin: 0; accent-color: #1e40af; }
.pf label.pfad { margin-top: 12px; }
.pfk input:disabled { cursor: default; }
.pf [hidden] { display: none; }

/* Changing a sermon (in the Sabbath panel) ----------------------------------- */
.edb { max-width: 720px; margin-top: 22px; }
.edok { max-width: 720px; margin: 8px 0 4px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ct) 12%, var(--card)); font-weight: 600; font-size: 15px; }
.pf.edf { max-width: 720px; margin: 4px 0 0; padding: 0; border: 0; background: none; }
.edf:focus { outline: none; }
.edf .dlgs { margin: 6px 0 8px; }
.edw { margin: 0 0 6px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--focus); font-size: 15px; }
.edk { margin: 10px 2px 4px; font-size: 13px; font-weight: 700; color: var(--mute); letter-spacing: .02em; }
.edm { margin: 10px 2px; color: var(--mute); font-size: 15px; }
.edl { list-style: none; margin: 8px 0 0; padding: 0; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 12px; }
.edl li + li { border-top: 1px solid var(--line); }
.edi {
  display: block; width: 100%; min-height: 48px; padding: 10px 12px;
  border: 0; background: transparent; color: var(--ink); text-align: left;
  font: 15px/1.35 Figtree, system-ui, sans-serif; cursor: pointer;
}
.edi b { display: block; font-size: 16px; font-weight: 700; }
.edi span { display: block; color: var(--mute); font-size: 14px; }
.edi .edg { font-size: 12px; font-weight: 600; margin-top: 2px; }
.edi[aria-pressed="true"] { background: color-mix(in srgb, var(--ct) 14%, var(--card)); box-shadow: inset 4px 0 0 var(--ct); }
.edi:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.edp { margin: 8px 2px 0; font-size: 14px; color: var(--mute); }
.edp .edu { display: inline; margin: 0; min-height: 32px; padding: 0 4px; font-size: 14px; }
.edhr { display: flex; align-items: center; gap: 10px; }
.pf .edhr input:not([type=checkbox]) { width: 110px; flex: none; }
.edhn { color: var(--mute); font-size: 15px; }
.edf .dlg2 { margin-top: 10px; }
/* The bank's suggestion under the blank form, and the button that fills it in. */
.edsg { margin: 18px 0 0; padding: 12px 14px 14px; border: 1.5px solid color-mix(in srgb, var(--ct) 45%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--ct) 6%, var(--card)); }
.edsg .edk { margin: 0 0 4px; }
.edsg .edm { margin: 4px 0 0; }
.edst { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.edsm { margin: 2px 0 0; color: var(--mute); font-size: 15px; }
.edsl { margin: 8px 0 0; }
.edsl div { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; font-size: 15px; }
.edsl span { flex: none; width: 104px; color: var(--mute); }
.edsl b { font-weight: 600; min-width: 0; }
.edf .edsu { margin-top: 12px; width: 100%; }
.edf .edfb { margin-top: 14px; }
.edfind { margin-top: 18px; }
.edab { margin: 24px 2px 2px; font-size: 13px; font-weight: 700; color: var(--mute); letter-spacing: .04em; text-transform: uppercase; }

/* Sermon bank page ------------------------------------------------------------ */
.bks { position: sticky; top: var(--navh, 0px); z-index: 3; background: var(--bg); padding: 10px 0 8px; }
.bks input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font: 18px Figtree, system-ui, sans-serif;
}
.bks input:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.bkn { margin: 6px 2px 0; color: var(--mute); font-size: 14px; }
.bkc { margin: 26px 2px 4px; font: 600 24px/1.2 "Source Serif 4", Georgia, serif; }
.bkg { margin: 16px 2px 8px; font-size: 15px; font-weight: 800; color: var(--mute); letter-spacing: .02em; }
.bkg span { font-weight: 600; }
.bkl { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bki { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.bki b { display: block; font: 600 18px/1.25 "Source Serif 4", Georgia, serif; }
.bki .bkt { display: block; margin-top: 2px; color: var(--mute); font-size: 14px; font-weight: 600; }
.bki p { margin: 6px 0 0; font-size: 15px; line-height: 1.45; }
.bki .bkm { display: block; margin-top: 6px; color: var(--mute); font-size: 14px; }

/* Assistant (chat) ------------------------------------------------------------ */
.chb {
  position: fixed; z-index: 19;
  right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom));
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px;
  background: #1e40af; color: #fff; cursor: pointer;
  font: 700 16px/1.2 Figtree, system-ui, sans-serif; letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(30, 64, 175, .45);
  display: flex; align-items: center; justify-content: center;
}
.chb:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
body.has-chat main.wrap { padding-bottom: 96px; }
.chp {
  position: fixed; z-index: 50; inset: 0;
  background: var(--card); color: var(--ink);
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.chp.on { opacity: 1; visibility: visible; transform: none; transition: opacity .2s ease, transform .2s ease; }
@media (min-width: 640px) {
  .chp {
    inset: auto calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) auto;
    width: 400px; height: min(640px, calc(100vh - 32px));
    border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden;
  }
}
.chh {
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 12px 12px 18px;
  background: linear-gradient(160deg, #2563eb, #1e3a8a); color: #fff;
}
@media (min-width: 640px) { .chh { padding-top: 12px; } }
.chh h2 { flex: 1; margin: 0; font: 700 18px/1.2 Figtree, system-ui, sans-serif; }
.chh p { margin: 2px 0 0; font-size: 13px; opacity: .9; }
.chh div { flex: 1; }
.chx { width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .16); color: #fff; font: 400 28px/1 Figtree, system-ui, sans-serif; cursor: pointer; }
/* Scrolling back through the messages never moves or refreshes the page. */
.chl { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; }
html.chopen, html.chopen body { overscroll-behavior-y: none; }
.chm { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.chm.a { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 5px; }
.chm.u { align-self: flex-end; background: #1e40af; color: #fff; border-bottom-right-radius: 5px; }
.chm.s { align-self: center; max-width: 94%; background: none; color: var(--hol); font-size: 14px; font-weight: 600; text-align: center; padding: 4px 8px; }
.chm.t { color: var(--mute); font-style: italic; }
.chf { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (min-width: 640px) { .chf { padding-bottom: 10px; } }
.cht {
  flex: 1; min-height: 48px; max-height: 140px; resize: none;
  padding: 12px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink); font: 17px/1.35 Figtree, system-ui, sans-serif;
}
.cht:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.chi { flex: none; width: 48px; height: 48px; border: 0; border-radius: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chi svg { width: 24px; height: 24px; }
.chmic { background: var(--bg); color: var(--ink); }
.chmic[aria-pressed="true"] { background: var(--hol); color: #fff; animation: chpulse 1.4s ease-in-out infinite; }
.chs { background: #1e40af; color: #fff; }
.chi:disabled { opacity: .5; cursor: default; }
.chi:focus-visible, .chx:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* The Sabbath the assistant was opened from, and its starter buttons. */
.chc { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 16px; background: color-mix(in srgb, #2563eb 10%, var(--card)); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.chc[hidden] { display: none; }
.chc span { flex: 1; min-width: 0; }
.chc button { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 400 24px/1 Figtree, system-ui, sans-serif; cursor: pointer; }
.chq { display: flex; flex-wrap: wrap; gap: 8px; }
.chq button { min-height: 44px; padding: 0 14px; border: 1.5px solid #1e40af; border-radius: 999px; background: var(--card); color: var(--ink); font: 700 15px Figtree, system-ui, sans-serif; cursor: pointer; }
.chq button:focus-visible, .chc button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.askb { max-width: 720px; }
.edf .ask1 { margin: 2px 0 14px; }
.chn { margin: 0; padding: 0 14px 8px; color: var(--mute); font-size: 13px; min-height: 0; }
.chn:empty { display: none; }
@keyframes chpulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--hol) 25%, transparent); } }

/* Reports page and the one-page year ------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .drw, .drw.on, .scrim, .nav, .nav.on, .dlg, .dlg.on, .ascrim, .nscrim, .chp, .chp.on { transition: none; }
  .chmic[aria-pressed="true"] { animation: none; }
}

/* Preaching, Teaching, Prayer Meeting --------------------------------------- */
.vsw {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  margin-top: 12px; padding: 4px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--line) 75%, var(--bg));
  scroll-margin-top: calc(var(--navc, 72px) + 8px);
}
.vsb {
  min-height: 46px; padding: 4px 6px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--ink);
  font: 700 15px/1.15 Figtree, system-ui, sans-serif;
  cursor: pointer;
}
.vsb.on { background: var(--card); color: #1e40af; box-shadow: 0 1px 4px rgba(15, 23, 42, .18); }
.vsb:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
@media (prefers-color-scheme: dark) { .vsb.on { color: #93c5fd; } }

/* How to use: shown once to people signed in, until Got it. */
.how { margin-top: 12px; padding: 14px 16px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.how h2 { margin: 0 0 6px; font: 700 17px/1.25 Figtree, system-ui, sans-serif; }
.how ul { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.45; }
.how li + li { margin-top: 4px; }
.how .howok { margin-top: 12px; min-height: 48px; }

/* Prayer Meeting uses the same grid; each church's meeting time sits under
   its name at the top. */
.gxc > span { display: block; font-size: 11.5px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; }
/* A row for each meeting day: the weekday over the date at the left, and a
   box only for the church that meets that day; the others stay empty. */
.gxr.dw .sxd { padding-top: 4px; }
.sxd > span { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); margin-bottom: 1px; }
.gx0 { min-height: 44px; }
.gx.mw.p > span { color: rgba(255, 255, 255, .9); }

/* The administrator's forms in the panel: who teaches, who leads. */
.tpf select, .mwf select {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  font: 17px Figtree, system-ui, sans-serif;
}
.tpf select:focus, .mwf select:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.tph { margin: 12px 0 0; font-size: 14px; color: var(--mute); }
.tph a { color: inherit; font-weight: 700; }
.mwf fieldset { margin: 8px 0 0; padding: 0; border: 0; }
.mwf legend { padding: 0; margin: 0 0 4px; font-weight: 700; font-size: 15px; }
.pf.mwf label.mwo { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 2px 0 0; font-weight: 600; font-size: 16px; cursor: pointer; }
.pf.mwf .mwo input[type=radio] { width: 22px; height: 22px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: #1e40af; }
.mwf .mwo + select, .mwf .mwo + input { margin: 2px 0 6px 32px; width: calc(100% - 32px); }
