:root {
  color-scheme: light;
  --club-red: #d3001b;
  --club-red-dark: #a10015;
  --club-red-soft: #fdeceecc;
  --ink: #1b2127;
  --muted: #6b7681;
  --faint: #96a0a9;
  --line: #e7ebef;
  --line-strong: #d7dde3;
  --paper: #ffffff;
  --surface: #f4f6f8;
  --surface-2: #eef1f4;
  --warn: #9a5b00;
  --warn-bg: #fff6e2;
  --danger: #c1121f;
  --ok: #1c7c3c;
  --ok-bg: #e9f7ee;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 40, 0.05), 0 1px 3px rgba(20, 30, 40, 0.04);
  --shadow-md: 0 2px 8px rgba(20, 30, 40, 0.06), 0 8px 24px rgba(20, 30, 40, 0.05);
  --shadow-lg: 0 18px 48px rgba(20, 30, 40, 0.18);
  --ring: 0 0 0 3px rgba(211, 0, 27, 0.16);
  --info: #1f6feb;
  --info-bg: #eaf2ff;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ---------- Buttons ---------- */
button {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

button:hover {
  border-color: var(--faint);
  background: #fbfcfd;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.primary {
  background: var(--club-red);
  border-color: var(--club-red);
  color: #fff;
  box-shadow: 0 1px 2px rgba(211, 0, 27, 0.25);
}

.primary:hover {
  background: var(--club-red-dark);
  border-color: var(--club-red-dark);
}

.danger {
  color: var(--danger);
  border-color: #eccdd0;
  background: #fdf6f6;
}

.danger:hover {
  background: #fbeced;
  border-color: #e3b6ba;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:disabled:hover {
  background: var(--paper);
  border-color: var(--line-strong);
}

.document-error {
  color: var(--danger);
  font-weight: 700;
}

/* ---------- Inputs ---------- */
input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--club-red);
  box-shadow: var(--ring);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

label input,
label textarea,
label select {
  color: var(--ink);
  font-weight: 400;
}

/* ---------- Topbar ---------- */
.topbar {
  min-height: 72px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: linear-gradient(118deg, #d3001b 0%, #ba0018 48%, #8d0015 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 4px 18px rgba(120, 0, 18, 0.24);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* feiner Glanz über der Kopfzeile */
.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 180% at 12% -40%, rgba(255, 255, 255, 0.18), transparent 60%);
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.05;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.topbar-logo {
  height: 48px;
  width: auto;
  background: #fff;
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.login-logo {
  display: block;
  height: 76px;
  margin: 0 auto 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions #currentUser {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  margin-right: 2px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* kleiner Punkt als Benutzer-Marker */
.topbar-actions #currentUser::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ee2a8;
  box-shadow: 0 0 0 2px rgba(126, 226, 168, 0.28);
}

/* Nebensächliche Aktionen (Passwort, Abmelden) treten zurück */
.topbar-actions button {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 13.5px;
  padding: 8px 13px;
  backdrop-filter: blur(2px);
}

.topbar-actions button:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
}

.topbar-actions .primary {
  background: #fff;
  color: var(--club-red);
  border-color: #fff;
}

.topbar-actions .primary:hover {
  background: #fff0f2;
  color: var(--club-red-dark);
}

.eyebrow {
  margin: 0;
  color: #ffd2d8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 470px;
  gap: 20px;
  padding: 22px clamp(12px, 3vw, 36px) 40px;
  max-width: 1500px;
  margin: 0 auto;
}

.workspace,
.detail {
  min-width: 0;
}

/* Bereiche ohne Sponsor-Detailspalte nutzen die volle Breite */
.layout-wide {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- Stat-Karten ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 15px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.stat:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* zarter Farbschleier oben statt harter Balken links */
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--club-red), rgba(211, 0, 27, 0.25));
}

.stat strong {
  display: block;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

.stat-open::before {
  background: linear-gradient(90deg, #e0a100, rgba(224, 161, 0, 0.25));
}

.stat-open strong {
  color: var(--warn);
}

.stat-paid::before {
  background: linear-gradient(90deg, var(--ok), rgba(28, 124, 60, 0.25));
}

.stat-paid strong {
  color: var(--ok);
}

/* ---------- Panels / Toolbars ---------- */
.toolbar {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  align-items: end;
}

/* Suchfeld nimmt den freien Platz, Knöpfe behalten ihre natürliche Breite */
.toolbar > input[type="search"] {
  flex: 1 1 240px;
  min-width: 180px;
}

.toolbar > label {
  flex: 0 0 auto;
  min-width: 130px;
}

.toolbar > select {
  flex: 0 0 auto;
  width: auto;
  min-width: 150px;
}

.toolbar > button {
  flex: 0 0 auto;
}

/* Rückmeldungen bekommen eine eigene Zeile, damit sie nichts auseinanderziehen */
.toolbar > .batch-result {
  flex: 1 1 100%;
}

.billing-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* Der gewählte Anlass steht als eigene Zeile über den Einstellungen */
.billing-panel > label {
  flex: 0 0 auto;
  min-width: 110px;
}

.billing-panel > label input {
  max-width: 130px;
}

.billing-panel .billing-actions {
  flex: 1 1 auto;
}

.billing-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.billing-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-right: auto;
}

.batch-result {
  flex: 1 1 100%;
  color: var(--club-red-dark);
  font-size: 13px;
  font-weight: 600;
  min-height: 16px;
}

/* ---------- Tabs ---------- */
/* Hauptbereiche als Kacheln auf hellem Träger */
/* ---------- Startseite: Kacheln ---------- */
.home {
  margin-bottom: 8px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  padding: 26px 22px 30px;
  margin-bottom: 16px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 85% -20%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, var(--club-red-dark) 0%, #7d0011 100%);
  box-shadow: 0 10px 30px rgba(161, 0, 21, 0.22);
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 230px;
  height: 230px;
  background: url("/static/icons/logo.png") center / contain no-repeat;
  opacity: 0.13;
  transform: rotate(-8deg);
}

.hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  font-size: 14px;
  opacity: 0.85;
}

.tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 8px;
}

.tile {
  border: 0;
  text-align: left;
  cursor: pointer;
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 134px;
  background: linear-gradient(150deg, var(--club-red) 0%, var(--club-red-dark) 100%);
  box-shadow: 0 2px 4px rgba(161, 0, 21, 0.22), 0 10px 22px rgba(161, 0, 21, 0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: transparent;
  background: linear-gradient(150deg, var(--club-red) 0%, var(--club-red-dark) 100%);
  box-shadow: 0 4px 8px rgba(161, 0, 21, 0.26), 0 16px 30px rgba(161, 0, 21, 0.2);
}

.tile:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.tile svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-name {
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.25;
}

.tile-desc {
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.82;
  margin-top: -3px;
  font-weight: 500;
}

@media (max-width: 860px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Bereichskopf ---------- */
.area-head {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 2px 2px 16px;
}

.area-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--club-red) 0%, var(--club-red-dark) 100%);
  box-shadow: 0 2px 8px rgba(161, 0, 21, 0.25);
}

.area-icon svg {
  width: 25px;
  height: 25px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.area-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.area-head p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Unterreiter eines Bereichs ---------- */
.pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: 14px;
}

.pills::-webkit-scrollbar {
  display: none;
}

.pill-tab {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--muted);
  font-weight: 650;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
}

.pill-tab:hover {
  border-color: #f0b8bf;
  background: #fff6f7;
  color: var(--club-red);
}

.pill-active,
.pill-active:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ---------- Sponsorenliste ---------- */
.sponsor-list {
  display: block;
}

.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.sponsor-table,
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.sponsor-table th,
.mini-table th {
  background: #f8fafb;
  color: var(--faint);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
}

/* Kopfzeile bleibt beim Scrollen langer Listen stehen */
.sponsor-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.sponsor-table td,
.mini-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

.sponsor-table tbody tr {
  transition: background 0.12s ease;
}

.sponsor-table tbody tr:hover {
  background: #fff6f7;
}

.sponsor-table .money,
.mini-table .money {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.strong {
  color: var(--club-red);
  font-weight: 700;
}

.num {
  white-space: nowrap;
}

.table-sub {
  color: var(--faint);
  font-size: 12px;
  margin-top: 3px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  transition: color 0.12s ease;
}

.link-button:hover {
  background: transparent;
  color: var(--club-red);
}

.muted-row {
  opacity: 0.55;
}

.mini-table tbody tr:last-child td,
.mini-table tbody tr:last-child th,
.sponsor-table tbody tr:last-child td {
  border-bottom: 0;
}

.check-cell {
  width: 40px;
}

.check-cell input {
  width: 17px;
  height: 17px;
  accent-color: var(--club-red);
}

/* ---------- Pills, Chips, Kennzahlen ---------- */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.pill-green {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid #c3e6cf;
}

.pill-gray {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line-strong);
}

.pill-admin {
  background: #fdeaec;
  color: var(--club-red);
  border: 1px solid #f3c2c8;
}

.pill-locked {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line-strong);
}

/* ---------- Benutzerverwaltung ---------- */
.user-inactive td {
  opacity: 0.55;
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}

.check-label input {
  margin-top: 2px;
  accent-color: var(--club-red);
}

@media (max-width: 700px) {
  .perm-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Spieler-Abrechnung ---------- */
.payout-title {
  margin: 26px 0 10px;
  font-size: 17px;
}

.counter-cell {
  min-width: 320px;
}

.counter-field {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 10px 4px 0;
  font-size: 11.5px;
  color: var(--muted);
}

.counter-field input {
  width: 72px;
  padding: 5px 7px;
  font-size: 13.5px;
}

.counter-field.counter-note input {
  width: 150px;
}

.counter-extra {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--line-strong);
}

.payout-amount {
  font-weight: 700;
  white-space: nowrap;
}

.payout-over {
  color: var(--club-red);
}

.agreement-active {
  align-self: end;
  padding-bottom: 10px;
}

/* ---------- Kassenbuch ---------- */
.cash-plus {
  color: var(--ok, #1a7f37);
}

.cash-minus {
  color: var(--club-red);
}

.cash-club-toolbar {
  align-items: center;
}

.cash-club-toolbar .payout-title {
  margin: 0;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  align-items: center;
}

.chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}

.tcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tcard {
  background: linear-gradient(160deg, #fbfcfd, #f2f5f8);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.tcard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.tcard strong {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--club-red);
}

.note-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--warn-bg);
  border: 1px solid #f0dca8;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

/* ---------- Detailbereich ---------- */
.detail {
  position: sticky;
  top: 108px;
  align-self: start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  max-height: calc(100vh - 128px);
  overflow: auto;
  box-shadow: var(--shadow-md);
}

.detail h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--faint);
  gap: 6px;
  padding: 24px 20px;
}

.empty-state h2 {
  color: var(--muted);
}

/* Ballsymbol als freundlicher Platzhalter */
.empty-state::before {
  content: "⚽";
  font-size: 30px;
  opacity: 0.35;
  margin-bottom: 2px;
}

.empty-state p {
  max-width: 42ch;
  line-height: 1.5;
  margin: 0;
}

/* Leere Listen innerhalb von Tabellenbereichen: dezenter Rahmen */
.documents-view .empty-state,
.sponsor-list .empty-state {
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  min-height: 170px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 18px;
}

.section h3 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--faint);
}

.kv {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 9px 14px;
  font-size: 14px;
}

.kv dt {
  color: var(--muted);
  font-weight: 600;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.kv a {
  color: var(--club-red-dark);
}

.meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.amount {
  font-weight: 700;
  color: var(--club-red);
  font-variant-numeric: tabular-nums;
}

.source-note {
  margin-top: 16px;
  font-size: 11px;
  color: var(--faint);
}

/* ---------- Positionen als Karten ---------- */
.position-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 11px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.position-card .position-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.position-card .position-head strong {
  font-size: 14.5px;
}

.position-card .position-badges {
  grid-column: 1 / -1;
}

.position-card input,
.position-card select {
  padding: 8px 10px;
  min-width: 0;
}

.position-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.position-source {
  color: var(--faint);
  font-size: 12px;
}

.add-position {
  margin-top: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
  background: #fcfdfe;
}

.add-position summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--club-red-dark);
  padding: 12px 2px;
  list-style: none;
}

.add-position summary::-webkit-details-marker {
  display: none;
}

.add-position[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.add-position[open] {
  padding-bottom: 14px;
}

.service-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.service-form .actions {
  grid-column: 1 / -1;
}

/* ---------- Dokumente ---------- */
.document {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 10px;
  box-shadow: var(--shadow-sm);
}

.document strong {
  font-size: 14px;
}

.one-time-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #f0dca8;
  background: var(--warn-bg);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Dokumente-Reiter ---------- */
.documents-view .toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.doc-status {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  font-weight: 600;
}

.doc-status.status-erstellt {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: #f0dca8;
}

.doc-status.status-versendet {
  background: #e8f1fb;
  color: #1d4f91;
  border-color: #c6dcf3;
}

.doc-status.status-bezahlt {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: #c3e6cf;
}

.doc-status.status-fehlerhaft {
  background: #fdecea;
  color: var(--danger);
  border-color: #f2c9cc;
}

/* Summenzeile unter Listen: als eigene helle Leiste statt loser Text */
.doc-totals {
  margin-top: 12px;
  padding: 11px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
}

.doc-totals strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Kennzahlen-Leiste des Kassenbuchs etwas prominenter */
#cashSummary {
  font-size: 14.5px;
  padding: 13px 16px;
}

.doc-actions {
  white-space: nowrap;
}

.doc-actions button {
  padding: 6px 10px;
  font-size: 12.5px;
}

.doc-actions .doc-delete {
  margin-left: 4px;
}

.th-sub {
  font-weight: 500;
  font-size: 10.5px;
  color: var(--club-red);
  letter-spacing: 0.2px;
  white-space: nowrap;
  text-transform: none;
}

/* ---------- Dialoge ---------- */
#pwDialog,
.app-dialog {
  border: none;
  border-radius: 16px;
  padding: 26px;
  width: min(400px, 93vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}

#pwDialog::backdrop,
.app-dialog::backdrop {
  background: rgba(20, 26, 32, 0.5);
  backdrop-filter: blur(2px);
}

#pwDialog h3,
.app-dialog h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.app-dialog > form > .meta {
  margin-bottom: 14px;
}

.app-dialog h4 {
  margin: 16px 0 10px;
}

.pw-form label,
.app-dialog label {
  display: block;
  margin-bottom: 13px;
  font-size: 13px;
}

.pw-form input,
.app-dialog input,
.app-dialog textarea,
.app-dialog select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 5px;
  font-size: 15px;
  font-family: inherit;
}

.app-dialog .two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.app-dialog .free-item {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.app-dialog .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.pw-error {
  color: var(--danger);
  min-height: 1.1em;
  margin: 4px 0 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Formular-Abschnitte (Sponsor-Dialog) ---------- */
.form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 15px 3px;
  margin-bottom: 14px;
  background: #fcfdfe;
}

.form-section h4 {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--club-red);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.span-2 {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.notice {
  border: 1px solid #f0c98d;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-weight: 600;
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .detail {
    position: static;
    max-height: none;
  }
}

/* Tablet / schmales Fenster: mehrspaltige Panels umbrechen lassen,
   sonst sprengen ihre Mindestbreiten die Seite */
@media (max-width: 900px) {
  .billing-panel {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .billing-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-logo {
    height: 40px;
  }

  /* Aktionen in einer Reihe statt untereinander */
  .topbar-actions {
    width: 100%;
    gap: 7px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions button {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 13px;
  }

  /* Kennzahlen zweispaltig statt endlos untereinander */
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .stat {
    padding: 12px 12px 11px;
  }

  .stat strong {
    font-size: 19px;
  }

  .stat span {
    font-size: 11.5px;
  }

  .tab {
    padding: 9px 14px;
    font-size: 13.5px;
  }

  .toolbar,
  .billing-panel,
  .form-grid,
  .service-form,
  .position-card,
  .app-dialog .two-col {
    grid-template-columns: 1fr;
  }

  .sponsor-table .col-lbs,
  .sponsor-table .col-season,
  .sponsor-table .col-status {
    display: none;
  }

  .detail-header {
    flex-direction: column;
  }

  .tcards {
    grid-template-columns: 1fr 1fr;
  }

  .tabbar {
    overflow-x: auto;
    scroll-snap-type: x proximity;
    border-radius: var(--radius);
  }

  .tab {
    scroll-snap-align: start;
  }
}

/* ---------- Zurück zur Startseite ---------- */
.topbar-back {
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 650;
  font-size: 13.5px;
  padding: 8px 14px 8px 11px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: none;
}

.topbar-back:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: transparent;
  color: #fff;
}

.topbar-back:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: none;
}


@media (max-width: 700px) {
  /* Am Handy soll die Kopfzeile eine Zeile bleiben: Zurück + Bereichsname + Konto */
  .topbar {
    min-height: 60px;
    gap: 10px;
    padding: 10px 14px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }

  .topbar h1 {
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-brand {
    gap: 10px;
    min-width: 0;
  }

  .topbar-logo {
    height: 34px;
    border-radius: 9px;
    padding: 3px;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar-actions #currentUser {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
    width: auto;
    flex: 0 0 auto;
    overflow: visible;
  }

  .topbar-actions button {
    padding: 7px 10px;
    font-size: 12.5px;
  }

  /* Im Bereich ersetzt der Zurück-Knopf das Logo */
  body.in-area .topbar-logo {
    display: none;
  }

  .topbar-back {
    padding: 7px 11px 7px 9px;
    font-size: 13px;
    flex: 0 0 auto;
  }

  .hero {
    padding: 20px 16px 24px;
  }

  .hero h2 {
    font-size: 20px;
  }

  .tiles {
    gap: 10px;
  }

  .tile {
    min-height: 126px;
    padding: 14px 12px;
  }

  .tile-name {
    font-size: 14.5px;
  }
}

/* ---------- Träger: FC Wadrill oder Förderverein ---------- */
.owner-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.owner-fc {
  background: var(--club-red-soft);
  color: var(--club-red-dark);
}

.owner-foerderverein {
  background: var(--info-bg);
  color: #1e4b8f;
}

.owner-split {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.owner-part {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ---------- Sponsorenliste als Pflegeansicht ---------- */
.table-rows-clickable tbody tr {
  cursor: pointer;
}

.table-rows-clickable tbody tr:hover {
  background: var(--club-red-soft);
}

/* ---------- Sponsorenpakete ---------- */
.package-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.package-gold {
  background: #fdf0cd;
  color: #8a6100;
}

.package-silber {
  background: #eceff2;
  color: #55606a;
}

.package-bronze {
  background: #f7e6da;
  color: #8a4f24;
}

/* ---------- Rechnungserstellung: Anlass zuerst ---------- */
.step-title {
  margin: 2px 0 12px;
  font-size: 16px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.choice-card:hover {
  border-color: var(--club-red);
  background: #fff8f9;
  box-shadow: var(--shadow-md);
}

.choice-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.choice-sub {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

.chosen-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.chosen-bar strong {
  color: var(--ink);
  font-size: 15px;
}

.chosen-bar button {
  margin-left: auto;
  font-size: 13px;
  padding: 7px 12px;
}

/* ---------- Sponsor am Handy bildschirmfüllend ---------- */
.detail-back {
  display: none;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-weight: 650;
  font-size: 13.5px;
  padding: 9px 15px 9px 12px;
  border-radius: 999px;
}

@media (max-width: 1040px) {
  .detail-back {
    display: inline-flex;
  }

  /* Liste und Werkzeugleisten weichen dem geöffneten Sponsor */
  body.detail-open .workspace {
    display: none;
  }
}

/* ---------- Hinweis bei unterbrochener Verbindung ---------- */
.conn-banner {
  position: sticky;
  top: 72px;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 11px clamp(16px, 3vw, 36px);
  background: var(--warn-bg);
  border-bottom: 1px solid #f0c98d;
  color: var(--warn);
  font-size: 13.5px;
  font-weight: 600;
}

.conn-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d98c00;
  animation: conn-pulse 1.2s ease-in-out infinite;
}

@keyframes conn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.conn-banner button {
  margin-left: auto;
  padding: 6px 12px;
  font-size: 12.5px;
  border-color: #e2b96a;
  background: #fff;
  color: var(--warn);
}

@media (max-width: 700px) {
  .conn-banner {
    top: 60px;
    padding: 10px 14px;
    font-size: 12.5px;
  }
}
