:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #23231e;
  --muted: #6d675c;
  --line: #e3ddd0;
  --accent: #7a6f43;        /* EllFit gold, darkened for white-text contrast */
  --accent-ink: #ffffff;
  --ok: #1f7a4d;
  --late: #b4540a;
  --late-bg: #fff1e2;
  --chip: #f1ede4;
  --mine: #ece5cf;
  --gold: #8f8352;
  --ok-bg: #e3f2ea;
  --zero: #8a5a00;
  --zero-bg: #fbf0d9;
  --neg: #a8322a;
  --neg-bg: #fbe5e2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110e;
    --card: #1d1b17;
    --ink: #f3efe6;
    --muted: #a39c8f;
    --line: #34302a;
    --chip: #2a2722;
    --ok: #5fcf95;
    --late: #ffb26b;
    --late-bg: #3a2614;
    --mine: #3b3624;
    --gold: #c2b37a;
    --ok-bg: #16301f;
    --zero: #f0c060;
    --zero-bg: #33280f;
    --neg: #ff8a7e;
    --neg-bg: #3a1a16;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 40px;
}

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.facts { margin-bottom: 22px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.facts .sub { margin: 0; color: var(--ink); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* Logo is a JPG on white — shown as a white disc so it also sits well in dark mode */
.logo { width: 76px; height: 76px; flex: none; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line); }
h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.01em;
}
h1 span { color: var(--gold); font-weight: 700; }

.sub { margin: 6px 0 0; color: var(--muted); font-weight: 500; }
.price { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.price b { color: var(--ink); }
.admin-badge { background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }

.me label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.me input {
  width: 100%;
  font: inherit;
  font-size: 18px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}
.me input:focus { outline: none; border-color: var(--ink); }
.me input.invalid { border-color: var(--accent); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

.sessions { display: grid; gap: 16px; margin: 24px 0 32px; }
.loading { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}
.card.today { border: 2px solid var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h2 { margin: 0; font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.pill { background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.04em; }
.when { margin: 2px 0 0; color: var(--muted); }
.sub-coach { margin: 2px 0 0; font-size: 15px; font-weight: 700; }
.count { text-align: right; white-space: nowrap; }
.count strong { font-size: 48px; line-height: 0.9; font-weight: 900; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.count span { color: var(--muted); font-weight: 600; margin-left: 2px; }

.deadline { background: var(--late-bg); color: var(--late); font-size: 14px; padding: 8px 12px; border-radius: 10px; margin: 14px 0 0; }

.actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 16px; }
.status { margin: 0; font-weight: 600; color: var(--muted); }
.status.ok { color: var(--ok); }

.btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.secondary { background: var(--chip); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); font-size: 16px; padding: 10px 16px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.link.small { font-size: 14px; align-self: center; }

.people { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.people li { display: flex; align-items: center; gap: 6px; background: var(--chip); padding: 5px 10px; border-radius: 99px; font-size: 14px; font-weight: 500; }
.people li.mine { background: var(--mine); font-weight: 700; }
.tag { font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tag.late { color: var(--late); }
.x { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.empty { margin: 16px 0 0; color: var(--muted); font-size: 14px; }

.card.cancelled { opacity: 0.85; border-style: dashed; }
.off { margin: 14px 0 0; font-weight: 700; color: var(--late); }

.schedule { margin: 0 0 32px; }
.schedule h2 { margin: 0 0 4px; font-size: 18px; }
.schedule .hint { margin: 0 0 12px; }
.sched { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.sched li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sched li:last-child { border-bottom: 0; }
.sched .d { width: 64px; flex: none; font-variant-numeric: tabular-nums; }
.sched .info { flex: 1; min-width: 0; color: var(--muted); font-size: 15px; }
.sched li.off .info { color: var(--late); font-weight: 600; }
.sched .info small { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }
.sched li.off .d { text-decoration: line-through; color: var(--muted); }
.sched .reason { width: 100%; font: inherit; font-size: 15px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.mini { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); cursor: pointer; }
.mini.danger { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mini:disabled { opacity: 0.5; }
footer p { margin: 0 0 8px; }

.cal { border-top: 1px solid var(--line); padding-top: 20px; }
.cal h2 { margin: 0 0 4px; font-size: 18px; }
.cal p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input) { padding: 7px 14px; border-radius: 99px; background: var(--chip); font-size: 15px; font-weight: 600; }
.seg label:has(input:checked) { background: var(--ink); color: var(--bg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.faq-btn { font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.faq-foot { margin: 24px 0 0; font-size: 15px; }
.faq-foot a { color: var(--ink); font-weight: 600; }
h1 span { display: block; }
@media (max-width: 400px) {
  .logo { width: 64px; height: 64px; }
  h1 { font-size: 23px; }
}

.faq {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.faq[open] { display: flex; flex-direction: column; }
.faq::backdrop { background: rgba(10, 9, 7, 0.55); }
.faq-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.faq-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.faq-close { border: 0; background: var(--chip); color: var(--ink); width: 36px; height: 36px; border-radius: 99px; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.faq-body { overflow-y: auto; padding: 8px 20px 20px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { list-style: none; cursor: pointer; padding: 14px 28px 14px 0; font-weight: 700; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 12px; font-size: 22px; font-weight: 400; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--muted); }
.faq details p b { color: var(--ink); }

footer { margin-top: 28px; font-size: 14px; color: var(--muted); }
footer a { color: inherit; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

/* ---------- coach check-in (treener.html) ---------- */
[hidden] { display: none !important; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sheet-title { font-size: 24px; }
.sheet-head .hint { margin-top: 2px; }
a.faq-close { display: grid; place-items: center; text-decoration: none; }
.search { width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); margin-bottom: 12px; }
.search:focus { outline: none; border-color: var(--ink); }
.list { list-style: none; margin: 0 0 14px; padding: 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.list:empty { display: none; }
.list-title { margin: 6px 0 8px; font-size: 16px; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 0; font: inherit; color: inherit; background: none; border: 0; text-align: left; cursor: pointer; touch-action: manipulation; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; }
.who small { font-weight: 400; font-size: 12px; color: var(--muted); }
.chip { font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.zero { background: var(--zero-bg); color: var(--zero); }
.chip.neg { background: var(--neg-bg); color: var(--neg); }
.tick { width: 34px; height: 34px; flex: none; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; color: var(--muted); }
.tick.on { background: var(--ok); border-color: var(--ok); color: var(--card); }
.note { margin: 0 0 12px; font-size: 14px; background: var(--zero-bg); color: var(--zero); border-radius: 10px; padding: 8px 12px; }
.btn.wide { display: block; width: 100%; margin-bottom: 12px; }
.btn small { display: block; font-size: 13px; font-weight: 600; opacity: 0.85; }
.refused { margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; background: var(--neg-bg); color: var(--neg); font-size: 14px; }
.refused p, .refused ul { margin: 0; }
.refused ul { padding-left: 18px; }
.sheet { width: min(420px, calc(100% - 24px)); border: 0; border-radius: 20px; padding: 18px; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.sheet[open], .sheet form, .sheet .stack { display: flex; flex-direction: column; gap: 10px; }
.sheet::backdrop { background: rgba(10, 9, 7, 0.55); }
.sheet-label { margin: 0; font-weight: 800; font-size: 18px; }
.sheet .hint { margin: 0; }
.sheet .link { align-self: center; }

/* ---------- coach pages: menu, people, person, cash ---------- */
.menu { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; margin: 0 0 18px; }
.menu a { display: flex; justify-content: space-between; padding: 12px 0; color: var(--ink); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--line); }
.menu a:last-child { border-bottom: 0; }
.menu span { color: var(--muted); }
a.row-main { text-decoration: none; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pill-btn { font: inherit; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 99px; border: 0; background: var(--chip); color: var(--ink); cursor: pointer; }
.pill-btn.on { background: var(--ink); color: var(--bg); }
.limit-line { margin: 0 0 12px; }

.big-balance { display: flex; flex-direction: column; margin: 0 0 14px; }
.big-balance strong { font-size: 64px; font-weight: 900; line-height: 0.9; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.big-balance span { font-size: 14px; font-weight: 700; color: var(--muted); }
.big-balance.ok { color: var(--ok); }
.big-balance.zero { color: var(--zero); }
.big-balance.neg { color: var(--neg); }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.hist { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.hist td { padding: 6px 4px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.hist td:first-child { color: var(--muted); white-space: nowrap; width: 64px; }
.hist td:last-child { text-align: right; font-weight: 700; white-space: nowrap; padding-right: 0; }
.hist small { color: var(--muted); }
.hist .link.small { font-size: 13px; }
.hist .struck td:nth-child(2), .hist .struck td:last-child { text-decoration: line-through; color: var(--muted); }
.phones { margin: 0 0 12px; }
.action-links { font-size: 14px; color: var(--muted); line-height: 2; }

.cash { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.cash td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.cash td:nth-child(2) { color: var(--muted); }
.cash td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.cash tr.total td { border-bottom: 0; font-weight: 800; font-size: 17px; }
#hints .note { line-height: 2; }

/* ---------- participant card (P1–P4) ---------- */
.my-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 0 0 6px; }
.my-card.zero { border-color: var(--zero); background: var(--zero-bg); }
.my-card.neg { border-color: var(--neg); background: var(--neg-bg); }
.my-label { margin: 0; font-weight: 700; font-size: 15px; }
.my-text { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.my-bal { display: flex; align-items: center; gap: 6px; color: var(--ok); }
.my-bal strong { font-size: 44px; line-height: 0.9; font-weight: 900; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.my-bal span { font-size: 12px; font-weight: 700; line-height: 1.1; color: var(--muted); }
.my-card.zero .my-bal, .my-bal.big.zero { color: var(--zero); }
.my-card.neg .my-bal, .my-bal.big.neg { color: var(--neg); }
.my-bal.big { flex-direction: column; align-items: flex-start; gap: 2px; margin: 8px 0 12px; }
.my-bal.big strong { font-size: 64px; }
.my-bal.big span { font-size: 14px; }
.my-history { display: block; margin: 0 0 14px; }
.keybox { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 14px; }
.keybox .hint { margin: 0; }
.url { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: 14px; background: var(--chip); padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.warn { margin: 0 0 12px; font-size: 13px; color: var(--zero); background: var(--zero-bg); border-radius: 8px; padding: 8px 10px; }
.keybox .warn, .sheet .warn { margin: 0; }
.done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 18px; margin-top: 24px; }
.done-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: var(--card); display: grid; place-items: center; font-size: 28px; font-weight: 800; margin: 0; }
.done h2 { margin: 0; font-size: 22px; font-weight: 800; }
.done-who { margin: 0; font-weight: 700; }
.done .hint { margin: 0; }
.done .btn { align-self: stretch; margin-top: 8px; text-align: center; text-decoration: none; }
