:root {
  --brand: #4f46e5; --brand-2: #7c3aed; --on-brand: #fff;
  --bg: #f4f5fb; --card: #fff; --text: #1d1f2c; --muted: #6b7083; --line: #e6e8f0;
  --ok: #0f8a5f; --ok-bg: #e3f6ee; --warn: #a15c00; --warn-bg: #fff2d9; --bad: #c62828; --bad-bg: #fde7e7;
  --radius: 16px; --shadow: 0 1px 2px rgb(20 20 50 / .06), 0 4px 14px rgb(20 20 50 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6d67f0; --brand-2: #8b5cf6;
    --bg: #11121a; --card: #1b1d28; --text: #ecedf5; --muted: #9a9db0; --line: #2b2e3d;
    --ok: #4ade9b; --ok-bg: #12352a; --warn: #fbbf4b; --warn-bg: #3a2c10; --bad: #ff7b7b; --bad-bg: #3d1a1a;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h3 { font-size: 16px; margin-bottom: 8px; }
main { max-width: 640px; margin: 0 auto; padding: 12px 14px; display: grid; gap: 12px; }
.small { font-size: 13px; } .muted { color: var(--muted); } .pad { padding: 0 4px; }
.mono { font-family: ui-monospace, monospace; word-break: break-all; }
.big { font-size: 22px; font-weight: 700; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px; background: var(--brand); color: var(--on-brand);
}
.bar h1 { flex: 1; font-size: 19px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.logo img { width: 34px; height: 34px; border-radius: 9px; display: block; margin-left: 6px; box-shadow: 0 0 0 2px rgb(255 255 255 / .25); }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer; flex: none;
}
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn:active { background: rgb(255 255 255 / .18); }
.icon-btn.sm { width: 34px; height: 34px; color: var(--muted); }
.icon-btn.sm svg { width: 20px; height: 20px; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.c-card { display: grid; gap: 6px; color: inherit; text-decoration: none; }
.c-card:active { transform: scale(.99); }
.c-card h2 { font-size: 17px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.amt { font-weight: 700; color: var(--brand); }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 6px; }
.pill { justify-self: start; display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; margin-top: 2px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

.totals { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.totals div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; font-size: 12px; color: var(--muted); display: grid; }
.totals span { font-size: 17px; font-weight: 700; color: var(--text); }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 12px 14px;
}

/* committee hero */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 20px; padding: 16px; }
.hero .small { opacity: .85; }
.hero-amt { font-size: 32px; font-weight: 800; letter-spacing: -.5px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; font-weight: 600; }
.hero-grid span { display: block; font-size: 12px; font-weight: 400; opacity: .8; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { display: grid; gap: 2px; align-content: start; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs a { text-align: center; padding: 9px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.on { background: var(--brand); color: #fff; }

.list { padding: 4px 0; }
.li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .no { min-width: 36px; font-size: 12px; font-weight: 700; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); padding: 3px 6px; border-radius: 8px; text-align: center; }
.li .sep { color: var(--muted); }
.hist { display: grid; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; overflow-wrap: anywhere; }
.shots { display: flex; gap: 8px; flex-wrap: wrap; }
.shots img { width: 76px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.shot { position: relative; }
.shot button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-size: 12px; }
.shots.edit:empty { display: none; }

.empty { text-align: center; padding: 40px 16px; display: grid; gap: 10px; justify-items: center; }
.empty img { width: 88px; border-radius: 22px; }
.empty p { margin: 0; color: var(--muted); }
.empty-small { text-align: center; color: var(--muted); margin: 16px 0; }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border: 0; border-radius: 12px; background: var(--brand); color: #fff; font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn:active { filter: brightness(.92); }
.btn.block { width: 100%; margin-top: 8px; }
.btn.ghost { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.small-btn { min-height: 38px; padding: 0 14px; background: var(--warn); color: #fff; flex: none; }
.form { display: grid; gap: 12px; }
.form label, fieldset { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 5px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; width: 100%; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
details summary { font-weight: 600; color: var(--brand); cursor: pointer; padding: 4px 0; }
details .grid2 { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-weight: 500; font-size: 14px; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.switch { display: flex !important; grid-template-columns: none; align-items: center; gap: 12px !important; color: var(--text) !important; font-weight: 500 !important; font-size: 14px !important; }
.switch input { padding: 0; width: 22px; height: 22px; flex: none; accent-color: var(--brand); }

/* floating action button */
.fab {
  position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 20px 0 16px; border-radius: 18px;
  background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 6px 18px rgb(79 70 229 / .4);
}
.fab svg { width: 24px; height: 24px; fill: currentColor; }

/* toast, dialog, image viewer */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 28px); width: max-content;
  background: #23243a; color: #fff; padding: 12px 14px 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / .3);
}
.toast button { border: 0; background: #25d366; color: #073; font: inherit; font-weight: 700; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.toast[hidden] { display: none; }
dialog { border: 0; border-radius: 18px; padding: 0; width: min(92vw, 420px); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.dlg-body { padding: 18px 18px 4px; }
.dlg-body p { margin: 8px 0; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 14px 14px; flex-wrap: wrap; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / .92); display: grid; place-items: center; padding: 12px; }
.viewer[hidden] { display: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .15); color: #fff; font-size: 18px; }

/* login, offline strip, server backup list */
.login { min-height: 100vh; align-content: center; justify-items: center; text-align: center; }
.login img { width: 84px; border-radius: 22px; }
.login h1 { font-size: 24px; margin-bottom: 4px; }
.login form { width: 100%; max-width: 360px; text-align: left; }
.offline { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: 13px; padding: 6px 12px; }
.blist { display: grid; }
.bi { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bi:last-child { border-bottom: 0; }
.bi > div { flex: 1; display: grid; }
.bi .icon-btn { text-decoration: none; font-size: 18px; }
.btn.mini { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .6; }
code { font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 5px; }
