/* Balance Sportparc – Studio-App
   Farben zentral hier anpassen, sobald das offizielle Branding vorliegt. */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #14231f;
  --muted: #5f6c67;
  --faint: #8a948f;
  --line: #e4e0d7;
  --brand: #1d4f45;
  --brand-2: #2a6a5d;
  --brand-soft: #e3eeea;
  --on-brand: #ffffff;
  --accent: #b0703c;          /* Reformer / Plus-Kurse */
  --accent-soft: #f6ebe1;
  --ok: #2c7a4b;
  --ok-soft: #e2f1e7;
  --warn: #9a6410;
  --warn-soft: #fbefd9;
  --danger: #b2393b;
  --danger-soft: #f8e3e2;
  --shadow: 0 1px 2px rgba(20, 35, 31, .06), 0 4px 16px rgba(20, 35, 31, .05);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1614; --surface: #17201d; --surface-2: #1b2522; --ink: #e8eeeb; --muted: #a2b0aa; --faint: #7b8a84;
    --line: #2a3632; --brand: #3d8f7d; --brand-2: #4fa290; --brand-soft: #1d302b; --on-brand: #06120f;
    --accent: #d39563; --accent-soft: #33261b; --ok: #5fbf85; --ok-soft: #183026; --warn: #e0a64a; --warn-soft: #33281a;
    --danger: #ec7a7b; --danger-soft: #3a1f20; --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand-2); }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.boot { display: grid; place-items: center; height: 100vh; letter-spacing: .4em; font-weight: 700; color: var(--brand); }

/* ---------- Layout ---------- */
.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
}
.wordmark { display: flex; flex-direction: column; line-height: 1; text-decoration: none; color: var(--ink); }
.wordmark b { letter-spacing: .32em; font-size: 17px; font-weight: 750; }
.wordmark span { letter-spacing: .38em; font-size: 9px; color: var(--muted); margin-top: 4px; }
.iconbtn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--ink);
}
.iconbtn svg { width: 20px; height: 20px; }
.badge-dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
main.page { padding: 4px 16px 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.page-head p { margin: 4px 0 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { display: flex; width: 100%; max-width: 560px; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px;
  text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 550;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--brand); }

/* Mitarbeiter: Seitenleiste auf großen Bildschirmen */
.staff .shell { max-width: none; }
.staff main.page { max-width: 1180px; }
@media (min-width: 900px) {
  .staff .shell { display: grid; grid-template-columns: 230px 1fr; padding-bottom: 0; }
  .staff .tabbar { position: sticky; top: 0; height: 100vh; border-top: 0; border-right: 1px solid var(--line); align-items: stretch; padding-top: 72px; }
  .staff .tabbar .inner { flex-direction: column; gap: 2px; padding: 0 12px; }
  .staff .tabbar a { flex: 0; flex-direction: row; gap: 12px; padding: 10px 12px; font-size: 14px; border-radius: 10px; color: var(--muted); }
  .staff .tabbar a.on { background: var(--brand-soft); color: var(--brand); }
  .staff .topbar { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .staff .content { grid-column: 2; grid-row: 2; min-width: 0; }
  .staff .tabbar { grid-row: 1 / span 2; grid-column: 1; }
  .staff .topbar { grid-column: 2; }
}

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 22px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 2px 10px; }
.section-title a { font-size: 14px; text-decoration: none; font-weight: 600; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; background: var(--brand); color: var(--on-brand);
  font-weight: 650; cursor: pointer; text-decoration: none; transition: transform .06s ease, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.link { background: none; color: var(--brand-2); padding: 0; min-height: 0; border: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.notice { padding: 12px 14px; border-radius: 12px; font-size: 14px; background: var(--brand-soft); color: var(--ink); }
.notice.warn { background: var(--warn-soft); }
.notice.danger { background: var(--danger-soft); }
.notice.accent { background: var(--accent-soft); }
.notice b { font-weight: 650; }

/* Formulare */
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 5px 2px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 13px; outline: none;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; cursor: pointer; padding: 0; border: 0; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- Login ---------- */
.auth { max-width: 420px; margin: 0 auto; padding: 48px 20px 32px; }
.auth .brand-big { text-align: center; margin-bottom: 30px; }
.auth .brand-big b { display: block; letter-spacing: .42em; font-size: 30px; font-weight: 750; color: var(--brand); padding-left: .42em; }
.auth .brand-big span { display: block; letter-spacing: .5em; font-size: 11px; color: var(--muted); margin-top: 8px; padding-left: .5em; }
.demo-list { display: grid; gap: 8px; }
.demo-list button { text-align: left; padding: 10px 12px; border-radius: 11px; border: 1px dashed var(--line); background: var(--surface); cursor: pointer; }
.demo-list button small { display: block; color: var(--muted); }

/* ---------- Start ---------- */
.hello h1 { font-size: 28px; }
.credit-card {
  position: relative; overflow: hidden; border-radius: 18px; padding: 18px; color: #fff;
  background: linear-gradient(135deg, #1d4f45 0%, #2a6a5d 55%, #b0703c 140%);
}
.credit-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; border: 22px solid rgba(255,255,255,.08); }
.credit-card .label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.credit-card .big { font-size: 44px; font-weight: 750; line-height: 1; margin: 10px 0 4px; }
.credit-card .meta { display: flex; gap: 16px; font-size: 13px; opacity: .92; flex-wrap: wrap; }
.credit-card .actions { display: flex; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.credit-card .btn { min-height: 38px; font-size: 14px; background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.25); }
.credit-card .btn.solid { background: #fff; color: var(--brand); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick a { display: flex; gap: 10px; align-items: center; padding: 14px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.quick a svg { width: 22px; height: 22px; color: var(--brand); flex: none; }

/* ---------- Kursliste ---------- */
.daystrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.daystrip::-webkit-scrollbar { display: none; }
.day {
  flex: none; width: 54px; padding: 8px 0; border-radius: 13px; border: 1px solid var(--line); background: var(--surface);
  text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.day small { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.day b { font-size: 18px; font-weight: 700; }
.day.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.day.on small { color: color-mix(in srgb, var(--on-brand) 80%, transparent); }
.day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 1px auto 0; visibility: hidden; }
.day .dot.show { visibility: visible; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 550; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.slot { display: flex; gap: 14px; padding: 14px; text-decoration: none; color: inherit; align-items: stretch; }
.slot + .slot { border-top: 1px solid var(--line); }
.slot .time { width: 50px; flex: none; }
.slot .time b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.slot .time small { color: var(--faint); font-size: 12px; }
.slot .bar { width: 4px; border-radius: 2px; flex: none; background: var(--brand); }
.slot .info { flex: 1; min-width: 0; }
.slot .info h3 { margin-bottom: 2px; }
.slot .info .muted { font-size: 13px; }
.slot .side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; text-align: right; }
.slot.cancelled .info h3 { text-decoration: line-through; color: var(--muted); }
.spots { font-size: 13px; font-weight: 650; color: var(--ok); }
.spots.few { color: var(--warn); }
.spots.none { color: var(--danger); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }

/* Kursdetail */
.hero { border-radius: 18px; padding: 20px; color: #fff; background: var(--brand); position: relative; overflow: hidden; }
.hero .kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.hero h1 { color: #fff; margin: 6px 0 10px; }
.hero .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 14px; }
.hero .facts div span { display: block; font-size: 11px; opacity: .75; text-transform: uppercase; letter-spacing: .08em; }
.capbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.capbar i { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--faint); }
.sticky-cta { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 12px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }

/* Listen */
.list > .item { padding: 14px 16px; display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.list > .item + .item { border-top: 1px solid var(--line); }
.list > a.item:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.notif.unread { background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); }
.notif .when { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Produkte */
.product { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.product .price { font-size: 26px; font-weight: 750; }
.product .per { font-size: 13px; color: var(--muted); }
.product.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.ribbon { align-self: flex-start; }

.pkg { padding: 14px 16px; }
.pkg + .pkg { border-top: 1px solid var(--line); }
.units { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.units i { width: 14px; height: 14px; border-radius: 4px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.units i.used { background: var(--line); border-color: var(--line); }
.units i.res { background: var(--accent); border-color: var(--accent); }

/* Tabellen (Admin) */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--brand-2); }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.tabs button { white-space: nowrap; flex: 1; border: 0; background: none; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Teilnehmerliste (Trainer, gut lesbar am Tablet) */
.roster .item { font-size: 17px; }
.roster .num-big { font-size: 34px; font-weight: 750; }

/* Toast & Modal */
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 550; transition: all .2s; max-width: calc(100% - 32px); z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); color: #fff; }
.modal-back { position: fixed; inset: 0; background: rgba(10, 18, 16, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--surface); width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; animation: up .18s ease-out; }
@media (min-width: 640px) { .modal-back { align-items: center; } .modal { border-radius: 20px; } }
.modal h2 { margin-bottom: 10px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }

#testbar { background: #241f12; color: #f3d9a4; font-size: 12px; padding: 6px 14px; display: flex; justify-content: center; gap: 12px; align-items: center; flex-wrap: wrap; }
#testbar b { color: #fff; }
#testbar button { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none; } }
@media (max-width: 899px) {
  .staff .tabbar .inner { overflow-x: auto; scrollbar-width: none; }
  .staff .tabbar .inner::-webkit-scrollbar { display: none; }
  .staff .tabbar a { flex: 1 0 64px; }
}
