/* Vereins-App – ein Stylesheet für alle Seiten. Farben wie in den Entwürfen,
   mit dunkler Variante (automatisch nach Gerät oder per Profil umschaltbar). */
:root {
  --ground: #F3F6F7;
  --surface: #FFFFFF;
  --surface-hover: #F8FAFB;
  --ink: #0F2533;
  --muted: #50636F;
  --line: #DCE3E7;
  --line-soft: #EAEFF1;
  --input-line: #C9D3D9;
  --accent: #0A6B8F;
  --accent-ink: #08506B;
  --accent-soft: #E3F1F6;
  --on-accent: #FFFFFF;
  --warn-ink: #8A3F06;
  --warn-soft: #FDF0E1;
  --notice-ink: #5A2A04;
  --warm: #F6C892;
  --warm-ink: #0F2533;
  --ok-ink: #1C5E3E;
  --ok-soft: #E4F2EA;
  --danger: #A3261B;
  --danger-soft: #FBE9E7;
  --danger-line: #E3B4AE;
  --hero-bg: #0F2533;
  --hero-ink: #FFFFFF;
  --hero-muted: #C9D9E1;
  --bar-exp: #A9CFDF;
  --meter-warn: #C2610C;
  --focus: #7AC4E0;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0E1A22;
    --surface: #15242E;
    --surface-hover: #1B2E3A;
    --ink: #E6EEF2;
    --muted: #9DB0BB;
    --line: #26404F;
    --line-soft: #1F3442;
    --input-line: #3A5868;
    --accent: #5BB8DC;
    --accent-ink: #8ACFEA;
    --accent-soft: #123A4C;
    --on-accent: #04202C;
    --warn-ink: #F2B880;
    --warn-soft: #3A2614;
    --notice-ink: #F6D7B6;
    --warm: #E9B677;
    --warm-ink: #1B1208;
    --ok-ink: #8FD4AE;
    --ok-soft: #143426;
    --danger: #F2958A;
    --danger-soft: #3A1A17;
    --danger-line: #6E3029;
    --hero-bg: #0B3448;
    --hero-ink: #FFFFFF;
    --hero-muted: #B4D0DD;
    --bar-exp: #2E6278;
    --meter-warn: #E39046;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0E1A22;
  --surface: #15242E;
  --surface-hover: #1B2E3A;
  --ink: #E6EEF2;
  --muted: #9DB0BB;
  --line: #26404F;
  --line-soft: #1F3442;
  --input-line: #3A5868;
  --accent: #5BB8DC;
  --accent-ink: #8ACFEA;
  --accent-soft: #123A4C;
  --on-accent: #04202C;
  --warn-ink: #F2B880;
  --warn-soft: #3A2614;
  --notice-ink: #F6D7B6;
  --warm: #E9B677;
  --warm-ink: #1B1208;
  --ok-ink: #8FD4AE;
  --ok-soft: #143426;
  --danger: #F2958A;
  --danger-soft: #3A1A17;
  --danger-line: #6E3029;
  --hero-bg: #0B3448;
  --hero-ink: #FFFFFF;
  --hero-muted: #B4D0DD;
  --bar-exp: #2E6278;
  --meter-warn: #E39046;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.plain { padding-bottom: 24px; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 800; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.center { text-align: center; display: block; }
.empty { color: var(--muted); padding: 8px 2px; }
.warn-text { color: var(--warn-ink); font-weight: 700; }

/* Kopf */
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(20px + env(safe-area-inset-top)) 20px 12px;
  max-width: 640px;
  margin: 0 auto;
}
.top-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.eyebrow.light { color: var(--hero-muted); font-weight: 700; }
.back {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
}

/* Inhalt */
.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wrap.wide { max-width: 900px; }
.wrap.narrow { max-width: 440px; padding-top: calc(32px + env(safe-area-inset-top)); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-bottom: 4px; }
.brand img { border-radius: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
a.card { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
.card.hero { background: var(--hero-bg); color: var(--hero-ink); border-color: var(--hero-bg); display: flex; flex-direction: column; gap: 10px; }
.card.hero span { color: var(--hero-muted); font-size: 14px; }
.card.hero .badge.warm { color: var(--warm-ink); }
.card.notice, .notice { background: var(--warn-soft); border: 0; color: var(--notice-ink); border-radius: var(--radius); padding: 14px 16px; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice.small, p.notice { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card.split > div { display: flex; flex-direction: column; gap: 2px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.baseline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.big.dark { color: var(--ink); }
h2.section { font-size: 15px; }
.flash { background: var(--accent-soft); color: var(--accent-ink); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 600; }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tiles.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.tile span { font-size: 12px; font-weight: 600; color: var(--muted); }
.tile strong { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.tile small { color: var(--muted); font-size: 12px; }
.tile.dark { background: var(--hero-bg); border-color: var(--hero-bg); color: var(--hero-ink); }
.tile.dark span, .tile.dark small { color: var(--hero-muted); }

/* Listen */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none;
  min-height: 56px;
}
.list > :last-child, .list > :last-child .row { border-bottom: 0; }
a.row:hover { background: var(--surface-hover); }
.row.inactive { opacity: 0.6; }
.row-day { width: 34px; flex: none; font-size: 13px; font-weight: 800; color: var(--muted); display: flex; flex-direction: column; line-height: 1.2; }
.row-day small { font-weight: 600; font-size: 11px; }
.row-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row-main small { color: var(--muted); }
.row-actions { display: flex; gap: 10px; align-items: center; }
details.row-details { border-bottom: 1px solid var(--line-soft); }
details.row-details summary { list-style: none; cursor: pointer; border-bottom: 0; }
details.row-details summary::-webkit-details-marker { display: none; }
details.row-details[open] summary { background: var(--surface-hover); }
.pager { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }

table.mini, table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mini { margin: 0 14px 12px; width: calc(100% - 28px); }
table.mini th, table.log th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 4px; }
table.mini td, table.log td { padding: 6px 4px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.log { background: var(--surface); border-radius: 12px; display: block; overflow-x: auto; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 700; }
ul.plain { margin: 0; padding-left: 18px; }
ul.todo { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
ol.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
code.secret { display: inline-block; background: var(--ground); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 17px; letter-spacing: 0.04em; word-break: break-all; }
p.secret { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 18px; letter-spacing: 0.06em; background: var(--ground); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
p.secret span { white-space: nowrap; }
.qr-wrap { display: flex; justify-content: center; margin: 10px 0; }
.qr-wrap svg { width: 220px; height: 220px; border-radius: 8px; background: #fff; }
details.manual-key { margin-top: 6px; }
.push-msg:empty { display: none; }
.push-msg { border-radius: 10px; padding: 10px 12px; background: var(--accent-soft); color: var(--accent-ink); }
.push-msg[data-kind="warn"] { background: var(--warn-soft); color: var(--notice-ink); }
.push-msg[data-kind="error"] { background: var(--danger-soft); color: var(--danger); }
.push-msg[data-kind="ok"] { background: var(--ok-soft); color: var(--ok-ink); }
input[type="radio"] { width: 20px; height: 20px; min-height: 0; }
[hidden] { display: none !important; }

/* Status-Markierungen */
.badge {
  display: inline-block; flex: none;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: var(--line-soft); color: var(--muted);
  white-space: nowrap;
}
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.warm { background: var(--warm); color: var(--warm-ink); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; min-width: 0; }
.field small { font-weight: 500; color: var(--muted); }
input, select, textarea {
  font: inherit; font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--input-line);
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 14px;
  width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
input.code { font-size: 24px; letter-spacing: 0.3em; text-align: center; font-weight: 700; }
fieldset.checks { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; }
fieldset.checks legend { font-size: 14px; font-weight: 700; padding: 0 4px; }
fieldset.checks label, label.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; }
form.inline { display: contents; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border-radius: 12px;
  border: 0;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 700; font-size: 15px;
  text-decoration: none; cursor: pointer;
  width: 100%;
  text-align: center;
}
.btn:hover { background: var(--accent-ink); color: var(--on-accent); }
.btn.primary { background: var(--accent); }
.btn.big { min-height: 56px; font-size: 17px; font-weight: 800; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--input-line); }
.btn.secondary:hover { background: var(--surface-hover); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger-line); }
.btn.link { background: none; color: var(--accent); min-height: 44px; padding: 0 4px; width: auto; font-weight: 600; font-size: 14px; }
.btn.small { min-height: 36px; width: auto; padding: 0 12px; font-size: 14px; }
.grid-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.stepper { display: flex; align-items: flex-end; gap: 12px; }
.stepper .field { flex: 1; }
.stepper input { text-align: center; font-size: 22px; font-weight: 800; }
.round {
  flex: none; width: 48px; height: 48px; border-radius: 24px;
  border: 1px solid var(--input-line); background: var(--surface); color: var(--ink);
  font-size: 24px; font-weight: 700; cursor: pointer;
}

/* Diagramm & Balken */
.chart { width: 100%; height: auto; }
.bar-act { fill: var(--accent); }
.bar-exp { fill: var(--bar-exp); }
.bar-label { fill: var(--muted); font-size: 10px; font-weight: 700; font-family: var(--font); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.lg-act { background: var(--accent); }
.lg-exp { background: var(--bar-exp); }
.meter { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line-soft); border-radius: 5px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
progress.warn::-webkit-progress-value { background: var(--meter-warn); }
progress.warn::-moz-progress-bar { background: var(--meter-warn); }

/* Navigation unten */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; min-height: 52px;
  text-decoration: none; color: var(--muted);
  font-size: 12px; font-weight: 600;
}
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 800; }

details > summary { cursor: pointer; font-weight: 700; color: var(--accent); min-height: 44px; display: flex; align-items: center; }

@media (min-width: 700px) {
  .tabs { left: 50%; transform: translateX(-50%); max-width: 640px; border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
}
@media (max-width: 360px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
}

/* Hinweis im Testbetrieb */
.testbanner { margin: 0; background: var(--warn-soft); color: var(--notice-ink); text-align: center; font-size: 13px; font-weight: 700; padding: 6px 12px; }
.row-link { padding: 0 14px 12px; font-size: 14px; font-weight: 600; }
ol.codes { margin: 0; padding-left: 26px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 17px; }
ol.codes code { letter-spacing: 0.04em; }

/* Yolawo-Zuordnung */
.yolawo-item { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.yolawo-item:last-child { border-bottom: 0; padding-bottom: 0; }
.yolawo-item .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
textarea { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.trainer-picks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.yolawo-linked .details-body { padding: 12px 4px 16px; }
.push-time { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.push-time select:first-child { grid-column: 1 / -1; }

/* Umschalter Woche/Monat */
.segmented { display: inline-flex; width: fit-content; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface); }
.segmented a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.segmented a[aria-current="page"] { background: var(--accent); color: var(--on-accent, #fff); }

/* Dateiablage */
.crumbs { font-size: 0.95rem; color: var(--muted); overflow-wrap: anywhere; }
.crumbs a { font-weight: 600; }
.file-row { display: flex; align-items: center; gap: 8px; }
.file-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.file-link .row-main { min-width: 0; }
.file-link strong { overflow-wrap: anywhere; }
.file-icon { width: 2rem; display: flex; justify-content: center; color: var(--accent); flex: none; }
input[type="file"] { width: 100%; padding: 12px; border: 1px dashed var(--input-line); border-radius: 12px; background: var(--surface); color: var(--ink); }

.file-row form.inline .btn.link { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.pick { position: relative; display: block; }
.pick .btn { width: 100%; }
.pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; padding: 0; border: 0; }
.upload-progress progress { width: 100%; height: 10px; accent-color: var(--accent); }
.upload-errors { color: var(--danger, #b42318); padding-left: 18px; margin: 0; }
.upload-errors:empty { display: none; }
