:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --text: var(--tg-theme-text-color, #16181d);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2a7ae2);
  --accent: var(--tg-theme-button-color, #2a7ae2);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --sep: color-mix(in srgb, var(--hint) 25%, transparent);
  --on: #2fb36d;
  --warn: #e0912f;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #17191d; --bg2: #22252b; --text: #eceef2; --hint: #8d939e; --link: #5aa2ff;
    --accent: #3d8bfd; --accent-text: #fff;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg2); color: var(--text); }
body { font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding-bottom: 72px; }

.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg); }
.title { flex: 1; min-width: 0; }
.club { font-weight: 600; font-size: 17px; }
.summary { color: var(--hint); font-size: 13px; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--sep); border-radius: 15px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 26px; height: 26px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--on); }
.switch input:checked + span::before { transform: translateX(20px); }

.tabs { position: sticky; top: 0; z-index: 2; display: flex; background: var(--bg); border-bottom: 1px solid var(--sep); }
.tabs button { flex: 1; padding: 10px 4px; border: 0; background: none; color: var(--hint); font: inherit;
  font-size: 14px; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.banner { margin: 10px 16px 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 18%, var(--bg)); }
.banner.error { background: color-mix(in srgb, #e5484d 18%, var(--bg)); }

main { padding: 8px 0; }
.tab { display: none; }
.tab.active { display: block; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px 16px 8px; }
.hint, .note { color: var(--hint); font-size: 12.5px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

.day { padding: 14px 16px 6px; color: var(--hint); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.list { background: var(--bg); }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--sep);
  cursor: pointer; -webkit-tap-highlight-color: transparent; }
.item:last-child { border-bottom: 0; }
.item .time { width: 48px; flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 500; overflow-wrap: anywhere; }
.item .sub { color: var(--hint); font-size: 13px; }
.item .bell { flex: none; font-size: 20px; opacity: .25; }
.item.on .bell { opacity: 1; }
.item.on { background: color-mix(in srgb, var(--on) 9%, var(--bg)); }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: 11px;
  color: var(--accent); border: 1px solid currentColor; vertical-align: 1px; }
.full { color: #e5484d; }

.search { display: block; width: calc(100% - 32px); margin: 4px 16px 10px; padding: 9px 12px; border: 0;
  border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; background: var(--bg2);
  display: grid; place-items: center; color: var(--hint); font-weight: 600; }
.check { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--sep);
  display: grid; place-items: center; color: transparent; font-size: 14px; }
.item.sel .check { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.empty { padding: 24px 16px; color: var(--hint); text-align: center; }

.card { margin: 10px 16px; padding: 12px 14px; background: var(--bg); border-radius: 12px; }
.card.muted { color: var(--hint); font-size: 13px; }
.card-title { font-weight: 600; margin-bottom: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.radio input { margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chips button { min-width: 42px; padding: 6px 10px; border-radius: 16px; border: 1px solid var(--sep);
  background: none; color: var(--text); font: inherit; cursor: pointer; }
.chips button.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
input[type=time], select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--sep);
  background: var(--bg2); color: var(--text); font: inherit; }
button.secondary { margin-top: 8px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--sep);
  background: none; color: var(--link); font: inherit; cursor: pointer; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--sep); }
.savebar button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--accent);
  color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
