/* SPORTUNION Herzogenburg Vereinsapp — Design-System
   Marke: Logo-Orange #E8481F, warmes Schwarz, helle warme Neutrale. */

:root {
  --brand: #E8481F;
  --brand-dark: #C93812;
  --brand-soft: #FCEDE7;
  --brand-softer: #FEF6F3;
  --ink: #1B1917;
  --muted: #77695f;
  --line: #EAE2DD;
  --line-strong: #D9CEC7;
  --bg: #FAF7F5;
  --surface: #FFFFFF;
  --good: #2E7D4F;
  --good-soft: #E7F2EB;
  --warn: #9A6200;
  --warn-soft: #FBF3E4;
  --data: #205B9E;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(27, 25, 23, 0.05), 0 4px 16px rgba(27, 25, 23, 0.06);
  --shadow-lg: 0 8px 40px rgba(27, 25, 23, 0.18);
  /* Abwärtskompatible Aliase */
  --accent: var(--brand);
  --accent-dark: var(--brand-dark);
  --accent-soft: var(--brand-soft);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* --- Icons --------------------------------------------------------------- */
.icon { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.icon-lg { width: 1.35em; height: 1.35em; }

/* --- Topbar -------------------------------------------------------------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(27, 25, 23, 0.05);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner {
  max-width: 78rem; margin: 0 auto; padding: 0.5rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; }
.brand img { height: 34px; width: auto; display: block; }
.topbar nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted); text-decoration: none; padding: 0.45rem 0.65rem; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.4rem;
}
.topbar nav a:hover { color: var(--ink); background: var(--bg); }
.topbar nav a.active { color: var(--brand-dark); background: var(--brand-soft); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 0.4rem; }
.subnav { background: var(--bg); border-top: 1px solid var(--line); }
.subnav-inner {
  max-width: 78rem; margin: 0 auto; padding: 0.2rem 1.25rem;
  display: flex; gap: 0.15rem; flex-wrap: wrap;
}
.subnav a {
  color: var(--muted); text-decoration: none; padding: 0.35rem 0.65rem; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem;
}
.subnav a:hover { color: var(--ink); background: var(--surface); }
.subnav a.active { color: var(--brand-dark); font-weight: 600; }
.subnav .count {
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px;
  padding: 0 0.45rem; font-size: 0.75rem; font-weight: 600; line-height: 1.4;
}
.userbox .who {
  color: var(--muted); font-size: 0.85rem; text-decoration: none;
  padding: 0.35rem 0.55rem; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.userbox .who:hover { color: var(--ink); background: var(--bg); }
.userbox form { margin: 0; }

.content { max-width: 78rem; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

/* --- Typografie ----------------------------------------------------------- */
h1 { font-size: 1.5rem; margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.6rem; letter-spacing: 0.005em; }
.subtle { color: var(--muted); font-size: 0.88rem; }
a { color: var(--brand-dark); }

/* --- Buttons -------------------------------------------------------------- */
button.btn, a.btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 0.4rem 0.85rem; font-size: 0.85rem;
  font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
button.btn:hover, a.btn:hover { border-color: var(--muted); background: var(--bg); }
button.btn.primary, a.btn.primary { background: var(--good); border-color: var(--good); color: #fff; }
button.btn.primary:hover { filter: brightness(1.07); }
button.btn.accent, a.btn.accent { background: var(--brand); border-color: var(--brand); color: #fff; }
button.btn.accent:hover { background: var(--brand-dark); }
.btns { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.btn-link {
  color: var(--muted); text-decoration: none; padding: 0.3rem 0.6rem; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn-link:hover { color: var(--brand-dark); background: var(--brand-soft); }
.btn-link.active { color: var(--brand-dark); background: var(--brand-soft); font-weight: 700; }

/* Icon-Aktionen in Tabellenzeilen */
.actions { display: flex; gap: 0.15rem; justify-content: flex-end; align-items: center; }
.iconbtn {
  border: none; background: none; color: var(--muted); cursor: pointer;
  padding: 0.35rem; border-radius: var(--radius-sm); line-height: 0;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.iconbtn:hover { color: var(--brand-dark); background: var(--brand-soft); }
.iconbtn.danger:hover { color: #b3261e; background: #FCEAE8; }
.iconbtn .icon { width: 1.15rem; height: 1.15rem; vertical-align: 0; }
form.inline-action { margin: 0; display: inline-flex; }

/* --- Karten & Kacheln ------------------------------------------------------ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.15rem; text-decoration: none; color: inherit; display: block;
  box-shadow: var(--shadow);
}
a.card:hover { border-color: var(--brand); }
.card .num { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .num.ok { color: var(--good); }
.card .num.alert { color: var(--brand); }
.card .label { color: var(--muted); font-size: 0.85rem; }
.card h4 { margin: 0 0 0.4rem; font-size: 0.95rem; font-weight: 650; }
.card p, .card ul { font-size: 0.9rem; margin: 0.35rem 0; }

/* --- Tabellen (kompakt) ----------------------------------------------------- */
table.list {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 0.88rem;
  box-shadow: var(--shadow);
}
table.list th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--line-strong);
  background: var(--brand-softer);
}
table.list td { padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr:hover td, table.list tr:hover td { background: var(--brand-softer); }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--brand-dark); }
.pos { color: var(--good); }

/* --- Chips & Badges --------------------------------------------------------- */
.chip {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 99px; font-size: 0.74rem; font-weight: 600; padding: 0.08rem 0.55rem;
  margin: 0.08rem 0.15rem 0.08rem 0;
}
.chip-muted { background: var(--bg); color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 600;
  border-radius: 99px; padding: 0.1rem 0.55rem; background: var(--bg); color: var(--muted);
  white-space: nowrap;
}
.badge.pos, .badge.st-aktiv { background: var(--good-soft); color: var(--good); }
.badge.st-angemeldet { background: #E8F0FA; color: var(--data); }
.badge.st-warteliste, .badge.st-schnuppern { background: var(--warn-soft); color: var(--warn); }
.badge.st-beendet, .badge.st-abgelehnt { background: var(--bg); color: var(--muted); }
.score {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 99px; font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.5rem; margin-left: 0.4rem;
}

/* --- Tabs & Filter ------------------------------------------------------------ */
.tabs { display: flex; gap: 0.25rem; align-items: center; border-bottom: 2px solid var(--line); margin: 1rem 0; flex-wrap: wrap; }
.tab {
  text-decoration: none; color: var(--muted); padding: 0.45rem 0.9rem; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 0.92rem;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tab .count {
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 99px;
  font-size: 0.72rem; font-weight: 700; padding: 0.05rem 0.45rem; margin-left: 0.3rem;
}
.filterbar {
  display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.7rem 0.9rem; margin: 1rem 0; box-shadow: var(--shadow);
}
.filterbar input[type="search"], .filterbar select, .inline-select {
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.35rem 0.55rem;
  font-size: 0.88rem; background: var(--surface); color: var(--ink); font-family: inherit;
}
.filterbar input[type="search"] { min-width: 14rem; }
.check-label { font-size: 0.88rem; display: flex; gap: 0.35rem; align-items: center; }

/* --- Toasts (Django messages) --------------------------------------------------- */
#toasts {
  position: fixed; top: 4.2rem; right: 1rem; z-index: 100;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: 26rem;
}
.flash {
  background: var(--good-soft); color: var(--good); border: 1px solid currentColor;
  border-radius: var(--radius-sm); padding: 0.55rem 2.2rem 0.55rem 0.9rem; font-size: 0.88rem;
  box-shadow: var(--shadow-lg); position: relative; animation: toast-in 0.18s ease-out;
}
.flash-error { background: var(--brand-soft); color: var(--brand-dark); }
.flash-warning { background: var(--warn-soft); color: var(--warn); }
.flash .toast-close {
  position: absolute; top: 0.3rem; right: 0.3rem; border: none; background: none;
  color: inherit; cursor: pointer; padding: 0.15rem; line-height: 0; border-radius: 4px;
}
@keyframes toast-in { from { transform: translateX(1rem); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

/* --- Modal ------------------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(27, 25, 23, 0.45); z-index: 80;
  display: flex; align-items: flex-start; justify-content: center; padding: 4rem 1rem 2rem;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 34rem; position: relative; animation: modal-in 0.15s ease-out;
}
@keyframes modal-in { from { transform: translateY(0.5rem); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }
.modal-close {
  position: absolute; top: 0.65rem; right: 0.65rem; border: none; background: none;
  color: var(--muted); cursor: pointer; padding: 0.3rem; border-radius: var(--radius-sm); line-height: 0;
}
.modal-close:hover { color: var(--ink); background: var(--bg); }
#modal-body { padding: 1.4rem 1.6rem 1.6rem; }
#modal-body h2 { margin: 0 2rem 1rem 0; font-size: 1.15rem; }
#modal-body .htmx-indicator { display: none; }

/* Formulare (Modal + Seiten) */
.formfields label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.7rem 0 0.2rem; }
.formfields input:not([type="checkbox"]), .formfields select, .formfields textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem; font-size: 0.92rem; background: var(--surface); color: var(--ink);
  font-family: inherit;
}
.formfields .checkbox-row { display: flex; gap: 0.45rem; align-items: center; margin-top: 0.8rem; }
.formfields .checkbox-row label { margin: 0; }
.formfields .helptext { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 0.15rem; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 540px) { .form-grid2 { grid-template-columns: 1fr; } }
.modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.4rem; }
.form-error { color: var(--brand-dark); font-size: 0.85rem; margin: 0.3rem 0 0; }

/* --- Auth & öffentliche Formulare ---------------------------------------------------- */
.authbox {
  max-width: 24rem; margin: 3rem auto 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
}
.authbox label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.9rem 0 0.25rem; }
.authbox input[type="text"], .authbox input[type="password"] {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem; font-size: 0.95rem; background: var(--surface); color: var(--ink);
}
.authbox button { margin-top: 1.2rem; width: 100%; padding: 0.5rem; font-size: 0.95rem; justify-content: center; }
.authbox .helptext { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.2rem; }
.authbox .helptext ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }

.formbox {
  max-width: 44rem; margin: 1.5rem auto 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 2rem 2rem;
  box-shadow: var(--shadow);
}
.formbox h2 { margin-top: 1.5rem; }
.formbox label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.5rem 0 0.2rem; }
.formbox input[type="text"], .formbox input[type="email"], .formbox input[type="date"],
.formbox select, .formbox textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem; font-size: 0.95rem; background: var(--surface); color: var(--ink);
  font-family: inherit;
}
.formbox .check-label input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1rem; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; top: -9999px; }

/* --- Bestand: Umsatz-Karten, Vorschläge --------------------------------------------- */
.tx-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1.1rem; margin-bottom: 0.9rem; box-shadow: var(--shadow);
}
.tx-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tx-title { font-weight: 600; }
.tx-meta { color: var(--muted); font-size: 0.85rem; }
.tx-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.suggestion {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  border-top: 1px dashed var(--line); padding: 0.55rem 0; flex-wrap: wrap;
}
.suggestion .what { font-size: 0.9rem; }

.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem;
  text-align: center; color: var(--muted); background: var(--surface);
}
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1.25rem 0; }
.pagination a { color: var(--brand-dark); text-decoration: none; font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 0.5rem; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1.25rem 0; }

.invite-link {
  display: block; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem; font-family: ui-monospace, monospace; font-size: 0.82rem;
  word-break: break-all; margin: 0.75rem 0;
}

/* --- PRAE-Grid & Anwesenheit ----------------------------------------------------------- */
.prae-grid td { padding: 0.25rem 0.8rem; }
.prae-grid tr.weekend td { background: var(--bg); }
.prae-grid .grid-text, .grid-text {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0.25rem 0.45rem; font-size: 0.85rem; background: var(--surface); color: var(--ink);
}
.prae-grid .grid-amount {
  width: 5.5rem; text-align: right; border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0.25rem 0.45rem; font-size: 0.85rem; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--ink);
}
.prae-total {
  margin-top: 0.75rem; font-size: 0.95rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.9rem; display: inline-block;
}
.prae-total.over { border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.attendance .att-check { width: 1.6rem; height: 1.6rem; accent-color: var(--good); }
.rereg { border-top: 1px dashed var(--line); margin-top: 0.9rem; padding-top: 0.75rem; }

/* --- Druck ------------------------------------------------------------------------------ */
.print-doc { margin-top: 1rem; }
.print-head { margin: 0.5rem 0 1rem; }
.print-title { font-size: 1.15rem; font-weight: 700; }
@media print {
  .topbar, .no-print, #toasts, .actions, .modal-overlay { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { max-width: none; padding: 0; }
  table.list { border-radius: 0; box-shadow: none; }
}

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
}

.bulkbar[hidden] { display: none; }
.bulkbar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--brand-soft); border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem; margin: 0.6rem 0;
}
.bulkbar .subtle { margin-right: 0.25rem; }
td.sel-cell, th.sel-cell { width: 1.6rem; }

.status-menu { position: relative; display: inline-block; }
.status-menu summary { list-style: none; cursor: pointer; }
.status-menu summary::-webkit-details-marker { display: none; }
.status-menu summary:hover .badge { box-shadow: 0 0 0 2px var(--brand-soft); }
.status-menu[open] summary .badge { box-shadow: 0 0 0 2px var(--brand); }
.status-menu-list {
  position: absolute; z-index: 60; top: calc(100% + 3px); left: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px; padding: 4px; white-space: nowrap;
}
.status-menu-list button {
  border: none; background: none; text-align: left; cursor: pointer;
  padding: 3px 5px; border-radius: var(--radius-sm); line-height: 1; font: inherit;
  display: flex; align-items: center; gap: 0.35rem;
}
.status-menu-list button:hover { background: var(--bg); }
.status-menu-list button:hover .badge { box-shadow: 0 0 0 2px var(--brand-soft); }

table.list th:not(.sel-cell):not(:empty) { cursor: pointer; user-select: none; }
table.list th.sorted-asc::after { content: " \25B4"; color: var(--brand-dark); }
table.list th.sorted-desc::after { content: " \25BE"; color: var(--brand-dark); }
