:root {
  --green: #1f6f43;
  --green-dark: #155834;
  --ball: #d6e64b;
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #1c2620;
  --muted: #6b7d72;
  --line: #e4e9e5;
  --danger: #b23b3b;
  --ok: #1f6f43;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 40, 30, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #35a065;
    --green-dark: #2b8553;
    --bg: #121814;
    --card: #1a221d;
    --text: #e8efe9;
    --muted: #93a89a;
    --line: #2a352e;
    --danger: #e0736f;
    --ok: #4cc98a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 0 0 12px; }
small { color: var(--muted); font-size: 13px; display: block; }
a { color: var(--green); }

/* ------------------------------------------------------------ Buttons */
button {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 11px 16px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: background .15s, opacity .15s;
}
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--green); color: #fff; }
.primary:not(:disabled):active { background: var(--green-dark); }
.ghost { border-color: var(--line); background: var(--card); color: var(--text); }
.ghost.danger { color: var(--danger); }
.small { padding: 7px 11px; font-size: 14px; border-radius: 9px; }
.block { display: block; width: 100%; }
.muted { color: var(--muted); font-weight: 400; }

input, select {
  font: inherit;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
}
input[type=checkbox] { width: auto; accent-color: var(--green); transform: scale(1.25); }
label { font-size: 14px; color: var(--muted); }
label input, label select { margin-top: 4px; color: var(--text); }

/* ------------------------------------------------------------ Login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 32px 24px; width: 100%; max-width: 380px; text-align: center;
}
.login-card .logo { font-size: 44px; }
.login-card h1 { font-size: 22px; margin: 8px 0 2px; }
.login-card .sub { color: var(--muted); margin: 0 0 20px; }
.login-card form { display: grid; gap: 10px; }
.hint { font-size: 14px; color: var(--muted); text-align: left; }
.hint.small { font-size: 12.5px; }
.switch { font-size: 14px; margin-top: 18px; }
.notice { font-size: 14px; padding: 11px 13px; border-radius: 10px; margin-top: 16px; text-align: left; }
.notice.ok { background: rgba(31, 111, 67, .1); color: var(--ok); }
.notice.error { background: rgba(178, 59, 59, .12); color: var(--danger); }
.notice.info { background: rgba(120, 130, 140, .12); }

/* ------------------------------------------------------------ Layout */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--green); color: #fff;
}
.topbar .title { display: flex; align-items: center; gap: 10px; }
.topbar .ball { font-size: 22px; }
.topbar strong { display: block; font-size: 16px; }
.topbar small { color: rgba(255, 255, 255, .8); }
.topbar .ghost { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .25); color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar .icon { position: relative; padding: 7px 11px; font-size: 17px; line-height: 1; }
.topbar .icon.spinning span { display: inline-block; animation: spin .6s linear; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Kleiner Punkt am Neu-laden-Knopf: grün = Änderungen kommen von selbst an */
.live-dot {
  position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, .35);
}
.live-dot.on { background: var(--ball); box-shadow: 0 0 0 2px rgba(31, 111, 67, .55); }

main { padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }

.segmented {
  display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; margin-bottom: 16px; overflow-x: auto;
}
.segmented button { flex: 1; padding: 9px 6px; font-size: 13px; border-radius: 9px; white-space: nowrap; color: var(--muted); }
.segmented button.active { background: var(--green); color: #fff; }
.segmented .dot { margin-left: 5px; }

.dot {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--ball); color: #1c2620; font-size: 11px; font-weight: 700; font-style: normal;
}

.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.install-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--ball); border-left: 4px solid var(--ball);
  border-radius: var(--radius); padding: 13px 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.install-text { flex: 1 1 200px; }
.install-text strong { display: block; font-size: 15px; }
.install-text small { font-size: 12.5px; line-height: 1.4; }
.install-actions { display: flex; gap: 6px; margin-left: auto; }
.ios-icon { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }

/* ------------------------------------------------------------ Termine */
.session {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.session.mine { border-color: var(--green); }
.session.cancelled, .session.past { opacity: .6; }
.session-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.session .date { font-weight: 700; font-size: 16px; }
.session .time { color: var(--muted); font-size: 14px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.badge.free { background: rgba(214, 230, 75, .35); color: #5c6b12; }
.badge.full { background: rgba(31, 111, 67, .13); color: var(--ok); }
.badge.mine { background: var(--green); color: #fff; }
.badge.off { background: rgba(120, 130, 140, .18); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .badge.free { background: rgba(214, 230, 75, .18); color: var(--ball); }
}

/* Eine Stunde innerhalb eines Spieltags */
.hour {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.hour:first-of-type { margin-top: 10px; }
.hour.cancelled { opacity: .5; }
.hour-time { grid-column: 1; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.hour .slots { grid-column: 1; margin: 0; }
.hour-action { grid-column: 2; grid-row: 1 / span 2; }

.declined { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tag.decline {
  background: rgba(178, 59, 59, .12); color: var(--danger); font-weight: 600;
  padding: 4px 10px; border-radius: 20px; font-size: 12.5px;
}
.badge.declined { background: rgba(178, 59, 59, .14); color: var(--danger); }

.admin-day { padding: 10px 0; border-top: 1px solid var(--line); }
.admin-day:first-of-type { border-top: none; padding-top: 0; }
.admin-day h4 { margin: 0 0 4px; font-size: 15px; }
.admin-day h4 .muted { font-weight: 400; font-size: 13px; }

.danger-zone { border-color: rgba(178, 59, 59, .35); }
.danger-zone h3 { color: var(--danger); }
.billing tr.me { font-weight: 600; }
.billing tr.me td:first-child::after { content: ' (du)'; font-weight: 400; color: var(--muted); }

.slots { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.slot { font-size: 13.5px; padding: 5px 11px; border-radius: 20px; background: rgba(120, 130, 140, .12); }
.slot.me { background: var(--green); color: #fff; }
.slot.free { border: 1px dashed var(--line); background: transparent; color: var(--muted); }
.slot .x { padding: 0 0 0 6px; color: var(--muted); font-size: 15px; line-height: 1; }

.session .note { font-size: 13.5px; color: var(--muted); margin: 8px 0 0; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.actions .primary, .actions .ghost { flex: 0 0 auto; }

/* ------------------------------------------------------------ Konto */
.balance {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  padding: 20px; text-align: center; box-shadow: var(--shadow);
}
.balance small { font-size: 13px; }
.balance strong { display: block; font-size: 34px; letter-spacing: -.5px; margin: 2px 0 4px; }
.balance span { font-size: 13px; color: var(--muted); }
.balance.positive strong { color: var(--ok); }
.balance.negative strong { color: var(--danger); }

.stat-row { display: flex; gap: 10px; margin-top: 12px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 8px; text-align: center;
}
.stat strong { display: block; font-size: 17px; }
.stat small { font-size: 12px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
}
.list .right { text-align: right; }

/* ------------------------------------------------------------ Karten/Formulare */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card.highlight { border-color: var(--ball); background: linear-gradient(0deg, var(--card), var(--card)); }
.form-grid { display: grid; gap: 10px; margin-bottom: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 14.5px; }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.row:first-of-type { border-top: none; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.row .right { display: flex; gap: 6px; align-items: center; }
.cap { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cap input { width: 64px; }

.series + .series { border-top: 1px solid var(--line); }
.edit-series {
  background: rgba(120, 130, 140, .06); border-radius: 12px; padding: 12px; margin: 4px 0 12px;
}
@media (prefers-color-scheme: dark) { .edit-series { background: rgba(255, 255, 255, .04); } }

.person { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.person:first-of-type { border-top: none; }
.person-main strong { display: block; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.tags { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: rgba(120, 130, 140, .15); color: var(--muted); }
.tag.admin { background: var(--green); color: #fff; }
.tag.off { background: rgba(178, 59, 59, .15); color: var(--danger); }

.admin-session { padding: 12px 0; border-top: 1px solid var(--line); }
.admin-session:first-of-type { border-top: none; }
.admin-session.cancelled { opacity: .55; }
.admin-session-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.admin-session-head span { font-size: 14px; color: var(--muted); }
.admin-session select { width: auto; min-width: 150px; }

.billing { width: 100%; border-collapse: collapse; font-size: 14px; }
.billing th, .billing td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.billing th:first-child, .billing td:first-child { text-align: left; }
.billing th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.billing tfoot td { font-weight: 700; border-bottom: none; }
.billing small { display: inline; }
.billing .neg { color: var(--danger); font-weight: 600; }
.billing .pos { color: var(--ok); font-weight: 600; }

/* ------------------------------------------------------------ Tabbar & Toast */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 0; position: relative;
}
.tabbar button span { font-size: 19px; line-height: 1; }
.tabbar button.active { color: var(--green); }
.tabbar .dot { position: absolute; top: 4px; right: 22%; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom));
  background: #22302a; color: #fff; padding: 11px 18px; border-radius: 24px;
  font-size: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); z-index: 50; max-width: 90vw; text-align: center;
}
.toast.error { background: var(--danger); }
