/* The Overview. Colours as roles (light, and a chosen dark set); church colours are the chart palette's first three
   (validated together for colour-blind readers, in light and dark). */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --border: #e3e2de;
  --grid: #ecebe7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --accent: #2a78d6;
  --nlc: #2a78d6;
  --swc: #eb6834;
  --ccpm: #1baf7a;
  --good: #1a7f37;
  --warn: #9a6700;
  --bad: #c62828;
  --chip: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --border: #2e2d2b; --grid: #262624;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e88; --accent: #3987e5;
    --nlc: #3987e5; --swc: #d95926; --ccpm: #199e70;
    --good: #4ac26b; --warn: #d4a72c; --bad: #f47067; --chip: #1f1f1e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --border: #2e2d2b; --grid: #262624;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e88; --accent: #3987e5;
  --nlc: #3987e5; --swc: #d95926; --ccpm: #199e70;
  --good: #4ac26b; --warn: #d4a72c; --bad: #f47067; --chip: #1f1f1e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 2px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
a { color: var(--accent); }

/* The shell, as in the church apps: a dark top bar; on phones a tab bar at the bottom, on wider screens a side menu. */
:root { --nav-bg: #1e293b; --nav-text: #f8fafc; --nav-muted: #94a3b8; --nav-active: rgba(255,255,255,0.14); --nav-hover: rgba(255,255,255,0.07); --tabs-h: 64px; }
.shell { display: flex; min-height: 100dvh; }
.column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; background: var(--nav-bg); color: var(--nav-text); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; min-height: 56px; }
.top h1 { flex: 1; min-width: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-logo { width: 30px; height: 30px; border-radius: 7px; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--nav-hover); }
.icon-btn svg, .side svg, .tabs svg, .menu svg { width: 20px; height: 20px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 46px; min-width: 210px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); padding: 6px; z-index: 20; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--grid); }
main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 12px 16px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--nav-bg); display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabs a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; border-radius: 12px; color: var(--nav-muted); text-decoration: none; font-size: 11px; position: relative; }
.tabs a[aria-current="page"] { color: var(--nav-text); background: var(--nav-active); }
.badge { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f59e0b; color: #1c1917; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.side { width: 232px; flex: none; background: var(--nav-bg); color: var(--nav-text); position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 14px 10px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 16px; }
.side .brand img { width: 32px; height: 32px; border-radius: 8px; }
.side a, .side button { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--nav-muted); text-decoration: none; font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.side a:hover, .side button:hover { background: var(--nav-hover); color: var(--nav-text); }
.side a[aria-current="page"] { background: var(--nav-active); color: var(--nav-text); font-weight: 600; }
.side .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #f59e0b; color: #1c1917; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.side .spacer { flex: 1; }
@media (min-width: 1024px) {
  .tabs { display: none !important; }
  .side:not([hidden]) ~ .column .top-logo, .side:not([hidden]) ~ .column .menu-wrap { display: none; }
  main { padding-bottom: 48px; }
  .top { background: var(--bg); color: var(--text); position: static; }
  .top h1 { font-size: 22px; }
}
@media (max-width: 1023.98px) { .side { display: none !important; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); }
.page-intro { margin: 0 0 10px; }

.btn { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text-2); border-color: transparent; font-weight: 500; }
.btn.ghost:hover { background: var(--grid); }
.btn:disabled { opacity: .55; cursor: default; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 4px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--chip); color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { border-color: var(--text); color: var(--text); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; min-width: 0; }
.section { margin-top: 18px; }
.section > .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }

.church-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.church-head h2 { margin: 0; flex: 1; min-width: 0; }
.big { font-size: 28px; font-weight: 700; line-height: 1.1; }
.kv { display: flex; gap: 16px; margin-bottom: 8px; }
.status { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.status li { display: flex; gap: 8px; align-items: center; }
.ok { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.ico { width: 18px; text-align: center; font-weight: 700; }

.chart-card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--text-2); margin: 6px 0 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 3px; border-radius: 2px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .endlabel { font-size: 11px; fill: var(--text-2); }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 16px rgb(0 0 0 / .12); white-space: nowrap; z-index: 2; }
.tip b { display: block; margin-bottom: 2px; }
.tip .row { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip .row strong { color: var(--text); margin-left: auto; padding-left: 12px; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 0; min-height: 32px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.spark { display: block; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 5px 0; }
.bar-track { height: 12px; }
.bar { height: 12px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.bar-row .val { font-variant-numeric: tabular-nums; color: var(--text-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin-right: 6px; }
.msg { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.signin { max-width: 380px; margin: 40px auto; text-align: center; }
.signin input { width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--chip); color: var(--text); font: inherit; padding: 0 12px; margin: 8px 0; }
.error { color: var(--bad); font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.side a { white-space: nowrap; }
/* Long error messages: the first four lines (tap the church app's list for the rest). */
#main .list .msg { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
