:root {
  --background: #f2f4f9;
  --surface: #ffffff;
  --surface-muted: #f7f8fc;

  --text: #18213b;
  --muted: #68718a;

  --border: #d8ddea;

  --primary: #1b3280;
  --primary-hover: #142764;
  --primary-dark: #0e1d4d;
  --primary-light: #e8ecf8;
  --primary-soft: #f2f4fb;

  --white: #ffffff;

  --danger: #a72c3b;
  --danger-background: #fff1f3;

  --success: #23734c;
  --success-background: #edf8f2;

  --shadow:
    0 10px 30px rgba(27, 50, 128, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--background);
}

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

button {
  appearance: none;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.container {
  width: min(1500px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: relative;
  margin-bottom: 24px;
  padding: 20px 0;
  color: var(--white);
  background:
    linear-gradient(
      135deg,
      var(--primary-dark) 0%,
      var(--primary) 55%,
      #29499d 100%
    );
  box-shadow: var(--shadow);
  overflow: hidden;
}

.site-header::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 240px;
  height: 240px;
  border: 34px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.header-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.club-logo {
  width: 78px;
  height: 78px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 4px;
  border-radius: 10px;
  background: var(--white);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.18);
}

.header-actions,
.toolbar,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-status {
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

h2 {
  margin-bottom: 0;
}

.brand h1 {
  color: var(--white);
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.78;
}

.brand .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
}

.toolbar > div {
  display: grid;
  gap: 6px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--white);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(27, 50, 128, 0.16);
  border-color: var(--primary);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary);
  border-radius: 9px;
  padding: 10px 16px;
  color: var(--white);
  background: var(--primary);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.65);
  color: var(--white);
  background: transparent;
}

.button-secondary:hover {
  border-color: var(--white);
  color: var(--primary);
  background: var(--white);
}

.toolbar .button-secondary,
.dialog-actions .button-secondary {
  border-color: var(--border);
  color: var(--primary);
  background: var(--white);
}

.toolbar .button-secondary:hover,
.dialog-actions .button-secondary:hover {
  border-color: var(--primary);
  color: var(--white);
  background: var(--primary);
}

.button-full {
  width: 100%;
  margin-top: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--primary);
}

.summary-card strong {
  color: var(--primary);
  font-size: 1.35rem;
}

.summary-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.table-card {
  margin-bottom: 40px;
  overflow: hidden;
}

.section-heading {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  min-width: 125px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: center;
  vertical-align: middle;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  max-width: 170px;
  color: var(--white);
  background: var(--primary);
}

thead th span,
thead th small,
tbody td strong,
tbody td small {
  display: block;
}

thead th small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
}

tbody td small {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 500;
}

.sticky-column {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 190px;
  text-align: left;
  background: var(--white);
}

thead .sticky-column {
  z-index: 4;
  color: var(--white);
  background: var(--primary-dark);
}

tbody tr:nth-child(even) td,
tbody tr:nth-child(even) th {
  background: var(--surface-muted);
}

tbody tr:hover td,
tbody tr:hover th {
  background: var(--primary-soft);
}

.total-column {
  min-width: 115px;
  color: var(--primary-dark);
  font-weight: 800;
  background: var(--primary-light);
}

.empty-cell {
  color: #a4aabc;
}

.alert {
  margin: 16px 20px;
  border-radius: 10px;
  padding: 12px 14px;
}

.alert-error {
  border: 1px solid #edbebe;
  color: var(--danger);
  background: var(--danger-background);
}

.alert-success {
  border: 1px solid #b8dfc9;
  color: var(--success);
  background: var(--success-background);
}

.hidden {
  display: none !important;
}

dialog {
  width: min(520px, calc(100% - 28px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(14, 29, 77, 0.34);
}

dialog::backdrop {
  background: rgba(7, 15, 40, 0.66);
}

dialog form {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.icon-button {
  border: 0;
  padding: 0;
  font-size: 2rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--primary);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at top left,
      #3958ad 0%,
      var(--primary) 38%,
      var(--primary-dark) 100%
    );
}

.login-container {
  width: min(430px, 100%);
}

.login-card {
  padding: 30px;
}

.login-logo {
  display: block;
  width: 100px;
  height: 100px;
  margin: 0 auto 18px;
  object-fit: contain;
}

.login-card form {
  display: grid;
  gap: 8px;
}

.muted {
  color: var(--muted);
}

.back-link {
  display: block;
  margin-top: 18px;
  color: var(--primary);
  text-align: center;
  font-weight: 700;
}

.back-link:hover {
  color: var(--primary-hover);
}

@media (max-width: 900px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 750px) {
  .container {
    width: min(100% - 20px, 1500px);
  }

  .header-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    align-items: center;
  }

  .club-logo {
    width: 64px;
    height: 64px;
  }

  .brand h1 {
    font-size: 1.7rem;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > div {
    width: 100%;
  }

  .toolbar .button {
    width: 100%;
  }

  .sticky-column {
    min-width: 150px;
  }

  th,
  td {
    min-width: 105px;
    padding: 9px;
    font-size: 0.86rem;
  }

  dialog form {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 16px 0;
  }

  .brand {
    gap: 12px;
  }

  .club-logo {
    width: 56px;
    height: 56px;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions .button {
    width: 100%;
  }

  .summary-card {
    padding: 16px;
  }

  .section-heading {
    padding: 16px;
  }

  .login-card {
    padding: 22px;
  }
}
.statistics-summary-grid {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.charts-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  min-width: 0;
  overflow: hidden;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.chart-heading .eyebrow {
  color: var(--primary);
}

.chart-container {
  position: relative;
  height: 360px;
  padding: 20px;
}

.chart-container-tall {
  height: 600px;
}

.statistics-table-card {
  margin-bottom: 40px;
  overflow: hidden;
}

.statistics-table {
  width: 100%;
}

.statistics-table th,
.statistics-table td {
  min-width: auto;
}

.statistics-table thead th:first-child {
  width: 90px;
}

.statistics-table thead th:nth-child(2),
.statistics-table tbody td:nth-child(2) {
  text-align: left;
}

.ranking-amount {
  color: var(--primary);
  font-weight: 800;
}

#reload-statistics:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 1100px) {
  .statistics-summary-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card-wide {
    grid-column: auto;
  }

  .chart-container-tall {
    height: 520px;
  }

  .statistics-summary-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .statistics-summary-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 320px;
    padding: 14px;
  }

  .chart-container-tall {
    height: 500px;
  }

  .chart-heading {
    padding: 16px;
  }
}
.doubling-column {
  min-width: 130px;
  color: #84202d;
  font-weight: 800;
  background: var(--danger-background);
}

.doubling-column small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.opening-balance-column {
  min-width: 115px;
  color: var(--primary-dark);
  font-weight: 700;
  background: var(--primary-soft);
}

.doubling-column {
  min-width: 130px;
  color: var(--danger);
  font-weight: 800;
  background: var(--danger-background);
}

.doubling-column small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.action-column {
  min-width: 190px;
}

.button-small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.button-danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button-danger:hover {
  border-color: #84202d;
  background: #84202d;
}

.doubling-status {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--primary-dark);
  background: var(--primary-light);
  font-size: 0.8rem;
  font-weight: 800;
}
.table-sort-button {
  display: flex;
  width: 100%;
  min-width: 100%;
  flex-direction: column;
  align-items: inherit;
  justify-content: center;
  gap: 3px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.table-sort-button:hover {
  text-decoration: underline;
}

.table-sort-button:focus-visible {
  border-radius: 4px;
  outline: 3px solid rgba(255, 255, 255, 0.75);
  outline-offset: 3px;
}

.table-sort-title {
  display: block;
  width: 100%;
}

.table-sort-button small {
  display: block;
  width: 100%;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
}
/* =========================================================
   ZAHLUNGEN
   ========================================================= */

.payment-open-button {
  margin-left: 10px;
  border-color: #1b7a46;
  background: #1b7a46;
  color: #fff;
}

.payment-open-button:hover {
  border-color: #145f36;
  background: #145f36;
}

.payment-dialog {
  width: min(94vw, 520px);
  max-width: 520px;
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow:
    0 24px 80px rgba(14, 29, 77, 0.28);
}

.payment-dialog::backdrop {
  background:
    rgba(14, 29, 77, 0.58);
  backdrop-filter: blur(3px);
}

.payment-dialog-content {
  padding: 24px;
  background: #fff;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dialog-header h2 {
  margin: 4px 0 6px;
  color: var(--primary-dark);
}

.dialog-eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dialog-close-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--primary-dark);
  background: #eef1f8;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-close-button:hover {
  background: #dde3f1;
}

.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #cbd3e3;
  border-radius: 9px;
  padding: 11px 12px;
  color: #14203d;
  background: #fff;
  font: inherit;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(27, 50, 128, 0.12);
}

.form-field textarea {
  resize: vertical;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.money-input-wrapper {
  position: relative;
}

.money-input-wrapper input {
  padding-right: 42px;
}

.money-input-currency {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--muted);
  font-weight: 800;
  transform: translateY(-50%);
  pointer-events: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.payment-submit-button {
  border-color: #1b7a46;
  background: #1b7a46;
  color: #fff;
}

.payment-submit-button:hover {
  border-color: #145f36;
  background: #145f36;
}

.payment-submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-secondary {
  border-color: #cbd3e3;
  color: var(--primary-dark);
  background: #eef1f8;
}

.button-secondary:hover {
  background: #dde3f1;
}

@media (max-width: 600px) {
  .payment-open-button {
    margin-left: 0;
    margin-top: 8px;
  }

  .payment-dialog-content {
    padding: 18px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }
}