/* FLX Tickets – Grundlagen und gemeinsame Komponenten
 * Werte 1:1 aus der Vorschau (gemeinsamer <style>-Block aller 12 Screens).
 * Klassen tragen dieselben Namen wie in der Vorschau, damit der Abgleich
 * einfach bleibt. Neue Klassen ersetzen die Inline-Styles der Vorschau.
 */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Nur für Screenreader sichtbar */
.sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sr-fokus:focus, .sr-fokus:focus-within { position: static !important; width: auto; height: auto; margin: 0; clip: auto; overflow: visible; }

/* Hilfsklassen (Vorschau) */
.ml { margin-left: auto; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mut { color: var(--muted); }
.sm { font-size: var(--fs-s); }
.num { font-variant-numeric: tabular-nums; }
/* Hilfsklassen (aus Inline-Styles der Vorschau) */
.nowrap { flex-wrap: nowrap; white-space: nowrap; }
.g4 { gap: 4px; } .g6 { gap: 6px; } .g8 { gap: 8px; } .g10 { gap: 10px; } .g12 { gap: 12px; } .g14 { gap: 14px; }
.flex1 { flex: 1; }
.stapel { display: flex; flex-direction: column; }
.fett5 { font-weight: 500; }
.text { color: var(--text); }
.text2 { color: var(--text-2); }

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: var(--r-btn); font: 500 13px var(--font); border: 1px solid var(--border-btn);
  background: var(--surface-2); color: var(--text); cursor: pointer; white-space: nowrap; box-sizing: border-box;
}
a.btn:hover { color: var(--text); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
a.btn.pri:hover { color: var(--on-accent); }
.btn.ic { width: 34px; padding: 0; justify-content: center; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.h28 { height: 28px; }
.btn.h30 { height: 30px; }
.btn.ic.h28 { width: 28px; }
.btn.gefahr { color: var(--bad); padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.card.zu { overflow: hidden; }
.ch { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ch h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-fuss { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); }
.card-pad { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }

/* Status-Pillen (nur Team/Verwaltung; im Spielerbereich farbiger Text) */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-ok { background: var(--ok-soft); color: var(--ok); }
.p-wait { background: var(--wait-soft); color: var(--wait); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.p-gray { background: var(--active); color: var(--text-2); }
.p-blue { background: var(--accent-soft); color: var(--accent-text); }

/* Status und Priorität als Text */
.st-offen { color: var(--accent-text); }
.st-in_arbeit { color: var(--wait); }
.st-wartet { color: var(--text-2); }
.st-geloest { color: var(--ok); }
.prio-niedrig { color: var(--muted); }
.prio-normal { color: var(--text-2); }
.prio-hoch { color: var(--prio-hoch); }
.prio-dringend { color: var(--bad); font-weight: 500; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 10px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 20px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
th.r, td.r { text-align: right; }
.tabelle-scroll { overflow-x: auto; }
/* Ganze Zeile klickbar (rowlink.js); ohne JS trägt der Link in der Zeile */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--hover); }

/* Reiter / Filter */
.tab {
  height: 30px; padding: 0 12px; border-radius: 15px; font-size: 13px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-tab);
  background: transparent; box-sizing: border-box; cursor: pointer;
}
a.tab:hover { color: var(--text); }
.tab.on, .tab:has(> input:checked) { background: var(--tab-on-bg); color: var(--tab-on-fg); border-color: var(--tab-on-bg); font-weight: 500; }
.tab.on:hover { color: var(--tab-on-fg); }
.tab:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab .zahl { color: var(--muted); }
.tab.on .zahl { color: inherit; opacity: .6; }
.tab.h26 { height: 26px; }
.tab.h28 { height: 28px; }
.tab.flach:not(.on):not(:has(> input:checked)) { border-color: transparent; }
.tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Formularfelder */
.fld { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fld > label, .fld .label { font-size: 13px; font-weight: 500; }
.fld .opt { color: var(--muted); font-weight: 400; }
.hint { font-size: var(--fs-s); color: var(--muted); }
.fehler-text { font-size: var(--fs-s); color: var(--bad); }
.in {
  min-height: 38px; border: 1px solid var(--border-field); background: var(--field); border-radius: var(--r-btn);
  padding: 0 12px; color: var(--text); font: 14px var(--font); display: flex; align-items: center; gap: 8px;
  box-sizing: border-box; width: 100%;
}
input.in, textarea.in { display: block; width: 100%; outline: none; }
input.in:focus, textarea.in:focus, .in:focus-within { border-color: var(--accent); }
.in::placeholder { color: var(--muted); }
textarea.in { min-height: 64px; padding: 10px 12px 10px; line-height: 1.5; resize: vertical; }
textarea.in.h76 { min-height: 76px; }
.in.fest { color: var(--text); }
.in[aria-invalid="true"] { border-color: var(--bad); }
.raster2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ganz { grid-column: 1 / -1; }

/* Schalter: <label class="tgl"><input type="checkbox" class="sr"><span class="tg"></span></label> */
.tg { width: 36px; height: 20px; border-radius: 10px; background: var(--accent); position: relative; flex: none; display: inline-block; }
.tg::after { content: ''; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.tg.off, input:not(:checked) + .tg { background: var(--border-btn); }
.tg.off::after, input:not(:checked) + .tg::after { right: auto; left: 2px; background: var(--knob-off); }
.tgl { display: inline-flex; cursor: pointer; position: relative; }
.tgl input:focus-visible + .tg { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Definitionsliste */
.kv { display: grid; grid-template-columns: 130px 1fr; row-gap: 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv.k110 { grid-template-columns: 110px 1fr; font-size: 13px; margin: 1em 0; } /* Vorschau: Browser-Standardabstand der dl */

/* Avatar und Logo */
.av {
  width: 28px; height: 28px; border-radius: 50%; background: var(--avatar); color: #fff; font-size: 11.5px;
  font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; object-fit: cover;
}
.av.spieler { background: var(--avatar-player); }
.av.a22 { width: 22px; height: 22px; font-size: 9.5px; }
.av.a24 { width: 24px; height: 24px; font-size: 10px; }
.av.a34 { width: 34px; height: 34px; font-size: 12px; }
.av.a40 { width: 40px; height: 40px; font-size: 13px; }
.logo {
  width: 28px; height: 28px; border-radius: 7px; background: var(--logo-bg); color: #fff; font-weight: 700;
  font-size: 14px; display: flex; align-items: center; justify-content: center; flex: none; object-fit: cover;
}
.logo.l22 { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.logo.l56 { width: 56px; height: 56px; font-size: 24px; border-radius: 12px; }
.farbpunkt { width: 10px; height: 10px; flex: none; display: block; }

/* Eigenes Dropdown (dropdown.js). Ohne JS: <details> mit Radios oder Submit-Knöpfen.
 * <details class="dd"><summary class="in dd-knopf">…</summary><div class="dd-menu" role="listbox">…</div></details> */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; justify-content: space-between; user-select: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary .dd-wert { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd > summary > svg { flex: none; }
.dd-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 300px; overflow: auto;
  box-sizing: border-box; padding: 4px; background: var(--surface); border: 1px solid var(--border-btn);
  border-radius: var(--r-box); box-shadow: 0 12px 32px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 1px;
}
.dd.rechts .dd-menu { left: auto; right: 0; }
.dd-opt {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; border-radius: 6px;
  font: 13.5px var(--font); color: var(--text); background: transparent; border: 0; text-align: left;
  cursor: pointer; white-space: nowrap; width: 100%; box-sizing: border-box;
}
.dd-opt:hover, .dd-opt.fokus, .dd-opt:focus-visible { background: var(--active); outline: none; }
.dd-opt:has(> input:checked), .dd-opt[aria-selected="true"] { font-weight: 500; }
.dd-opt .haken { margin-left: auto; visibility: hidden; color: var(--accent-text); }
.dd-opt:has(> input:checked) .haken, .dd-opt[aria-selected="true"] .haken { visibility: visible; }
.dd-ohnejs { padding: 6px 6px 2px; }
.js .dd-ohnejs { display: none; }
.dd-opt[hidden], .dd-leer[hidden], .dd-suche[hidden] { display: none; }
/* Textbaustein-Menü 28.11.: Liegt das Dropdown in einem Container, der abschneidet (overflow: Verlauf, rechte Spalte, Karte),
   setzt dropdown.js das Menü auf position: fixed mit berechneter Lage (.dd-schwebt, top/left/max-height inline). Es öffnet
   dann nach unten oder – bei data-richtung="oben" bzw. zu wenig Platz unten – nach oben und bleibt im Fenster. */
.dd-menu.dd-schwebt { position: fixed; z-index: 60; }   /* top/left/bottom/right/max-height setzt dropdown.js inline */
.js .dd[data-richtung="oben"] > .dd-menu:not(.dd-schwebt) { visibility: hidden; }   /* kein Aufblitzen vor der Ausrichtung */
.dd-suche { flex: none; width: 100%; box-sizing: border-box; margin-bottom: 4px; }
.dd-leer { margin: 0; padding: 8px 10px; }
/* Textbausteine: höchstens halbe Fensterhöhe, Suchfeld oben fest, nur die Liste scrollt */
.dd-menu.tb-menu { min-width: 260px; max-width: min(440px, calc(100vw - 16px)); max-height: 50vh; overflow: hidden; }
.tb-liste { display: flex; flex-direction: column; gap: 1px; min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.tb-liste .dd-opt { flex: none; }

/* Dialog (dialog.js). Ohne JS öffnet :target den Dialog über einen Anker-Link. */
.dlg { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(0, 0, 0, .55); overflow: auto; }
.dlg:target, .dlg.offen { display: flex; }
.dlg-box {
  width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: 0 24px 64px rgba(0, 0, 0, .45); color: var(--text); font-size: 14px;
}
.dlg-box.breit { max-width: 640px; }
.dlg-inhalt { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.dlg-fuss { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
body.dlg-auf { overflow: hidden; }

/* Hinweisleiste (Rückmeldung nach dem Speichern) */
.meldung { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-box); font-size: 13.5px; background: var(--ok-soft); color: var(--ok); }
.meldung.fehler { background: var(--bad-soft); color: var(--bad); }

/* Ergänzungen */
.b6 { font-weight: 600; }
.mr-auto { margin-right: auto; }
.btn[aria-disabled="true"] { cursor: default; }
.btn.pri.gefahr-voll { background: var(--bad); border-color: var(--bad); color: #fff; }
.nur-ohnejs { }
.js .nur-ohnejs { display: none !important; }
.g20 { gap: 20px; }

/* Ladebild beim Wechsel Spielerbereich ↔ Team/Verwaltung (layout/_wechsel.php, assets/js/wechsel.js).
 * .wechsel.an    alte Seite nach dem Klick (blendet kurz ein)
 * .wechsel-an    am <html> der Zielseite: steht schon beim ersten Bild
 * .fertig / .weg Balken läuft voll, dann Ausblenden. Ohne JS nie sichtbar. */
.wechsel {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in srgb, var(--brand) 42%, #050506); color: #fff; font-family: var(--font);
}
.wechsel.an, .wechsel-an .wechsel { display: flex; }
.wechsel.an { animation: wechsel-ein 140ms ease-out both; }
.wechsel-an .wechsel:not(.weg) { animation: wechsel-notaus 200ms ease-out 6s forwards; } /* falls das Skript ausfällt */
.wechsel.weg { opacity: 0; transition: opacity 240ms ease-out; pointer-events: none; }
.wechsel-innen { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.wechsel .logo { background: var(--logo-bg); border: 1px solid rgba(255, 255, 255, .12); color: #fff; }
.wechsel-text { font-size: 15px; line-height: 1.4; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; }
.wechsel-text b { font-weight: 600; }
.wechsel-trenner, .wechsel-text [data-wechsel-ziel] { color: rgba(255, 255, 255, .62); }
.wechsel-balken { width: 160px; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, .14); overflow: hidden; margin-top: 4px; }
.wechsel-balken i { display: block; height: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); }
.wechsel.an .wechsel-balken i, .wechsel-an .wechsel .wechsel-balken i {
  animation: wechsel-lauf 440ms cubic-bezier(.25, .7, .3, 1) var(--wechsel-verzug, 0ms) both;
}
.wechsel.fertig .wechsel-balken i, .wechsel-an .wechsel.fertig .wechsel-balken i { animation: wechsel-voll 160ms ease-out both; }
@keyframes wechsel-ein { from { opacity: 0; } to { opacity: 1; } }
@keyframes wechsel-notaus { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@keyframes wechsel-lauf { from { transform: scaleX(0); } to { transform: scaleX(.9); } }
@keyframes wechsel-voll { from { transform: scaleX(.9); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .wechsel-balken { display: none; }
  .wechsel.an { animation-duration: 120ms; }
  .wechsel.weg { transition-duration: 160ms; }
}

/* SP (Live-Prüfung 14): Autogrow (formular.js) ohne Scrollleiste bis max-height, erst dann scrollt das Feld. Ohne JS normal. */
.js textarea[data-autohoehe] { overflow-y: hidden; resize: none; scrollbar-width: thin; }
.composer-text[data-autohoehe] { max-height: 420px; }

/* ── SP (Live-Prüfung 28.11., Punkt 28): Handy – Tippflächen mind. 44 px, Dropdowns und Dialoge im Fenster ──
 * Geprüft mit tools/handy.mjs (390×844). Nur schmale Fenster; der Desktop bleibt 1:1 wie die Vorschau. */
@media (max-width: 720px) {
  .btn, .btn.h28, .btn.h30 { min-height: 44px; }
  .btn.ic, .btn.ic.h28 { min-width: 44px; min-height: 44px; }
  .btn.gefahr { min-height: 44px; }
  .tab, .tab.h26, .tab.h28 { min-height: 44px; border-radius: 22px; }
  .dd-opt { min-height: 44px; }
  .in.suchfeld, .suchfeld { min-height: 44px; }
  .suchfeld input { align-self: stretch; }
  .tgl { min-height: 44px; min-width: 44px; align-items: center; justify-content: center; }
  .dd > summary { min-height: 44px; }
  .brand, .t-betreff, a.person { min-height: 44px; }
  input.in, input.in.h30, .in.dd-knopf { min-height: 44px; }
  td input.in.num { min-width: 150px; }   /* Kanal-ID in Tabellen: nicht auf 30 px quetschen, die Tabelle scrollt */
  .griff { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .griff-zelle { width: 44px; }
  .kat-link { min-height: 44px; justify-content: center; }
  label.farbe { min-width: 44px; min-height: 44px; }
  .kv dd a, .meldung a, .card-fuss a { display: inline-flex; align-items: center; min-height: 44px; }
  .meldung { flex-wrap: wrap; row-gap: 0; }
  .composer-text[data-autohoehe] { max-height: 50vh; }
  /* Dropdown-Menüs nie über den Rand: am rechten Rand ausrichten, wenn links kein Platz ist (dropdown.js setzt .links-eng) */
  .dd-menu { max-width: calc(100vw - 32px); }
  .dd.links-eng .dd-menu { left: auto; right: 0; }
  .dd.rechts-eng .dd-menu { left: 0; right: auto; }
  /* Dialoge: oben beginnen (mehr Platz); lange Dialoge scrollen mit der Fläche (.dlg overflow: auto),
     so bleiben Dropdowns im Dialog unbeschnitten. Knöpfe im Fuß brechen um statt überzustehen. */
  .dlg { padding: 16px 12px 24px; }
  .dlg-fuss { flex-wrap: wrap; }
}

/* ── Ticketansicht 28.11. (Team und Spieler) ────────────────────────── */
/* Badge Spieler/Team an Nachrichten */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; }
.b-spieler { background: var(--active); color: var(--text-2); }
.b-team { background: var(--accent-soft); color: var(--accent-text); }
/* Deaktiviertes „Senden“: Akzentfarbe mit 40 % Deckkraft statt grau */
.btn.pri:disabled { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: .4; }
/* Antwortfeld fest 28.11.: dezenter Hinweis über dem Antwortfeld, wenn eine neue Nachricht kommt und man hochgescrollt hat (ticket.js) */
.neu-hinweis {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 6; height: 30px; padding: 0 14px;
  border: 1px solid var(--border-btn); border-radius: 15px; background: var(--surface); color: var(--text); font: 500 13px var(--font);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); cursor: pointer; white-space: nowrap;
}
.neu-hinweis:hover { background: var(--hover); }
.neu-hinweis[hidden] { display: none; }

/* ── Ereigniszeile im Verlauf (Team- und Spieler-Ticket, Spieler-Ereignisse konkret 28.11.): mittig, Uhr-Symbol, Werte fett ── */
.sys { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: nowrap; padding-left: 0; text-align: center; font-size: 13px; color: var(--text-2); }
.sys svg { color: var(--muted); flex: none; }
.sys > span { min-width: 0; overflow-wrap: anywhere; }   /* langer Satz bricht im Text um, das Symbol bleibt davor */
.sys b { color: var(--text); font-weight: 500; }
