/* VereinsKasse – ein Stylesheet, Systemschriften, keine externen Ressourcen. */

:root {
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-soft: #eff6ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --page: #f8fafc;
  --good: #15803d;
  --good-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 1px 3px rgb(15 23 42 / 10%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--brand); }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* --- Kopfzeile ------------------------------------------------------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 0.6rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.brand img { height: 36px; width: auto; display: block; }
.brand-club { font-size: 0.8rem; font-weight: 600; color: var(--brand-dark); max-width: 14rem; }
.club-logo { height: 36px; max-width: 90px; object-fit: contain; border-radius: 6px; }

/* Die Navigation steht in einer eigenen Zeile: Sieben Einträge plus Vereinsname und Benutzer
   passen auf üblichen Bildschirmen nicht nebeneinander und brächen sonst mitten im Menü um. */
.nav { display: flex; gap: 0.15rem; flex-wrap: wrap; order: 3; flex-basis: 100%; }
.nav a {
  padding: 0.45rem 0.7rem; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-weight: 500; font-size: 0.93rem;
}
.nav a:hover { background: var(--page); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }

.topbar-tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-left: auto; }
.topbar-tools form { display: flex; gap: 0.25rem; margin: 0; }
/* Die gewählte Sprache ist hervorgehoben, nicht ausgegraut. */
.topbar-tools button[aria-pressed="true"] {
  background: var(--brand-soft); color: var(--brand); border-color: transparent; opacity: 1; cursor: default;
}
.user-name { font-size: 0.85rem; color: var(--muted); }

.page { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-head p { color: var(--muted); margin: 0.25rem 0 0; }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1.5rem; }
.footer a, .auth-legal a { color: inherit; }
.auth-legal { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 1rem; }

/* --- Bausteine ------------------------------------------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem;
}
.card-head p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.grid > .card { margin-bottom: 0; }
.stack { margin-bottom: 1.25rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }

.stat-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 0.82rem; color: var(--muted); }
.positive { color: var(--good); }
.negative { color: var(--bad); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.badge {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: var(--page); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.badge-good { background: var(--good-soft); color: var(--good); border-color: #bbf7d0; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: #bfdbfe; }

.alert {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px;
  padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; background: var(--surface);
}
.alert-danger { border-color: #fecaca; border-left-color: var(--bad); background: var(--bad-soft); }
.alert-warning { border-color: #fde68a; border-left-color: var(--warn); background: var(--warn-soft); }
.alert-info { border-color: #bfdbfe; border-left-color: var(--brand); background: var(--brand-soft); }
.alert-success { border-color: #bbf7d0; border-left-color: var(--good); background: var(--good-soft); }

/* Ampel: Die Aussage steht im Text, die Farbe unterstützt nur. */
.status {
  display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
}
.status h2 { font-size: 1.2rem; }
.status p { margin: 0.2rem 0 0; }
.status-light { width: 1.6rem; height: 1.6rem; border-radius: 50%; flex: none; background: var(--muted); }
.status-green { background: var(--good-soft); border-color: #bbf7d0; }
.status-green .status-light { background: var(--good); }
.status-yellow { background: var(--warn-soft); border-color: #fde68a; }
.status-yellow .status-light { background: #f59e0b; }
.status-red { background: var(--bad-soft); border-color: #fecaca; }
.status-red .status-light { background: var(--bad); }

.steps { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.35rem; }
.steps .done { color: var(--muted); }
.steps a { font-weight: 600; }
.year-input { font-weight: 600; }
.review-table input[type="text"], .review-table select { min-width: 8rem; padding: 0.35rem 0.45rem; }
.review-table input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.review-table tr.off td { color: var(--muted); }

/* --- Formulare ------------------------------------------------------------------------------ */

button, input, select, textarea { font: inherit; color: inherit; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--page); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-link { border: 0; background: none; color: var(--brand); padding: 0; cursor: pointer; font-weight: 600; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button {
  border: 0; background: var(--surface); padding: 0.35rem 0.75rem; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; color: var(--muted);
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 0.6rem 0.9rem; cursor: pointer; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

label { font-size: 0.85rem; font-weight: 600; display: block; margin-bottom: 0.25rem; }
input[type="text"], input[type="number"], input[type="password"], input[type="file"], select, textarea {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid #cbd5e1; border-radius: 8px;
  background: var(--surface);
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
input:disabled, select:disabled, textarea:disabled { background: var(--page); color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
.field { margin-bottom: 0.9rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }
.fields { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.inline-select { width: auto; padding: 0.35rem 0.5rem; }
input[type="text"].inline-input { width: 16rem; max-width: 100%; padding: 0.3rem 0.5rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.check input { width: auto; }

/* --- Tabellen ------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem; }

.entry-grid th:first-child, .entry-grid td:first-child {
  position: sticky; left: 0; background: var(--surface); min-width: 13rem; z-index: 1;
}
.entry-grid td { padding: 0.25rem 0.3rem; }
.entry-grid td:first-child { padding-left: 0.6rem; font-weight: 500; }
.entry-grid input {
  min-width: 5.2rem; padding: 0.35rem 0.4rem; text-align: right; font-variant-numeric: tabular-nums;
}
.entry-grid tr.computed td { background: var(--brand-soft); }
.entry-grid tr.computed td:first-child { background: var(--brand-soft); font-style: italic; }
.entry-grid.single-month input { max-width: 12rem; }

.chart-box { position: relative; height: 300px; }
.chart-box-tall { height: 360px; }

/* --- Dialoge und Meldungen ------------------------------------------------------------------ */

dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(34rem, calc(100vw - 2rem));
  box-shadow: 0 20px 50px rgb(15 23 42 / 30%);
}
dialog::backdrop { background: rgb(15 23 42 / 45%); }
.dialog-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.dialog-body { padding: 1.1rem 1.25rem 0.25rem; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.9rem 1.25rem 1.1rem; }
.dialog-close { border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); }

.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50; display: grid; gap: 0.5rem; }
.toast {
  padding: 0.7rem 1rem; border-radius: 8px; color: #fff; background: var(--good);
  box-shadow: var(--shadow); max-width: 26rem; font-weight: 500;
}
.toast-error { background: var(--bad); }

.scenario { border-top: 4px solid var(--brand); }
.scenario.risk { border-top-color: var(--bad); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Vorhaben */
.project { border-top: 4px solid var(--brand); }
.project-idea { border-top-color: #cbd5e1; }
.kv-total { border-top: 1px solid var(--line); padding-top: 0.35rem; margin-top: 0.2rem; }
.kv dt.kv-total { color: var(--ink); font-weight: 600; }
.note-line { margin: 0.5rem 0 0; }
.note-row { gap: 0.4rem; }
.section-title { margin: 0.25rem 0 0.5rem; }
.status-compact { padding: 0.7rem 0.9rem; margin: 0.5rem 0 0.75rem; }
.status-compact p { margin: 0; }
tr.cancelled td { color: var(--muted); }
tr.cancelled td:first-child { text-decoration: line-through; }

/* --- Anmeldung ------------------------------------------------------------------------------ */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(26rem, 100%); }
.auth-card img { height: 56px; display: block; margin: 0 auto 1.25rem; }
.auth-card h1 { font-size: 1.25rem; margin-bottom: 0.4rem; text-align: center; }
.auth-card .btn { width: 100%; justify-content: center; }
.auth-lang { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1rem; }

@media print {
  .topbar, .footer, .btn, .tabs, .toasts { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
