@media (max-width: 400px) {
  /* Скрыть второстепенные колонки: Stadt и Zuschuss ohne 
  #eventsTable th:nth-child(4), #eventsTable td:nth-child(4){
    display: none; 
  }*/
  /* Уменьшить шрифт и отступы */
  body, .table, .card, .container {
    font-size: 0.92em;
    padding: 0.3rem;
  }
  .table th, .table td {
    padding: 0.25rem 0.3rem;
  }
  /* Модальное окно: прокрутка таблицы */
  #detailsModalBody table {
    font-size: 0.92em;
    min-width: 320px;
    overflow-x: auto;
    display: block;
  }
  #detailsModal .modal-dialog {
    margin: 0.5rem;
  }
  .btn, .sum-link {
    font-size: 0.95em;
    padding: 0.25em 0.6em;
  }
}
/* Центрирование содержимого всех ячеек таблиц по вертикали */
td, th {
  vertical-align: middle !important;
}
/* Выделение столбца Sportleranteil */
.sportler-col, th.sportler-col {
  background: #ffe5e5;
  font-weight: bold;
}
.sportler-total {
  font-size: 1.15em;
  background: #ffd6d6;
  font-weight: bold;
}
:root{
  /* Брендовые цвета SC Potsdam (из логотипа) */
  --sc-primary: #D8232A; /* основной красный из логотипа */
  /* RGB версия для полупрозрачных фонов */
  --sc-primary-rgb: 216,35,42;
  --sc-accent: #063a7a;  /* тёмно-синий акцент */
  --sc-dark: #0a1a2a;
}

body{
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: #f8f9fa;
  color: #111;
}

.sc-navbar{
  background: var(--sc-primary);
}

.navbar-brand img{ filter: drop-shadow(0 1px 0 rgba(0,0,0,0.15)); }

#saldoValue{ color: var(--sc-primary); }

.table thead th{
  border-bottom: 1px solid rgba(255,255,255,0.06);
  /* use brand accent (dark blue) for better contrast instead of strong red */
  background: linear-gradient(180deg, var(--sc-accent), #063a7a 60%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
  text-align: center !important;
  vertical-align: middle !important;
}

.card-title{ color: var(--sc-dark); }

.card .small{ color: #6c757d; }
.table tfoot th{
  font-weight:700;
  background-color: rgba(10,26,42,0.06);
  color: var(--sc-dark);
}

/* Softer zebra striping to reduce visual noise */
.table.table-striped > tbody > tr:nth-of-type(odd){
  background-color: rgba(0,0,0,0.02);
}
.table.table-striped > tbody > tr:nth-of-type(even){
  background-color: transparent;
}
.text-danger{ color: #bd2130 !important; }

/* Numeric alignment */
.table td.num, .table th.num { text-align: right; }
.table td.num { font-variant-numeric: tabular-nums; }

/* Overview highlight */
.highlight-overview{ background: linear-gradient(90deg, rgba(var(--sc-primary-rgb),0.06), rgba(0,0,0,0.01)); border-left: 4px solid var(--sc-primary); }
.highlight-overview .sum-link{ display:inline-block; font-size:1.1rem; color:var(--sc-dark); text-decoration:none; }
.highlight-overview .sum-link:hover{ text-decoration:underline; cursor:pointer; }

/* Profile highlight - light green */
.highlight-profile{ background: linear-gradient(90deg, rgba(200,230,200,0.6), rgba(255,255,255,0.4)); border-left: 4px solid #6fbf6f; }
.highlight-profile .fw-bold{ color: #145214; }

/* Responsive tweaks */
@media (max-width: 576px){
  #saldo{ text-align: left; margin-top: 1rem; }
}

/* Very small screens: <= 320px */
@media (max-width: 320px){
  /* Reduce overall spacing and font-sizes for compact view */
  body{ font-size: 14px; }
  .container{ padding-left: 0.5rem; padding-right: 0.5rem; }
  header h1{ font-size: 1rem; }
  .highlight-overview .sum-link{ font-size: 0.95rem; }
  .highlight-profile{ padding: 0.6rem; }

  /* Navbar logo smaller to save space */
  .navbar-brand img{ height: 32px; }

  /* Cards: reduce padding */
  .card, .card .card-body{ padding: 0.6rem; }

  /* Tables: make horizontally scrollable and hide less-important columns */
  .table-responsive{ overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Hide 'Stadt' and 'Zuschuss (ohne Anrechnung)' columns to fit narrow screens */
  table#eventsTable thead th:nth-child(4),
  table#eventsTable tbody td:nth-child(4),
  table#eventsTable tfoot th:nth-child(4){ display: none; }

  /* hide the 'Zuschuss (ohne Anrechnung)' which is the 8th column after reordering
    note: we must target both thead and tbody tds */
  table#eventsTable thead th:nth-child(8),
  table#eventsTable tbody td:nth-child(8),
  table#eventsTable tfoot th:nth-child(8){ display: none; }

  /* Reduce padding in table cells */
  .table td, .table th{ padding: 0.35rem 0.4rem; }

  /* Make clickable sums slightly larger tappable targets */
  .sum-link{ padding: 0.2rem 0.4rem; display: inline-block; }
}

  /* Warning / negative states */
  .negative, .negative a { color: #a71d2a !important; background-color: rgba(183,31,45,0.06); border-radius: 4px; padding: 0.05rem 0.2rem; }
  .warn-note{ font-size: 0.8rem; color: #6c757d; }
  /* Positive state for negative open amount (green) */
  .positive{ color: #0f8b3a !important; background-color: rgba(15,139,58,0.06); border-radius: 4px; padding: 0.05rem 0.2rem; }

  /* Highlight animation when jumping to a section */
  .section-highlight{ animation: sectionFlash 1.6s ease-in-out; }
  @keyframes sectionFlash{
    0% { box-shadow: 0 0 0 rgba(0,0,0,0); }
    10% { box-shadow: 0 0 12px rgba(var(--sc-primary-rgb),0.35); }
    100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
  }
