: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; }
.multi-find { width: 100%; margin-bottom: 6px; }
.multi-count { display: block; margin-top: 4px; }

.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; }
/* Eye button inside password boxes (cloud.js addPasswordEyes) */
.pw-wrap{position:relative;display:block}
.pw-wrap input{width:100%;padding-right:46px}
.pw-eye{position:absolute;right:4px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--muted);padding:7px;cursor:pointer;border-radius:8px;display:flex;line-height:0}
.pw-eye svg{width:20px;height:20px}
.pw-eye:hover{color:var(--text);background:var(--panel-2)}
.code-input{font-size:24px;letter-spacing:.35em;text-align:center;font-variant-numeric:tabular-nums}

/* 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)); }
tr.sl-head td { background: var(--panel-2); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
table.flow tr.flow-setlist td { background: color-mix(in srgb, var(--services, #7a5af8) 10%, 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-tag { display: inline-flex; align-items: center; gap: 2px; margin: 0 4px 4px 0; padding: 1px 2px 1px 8px; border-radius: 999px; background: var(--brand-soft); font-weight: 600; }
.flow-tag .icon-btn { width: 20px; height: 20px; min-width: 0; padding: 0; font-size: 11px; }
.flow-tag-menu { position: fixed; z-index: 1000; width: 260px; max-height: 280px; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.flow-tag-opt { display: block; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.flow-tag-opt:hover, .flow-tag-opt.on { background: var(--panel-2); }
.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; }
/* Join form: country code + mobile number (cloud.js joinScreen) */
.phone-row { display: flex; gap: 6px; }
.phone-row select { flex: none; width: 112px; }
.phone-row input { flex: 1; min-width: 0; }
.link-mins { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 50%; }
/* People directory: tap a heading to sort (people.js peopleHead) */
th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-sort:hover { color: var(--text); }
.sort-arrow { font-size: 10px; color: var(--brand); }
#peopleSortSel { max-width: 220px; }
/* Anointed Tree chart view (tree.js treeChartHtml): cards joined by lines, the classic organisation chart */
.oc-switch, .oc-zoom { display: inline-flex; gap: 4px; }
.oc-scroll { overflow: auto; -webkit-overflow-scrolling: touch; padding: 6px 0 14px; }
.oc { width: max-content; min-width: 100%; --oc-line: var(--brand); } /* as wide as the chart, so nothing is cut off on the left */
.oc ul { display: flex; justify-content: center; margin: 0; padding: 18px 0 0; position: relative; }
.oc li { list-style: none; position: relative; padding: 18px 5px 0; display: flex; flex-direction: column; align-items: center; }
.oc li::before, .oc li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 2px solid var(--oc-line); }
.oc li::after { right: auto; left: 50%; border-left: 2px solid var(--oc-line); }
.oc li:only-child::before { display: none; }
.oc li:only-child::after { border-top: 0; }
.oc li:first-child::before, .oc li:last-child::after { border: 0 none; }
.oc li:last-child:not(:only-child)::before { border-right: 2px solid var(--oc-line); border-radius: 0 8px 0 0; }
.oc li:first-child:not(:only-child)::after { border-radius: 8px 0 0 0; }
.oc ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid var(--oc-line); }
.oc ul ul::after { content: ''; position: absolute; top: 14px; left: calc(50% - 3px); width: 8px; height: 8px; border-radius: 50%; background: var(--oc-line); z-index: 1; }
.oc > ul { padding-top: 0; gap: 26px; width: max-content; margin: 0 auto; }
.oc > ul > li { padding-top: 0; }
.oc > ul > li::before, .oc > ul > li::after { display: none; }
.oc-card { position: relative; width: 148px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.oc-card .avatar.oc { width: 58px; height: 58px; font-size: 20px; box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--oc-line); }
.oc-name { font-weight: 800; font-size: 12.5px; line-height: 1.25; text-transform: uppercase; letter-spacing: .04em; color: var(--text) !important; text-decoration: none; }
.oc-role { max-width: 100%; background: var(--text); color: var(--panel); font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-role.pastor { background: var(--brand); color: #fff; }
.oc-wait { font-size: 10.5px; color: #b07f00; }
.oc-count { font-size: 11px; color: var(--muted); margin-top: -2px; }
@media print { .oc-print .oc-count { color: #555; } }
.oc-pending { border: 2px dashed #c99a06; }
.oc-hit { outline: 3px solid var(--brand); outline-offset: 3px; }
.oc-move { border: 0; background: var(--panel-2); color: var(--muted); font: inherit; font-size: 11px; padding: 2px 10px; border-radius: 6px; cursor: pointer; }
.oc-move:hover { color: var(--text); }
.oc-toggle { position: relative; margin-top: 8px; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; border: 2px solid var(--oc-line); background: var(--panel);
  color: var(--oc-line); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; line-height: 1; }
.oc-toggle::before { content: ''; position: absolute; bottom: 100%; left: calc(50% - 1px); height: 8px; border-left: 2px solid var(--oc-line); }
.oc-toggle + ul { padding-top: 18px; }
@media print {
  .oc-print .oc-scroll { overflow: visible; }
  .oc-print .oc { --oc-line: #568203; }
  .oc-print .oc-card { box-shadow: none; border-color: #bbb; background: #fff; break-inside: avoid; }
  .oc-print .oc-name { color: #000 !important; }
  .oc-print .oc-role, .oc-print .oc-role.pastor, .oc-print .avatar, .oc-print .oc ul ul::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .oc-print .oc-role { background: #1d2116; color: #fff; }
  .oc-print .oc-role.pastor { background: #568203; }
  .oc-print .oc-move, .oc-print .oc-toggle { display: none; }
}
.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; }

/* The piano in the worship set (v61) */
.piano { position: relative; display: flex; height: 92px; margin-top: 6px; max-width: 340px; user-select: none; -webkit-user-select: none; }
.pk { border: 1px solid var(--line); padding: 0; cursor: pointer; }
.pk.w { flex: 1; background: #fff; color: #333; border-radius: 0 0 6px 6px; display: flex; align-items: flex-end; justify-content: center; font-size: 11px; padding-bottom: 5px; }
.pk.b { position: absolute; top: 0; width: 9%; height: 58%; margin-left: -4.5%; background: #222; border-color: #000; border-radius: 0 0 4px 4px; z-index: 1; }
.pk.on, .pk:active { background: var(--brand); color: #fff; }
/* My availability (v61) */
.avail-cal .day { cursor: pointer; min-height: 70px; }
.avail-cal .day.avail-off { background: color-mix(in srgb, var(--danger) 12%, transparent); }
@media (max-width: 640px) { .avail-cal .ev { font-size: 9px; padding: 1px 3px; white-space: normal; } .avail-cal .day { min-height: 58px; padding: 3px; } }
/* Message reactions (v61) */
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-react { border: 1px solid var(--line); background: var(--panel-2); border-radius: 99px; padding: 1px 7px; font-size: 12px; cursor: pointer; color: inherit; }
.msg-react.me { border-color: var(--brand); }
.msg-pick { display: flex; gap: 4px; margin-top: 4px; }
.msg-pick button { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; font-size: 18px; padding: 2px 6px; cursor: pointer; }

/* v73: Book a space, Internal or External */
.book-choice { display: grid; gap: 10px; }
.book-choice .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; text-align: left; white-space: normal; height: auto; }

/* v73: the phone and tablet apps (js/appshell.js). The website doesn't get body.app-mode. */
.app-tabbar { display: none; }
body.app-mode .sidenav, body.app-mode .nav-toggle, body.app-mode .global-search, body.app-mode .brand span { display: none; }
body.app-mode .topbar { justify-content: flex-start; gap: 8px; }
body.app-mode .topbar .church-name { display: none; }
body.app-mode #syncStatus { margin-left: auto; }
body.app-mode #bellBtn { margin-left: auto; }
body.app-mode #syncStatus:not([hidden]) ~ #bellBtn { margin-left: 0; }
body.app-mode .view { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; width: 100%; min-width: 0; }
body.app-mode .app-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
body.app-mode .app-tabbar[hidden] { display: none; }
.app-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; font-size: 11px; color: var(--muted); }
.app-tabbar a:hover { text-decoration: none; }
.app-tabbar a.on { color: var(--brand); font-weight: 700; }
.app-tabbar svg { width: 22px; height: 22px; }
.app-hero { background: var(--brand); color: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.app-hero .small { opacity: .85; }
.app-hero h2 { font-size: 22px; margin: 2px 0 0; color: #fff; }
.app-head { display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; }
.app-head h3 { margin: 0; }
.app-event, .app-link, .app-profile { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; color: inherit; }
.app-link:hover { text-decoration: none; }
.app-date { text-align: center; min-width: 42px; }
.app-date b { font-size: 20px; font-weight: 800; }
.app-swatch { width: 10px; align-self: stretch; min-height: 30px; border-radius: 5px; flex: none; }
.app-profile { margin-bottom: 16px; }
.app-more { padding: 8px; }
.app-more a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.app-more a:hover { background: var(--panel-2); text-decoration: none; }
.app-more a.active { background: var(--brand-soft); font-weight: 650; }
.app-more .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.app-more .dot svg { width: 15px; height: 15px; }
.app-more .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.app-more .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 10px; }
@media print { .app-tabbar { display: none !important; } }
body.app-mode .demo-bar { bottom: calc(66px + env(safe-area-inset-bottom)); }
/* v75: top bar, green header and tab bar stay put like a native app: only the page between them scrolls, with no bounce. */
html:has(body.app-mode) { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.app-mode { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; overscroll-behavior: none; }
body.app-mode .layout { flex: 1; min-height: 0; }
body.app-mode .view { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.app-mode .app-hero { position: sticky; top: 0; z-index: 5; }

/* v75: a small drop-down filter inside a table heading */
.th-filter { width: 22px; max-width: 120px; margin-left: 4px; padding: 0 1px; font-size: 11px; height: 20px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); color: var(--muted); cursor: pointer; vertical-align: middle; }
.th-filter:focus { width: auto; }

/* v75: the phone and tablet apps fit the screen and turn sideways cleanly (landscape, iPad). */
body.app-mode .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.app-mode img, body.app-mode iframe, body.app-mode video { max-width: 100%; }
body.app-mode .view { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
body.app-mode .app-tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
@media (orientation: landscape) and (max-height: 520px) {
  body.app-mode .view { max-width: none; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .app-tabbar a { flex-direction: row; justify-content: center; gap: 6px; padding: 6px 0; }
  .app-tabbar svg { width: 18px; height: 18px; }
  .app-hero { padding: 8px 14px; margin-bottom: 8px; }
  .app-hero h2 { font-size: 18px; }
}
@media (min-width: 700px) { body.app-mode .view { max-width: 980px; } body.app-mode .grid.g2, body.app-mode .grid.g3 { display: grid; } }

/* v75: phone and tablet apps in a social feed style: story row, feed posts, icon tab bar with a + in the middle. */
body.app-mode .topbar .brand span { display: inline; font: 600 15px 'Avenir Next', 'Avenir', 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--text); }
body.app-mode .topbar .brand b { color: inherit; font-weight: 700; }
body.app-mode .topbar .brand img { display: block; width: 32px; height: 32px; border-radius: 9px; object-fit: cover; flex: 0 0 auto; }
.app-more-btn { display: grid; place-items: center; width: 34px; height: 34px; color: var(--text); flex: none; }
.app-more-btn svg { width: 22px; height: 22px; }
.app-hi { font-size: 22px; margin: 4px 0 10px; }
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; margin: 0 -2px 4px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 68px; flex: none; color: var(--muted); font-size: 11px; }
.story:hover { text-decoration: none; }
.story .ring { width: 64px; height: 64px; border-radius: 50%; padding: 3px; background: conic-gradient(#4F7D05, #D4A017, #C2185B, #4F7D05); display: block; }
.story .ring.seen { background: var(--line); }
.story .ring i { display: flex; width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--bg, var(--panel)); align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: 17px; color: #fff; }
.story-name { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.post-head small { color: var(--muted); font-size: 11px; }
.post .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.post-media { min-height: 120px; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; color: #fff; background: linear-gradient(135deg, #27500A, #4F7D05 60%, #9BD23C); }
.post-media small { opacity: .9; } .post-media b { font-size: 21px; line-height: 1.15; }
.post-text { padding: 0 14px 14px; } .post-text b { display: block; margin-bottom: 4px; }
.post-foot { padding: 10px 14px; font-size: 13px; }
body.app-mode .app-tabbar { grid-template-columns: repeat(5, 1fr); align-items: center; padding-top: 4px; }
body.app-mode .app-tabbar a, body.app-mode .app-tabbar .tab-plus { display: grid; place-items: center; height: 46px; color: var(--muted); background: none; border: 0; padding: 0; font-size: 0; }
body.app-mode .app-tabbar a.on { color: var(--brand); }
body.app-mode .app-tabbar svg { width: 25px; height: 25px; }
body.app-mode .app-tabbar .tab-plus { color: var(--text); cursor: pointer; }
.tab-me { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid transparent; }
.app-tabbar a.on .tab-me { border-color: var(--text); }

/* v75: the website home gets a welcome band (same family as the phone app). */
.site-hero { background: var(--brand); color: #fff; border-radius: 16px; padding: 22px 24px; margin-bottom: 18px; }
.site-hero small { opacity: .88; } .site-hero h1 { color: #fff; font-size: 28px; margin: 2px 0 14px; }
.site-hero .pill { display: inline-block; padding: 7px 15px; border-radius: 999px; font-size: 13px; margin: 0 8px 6px 0; background: rgba(255,255,255,.2); color: #fff; }
.site-hero .pill.w { background: #fff; color: #27500A; font-weight: 600; } .site-hero .pill:hover { text-decoration: none; filter: brightness(1.08); }
.card { border-radius: 14px; }

/* v75: replies in Messages */
.msg-quote { font-size: 12px; color: var(--muted); border-left: 3px solid var(--brand); padding: 2px 8px; margin: 0 0 3px; border-radius: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-replying { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 12px; background: var(--panel-2); border-top: 1px solid var(--line); }
.msg-replying a { margin-left: auto; }

/* ---------- v76: phone fixes ---------- */
/* Files & Links: the row wraps so the title, the notes and the buttons all fit and read in full */
.link-row { flex-wrap: wrap; align-items: flex-start; }
.link-row .link-body { min-width: 0; flex: 1 1 160px; overflow-wrap: anywhere; }
.link-row .link-notes { white-space: normal; display: block; margin-top: 2px; }
body.app-mode .link-row .link-mins { flex: 1 0 100%; order: 3; }
body.app-mode .link-row .btn { order: 4; }
/* Ministry schedule table in portrait: compact so the dates fit, scroll sideways for more, zoom with - Fit + */
.sh-zoombar { display: flex; gap: 6px; align-items: center; margin: 4px 0 8px; }
body.app-mode .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
body.app-mode table.sched { min-width: 0; font-size: 11px; }
body.app-mode table.sched th, body.app-mode table.sched td { padding: 3px 4px; }
body.app-mode table.sched .sched-pos { min-width: 84px; white-space: normal; }
body.app-mode table.sched td:not(.sched-pos):not(.sched-pad), body.app-mode table.sched .sched-svc th:not(:first-child):not(.sched-pad) { min-width: 62px; }
body.app-mode table.sheet .sh-in { font-size: 11px; padding: 2px 1px; }
@media (orientation: portrait) { body.app-mode table.sched .sched-svc th { white-space: normal; } }
/* nothing but the schedule table zooms */
body.app-mode, body.app-mode .view { touch-action: pan-x pan-y; }
body.app-mode .table-wrap:has(.sheet) { touch-action: pan-x pan-y pinch-zoom; }

/* Dashboard: drag a card by its grip to move it up or down (v76) */
.dash-grip { cursor: grab; touch-action: none; user-select: none; padding: 0 6px; color: var(--muted); font-size: 16px; line-height: 1; }
.dash-drag { opacity: .6; outline: 2px dashed var(--brand); }

/* Live Program flow (v77) */
.live-box { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2, var(--panel)); }
.live-box[hidden] { display: none; }
.live-box.on { border-color: var(--danger, #c0392b); }
.live-top { display: flex; gap: 8px; align-items: center; font-size: 12px; letter-spacing: .06em; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger, #c0392b); animation: livepulse 1.4s infinite; }
.live-dot.paused { animation: none; background: var(--warn, #d4a017); }
@keyframes livepulse { 50% { opacity: .25; } }
.live-seg { font-size: 22px; font-weight: 800; margin: 4px 0 0; line-height: 1.2; }
.live-clock { font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 2px 0 6px; }
.live-clock.soon { color: var(--warn, #d4a017); }
.live-clock.over { color: var(--danger, #c0392b); }
.live-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.live-bar span { display: block; height: 100%; background: var(--brand); }
.live-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.live-btns .btn { flex: 1 1 120px; min-height: 46px; font-size: 15px; }
body.app-mode .live-clock { font-size: 48px; }

.piano-chord{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0 2px}
.piano-chord[hidden]{display:none}

/* v89: the check-in marks (X, check, clock) sit at the right end of the name cell, on the same line as the name */
table.sheet td { position: relative; }
table.sheet td:has(.sh-marks) { padding-right: 28px; }
table.sheet .sh-marks { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); margin: 0; flex-wrap: nowrap; }

/* v90: on the phone and tablet apps the roster table fits: names keep their room, the marks sit small at the right edge */
body.app-mode table.sheet td:has(.sh-marks) { padding-right: 20px; }
body.app-mode table.sheet .sh-marks { right: 2px; top: 6px; transform: none; }
body.app-mode table.sheet .sh-marks .sh-mark { font-size: 10px; line-height: 1; }
body.app-mode table.sheet td { word-break: normal; overflow-wrap: anywhere; hyphens: auto; }

/* v91: On/Off switch for check-in by location */
.gps-switch { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(128,128,128,.5); background: transparent; color: inherit; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; font-weight: 600; }
.gps-switch .gps-knob { width: 22px; height: 22px; border-radius: 50%; background: #b9b9b0; transition: background .15s; }
.gps-switch.on { background: rgba(90,138,31,.22); border-color: #5a8a1f; }
.gps-switch.on .gps-knob { background: #5a8a1f; }

/* v101: team rows and the Worship Setlist rows fit the phone */
.pos-tag { white-space: normal; border-radius: 10px; max-width: 100%; overflow-wrap: anywhere; }
.team-acts { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.team-li { flex-wrap: wrap; }
.team-li > .grow { flex: 1 1 180px; min-width: 0; }
@media (max-width: 700px) {
  .team-acts { flex: 1 1 100%; justify-content: flex-end; margin-left: 0; padding-top: 4px; border-top: 1px dashed rgba(128,128,128,.25); }
  .team-li .pos-tags { gap: 4px; }
  .team-li .pos-tag { font-size: 11px; padding: 2px 8px; line-height: 1.35; }
  .wl-row { gap: 8px 10px; }
  .wl-row > .grow { flex: 1 1 160px; min-width: 140px; }
  .wl-row > .grow a b { overflow-wrap: normal; word-break: normal; hyphens: none; }
  .wl-row > .btn { margin-left: auto; }
}

/* v102: church logo on the app hero; the worship set is a tidy list on the phone */
.app-hero.has-logo { display: flex; align-items: center; gap: 12px; }
.app-hero-logo { width: 52px; height: 52px; object-fit: contain; border-radius: 12px; background: #fff; padding: 4px; flex: 0 0 auto; }
.app-hero-text { min-width: 0; }
@media (max-width: 700px) {
  .app-hero-logo { width: 40px; height: 40px; }
  .setlist-table, .setlist-table tbody { display: block; width: 100%; }
  .setlist-table thead { display: none; }
  .setlist-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 2px; border-bottom: 1px solid rgba(128,128,128,.25); }
  .setlist-table tbody tr.sl-head { display: flex; background: rgba(128,128,128,.12); border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
  .setlist-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .setlist-table td:empty { display: none; }
  .setlist-table tr.sl-head td { flex: 1 1 auto; font-weight: 700; }
  .setlist-table tr:not(.sl-head) td:nth-child(1) { flex: 0 0 24px; text-align: center; }
  .setlist-table tr:not(.sl-head) td:nth-child(2) { flex: 1 1 calc(100% - 36px); font-size: 16px; }
  .setlist-table tr:not(.sl-head) td:nth-child(3) { margin-left: 32px; opacity: .8; }
  .setlist-table tr:not(.sl-head) td:nth-child(5) { font-weight: 700; }
  .setlist-table tr:not(.sl-head) td:nth-child(6)::before { content: 'BPM '; opacity: .7; }
  .setlist-table tr:not(.sl-head) td:nth-child(n+6) { font-size: 12.5px; opacity: .85; }
  .setlist-table td.right { margin-left: auto; }
}

/* v103: the Order of service (program flow) reads as a list on the phone: time and length, the segment, then who and what */
@media (max-width: 700px) {
  table.flow:not(.flow-edit), table.flow:not(.flow-edit) tbody, table.flow:not(.flow-edit) tfoot { display: block; width: 100%; }
  table.flow:not(.flow-edit) thead { display: none; }
  table.flow:not(.flow-edit) tbody tr:not(.flow-head):not(.flow-setlist) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 10px 4px; border-bottom: 1px solid rgba(128,128,128,.25); }
  table.flow:not(.flow-edit) tr.flow-head, table.flow:not(.flow-edit) tr.flow-setlist, table.flow:not(.flow-edit) tfoot tr { display: block; }
  table.flow:not(.flow-edit) td { display: block; padding: 0; border: 0; min-width: 0; }
  table.flow:not(.flow-edit) tbody tr:not(.flow-head):not(.flow-setlist) td:empty { display: none; }
  table.flow:not(.flow-edit) tr:not(.flow-head):not(.flow-setlist) td:nth-child(1) { flex: 0 0 auto; font-size: 15px; }
  table.flow:not(.flow-edit) tr:not(.flow-head):not(.flow-setlist) td:nth-child(2) { flex: 1 1 auto; opacity: .7; font-size: 13px; }
  table.flow:not(.flow-edit) tr:not(.flow-head):not(.flow-setlist) td:nth-child(3) { flex: 1 1 100%; font-size: 17px; line-height: 1.25; margin: 2px 0; }
  table.flow:not(.flow-edit) tr:not(.flow-head):not(.flow-setlist) td:nth-child(n+4) { flex: 1 1 100%; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
  table.flow:not(.flow-edit) td[data-l]:not(:empty)::before { content: attr(data-l) ': '; font-weight: 700; opacity: .7; }
  table.flow:not(.flow-edit) tr.flow-head td { display: block; }
}

/* v106: ministry logos in the app home bubbles; five dashboard cards in one row; the whole tree zoom */
.stories .story i { overflow: hidden; }
.stories .story i img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
@media (min-width: 1000px) { .grid.g4:has(> .card.stat:nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
#treeWhole { transform-origin: top left; }

/* v108: the profile picture in the You bubble and the Me tab */
.tab-me { overflow: hidden; }
.tab-me img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* v111: the whole tree as compact cards that fit the phone */
.tc-card { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; padding: 8px 10px; margin: 8px 0; background: var(--panel); }
.tc-card .tc-card { margin: 8px 0 4px; box-shadow: none; }
.tc-card.tc-pastor { border-left-color: var(--brand); background: var(--brand-soft); }
.tc-head { font-size: 15px; line-height: 1.3; margin-bottom: 4px; overflow-wrap: anywhere; }
.tc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tc-tag { font-size: 13px; line-height: 1.25; padding: 3px 9px; border-radius: 999px; background: rgba(128,128,128,.16); overflow-wrap: anywhere; }

/* v112: small photos in the compact tree tags; the chart in the app uses the same cards as the website chart */
.tc-tag { display: inline-flex; align-items: center; gap: 5px; }
.tc-tag img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
#treeWholeScroll .oc-card { width: 132px; }
.oc-card .avatar.oc { min-width: 0; flex: 0 0 auto; }

/* v113: logo row on ministry and group pages in the app */
.logo-prev { width: 52px; height: 52px; border-radius: 12px; background: rgba(128,128,128,.14); display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }

/* v114: the name at the top of the apps in Avenir Next capitals; the bar keeps everything inside the screen */
body.app-mode .topbar .brand { min-width: 0; flex: 1 1 auto; overflow: hidden; }
body.app-mode .topbar .brand span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.app-mode .topbar #userBtn { max-width: 76px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
body.app-mode .topbar #bellBtn, body.app-mode .topbar .app-more-btn { flex: 0 0 auto; }

/* ====== v115: glass design for the apps (iOS style, clean and elegant). Apps only: the website on a computer is unchanged. Fonts are unchanged.
   To go back: delete from here to the end of the file. ====== */
body.app-mode {
  --g1: color-mix(in srgb, var(--panel) 56%, transparent);
  --g2: color-mix(in srgb, var(--panel) 74%, transparent);
  --gl: color-mix(in srgb, var(--text) 13%, transparent);
  --gh: inset 0 .5px 0 rgba(255, 255, 255, .28);
  --gblur: blur(16px) saturate(150%);
  --gblur2: blur(22px) saturate(160%);
  background:
    radial-gradient(circle at 10% 4%, color-mix(in srgb, #6a9e08 30%, transparent), transparent 46%),
    radial-gradient(circle at 94% 28%, color-mix(in srgb, #5b5fc7 24%, transparent), transparent 44%),
    radial-gradient(circle at 16% 92%, color-mix(in srgb, #c99a06 20%, transparent), transparent 46%),
    var(--bg);
  background-attachment: fixed;
}
body.app-mode .topbar {
  background: var(--g2); -webkit-backdrop-filter: var(--gblur2); backdrop-filter: var(--gblur2); border-bottom: .5px solid var(--gl);
}
body.app-mode .card, body.app-mode .post, body.app-mode .app-event, body.app-mode .app-link, body.app-mode .app-profile, body.app-mode .live-box, body.app-mode .note {
  background: var(--g1); -webkit-backdrop-filter: var(--gblur); backdrop-filter: var(--gblur);
  border: .5px solid var(--gl); border-radius: 20px; box-shadow: var(--gh), 0 8px 24px rgba(0, 0, 0, .13);
}
body.app-mode .card .card, body.app-mode .card .post, body.app-mode .card .note { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; background: color-mix(in srgb, var(--panel) 40%, transparent); }
body.app-mode .app-hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-hi) 72%, transparent), color-mix(in srgb, var(--brand) 54%, transparent));
  -webkit-backdrop-filter: var(--gblur); backdrop-filter: var(--gblur); border: .5px solid rgba(255, 255, 255, .34); border-radius: 22px;
  box-shadow: var(--gh), 0 10px 26px color-mix(in srgb, var(--brand) 28%, transparent);
}
body.app-mode .app-tabbar {
  left: 14px; right: 14px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 28px; border: .5px solid var(--gl);
  background: var(--g2); -webkit-backdrop-filter: var(--gblur2); backdrop-filter: var(--gblur2); box-shadow: var(--gh), 0 12px 32px rgba(0, 0, 0, .22);
}
body.app-mode .app-tabbar a { border-radius: 20px; padding: 7px 0 8px; }
body.app-mode .app-tabbar a.on { background: var(--g1); box-shadow: var(--gh); }
@media (min-height: 521px) { body.app-mode .view { padding-bottom: calc(104px + env(safe-area-inset-bottom)); } }
body.app-mode .btn:not(.primary):not(.danger) {
  background: var(--g1); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: .5px solid var(--gl); border-radius: 12px; box-shadow: var(--gh);
}
body.app-mode .btn.primary { background: linear-gradient(180deg, var(--brand-hi), var(--brand)); border: .5px solid rgba(255, 255, 255, .3); border-radius: 12px; box-shadow: var(--gh), 0 6px 16px color-mix(in srgb, var(--brand) 32%, transparent); }
body.app-mode .btn.danger { border-radius: 12px; }
body.app-mode .chip:not(.brand):not(.ok):not(.warn):not(.bad):not(.info) { background: var(--g1); border-color: var(--gl); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
body.app-mode input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), body.app-mode select, body.app-mode textarea {
  background: color-mix(in srgb, var(--panel) 50%, transparent); border: .5px solid var(--gl); border-radius: 12px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
body.app-mode .modal-back { background: rgba(10, 14, 6, .34); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
body.app-mode .modal { background: var(--g2); -webkit-backdrop-filter: var(--gblur2); backdrop-filter: var(--gblur2); border: .5px solid var(--gl); border-radius: 22px; box-shadow: var(--gh), 0 24px 60px rgba(0, 0, 0, .3); }
body.app-mode .modal header, body.app-mode .modal footer { border-color: var(--gl); }
body.app-mode .toast { background: color-mix(in srgb, #1f2419 76%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: .5px solid rgba(255, 255, 255, .16); border-radius: 16px; }
body.app-mode .update-bar { background: var(--g2); -webkit-backdrop-filter: var(--gblur2); backdrop-filter: var(--gblur2); border: .5px solid var(--gl); border-radius: 18px; }
body.app-mode .list li, body.app-mode .card .row { border-color: var(--gl); }
body.app-mode .alarm-screen { -webkit-backdrop-filter: none; backdrop-filter: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.app-mode { --g1: color-mix(in srgb, var(--panel) 94%, transparent); --g2: color-mix(in srgb, var(--panel) 97%, transparent); }
}
@media (prefers-reduced-transparency: reduce) {
  body.app-mode { --g1: var(--panel); --g2: var(--panel); }
  body.app-mode .card, body.app-mode .post, body.app-mode .topbar, body.app-mode .app-tabbar, body.app-mode .modal, body.app-mode .btn { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* v115b: on the apps the church logo is shown once, next to the name (not a second time beside the bell) */
body.app-mode .topbar .church-logo { display: none; }

/* v116: on the narrowest phones (up to 390 px) the whole name still fits next to the bell and the name chip */
@media (max-width: 390px) {
  body.app-mode .topbar { gap: 4px; }
  body.app-mode .topbar .brand { gap: 6px; }
  body.app-mode .topbar .brand span { font-size: 12.5px; letter-spacing: .5px; }
  body.app-mode .topbar #userBtn { max-width: 62px; font-size: 11px; padding-left: 8px; padding-right: 8px; }
}

/* v118: the top bar of the apps fits on every phone width (up to 440 px, the large iPhones too): smaller name, first name in the chip */
@media (max-width: 440px) {
  body.app-mode .topbar { gap: 4px; padding-left: 10px; padding-right: 10px; }
  body.app-mode .topbar .brand { gap: 6px; }
  body.app-mode .topbar .brand span { font-size: 12.5px; letter-spacing: .5px; }
  body.app-mode .topbar #userBtn { max-width: 70px; font-size: 11.5px; padding-left: 8px; padding-right: 8px; }
}

/* v122: (1) in the apps the red Emergency button sits right next to the name, and the three-dot menu is bigger.
         (2) the windows in the apps start below the phone's clock and camera area; the Alerts window's X is big. Nothing else changes. */
body.app-mode .topbar:has(#alarmBtn:not([hidden])) .brand { flex: 0 1 auto; }
body.app-mode .topbar #alarmBtn:not([hidden]) { margin-right: auto; flex: 0 0 auto; }
body.app-mode .app-more-btn { width: 46px; height: 46px; }
body.app-mode .app-more-btn svg { width: 32px; height: 32px; }
body.app-mode .modal-back { padding-top: max(16px, calc(env(safe-area-inset-top) + 10px)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
body.app-mode .modal { max-height: calc(100vh - max(16px, calc(env(safe-area-inset-top) + 10px)) - max(16px, env(safe-area-inset-bottom))); }
.modal .big-x { font-size: 30px; line-height: 1; width: 48px; height: 48px; padding: 0; border-radius: 12px; display: grid; place-items: center; flex: none; }

/* v124: the Me page starts with the person's photo or initials; the photo at the top left is round */
.app-hero-logo.mp-photo { object-fit: cover; padding: 0; border-radius: 50%; }
.app-hero-logo.mp-initials { display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .22); color: #fff; font-weight: 700; font-size: 20px; padding: 0; }

/* v125: seven tabs (Messages and Check in added, the red dot on Check in); the typing box grows; an open chat fills the screen above the tab bar */
body.app-mode .app-tabbar { grid-template-columns: repeat(7, 1fr); }
body.app-mode .app-tabbar a, body.app-mode .app-tabbar .tab-plus { position: relative; }
body.app-mode .app-tabbar svg { width: 24px; height: 24px; }
body.app-mode .app-tabbar a.has-dot::after { content: ''; position: absolute; top: 5px; left: 50%; margin-left: 6px; width: 11px; height: 11px; border-radius: 50%; background: #e5484d; border: 2px solid var(--panel); }
.msg-compose textarea { min-height: 44px; max-height: 168px; }
@media (max-width: 800px) {
  body.app-mode .view:has(.msg-wrap.has-thread) .page-head,
  body.app-mode .view:has(.msg-wrap.has-thread) #msgReports,
  body.app-mode .view:has(.msg-wrap.has-thread) > div:has(> [data-act=msgNewDm]) { display: none; }
  body.app-mode .msg-wrap.has-thread { min-height: 0; height: calc(100dvh - 56px - env(safe-area-inset-top) - 14px - 104px - env(safe-area-inset-bottom)); }
}

/* v126: the event card on Home: the line "Coming up" alone at the top; the banner behind the event name is frosted green glass */
.post-event .post-head { padding-top: 12px; padding-bottom: 8px; }
.post-event .post-head small { font-size: 13px; }
body.app-mode .post-media { background: linear-gradient(135deg, rgba(39, 80, 10, .78), rgba(79, 125, 5, .62) 60%, rgba(155, 210, 60, .5)); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: .5px solid rgba(255, 255, 255, .38); border-radius: 14px; margin: 0 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 8px 22px rgba(39, 80, 10, .22); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }

/* v127: while typing in a chat the tab bar is hidden */
body.app-mode.msg-typing .app-tabbar { display: none; }
body.app-mode.msg-typing .view { padding-bottom: 10px; }

/* v128: the Appearance picker (Auto / Night / Day) */
.theme-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.theme-opt .theme-ic { font-size: 22px; line-height: 1; }
.theme-opt.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 700; }

/* v129: the message options sheet comes up from the bottom; the Appearance window uses the same three choice buttons as before */
.modal-back:has(.msg-sheet) { place-items: end center; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.modal:has(.msg-sheet) { width: min(560px, 100%); border-radius: 22px; }
.msg-sheet-prev { margin: 0 0 12px; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.msg-sheet-emoji { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 12px; }
.msg-sheet-emoji button { flex: 1; font-size: 26px; padding: 8px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.msg-sheet-opts { display: grid; gap: 8px; }
.msg-opt { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 48px; font-size: 16px; }
.msg-opt-ic { width: 24px; text-align: center; font-size: 18px; }
.msg-opt.danger { color: var(--danger, #c0392b); }

/* v132: the Chat options button in the chat header and its sheet */
.msg-more { font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 10px; }
.msg-opt { align-items: flex-start; text-align: left; height: auto; padding: 10px 12px; }
.msg-opt .muted { font-weight: 400; }

.msg-opt, .msg-opt > span { white-space: normal; }
.msg-opt > span:last-child { min-width: 0; text-align: left; flex: 1; }

/* v136: while the red dot shows on Check in (an event is open and you are not checked in) the icon gently wiggles; it stops by itself, and not at all with "Reduce Motion" */
@keyframes ac-wiggle {
  0%, 62%, 100% { transform: rotate(0) scale(1); }
  68% { transform: rotate(-14deg) scale(1.12); }
  76% { transform: rotate(12deg) scale(1.12); }
  84% { transform: rotate(-8deg) scale(1.08); }
  92% { transform: rotate(5deg) scale(1.04); }
}
body.app-mode .app-tabbar a.has-dot svg { animation: ac-wiggle 2.4s ease-in-out infinite; transform-origin: 50% 60%; }
@media (prefers-reduced-motion: reduce) { body.app-mode .app-tabbar a.has-dot svg { animation: none; } }

/* v141: number on the Messages tab in the phone app */
body.app-mode .app-tabbar a { position: relative; }
body.app-mode .app-tabbar a .tab-badge { position: absolute; top: 2px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid var(--panel); box-sizing: content-box; }

/* v142: phone fit for two lists (Service Planner templates, Calendar upcoming): names get room, buttons and tags move below instead of squeezing the name */
@media (max-width: 640px) {
  .list li.fit-li { flex-wrap: wrap; row-gap: 6px; align-items: flex-start; }
  .list li.fit-li .grow { flex: 1 1 140px; min-width: 140px; overflow-wrap: anywhere; }
  .list li.fit-li > span[style*="gap:6px"] { flex-basis: 100%; }
  .list li.fit-li .chip { white-space: normal; max-width: 100%; }
}

/* v148: the Emergency button gets a full thumb-size tap area on the phone */
@media (max-width: 700px) { .btn.alarm-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; } }

/* ====== v149: glass chat (Telegram style) on the phone app and the computer. To go back: delete from here to the end of the file. ====== */
.msg-wrap { --mb1: color-mix(in srgb, var(--panel) 38%, transparent); --mbl: color-mix(in srgb, #fff 24%, transparent); }
.msg-scroll { gap: 7px; padding: 14px;
  background:
    radial-gradient(circle at 10% 8%, color-mix(in srgb, #7cc10a 46%, transparent), transparent 46%),
    radial-gradient(circle at 94% 36%, color-mix(in srgb, #6c70ff 40%, transparent), transparent 48%),
    radial-gradient(circle at 20% 92%, color-mix(in srgb, #ffb81c 34%, transparent), transparent 46%),
    radial-gradient(circle at 80% 96%, color-mix(in srgb, #ff4f9a 26%, transparent), transparent 44%); }
.msg { background: linear-gradient(160deg, color-mix(in srgb, #fff 20%, var(--mb1)), var(--mb1) 55%); border: .5px solid var(--mbl); border-radius: 18px 18px 18px 6px; padding: 7px 12px 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), inset 0 -.5px 0 rgba(255, 255, 255, .10), 0 4px 14px rgba(0, 0, 0, .18); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); }
.msg.mine { background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 86%, #9be02a 14%), color-mix(in srgb, var(--brand) 78%, transparent) 60%); border-color: rgba(255, 255, 255, .42); border-radius: 18px 18px 6px 18px; }
.msg.ann { border: 1.5px solid var(--warn); }
.msg-meta { text-align: right; margin-top: 2px; }
.msg-day { background: var(--mb1); border: .5px solid var(--mbl); padding: 3px 12px; -webkit-backdrop-filter: blur(12px) saturate(170%); backdrop-filter: blur(12px) saturate(170%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.msg-head, .msg-pin { background: color-mix(in srgb, var(--panel) 52%, transparent); -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%); }
.msg-compose { background: color-mix(in srgb, var(--panel) 55%, transparent); border-top: .5px solid var(--mbl); -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%); }
.msg-compose textarea { border-radius: 18px; padding: 10px 14px; background: color-mix(in srgb, var(--panel) 45%, transparent); border: .5px solid var(--mbl); }
.msg-compose .btn.primary { border-radius: 999px; padding-left: 20px; padding-right: 20px; }

/* ====== v150: designed cards for greetings and announcements (clean, compact). To go back: delete from here to the end of the file and the v150 block in js/messages.js. ====== */
.msg.cd { flex: none; max-width: min(96%, 560px); width: 100%; padding: 0; overflow: hidden; align-self: center; border-radius: 16px; position: relative;
  background: color-mix(in srgb, var(--panel) 78%, transparent); border: .5px solid var(--mbl, rgba(255,255,255,.2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 14px rgba(0, 0, 0, .16); }
.msg.cd::before { content: ''; display: block; height: 5px; background: var(--cd-accent, linear-gradient(90deg, #7cc10a, #ffb81c)); }
.msg.cd .msg-tag, .msg.cd .msg-who { display: none; }
.msg.cd .msg-body { padding: 10px 14px 4px; white-space: normal; text-align: left; }
.msg.cd .msg-meta { padding: 0 14px 8px; text-align: left; }
.msg.cd .msg-reacts { padding: 0 12px 8px; }
.cd-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cd-emoji { font-size: 22px; line-height: 1; }
.cd-kicker { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--cd-ink, var(--brand)); }
.cd-name { font-size: 24px; font-weight: 800; line-height: 1.15; margin: 2px 0 4px; }
.cd-sub { font-size: 13.5px; color: var(--muted); }
.cd-title { font-size: 18px; font-weight: 800; line-height: 1.2; margin: 2px 0 4px; }
.cd-p { margin: 5px 0; font-size: 14px; line-height: 1.4; }
.cd-foot { margin-top: 6px; font-size: 13.5px; font-weight: 700; color: var(--cd-ink, var(--brand)); }
.cd-event { margin: 8px 0 4px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--cd-ink, var(--brand)) 12%, transparent); border: .5px solid color-mix(in srgb, var(--cd-ink, var(--brand)) 35%, transparent); }
.cd-ev-top { display: flex; align-items: center; gap: 8px; }
.cd-when { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #fff; background: var(--cd-ink, var(--brand)); padding: 2px 8px; border-radius: 99px; }
.cd-ev-title { font-size: 16px; font-weight: 800; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cd-chips span { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--text) 9%, transparent); }
.cd-ev-note { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.cd-bday { --cd-accent: linear-gradient(90deg, #ff4f9a, #ffb81c); --cd-ink: #e0407f; }
.cd-day.cd-morning { --cd-accent: linear-gradient(90deg, #ff9a5a, #ffd166); --cd-ink: #d9731f; }
.cd-day.cd-afternoon { --cd-accent: linear-gradient(90deg, #38a3e8, #7cc10a); --cd-ink: #2f7fc9; }
.cd-day.cd-evening { --cd-accent: linear-gradient(90deg, #6a4cc4, #ff9a5a); --cd-ink: #7a5ad6; }
.cd-ann { --cd-accent: linear-gradient(90deg, #5c8a12, #ffb81c); --cd-ink: #6aa516; }
/* v150: the pinned copy of the latest announcement is hidden (the whole message is in the chat as a card). To bring it back: delete this line. */
.msg-pin { display: none; }

/* ====== v152: the chat fits the phone screen (compact header, one-row message box with Send on the right, the Announcement tick only while writing). To go back: delete from here to the end of the file and the v152 lines in js/messages.js. ====== */
body.app-mode .msg-head { flex-wrap: nowrap; gap: 8px; padding: 8px 12px; }
body.app-mode .msg-head .grow { min-width: 0; }
body.app-mode .msg-head h2 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.app-mode .msg-head .grow .muted { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.app-mode .msg-head label.small { order: 3; flex: none; margin-left: auto; font-size: 11.5px; white-space: nowrap; padding: 3px 8px; border: .5px solid var(--mbl, var(--line)); border-radius: 99px; }
body.app-mode .msg-head .msg-more { order: 4; flex: none; }
body.app-mode .msg-compose { grid-template-columns: 1fr auto; align-items: end; gap: 4px 8px; padding: 8px 10px; }
body.app-mode .msg-compose textarea { grid-column: 1; grid-row: 1; min-height: 40px; }
body.app-mode .msg-actions { display: contents; }
body.app-mode .msg-actions .grow { display: none; }
body.app-mode .msg-compose .btn.primary { grid-column: 2; grid-row: 1; align-self: end; height: 40px; }
body.app-mode .msg-actions label { grid-column: 1 / -1; grid-row: 2; font-size: 13px; }
body.app-mode .msg-compose:not(:focus-within) .msg-actions label { display: none !important; }

/* v153: the "New message" button shown while you read higher up in the chat */
.msg-thread { position: relative; }
.msg-jump { position: absolute; right: 14px; bottom: 96px; z-index: 5; border: 0; border-radius: 99px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--brand); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); cursor: pointer; }
