:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-2: #f1ece4;
  --text: #221d19;
  --muted: #6f655c;
  --line: #e4ddd2;
  --accent: #7a1f2b;
  --link: #7a1f2b;
  --accent-ink: #ffffff;
  --btn: #7a1f2b; --btn-ink: #ffffff;
  --gold: #b0842f;
  --ready: #1f7a4d;
  --ready-bg: #e3f2ea;
  --progress: #8a5a00;
  --progress-bg: #fbf0d9;
  --idle: #6f655c;
  --idle-bg: #eee9e1;
  --fail: #b3261e;
  --fail-bg: #fbe5e3;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 4px 16px rgba(40, 30, 20, .05);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171412; --surface: #211d1a; --surface-2: #2a2521; --text: #f1ebe3; --muted: #a89d92; --line: #3a332d;
    --accent: #d06a77; --accent-ink: #1a1210; --btn: #8c2534; --btn-ink: #ffffff; --gold: #d9b26a; --link: #e2505e;
    --ready: #6fd1a0; --ready-bg: #173126; --progress: #e8b75c; --progress-bg: #362a14;
    --idle: #a89d92; --idle-bg: #2e2924; --fail: #f08a82; --fail-bg: #3a1d1b;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #171412; --surface: #211d1a; --surface-2: #2a2521; --text: #f1ebe3; --muted: #a89d92; --line: #3a332d;
  --accent: #d06a77; --accent-ink: #1a1210; --btn: #8c2534; --btn-ink: #ffffff; --gold: #d9b26a; --link: #e2505e;
  --ready: #6fd1a0; --ready-bg: #173126; --progress: #e8b75c; --progress-bg: #362a14;
  --idle: #a89d92; --idle-bg: #2e2924; --fail: #f08a82; --fail-bg: #3a1d1b;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, -apple-system, sans-serif; }
h1, h2, .brand { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0; }
.muted { color: var(--muted); }
.loadbar { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 0 0 16px; }
.loadbar-top, .loadbar-bottom { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.loadbar-top #load-pct { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.loadbar-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 10px 0 8px; }
.loadbar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .9s linear; }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.btn { font: inherit; font-weight: 500; border-radius: 999px; padding: 10px 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 40px 32px; max-width: 380px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.signin-card h1 { margin: 8px 0 4px; font-size: 26px; }
.signin-card .btn { margin-top: 20px; width: 100%; }
.signin-card .btn + .btn { margin-top: 10px; }
.email-form { margin-top: 16px; text-align: left; }
.signin-help { margin-top: 18px; text-align: left; font-size: 14px; color: var(--text); }
.signin-help summary { cursor: pointer; color: var(--accent); font-weight: 600; text-align: center; list-style: none; }
.signin-help summary::-webkit-details-marker { display: none; }
.signin-help p, .signin-help ol { margin: 10px 0 0; line-height: 1.45; }
.signin-help ol { padding-left: 20px; }
.signin-help a { color: var(--link); }
.email-form .field { display: block; }
.email-form input { width: 100%; box-sizing: border-box; }
#code-input { font-size: 22px; letter-spacing: 6px; text-align: center; }
.signin-msg { background: var(--fail-bg); color: var(--fail); border-radius: 8px; padding: 10px; font-size: 14px; }
.mark { color: var(--gold); font-size: 22px; }
/* The Coptic cross (the same outline as the apps), in the current text colour, sized to the text. */
.cx { display: inline-block; width: 1em; height: 1em; vertical-align: -0.14em; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.504 9.504 L9.504 5.856 L6.720 3.024 L10.272 3.024 L12 0.576 L13.728 3.024 L17.280 3.024 L14.496 5.856 L14.496 9.504 L18.144 9.504 L20.976 6.720 L20.976 10.272 L23.424 12 L20.976 13.728 L20.976 17.280 L18.144 14.496 L14.496 14.496 L14.496 18.144 L17.280 20.976 L13.728 20.976 L12 23.424 L10.272 20.976 L6.720 20.976 L9.504 18.144 L9.504 14.496 L5.856 14.496 L3.024 17.280 L3.024 13.728 L0.576 12 L3.024 10.272 L3.024 6.720 L5.856 9.504 Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.504 9.504 L9.504 5.856 L6.720 3.024 L10.272 3.024 L12 0.576 L13.728 3.024 L17.280 3.024 L14.496 5.856 L14.496 9.504 L18.144 9.504 L20.976 6.720 L20.976 10.272 L23.424 12 L20.976 13.728 L20.976 17.280 L18.144 14.496 L14.496 14.496 L14.496 18.144 L17.280 20.976 L13.728 20.976 L12 23.424 L10.272 20.976 L6.720 20.976 L9.504 18.144 L9.504 14.496 L5.856 14.496 L3.024 17.280 L3.024 13.728 L0.576 12 L3.024 10.272 L3.024 6.720 L5.856 9.504 Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.mark .cx, .mark.cx { vertical-align: -0.12em; }
.signin-card .mark { font-size: 34px; }
.signin-card .diocese { margin: 10px 0 0; font-family: Fraunces, Georgia, serif; font-size: 15px; line-height: 1.4; color: var(--text); }
.signin-card .department { margin: 6px 0 18px; font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); }

/* layout */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-size: 19px; display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role { background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 2px 8px; font-size: 12px; text-transform: capitalize; }
.role.approver { background: color-mix(in srgb, var(--gold, #a8812f) 18%, transparent); color: var(--gold, #8a6420); text-transform: none; cursor: pointer; font-weight: 500; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 24px 40px; }

.banner { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.banner.info { background: var(--surface-2); color: var(--muted); }
.banner.warn { background: var(--progress-bg); color: var(--progress); }
.banner.warn ul { margin: 4px 0 0; padding-left: 18px; }
.banner.notice { display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--accent, #7a1f2b) 7%, transparent); border: 1px solid color-mix(in srgb, var(--accent, #7a1f2b) 18%, transparent); color: var(--muted); }
.banner.notice strong { color: var(--ink, inherit); }
.banner.notice p { margin: 4px 0 0; }
.notice-close { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.notice-close:hover { background: var(--surface-2); }
.banner.notice.tip { background: color-mix(in srgb, var(--gold, #b0842f) 9%, transparent); border-color: color-mix(in srgb, var(--gold, #b0842f) 28%, transparent); }
.tip-icon { font-size: 16px; line-height: 1.3; }
.tip-hide, .linkish { background: none; border: 0; padding: 0; margin-top: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--gold, #b0842f); cursor: pointer; }
.tip-body { flex: 1; }
.tip-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tip-next { background: none; border: 0; padding: 0; margin-top: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--gold, #b0842f); cursor: pointer; }
.linkish { color: var(--accent, #7a1f2b); margin-top: 0; }

.controls { display: flex; gap: 12px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 200px; }
.field.grow { flex: 1; }
.field select, .field input { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 18px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; overflow-x: auto; max-width: 100%; }
.seg button { font: inherit; font-size: 13px; font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tile:hover { border-color: var(--accent); }
.tile .num { font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 600; line-height: 1.1; }
.tile .num small { font-size: 15px; color: var(--muted); font-weight: 500; }
.tile .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tile.ready .num { color: var(--ready); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.panel h2 { margin-bottom: 8px; }

.table-wrap { overflow-x: auto; }
table.churches { width: 100%; border-collapse: collapse; font-size: 14px; }
.churches th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.churches td { padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.churches tr:last-child td { border-bottom: 0; }
.churches tbody tr { cursor: pointer; }
.churches tbody tr:hover td { background: var(--surface-2); }
.churches td.name { font-weight: 500; }
.bar { display: inline-block; vertical-align: middle; width: 70px; height: 6px; border-radius: 3px; background: var(--idle-bg); margin-left: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ready); }

.people { list-style: none; margin: 0; padding: 0; }
.person { display: flex; gap: 12px; align-items: center; padding: 12px 6px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.person:first-child { border-top: 0; }
.person:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }
.p-main { flex: 1; min-width: 0; }
.p-name { font-weight: 600; }
.p-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-tracks { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ready { background: var(--ready-bg); color: var(--ready); }
.pill.in_progress { background: var(--progress-bg); color: var(--progress); }
.pill.not_started { background: var(--idle-bg); color: var(--idle); }
.pill .t { opacity: .75; }
.flag { color: var(--fail); font-size: 12px; }
.pill.ordained { background: #f6ebd3; color: #8a6420; }
.tile.ordained .num { color: var(--gold); }
.rank-badge { display: inline-block; margin: 2px 0 6px; padding: 3px 10px; border-radius: 999px; background: #f6ebd3; color: #8a6420; font-size: 13px; font-weight: 600; }
.rank-mini { font-size: 11px; font-weight: 600; color: #8a6420; background: #f6ebd3; border-radius: 999px; padding: 1px 7px; margin-left: 4px; vertical-align: 2px; }
.btn.gold { background: var(--gold); color: #fff; border-color: transparent; }
.btn.gold:disabled { opacity: .6; }
.ord { margin: 12px 0 4px; }
.ord > .btn { width: 100%; }
.ordained-line { background: #f6ebd3; color: #6e4f17; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 500; }
.ord-actions { display: block; margin-top: 6px; }
.link { font: inherit; font-size: 13px; background: none; border: 0; padding: 0; margin-right: 14px; color: var(--accent); cursor: pointer; font-weight: 600; }
.link.danger { color: var(--fail); }
.ord-form { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.ord-form .field { min-width: 0; }
.ord-warn { margin: 0; font-size: 13px; color: var(--progress); background: var(--progress-bg); border-radius: 8px; padding: 8px 10px; }
.ord-buttons { display: flex; gap: 8px; }
.ord-buttons .btn { flex: 1; }
.cert-line { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2, var(--surface)); flex-wrap: wrap; }
.cert-icon { font-size: 20px; }
.cert-main { flex: 1; min-width: 160px; }
.cert-title { font-size: 14px; font-weight: 600; }
.cert-title .muted { white-space: nowrap; }
.cert-actions { display: flex; gap: 6px; }
.cert-actions .btn { text-decoration: none; }
.switch-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch-field input { width: 16px; height: 16px; accent-color: var(--gold); }
a.btn { text-decoration: none; display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill.ordained, :root:not([data-theme="light"]) .rank-badge, :root:not([data-theme="light"]) .rank-mini, :root:not([data-theme="light"]) .ordained-line { background: #3a2e17; color: #e8c983; }
}

.empty { text-align: center; color: var(--muted); padding: 24px 0; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 14, 10, .35); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--bg); overflow-y: auto; padding: 24px; box-shadow: -8px 0 30px rgba(0, 0, 0, .15); }
.close { position: absolute; top: 14px; right: 14px; border: 0; background: var(--surface-2); color: var(--text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.d-head { margin-bottom: 16px; padding-right: 40px; }
.d-head h1 { font-size: 24px; margin: 0 0 2px; }
.track-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.track-card .tc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.track-card h2 { font-size: 17px; margin: 0; }
.steps { list-style: none; margin: 10px 0 0; padding: 0; }
.step { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; margin-top: 1px; }
.ico.complete { background: var(--ready); color: var(--surface); }
.ico.in_progress, .ico.pending { background: var(--progress-bg); color: var(--progress); border: 1.5px solid var(--progress); }
.ico.failed { background: var(--fail-bg); color: var(--fail); border: 1.5px solid var(--fail); }
.ico.not_started { border: 1.5px solid var(--line); background: transparent; }
.step-body { flex: 1; min-width: 0; }
.step-label { font-weight: 500; }
.step-detail { font-size: 13px; color: var(--muted); }
.step-note { font-size: 13px; color: var(--fail); }
details.sub { margin-top: 6px; font-size: 13px; }
details.sub summary { cursor: pointer; color: var(--accent); }
details.sub ul { list-style: none; padding: 0; margin: 6px 0 0; }
details.sub li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; color: var(--muted); }
details.sub li .st { font-size: 12px; }
details.sub li .st.complete, details.sub li .st.completed { color: var(--ready); }
details.sub li .st.failed { color: var(--fail); }

.controls { align-items: flex-end; }
.reports { position: relative; }
.reports .btn { padding: 10px 18px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 290px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(40, 30, 20, .15); padding: 6px; }
.menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: inherit; background: none; border: 0; border-radius: 8px; padding: 10px 12px; color: var(--text); cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button span { font-size: 12px; color: var(--muted); }
.menu-note { font-size: 12px; color: var(--muted); margin: 4px 12px 6px; }
.churches tr.region-row td { background: var(--surface-2); font-weight: 600; }
/* Overview / People tabs */
.view-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; }
.view-tabs button { font: inherit; font-size: 15px; font-weight: 500; border: 0; background: none; color: var(--muted); padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; }
.view-tabs button:hover { color: var(--text); }
.view-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.view-tabs .n { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.view-tabs .n:empty { display: none; }
.view-overview [data-tab="people"], .view-people [data-tab="overview"] { display: none !important; }
.controls .reports { margin-left: auto; }
.people-search { margin: 0 0 12px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; box-shadow: var(--shadow); color: var(--muted); }
.search-box:focus-within { border-color: var(--text); }
.search-box input { flex: 1; font: inherit; font-size: 16px; color: var(--text); background: none; border: 0; outline: none; padding: 13px 0; min-width: 0; }
.region-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.region-chip { font: inherit; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.region-chip:hover { background: var(--surface-2); }
.region-chip .n { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 4px; }
.region-chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.region-chip.on .n { color: inherit; opacity: .75; }
.region-chip:focus-visible { outline: 2px solid var(--accent, #2f6fde); outline-offset: 2px; }
@media (max-width: 640px) { .region-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; } .region-chips::-webkit-scrollbar { display: none; } }
.churches tr.region-row td.name { font-family: Fraunces, Georgia, serif; }
.churches tbody tr:not(.region-row) td.name { padding-left: 20px; }

@media (max-width: 640px) {
  .reports { flex: 1 1 100%; }
  .reports .btn { width: 100%; }
  .menu { left: 0; right: 0; width: auto; }
  .topbar { padding: 12px 16px; }
  .brand { font-size: 17px; }
  #who-name { display: none; }
  .wrap { padding: 16px 16px 32px; }
  .field { min-width: 0; flex: 1 1 100%; }
  .filters { flex-direction: column; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .p-tracks .t { display: none; }
  .drawer-panel { padding: 20px 16px; }
}

/* bulk ordain */
.head-right { display: inline-flex; align-items: center; gap: 12px; }
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 14, 10, .4); }
.modal-panel { position: relative; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--bg); border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-panel h1 { margin: 0 0 2px; font-size: 24px; }
.modal-panel > p { margin: 0 0 14px; }
.bulk-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.bulk-controls .field { min-width: 180px; }
.bulk-tools { margin: 14px 0 6px; }
.bulk-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 120px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.bulk-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.bulk-list li:first-child { border-top: 0; }
.bulk-list li.disabled { cursor: default; opacity: .55; }
.bulk-list li:not(.disabled):hover { background: var(--surface-2); }
.bulk-list input { width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.bulk-list .b-main { flex: 1; min-width: 0; }
.bulk-list .b-name { font-weight: 600; }
.bulk-list .b-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-list .b-empty { justify-content: center; color: var(--muted); cursor: default; }
.bulk-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: #3a2e17; color: #f6ebd3; padding: 12px 18px; border-radius: 999px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
@media (max-width: 640px) {
  .modal { padding: 0; place-items: end stretch; }
  .modal-panel { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 20px 16px; }
  .bulk-footer .btn { flex: 1; }
}

/* servants */
:root { --servant: #2f5d8a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --servant: #8db4e0; } }
div.tile.servants { cursor: default; }
div.tile.servants:hover { border-color: var(--line); }
.tile.servants .num { color: var(--servant); }
.bar.servant i { background: var(--servant); }

.addr { font-weight: 400; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }

/* How-to guide */
.guide { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 64px); border: 1px solid var(--line); border-radius: 18px; padding: 28px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.guide::backdrop { background: rgba(20, 12, 10, .45); }
.guide-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.guide h1 { font-size: 26px; margin: 2px 0 0; }
.guide-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); }
.guide-intro { color: var(--muted); line-height: 1.55; margin: 12px 0 18px; }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.guide summary { cursor: pointer; font-weight: 600; font-size: 16px; list-style: none; display: flex; justify-content: space-between; }
.guide summary::after { content: "+"; color: var(--accent); font-weight: 600; }
.guide details[open] summary::after { content: "–"; }
.guide summary::-webkit-details-marker { display: none; }
.guide ol { margin: 10px 0 4px; padding-left: 22px; line-height: 1.6; }
.guide li { margin: 4px 0; }
.guide .tip { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--progress-bg); font-size: 14px; }
.guide a { color: var(--link); }

/* installed app (Android home screen) and small phones */
.brand .short { display: none; }
.install-btn { white-space: nowrap; }
#install-signin { margin-top: 12px; width: 100%; }
.install-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); }
.install-banner[hidden] { display: none; }
.install-actions { display: inline-flex; gap: 8px; }
.brand, .who .btn { white-space: nowrap; }
.seg { scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
@media (display-mode: standalone) {
  .topbar { padding-top: max(14px, env(safe-area-inset-top)); }
  .wrap { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  #who-role, #who-approver { display: none; }
  .brand { font-size: 16px; }
  .brand .full { display: none; }
  .brand .short { display: inline; }
  .who { gap: 6px; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .controls > .field.grow, .controls > .reports, #region-field[hidden] + #church-field { grid-column: 1 / -1; }
}

/* ---------- servant stewards ---------- */
/* A steward sees only their church's servants: hide the reader/subdeacon parts of the page. */
.is-steward #people-panel, .is-steward .filters, .is-steward #by-church, .is-steward #region-field, .is-steward #church-field,
.is-steward #reports-menu [data-report="ordination"], .is-steward #reports-menu button[data-report="church"]:not([data-track]) { display: none !important; }
.tile.servants.alt { background: var(--surface); }
.pill.certified { background: var(--servant-bg, #e3ecf5); color: var(--servant, #2f5d8a); }
.pill.not_certified { background: var(--idle-bg); color: var(--idle); }
.stewards { list-style: none; margin: 8px 0 14px; padding: 0; }
.stewards li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.stewards li:first-child { border-top: 0; }
.stewards .s-main { flex: 1; min-width: 0; }
.stewards .s-name { font-weight: 500; }
.stewards .s-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.stewards .none { color: var(--muted); font-size: 14px; padding: 6px 0; border-top: 0; }
.steward-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.steward-form .field { min-width: 180px; }
.steward-intro { margin: 0 0 4px; }
#steward-msg.ok { color: var(--ready); }
@media (max-width: 640px) {
  .steward-form .field, .steward-form .btn { width: 100%; min-width: 0; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.certified { background: #1c2a38; color: #8db4e0; } }
.btn.danger-text { color: var(--fail); }

/* ---------- registrations to approve (priests) ---------- */
.panel.approvals { border-color: #d9b26a; }
.approvals li { flex-wrap: wrap; }
.approvals .a-actions { display: flex; gap: 8px; margin-left: auto; }
.approvals .a-contact { font-size: 13px; }
.approvals .a-contact a { color: var(--accent, #7a1f2b); margin-right: 12px; }
#approvals-msg.ok { color: var(--ready); }
.approvals-hidden { margin-top: 12px; }
.approvals-hidden summary { cursor: pointer; font-size: 14px; color: var(--muted, #6b6b6b); padding: 6px 0; }
.approvals-hidden .s-name, .approvals-hidden .avatar { opacity: .75; }
@media (max-width: 640px) { .approvals .a-actions { width: 100%; } .approvals .a-actions .btn { flex: 1; } }

/* full picture */
.picture { margin: 4px 0 14px; }
.contact { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin-top: 6px; }
.contact a { color: var(--link); text-decoration: none; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 8px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.timeline li.k-ready::before, .timeline li.k-approved::before { border-color: var(--ready); background: var(--ready); }
.timeline li.k-ordained::before, .timeline li.k-certificate::before { border-color: var(--gold); background: var(--gold); }
.timeline li.k-registered::before { border-color: var(--accent); }
.timeline .t-date { font-size: 12px; color: var(--muted); }
.timeline .t-title { font-size: 14px; font-weight: 600; }
.timeline .t-detail { font-size: 13px; color: var(--muted); }
.history-card summary { cursor: pointer; font-family: Fraunces, Georgia, serif; font-size: 18px; font-weight: 600; }

/* weekly email */
.digest-setting { display: inline-flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }

/* dashboard */
.modal-panel.wide { width: min(1040px, 100%); }
.dash-body { overflow: auto; margin: 0 -4px; padding: 0 4px; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 18px; }
.dash-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.dash-tile .num { font-family: Fraunces, Georgia, serif; font-size: 28px; font-weight: 600; line-height: 1.1; }
.dash-tile .lbl { font-size: 13px; color: var(--muted); }
.dash-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.dash-section h2 { margin-bottom: 4px; }
.dash-section .note { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.pipe-row { margin: 10px 0 14px; }
.pipe-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.pipe-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.pipe-bar span { display: block; height: 100%; min-width: 2px; }
.pipe-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.pipe-legend i, .chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.c-waiting { background: #9b8fb8; } .c-notstarted { background: var(--idle-bg); border: 1px solid var(--line); } .c-progress { background: var(--progress); }
.c-ready { background: var(--ready); } .c-ordained { background: var(--gold); } .c-registered { background: var(--accent); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: Inter, system-ui, sans-serif; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.dash-table th:first-child, .dash-table td:first-child { text-align: left; }
.dash-table td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.dash-table tr.region td { background: var(--surface-2); font-weight: 600; text-align: left; font-size: 13px; }
.dash-table td.zero { color: var(--muted); opacity: .5; }
.dash-seg { margin: 0 0 8px; }

/* ordination requests */
.panel.requests { border-color: var(--gold); }
.panel.requests .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.req-church { margin: 14px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.req-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.req-card:hover { border-color: var(--gold); }
.req-card.static { cursor: default; }
.req-card.static:hover { border-color: var(--line); }
.req-main { flex: 1; min-width: 0; }
.req-head { font-weight: 600; }
.req-sub { font-size: 13px; color: var(--muted); }
.req-people { font-size: 14px; margin-top: 4px; }
.req-warn { color: var(--progress); }
.req-badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.req-badge.open { background: var(--progress-bg); color: var(--progress); }
.req-badge.approved { background: var(--gold-bg, #F6EBD2); color: var(--gold, #8A6516); }
.req-group { margin: 18px 0 2px; font-size: 14px; font-weight: 700; color: var(--ink, inherit); }
.req-stage { margin: 6px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--progress-bg); color: var(--ink, inherit); font-size: 14px; line-height: 1.4; }
.req-badge.completed { background: var(--ready-bg); color: var(--ready); }
.req-badge.declined, .req-badge.withdrawn { background: var(--idle-bg); color: var(--idle); }
.req-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.req-note { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 10px; }
.req-list li { flex-wrap: wrap; }
.req-list .req-name { flex-basis: 100%; display: flex; gap: 8px; align-items: center; padding-left: 34px; }
.req-list .req-name input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.req-list .req-name label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.req-list .b-sub.warn { color: var(--progress); }
.req-chanters { margin: 4px 0 14px; }
.req-subhead { font-size: 14px; font-weight: 700; margin: 10px 0 6px; }
.req-chanters .req-list { margin-bottom: 8px; }
.chanter-form { margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.chanter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.chanter-grid .field { min-width: 0; }
.chanter-form .attest { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 10px 0 4px; cursor: pointer; }
.chanter-form .attest input { margin-top: 3px; }
.req-how { margin: 4px 0 12px; font-size: 14px; }
.req-how summary { cursor: pointer; font-weight: 600; color: var(--accent, inherit); }
.req-how ol { margin: 8px 0 0; padding-left: 22px; line-height: 1.45; }
.req-how li { margin: 4px 0; }
.chanter-reqs { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--progress-bg); font-size: 14px; line-height: 1.45; }
.chanter-reqs strong { display: block; margin-bottom: 4px; }
.chanter-reqs ul { margin: 6px 0 0; padding-left: 20px; }
.chanter-reqs li { margin: 3px 0; }
.chanter-matches { margin-top: 10px; padding: 12px; border: 1px solid var(--progress); border-radius: 12px; background: var(--surface); }
.chanter-matches h3 { margin: 0 0 4px; font-size: 15px; }
.chanter-matches .cm-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.chanter-matches .cm-row:first-of-type { border-top: 0; }
.chanter-matches .cm-main { flex: 1; min-width: 0; font-size: 14px; }
.chanter-matches .cm-why { color: var(--progress); font-size: 13px; }
.chanter-matches .cm-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.req-list .req-match { flex-basis: 100%; padding-left: 50px; font-size: 13px; color: var(--progress); }
.chanter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.req-list .ch-remove { margin-left: auto; }
#req-chanters .req-name { padding-left: 50px; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); resize: vertical; width: 100%; }
.person.chanter .p-tracks { flex-direction: row; align-items: center; gap: 8px; }
.person.chanter { cursor: default; }

/* Past ordinations (before CED Tracker) */
.past-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.past-row .past-main { flex: 1; min-width: 0; }
.past-row .past-name { font-weight: 600; }
.past-row .past-sub { font-size: 13px; color: var(--muted, #6b6b6b); margin-top: 2px; }
.past-row .past-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.past-tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--chip, rgba(0,0,0,.06)); margin-left: 6px; font-weight: 500; }
.past-tag.in-app { background: rgba(122, 31, 43, .1); color: var(--link, #7a1f2b); }
.past-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.past-form .field { margin: 0; min-width: 160px; }
.past-form .field input, .past-form .field select { min-width: 0; }
.past-form .field.year input { width: 90px; }
.past-add { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.past-add h3 { font-size: 15px; margin: 0 0 4px; }
.past-rollout { columns: 2 220px; margin: 8px 0 12px; font-size: 14px; }
.past-rollout label { display: flex; gap: 8px; align-items: center; padding: 3px 0; break-inside: avoid; }
.past-group { margin: 16px 0 2px; font-size: 14px; font-weight: 700; }
.field.inline { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Submitting someone already ordained: a tidy grid of fields, the button on its own line. */
.past-form.past-submit { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.past-form.past-submit .btn { justify-self: start; grid-column: 1 / -1; }
/* Bulk submit (past ordinations): a blue text link, the steps, and the checked rows. */
.blue-link { background: none; border: 0; padding: 0; font: inherit; color: #1a6fd1; cursor: pointer; text-decoration: none; }
.blue-link:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .blue-link { color: #6aa8ff; } }
:root[data-theme="dark"] .blue-link { color: #6aa8ff; }
.bulk-hint { margin: 12px 0 0; color: var(--muted); }
.bulk-step { font-size: 15px; margin: 18px 0 8px; }
.bulk-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bulk-file { cursor: pointer; margin-right: 8px; }
.bulk-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.bulk-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bulk-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bulk-table tr.bulk-bad td { background: color-mix(in srgb, var(--danger, #b3261e) 7%, transparent); }
.bulk-ok { color: var(--ready, #2e7d4f); font-weight: 600; white-space: nowrap; }
.bulk-problem { color: var(--danger, #b3261e); }
.bulk-summary { margin: 12px 0 4px; }
.modal-panel.wide { max-width: min(1100px, calc(100vw - 32px)); width: 100%; }
.is-steward .controls { margin-bottom: 14px; }
