/* Circuit overseer visit: one calm column, white cards on warm paper, teal accent.
   Kinds of events each have a colour: field service = teal, shepherding call = amber, meal = slate blue. */
:root {
  --bg: #f5f3ee; --surface: #ffffff; --surface-2: #faf9f6;
  --ink: #1c2422; --muted: #5d6967; --faint: #8a9492;
  --line: #e4e1d9; --line-strong: #cbc7bc;
  --accent: #1f5f5b; --accent-hover: #174a47; --accent-ink: #ffffff; --accent-soft: #e5efed;
  --fs: #1f5f5b; --call: #a8561a; --meal: #3d5a80;
  --fs-soft: #e5efed; --call-soft: #f7ebe0; --meal-soft: #e6ecf4;
  --danger: #a3341f; --danger-soft: #f8e7e3; --ok: #2d6a3a; --ok-soft: #e4f1e6; --warn-soft: #fbf1df;
  --ring: rgba(31, 95, 91, .28);
  --shadow: 0 1px 2px rgba(28, 36, 34, .05), 0 2px 8px rgba(28, 36, 34, .04);
  --shadow-pop: 0 8px 28px rgba(28, 36, 34, .16);
  --radius: 12px; --radius-s: 8px;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bar-h: 60px;
  --band-mix: 11%; --band-mix-end: 5%; --band-line: 26%; /* how much teal the day band carries; dark mode needs more to show at all */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111716; --surface: #1e2826; --surface-2: #222d2a;
    --ink: #e6eeec; --muted: #a0b1ad; --faint: #75857f;
    --line: #2f3c39; --line-strong: #41514d;
    --accent: #5fb7ae; --accent-hover: #7cc8c0; --accent-ink: #0b1a18; --accent-soft: #1f302d;
    --fs: #5fb7ae; --call: #e0955a; --meal: #8fb0dc;
    --fs-soft: #1f302d; --call-soft: #33261b; --meal-soft: #1f2a38;
    --danger: #f08a73; --danger-soft: #3a211c; --ok: #7fcf8c; --ok-soft: #1c3121; --warn-soft: #362c1b;
    --ring: rgba(95, 183, 174, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-pop: 0 8px 28px rgba(0, 0, 0, .5);
    --band-mix: 18%; --band-mix-end: 9%; --band-line: 34%;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; text-wrap: balance; margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

/* ---------- Form controls ---------- */
label, .label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-s); transition: border-color .15s, box-shadow .15s;
}
/* iOS Safari gives date and time boxes a built-in minimum width (so they poke past their column)
   and centres the value. Let them shrink to the column and read left-aligned like the other fields. */
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 72px; }
textarea.growBox { resize: none; min-height: 44px; overflow: hidden; display: block; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.hint { font-size: 14px; color: var(--muted); margin-top: 6px; }
.err { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 1.4em; }
.err:empty { min-height: 0; margin: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--radius-s); border: 1px solid transparent; font-weight: 600; font-size: 15px; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--faint); background: var(--surface-2); }
.btn.quiet { background: transparent; color: var(--accent); padding-left: 10px; padding-right: 10px; }
.btn.quiet:hover { background: var(--accent-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.iconBtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-s);
  border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.iconBtn:hover { background: var(--surface-2); color: var(--ink); }
.iconBtn svg { width: 20px; height: 20px; }

/* ---------- Menus (details/summary popovers) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menuPanel { position: absolute; right: 0; max-width: calc(100vw - 24px); top: calc(100% + 6px); z-index: 30; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.menuItem { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; gap: 1px;
  padding: 10px 12px; border: 0; border-radius: var(--radius-s); background: transparent; cursor: pointer; }
.menuItem:hover, .menuItem:focus-visible { background: var(--surface-2); }
.menuItem strong { font-weight: 600; font-size: 15px; }
.menuItem span { font-size: 13px; color: var(--muted); }
.menuItem.danger strong { color: var(--danger); }
.menuItem.armed { background: var(--danger); }
.menuItem.armed strong, .menuItem.armed span { color: #fff; }
.menuSep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- App bar ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.appbar .wrap { display: flex; align-items: center; gap: 8px; min-height: var(--bar-h); }
.appbar .grow { flex: 1; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); text-decoration: none; font-weight: 600; padding: 8px 10px 8px 4px; border-radius: var(--radius-s); }
.back:hover { background: var(--surface-2); }
.back svg { width: 20px; height: 20px; }
.who { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Save status pill */
/* A block, so a long message ends in "…" inside the space left in the bar instead of running under the buttons. */
.saveStatus { display: block; max-width: 100%; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saveStatus::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 1px; border-radius: 50%; background: var(--line-strong); }
.saveStatus:empty::before { display: none; }
.saveStatus.busy::before { background: var(--call); animation: pulse 1s ease-in-out infinite; }
.saveStatus.ok { color: var(--ok); } .saveStatus.ok::before { background: var(--ok); }
.saveStatus.bad { color: var(--danger); } .saveStatus.bad::before { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Page header ---------- */
.pageHead { padding: 32px 0 20px; }
.pageHead h1 { font-size: 34px; margin-top: 6px; }
.pageHead .dates { font-size: 17px; color: var(--muted); margin-top: 4px; }
/* The congregation and week are context, not content: plain, compact text, well below the section titles in weight.
   Stacked in one column at every width: name and number, then the week beneath. */
.headBand { display: block; }
.headName { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.headBand h1 { font-size: 22px; margin: 0; }
.congNo { font-size: 14px; color: var(--muted); white-space: nowrap; }
.congNo:empty { display: none; }
.headBand .dates { font-size: 15px; margin: 2px 0 0; }
.pageHead:has(.headBand) { padding: 20px 0 0; }
.pageHead .intro { margin-top: 12px; color: var(--muted); max-width: 60ch; }

/* ---------- Cards and sections ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.section { margin-top: 44px; }
.sectionHead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.sectionHead h2 { font-size: 32px; }
.sectionHint { color: var(--muted); font-size: 15px; margin-bottom: 4px; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--line); margin-top: 12px; }
.callout svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--call); }
.callout strong { display: block; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 15px; font-weight: 500; box-shadow: var(--shadow-pop); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast { display: flex; align-items: center; gap: 14px; }
.toastAction { border: 0; background: transparent; color: var(--accent-soft); font: inherit; font-weight: 700; padding: 4px 6px; margin: -4px -6px -4px 0; border-radius: 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.toastAction:hover { background: rgba(255, 255, 255, .12); }
@media (prefers-color-scheme: dark) { .toastAction { color: var(--accent-ink); } .toastAction:hover { background: rgba(0, 0, 0, .1); } }

/* Link panel (shown only when automatic copying is refused) */
.linkDialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.linkDialog::backdrop { background: rgba(17, 23, 22, .45); }
.linkDialog .ldTitle { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.linkDialog input { margin-top: 14px; font-size: 14px; }
.linkDialog .ldActions { display: flex; justify-content: flex-end; margin-top: 14px; }
.toast.bad { background: var(--danger); color: #fff; }

/* =========================================================
   Sign in
   ========================================================= */
.signin { max-width: 440px; margin: 0 auto; padding: 12vh 20px 40px; }
.signin .card { padding: 32px; }
.signin .brandMark { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 18px; }
.signin h1 { font-size: 30px; }
.signin .lead { color: var(--muted); margin: 8px 0 24px; }
.check { display: flex; gap: 10px; align-items: center; margin: 0 0 18px; font-weight: 500; color: var(--ink); font-size: 15px; }
#googleBtn { min-height: 44px; }
.devForm { margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--line-strong); }
.devForm .row { display: flex; gap: 8px; margin-top: 4px; }
.aside { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.aside strong { color: var(--ink); }

/* =========================================================
   Home: start a schedule + list of visits
   ========================================================= */
.homeHead { padding: 32px 0 8px; }
.homeHead h1 { font-size: 34px; }
.startCard { margin-top: 20px; }
.startCard h2 { font-size: 20px; margin-bottom: 14px; }
/* Three layouts: one row when there is room for all four; two rows (number + name, week + button) in between;
   one column on a phone (see Phones, below). */
.startForm { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.startForm label { white-space: nowrap; }
.startForm .btn { margin-top: 28px; }
@media (max-width: 860px) {
  .startForm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
  .startForm .btn { justify-self: start; } /* its own width beside the week, not stretched across the column */
}
.label .opt, label .opt { font-weight: 400; color: var(--faint); margin-left: 4px; }
.listEmpty { margin-top: 20px; text-align: center; color: var(--faint); font-size: 15px; }
.listGroup { margin-top: 32px; }
.listGroup h2 { font-size: 15px; font-family: var(--font-body); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.visits { display: grid; gap: 12px; }
.visit { display: grid; grid-template-columns: 1fr auto; gap: 14px 20px; align-items: center; padding: 18px 20px; }
.visit h3 { font-size: 21px; }
.visit h3 a { color: inherit; text-decoration: none; }
.visit h3 .congNo { font-family: var(--font-body); font-weight: 400; margin-left: 8px; }
.visit h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.visit .dates { color: var(--muted); font-size: 15px; margin-top: 2px; }
.visit .acts { display: flex; gap: 6px; align-items: center; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.pill.none { color: var(--faint); }
.status { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-left: 8px; vertical-align: 3px; font-family: var(--font-body); }
.status.open { background: var(--accent-soft); color: var(--accent); }
.status.locked { background: var(--warn-soft); color: var(--call); }
.status.over { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.empty { text-align: center; padding: 40px 24px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 20px; margin-bottom: 4px; }
.visit.past { box-shadow: none; background: var(--surface-2); }

/* =========================================================
   Schedule: day tabs, days, event cards
   ========================================================= */
.dayNav { position: sticky; top: var(--bar-h); z-index: 15; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 10px -6px rgba(28, 36, 34, .14); }
.dayNav .wrap { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.dayNav .wrap::-webkit-scrollbar { display: none; }
.dayNav a { flex: none; display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px; text-decoration: none;
  color: var(--ink); font-weight: 600; font-size: 14px; background: var(--surface); border: 1px solid var(--line); }
.dayNav a small { color: var(--muted); font-weight: 400; }
.dayNav a:hover { border-color: var(--line-strong); }
.dayNav a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.dayNav a.active small { color: inherit; opacity: .8; }
/* Hospitality is a section, not a day: set it apart from the run of days. */
.dayNav a[data-target="hospitality"] { position: relative; margin-left: 17px; }
.dayNav a[data-target="hospitality"]::before { content: ""; position: absolute; left: -12px; top: 5px; bottom: 5px; width: 1px; background: var(--line-strong); }
[id^="day-"], #hospitality, #ministry-top { scroll-margin-top: calc(var(--bar-h) + 64px); }

/* Three clear levels: section title (serif, large) > day (sans, bold) > cards.
   Each day is one group: a rule above it, then its heading, cards and add actions close together,
   and a wider gap before the next day. (A rule under the heading would cut it off from its own cards.) */
.day { margin-top: 32px; }
.sectionHint + div > .day:first-child { margin-top: 16px; }
/* Day heading: a small calendar leaf, then the day name in the display serif (a size down from the section title).
   The name sits in a soft band joined to the leaf: same height, touching it, running to the edge. */
.dayHead { display: flex; align-items: stretch; gap: 0; margin-bottom: 8px; }
.dayHead h2, .dayHead h3 { flex: 1; min-width: 0; display: flex; align-items: center; font-size: 21px; font-weight: 600; padding: 0 14px; border-radius: 0 6px 6px 0;
  /* Two layers: a hairline along the foot that fades with the band, over the band's own left-to-right fade. */
  background:
    linear-gradient(to right, color-mix(in srgb, var(--accent) var(--band-line), var(--bg)), color-mix(in srgb, var(--accent) var(--band-mix), var(--bg))) bottom / 100% 1px no-repeat,
    linear-gradient(to right, color-mix(in srgb, var(--accent) var(--band-mix), var(--bg)), color-mix(in srgb, var(--accent) var(--band-mix-end), var(--bg))); }
.dayHead .date { color: var(--muted); font-size: 15px; }
.cal { flex: none; display: flex; flex-direction: column; width: 36px; overflow: hidden; text-align: center; line-height: 1;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px 0 0 6px; }
.calM { padding: 3px 0 2px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.calD { padding: 3px 0 4px; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.ev { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 8px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k, var(--fs)); }
.ev.fs { --k: var(--fs); --ks: var(--fs-soft); } .ev.call { --k: var(--call); --ks: var(--call-soft); } .ev.meal { --k: var(--meal); --ks: var(--meal-soft); }
.evHead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px 0 10px; }
.kind { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--k); }
/* A card reads as a summary; tapping it opens the editor. One card is open at a time. */
.evSummary, .evEditor { padding: 14px 16px 16px 20px; }
.evSummary { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.evSummary:focus-visible { outline-offset: -3px; }
.evEditor, .ev.open .evSummary { display: none; }
.ev.open .evEditor { display: block; }
.ev:not(.open):hover { border-color: var(--line-strong); }
.ev.open { border-color: var(--line-strong); }
/* Shepherding calls get a faint amber wash as well as the amber edge, so they stand apart from field service at a glance. */
.ev.call { background: color-mix(in srgb, var(--call-soft) 50%, var(--surface)); }
.evSumHead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
/* "Edit" appears on hover or keyboard focus only; at rest a card is just its contents. */
.evEditHint { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--faint); opacity: 0; transition: color .15s, opacity .15s; }
.evSummary:hover .evEditHint, .evSummary:focus-visible .evEditHint { opacity: 1; }
.evEditHint svg { width: 14px; height: 14px; }
.evSummary:hover .evEditHint, .evSummary:focus-visible .evEditHint { color: var(--accent); }
.evSumBody { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; }
.evSumBody .t { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.evSumBody .t.none { color: var(--faint); font-weight: 400; }
.evSumBody .main { display: block; font-weight: 600; overflow-wrap: break-word; }
.evSumBody .sub { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; overflow-wrap: break-word; }
.evSumBody .sub b { color: var(--ink); font-weight: 600; }
.evSumBody .note { font-style: italic; }
.unset { color: var(--faint); font-weight: 400; }
/* Remove is plain text starting at the fields' left edge, like "+ Add note": no negative margin, and no hover box poking out past that edge. */
.evFoot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.remove { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; padding: 6px 0; border-radius: 4px; cursor: pointer; }
.remove svg { width: 16px; height: 16px; flex: none; }
.remove:hover { color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }

.grid { display: grid; gap: 12px; }
.grid + .grid { margin-top: 12px; }
.g-tp { grid-template-columns: 150px 1fr; }
.g-2 { grid-template-columns: 1fr 1fr; }
.roles { margin-top: 12px; }
/* Notes: "+ Add note" when empty, the note itself when filled in (tap to edit), a text box while editing */
.noteBox { margin-top: 8px; }
.noteBox textarea, .noteBox .notePreview { display: none; }
.noteBox.has-note .noteAdd { display: none; }
.noteBox.has-note .notePreview { display: flex; }
.noteBox.editing .noteAdd, .noteBox.editing .notePreview { display: none; }
.noteBox.editing textarea { display: block; min-height: 64px; }
.noteAdd { border: 0; background: transparent; color: var(--accent); font-size: 14px; font-weight: 500; padding: 4px 0; cursor: pointer; border-radius: 4px; }
.noteAdd:hover { text-decoration: underline; text-underline-offset: 3px; }
.notePreview { width: 100%; align-items: flex-start; justify-content: space-between; gap: 12px; text-align: left; cursor: text;
  padding: 9px 12px; border-radius: var(--radius-s); border: 1px solid transparent; background: var(--ks, var(--accent-soft)); color: var(--ink); font-size: 15px; line-height: 1.45; }
.notePreview:hover { border-color: var(--line-strong); }
.noteText { min-width: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.noteEdit { flex: none; font-size: 13px; font-weight: 600; color: var(--accent); padding-top: 1px; }

/* Adding is a quiet text action under each day, so it doesn't compete with the cards. */
.addRow { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -10px; margin-top: -2px; }
.addBtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 10px; border-radius: var(--radius-s);
  border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; }
.addBtn:hover { background: var(--accent-soft); }
#meals:empty + .addRow { margin-top: 8px; }
#meals:not(:empty) + .addRow { margin-top: 2px; }
/* "Nothing planned" is for readers of a locked schedule; while editing, the add actions say it. */
.dayEmpty { display: none; color: var(--faint); font-size: 15px; margin: 0; }
.readonly .dayEmpty { display: block; }
.readonly .ev ~ .dayEmpty { display: none; }

/* Read-only: fields read like text */
.readonly .evSummary { cursor: default; }
.readonly .evEditHint { display: none; }
/* Locked: no editing hints, and an empty Hospitality section says so instead of sitting blank. */
.readonly .editOnly { display: none; }
.readonly #meals:empty::before { content: "No meals arranged."; display: block; margin-top: 8px; color: var(--faint); font-size: 15px; }
.readonly .addRow, .readonly .remove, .readonly #addMeal, .readonly .noteAdd, .readonly .noteEdit { display: none; }
.readonly .notePreview:disabled { cursor: default; border-color: transparent; color: var(--ink); opacity: 1; }
.readonly input:disabled, .readonly select:disabled, .readonly textarea:disabled {
  border-color: transparent; background: var(--surface-2); color: var(--ink); opacity: 1; cursor: default; -webkit-text-fill-color: var(--ink); }
.readonly select:disabled { background-image: none; }
.readonly textarea:disabled { resize: none; }

.pageFoot { margin: 40px 0 60px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }

/* =========================================================
   Agenda: printable schedule and the view-only link
   ========================================================= */
.agenda .pageHead { padding-top: 24px; }
.docLabel { font-size: 12px; margin-bottom: 4px; }
.agendaDay { margin-top: 28px; break-inside: avoid-page; }
.agendaDay .dayHead { margin-bottom: 0; }
.item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.item .t { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .t.none { color: var(--faint); font-weight: 400; }
.item .what { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--k); }
.item.fs { --k: var(--fs); } .item.call { --k: var(--call); } .item.meal { --k: var(--meal); }
.item .main { font-weight: 600; margin-top: 2px; }
.item .sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.item .sub b { color: var(--ink); font-weight: 600; }
.item .note { font-style: italic; }
.agendaTools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.agendaMeta { margin-top: 28px; font-size: 13px; color: var(--faint); }
.agendaEmpty { margin-top: 32px; }

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm 12mm; }
  .noprint, .appbar, .dayNav, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  :root { --ink: #000; --muted: #333; --faint: #555; --line: #bbb; --fs: #000; --call: #000; --meal: #000; }
  .wrap { max-width: none; padding: 0; }
  .agenda .pageHead { padding: 0 0 6pt; }
  .pageHead h1 { font-size: 16pt; }
  .headBand .dates, .congNo { font-size: 10.5pt; }
  .docLabel { font-size: 8pt; margin-bottom: 3pt; }
  .agendaDay { margin-top: 14pt; }
  /* On paper the day band becomes a plain rule, and the calendar leaf an outline. */
  .agendaDay .dayHead h2 { font-size: 15pt; background: none; border-radius: 0; border-bottom: 1.5pt solid #000; }
  .agendaDay .cal { border-color: #000; border-radius: 0; background: none; }
  .agendaDay .calM { background: none; color: #000; border-bottom: .5pt solid #000; }
  .item { grid-template-columns: 70pt 1fr; gap: 10pt; padding: 6pt 0; }
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .pageHead { padding: 22px 0 12px; }
  .pageHead h1, .homeHead h1 { font-size: 28px; }
  .headBand h1 { font-size: 21px; }
  .pageHead:has(.headBand) { padding-top: 16px; }
  .section { margin-top: 36px; }
  .sectionHead h2 { font-size: 30px; }
  .startForm { grid-template-columns: 1fr; }
  .startForm .btn { margin-top: 0; width: 100%; }
  .visit { grid-template-columns: 1fr; padding: 16px; }
  .visit .acts .btn.primary { flex: 1; }
  .g-tp { grid-template-columns: 1fr; }
  .g-tp input[type=time] { max-width: 180px; }
  .g-2 { gap: 10px; }
  .evSummary, .evEditor { padding: 12px 12px 14px 16px; }
  .evSumBody { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  /* Overseer and wife one above the other, so their notes get the full width. */
  .roles { grid-template-columns: 1fr; gap: 14px; }
  .appbar .who { display: none; }
  /* Room for the save status: tighter bar, and Print shows just its icon. */
  .appbar .wrap { gap: 4px; }
  #openPrint { width: 40px; padding: 0; }
  #openPrint span { display: none; }
  .hide-s { display: none; }
  /* The two agenda buttons stay on one row on a phone, at their own widths, kept to the left. */
  .agendaTools { flex-wrap: nowrap; }
  .item { grid-template-columns: 78px 1fr; gap: 10px; }
  .item .t { font-size: 15px; }
  .menuPanel { min-width: 0; width: min(300px, calc(100vw - 24px)); }
  .signin { padding-top: 6vh; }
  .signin .card { padding: 24px; }
}
@media (max-width: 380px) { .g-2.stack-xs { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }
