:root {
  --bg: #f4f5f1;
  --panel: #ffffff;
  --panel-2: #f8f9f6;
  --line: #e2e5dc;
  --text: #1f2419;
  --muted: #6b7262;
  --brand: #568203;
  --brand-hi: #6a9e08;
  --brand-soft: #eaf3dc;
  --on-brand: #ffffff;
  --danger: #c8443a;
  --warn: #c98a0b;
  --ok: #2e8b57;
  --people: #2f7dd1;
  --ministries: #c99a06;
  --lifegroups: #5b5fc7;
  --services: #7a52cc;
  --checkins: #e07b16;
  --giving: #1f9d6b;
  --groups: #d64a7a;
  --calendar: #c0392b;
  --registrations: #0f8f9f;
  --app: #568203;
  --reports: #2a78d6;
  --tasks: #b5562a;
  --messages: #2f7dd1;
  /* chart series, in a fixed colorblind-checked order */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --info: #2a78d6;
  --shadow: 0 1px 2px rgba(20, 30, 10, .06), 0 4px 16px rgba(20, 30, 10, .06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f120c; --panel: #171b13; --panel-2: #1d2218; --line: #2c3324; --text: #e9ecdf; --muted: #9aa28c;
    --brand-soft: #24321a; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --info: #5b9be8;
  }
}
:root[data-theme="dark"] {
  --bg: #0f120c; --panel: #171b13; --panel-2: #1d2218; --line: #2c3324; --text: #e9ecdf; --muted: #9aa28c;
  --brand-soft: #24321a; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --info: #5b9be8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--brand); }
.global-search { position: relative; flex: 1; max-width: 460px; margin-left: 12px; }
.global-search input { width: 100%; }
.search-results {
  position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); max-height: 380px; overflow: auto; padding: 6px;
}
.search-results a { display: flex; gap: 10px; align-items: center; padding: 7px 9px; border-radius: 7px; color: var(--text); }
.search-results a:hover, .search-results a.active { background: var(--brand-soft); text-decoration: none; }
.church-name { margin-left: auto; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle { display: none; }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidenav {
  width: 220px; flex: none; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500;
}
.sidenav a:hover { background: var(--panel-2); text-decoration: none; }
.sidenav a.active { background: var(--brand-soft); color: var(--text); font-weight: 650; }
.sidenav .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.sidenav .dot svg { width: 15px; height: 15px; }
.sidenav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.sidenav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 10px; }
.view { flex: 1; min-width: 0; padding: 24px 28px 60px; outline: none; }

/* Page chrome */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head .crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.mod-badge { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.mod-badge svg { width: 22px; height: 22px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--brand); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }

/* Cards & grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
a.card { color: var(--text); }
a.card:hover { text-decoration: none; border-color: var(--brand); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.stat .lbl { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .delta { font-size: 12px; }
.up { color: var(--ok); } .down { color: var(--danger); }

/* Tables & lists */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: #fff;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); white-space: nowrap;
}
.chip.ok { background: rgba(46, 139, 87, .12); border-color: rgba(46, 139, 87, .3); color: var(--ok); }
.chip.warn { background: rgba(201, 138, 11, .13); border-color: rgba(201, 138, 11, .35); color: var(--warn); }
.chip.bad { background: rgba(200, 68, 58, .12); border-color: rgba(200, 68, 58, .3); color: var(--danger); }
.chip.brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
button.chip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }

.bar { height: 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* Controls */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 36px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }
.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 14px; min-height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hi); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 4px 10px; min-height: 28px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.icon-btn { border: 0; background: transparent; color: var(--text); font-size: 18px; cursor: pointer; padding: 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--panel-2); }

/* Modal & forms */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 6, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal {
  background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); border: 1px solid var(--line);
}
.modal.wide { width: min(820px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal .body { padding: 18px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal footer .grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 650; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check > span { color: var(--text); font-size: 14px; font-weight: 500; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 220px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.multi label { display: flex; gap: 7px; align-items: center; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2419; color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); font-weight: 600;
}

/* Services: plan */
.plan-items .item { display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.plan-items .item .time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.plan-items .item.header { background: var(--panel-2); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; grid-template-columns: minmax(0, 1fr) auto; }
.plan-items .item .acts { display: flex; gap: 2px; opacity: .55; }
.plan-items .item:hover .acts { opacity: 1; }
.kind { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; margin-right: 6px; }
.kind.k-song { background: color-mix(in srgb, var(--services) 16%, transparent); color: var(--services); }
.kind.k-item { background: var(--panel-2); color: var(--muted); }
.kind.k-media { background: color-mix(in srgb, var(--registrations) 16%, transparent); color: var(--registrations); }
.team-block + .team-block { margin-top: 14px; }
.team-block h3 { margin-bottom: 4px; }

/* Live view */
.live { position: fixed; inset: 0; background: #0b0d09; color: #f1f4e8; z-index: 40; display: flex; flex-direction: column; }
.live header { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid #252a1f; }
.live .clock { font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 700; }
.live .rows { flex: 1; overflow: auto; padding: 10px 22px; }
.live .row { display: grid; grid-template-columns: 80px 1fr 90px; gap: 14px; padding: 14px; border-radius: 10px; font-size: 18px; align-items: center; }
.live .row.hdr { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #9aa28c; padding: 10px 14px; }
.live .row.done { opacity: .4; }
.live .row.now { background: var(--brand); color: #fff; font-size: 24px; font-weight: 700; }
.live .btn { background: #1d2218; color: #f1f4e8; border-color: #2c3324; }
.live .btn.primary { background: var(--brand); border-color: var(--brand); }

/* Check-in kiosk */
.kiosk { max-width: 760px; margin: 0 auto; text-align: center; }
.kiosk .big-input { font-size: 24px; padding: 16px; text-align: center; min-height: 64px; border-radius: 14px; }
.kiosk .fam { text-align: left; }
.kid-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; margin-bottom: 10px; cursor: pointer; background: var(--panel); text-align: left; }
.kid-row.on { border-color: var(--checkins); background: color-mix(in srgb, var(--checkins) 8%, var(--panel)); }
.kid-row select { width: auto; }
.code-big { font-size: 64px; font-weight: 800; letter-spacing: .12em; color: var(--checkins); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal .dow { padding: 6px 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel-2); }
.cal .day { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.cal .day.other { background: var(--panel-2); color: var(--muted); }
.cal .day.today .n { background: var(--brand); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal .n { font-size: 12px; font-weight: 700; display: inline-block; margin-bottom: 4px; }
.cal .ev { display: block; font-size: 11px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal .ev.pending { background: repeating-linear-gradient(45deg, #9aa28c, #9aa28c 4px, #8a927c 4px, #8a927c 8px) !important; }

/* Groups */
.group-card { display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform .1s; }
.group-card:hover { transform: translateY(-2px); }
.group-card .banner { height: 70px; border-radius: 8px; margin: -4px -4px 4px; display: flex; align-items: end; padding: 8px 10px; color: #fff; font-weight: 700; }

/* Member app (phone preview) */
.phone-wrap { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.phone {
  width: 380px; max-width: 100%; height: 760px; border-radius: 40px; border: 10px solid #1b1f16; background: var(--bg);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.phone .app-top { background: var(--brand); color: #fff; padding: 16px 18px 14px; }
.phone .app-top h2 { font-size: 20px; }
.phone .app-body { flex: 1; overflow: auto; padding: 14px; }
.phone .app-tabs { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: var(--panel); }
.phone .app-tabs button { border: 0; background: none; padding: 9px 0 11px; font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.phone .app-tabs button.on { color: var(--brand); font-weight: 700; }
.phone .app-tabs svg { width: 20px; height: 20px; }
.phone .card { padding: 13px; border-radius: 14px; }
.phone .card + .card { margin-top: 10px; }
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.amount-grid button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }

/* Print */
.print-area { display: none; }
@media print {
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; color: #000; }
  .label { width: 4in; height: 2in; border: 1px dashed #999; padding: .15in; margin-bottom: .2in; page-break-inside: avoid; font-family: Arial, sans-serif; }
  .label .nm { font-size: 26pt; font-weight: 800; }
  .label .cd { font-size: 22pt; font-weight: 800; float: right; }
  .statement { font-family: Georgia, serif; page-break-after: always; padding: .3in; }
  .statement table td, .statement table th { border-bottom: 1px solid #ccc; color: #000; }
}

/* Responsive */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .sidenav { position: fixed; top: 56px; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidenav.open { transform: none; }
  .view { padding: 18px 16px 50px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .church-name { display: none; }
  .brand span { display: none; }
  .global-search { margin-left: 0; }
  .cal .day { min-height: 70px; padding: 3px; }
  .cal .ev { font-size: 9px; padding: 1px 3px; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1; }
  .live .row { grid-template-columns: 56px 1fr 60px; font-size: 15px; }
  .live .row.now { font-size: 18px; }
}

/* Live mode: sign-in screen and sync status */
.auth { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: grid; place-items: center; padding: 16px; overflow: auto; }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); text-align: center; }
.auth-card h1 { margin: 10px 0 18px; font-size: 22px; }
.auth-card h2 { margin-bottom: 12px; }
.auth-card form { display: grid; gap: 12px; text-align: left; }
.auth-card .note { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; text-align: left; }
.auth-links { display: flex; justify-content: center; gap: 18px; margin-top: 14px; }
.sync-status { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sync-status.saved::before { content: '● '; color: var(--ok); }
.sync-status.saving::before { content: '● '; color: var(--warn); }
.sync-status.offline { color: var(--danger); }
.sync-status.offline::before { content: '● '; }

/* Installed app on phones and tablets: keep clear of the notch and home indicator */
.topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.sidenav { top: calc(56px + env(safe-area-inset-top)); height: calc(100vh - 56px - env(safe-area-inset-top)); }
.view { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
@media (max-width: 800px) {
  .sync-status { display: none; }
  .sidenav { top: calc(56px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
}

/* ---------- photos and logos ---------- */
img.avatar { object-fit: cover; padding: 0; background: var(--panel-2); }
.photo-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.photo-prev { width: 64px; height: 64px; border-radius: 50%; border: 1px dashed var(--line); display: grid; place-items: center; overflow: hidden; background: var(--panel-2); }
.photo-prev.logo { border-radius: 12px; width: 84px; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.photo-prev.logo img { object-fit: contain; }
.group-card .banner { gap: 10px; }
.min-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.92); padding: 3px; flex: none; align-self: center; }
.min-logo-head { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; vertical-align: middle; margin-right: 10px; background: var(--panel); border: 1px solid var(--line); padding: 2px; }

/* ---------- notes, pills ---------- */
.note { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.chip.info { background: rgba(42, 120, 214, .12); border-color: rgba(42, 120, 214, .3); color: var(--info); }
.cat-pills, .preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-pills .chip b { font-weight: 800; margin-left: 2px; }
.preset-row .chip { padding: 5px 10px; }
.pill-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-pick label { position: relative; }
.pill-pick input { position: absolute; opacity: 0; }
.pill-pick span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; }
.pill-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pill-pick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- charts and reports ---------- */
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.chart .axis, .donut .axis { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: var(--text); fill-opacity: .05; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--text); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.donut { display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: 16px; align-items: center; }
.donut svg { width: 100%; height: auto; }
.donut .slice { stroke: var(--panel); stroke-width: 2; cursor: crosshair; }
.donut .slice:hover { opacity: .85; }
.donut-total { fill: var(--text); font-size: 13px; font-weight: 800; }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--text); color: var(--panel); padding: 7px 10px; border-radius: 8px; font-size: 12px; white-space: pre; line-height: 1.5; box-shadow: var(--shadow); }
.rep-controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 12px; }
.rep-controls .field { margin: 0; }
table.pivot td, table.pivot th { white-space: nowrap; }
table.pivot tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
table.pivot tbody tr:hover td { background: var(--panel-2); }

/* ---------- offering count ---------- */
.off-h { font-size: 14px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.off-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.off-row { display: grid; grid-template-columns: 92px 14px 1fr 96px; gap: 8px; align-items: center; }
.off-row input { text-align: right; font-size: 16px; }
.off-note { font-weight: 700; }
.off-sub { text-align: right; font-variant-numeric: tabular-nums; }
.off-line { display: flex; justify-content: space-between; padding: 10px 0 0; margin-top: 8px; border-top: 1px dashed var(--line); }
.off-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--brand-soft); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.off-total b { font-size: 26px; font-variant-numeric: tabular-nums; }
.off-view { max-width: 1200px; margin: 0 auto; width: 100%; }
.off-app { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.off-app > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.off-app #offeringForm .body { padding: 0; }
.off-app #offeringForm footer { display: flex; gap: 8px; padding: 12px 0 0; border-top: 1px solid var(--line); margin-top: 6px; }
.offering-body .topbar { gap: 12px; }
@media (max-width: 800px) {
  .off-app { grid-template-columns: 1fr; }
  .off-row { grid-template-columns: 84px 12px 1fr 86px; }
  .donut { grid-template-columns: 1fr; }
  .donut svg { max-width: 200px; margin: 0 auto; }
}

/* ---------- VIP card ---------- */
.auth.vip { place-items: start center; }
.auth.vip .auth-card { width: min(520px, 100%); margin: 8px 0 24px; }
.auth.vip .field.check { display: flex; gap: 8px; align-items: flex-start; }
.qr-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); line-height: 0; }
.qr svg { width: 168px; height: 168px; }
.vip-poster { text-align: center; padding: 40px 20px; font-family: inherit; }
.vip-poster h1 { font-size: 34px; margin: 14px 0 8px; }
.vip-poster h2 { font-size: 20px; font-weight: 500; margin-bottom: 26px; }
.vip-poster .qr { display: inline-block; border: none; }
.vip-poster .qr svg { width: 340px; height: 340px; }
.vip-poster .big { font-size: 20px; }
.topbar .grow { flex: 1; }

/* ---------- view only: logins that can look at the church database but not change it ---------- */
body.view-only #view :is(button, .btn)[data-act="acceptRequest"],
body.view-only #view :is(button, .btn)[data-act="addDonation"],
body.view-only #view :is(button, .btn)[data-act="addItem"],
body.view-only #view :is(button, .btn)[data-act="addMember"],
body.view-only #view :is(button, .btn)[data-act="addOffering"],
body.view-only #view :is(button, .btn)[data-act="addPerson"],
body.view-only #view :is(button, .btn)[data-act="addReg"],
body.view-only #view :is(button, .btn)[data-act="addSongItem"],
body.view-only #view :is(button, .btn)[data-act="approveEvent"],
body.view-only #view :is(button, .btn)[data-act="autoFill"],
body.view-only #view :is(button, .btn)[data-act="checkOut"],
body.view-only #view :is(button, .btn)[data-act="cycleStatus"],
body.view-only #view :is(button, .btn)[data-act="declineRequest"],
body.view-only #view :is(button, .btn)[data-act="deleteOffering"],
body.view-only #view :is(button, .btn)[data-act="editAnnouncement"],
body.view-only #view :is(button, .btn)[data-act="editCheckinEvent"],
body.view-only #view :is(button, .btn)[data-act="editChurch"],
body.view-only #view :is(button, .btn)[data-act="editDonation"],
body.view-only #view :is(button, .btn)[data-act="editEvent"],
body.view-only #view :is(button, .btn)[data-act="editExpense"],
body.view-only #view :is(button, .btn)[data-act="editExpenseCats"],
body.view-only #view :is(button, .btn)[data-act="editFund"],
body.view-only #view :is(button, .btn)[data-act="editGroup"],
body.view-only #view :is(button, .btn)[data-act="editItem"],
body.view-only #view :is(button, .btn)[data-act="editLists"],
body.view-only #view :is(button, .btn)[data-act="editMinistry"],
body.view-only #view :is(button, .btn)[data-act="editOffering"],
body.view-only #view :is(button, .btn)[data-act="editOpening"],
body.view-only #view :is(button, .btn)[data-act="editPerson"],
body.view-only #view :is(button, .btn)[data-act="editPlan"],
body.view-only #view :is(button, .btn)[data-act="editPosition"],
body.view-only #view :is(button, .btn)[data-act="editRoom"],
body.view-only #view :is(button, .btn)[data-act="editSignup"],
body.view-only #view :is(button, .btn)[data-act="editSong"],
body.view-only #view :is(button, .btn)[data-act="editTeam"],
body.view-only #view :is(button, .btn)[data-act="editType"],
body.view-only #view :is(button, .btn)[data-act="groupLeaders"],
body.view-only #view :is(button, .btn)[data-act="kioskAddKid"],
body.view-only #view :is(button, .btn)[data-act="kioskNewFamily"],
body.view-only #view :is(button, .btn)[data-act="lgPlace"],
body.view-only #view :is(button, .btn)[data-act="ministryAdd"],
body.view-only #view :is(button, .btn)[data-act="ministryAnnDelete"],
body.view-only #view :is(button, .btn)[data-act="ministryAnnounce"],
body.view-only #view :is(button, .btn)[data-act="ministryAttendance"],
body.view-only #view :is(button, .btn)[data-act="ministryLeaders"],
body.view-only #view :is(button, .btn)[data-act="ministryPosition"],
body.view-only #view :is(button, .btn)[data-act="ministryRemove"],
body.view-only #view :is(button, .btn)[data-act="ministryRole"],
body.view-only #view :is(button, .btn)[data-act="moveItem"],
body.view-only #view :is(button, .btn)[data-act="newPlan"],
body.view-only #view :is(button, .btn)[data-act="promoteReg"],
body.view-only #view :is(button, .btn)[data-act="removeMember"],
body.view-only #view :is(button, .btn)[data-act="removeReg"],
body.view-only #view :is(button, .btn)[data-act="schedule"],
body.view-only #view :is(button, .btn)[data-act="takeAttendance"],
body.view-only #view :is(button, .btn)[data-act="togglePaid"],
body.view-only #view :is(button, .btn)[data-act="toggleRole"],
body.view-only #view :is(button, .btn)[data-act="unschedule"],
body.view-only #view :is(button, .btn)[data-act="vipNew"],
body.view-only #view :is(button, .btn)[data-act="vipStatus"],
body.view-only #view :is(button, .btn)[data-act="resetDemo"],
body.view-only #view :is(button, .btn)[data-act="startFresh"],
body.view-only #view button[data-act="taskEdit"],
body.view-only #view :is(button, .btn)[data-act="eventScope"],
body.view-only #view :is(button, .btn)[data-act="editDate"],
body.view-only #view :is(button, .btn)[data-act="cancelDate"],
body.view-only #view :is(button, .btn)[data-act="restoreDate"],
body.view-only #view :is(button, .btn)[data-act="rosterFillDate"],
body.view-only #view :is(button, .btn)[data-act="addSongList"],
body.view-only #view :is(button, .btn)[data-act="progEdit"],
body.view-only #view :is(button, .btn)[data-act="progMove"],
body.view-only #view :is(button, .btn)[data-act="prayerAssign"],
body.view-only #view .btn.danger { display: none !important; }
body.view-only #view tr.click { cursor: default; }

table.program td { vertical-align: top; }
table.program tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* new-visitor bell */
.bell { position: relative; }
.bell-n { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }

/* ---------- messages ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; }
.msg-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); padding: 0; overflow: hidden; height: calc(100vh - 200px); min-height: 460px; }
.msg-list { border-right: 1px solid var(--line); overflow-y: auto; }
.msg-ch { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.msg-ch:hover { background: var(--panel-2); text-decoration: none; }
.msg-ch.active { background: var(--brand-soft); }
.msg-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; font-size: 16px; }
.msg-prev { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.msg-head { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.msg-back { display: none; font-size: 26px; line-height: 1; padding: 0 6px; }
.msg-pin { padding: 8px 16px; background: var(--brand-soft); font-size: 13px; border-bottom: 1px solid var(--line); }
.msg-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--panel-2); padding: 2px 10px; border-radius: 10px; margin: 6px 0; }
.msg { max-width: min(75%, 560px); align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; }
.msg.mine { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.msg.mine .msg-meta, .msg.mine .msg-meta a { color: rgba(255,255,255,.8); }
.msg.ann { border: 2px solid var(--warn); }
.msg-tag { font-size: 11px; font-weight: 800; color: var(--warn); margin-bottom: 2px; }
.msg.mine .msg-tag { color: #ffe9a8; }
.msg-who { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.msg-body { white-space: pre-wrap; word-wrap: break-word; }
.msg-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg-compose { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 6px; }
.msg-compose textarea { resize: none; font-size: 15px; }
.msg-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 800px) {
  .msg-wrap { grid-template-columns: 1fr; height: calc(100vh - 170px); }
  .msg-wrap.has-thread .msg-list { display: none; }
  .msg-wrap:not(.has-thread) .msg-thread { display: none; }
  .msg-back { display: block; }
}

/* ---------- rosters ---------- */
table.roster { border-collapse: collapse; min-width: 100%; }
table.roster th, table.roster td { border: 1px solid var(--line); padding: 4px 8px; text-align: center; white-space: nowrap; }
table.roster td:nth-child(3), table.roster th:nth-child(3) { text-align: left; }
table.roster .roster-title th { background: color-mix(in srgb, var(--info) 22%, transparent); font-size: 15px; text-transform: none; letter-spacing: 0; }
table.roster thead tr:not(.roster-title) th { font-weight: 800; }
table.roster .roster-whole td:last-child { background: color-mix(in srgb, var(--danger) 14%, transparent); font-weight: 800; }
.roster-in { width: 100%; min-width: 120px; border: 0; background: transparent; text-align: center; padding: 6px 4px; font: inherit; color: inherit; }
.roster-in:focus { outline: 2px solid var(--brand); background: var(--panel); border-radius: 4px; }
@media print { table.roster th, table.roster td { border: 1px solid #333; color: #000; } .roster-print { page-break-after: auto; } }

/* edit-all program */
.pb-table { width: 100%; border-collapse: collapse; }
.pb-table td, .pb-table th { padding: 4px; vertical-align: top; }
.pb-table input:not([type=checkbox]) { width: 100%; }
.pb-table .pb-notes { margin-top: 4px; font-size: 12px; }
.pb-table .pb-mins { width: 70px; }
.pb-table td:first-child { min-width: 220px; }
.pb-table .center { text-align: center; padding-top: 12px; }

table.roster td.linked { position: relative; }
table.roster td.linked::after { content: ''; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

/* several-people dropdown */
.pp { position: relative; }
.pp-box { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.pp-box:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.pp-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.pp-chip { background: var(--brand-soft); color: var(--text); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.pp-caret { color: var(--muted); }
.pp-menu { margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; }
.pp-search { width: 100%; margin-bottom: 6px; }
.pp-list { max-height: 220px; overflow-y: auto; display: grid; gap: 2px; }
.pp-opt { display: flex; gap: 8px; align-items: center; padding: 6px 6px; border-radius: 6px; cursor: pointer; }
.pp-opt:hover { background: var(--panel-2); }
.pp-add { margin: 6px 0 0; width: 100%; }
.pp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* cancelled event dates */
.cal .ev.cancelled { text-decoration: line-through; opacity: .55; }
table.roster th.cancelled { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.scope-grid { display: grid; gap: 8px; margin-top: 12px; }
.scope-grid .btn { justify-content: flex-start; }

/* ---------- chord charts ---------- */
.chart-sheet { font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.35; overflow-x: auto; }
.chart-sheet .cl-sec { font-family: inherit; font-weight: 800; color: var(--brand); margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .04em; font-size: .8em; }
.chart-sheet .cl-gap { height: .6em; }
.chart-sheet .cl-chords { white-space: pre; color: var(--brand); font-weight: 800; }
.chart-sheet .cl-line { white-space: pre-wrap; }
.chart-sheet .cl-inline { display: flex; flex-wrap: wrap; align-items: flex-end; margin-top: 2px; }
.chart-sheet .cl-pair { display: inline-flex; flex-direction: column; }
.chart-sheet .cl-pair b { color: var(--brand); min-height: 1.3em; padding-right: 4px; }
@media print { .chart-print .chart-sheet b, .chart-print .cl-chords, .chart-print .cl-sec { color: #000 !important; } }
/* ministry roster (ministryroster.js) */
table.mroster td:first-child, table.mroster th:first-child { text-align: left; }
table.mroster td.mr-cell { white-space: normal; min-width: 120px; vertical-align: top; }
table.mroster td.mr-cell.editable { cursor: pointer; }
table.mroster td.mr-cell.editable:hover { background: var(--brand-soft); }
table.mroster td.mr-cell.mine { background: color-mix(in srgb, var(--ok, #2e7d32) 14%, transparent); }
table.mroster .pp-chip { display: inline-block; margin: 2px 0; }
.mr-note { margin-top: 3px; max-width: 200px; text-align: left; }
/* schedule-style roster (ministryroster.js): colored title bar, one shaded row per service, centered names */
.roster-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
table.sched { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 13px; }
table.sched th, table.sched td { border: 1px solid color-mix(in srgb, var(--mc) 35%, var(--line)); padding: 4px 8px; text-align: center; vertical-align: middle; }
table.sched th { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
table.sched .sched-title th { background: var(--mc); color: #fff; font-weight: 800; letter-spacing: .03em; font-size: 14px; }
table.sched .sched-svc th { background: color-mix(in srgb, var(--mc) 22%, var(--panel)); font-weight: 800; white-space: nowrap; }
table.sched .sched-svc th:first-child { text-align: left; }
table.sched .sched-pos { white-space: nowrap; min-width: 150px; }
table.sched .sched-pad { background: color-mix(in srgb, var(--mc) 14%, var(--panel)); }
table.sched th.cancelled { text-decoration: line-through; opacity: .7; }
table.sched td.editable { cursor: pointer; }
table.sched td.editable:hover { background: var(--brand-soft); }
table.sched td.mine { background: color-mix(in srgb, var(--ok) 18%, transparent); font-weight: 700; }
table.sched .mr-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sched-gear { font-size: 13px; padding: 0 4px; vertical-align: middle; }
@media print { .sched-print table.sched { min-width: 0; font-size: 11px; } .sched-print table.sched .sched-title th { background: var(--mc) !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sched-print table.sched .sched-svc th, .sched-print table.sched .sched-pad { -webkit-print-color-adjust: exact; print-color-adjust: exact; } .sched-print table.sched td, .sched-print table.sched th { color: #000; } }
table.sched td:not(.sched-pos):not(.sched-pad), table.sched .sched-svc th:not(:first-child):not(.sched-pad) { min-width: 104px; }
/* roster sheet (rostersheet.js): the printed schedule, editable in place */
table.sheet .sh-in { width: 100%; min-width: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: center; padding: 3px 2px; border-radius: 4px; }
table.sheet .sh-in:hover { background: color-mix(in srgb, var(--mc) 10%, transparent); }
table.sheet .sh-in:focus { outline: 2px solid var(--mc); background: var(--panel); }
table.sheet .sched-title .sh-title { color: #fff; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
table.sheet .sched-title .sh-title:focus { color: var(--text); }
table.sheet .sh-svc { display: flex; gap: 4px; align-items: center; }
table.sheet .sh-bname { text-align: left; font-weight: 800; min-width: 120px; }
table.sheet .sh-day { width: auto; flex: none; font-weight: 700; }
table.sheet .sh-time { width: 92px; flex: none; }
table.sheet .sched-pos .sh-in { text-align: center; }
table.sheet td { padding: 2px 4px; }
table.sheet .sh-x { font-size: 11px; padding: 0 3px; opacity: .55; }
table.sheet .sh-x:hover { opacity: 1; }
table.sheet .sh-addrow { text-align: left; background: transparent; padding: 2px 6px; }
table.sheet .sh-add { background: transparent; }
.sh-unknown { color: #c9731a !important; }
/* ministry Team list: position and open tasks under each name (ministryroster.js memberTags) */
.pos-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.pos-tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; line-height: 1.6; border: 1px solid transparent; }
.pos-tag.pos-sing { background: color-mix(in srgb, #d6336c 16%, var(--panel)); color: #b02a5b; border-color: color-mix(in srgb, #d6336c 40%, transparent); }
.pos-tag.pos-play { background: color-mix(in srgb, #1a73e8 16%, var(--panel)); color: #1559b8; border-color: color-mix(in srgb, #1a73e8 40%, transparent); }
.pos-tag.pos-other { background: color-mix(in srgb, #2e8b57 16%, var(--panel)); color: #23704a; border-color: color-mix(in srgb, #2e8b57 40%, transparent); }
.pos-tag.pos-task { background: color-mix(in srgb, #e0a800 16%, var(--panel)); color: #8a6400; font-weight: 600; border-color: color-mix(in srgb, #e0a800 40%, transparent); }
table.sheet td:not(.sched-pos):not(.sched-pad):not(.sh-addrow), table.sheet .sched-svc th:not(:first-child):not(.sched-pad):not(.sh-add) { min-width: 132px; }
table.sheet .sh-time { width: 108px; }
/* Show / Hide button inside password boxes (cloud.js addPasswordEyes) */
.pw-wrap{position:relative;display:block}
.pw-wrap input{width:100%;padding-right:64px}
.pw-eye{position:absolute;right:6px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--brand);font:inherit;font-size:13px;font-weight:700;padding:6px 8px;cursor:pointer;border-radius:6px}
.pw-eye:hover{background:var(--panel-2)}

/* Spaces: when rooms are free (bookings.js) */
table.avail { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
table.avail th, table.avail td { border: 1px solid var(--line); padding: 6px; vertical-align: top; text-align: left; }
table.avail thead th { text-align: center; font-size: 12px; }
table.avail thead th.today { background: var(--brand-soft); }
table.avail th { text-transform: none; letter-spacing: 0; color: var(--text); }
table.avail tbody th { width: 120px; font-weight: 700; }
table.avail td.past { background: color-mix(in srgb, var(--line) 30%, transparent); }
table.avail .slot { display: block; margin-bottom: 4px; padding: 3px 6px; border-radius: 6px; background: color-mix(in srgb, #c0392b 14%, var(--panel)); border-left: 3px solid #c0392b; line-height: 1.3; overflow-wrap: anywhere; }
table.avail .slot.pending { background: repeating-linear-gradient(45deg, color-mix(in srgb, #e0a800 18%, var(--panel)) 0 6px, var(--panel) 6px 12px); border-left-color: #e0a800; }
table.avail .slot-book { display: block; margin-top: 4px; width: 100%; }
/* demo site (js/demo.js): a small bar at the bottom with Reset */
.demo-bar { position: fixed; z-index: 60; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; white-space: nowrap;
  max-width: calc(100vw - 32px); padding: 6px 8px 6px 14px; border-radius: 999px; background: #e07b16; color: #fff; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.demo-bar .btn { background: #fff; color: #8a4a00; border-color: transparent; }
@media (max-width: 900px) { .demo-bar span { display: none; } }
@media print { .demo-bar { display: none; } }

/* ---------- roster rules (update 24): themes, skills, log, check-in, the Today notice and the emergency alarm ---------- */
.sched-theme td { background: var(--brand-soft); font-size: 12px; }
.sched-theme td .sh-in { font-weight: 600; }
.sh-marks { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; justify-content: center; }
.sh-part { font-size: 10px; padding: 0 5px; border-radius: 8px; background: #efe7fb; color: #5b3f99; }
.sh-mark { font-size: 11px; }
td { position: relative; }
.sh-swap { border: 0; background: none; cursor: pointer; font-size: 12px; padding: 0 2px; color: var(--brand); }
.sh-sub { font-size: 14px; margin: 14px 0 4px; }
.sh-log { margin-top: 8px; }
.sh-log summary { cursor: pointer; color: var(--muted); }
.pos-tag.pos-skill { background: #eef3fb; color: #2a5590; }
.church-logo { height: 28px; width: auto; max-width: 90px; object-fit: contain; margin-left: 8px; border-radius: 4px; }
.alarm-btn span { display: inline; }
@media (max-width: 700px) { .alarm-btn span { display: none; } }
.today-back { position: fixed; inset: 0; background: rgba(15, 18, 12, .55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.today-card { max-width: 460px; width: 100%; }
.alarm-screen { position: fixed; inset: 0; z-index: 80; background: #d63a3a; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 24px; animation: alarmPulse 2s ease-in-out infinite; }
.alarm-screen h2 { font-size: 30px; margin: 0; color: #fff; }
.alarm-screen p { max-width: 520px; margin: 0; font-size: 17px; line-height: 1.5; }
.alarm-screen .alarm-icon { font-size: 54px; line-height: 1; }
.alarm-screen .alarm-kicker { letter-spacing: 3px; font-size: 13px; font-weight: 700; color: #ffe1e1; }
.alarm-screen .alarm-meta { font-size: 13px; color: #ffe1e1; }
.alarm-screen .btn { width: min(360px, 100%); font-size: 18px; padding: 14px; justify-content: center; }
.alarm-screen .alarm-safe { background: #fff; color: #2f6b0a; border-color: #fff; margin-top: 10px; }
.alarm-screen .alarm-help { background: transparent; color: #fff; border: 2px solid #fff; }
@keyframes alarmPulse { 50% { background: #c42f2f; } }
@media (prefers-reduced-motion: reduce) { .alarm-screen { animation: none; } }
.btn.emerg { color: var(--danger); border-color: var(--danger); }

/* Team & roles: drop-down role groups with tables of 10 */
.team-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.team-tools input { flex: 1; min-width: 180px; }
.team-tools select { width: auto; }
.team-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.team-group > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 10px 12px; list-style: none; }
.team-group > summary::-webkit-details-marker { display: none; }
.team-group > summary::before { content: '›'; font-size: 18px; line-height: 1; transition: transform .15s; color: var(--muted); }
.team-group[open] > summary::before { transform: rotate(90deg); }
.team-group .table-wrap { margin: 0 12px 8px; }
.team-table { width: 100%; min-width: 640px; }
.team-table td { vertical-align: top; }
.team-email { word-break: break-all; }
.team-roles { display: flex; gap: 4px; flex-wrap: wrap; }
.team-pages { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 0 12px 10px; }
.team-pages .muted { margin-right: auto; }
/* Song library: custom text columns filled in straight in the table */
.song-cell { width: 150px; min-width: 110px; padding: 5px 8px; border: 1px solid transparent; background: transparent; border-radius: 8px; font: inherit; color: inherit; }
.song-cell:hover { border-color: var(--line); }
.song-cell:focus { border-color: var(--brand); background: var(--panel); outline: none; }
th .icon-btn { width: 22px; height: 22px; font-size: 13px; vertical-align: middle; }

/* Service Planner: the program flow table */
table.flow td { vertical-align: top; }
table.flow td:nth-child(4), table.flow td:nth-child(5) { min-width: 150px; }
table.flow tr.flow-head td { background: var(--panel-2); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
table.flow tr.flow-song td { font-size: .92em; background: color-mix(in srgb, var(--services, #7a5af8) 6%, var(--panel)); }
table.flow tr.flow-mine td { background: color-mix(in srgb, var(--brand, #5b4fc4) 12%, var(--panel)); }
table.flow tfoot td { border-top: 2px solid var(--line); }
.flow-red { color: #d32f2f; font-weight: 700; }
.flow-setlist { margin-top: 6px; line-height: 1.5; }
.brand img { object-fit: cover; }
/* Service type: typing straight into the program flow */
table.flow-edit .flow-in { width: 100%; min-width: 0; padding: 5px 7px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: inherit; font: inherit; resize: vertical; }
table.flow-edit .flow-in:hover { border-color: var(--line); }
table.flow-edit .flow-in:focus { border-color: var(--brand); background: var(--panel); outline: none; }
table.flow-edit input.flow-min { width: 64px; display: inline-block; }
table.flow-edit td.flow-seg { min-width: 230px; }
table.flow-edit td:nth-child(4) { min-width: 210px; }
table.flow-edit td:nth-child(5) { min-width: 230px; }
table.flow-edit td:nth-child(6) { min-width: 170px; }
table.flow-edit textarea.flow-in { field-sizing: content; min-height: 34px; }
table.flow-edit tr:not(:hover):not(:focus-within) .flow-check:not(:has(input:checked)) { visibility: hidden; }
.flow-view { cursor: text; padding: 5px 7px; border: 1px solid transparent; border-radius: 7px; min-height: 30px; }
.flow-view:hover, .flow-view:focus { border-color: var(--line); outline: none; }
.flow-check { display: flex; align-items: center; gap: 6px; margin: 4px 0 0 7px; }
.flow-check input { width: auto; }
.st-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.st-fields .flow-in { padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: inherit; font: inherit; width: auto; }
.st-fields .st-name { font-size: 18px; font-weight: 700; min-width: 220px; }
.tpl-pick { width: auto; padding: 5px 8px; font-size: 13px; border-radius: 8px; }

/* Export: choose Excel, CSV, Word or PDF */
.export-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.export-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; height: auto; text-align: left; white-space: normal; }

/* New version uploaded: tap to refresh */
.update-bar { position: fixed; z-index: 70; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; white-space: nowrap;
  background: var(--panel); color: var(--text); border: 1px solid var(--brand); border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-weight: 600; }

/* Anointed Tree (tree.js) */
.tree { list-style: none; margin: 0; padding-left: 22px; border-left: 2px solid var(--line); }
.tree.tree-top { padding-left: 0; border-left: 0; }
.tree li { margin: 4px 0; }
.tree summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: '▸'; width: 12px; color: var(--muted); }
.tree details[open] > summary::before { content: '▾'; }
.tree .tree-leaf { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0 4px 18px; }
.tree-name a { font-weight: 600; }
.tree-hit { background: var(--brand-soft); border-radius: 6px; padding: 0 6px; }
.tree-move { padding: 2px 8px; }
.leader-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.leader-opt { display: flex; gap: 8px; align-items: center; justify-content: space-between; text-align: left; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.leader-opt:hover { border-color: var(--brand); }
/* Attendance: the door QR code (attendance.js) */
.att-qr svg { width: 100%; max-width: 420px; height: auto; box-sizing: border-box; background: #fff; padding: 12px; border-radius: 12px; }
/* Family: the join form's children rows and the guests − 0 + picker (js/family.js, attendance.js) */
.kid-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.kid-row .kid-first { flex: 1; min-width: 0; }
.kid-row .kid-birth { width: 150px; }
.guest-pick { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.guest-pick output { min-width: 28px; text-align: center; font-size: 18px; font-weight: 700; }
