/* Church Admin: light, mobile-first styles. No frameworks, no web fonts (3G budget). */
:root {
  --ink: #1b2330; --muted: #5b6676; --line: #dfe3ea; --bg: #f5f7fa; --card: #fff;
  --brand: #1f3a5f; --brand-2: #2f5d8f; --accent: #b8860b; --ok: #2e7d4f; --warn: #b26a00; --bad: #b3261e;
  --radius: 10px; --pad: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.45; }
a { color: var(--brand-2); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .85rem; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--brand); color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.brand .org { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .scope { font-size: .8rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn, .lang-btn { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px; min-width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }
.lang-btn { font-size: .85rem; font-weight: 600; }

.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 82%; max-width: 300px; z-index: 40;
  background: #fff; overflow-y: auto; padding: 16px 0; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
.drawer a { display: block; padding: 13px 20px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.drawer a.active { border-left-color: var(--brand); background: #eef3f9; font-weight: 600; }
.drawer .section { padding: 14px 20px 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }

.app { max-width: 960px; margin: 0 auto; padding: 16px 14px 80px; }
.loading { text-align: center; padding: 80px 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-bottom: 12px; }
.auth-card { max-width: 420px; margin: 30px auto; }
.auth-logo { text-align: center; margin-bottom: 14px; }
.auth-logo img { width: 56px; height: 56px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .n { font-size: 1.5rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.warn .n { color: var(--warn); }

.bars .row { display: grid; grid-template-columns: 90px 1fr 50px; gap: 8px; align-items: center; margin: 6px 0; font-size: .9rem; }
.bars .track { background: #edf0f4; border-radius: 6px; height: 12px; overflow: hidden; }
.bars .fill { background: var(--brand-2); height: 100%; }
.bars .num { text-align: right; color: var(--muted); }

form .field { margin-bottom: 12px; }
label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 11px; border: 1px solid #c9d0da; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: var(--brand-2); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.check label { color: var(--ink); font-size: .95rem; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar > * { flex: 1 1 160px; }
.toolbar .btn { flex: 0 0 auto; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a.item, .list .item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 2px; color: var(--ink); text-decoration: none; align-items: center; }
.item .main { min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: .85rem; }
.chev { color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: #edf0f4; color: var(--muted); }
.badge.ok { background: #e3f3ea; color: var(--ok); }
.badge.warn { background: #fff2dc; color: var(--warn); }
.badge.bad { background: #fde7e5; color: var(--bad); }
.badge.brand { background: #e6eef8; color: var(--brand); }

.tree { list-style: none; padding-left: 0; margin: 0; }
.tree ul { list-style: none; padding-left: 12px; margin: 0; border-left: 1px dashed var(--line); }
.tree li { margin: 0; }
.tree .node { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 4px; }
.tree .node .meta { flex: 1 1 150px; min-width: 0; }
.tree .node .tools { display: flex; gap: 6px; margin-left: auto; }
.tree .node .name { font-weight: 600; }
.tree details > summary { list-style: none; cursor: pointer; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree .tw { width: 16px; color: var(--muted); }

.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { text-decoration: none; }
.notice { border-left: 4px solid var(--accent); background: #fff8e8; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: .92rem; }
.notice.bad { border-color: var(--bad); background: #fdeceb; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.demo-band { background: var(--accent); color: #fff; text-align: center; font-size: .8rem; padding: 4px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: 92%;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 14px 14px 0 0; padding: 18px; }
@media (min-width: 640px) { .modal { align-items: center; } .modal .sheet { border-radius: 14px; } }
.qr { text-align: center; } .qr img { width: 200px; height: 200px; }
code.copy { display: block; word-break: break-all; background: #f0f3f7; padding: 8px; border-radius: 6px; font-size: .85rem; }
[hidden] { display: none !important; }
