/* KSF Sitzplan – Stylesheet
   Helles Theme, Ubuntu für Überschriften, Gold/Braun – identisch zur Sponsoring-App. */

@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&family=Open+Sans:wght@400;600&display=swap');

:root {
    --gold: #B5994F;
    --gold-dunkel: #8A7A5C;
    --braun: #4A3D2C;
    --braun-hell: #5C4D38;
    --creme: #F5EFDE;
    --creme-hover: #FBF8EF;
    --weiss: #FFFFFF;
    --grau-bg: #F4F2EE;
    --grau-rand: #E2DDD2;
    --text: #2B2620;
    --text-leise: #6B6357;
    --ok-bg: #E4F0E2; --ok-tx: #2E6B33;
    --warte-bg: #FBEFD5; --warte-tx: #936C12;
    --gefahr: #A33030;
    --radius: 10px;
    --radius-sm: 6px;
    --schatten: 0 1px 3px rgba(74,61,44,.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Open Sans', system-ui, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--grau-bg);
    line-height: 1.5;
}
/* --- v1.2.0: Alle Ausrichter-Seiten (index.php, vereine.php, ...) als
   Flex-Gerüst, damit Kopf/Menü fest stehen bleiben und einzelne Listen
   einen eigenen Scrollbalken bekommen können (siehe .liste-scroll weiter
   unten). Betrifft alle Seiten mit Klasse "app-body", nicht
   login.php/init.php/verein.php, da deren Inhalt anders aufgebaut ist. */
html { height: 100%; }
body.app-body {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
h1, h2, h3, h4, .ubuntu { font-family: 'Ubuntu', sans-serif; font-weight: 500; color: var(--braun); }
h2 { font-size: 19px; margin: 20px 0 10px; }
h4 { margin: 14px 0 8px; }

/* --- Login --- */
.login-body { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:20px; background: var(--grau-bg); }
.login-card {
    background: var(--weiss); border-radius: var(--radius); padding: 32px;
    max-width: 380px; width: 100%; text-align: center; box-shadow: var(--schatten);
    border-top: 4px solid var(--gold);
}
.login-card h1 { font-size: 22px; margin: 0 0 2px; }
.login-sub { color: var(--text-leise); font-size: 14px; margin: 0 0 20px; }
.login-fehler { background: #F7E3E3; color: var(--gefahr); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; }
.login-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.login-tab {
    flex: 1; padding: 9px; border: 1px solid var(--grau-rand); background: var(--weiss);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; cursor: pointer; color: var(--text);
}
.login-tab.aktiv { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form[hidden] { display: none; } /* Fix: display:flex würde das hidden-Attribut sonst aushebeln */
.login-hinweis { font-size: 13px; color: var(--text-leise); margin: 0; }
.passwort-feld { position: relative; display: block; margin-top: 4px; }
.passwort-feld input { padding-right: 38px; margin: 0; }
.passwort-feld button {
    position: absolute; right: 2px; top: 2px; bottom: 2px; padding: 0 9px;
    background: none; color: var(--text-leise); border: none; border-radius: var(--radius-sm);
}
.passwort-feld button:hover { background: var(--creme-hover); color: var(--braun); }

/* --- Formularelemente --- */
label { font-size: 14px; color: var(--text-leise); display: block; }
input, select, textarea {
    font-family: inherit; font-size: 15px; width: 100%; margin-top: 4px;
    padding: 9px 11px; border: 1px solid var(--grau-rand); border-radius: var(--radius-sm);
    background: var(--weiss); color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold);
}
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
label.check input { width: auto; margin: 0; }

button {
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    background: var(--gold); color: #fff; border: none;
    border-radius: var(--radius-sm); padding: 9px 14px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s;
}
button:hover { background: var(--gold-dunkel); }
button.secondary { background: var(--weiss); color: var(--braun); border: 1px solid var(--grau-rand); }
button.secondary:hover { background: var(--creme-hover); }
button.klein { padding: 5px 9px; font-size: 13px; }
button.gefahr { background: var(--weiss); color: var(--gefahr); border: 1px solid var(--grau-rand); }
button.gefahr:hover { background: #F7E3E3; }
button:disabled { opacity: .45; cursor: not-allowed; }
/* Ladeanzeige auf Speichern-Knöpfen (siehe mitLadezustand() in app.js) */
.dreht { display: inline-block; animation: dreht-animation .8s linear infinite; }
@keyframes dreht-animation { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dreht { animation: none; } }

/* --- Kopf --- */
.kopf {
    background: var(--weiss); border-bottom: 1px solid var(--grau-rand);
    padding: 10px 18px; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; flex-shrink: 0;
}
.kopf-links { display: flex; align-items: center; gap: 12px; }
.menue-btn {
    background: none; color: var(--braun); border: 1px solid var(--grau-rand);
    padding: 8px 11px; font-size: 18px; line-height: 1;
}
.menue-btn:hover { background: var(--creme-hover); }
.kopf-marke { display: flex; align-items: center; gap: 12px; }
.kopf .titel { font-family: 'Ubuntu', sans-serif; font-size: 18px; font-weight: 700; color: var(--braun); }
.kopf .unter { font-size: 13px; color: var(--text-leise); }
.kopf .version { color: var(--gold-dunkel); font-size: 12px; }
.kopf-rechts { display: flex; align-items: center; gap: 10px; }
.kopf-rechts label { margin: 0; display: flex; align-items: center; gap: 5px; }

/* --- Hauptmenü (Hamburger-Dropdown) --- */
.hauptmenue {
    position: absolute; top: 58px; left: 18px; z-index: 100;
    background: var(--weiss); border: 1px solid var(--grau-rand); border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(74,61,44,.25); padding: 6px; min-width: 220px;
    flex-direction: column; gap: 2px;
}
/* [hidden] hat im User-Agent-Stylesheet dieselbe Spezifität wie eine
   Klasse, verliert aber gegen jede Autoren-Regel mit "display" – darum
   das Ein-/Ausblenden hier explizit an [hidden] koppeln statt die Klasse
   pauschal auf display:flex zu setzen (siehe CHANGELOG v1.2.0/v1.1.5). */
.hauptmenue:not([hidden]) { display: flex; }
.menue-eintrag {
    display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
}
.menue-eintrag:hover { background: var(--creme-hover); }
.menue-eintrag.aktiv { background: var(--creme); color: var(--braun); }

/* --- Unter-Tabs (z. B. Stammdaten) --- */
.tabs-unter { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--grau-rand); padding: 0; background: none; }
.tab {
    background: none; color: var(--text-leise); border: none; border-bottom: 3px solid transparent;
    border-radius: 0; padding: 9px 13px; font-weight: 600; white-space: nowrap;
}
.tab:hover { background: var(--creme-hover); color: var(--braun); }
.tab.aktiv { color: var(--braun); border-bottom-color: var(--gold); }
.tabs-unter .tab { padding: 7px 12px; font-size: 14px; }

/* --- Layout --- */
.wrap { max-width: none; margin: 0; padding: 18px 22px; }
.wrap-schmal { max-width: 640px; }

/* --- v1.2.0: Seiten mit einer potenziell langen Tabelle bekommen einen
   eigenen Scrollbalken (Kopf/Menü/Werkzeugleiste bleiben sichtbar, nur die
   Tabelle scrollt, ihr Kopf bleibt dabei sichtbar). Opt-in per Klasse
   "liste-scroll" auf dem jeweiligen Listen-Container (Vereine, Meldungen,
   Veranstaltungstage, Sonderwünsche, Stammdaten -> Ämter); alle anderen
   Seiten scrollen unverändert als Ganzes innerhalb von .wrap. */
body.app-body > .wrap {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    display: flex; flex-direction: column;
}
body.app-body > .wrap:has(.liste-scroll) { overflow: hidden; }
.liste-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.liste-scroll table.tabelle thead th { position: sticky; top: 0; z-index: 2; }
.zeile-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.box {
    background: var(--weiss); border: 1px solid var(--grau-rand);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
    box-shadow: var(--schatten);
}
.box-hinweis { color: var(--text-leise); }
.hinweis { font-size: 13px; color: var(--text-leise); }
.leise { color: var(--text-leise); font-size: 13px; }

/* --- KPIs --- */
.kpi-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kpi {
    background: var(--weiss); border: 1px solid var(--grau-rand); border-radius: var(--radius-sm);
    padding: 6px 10px; text-align: center; box-shadow: var(--schatten); flex: 1 1 90px;
}
.kpi-wert { font-family: 'Ubuntu', sans-serif; font-size: 18px; font-weight: 700; color: var(--braun); line-height: 1.2; }
.kpi-label { font-size: 10px; color: var(--text-leise); }

/* --- Tag-Boxen (Dashboard) --- */
.tag-box-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.tag-box-zahlen { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--text-leise); }
.tag-box-zahlen b { color: var(--text); }

/* --- Chips --- */
.chip {
    display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px;
    border-radius: 10px; background: var(--creme); color: var(--braun-hell);
}
.chip-gruen { background: var(--ok-bg); color: var(--ok-tx); }

/* --- Tabelle --- */
/* KEIN overflow:hidden hier (früher für die abgerundeten Ecken gesetzt) -
   overflow ungleich "visible" auf der Tabelle selbst erzeugt einen eigenen
   Scroll-Kontext und verankert eine sticky-positionierte th (siehe
   .liste-scroll weiter oben) dann an DIESEM Kontext statt am eigentlich
   gewollten .liste-scroll-Container - dadurch bleibt der Tabellenkopf beim
   Scrollen NICHT stehen. Die abgerundeten Ecken werden stattdessen gezielt
   an den vier Eck-Zellen gesetzt (siehe unten), sieht optisch identisch aus. */
.tabelle { width: 100%; border-collapse: collapse; background: var(--weiss); border-radius: var(--radius); box-shadow: var(--schatten); }
.tabelle thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.tabelle thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.tabelle tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.tabelle tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
.tabelle th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-leise); background: var(--creme); padding: 9px 11px;
}
.tabelle td { padding: 9px 11px; border-top: 1px solid var(--grau-rand); vertical-align: middle; }
.tabelle tr:hover td { background: var(--creme-hover); }
.tabelle .aktionen { text-align: right; white-space: nowrap; }
code.code {
    background: var(--creme); padding: 3px 8px; border-radius: var(--radius-sm);
    font-size: 14px; letter-spacing: .06em; color: var(--braun);
}

/* --- Zelt-Boxen --- */
.zelt-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.zelt-box-kopf { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* --- Dialoge --- */
dialog {
    border: none; border-radius: var(--radius); box-shadow: 0 8px 30px rgba(74,61,44,.25);
    padding: 22px; width: min(480px, 92vw);
}
dialog::backdrop { background: rgba(43,38,32,.45); }
dialog h3 { margin: 0 0 14px; }
/* Verein-Name bleibt beim Scrollen im (langen) Vereins-Dialog sichtbar - der
   <dialog>-Rahmen selbst ist der Scroll-Container, daher genügt sticky ohne
   HTML-Umbau. Negative Ränder + zusätzliches Padding gleichen das eigene
   padding:22px des dialog-Elements aus, damit der Balken randlos volle
   Breite deckt (sonst schiene links/rechts noch Inhalt durch). */
#dlg-verein-titel {
    position: sticky;
    top: -22px;
    z-index: 2;
    background: var(--weiss);
    margin: -22px -22px 14px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--grau-rand);
}
dialog label { margin-bottom: 10px; }
.dialog-zeile { display: flex; gap: 10px; }
.dialog-zeile label { flex: 1; }
/* Eingabefeld an der Unterkante ausrichten, auch wenn der Hinweistext einer
   Nachbar-Spalte in derselben Zeile mehrzeilig ist – sonst stehen die
   Felder je nach Textlänge auf unterschiedlicher Höhe. */
.dialog-zeile label:not(.check) { display: flex; flex-direction: column; }
.dialog-zeile label:not(.check) > input,
.dialog-zeile label:not(.check) > select,
.dialog-zeile label:not(.check) > textarea { margin-top: auto; }
.dialog-aktionen { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --- Vereins-Ansicht --- */
.meldung-kopf { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.meldung-eingabe { display: flex; gap: 8px; margin-bottom: 6px; }
.meldung-eingabe input { max-width: 130px; margin: 0; }
/* Schnell-Editiermodus in der Meldungen-Liste */
.schnell-eingabe { max-width: 70px; margin: 0; padding: 5px 6px; }

/* --- Suche --- */
input[type=search] { max-width: 320px; margin-bottom: 12px; }

@media (max-width: 560px) {
    .dialog-zeile { flex-direction: column; gap: 0; }
    .kopf { padding: 10px 12px; }
    .wrap { padding: 12px; }
}

/* --- Lesezugriff-Banner (Rollen ohne Schreibrecht) --- */
.lese-hinweis {
    background: var(--warte-bg);
    color: var(--warte-tx);
    border-bottom: 1px solid var(--grau-rand);
    padding: 7px 20px;
    font-size: 13px;
}
.lese-hinweis .ti { margin-right: 4px; }

/* --- Testdatenbank-Banner (nur für die eigene Session aktiv) --- */
.test-db-hinweis {
    background: var(--gefahr);
    color: #fff;
    padding: 7px 20px;
    font-size: 13px;
    font-weight: 600;
}
.test-db-hinweis .ti { margin-right: 4px; }

/* --- v0.3.0: Kopfzeilen-Logos --- */
.kopf-logo { height: 40px; max-width: 90px; object-fit: contain; }

/* --- v0.3.0: Fest-Tab Logo-Verwaltung --- */
.logo-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grau-rand); }
.logo-zeile:last-of-type { border-bottom: none; }
.logo-vorschau { display: block; height: 48px; max-width: 140px; object-fit: contain; margin-top: 4px; }
.wappen-mini { height: 26px; max-width: 40px; object-fit: contain; vertical-align: middle; }

/* --- v0.3.0: Vereine-Filter --- */
.filter-zeile { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.filter-zeile input[type=search] { margin-bottom: 0; }
.filter-zeile select { max-width: 200px; }

/* --- v0.3.0: breiter Dialog + Kapellen-Editor --- */
dialog.dialog-breit { width: min(640px, 94vw); }
.kapelle-zeile { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.kapelle-zeile input { flex: 2; margin: 0; }
.kapelle-zeile select { flex: 1; margin: 0; }

/* --- v0.3.0: Sonderwunsch-Status --- */
.chip-rot { background: #F5DFDF; color: var(--gefahr); }

/* --- v0.4.0: Meldungen --- */
.benoetigt-eingabe { width: 90px; margin: 0; }
.tabelle tfoot th { background: var(--creme); text-align: left; padding: 8px 12px; }
.log-zeile { padding: 6px 0; border-bottom: 1px solid var(--grau-rand); font-size: 14px; }
.log-zeile:last-child { border-bottom: none; }
.kapellen-meldung { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.kapellen-meldung .check { font-size: 14px; }

/* --- v0.4.1: sortierbare Spaltenköpfe --- */
th.sortierbar { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortierbar:hover { color: var(--gold-dunkel); }
.kapelle-neu-zeile { display: flex; gap: 6px; margin: 4px 0; }
.kapelle-neu-zeile input, .kapelle-neu-zeile select { margin: 0; }

/* --- v0.5.0: Zeltplan-Grid --- */
dialog.dialog-plan { width: min(860px, 96vw); }
.bloecke-tabelle input { width: 64px; margin: 0; display: inline-block; }
.bloecke-tabelle td { white-space: nowrap; }
.zp-zeile { display: flex; gap: 14px; margin-bottom: 14px; }
.zp-block { flex: 1; background: var(--weiss); border: 1px solid var(--grau-rand); border-radius: var(--radius-sm); padding: 8px; min-height: 54px; }
.zp-block.zp-leer { display: flex; align-items: center; justify-content: center; background: transparent; border-style: dashed; text-align: center; }
.zp-block-titel { font-size: 11px; color: var(--text-leise); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.zp-reihe { display: flex; gap: 4px; margin-bottom: 4px; flex-wrap: wrap; }
.zp-tisch { width: 34px; height: 26px; display: flex; align-items: center; justify-content: center;
    background: var(--creme); border: 1px solid var(--gold-dunkel); border-radius: 4px;
    font-size: 11px; font-weight: 600; color: var(--braun); cursor: default; }
.zp-tisch[onclick] { cursor: pointer; }
.zp-tisch[onclick]:hover { background: var(--gold); color: #fff; }
.zp-tisch.zp-musik { background: #DCE9F5; border-color: #4A76A8; color: #2C4A6E; }
.zp-tisch.zp-foh { background: #E7DFF0; border-color: #7B5EA7; color: #4C3A6B; }
.zp-tisch.zp-theke { background: #F0E6D2; border-color: var(--gold-dunkel); color: var(--braun); }
.zp-thron { background: var(--braun); color: var(--creme); text-align: center; padding: 10px;
    border-radius: var(--radius-sm); margin: 0 25% 14px; font-family: 'Ubuntu', sans-serif; letter-spacing: .1em; }
.zp-eingang { text-align: center; padding: 6px; color: var(--gold-dunkel); font-weight: 600; letter-spacing: .08em; }
.zp-eingang-leise { color: var(--text-leise); font-weight: 400; }

/* --- v0.6.0: Verteilung & Belegungsgrafik --- */
.verteilung-box { margin-bottom: 14px; }
.verteilung-box-test { background: #FBF2DD; border-color: #E0C179; }
.verteilung-test-steuer { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.verteilung-liste { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.vert-eintrag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
    border-radius: 20px; border: 1px solid var(--grau-rand); background: var(--weiss); font-size: 14px; }
.vert-eintrag a { color: inherit; text-decoration: none; }
.vert-ok { border-color: #2E6B33; background: var(--ok-bg); }
.vert-teil { border-color: #936C12; background: var(--warte-bg); }
.vert-aktiv { outline: 2px solid var(--gold); }
/* Zeltverbund: alle Zelte nahtlos nebeneinander (horizontal scrollbar),
   Breite ergibt sich proportional aus den Blöcken (Tische à feste Breite) */
.belegung-zelte { display: flex; gap: 0; flex-wrap: nowrap; align-items: stretch;
    overflow-x: auto; padding-bottom: 8px; }
/* Nur auf dem Ausdruck: shrink-to-fit statt volle Breite auszufüllen. Ohne
   das würde sich die Zeile beim Messen (siehe btn-sitzplan-drucken) auf die
   volle Fensterbreite dehnen (flex-grow verteilt dann echten Leerraum auf
   jedes Zelt), was die gemessene Gesamtbreite unnötig aufbläht und dadurch
   die errechnete Druck-Skalierung kleiner ausfallen lässt, als nötig wäre. */
.belegung-zelte-druck { width: fit-content; }
/* min-width:0 überschreibt die automatische Mindestbreite, die Flex-Items
   sonst von Haus aus bekommen (= ihr Inhalt darf sonst nie unter dessen
   eigene Content-Größe schrumpfen) - ohne das verhinderte ein breites
   Sponsor-Logo (width:100%, siehe .bg-zelt-logo) das Schrumpfen der Spalte
   auf die per flex-grow vorgesehene, proportionale Breite und riss
   dadurch alle Zelte extrem breit. */
.belegung-zelt { background: var(--weiss); border: 1px solid var(--grau-rand); border-radius: 0;
    padding: 10px; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.belegung-zelt + .belegung-zelt { border-left: none; }
.belegung-zelt:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.belegung-zelt:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.belegung-zelt-kopf { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
/* Füllt den Rest der (gleich hohen) Karte, damit das Sponsor-Logo darunter
   bei allen Zelten exakt in einer Reihe steht. */
.belegung-zelt-inhalt { flex: 1 1 auto; }
.bg-zelt-logo { display: block; width: 100%; height: auto; margin: 8px auto 0; }
.bg-grid { }
/* justify-content:center statt space-between: bei Zelten ohne Thron/Eingang
   in der Mitte (also die meisten Zeilen) blieben die linke/rechte
   Tischgruppe sonst weit auseinandergezogen, sobald die per flex-grow
   zugeteilte Spaltenbreite (siehe zeltSpalten()) etwas mehr Platz bot als
   das Tisch-Grid selbst braucht - unnötig verschenkter Platz, der die
   Gesamtbreite (und damit die Skalierung, siehe btn-sitzplan-drucken)
   unnötig aufblies. Bei Thron/Eingang (flex:1 dazwischen, siehe
   .bg-thron/.bg-eingang-mitte) ändert das nichts, da deren Wachstum den
   verfügbaren Platz ohnehin zuerst aufbraucht. */
.bg-zeile { display: flex; gap: 12px; margin-bottom: 8px; align-items: stretch; justify-content: center; }
.bg-block { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; min-height: 12px; }
/* Leere Blöcke bleiben optisch leer, reservieren aber horizontal ihren Platz */
.bg-block.bg-leer { min-width: 40px; }
/* Grid wächst nicht – dadurch beginnen die Vereinslisten aller Zelte auf gleicher Höhe */
.bg-grid { flex: 0 0 auto; }
.bg-zeile { align-content: flex-start; }
/* Vereinsliste darf die Zeltbreite nicht aufblähen (Breite folgt dem Grid);
   Nummer- und Pl./T.-Spalte bleiben einzeilig, die Namensspalte nimmt den
   Rest der Breite und darf umbrechen. */
.bg-vereine { min-width: 100%; width: 0; border-collapse: collapse; }
.bg-vereine-name { width: 100%; }
.bg-vereine-name a { overflow-wrap: anywhere; }
.bg-tisch { width: 24px; height: 20px; font-size: 10px; font-weight: 600; display: flex;
    align-items: center; justify-content: center; border-radius: 3px; cursor: pointer;
    border: 1px solid var(--grau-rand); background: var(--grau-bg); color: var(--text-leise); }
.bg-frei:hover { background: var(--creme-hover); border-color: var(--gold); }
.bg-belegt { background: var(--creme); border-color: var(--gold-dunkel); color: var(--braun); }
.bg-sonder { background: #EEE; color: #999; }
/* Zusammengefasster Block mehrerer zusammenhängender Musik-/FOH-/Theke-Tische
   (auch über mehrere Reihen hinweg) – Größe kommt vollständig aus der
   grid-column/grid-row-Spanne, die beim Rendern inline gesetzt wird. */
.bg-tisch-block { width: 100%; height: 100%; font-size: 9px; font-weight: 600; display: flex; align-items: center;
    justify-content: center; border-radius: 3px; border: 1px solid var(--grau-rand);
    background: #EEE; color: #999; white-space: nowrap; overflow: hidden; }
/* Stehtisch-Spalte: eigene Grid-Zelle je Reihe, kann mehrere Kreise nebeneinander enthalten */
.bg-steh-zelle { display: flex; align-items: center; gap: 2px; }
.bg-markiert { background: var(--gold); border-color: var(--braun); color: #fff; box-shadow: 0 0 0 2px var(--gold); }
/* Passender zusammenhängender freier Tisch im manuellen Zuweisen-Modus */
.bg-tisch.bg-passt { background: #E3F2E3; border-color: #3E9C46; box-shadow: 0 0 0 2px #8CD08C; }
.bg-tisch.bg-passt:hover { background: #D2ECD2; }
/* Gemeldet/Zugewiesen je Tag in der Vereinsliste */
.pt { display: inline-block; white-space: nowrap; }
.bg-thron { flex: 1; min-width: 30px; display: flex; align-items: center; justify-content: center;
    background: var(--creme); border: 1px solid var(--gold-dunkel); border-radius: 4px;
    color: var(--braun); font-weight: 700; }
.bg-eingang-mitte { flex: 1; min-width: 30px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center; font-size: 11px; line-height: 1.3;
    color: var(--gold-dunkel); font-weight: 600; }
/* Unsichtbares Gegenstück zu .bg-thron/.bg-eingang-mitte für Zeilen ohne
   Thron/Eingang - schiebt den linken/rechten Block je an seinen äußeren
   Rand statt sie als Gruppe zu zentrieren (siehe miniGrid() in app.js). */
.bg-zeile-spacer { flex: 1; min-width: 0; }
.bg-vereine { margin: 8px 0 0; font-size: 13px; }
.bg-vereine td { padding: 2px 4px 2px 0; border-bottom: 1px dashed var(--grau-rand); vertical-align: top; }
.bg-vereine tr:last-child td { border-bottom: none; }
.bg-vereine a { color: inherit; text-decoration: none; }
.bg-vereine-nr, .bg-vereine-zahl { white-space: nowrap; }
.bg-vereine-zahl { text-align: right; padding-right: 0; }
.bg-verein-markiert td { background: var(--creme); }

/* --- v0.6.0: Zeltplan-Erweiterungen --- */
.zp-tisch.zp-leer { background: repeating-linear-gradient(45deg, #eee, #eee 3px, #f8f8f8 3px, #f8f8f8 6px); border-color: #bbb; color: #999; }
.zp-tisch.zp-belegt { box-shadow: inset 0 0 0 2px var(--gold); }
.zp-tisch.zp-ausnahme { outline: 2px dashed #936C12; outline-offset: 1px; }
.zp-thron-mitte { flex: 0 0 90px; margin: 0; display: flex; align-items: center; justify-content: center; }

/* --- v0.6.0: Kontextmenü --- */
.kontextmenu { position: fixed; z-index: 1000; background: var(--weiss); border: 1px solid var(--grau-rand);
    border-radius: var(--radius-sm); box-shadow: 0 6px 24px rgba(74,61,44,.25); padding: 6px; min-width: 210px; }
.kontextmenu .km-titel { font-size: 12px; color: var(--text-leise); padding: 4px 8px; }
.kontextmenu button { display: block; width: 100%; text-align: left; background: none; border: none;
    padding: 7px 10px; border-radius: 4px; cursor: pointer; color: var(--text); font-size: 14px; }
.kontextmenu button:hover { background: var(--creme); }
.kontextmenu .km-trennung { border-top: 1px solid var(--grau-rand); margin-top: 4px; border-radius: 0 0 4px 4px; }
.log-box { max-height: 220px; overflow-y: auto; }

/* --- v0.6.0: Responsive Tabellen (Fehler 3) --- */
#vereine-liste, #meldungen-liste, #tage-liste, #benutzer-liste, #sonderwuensche-liste { overflow-x: auto; }
#vereine-liste .tabelle, #meldungen-liste .tabelle { min-width: 720px; }
@media (max-width: 700px) {
    .zp-tisch { width: 26px; height: 22px; }
}
.sv-zelt { display: block; width: 100%; text-align: left; margin-bottom: 6px; background: var(--weiss);
    color: var(--text); border: 1px solid var(--grau-rand); }
.sv-zelt:hover:not(:disabled) { border-color: var(--gold); background: var(--creme-hover); }
.sv-zelt.sv-voll { opacity: .5; }

/* --- v0.6.1: Aktionen-Spalte bleibt beim horizontalen Scrollen sichtbar --- */
.tabelle td.aktionen, .tabelle th:last-child {
    position: sticky; right: 0; background: var(--weiss);
    box-shadow: -6px 0 8px -6px rgba(74,61,44,.25);
}
.tabelle thead th:last-child { background: var(--creme); }
.tabelle tr:hover td.aktionen { background: var(--creme-hover); }

/* --- v0.6.2: Verteilungs-Steuerzeile --- */
.verteilung-steuer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verteilung-steuer select { max-width: 460px; margin: 0; }
#verteilung-amt-filter { max-width: 180px; }
.gefahr-rand { color: var(--gefahr); }

/* --- Verteilungs-Panel: durchsuchbare Vereinsauswahl --- */
.kombo { position: relative; display: inline-block; }
/* input[type=text] hat ohne explizite Breite nur die winzige Browser-
   Standardbreite (~20 Zeichen) – hier fest breit genug für übliche
   Vereinsnamen, schrumpft auf schmalen Bildschirmen über max-width. */
.kombo input[type=text] { width: 340px; max-width: 100%; margin: 0; padding-right: 26px; }
.kombo-leeren {
    position: absolute; right: 2px; top: 2px; bottom: 2px; padding: 0 7px;
    background: none; color: var(--text-leise); border: none; border-radius: var(--radius-sm);
}
.kombo-leeren:hover { background: var(--creme-hover); color: var(--braun); }
/* Als echte Tabelle aufgebaut, damit Amt/Ort/Verein/Sitzplätze/Tische/Haken
   sauber untereinander fluchten. width:max-content ohne max-width, damit die
   längste Zeile immer ohne Umbruch/horizontalen Scrollbalken hineinpasst. */
.kombo-liste {
    position: absolute; top: 100%; left: 0; z-index: 50; margin: 2px 0 0;
    background: var(--weiss); border: 1px solid var(--grau-rand); border-radius: var(--radius-sm);
    box-shadow: 0 6px 24px rgba(74,61,44,.25); max-height: 340px; overflow-y: auto;
    min-width: 100%; width: max-content;
}
.kombo-tabelle { border-collapse: collapse; font-size: 13px; }
.kombo-tabelle th, .kombo-tabelle td { padding: 6px 12px; white-space: nowrap; text-align: left; }
.kombo-tabelle thead th {
    position: sticky; top: 0; background: var(--weiss); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em; color: var(--text-leise);
    border-bottom: 1px solid var(--grau-rand); cursor: pointer; user-select: none;
}
.kombo-tabelle thead th:hover { color: var(--gold-dunkel); }
.kombo-tabelle tbody tr { cursor: pointer; }
.kombo-tabelle tbody tr:hover { background: var(--creme); }
.kombo-tabelle td.kombo-leer { color: var(--text-leise); cursor: default; text-align: center; }
.kombo-haken { text-align: center; font-weight: 700; }

/* --- v0.6.4: Vereinsdialog-Abschnitte --- */
.dlg-abschnitt { margin-top: 16px; border-top: 1px solid var(--grau-rand); padding-top: 8px; }
.dlg-gruppe { border: 1px solid var(--grau-rand); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin-bottom: 10px; background: var(--grau-bg); }
.dlg-gruppe-titel { font-family: 'Ubuntu', sans-serif; font-weight: 500; color: var(--braun); font-size: 13px; margin-bottom: 4px; }
/* Einmarschrichtung-Editor (Übersicht) */
.einmarsch-editor { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.einmarsch-editor label { display: flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }
.einmarsch-editor select { max-width: 210px; margin: 0; }
.einmarsch-editor .leise { margin: 0; }
/* Einmarsch-Pfeil in der Belegungsgrafik */
.bg-einmarsch { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 700;
    color: #fff; background: var(--gold); border-radius: 4px; padding: 1px 6px; margin: 3px 0; letter-spacing: .02em; }
.bg-einmarsch .pfeil { font-size: 15px; line-height: 1; }
/* Reserviert dieselbe Höhe wie .bg-einmarsch, wenn gerade kein Marschweg
   durch dieses Zelt führt – verhindert optisches Springen der Zelt-Höhen. */
.bg-einmarsch-leer { visibility: hidden; }
/* Im Hauptzelt: Marschweg beginnt in der Mitte (vor dem Thron) und geht nur
   zu einer Seite, nicht über die ganze Zeltbreite. */
.bg-einmarsch-halb { display: flex; gap: 12px; }
.bg-einmarsch-halb-slot { flex: 1; display: flex; min-width: 0; }
.bg-einmarsch-halb-slot .bg-einmarsch { flex: 1; }
.bg-einmarsch-halb-slot:empty { visibility: hidden; }

/* --- v1.4.0: Marschreihenfolge (Drag & Drop) --- */
.marsch-liste { list-style: none; margin: 0; padding: 0; font-size: 16px; }
.marsch-eintrag {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: var(--weiss); border: 1px solid var(--grau-rand); border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.marsch-eintrag[draggable="true"] { cursor: grab; }
.marsch-eintrag[draggable="true"]:active { cursor: grabbing; }
.marsch-eintrag > i.ti { font-size: 20px; }
.marsch-griff { color: var(--text-leise); }
.marsch-nr-live {
    min-width: 30px; text-align: center; font-weight: 700; color: var(--braun);
    background: var(--creme); border-radius: var(--radius-sm); padding: 3px 5px;
}
input.marsch-nr-eingabe {
    width: 44px; border: 1px solid transparent; font: inherit; margin: 0;
}
input.marsch-nr-eingabe:hover, input.marsch-nr-eingabe:focus { border-color: var(--gold-dunkel); }
.marsch-name { flex: 1; }
.marsch-name i.ti { font-size: 18px; }
.marsch-kapellen { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* --- v1.8.0: Züge & separat marschierende Kapellen --- */
.marsch-zug-badge {
    display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--gold-dunkel);
    background: var(--creme); border: 1px solid var(--grau-rand); border-radius: 999px; padding: 2px 9px;
}
.marsch-kapelle-tag {
    display: inline-flex; align-items: center; gap: 2px; background: var(--grau-bg);
    border: 1px solid var(--grau-rand); border-radius: var(--radius-sm); padding: 2px 3px 2px 9px;
    font-size: 14px;
}
.marsch-kapelle-tag .klein { padding: 2px 7px; font-size: 13px; }
/* Kapelle mit eigener Position: farblich abgesetzt, aber auf gleicher Höhe/Schriftgröße wie die anderen Zeilen */
.marsch-kapelle-zeile { background: var(--creme-hover); border-style: dashed; }
/* Gast, Gruppe, Sonstige: eigene helle Hintergrundfarbe, unterscheidbar von abgekoppelten Kapellen */
.marsch-typ-besonders { background: #EAF0F5; }
.marsch-festkapelle-badge {
    display: inline-block; font-size: 13px; font-weight: 700; color: var(--braun); white-space: nowrap;
    background: var(--creme); border: 1px solid var(--gold); border-radius: 999px; padding: 2px 10px;
}
.marsch-gemeldet { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.marsch-summe { text-align: right; font-weight: 600; margin-top: 4px; }

/* --- Einmarsch-Modus: Sitzplan-Nummer, Einmarschrichtung und Aktionen als
   feste Spalten (statt im flexiblen Namensbereich) - dadurch stehen sie
   über alle Zeilen hinweg untereinander wie Tabellenspalten, unabhängig
   von der Länge des davorstehenden Vereinsnamens. */
.marsch-zelt-tisch-spalte {
    flex: 0 0 130px; font-size: 14px; font-weight: 600; color: var(--braun);
}
.marsch-richtung-spalte { flex: 0 0 132px; }
.marsch-einmarsch-richtung {
    display: inline-block; font-weight: 600; color: var(--braun); background: var(--creme);
    border: 1px solid var(--grau-rand); border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.marsch-aktionen-spalte { flex: 0 0 auto; min-width: 96px; display: flex; gap: 4px; }

/* --- v1.4.0: Stehtische (inoffizielle Zusatzkapazität im Belegungsraster) --- */
.bg-stehtisch {
    width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--creme-hover); border: 1px dashed var(--gold-dunkel);
    font-size: 9px; font-weight: 600; color: var(--braun); cursor: default;
}
.bg-stehtisch[onclick] { cursor: pointer; }
.bg-stehtisch[onclick]:hover { background: var(--gold); color: #fff; }
.bg-stehtisch-neu { background: transparent; color: var(--text-leise); font-size: 13px; }

/* --- v1.4.0: Druck (Marschreihenfolge, Schießliste, Sitzplatzverteilung) ---
   .nur-druck-Container sind im Bildschirmbetrieb unsichtbar; beim Drucken wird
   die restliche Kopfzeile/Navigation ausgeblendet und nur der jeweilige
   Druck-Container gezeigt. body.app-body ist normalerweise ein Flex-Gerüst mit
   overflow:hidden (siehe Scrollbalken-Feature) – das würde gedruckten Inhalt
   abschneiden, daher hier für den Druckfall zurückgesetzt. */
.nur-druck { display: none; }
@media print {
    /* Sonst schlägt die überall geltende "body { background: var(--grau-bg); }"
       (siehe oben) bei aktiviertem "Hintergrundgrafiken drucken" überall dort
       durch, wo kein anderer Inhalt sie überdeckt (z. B. neben schmaleren
       Zelten oder unter der Kopfzeile) - unerwünscht, die farbige
       Tisch-Hervorhebung selbst bleibt davon unberührt (eigene Regeln). */
    body { background: none !important; }
    body.app-body { display: block !important; height: auto !important; overflow: visible !important; }
    body.app-body > .kopf, body.app-body > .hauptmenue, body.app-body > .lese-hinweis,
    body.app-body > .test-db-hinweis { display: none !important; }
    body.app-body > .wrap { display: block !important; overflow: visible !important; padding: 0; }
    body.app-body > .wrap > *:not(.nur-druck) { display: none !important; }
    .nur-druck { display: block !important; }
    @page { margin: 5mm; }
    /* Marschreihenfolge/Einmarschreihenfolge kompakter: die Boxen-Optik
       (Rahmen, Radius, Abstand) der Bildschirmliste macht auf Papier bei
       vielen Zeilen unnötig viele Seiten - stattdessen nur eine dünne
       Trennlinie je Zeile. */
    #druck-marschreihenfolge .marsch-eintrag {
        border: none; border-radius: 0; margin-bottom: 0; padding: 4px 2px;
        border-bottom: 1px solid var(--grau-rand); background: none !important;
    }
    #druck-marschreihenfolge .marsch-liste { font-size: 13px; }
    /* Die Sitzplan-Nummer ist die für den Ausdruck wichtigste Information
       (wo steht der Verein) - deutlich größer als der Rest der Zeile. */
    #druck-marschreihenfolge .marsch-zelt-tisch-spalte { flex-basis: 150px; font-size: 17px; }
}

/* --- v1.7.0: Sitzplan-Ausdruck – Kopf-/Fußzeile --- */
.druck-kopf { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.druck-logo { max-width: 130px; max-height: 60px; object-fit: contain; flex: 0 0 auto; }
.druck-titel { flex: 1 1 auto; text-align: center; }
.druck-titel h1 { font-family: 'Ubuntu', sans-serif; font-size: 20px; margin: 0; color: var(--braun); }
.druck-titel h2 { font-size: 13px; font-weight: 400; margin: 2px 0 0; color: var(--text-leise); }
/* Zelt-Kopf im Ausdruck: nur die zentrierte Zeltnummer (kein Sponsorname,
   keine Belegungszahl - siehe belegungKartenHtml()). */
.belegung-zelt-kopf-druck { justify-content: center; text-align: center; }
