/* ChurchBee styles.
 *
 * Every color is a variable defined in :root below (the light theme).
 * Other themes live in static/themes/<id>.css and only redefine these
 * variables — see src/theme.rs for how to add one.
 */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;        /* table heads, hover rows, quiet fills */
  --surface-3: #eef0f3;        /* pills, tracks */
  --text: #1f2933;
  --muted: #5d6b7a;
  --faint: #98a2b0;
  --border: #dde2e8;
  --border-strong: #c5ccd5;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --on-primary: #ffffff;
  --focus: #6366f1;
  --danger: #b42318;
  --danger-bg: #fdecec;
  --danger-border: #f1b8b3;
  --success: #067647;
  --success-bg: #e7f8ee;
  --warning: #93370d;
  --warning-bg: #fef3e2;
  --info: #175cd3;
  --info-bg: #eaf2ff;
  --viz-1: #2a78d6;            /* birthdays, bars */
  --viz-2: #eb6834;            /* anniversaries */
  --viz-prior: #b9c1cc;        /* the comparison period (a year earlier) */
  --event-1-bg: #eef4fc;
  --event-2-bg: #fdf1eb;
  --viz-3: #0e9384;            /* activities */
  --event-3-bg: #e7f6f4;
  --track: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --radius: 10px;
  --radius-sm: 6px;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
a.quiet { color: inherit; text-decoration: none; }
a.quiet:hover { color: var(--primary); text-decoration: underline; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: .5rem; top: .5rem; z-index: 100; background: var(--surface); color: var(--text);
  padding: .5rem .75rem; border-radius: var(--radius-sm); transform: translateY(-200%); }
.skip-link:focus { transform: none; box-shadow: var(--shadow-lg); }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
kbd { font: inherit; font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 .35rem; background: var(--surface); }

.container { width: 100%; max-width: 1200px; margin: 1.25rem auto 3rem; padding: 0 1.5rem; container-type: inline-size; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.narrow { max-width: 420px; width: 100%; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline { display: inline; margin: 0; }
.pre { white-space: pre-line; }

/* Logos: one for light backgrounds, one for dark (themes swap them). */
.logo { display: block; width: auto; }
.logo-on-dark { display: none; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 1rem; font-weight: 500; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
input[type=email], input[type=password], input[type=text], input[type=search], input[type=date], input[type=datetime-local], input[type=tel],
input[type=time], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .75rem; min-height: 2.5rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit;
  background: var(--surface); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 1.05rem; height: 1.05rem; }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; color: inherit; }
button[disabled] { opacity: .5; cursor: not-allowed; }

.button, button.primary, button.danger, button.secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem 1rem; min-height: 2.5rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-weight: 500; cursor: pointer;
  line-height: 1.2; transition: background-color .12s, border-color .12s; }
.button:hover, button.secondary:hover { background: var(--surface-2); color: var(--text); }
.button.primary, button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.button.primary:hover, button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
button.danger { color: var(--danger); border-color: var(--danger-border); }
button.danger:hover { background: var(--danger-bg); }
button.wide { width: 100%; }
button.link { background: none; border: 0; color: var(--primary); padding: 0; min-height: 0; }
.alert { background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.notice { display: flex; align-items: center; gap: .75rem; justify-content: space-between;
  background: var(--success-bg); color: var(--success); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.notice .dismiss { background: none; border: 0; color: inherit; padding: .2rem; border-radius: 4px; display: inline-flex; }
.notice .dismiss:hover { background: color-mix(in srgb, currentColor 12%, transparent); }

.form .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 1.25rem; }
.field { display: block; margin-bottom: 1rem; font-weight: 500; }
.field > span:first-child { display: block; margin-bottom: .25rem; }
.field.check { display: flex; align-items: center; gap: .5rem; padding-top: 1.75rem; font-weight: 400; }
.has-error input, .has-error select { border-color: var(--danger); }
.error { display: block; color: var(--danger); font-size: .85rem; font-weight: 400; margin-top: .2rem; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.form h2 { padding-top: .75rem; border-top: 1px solid var(--border); margin-top: .75rem; }
.form > h2:first-of-type, .form .alert + h2 { border-top: 0; padding-top: 0; }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--surface); padding: .75rem 0; margin-bottom: -.75rem;
  border-top: 1px solid var(--border); z-index: 2; }
trix-editor { min-height: 8rem; background: var(--surface); color: var(--text); border-color: var(--border-strong) !important; }
.trix-button-group--file-tools { display: none !important; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: .75rem; padding: .5rem 1.25rem; min-height: 60px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.brand { flex: none; display: inline-flex; align-items: center; }
.topbar-spacer { flex: 1; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--muted); }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button .icon { width: 22px; height: 22px; }

.quick-search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; }
.quick-search > .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.quick-search input { margin: 0; padding-left: 2.2rem; padding-right: 2rem; background: var(--surface-2); border-color: var(--border); }
.quick-search input:focus { background: var(--surface); }
.quick-search .hint { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.quick-search input:focus ~ .hint, .quick-search input:not(:placeholder-shown) ~ .hint { display: none; }
.quick-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; }
.qr-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .4rem; max-height: min(70vh, 32rem); overflow-y: auto; }
.search-page .qr-panel { box-shadow: none; border: 0; padding: 0; max-height: none; }
.qr-section + .qr-section { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .3rem; }
.qr-head { display: flex; justify-content: space-between; align-items: baseline; padding: .3rem .5rem; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.qr-head a { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .8rem; }
.qr-panel ul { list-style: none; margin: 0; padding: 0; }
.qr-hit { display: flex; gap: .6rem; align-items: center; padding: .4rem .5rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.qr-hit:hover, .qr-hit:focus { background: var(--primary-soft); color: var(--text); outline: none; }
.qr-hit > span { display: flex; flex-direction: column; min-width: 0; }
.qr-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-detail { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-empty { margin: 0; padding: .75rem; color: var(--muted); }
.avatar-xs { width: 28px; height: 28px; border-radius: 50%; flex: none; }

/* Dropdown menus built on <details>. */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .5rem;
  padding: .3rem .5rem; border-radius: var(--radius-sm); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--surface-2); }
.menu > summary .icon { width: .9em; color: var(--muted); }
.initials { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: .8rem; letter-spacing: .02em; }
.menu-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 280px; z-index: 30; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; }
.menu-panel > a, .menu-signout button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .6rem;
  border-radius: var(--radius-sm); color: var(--text); text-decoration: none; background: none; border: 0; text-align: left; }
.menu-panel > a:hover, .menu-signout button:hover { background: var(--surface-2); color: var(--text); }
.menu-panel .icon { color: var(--muted); }
.menu-section { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: .35rem 0; padding: .5rem .3rem; }
.menu-label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin: 0 .3rem .4rem; }
.menu-signout { margin: 0; }

/* Theme buttons (segmented control). */
.theme-switch { display: flex; gap: .25rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem; margin: 0; }
.theme-switch button { flex: 1; display: inline-flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem .25rem;
  background: none; border: 0; border-radius: 4px; color: var(--muted); font-size: .75rem; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.swatch-dot { width: 1.1em; height: 1.1em; border-radius: 50%; background: linear-gradient(135deg, var(--sw-bg) 50%, var(--sw-accent) 50%); border: 1px solid var(--border); }

.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin: 0; }
.theme-card { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; text-align: left; padding: .75rem;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.theme-card:hover { border-color: var(--border-strong); }
.theme-card[aria-pressed=true] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.theme-name { font-weight: 600; }
.theme-desc { font-size: .85rem; color: var(--muted); }
.preview { display: block; position: relative; height: 92px; border-radius: var(--radius-sm); background: var(--sw-bg); overflow: hidden; border: 1px solid var(--border); }
.preview.split { background: linear-gradient(110deg, #f4f5f7 50%, #0d1117 50%); }
.pv-bar { position: absolute; left: 0; right: 0; top: 0; height: 16px; background: var(--sw-surface); opacity: .9; }
.preview.split .pv-bar { background: linear-gradient(110deg, #ffffff 50%, #161b22 50%); }
.pv-card { position: absolute; left: 14px; right: 14px; top: 28px; bottom: 12px; border-radius: 5px; background: var(--sw-surface); padding: 8px; }
.preview.split .pv-card { background: linear-gradient(110deg, #ffffff 50%, #161b22 50%); }
.pv-line { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--sw-accent) 35%, #8892a0); opacity: .55; margin-bottom: 6px; width: 80%; }
.pv-line.short { width: 50%; }
.pv-button { display: block; width: 34px; height: 10px; border-radius: 3px; background: var(--sw-accent); }

/* ---------- app shell and side menu ----------
 * Large screens (1024px+): menu column, 264px or folded to a 72px icon rail.
 * Tablets (768–1023px): icon rail; the toggle opens the full menu over the page.
 * Phones (under 768px): menu hidden; the button in the top bar opens it as a drawer.
 */
:root { --sidebar-w: 264px; --rail-w: 72px; }
.shell.has-sidebar { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar-collapsed .shell.has-sidebar { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.page { min-width: 0; display: flex; flex-direction: column; }
.has-sidebar > .page { grid-column: 2; }
.has-sidebar > .sidebar { grid-column: 1; grid-row: 1; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; z-index: 40;
  display: flex; flex-direction: column; gap: .2rem; padding: .6rem .65rem .75rem;
  background: var(--surface); border-right: 1px solid var(--border); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 .35rem .35rem; }
.brand-mark { display: none; border-radius: 8px; }
.sidebar .org-switch, .sidenav a, .collapse-toggle {
  display: flex; align-items: center; gap: .8rem; min-height: 42px; padding: .5rem .75rem; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.sidebar .icon { width: 20px; height: 20px; }
.sidebar .label { overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.sidebar .org-switch { color: var(--text); font-weight: 600; border: 1px solid var(--border); margin: 0 0 .6rem; }
.sidebar .org-switch .icon { color: var(--primary); }
.sidebar .org-switch:hover { border-color: var(--primary); background: var(--primary-soft); }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a[aria-current=page] { background: var(--primary-soft); color: var(--primary); }
.nav-divider { height: 1px; background: var(--border); margin: .45rem .6rem; }
.collapse-toggle { margin-top: auto; width: 100%; background: none; border: 0; text-align: left; font: inherit; font-weight: 500; }
.collapse-toggle:hover { background: var(--surface-2); color: var(--text); }
.sidebar-close, .menu-button, .topbar-brand { display: none; }
.nav-backdrop { display: none; }

/* Folded to icons: labels hidden, names shown as tooltips (title). */
@media (min-width: 1024px) {
  .sidebar-collapsed .sidebar .label, .sidebar-collapsed .brand-full { display: none; }
  .sidebar-collapsed .brand-mark { display: block; }
  .sidebar-collapsed .sidebar-head { justify-content: center; padding: 0 0 .35rem; }
  .sidebar-collapsed .sidebar .org-switch, .sidebar-collapsed .sidenav a, .sidebar-collapsed .collapse-toggle { justify-content: center; padding: .5rem; }
  .sidebar-collapsed .collapse-toggle .icon { transform: scaleX(-1); }
}

/* Tablets: icon rail; the toggle opens the full menu over the page. */
@media (min-width: 768px) and (max-width: 1023px) {
  .shell.has-sidebar, .sidebar-collapsed .shell.has-sidebar { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  html:not(.nav-open) .sidebar .label, html:not(.nav-open) .brand-full { display: none; }
  html:not(.nav-open) .brand-mark { display: block; }
  html:not(.nav-open) .sidebar-head { justify-content: center; padding: 0 0 .35rem; }
  html:not(.nav-open) .sidebar .org-switch, html:not(.nav-open) .sidenav a, html:not(.nav-open) .collapse-toggle { justify-content: center; padding: .5rem; }
  html:not(.nav-open) .collapse-toggle .icon { transform: scaleX(-1); }
  .nav-open .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  .nav-open .nav-backdrop { display: block; }
}

/* Phones: a drawer. */
@media (max-width: 767px) {
  .shell.has-sidebar, .sidebar-collapsed .shell.has-sidebar { display: block; }
  .js .sidebar { position: fixed; left: 0; top: 0; width: min(84vw, 300px); transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: none; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .nav-backdrop { display: block; }
  .no-js .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .js .menu-button { display: inline-grid; }
  .sidebar-close { display: inline-grid; }
  .collapse-toggle { display: none; }
  .nav-open body { overflow: hidden; }
}
.nav-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .45); }

/* ---------- page structure ---------- */
.page-head, .section-head { display: flex; justify-content: space-between; align-items: center;
  gap: .75rem 1rem; flex-wrap: wrap; margin: 1rem 0; }
.page-head h1, .section-head h2 { margin: 0; }
.page-head h1 .muted { font-weight: 500; }
.eyebrow { display: block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .1rem; }
.section-head.compact { margin: 0 0 .75rem; }
.card + .card, .card + .section-head { margin-top: 1rem; }
.card > h2:first-child { margin-top: 0; }
.actions, .row-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row-actions button.danger, .row-actions .button { padding: .2rem .6rem; min-height: 2rem; font-size: .9rem; }
.back-link { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); text-decoration: none; font-size: .9rem; margin-top: .5rem; }
.back-link:hover { color: var(--primary); }
.back-link + .page-head { margin-top: .25rem; }

/* ---------- lists: filters, tables, pager ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; margin: 0 0 1rem; }
.filters label { margin: 0; font-weight: 500; }
.search-field { position: relative; flex: 1 1 280px; }
.search-field .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { margin: 0; padding-left: 2.2rem; }
.inline-select select, .sort select { margin: 0; width: auto; min-width: 9rem; }
.sort { display: flex; align-items: center; gap: .5rem; }
.sort span { color: var(--muted); font-weight: 400; font-size: .9rem; white-space: nowrap; }
.filter-more { flex: none; }
.filter-more > summary { list-style: none; display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; padding: .5rem .9rem;
  min-height: 2.5rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 500; }
.filter-more > summary::-webkit-details-marker { display: none; }
.filter-more[open] > summary { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.filter-more[open] { flex-basis: 100%; order: 10; }
.filter-more[open] > summary { margin-bottom: .6rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; padding: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-grid label { font-size: .85rem; color: var(--muted); }
.filter-grid select { color: var(--text); }
.count-badge { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 600; }
.result-summary { margin: 0 0 .6rem; color: var(--muted); font-size: .9rem; }
.results.htmx-request { opacity: .6; transition: opacity .15s; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
th.num, td.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); min-width: 0; }
.person > span { display: flex; flex-direction: column; min-width: 0; }
.person small { overflow: hidden; text-overflow: ellipsis; }
.person:hover .person-name { color: var(--primary); text-decoration: underline; }
.person-name { font-weight: 500; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--surface-3); }
.avatar-lg { width: 112px; height: 112px; flex: none; border-radius: 50%; background: var(--surface-3); }
.count-pill, .pill { display: inline-block; min-width: 1.8rem; text-align: center; font-size: .8rem; padding: .05rem .5rem;
  border-radius: 999px; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; vertical-align: middle; }
.pill.current { background: var(--primary-soft); color: var(--primary); }

/* Member status labels (values from the Rails member_status list). */
.status { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 500; padding: .1rem .55rem; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .8; }
.status-0 { background: var(--success-bg); color: var(--success); }   /* active */
.status-2 { background: var(--info-bg); color: var(--info); }         /* visitor */
.status-3 { background: var(--warning-bg); color: var(--warning); }   /* prospect */
.status-5 { background: var(--surface-3); color: var(--faint); }      /* deceased */

.pager { display: flex; gap: .75rem 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.pager-count { color: var(--muted); font-size: .9rem; }
.pager-links { display: flex; gap: .25rem; align-items: center; }
.pager a, .pager .current, .pager .gap { display: inline-grid; place-items: center; min-width: 2.25rem; height: 2.25rem; padding: 0 .5rem;
  border-radius: var(--radius-sm); text-decoration: none; }
.pager a { color: var(--text); border: 1px solid var(--border); background: var(--surface); }
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager .current { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.pager .gap { color: var(--faint); min-width: 1.25rem; padding: 0; }

.empty { text-align: center; }
.empty img { max-width: 200px; width: 55%; margin: 0 auto 1rem; display: block; }
.empty .button { margin-top: .5rem; }
.no-results > .icon { width: 2.25rem; height: 2.25rem; color: var(--faint); margin-bottom: .25rem; }
.no-results p { margin: .25rem 0; }

/* Group cards. */
.group-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.group-card { display: flex; flex-direction: column; gap: .6rem; height: 100%; padding: 1.1rem 1.2rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s; }
.group-card:hover { border-color: var(--primary); color: var(--text); }
.group-card-head { display: flex; align-items: center; gap: .7rem; }
.group-name { font-weight: 600; font-size: 1.05rem; }
.group-desc { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-meta { display: flex; gap: .4rem 1rem; flex-wrap: wrap; margin-top: auto; color: var(--muted); font-size: .85rem; }
.group-meta > span { display: inline-flex; align-items: center; gap: .3rem; }

/* ---------- record pages ---------- */
.profile { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem 1.5rem; margin: 0; flex: 1; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd:empty::before { content: "—"; color: var(--faint); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.rich-text { overflow-wrap: anywhere; }

/* Record photo with its buttons. */
.photo-box { display: flex; flex-direction: column; align-items: center; gap: .55rem; flex: none; width: 140px; }
.photo-frame { display: block; border-radius: 50%; }
img.photo { object-fit: cover; background: var(--surface-3); }
.photo-frame:hover img.photo { filter: brightness(.95); }
.photo-actions { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.photo-upload { margin: 0; }
.photo-upload label { margin: 0; cursor: pointer; }
.photo-upload label:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.small-button { padding: .3rem .7rem !important; min-height: 2rem !important; font-size: .85rem; }
.link-button { background: none; border: 0; padding: .2rem; color: var(--muted); font-size: .85rem; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--danger); }
.photo-box .error { text-align: center; }
.avatar-sm, .avatar-xs { object-fit: cover; }
.photo-box.busy { opacity: .6; pointer-events: none; }

/* ---------- sign in, sign up ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth .logo { margin: 0 auto .5rem; }
.choices { list-style: none; padding: 0; margin: 0 0 1rem; }

/* Church picker. */
.narrow-page { max-width: 640px; margin: 0 auto; }
.church-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.church-list form { margin: 0; }
.church-option { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .85rem 1rem; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 500; }
.church-option:hover { border-color: var(--primary); background: var(--primary-soft); }
.church-option .icon { color: var(--primary); width: 1.4em; height: 1.4em; }
.church-option .go { margin-left: auto; transform: rotate(-90deg); color: var(--muted); }
.church-option.is-current { border-color: var(--primary); }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem;
  text-decoration: none; color: var(--text); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.kpi:hover { border-color: var(--primary); color: var(--text); }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: .9rem; }
.dash-layout { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 1rem; align-items: start; }
.dash-charts { columns: 2 300px; column-gap: 1rem; }
.dash-charts > .card { break-inside: avoid; margin: 0 0 1rem; }
.dash-layout .card + .card, .dash-charts .card + .card { margin-top: 0; }
/* Sized by the room beside the menu, so it adapts when the menu folds. */
@container (max-width: 1020px) { .dash-layout { grid-template-columns: 1fr; } .dash-layout .celebrations { columns: 2 300px; column-gap: 2rem; } .dash-layout .celebrations li { break-inside: avoid; } }
.bars { margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr; align-items: center; gap: .75rem; }
.bar-row:hover dt { color: var(--text); }
.bar-row dt { font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row dd { margin: 0; display: flex; align-items: center; gap: .5rem; }
.bar-track { flex: 1; height: 14px; display: block; }
.bar { display: block; height: 14px; min-width: 0; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.bar-row:hover .bar { filter: brightness(1.1); }
.bar-value { min-width: 2.5ch; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.celebrations { list-style: none; margin: 0; padding: 0; }
.celebrations li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; align-items: baseline; padding: .6rem 0;
  border-bottom: 1px solid var(--border); }
.celebrations .what { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.celebrations .what a { text-decoration: none; font-weight: 500; }
.celebrations .what a:hover { text-decoration: underline; }
.celebrations li:last-child { border-bottom: 0; }
.celebrations .when { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.celebrations li.is-today .when { color: var(--text); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); }
.badge::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--viz-1); }
.badge.anniversary::before { background: var(--viz-2); border-radius: 2px; }

/* ---------- calendar ---------- */
.cal-nav { display: flex; gap: .35rem; flex-wrap: wrap; }
.cal-nav .button { padding: .35rem .75rem; min-height: 2.25rem; }
.legend { display: flex; gap: 1rem; margin: 0 0 .75rem; }
table.calendar { table-layout: fixed; }
table.calendar th { text-align: center; }
table.calendar td { height: 6.5rem; vertical-align: top; padding: .35rem; border-right: 1px solid var(--border); }
table.calendar td:last-child { border-right: 0; }
table.calendar tbody tr:hover td { background: transparent; }
table.calendar td.other-month { background: var(--surface-2); }
table.calendar td.other-month .day-number { color: var(--faint); }
.day-number { display: inline-block; font-size: .85rem; font-variant-numeric: tabular-nums; min-width: 1.6rem;
  text-align: center; border-radius: 999px; margin-bottom: .2rem; }
td.today .day-number { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.event { display: block; font-size: .8rem; line-height: 1.3; text-decoration: none; color: var(--text);
  padding: .1rem .3rem .1rem .45rem; margin-bottom: .15rem; border-left: 3px solid var(--viz-1);
  background: var(--event-1-bg); border-radius: 0 4px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event.anniversary { border-left-color: var(--viz-2); background: var(--event-2-bg); }
.event.activity { border-left-color: var(--viz-3); background: var(--event-3-bg); }
.badge.activity::before { background: var(--viz-3); border-radius: 2px; }
.event-time { font-variant-numeric: tabular-nums; color: var(--muted); }
/* Several-day activities: one bar across the days of a week. */
table.calendar td { padding-left: 0; padding-right: 0; }
table.calendar td .day-head, table.calendar td .event:not(.span) { margin-left: .35rem; margin-right: .35rem; }
.event.span { border-left-width: 0; border-radius: 0; padding-left: .45rem; }
.event.span-start { border-left-width: 3px; border-radius: 0; margin-left: .35rem; }
.event.span-end { border-radius: 0 4px 4px 0; margin-right: .35rem; }
.event.span-gap { background: none; border: 0; visibility: hidden; }
.day-head { display: flex; align-items: center; justify-content: space-between; }
.day-add { visibility: hidden; text-decoration: none; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 .3rem; border-radius: 4px; }
td:hover .day-add, .week-day:hover .day-add, .day-add:focus { visibility: visible; }
.day-add:hover { background: var(--surface-3); color: var(--text); }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .75rem; }
.cal-bar .legend { margin: 0; }
.cal-filter { margin: 0; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.week-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem; min-height: 10rem; }
.week-day h2 { font-size: .85rem; margin: 0 0 .5rem; display: flex; justify-content: space-between; align-items: center; }
.week-day.today h2 span { color: var(--primary); }
.week-day .event { white-space: normal; }
.agenda { padding: .5rem 1.25rem; }
.agenda-row { padding: .75rem 0; border-bottom: 1px solid var(--border); break-inside: avoid; }
.agenda-row:last-child { border-bottom: 0; }
.agenda-row h2 { font-size: 1rem; margin: 0 0 .35rem; }
.agenda-row.today h2 { color: var(--primary); }
.agenda-row ul { list-style: none; margin: 0; padding: 0; }
.agenda-item { display: grid; grid-template-columns: 8rem 1fr; gap: .75rem; padding: .2rem 0 .2rem .6rem; border-left: 3px solid var(--viz-3); margin-bottom: .2rem; }
.agenda-item.birthday { border-left-color: var(--viz-1); }
.agenda-item.anniversary { border-left-color: var(--viz-2); }
.agenda-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.print-only { display: none; }
@media (max-width: 900px) {
  .week-grid { grid-template-columns: 1fr; }
  .week-day { min-height: 0; }
  .day-add { visibility: visible; }
}
@media print {
  .print-only { display: block; }
  .agenda { border: 0; box-shadow: none; padding: 0; }
  .agenda-row h2 { color: #000; }
}
.event:hover { text-decoration: underline; color: var(--text); }
.cal-agenda { display: none; }
.agenda-day { display: grid; grid-template-columns: 4.5rem 1fr; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.agenda-day.today strong { color: var(--primary); }
.agenda-day .event { white-space: normal; }
@media (max-width: 640px) {
  .cal-month { display: none; }
  .cal-agenda { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .25rem 1rem; }
}

/* ---------- text messages ---------- */
.compose { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; align-items: start; }
.compose .card + .card { margin-top: 0; }
@container (max-width: 700px) { .compose { grid-template-columns: 1fr; } }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.plain li { padding: .25rem 0; }
.messages-list .message { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- accounts ---------- */
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { width: auto; flex: 1; min-width: 12rem; margin: 0; }
.danger-zone { border-color: var(--danger-border); }
.new-church { margin: 1.25rem 0 0; }
.table-wrap + .card, .table-wrap + .form-actions { margin-top: 1rem; }

/* ---------- billing ---------- */
.pricing h1 { font-size: 2rem; margin-top: 1rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 300px)); gap: 1rem; justify-content: center; margin-bottom: 1.5rem; }
.plan h3 { margin: 0 0 .5rem; }
.plan-price strong { font-size: 2rem; }
.plan .card + .card { margin-top: 0; }
.wide-link { display: block; text-align: center; }
.receipt-page { padding: 1rem; }
.receipt { max-width: 720px; margin: 1rem auto; }
.receipt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.receipt-head .right { text-align: right; }
.receipt-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .topbar { gap: .4rem; padding: .4rem .6rem; min-height: 56px; }
  .menu-name { display: none; }
  .quick-search { min-width: 0; }
  .quick-search .hint { display: none; }
  .container { margin-top: .75rem; padding: 0 .75rem; }
  .card { padding: 1.1rem; }
  .page-head h1 { font-size: 1.3rem; }
  .sort { flex: 1; }
  .sort select, .inline-select, .inline-select select { flex: 1; width: 100%; }
  .pager { justify-content: center; }

  /* Tables marked .stack become one card per row. */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: .75rem .9rem; border-bottom: 1px solid var(--border); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: .15rem 0 .15rem 46px; text-align: left; background: none !important; }
  table.stack td.primary-cell { padding-left: 0; padding-bottom: .35rem; }
  table.stack.no-avatar td { padding-left: 0; }
  table.stack td.row-actions { padding-top: .5rem; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  table.stack td[data-label]:empty { display: none; }
  table.stack td.num { text-align: left; }
  .table-wrap:has(table.stack) { overflow: visible; }
  .receipt-parties { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .no-print, .topbar, .sidebar, .nav-backdrop, .filters, .pager, .actions { display: none !important; }
  .shell.has-sidebar { display: block; }
  .receipt { border: 0; } body { background: #fff; }
}

/* ---------- admin pages ---------- */
.block { display: block; }
.topbar-title { font-weight: 600; color: var(--muted); }
.sidebar .admin-badge { cursor: default; }
.sidebar .admin-badge:hover { border-color: var(--border); background: none; }
.kpi-detail { color: var(--faint); font-size: .8rem; margin-top: .2rem; }
.kpis.compact .kpi-value { font-size: 1.5rem; }
.kpis.compact .kpi:hover { border-color: var(--border); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.admin-grid .card + .card { margin-top: 0; }
.admin-grid .card h2 { font-size: 1.05rem; }
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--border); }
.stat-list li:first-child { border-top: 0; }
.stat-list a { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); }
.stat-list strong { font-variant-numeric: tabular-nums; }
.big-number { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.sub-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--faint); }
.sub-dot.sub-trial { background: var(--info); }
.sub-dot.sub-active { background: var(--success); }
.sub-dot.sub-grace { background: var(--warning); }
.pill.ok, .pill.sub-active, .pill.svc-ok { background: var(--success-bg); color: var(--success); }
.pill.sub-trial { background: var(--info-bg); color: var(--info); }
.pill.sub-grace, .pill.svc-warn { background: var(--warning-bg); color: var(--warning); }
.pill.suspended { background: var(--danger-bg); color: var(--danger); }
.pill.sub-ended, .pill.svc-off { background: var(--surface-3); color: var(--muted); }
.pill.role-admin { background: var(--primary-soft); color: var(--primary); }
.pill.role-support { background: var(--info-bg); color: var(--info); }
h1 .pill { font-size: .8rem; vertical-align: middle; font-weight: 600; }
.church-option.is-suspended { cursor: not-allowed; opacity: .75; }
.church-option.is-suspended:hover { border-color: var(--border); background: var(--surface); }
.church-option.is-suspended .icon { color: var(--danger); }
.church-option.is-suspended .pill { margin-left: auto; }
.action-rows { display: flex; flex-direction: column; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--border); }
.action-row:first-child { border-top: 0; padding-top: 0; }
.action-row p { margin: .2rem 0 0; }
.action-row form { flex: none; }
.link-list { list-style: none; margin: 0; padding: .5rem 1.5rem; }
.link-list li { padding: .45rem 0; border-top: 1px solid var(--border); }
.link-list li:first-child { border-top: 0; }
.read-only { display: inline-flex; align-items: center; gap: .4rem; }
.notice-inline { background: var(--warning-bg); color: var(--warning); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.field.span-2 { grid-column: 1 / -1; }
.field textarea { width: 100%; }
@media (max-width: 640px) {
  .action-row { flex-direction: column; align-items: stretch; }
  .action-row form button { width: 100%; }
}

/* ---------- What's new ---------- */
.whats-new { position: relative; color: var(--muted); }
.whats-new:hover { color: var(--text); }
.unread-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
.narrow-page.wide { max-width: 760px; }
.announcements { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.announcement h2 { margin: .5rem 0 .6rem; font-size: 1.2rem; }
.announcement-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; color: var(--muted); font-size: .85rem; }
.announcement .rich-text > :last-child { margin-bottom: 0; }
.pill.kind-new { background: var(--success-bg); color: var(--success); }
.pill.kind-fix { background: var(--danger-bg); color: var(--danger); }
.pill.kind-improvement { background: var(--info-bg); color: var(--info); }
.pill.kind-update { background: var(--primary-soft); color: var(--primary); }
.pill.new-badge { background: var(--warning-bg); color: var(--warning); }
.field .hint { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: .25rem; }
.announcements .card + .card { margin-top: 0; }

/* ---------- public marketing pages ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.public main { flex: 1; }
.public-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.public-bar { max-width: 1160px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.public-nav { display: flex; gap: .25rem; margin-left: 1rem; }
.public-nav a, .public-signin { color: var(--muted); padding: .45rem .7rem; border-radius: var(--radius-sm); font-weight: 500; text-decoration: none; }
.public-nav a:hover, .public-signin:hover { color: var(--text); background: var(--surface-2); }
.public-nav a[aria-current=page] { color: var(--primary); }
.lang-menu summary { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); padding: .45rem .55rem; border-radius: var(--radius-sm); }
.lang-menu summary:hover { background: var(--surface-2); color: var(--text); }
.lang-code { font-size: .8rem; font-weight: 600; letter-spacing: .03em; }
.lang-menu .menu-panel a[aria-current] { color: var(--primary); font-weight: 600; }
.button.large { padding: .8rem 1.3rem; font-size: 1.05rem; min-height: 3rem; }

.hero { max-width: 1160px; margin: 0 auto; padding: 4rem 1.25rem 3rem; display: grid; grid-template-columns: 1fr 1.15fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.02em; margin: .6rem 0 1rem; }
.lead { font-size: 1.15rem; color: var(--muted); line-height: 1.55; margin: 0 0 1.5rem; }
.hero-logo { display: block; width: min(440px, 100%); height: auto; margin: 0 0 1.25rem -.5rem; }
.eyebrow-pill { display: inline-block; margin: 0; padding: .3rem .7rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .85rem; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.center-actions { justify-content: center; }
.hero-shot { position: relative; margin: 0; }
.hero-shot > img:not(.phone-shot) { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 12px 12px; box-shadow: var(--shadow-lg); }
.browser-frame { display: flex; gap: 6px; padding: 10px 12px; background: var(--surface-3); border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; }
.browser-frame span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.phone-shot { position: absolute; right: -18px; bottom: -36px; width: 26%; height: auto; border-radius: 22px; border: 6px solid #1f2933; box-shadow: var(--shadow-lg); background: #1f2933; }

.public-section { max-width: 1160px; margin: 0 auto; padding: 3.5rem 1.25rem; }
.section-intro { text-align: center; max-width: 680px; margin: 0 auto 2.5rem; }
.section-intro h2, .page-hero h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.01em; margin: 0 0 .6rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
.feature { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.feature h3 { margin: .9rem 0 .4rem; font-size: 1.1rem; }
.feature p { margin: 0; color: var(--muted); line-height: 1.55; }
.feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); flex: none; }
.feature-icon .icon { width: 22px; height: 22px; }
.steps-section { background: var(--bg); max-width: none; }
.steps { list-style: none; padding: 0; margin: 0 auto; max-width: 1160px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.steps h3 { margin: .8rem 0 .4rem; }
.steps p { margin: 0; color: var(--muted); }
.step-number { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; }
.trust-card { display: flex; gap: 1.25rem; align-items: flex-start; max-width: 820px; margin: 0 auto; padding: 1.75rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.trust-card h2 { margin: 0 0 .4rem; font-size: 1.3rem; }
.trust-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.cta-band { text-align: center; padding: 3.5rem 1.25rem; background: var(--primary); color: var(--on-primary); }
.cta-band h2 { margin: 0 0 .5rem; font-size: clamp(1.5rem, 3vw, 2rem); }
.cta-band p { margin: 0 0 1.5rem; opacity: .9; }
.cta-band .button { background: var(--surface); color: var(--text); border-color: transparent; }
.cta-band .button.primary { background: #ffffff; color: var(--primary); }
.cta-band .button:not(.primary) { background: transparent; color: var(--on-primary); border-color: rgba(255,255,255,.6); }
.page-hero { text-align: center; max-width: 760px; margin: 0 auto; padding: 3.5rem 1.25rem 1rem; }
.feature-rows { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem 2.5rem; }
.feature-row { display: flex; gap: 1rem; align-items: flex-start; }
.feature-row h2 { margin: .2rem 0 .4rem; font-size: 1.15rem; }
.feature-row p { margin: 0 0 .4rem; line-height: 1.55; }
.showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; padding-top: 0; }
.showcase figure { margin: 0; }
.showcase img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.showcase figcaption { text-align: center; color: var(--muted); font-size: .9rem; margin-top: .6rem; }

.interval-toggle { display: flex; width: max-content; margin: 0 auto 2rem; padding: 4px; border-radius: 999px; background: var(--surface-3); }
.interval-toggle a { padding: .5rem 1.25rem; border-radius: 999px; color: var(--muted); font-weight: 600; text-decoration: none; }
.interval-toggle a[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.plan { display: flex; flex-direction: column; }
.plan .checks { flex: 1; margin: 1rem 0 1.25rem; }
.plan .checks li { display: flex; gap: .5rem; align-items: flex-start; padding: .25rem 0; }
.plan .checks .icon { color: var(--success); flex: none; margin-top: .15rem; }
.plan.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg); }
.plan-equiv { margin: -.4rem 0 0; }
.faq { max-width: 760px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { color: var(--muted); margin: .6rem 0 0; line-height: 1.55; }

.public-footer { border-top: 1px solid var(--border); background: var(--surface-2); }
.public-footer-inner { max-width: 1160px; margin: 0 auto; padding: 2.5rem 1.25rem 1rem; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-brand p { max-width: 320px; }
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-copy { max-width: 1160px; margin: 0 auto; padding: 0 1.25rem 2rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 2.5rem; gap: 2.5rem; }
  .phone-shot { right: 8px; bottom: -24px; }
  .feature-grid, .steps { grid-template-columns: 1fr 1fr; }
  .feature-rows, .showcase { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .public-bar { padding: .6rem 1rem; gap: .4rem; flex-wrap: wrap; }
  .public-nav { order: 10; width: 100%; margin: 0; justify-content: center; }
  .public-signin { padding: .45rem .4rem; }
  .public-bar .button.primary { padding: .45rem .7rem; font-size: .9rem; }
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .public-section { padding: 2.5rem 1rem; }
  .public-footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .hero-actions .button { flex: 1; justify-content: center; }
  .trust-card { flex-direction: column; }
}
.plans[hidden] { display: none; }
.plans .card + .card { margin-top: 0; }
.public-nav .nav-signin { display: none; }
@media (max-width: 640px) {
  .public-bar .public-signin { display: none; }
  .public-nav .nav-signin { display: inline-block; }
  .public-bar { flex-wrap: wrap; }
}

/* ---------- offerings ---------- */
.record-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2rem; margin-bottom: 1rem; }
.record-top .field { max-width: 220px; margin: 0; }
.record-help { margin: 0 0 .6rem; max-width: 520px; }
.offering-rows { display: flex; flex-direction: column; gap: .5rem; }
.offering-row { display: grid; grid-template-columns: minmax(180px, 2.2fr) minmax(130px, 1.3fr) minmax(100px, 1fr) minmax(120px, 1.1fr) minmax(100px, 1fr) minmax(120px, 1.4fr) 40px; gap: .5rem; align-items: center; }
.offering-row input, .offering-row select { margin: 0; min-width: 0; }
.offering-row .num, .offering-row input.num { text-align: right; font-variant-numeric: tabular-nums; }
.offering-head { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 .1rem; }
.offering-row .cell { display: block; margin: 0; }
.offering-row .cell-label { display: none; }
.offering-row .row-error { grid-column: 1 / -1; margin: -.2rem 0 .2rem; }
.offering-row.has-error input, .offering-row.has-error select { border-color: var(--danger-border); }
.offering-row input.is-invalid { border-color: var(--danger); }
.row-remove { color: var(--muted); }
.row-remove:hover { color: var(--danger); }
.record-totals { margin-top: 1.25rem; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.record-totals h2 { margin: 0 0 .75rem; font-size: 1rem; }
.record-totals h3 { margin: 0 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.totals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.totals-grid dl { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; margin: 0; }
.totals-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.grand-total { display: flex; align-items: baseline; gap: .5rem; margin: .9rem 0 0; padding-top: .75rem; border-top: 1px solid var(--border); font-size: 1.1rem; }
.grand-total strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.offering-filters { flex-wrap: wrap; }
.inline-field { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-size: .9rem; color: var(--muted); }
.inline-field input { margin: 0; width: auto; }
.member-filter { flex: 1 1 220px; }
.offering-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 1rem 0; }
.offering-summary .kpi { padding: .7rem 1rem; min-width: 180px; }
.offering-summary .kpi-value { font-size: 1.5rem; }
.offering-summary .kpi:hover { border-color: var(--border); }
tr.is-inactive td { color: var(--muted); }
.type-actions { white-space: nowrap; }
.period-filters { flex-wrap: wrap; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented a { padding: .4rem .8rem; color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.segmented a + a { border-left: 1px solid var(--border); }
.segmented a:hover { background: var(--surface-2); color: var(--text); }
.segmented a.active { background: var(--primary-soft); color: var(--text); font-weight: 600; }
.period-note { margin: .25rem 0 1rem; font-size: .9rem; }
.console-kpis .kpi { display: flex; flex-direction: column; gap: .15rem; }
.console-kpis .kpi-value { font-size: 1.45rem; }
.trend { font-weight: 600; color: var(--text); }
.trend-up::before { content: "▲ "; font-size: .7em; }
.trend-down::before { content: "▼ "; font-size: .7em; }
.other-currencies { font-size: .9rem; margin: -.25rem 0 1rem; }
.chart-card { margin-bottom: 1rem; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .5rem; }
.chart-head h2 { margin: 0; }
.chart-head .legend { margin: 0; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.chart-head .legend li { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; }
.swatch-now { background: var(--viz-1); }
.swatch-before { background: var(--viz-prior); }
.chart-scroll { overflow-x: auto; }
.month-chart { display: block; min-width: 600px; width: 100%; height: auto; overflow: visible; }
.month-chart .grid { stroke: var(--border); stroke-width: 1; }
.month-chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.month-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.month-chart .bar-now { fill: var(--viz-1); }
.month-chart .bar-before { fill: var(--viz-prior); }
.month-chart .hit { fill: transparent; }
.month-chart .month:hover .hit { fill: var(--surface-2); }
.month-chart .month:hover .tick { fill: var(--text); }
.chart-table { margin-top: .75rem; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table table { margin-top: .5rem; }
.console-breakdowns, .member-giving { margin-bottom: 1rem; }
.console-breakdowns .card + .card, .member-giving .card + .card { margin-top: 0; }
.share-bars .bar-row { grid-template-columns: minmax(6rem, 30%) 1fr; }
.share-bars .bar-value { min-width: 0; white-space: nowrap; }
.bar-share { min-width: 3.5ch; text-align: right; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.year-summary { color: var(--muted); }
.year-summary strong { color: var(--text); font-variant-numeric: tabular-nums; }
.member-giving .card { max-width: 720px; }
.type-edit { display: grid; grid-template-columns: 1fr 1.5fr auto; gap: .75rem 1rem; align-items: end; }
.type-edit .form-actions { grid-column: 1 / -1; margin: 0; }
@media (max-width: 900px) {
  .offering-head { display: none; }
  .offering-row { grid-template-columns: 1fr 1fr; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); position: relative; }
  .offering-row .cell-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
  .offering-row .cell-member, .offering-row .cell-notes { grid-column: 1 / -1; }
  .row-remove { position: absolute; top: .3rem; right: .3rem; }
  .offering-row .cell-member { padding-right: 2.5rem; }
  .totals-grid { grid-template-columns: 1fr; }
  .type-edit { grid-template-columns: 1fr; }
}
.statement-filters { flex-wrap: wrap; }
.statement-help { margin: .25rem 0 1rem; max-width: 60rem; font-size: .9rem; }
.statement-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.statement-actions .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.statement-counts { margin: 0; color: var(--muted); }
.statement-table td.check, .statement-table th.check { width: 2.2rem; }
.statement-table .row-buttons { display: flex; gap: .35rem; justify-content: flex-end; white-space: nowrap; }
.statement-table td.row-actions { display: table-cell; vertical-align: middle; }
.statement-table .row-actions .button { padding: .3rem .65rem; min-height: 2rem; font-size: .85rem; }
.statement-filters .inline-field { white-space: nowrap; }
.statement-table .email-cell { color: var(--muted); overflow-wrap: anywhere; }
.statement-table .pill { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.statement-table .pill .icon { width: .85em; height: .85em; }
.pill.pill-good { background: var(--success-bg); color: var(--success); }
.pill.pill-bad { background: var(--danger-bg); color: var(--danger); }
.changed-note { display: block; margin-top: .2rem; }
.statement-table .givers { display: block; margin-top: .15rem; font-weight: 400; }
.alert.info { background: var(--info-bg); color: var(--info); }
.section-head + .muted { margin-top: -.5rem; }
.empty-state p { margin: 0; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } .segmented { display: flex; width: 100%; overflow-x: auto; } }

/* ---------- online giving ---------- */
.giving-card h2 { margin-top: 0; }
.giving-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem 1rem; }
.giving-head h2 { margin: 0 0 .35rem; }
.giving-link code { font-size: .95rem; word-break: break-all; }
.giving-settings { margin-top: 1rem; max-width: 34rem; }
.slug-input { display: flex; align-items: center; gap: .35rem; }
.slug-input input { flex: 1; }
.donation-table .small.block { font-size: .8rem; }
.link-member { display: flex; gap: .35rem; align-items: center; }
.link-member input { width: 8rem; min-width: 6rem; margin: 0; }
.donation-table .pill { white-space: nowrap; }
main.give { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; gap: 1rem; }
.give-card { width: 100%; max-width: 30rem; }
.give-card h1 { margin: .1rem 0 1rem; font-size: 1.6rem; }
.give-form fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.give-form legend { font-weight: 600; margin-bottom: .5rem; }
.amount-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.amount-choice { padding: .6rem .4rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.amount-choice:hover { background: var(--surface-2); }
.amount-choice.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.amount-input { display: flex; align-items: center; gap: .4rem; font-size: 1.25rem; font-weight: 600; }
.amount-input input { font-size: 1.25rem; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }
.cover-fee { margin: .25rem 0 1rem; align-items: flex-start; }
.give-submit { width: 100%; justify-content: center; padding: .75rem 1rem; font-size: 1.05rem; }
.give-secure { text-align: center; margin-top: .6rem; color: var(--muted); font-size: .8rem; }
.give-footer { color: var(--muted); font-size: .8rem; margin: 0; }
.give-amount-done { font-size: 2rem; font-weight: 700; margin: .25rem 0 .75rem; font-variant-numeric: tabular-nums; }
.frequency { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0; margin: 0 0 1rem; overflow: hidden; }
.frequency label { margin: 0; cursor: pointer; }
.frequency input { position: absolute; opacity: 0; pointer-events: none; }
.frequency span { display: block; text-align: center; padding: .55rem .5rem; font-weight: 600; color: var(--muted); }
.frequency label + label span { border-left: 1px solid var(--border); }
.frequency input:checked + span { background: var(--primary-soft); color: var(--primary); }
.frequency input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.give-form .monthly-note { display: none; }
.give-form.is-monthly .monthly-note { display: block; }
.give-manage { text-align: center; margin: 1rem 0 0; font-size: .9rem; }
.cancel-recurring { display: block; margin-top: .2rem; }

/* ---------- pledges ---------- */
.pledge-help { margin: 0; max-width: 46rem; }
.campaign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.campaign-card { display: block; color: var(--text); text-decoration: none; }
.campaign-card:hover { border-color: var(--primary); color: var(--text); }
.campaign-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.campaign-top h2 { margin: 0; font-size: 1.1rem; }
.campaign-card .small { margin: .25rem 0 .75rem; }
.campaign-figures { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1rem; margin: .75rem 0 0; }
.campaign-figures dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.campaign-figures dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--viz-1); border-radius: 4px; }
.progress.big { height: 12px; border-radius: 6px; }
.progress.small-bar { height: 5px; margin-top: .3rem; min-width: 5rem; }
.goal-bar { margin: -.25rem 0 1.25rem; }
.campaign-head h2 { margin: 0; font-size: 1.4rem; }
.campaign-form { max-width: 40rem; }
.campaign-form h2 { margin-top: 0; }
.pledge-form h3 { margin: 0 0 .75rem; }
.pledge-fields { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.5fr) auto; gap: .75rem; align-items: end; }
.pledge-fields .field { margin: 0; }
.pledge-fields .form-actions { margin: 0; }
.pledge-edit { display: grid; grid-template-columns: minmax(160px, 1.5fr) 1fr 1fr 1.5fr auto; gap: .75rem; align-items: end; }
.pledge-edit .field, .pledge-edit .form-actions { margin: 0; }
.send-status { display: flex; gap: .5rem; align-items: center; }
.send-status select { margin: 0; width: auto; }
.pill.fulfilled-pill { background: var(--success-bg); color: var(--success); }
.pill.on_track-pill { background: var(--info-bg); color: var(--info); }
.pill.behind-pill { background: var(--warning-bg); color: var(--warning); }
.pledge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.pledge-line { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .35rem; }
.member-pledges { margin-bottom: 1rem; }
.member-pledges h2 { margin-top: 0; font-size: 1.05rem; }
@media (max-width: 900px) { .pledge-fields, .pledge-edit { grid-template-columns: 1fr; } }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.campaign-grid .card + .card { margin-top: 0; }
.pledge-table td.row-actions { display: table-cell; vertical-align: middle; }
.pledge-table .row-buttons { display: flex; gap: .35rem; justify-content: flex-end; white-space: nowrap; }

/* ---------- expenses ---------- */
.expense-rows { display: flex; flex-direction: column; gap: .5rem; }
.expense-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(140px, 1.3fr) minmax(150px, 1.6fr) minmax(100px, 1fr) minmax(110px, 1fr) minmax(100px, 1fr) minmax(120px, 1.3fr) 40px; gap: .5rem; align-items: center; }
.expense-row.with-fund { grid-template-columns: minmax(132px, 1fr) minmax(110px, 1.2fr) minmax(110px, 1.4fr) minmax(80px, .8fr) minmax(100px, 1fr) minmax(76px, .8fr) minmax(124px, 1.3fr) minmax(80px, 1fr) 32px; gap: .4rem; }
@media (max-width: 1180px) { .expense-row.with-fund { grid-template-columns: 1fr 1fr; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); position: relative; } .expense-row.with-fund.offering-head { display: none; } .expense-row.with-fund .cell-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; } .expense-row.with-fund .cell-notes { grid-column: 1 / -1; } }
.expense-row input, .expense-row select { margin: 0; min-width: 0; }
.expense-row .cell { display: block; margin: 0; }
.expense-row .cell-label { display: none; }
.expense-row .row-error { grid-column: 1 / -1; margin: -.2rem 0 .2rem; }
.expense-row.has-error input, .expense-row.has-error select { border-color: var(--danger-border); }
.expense-row input.num { text-align: right; }
.expense-breakdown { margin-bottom: 1rem; max-width: 52rem; }
.expense-breakdown h2 { margin-top: 0; font-size: 1.05rem; }
.receipt-link { color: var(--muted); display: inline-flex; }
.receipt-link:hover { color: var(--primary); }
.expense-edit { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.expense-edit .card + .card { margin-top: 0; }
.receipt-card h2 { margin-top: 0; font-size: 1.05rem; }
.receipt-preview { display: block; max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: .5rem; }
.receipt-upload { display: grid; gap: .5rem; margin-top: .75rem; }
.receipt-upload input[type=file] { font-size: .85rem; }
@media (max-width: 900px) {
  .expense-row, .expense-row.with-fund { grid-template-columns: 1fr 1fr; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); position: relative; }
  .expense-row.offering-head { display: none; }
  .expense-row .cell-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
  .expense-row .cell-notes { grid-column: 1 / -1; }
  .expense-edit { grid-template-columns: 1fr; }
}

/* ---------- budgets and the income vs. expenses report ---------- */
.budget-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1rem; }
.budget-bar .filters { margin: 0; align-items: center; }
.budget-bar .inline-select { display: flex; align-items: center; gap: .5rem; }
.budget-bar form.inline { margin: 0; }
.budget-kpis .kpi-value.negative, .budget-kpis .kpi-value.bad { color: var(--danger); }
.budget-kpis .kpi-value.good { color: var(--success); }
.budget-section h2, .report-section h2 { margin-top: 0; }
.budget-section + .budget-section, .report-section + .report-section { margin-top: 1rem; }
.budget-table td.budget-input { width: 11rem; }
.budget-table td.budget-input input { margin: 0; width: 100%; text-align: right; }
.budget-table td.budget-input .error { display: block; text-align: left; }
.budget-table .budget-input-head { white-space: nowrap; }
.budget-form .form-actions { margin-top: 1rem; }
.notice-box { background: var(--info-bg); color: var(--info); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.notice-box a { color: inherit; font-weight: 600; }
.report-table { font-variant-numeric: tabular-nums; }
.report-table .group-row th { border-bottom: 0; padding-bottom: 0; color: var(--text); }
.report-table .group-start { border-left: 1px solid var(--border); }
.report-table .total-row th, .report-table .total-row td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.report-table .total-row th { font-size: inherit; color: var(--text); text-transform: none; letter-spacing: normal; background: none; }
/* Same columns in every table, so the sections line up. */
.report-table, .budget-table { table-layout: fixed; width: 100%; }
.report-table .group-row th:first-child { width: 22%; }
.budget-table th:first-child { width: 40%; }
.report-table td.diff.good, .month-table td.good { color: var(--success); }
.report-table td.diff.bad, .month-table td.bad { color: var(--danger); }
.net-section .report-table { margin: 0; }
.month-table tr.is-selected td { background: var(--primary-soft); }
@media (max-width: 760px) {
  .report-table .group-start { border-left: 0; }
  table.stack tfoot { display: block; }
  table.stack tr.total-row th { display: block; padding: 0 0 .35rem; text-align: left; border: 0; }
  /* Label on the left, figure on the right, without the avatar indent. */
  .report-table td[data-label], .budget-table td[data-label], .month-table td[data-label] { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding-left: 0; text-align: right; }
  .report-table td[data-label]::before, .budget-table td[data-label]::before, .month-table td[data-label]::before { min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .report-table td[data-label]:empty, .month-table td[data-label]:empty { display: none; }
  .budget-table td.budget-input { width: 100%; flex-wrap: wrap; align-items: center; }
  .budget-table td.budget-input input { width: 9.5rem; flex: 0 0 auto; text-align: right; }
  .budget-table td.budget-input .error { flex-basis: 100%; }
  .net-section thead { display: none; }
}
.row-buttons { display: flex; gap: .35rem; justify-content: flex-end; align-items: center; white-space: nowrap; }
.receipt-card h2 { display: flex; align-items: center; gap: .5rem; }
.receipt-number { font-weight: 600; font-size: 1.05rem; }
.receipt-actions { flex-wrap: wrap; align-items: center; }
.receipt-actions form.inline { margin: 0; }
.receipt-log { list-style: none; padding: 0; margin: .75rem 0 0; color: var(--muted); font-size: .9rem; }
.receipt-log li.bad { color: var(--danger); }
.send-receipts { margin-top: 1rem; }
@media (min-width: 761px) { td.row-actions:has(> .row-buttons) { display: table-cell; vertical-align: middle; } }

/* ---------- importing offerings ---------- */
.import-templates { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.import-templates a { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.upload-form .field { max-width: 32rem; }
.import-form > .card, .import-form > .offering-summary { margin-top: 1rem; }
.import-map { display: grid; gap: .25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.import-map .field select, .import-map .field input { width: 100%; }
.import-map .is-unused { opacity: .55; }
.import-summary .kpi.has-errors .kpi-value { color: var(--danger); }
.import-preview tr.row-error td { background: var(--danger-bg); }
.import-preview tr.row-duplicate td { background: var(--warning-bg); }
.import-errors { margin: 0; padding-left: 1rem; color: var(--danger); font-size: .9rem; }
.import-duplicates { margin: 1rem 0 0; }
@media (max-width: 760px) { .import-preview table.stack td { padding-left: 0; } }
/* A family's giving, on its page (finance only). */
.family-giving { margin-bottom: 1.5rem; }
@media (max-width: 600px) { .statement-filters .segmented a { flex: 1; text-align: center; } }

/* Accounting. */
.ledger-rows { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.ledger-row { display: grid; gap: .5rem; align-items: center; }
.ledger-row.entry-row { grid-template-columns: minmax(200px, 2.4fr) minmax(130px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(130px, 1.5fr) 40px; }
.ledger-row.opening-row { grid-template-columns: minmax(220px, 2.4fr) minmax(150px, 1.4fr) minmax(120px, 1fr) 40px; }
.ledger-row input, .ledger-row select { margin: 0; min-width: 0; width: 100%; }
.ledger-row .cell { display: block; margin: 0; }
.ledger-row .cell-label { display: none; }
.ledger-row .row-error { grid-column: 1 / -1; margin: -.2rem 0 .2rem; }
.ledger-row.has-error input, .ledger-row.has-error select { border-color: var(--danger-border); }
.ledger-row input.num, .ledger-row .num { text-align: right; }
.entry-totals { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: flex-end; margin: .5rem 0 0; font-variant-numeric: tabular-nums; }
.entry-totals .balanced { color: var(--success); font-weight: 600; }
.entry-totals .off { color: var(--danger); font-weight: 600; }
.negative { color: var(--danger); }
.ledger-since { margin: -.25rem 0 1rem; }
.ledger-callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.ledger-callout p { margin: 0; }
.ledger-balances { margin-bottom: 1rem; }
.ledger-balances h2 { margin-top: 0; }
.balance-list { width: 100%; border-collapse: collapse; }
.balance-list th, .balance-list td { padding: .55rem 0; border-bottom: 1px solid var(--border); text-align: left; font-weight: 400; vertical-align: baseline; background: none; text-transform: none; letter-spacing: normal; font-size: inherit; color: inherit; }
.balance-list th a { font-weight: 500; }
.balance-list tr:last-child th, .balance-list tr:last-child td { border-bottom: 0; }
.balance-list td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; padding-left: 1rem; }
.ledger-kpis { margin-bottom: 1.5rem; }
.ledger-kpis .kpi-value.negative { color: var(--danger); }
.account-group { margin: 1.5rem 0 .5rem; font-size: 1.05rem; }
.account-table .code-col, .trial-table .code-col { width: 5.5rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.account-edit { grid-template-columns: 8rem 1fr 1fr auto auto; }
.ledger-setup { max-width: 52rem; }
.ledger-setup h2 { margin-top: 0; }
.setup-steps { padding-left: 1.25rem; margin: 1rem 0 1.5rem; }
.setup-steps li { margin: .4rem 0; }
.ledger-filters { flex-wrap: wrap; align-items: center; }
.ledger-title { margin: 1rem 0 .5rem; font-size: 1.1rem; }
.ledger-table .opening-line td, .ledger-table tfoot th, .ledger-table tfoot td { background: var(--surface-2); }
.journal { display: flex; flex-direction: column; gap: .75rem; }
.journal-entry { padding: .75rem 1rem; }
.journal-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .4rem; }
.journal-number { font-weight: 600; font-variant-numeric: tabular-nums; }
.journal-memo { flex: 1; min-width: 12rem; }
.journal-lines { width: 100%; border-collapse: collapse; font-size: .92rem; }
.journal-lines td { padding: .3rem 0; border-top: 1px solid var(--border); vertical-align: baseline; }
.journal-lines td.num { width: 8rem; text-align: right; font-variant-numeric: tabular-nums; padding-left: .75rem; }
.journal-lines td:nth-child(2) { width: 10rem; padding-left: .75rem; }
.journal-lines .credit-account { padding-left: 1.5rem; }
.entry-facts { margin-bottom: 1rem; }
.entry-lines tfoot th, .entry-lines tfoot td, .trial-table tfoot th, .trial-table tfoot td { border-top: 2px solid var(--border-strong); }
.compact-head { margin-top: 0; }
.compact-head h2 { margin: 0; }
@media (max-width: 760px) {
  .ledger-row.entry-row, .ledger-row.opening-row { grid-template-columns: 1fr 1fr; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); position: relative; }
  .ledger-row.offering-head { display: none; }
  .ledger-row .cell-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
  .ledger-row .cell:first-child, .ledger-row .cell-notes { grid-column: 1 / -1; padding-right: 2.5rem; }
  .ledger-row .cell-notes { padding-right: 0; }
  .ledger-row .row-remove { position: absolute; top: .3rem; right: .3rem; }
  .entry-totals { justify-content: flex-start; }
  .journal-lines td:nth-child(2) { display: none; }
  .journal-lines td.num { width: 6.5rem; }
  .account-edit { grid-template-columns: 1fr; }
}
@media (min-width: 761px) {
  .account-table { table-layout: fixed; width: 100%; }
  .account-table th:nth-child(1) { width: 6rem; }
  .account-table th:nth-child(3) { width: 28%; }
  .account-table th:nth-child(4) { width: 9.5rem; }
  .account-table th:nth-child(5) { width: 11rem; }
  .account-table td { overflow-wrap: anywhere; }
}
.ledger-pair > .card { margin-top: 0; margin-bottom: 0; }
.ledger-pair { margin-bottom: 1rem; }
.entry-totals[hidden] { display: none; }
@media (max-width: 760px) {
  .ledger-row.entry-row .cell:nth-child(2) { grid-column: 1 / -1; }
}
.journal-lines .line-fund { display: none; }
@media (max-width: 760px) { .journal-lines .line-fund { display: block; } }
.rules-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.rules-form .card h2 { margin-top: 0; font-size: 1.05rem; }
.rules-table select { width: 100%; margin: 0; }
.rules-methods { width: 100%; border-collapse: collapse; }
.rules-methods th, .rules-methods td { padding: .45rem 0; border-bottom: 1px solid var(--border); background: none; text-transform: none; letter-spacing: normal; font-size: inherit; color: inherit; font-weight: 400; vertical-align: middle; }
.rules-methods tr:last-child th, .rules-methods tr:last-child td { border-bottom: 0; }
.rules-methods th { width: 9rem; padding-right: .75rem; }
.rules-methods select { width: 100%; margin: 0; }

/* Bank deposits (accounting, part 3). */
.deposit-form { display: grid; gap: 1rem; }
.deposit-form > .card { margin: 0; }
.deposit-days { display: grid; gap: .75rem; max-height: 32rem; overflow-y: auto; padding-right: .25rem; }
.deposit-day { border: 1px solid var(--border); border-radius: var(--radius, 10px); padding: .25rem .75rem .5rem; margin: 0; min-width: 0; }
.deposit-day legend { display: flex; align-items: center; line-height: 1.4; justify-content: space-between; gap: 1rem; width: 100%; padding: .4rem 0; float: left; border-bottom: 1px solid var(--border); margin-bottom: .25rem; }
.deposit-day legend + * { clear: both; }
.deposit-items { list-style: none; margin: 0; padding: 0; }
.deposit-items li + li { border-top: 1px dashed var(--border); }
.deposit-day legend label.check { margin: 0; }
label.check.deposit-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .45rem 0; cursor: pointer; }
.deposit-what { min-width: 0; overflow-wrap: anywhere; }
.deposit-selected { margin: 0 0 .75rem; }
.deposit-adjust .alert { margin-bottom: .75rem; }
.deposits-table td.num, .payouts-table td.num { text-align: right; }

/* Bank reconciliation and closing months (accounting, part 4). */
.reconcile-banks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.reconcile-bank { margin: 0; }
.reconcile-bank h2 { margin-top: 0; font-size: 1.05rem; }
.reconcile-facts { display: grid; gap: .35rem; margin: 0 0 1rem; }
.reconcile-facts > div { display: flex; justify-content: space-between; gap: 1rem; }
.reconcile-facts dt { color: var(--muted); }
.reconcile-facts dd { margin: 0; text-align: right; }
.reconcile-start { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem .75rem; align-items: end; }
.reconcile-start .field { margin: 0; }
@media (max-width: 560px) { .reconcile-start { grid-template-columns: 1fr; } }
.reconcile-form { display: grid; gap: 1rem; }
.reconcile-form .card { margin: 0; }
.reconcile-summary { position: sticky; top: 4.25rem; z-index: 2; }
.reconcile-summary dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 0; }
.reconcile-summary dt { color: var(--muted); font-size: .85rem; }
.reconcile-summary dd { margin: .15rem 0 0; font-size: 1.15rem; font-weight: 600; text-align: left; }
.reconcile-diff dd { color: var(--danger, #b42318); }
.reconcile-diff.is-zero dd { color: var(--success, #067647); }
.reconcile-summary .form-actions { margin-top: .75rem; }
@media (max-width: 760px) { .reconcile-summary { position: static; } .reconcile-summary dl { grid-template-columns: 1fr 1fr; } }
.reconcile-items { list-style: none; margin: 0; padding: 0; }
.reconcile-items li + li { border-top: 1px dashed var(--border); }
label.check.reconcile-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .45rem 0; cursor: pointer; font-weight: 400; }
.reconcile-what { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { label.check.reconcile-item { grid-template-columns: auto minmax(0, 1fr) auto; } label.check.reconcile-item > .nowrap.muted { grid-column: 2; grid-row: 2; } }
.periods-state { font-weight: 600; }
.periods-table .pill .icon { width: 14px; height: 14px; margin-right: .25rem; vertical-align: -2px; }
.periods-missing { margin: .35rem 0 0; }
.periods-reopen form { display: grid; gap: .5rem; margin-top: .5rem; min-width: 16rem; text-align: left; }
.periods-reopen summary { list-style: none; cursor: pointer; }
.periods-reopen summary::-webkit-details-marker { display: none; }
.subnav { margin: 0 0 1rem; }

/* Financial statements (accounting, part 5). */
.filters-spacer { flex: 1; }
.statement-doc { padding-top: 1.25rem; }
.statement-head { text-align: center; margin-bottom: 1rem; }
.statement-head h2 { margin: 0; font-size: 1.25rem; }
.statement-head p { margin: .25rem 0 0; }
.statement-table-fin { width: 100%; border-collapse: collapse; }
.statement-table-fin thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .4rem .6rem; border-bottom: 1px solid var(--border); background: none; }
.statement-table-fin tbody th, .statement-table-fin td { padding: .38rem .6rem; border-bottom: 1px solid var(--border); font-weight: 400; text-align: left; background: none; text-transform: none; letter-spacing: normal; font-size: inherit; color: inherit; }
.statement-table-fin td.num { text-align: right; width: 9.5rem; }
.statement-table-fin .fin-section th { padding-top: 1.1rem; font-weight: 600; font-size: 1rem; border-bottom: 2px solid var(--border-strong, var(--border)); }
.statement-table-fin .fin-subtotal th, .statement-table-fin .fin-subtotal td { font-weight: 600; }
.statement-table-fin .fin-total th, .statement-table-fin .fin-total td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong, var(--border)); }
.statement-table-fin .fin-item th { padding-left: 1.75rem; color: var(--muted); font-size: .9rem; }
.statement-table-fin .fin-item td { color: var(--muted); font-size: .9rem; }
.statement-table-fin .fin-code { font-variant-numeric: tabular-nums; }
.fin-note { margin: .75rem 0 0; }
@media (max-width: 700px) {
  .statement-table-fin thead { display: none; }
  .statement-table-fin tr { display: grid; grid-template-columns: 1fr auto; }
  .statement-table-fin tbody th { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 0; }
  .statement-table-fin .fin-section th { padding-bottom: .4rem; }
  .statement-table-fin td.num { width: auto; grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 1rem; border-bottom: 0; padding-top: .1rem; padding-bottom: .1rem; }
  .statement-table-fin td.num::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  .statement-table-fin tr { border-bottom: 1px solid var(--border); }
}

/* Activities: the form's rule builder and preview, and lists of dates. */
.activity-form fieldset { border: 0; border-top: 1px solid var(--border); padding: 1rem 0 0; margin: 1rem 0 0; min-width: 0; }
.activity-form legend { font-weight: 600; padding: 0 .25rem 0 0; }
.activity-form [hidden] { display: none !important; }
.activity-form textarea { width: 100%; }
.inline-input { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.inline-input input, .inline-input select { display: inline-block; width: auto; margin-top: 0; }
.inline-input input[type=number] { width: 5rem; }
.day-picks { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.day-pick { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; }
.activity-form label.check input[type=date], .activity-form label.check input[type=number] { display: inline-block; width: auto; margin-top: 0; }
.activity-form label.check input[type=number] { width: 5rem; }
.preview-box { margin-top: 1rem; padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.preview-box h2 { font-size: 1rem; margin: 0 0 .5rem; padding: 0; border: 0; }
.rule-preview p { margin: 0 0 .35rem; }
.date-list { margin: 0; padding-left: 1.2rem; }
.date-list li { margin: .15rem 0; }
.description { white-space: normal; margin: 1rem 0 0; }
.leader-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.leader-list li { display: flex; align-items: center; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.inline-form .field { margin: 0; }
.dash-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.celebrations.card { padding: .25rem 1.25rem; }
.leader-add { align-items: flex-end; }
.copy-field { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.subscribe { margin-top: 1rem; }
.date-actions .actions { margin-bottom: 1rem; }

/* A copy of the app that isn't the real one (APP_ENV=staging). */
.env-banner { position: fixed; right: .75rem; bottom: .75rem; z-index: 90; max-width: calc(100vw - 1.5rem);
  background: #b54708; color: #fff; font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  padding: .35rem .75rem; border-radius: 999px; box-shadow: var(--shadow-lg); pointer-events: none; }
@media (max-width: 640px) { .env-banner .env-notice { display: none; } }
@media print { .env-banner { display: none; } }

/* Member events */
.stats-filters { display: grid; gap: .8rem; }
.stats-filters .segmented { justify-self: start; }
.stats-filters .filters { margin: 0; align-items: flex-end; }
.stats-filters .compare-custom { display: contents; }
.stats-filters .compare-custom[hidden] { display: none; }
.type-checks { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; min-width: 0; }
.type-checks legend { padding: 0; margin-bottom: .4rem; font-weight: 600; }
.stats-filters .form-actions { margin: 0; }
.stats-table td.num a, .kpi-value a { color: inherit; text-decoration-color: var(--border-strong); }
.export-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.member-picker { border: 1px solid var(--border); border-radius: 8px; padding: .8rem; margin: 0 0 1rem; min-width: 0; }
.member-picker .picker-list { max-height: 22rem; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .25rem 1rem; margin-top: .6rem; }
.member-picker .picker-list [hidden] { display: none; }
.error-list { color: var(--danger, #b42318); margin: 0 0 1rem; padding-left: 1.2rem; }
.level-form select { min-width: 12rem; }
