:root {
  --lila: #5b2a86; --lila-hell: #ece3f5; --lila-dunkel: #3f1c5e;
  --bg: #f7f5fa; --flaeche: #ffffff; --text: #1f1a26; --leise: #6a6375; --rand: #ddd6e6;
  --gruen: #1f7a3d; --gruen-hell: #e3f4e8; --rot: #b3261e; --rot-hell: #fbe4e2; --gelb: #f6d24a; --gelb-hell: #fff6d6;
  --sitz-frei: #ffffff; --sitz-frei-rand: #8f84a0; --sitz-belegt: #c9c4d1; --sitz-gesperrt: #4a4452; --sitz-rolli: #dbe9fb;
  --radius: 12px; --schatten: 0 1px 3px rgba(40, 20, 60, .08), 0 4px 16px rgba(40, 20, 60, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --lila: #b48ae0; --lila-hell: #2f2440; --lila-dunkel: #d9c3f3;
    --bg: #15121a; --flaeche: #1f1b26; --text: #ece8f2; --leise: #a59fb0; --rand: #3a3346;
    --gruen: #6fd08f; --gruen-hell: #193323; --rot: #ff8a80; --rot-hell: #3a1b1a; --gelb: #f6d24a; --gelb-hell: #3a3215;
    --sitz-frei: #2a2433; --sitz-frei-rand: #8d82a0; --sitz-belegt: #4a4454; --sitz-gesperrt: #0d0b10; --sitz-rolli: #22344d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: 40px; outline: none; }
a { color: var(--lila); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.2rem; margin: 0 0 .4em; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.wrap.breit { max-width: 1280px; }
.wrap.schmal { max-width: 520px; }
.sprung { position: absolute; left: -999px; }
.sprung:focus { left: 8px; top: 8px; z-index: 10; background: var(--flaeche); padding: 8px; }

.band { padding: 7px 16px; font-size: .9rem; text-align: center; }
.band.gelb { background: var(--gelb); color: #2b2300; font-weight: 600; }
.band.demo { background: var(--lila-hell); display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; }
.band.demo select { width: auto; padding: 4px 8px; }

.kopf { background: var(--flaeche); border-bottom: 1px solid var(--rand); position: sticky; top: 0; z-index: 5; }
.kopf-innen { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.marke { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.1rem; }
.marke small { font-weight: 500; color: var(--leise); }
.marke-zeichen { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--lila); color: #fff; font-size: 1.1rem; }
@media (prefers-color-scheme: dark) { .marke-zeichen { color: #1f1b26; } }
#nav { display: flex; gap: 2px; flex-wrap: wrap; }
#nav a { text-decoration: none; color: var(--text); padding: 8px 11px; border-radius: 8px; font-weight: 500; }
#nav a:hover { background: var(--lila-hell); }
#nav a[aria-current] { background: var(--lila); color: #fff; }
@media (prefers-color-scheme: dark) { #nav a[aria-current] { color: #1f1b26; } }
@media (max-width: 640px) { .kopf { position: static; } #nav { width: 100%; padding-bottom: 8px; } #nav a { padding: 6px 9px; font-size: .95rem; } }

.fuss { border-top: 1px solid var(--rand); padding: 18px 0; color: var(--leise); font-size: .9rem; }
.fuss a { color: var(--leise); }

.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--schatten); }
.karte-kopf { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
details.karte > summary, details > summary { cursor: pointer; font-weight: 600; }
.karte.gefahr summary { color: var(--rot); }
.seitenkopf { margin: 18px 0 6px; }
.ueberzeile { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--lila); margin: 0; }
.leise { color: var(--leise); }
.klein { font-size: .88rem; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.mitte { text-align: center; }
.leer { color: var(--leise); text-align: center; padding: 24px 8px; }
.zeile { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.zeile.zwischen { justify-content: space-between; }
.zeile.rechts { justify-content: flex-end; }
.stapel { display: flex; flex-direction: column; gap: 12px; }
.held { padding: 26px 0 8px; }
.held h1 { font-size: 2rem; }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
  padding: 9px 16px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; }
.knopf:hover { border-color: var(--lila); }
.knopf.primaer { background: var(--lila); border-color: var(--lila); color: #fff; }
@media (prefers-color-scheme: dark) { .knopf.primaer { color: #1f1b26; } }
.knopf.geist { background: transparent; }
.knopf.rot { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.klein { padding: 4px 10px; min-height: 32px; font-size: .88rem; }
.knopf.gross { padding: 13px 20px; font-size: 1.05rem; }
.knopf.voll { width: 100%; }
.knopf:disabled { opacity: .55; cursor: not-allowed; }
.knopf.laedt { cursor: progress; }
.knopf:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .sitz:focus-visible rect { outline: 3px solid var(--lila); outline-offset: 2px; }

input, select, textarea { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 42px; }
textarea { min-height: 120px; resize: vertical; }
.feld { display: flex; flex-direction: column; gap: 4px; }
.feld > span { font-size: .88rem; font-weight: 600; color: var(--leise); }
.haken { display: flex; gap: 10px; align-items: start; }
.haken input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--lila); }

.hinweis { border-radius: 9px; padding: 10px 14px; margin: 10px 0; }
.hinweis.gelb { background: var(--gelb-hell); border: 1px solid var(--gelb); }
.hinweis.rot { background: var(--rot-hell); color: var(--rot); }
.hinweis.gruen { background: var(--gruen-hell); }
.status { font-weight: 600; }
.status.gruen { color: var(--gruen); }

.abende { list-style: none; margin: 10px 0 0; padding: 0; }
.abende li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rand); }
.abende li > div:first-child { display: flex; flex-direction: column; }
.abende li.vorbei { opacity: .5; }
.abende .frei { color: var(--leise); font-size: .9rem; white-space: nowrap; }
@media (max-width: 520px) { .abende li { grid-template-columns: 1fr auto; } .abende li .knopf { grid-column: 1 / -1; } }

/* Buchen */
.buchen-raster { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .buchen-raster { grid-template-columns: 1fr; } }
.auswahl { position: sticky; top: 74px; }
@media (max-width: 900px) { .auswahl { position: static; } }
.saal-karte { padding: 10px; }
.saal-leiste { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.saal-rahmen { overflow: auto; max-height: 72vh; border-radius: 8px; background: var(--bg); -webkit-overflow-scrolling: touch; }
.saal-innen { min-width: 100%; }
.saal { display: block; width: 100%; height: auto; user-select: none; }
.saal .buehne { fill: var(--lila-hell); stroke: var(--lila); stroke-width: .06; }
.saal .buehne-text { font-size: 1.1px; font-style: italic; fill: var(--lila); }
.saal .reihe-nr, .saal .loge-nr { font-size: .62px; fill: var(--leise); font-weight: 700; }
.sitz rect { fill: var(--sitz-frei); stroke: var(--sitz-frei-rand); stroke-width: .05; }
.sitz text { font-size: .36px; fill: var(--text); pointer-events: none; }
.sitz.rolli rect { fill: var(--sitz-rolli); }
.sitz.rolli text { font-size: .5px; }
.sitz[role=button] { cursor: pointer; }
.sitz.frei[role=button]:hover rect { stroke: var(--lila); stroke-width: .12; }
.sitz.gewaehlt rect { fill: var(--lila); stroke: var(--lila); }
.sitz.gewaehlt text { fill: #fff; font-weight: 700; }
.sitz.meins rect { fill: var(--lila-hell); stroke: var(--lila); stroke-width: .14; }
.sitz.verkauft rect { fill: var(--sitz-belegt); stroke: none; }
.sitz.verkauft text { fill: var(--leise); }
.sitz.gesperrt rect, .sitz.gesperrt-abend rect { fill: var(--sitz-gesperrt); stroke: none; }
.sitz.gesperrt text, .sitz.gesperrt-abend text { fill: #aaa; }
.sitz.gesperrt-abend rect { fill: #7a5a2a; }
.sitz.markiert rect { fill: #e8a33d; stroke: #7a4b00; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--leise); margin-top: 8px; }
.legende span { display: inline-flex; gap: 5px; align-items: center; }
.l { display: inline-grid; place-items: center; width: 16px; height: 14px; border-radius: 3px; border: 1px solid var(--sitz-frei-rand); background: var(--sitz-frei); font-style: normal; font-size: 10px; }
.l.gewaehlt { background: var(--lila); border-color: var(--lila); }
.l.meins { background: var(--lila-hell); border: 2px solid var(--lila); }
.l.verkauft { background: var(--sitz-belegt); border-color: transparent; }
.l.gesperrt { background: var(--sitz-gesperrt); border-color: transparent; }
.l.rolli { background: var(--sitz-rolli); }
.gewaehlt-liste { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.gewaehlt-liste li { border: 1px solid var(--rand); border-radius: 9px; padding: 8px 10px; }
.summe { display: flex; justify-content: space-between; font-size: 1.1rem; border-top: 1px solid var(--rand); padding-top: 10px; }
.erfolg { text-align: center; }
.erfolg ul { list-style: none; padding: 0; }
.erfolg .zeile { justify-content: center; }
.haken-gross { width: 64px; height: 64px; border-radius: 50%; background: var(--gruen); color: #fff; font-size: 2rem; display: grid; place-items: center; margin: 6px auto; }

/* Karten */
.ticket-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 10px; }
.ticket { display: flex; gap: 12px; border: 1px solid var(--rand); border-radius: 10px; padding: 10px; align-items: center; }
.ticket.ungueltig { opacity: .55; }
.ticket .qr { width: 84px; height: 84px; flex: none; padding: 0; border: 0; background: #fff; border-radius: 6px; cursor: zoom-in; }
.qr svg, .qr-bild svg { width: 100%; height: 100%; display: block; }
.leer-qr { display: grid; place-items: center; color: #999; cursor: default !important; }
.qr-gross .qr-bild { width: min(80vw, 340px); aspect-ratio: 1; margin: 0 auto; background: #fff; }
.qr-gross { text-align: center; }

.dialog { border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); color: var(--text); padding: 20px; max-width: min(92vw, 480px); }
.dialog.breit { max-width: min(94vw, 760px); width: 100%; }
.dialog::backdrop { background: rgba(10, 5, 20, .5); }
.mail { border-top: 1px solid var(--rand); padding: 8px 0; }
.mail-inhalt { background: #fff; color: #222; border-radius: 8px; margin: 8px 0; overflow: auto; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 10px;
  max-width: min(92vw, 520px); z-index: 50; transition: transform .25s; box-shadow: var(--schatten); }
.toast.zeigen { transform: translate(-50%, 0); }
.toast.fehler { background: var(--rot); color: #fff; }

/* Tabellen (Verwaltung) */
.tabelle-huelle { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); }
td.zahl, th.zahl { text-align: right; white-space: nowrap; }
.reiter { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--rand); margin: 12px 0 4px; }
.reiter a { padding: 8px 12px; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; font-weight: 500; }
.reiter a[aria-current] { border-color: var(--lila); color: var(--lila); }
.raster-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.pille { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--lila-hell); font-size: .8rem; margin: 1px 2px; }
.pille.rot { background: var(--rot-hell); color: var(--rot); }
.limits-tabelle input { min-height: 36px; padding: 5px 7px; }
.limits-tabelle td { min-width: 110px; }
.text { white-space: normal; }

/* Einlass */
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .rahmen { position: absolute; inset: 15%; border: 3px solid rgba(255, 255, 255, .8); border-radius: 12px; }
.scanner .hinweis-text { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; font-size: .9rem; text-shadow: 0 1px 3px #000; }
.ergebnis { border-width: 3px; text-align: center; }
.ergebnis.gruen { border-color: var(--gruen); background: var(--gruen-hell); }
.ergebnis.rot { border-color: var(--rot); background: var(--rot-hell); }
.ergebnis .gross-text { font-size: 1.6rem; font-weight: 800; }
.ergebnis.gruen .gross-text { color: var(--gruen); }
.ergebnis.rot .gross-text { color: var(--rot); }
.zahlen { display: flex; gap: 18px; flex-wrap: wrap; }
.zahlen b { font-size: 1.4rem; display: block; }
@media print { .kopf, .fuss, #band, .saal-leiste { display: none; } }
