:root {
  --bg: #f5f7f8; --card: #fff; --text: #14202b; --muted: #66727d;
  --brand: #0f766e; --pos: #15803d; --neg: #b91c1c; --line: #e3e8ec;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1418; --card: #172027; --text: #e8eef2; --muted: #90a0ac; --line: #26333c; --brand: #2dd4bf; --pos: #4ade80; --neg: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--brand); color: #fff;
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.container { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 12px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; }
.summary { text-align: center; }
.big { font-size: 2rem; font-weight: 800; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .center { text-align: center; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; }
.amt { font-weight: 700; text-align: right; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .zero { color: var(--muted); }
.tx .row { padding: 2px 0; }
label { display: block; font-weight: 600; margin-bottom: 12px; }
label.plain { margin: 0; }
input, select, textarea { width: 100%; margin-top: 6px; padding: 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
#member-list input { margin: 0 0 8px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.check input { width: 20px; height: 20px; margin: 0; }
.btn { display: block; width: 100%; padding: 14px; margin-top: 10px; border: 0; border-radius: 12px;
  font: inherit; font-weight: 700; cursor: pointer; }
.btn { text-align: center; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px dashed var(--brand); }
.btn.danger { background: transparent; color: var(--neg); border: 1px solid var(--neg); margin-top: 24px; }
a.link { text-decoration: none; }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 4px; }
.link.danger { color: var(--neg); }
.chip { display: inline-block; margin-left: 8px; padding: 4px 10px; border-radius: 999px; font-size: .8rem;
  background: var(--brand); color: #fff; text-decoration: none; }
.flash { padding: 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash.ok { background: #dcfce7; color: #166534; } .flash.error { background: #fee2e2; color: #991b1b; }
details summary { cursor: pointer; font-weight: 600; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.bottomnav a { flex: 1; text-align: center; padding: 14px 4px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.bottomnav a.on { color: var(--brand); }
.bottomnav a.add { color: #fff; background: var(--brand); border-radius: 12px; margin: 6px; padding: 8px 4px; }

/* ---- login / roles / photos ---- */
.who { font-size: .85rem; display: flex; gap: 10px; align-items: center; }
.who a { color: #fff; background: rgba(255,255,255,.2); padding: 4px 10px; border-radius: 999px; text-decoration: none; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 20px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 12px; min-height: 56px; text-align: left;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  font: inherit; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.pick:active { background: var(--bg); border-color: var(--brand); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; }
.bottomnav a { min-width: 0; }
.gallery { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .gallery { grid-template-columns: 1fr 1fr; } }
.shot { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.shot img { display: block; width: 100%; height: auto; cursor: zoom-in; background: var(--bg); }
.shot figcaption { padding: 10px 14px; font-weight: 600; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: flex; }
.lightbox[hidden] { display: none; }
.lb-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.lb-scroll img { display: block; width: 100%; max-width: 900px; margin: 0 auto; height: auto; }
.lb-close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 51; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: #000; font-size: 1.2rem; cursor: pointer; }

/* ---- groups ---- */
.brand .caret { font-size: .8em; opacity: .8; }
a.group-card { display: block; color: inherit; text-decoration: none; }
a.group-card:active, a.group-card.current { border-color: var(--brand); }
.group-card .row { padding: 0 0 4px; }
