/* Steuerung – Seitenleiste (Desktop) bzw. Menü + untere Leiste (Handy).
   Gestaltung wie die Verwaltung der Website der Event Crew Steinfurt. */
:root {
  --sb-w: 264px;
  --sb-bg: #00021a;
  --sb-bg-2: #0d1650;
  --sb-item: #162668;
  --sb-line: rgba(132, 148, 235, 0.16);
  --sb-text: #a3abc2;
  --sb-strong: #f3f6fd;
  --sb-accent: #8494eb;
  --sb-label: #6a7396;
  --page-max: 1240px;
}

body { font-size: 15px; line-height: 1.5; min-height: 100vh; background: var(--bg); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--heading); }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 4px 0 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* --- Seitenleiste ------------------------------------------------------------ */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sb-w);
  display: flex; flex-direction: column; background: var(--sb-bg); color: var(--sb-text);
  border-right: 1px solid var(--sb-line); color-scheme: dark;
}
.sb-brand { display: flex; align-items: flex-start; gap: 10px; padding: 18px 16px 12px 18px; color: var(--sb-strong); }
.sb-logo { display: grid; justify-items: center; gap: 6px; min-width: 0; color: inherit; text-decoration: none; }
.sb-logo img { display: block; width: auto; height: 38px; max-width: 100%; }
.sb-logo span { padding-left: 0.14em; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ecs-sun); }
.sb-close {
  display: none; margin-left: auto; width: 36px; height: 36px; border-radius: 8px; border: 0;
  background: none; color: var(--sb-text); font-size: 16px; cursor: pointer;
}
.sb-tenant { display: grid; gap: 2px; margin: 0 12px 8px; padding: 0 2px; }
.sb-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--sb-label); }
.sb-tenant strong { color: var(--sb-strong); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-tenant select {
  min-height: 32px; padding: 4px 8px; border: 1px solid var(--sb-line); border-radius: 8px;
  background: var(--sb-bg-2); color: var(--sb-strong); font-weight: 650; font-size: 14px; cursor: pointer;
}
.sb-tenant select option { color: #111; background: #fff; }
.sb-tenant:has(select:not([hidden])) strong { display: none; }
.sb-tournament { margin: 4px 12px 6px; padding: 10px 12px; border-radius: 16px; background: var(--sb-bg-2); border: 1px solid var(--sb-line); }
.sb-tournament select {
  width: 100%; min-height: 28px; padding: 0 4px 0 0; border: 0; background: transparent; color: var(--sb-strong);
  font-weight: 700; font-size: 15px; cursor: pointer; outline-offset: 2px;
}
.sb-tournament select option { color: #111; background: #fff; }
.sb-status { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 4px; font-size: 12px; font-weight: 600; }
.sb-phase { display: inline-flex; align-items: center; gap: 6px; }
.sb-phase[data-phase='running']::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.sb-onair { display: inline-flex; align-items: center; gap: 6px; color: #fca5a5; }
.sb-onair i, .badge-onair i { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; animation: pulse 1.6s ease-in-out infinite; }

.sb-nav { flex: 1; overflow-y: auto; padding: 2px 10px 10px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.sb-section { padding: 16px 10px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--sb-label); }
.sb-nav button {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px;
  border: 0; border-radius: 12px; background: none; color: var(--sb-text); text-align: left;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.sb-nav button svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; opacity: 0.85; }
.sb-nav button:hover { background: var(--sb-bg-2); color: var(--sb-strong); }
.sb-nav button.active { background: var(--sb-item); color: var(--sb-strong); box-shadow: inset 0 0 0 1px #2f3d7b; }
.sb-nav button.active svg { color: var(--sb-accent); opacity: 1; }
.sb-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: auto;
  border-radius: 10px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; font-style: normal;
}

/* Unten: Anzeige öffnen, Verbindung, Benutzer, Betreiber – links daneben sitzt der SOS-Knopf */
.sb-foot { display: grid; gap: 10px; padding: 14px 14px 16px; border-top: 1px solid var(--sb-line); }
.sb-foot .ecs-credit { min-height: 62px; padding-left: 72px; color: #6a7396; }
.sb-foot .ecs-credit img { display: none; }
.sb-foot .ecs-credit strong { color: var(--sb-text); font-size: 11.5px; }
.sb-foot .ecs-credit a:hover { color: var(--sb-strong); }
.sb-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sb-user-tools { display: flex; align-items: center; gap: 4px; }
.sidebar .conn { color: var(--sb-text); }
.sidebar .whoami { font-size: 12px; color: var(--sb-label); max-width: none; }
.sidebar .push-toggle { border-color: var(--sb-line); background: transparent; color: var(--sb-text); }
.sidebar .push-toggle[data-state='on'] { color: var(--sb-accent); border-color: var(--sb-accent); background: rgba(110, 160, 255, 0.12); }
.sb-logout {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--sb-line); background: transparent; color: var(--sb-text); cursor: pointer;
}
.sb-logout:hover, .sidebar .push-toggle:hover { color: var(--sb-strong); background: var(--sb-bg-2); }
body .panic { left: 22px; }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.conn.ok i { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.whoami { font-size: 13px; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.appbar, .bottombar { display: none; }
.scrim { display: none; }

/* --- Inhalt ------------------------------------------------------------------ */
.view { margin-left: var(--sb-w); padding: 28px clamp(20px, 3vw, 40px) 120px; }
.view > * { max-width: var(--page-max); margin-left: auto; margin-right: auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.progress-line { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

/* Bausteine */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .card-list + .card { margin-top: 20px; }
.section { margin-bottom: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover { background: color-mix(in srgb, var(--surface-2) 85%, var(--text)); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 10px 22px -14px var(--primary); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--cta-text); box-shadow: 0 10px 24px -14px var(--cta); }
.btn-cta:hover { background: var(--cta); filter: brightness(1.05); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; height: 46px; }
.danger { color: var(--live); }
.btn.danger:hover { background: var(--live-soft); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 999px; border: 1px solid transparent;
  background: none; color: var(--text-2); cursor: pointer; font-size: 14px;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.3; }
.icon-btn.danger:hover { color: var(--live); background: var(--live-soft); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-live { background: var(--live); color: #fff; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--text-2); }
.badge-onair { background: var(--live-soft); color: var(--live); }
.badge-cta { background: color-mix(in srgb, var(--cta) 20%, var(--surface)); color: var(--heading); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cta) 45%, transparent); }
.system-check { align-items: flex-start !important; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.system-check input { margin-top: 3px; }
.system-check span { font-weight: 500; line-height: 1.45; }
.phase-running { background: var(--success-soft); color: var(--success); }
.phase-setup { background: var(--surface-2); color: var(--text-2); }
.phase-done { background: var(--accent-soft); color: var(--accent); }
.phase-template { background: color-mix(in srgb, var(--cta) 20%, var(--surface)); color: var(--heading); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--field);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; min-height: 38px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
input:disabled, select:disabled { opacity: 0.6; color: var(--text-2); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type='checkbox'], input[type='radio'] { width: 18px; height: 18px; min-height: 0; padding: 0; flex-shrink: 0; accent-color: var(--primary); box-shadow: none; }
input[type='color'] { padding: 3px; height: 38px; cursor: pointer; }
textarea { resize: vertical; }
.select-sm { width: auto; max-width: 220px; min-height: 32px; height: 32px; padding: 2px 10px; font-size: 13px; border-radius: 999px; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.row-2, .row-3 { display: grid; gap: 12px; align-items: end; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.notice { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
/* Hinweise: in Formularen (Raster mit Abstand) dicht unter dem Feld, sonst mit eigenem Abstand */
.hint { margin: 8px 0 0; font-size: 13px; color: var(--text-2); }
.form > .hint { margin-top: -4px; }
.hint.warn { color: var(--warn); font-weight: 600; }
.hint.ok { color: var(--success); }
.section-gap { margin-top: 20px; }

.empty { text-align: center; padding: 64px 24px; color: var(--text-2); }
.empty h2 { color: var(--text); font-size: 20px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }
.empty.small { padding: 32px; }

.progress { width: 260px; max-width: 100%; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--success); border-radius: inherit; transition: width 0.4s; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

@keyframes pulse { 50% { opacity: 0.35; } }

/* Aufklappmenü (⋯) */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary.icon-btn { display: grid; place-items: center; border-color: var(--border); font-size: 18px; line-height: 1; }
details.menu[open] > summary.icon-btn { background: var(--surface-2); color: var(--text); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; display: grid; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.7);
}
.menu-list > * {
  display: block; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--text);
  font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-list > *:hover { background: var(--surface-2); }
.menu-list > .danger { color: var(--live); }

/* --- Übersicht ---------------------------------------------------------------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px;
}
.banner > div:first-child { display: grid; gap: 2px; }
.banner span { font-size: 13.5px; }
.banner-live { background: var(--live); color: #fff; }
.banner-live .btn { background: #fff; border-color: #fff; color: #991b1b; }
.banner-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
/* Vorlage in Bearbeitung: Balken über allen Turnier-Ansichten */
.banner-template { background: var(--accent-soft); border: 1px solid var(--primary); color: var(--text); margin-bottom: 18px; }
.banner-template strong { color: var(--heading); font-size: 15px; }
.banner-template span { color: var(--text-2); max-width: 80ch; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi {
  display: grid; gap: 4px; align-content: start; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); }
.kpi-value { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 16px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.kpi-value.ok { font-size: 22px; color: var(--heading); }
.kpi-sub { font-size: 13px; color: var(--text-2); }
.kpi .progress { width: 100%; margin-top: 8px; }
.kpi.is-live { border-color: color-mix(in srgb, var(--live) 40%, var(--border)); }
.kpi.is-live .kpi-value { color: var(--live); }
.kpi.is-warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.4s ease-in-out infinite; }
.kpi-notes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; font-weight: 600; }
.kpi-notes li { display: flex; align-items: baseline; gap: 8px; }
.kpi-notes li::before { content: ''; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); transform: translateY(-1px); }
.kpi-notes li.live::before { background: var(--live); }
.kpi-notes .link-btn { color: inherit; text-decoration: underline dotted; text-align: left; }

.court-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.court-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.court-card.is-live { border-color: color-mix(in srgb, var(--live) 40%, var(--border)); }
.cc-head { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.court-card.is-live .cc-head { background: color-mix(in srgb, var(--live) 6%, var(--surface)); }
.cc-head strong { font-size: 15px; }
.cc-state {
  margin-left: auto; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.court-card.is-live .cc-state { background: var(--live); color: #fff; }
.court-card.is-free .cc-state { background: var(--success-soft); color: var(--success); }
.cc-game { flex: 1; display: grid; gap: 10px; align-content: start; padding: 14px 16px; }
.cc-meta { font-size: 12px; font-weight: 600; color: var(--text-3); }
.cc-meta span { color: var(--text-2); }
.cc-line { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.cc-team { font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.cc-team.home { text-align: right; }
.cc-team.placeholder { color: var(--text-3); font-weight: 500; font-style: italic; }
.cc-score { display: flex; gap: 6px; font-size: 30px; font-weight: 850; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cc-score i { font-style: normal; color: var(--text-3); }
.cc-vs { font-size: 18px; color: var(--text-3); }
.cc-clock { justify-self: center; display: inline-flex; align-items: baseline; gap: 8px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); }
.cc-clock b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cc-clock span { font-size: 12px; font-weight: 650; color: var(--text-2); }
.cc-clock.halftime, .cc-clock.paused { background: var(--warn-soft); }
.cc-clock.halftime span, .cc-clock.paused span { color: var(--warn); }
.cc-clock.fulltime { background: var(--live-soft); }
.cc-clock.fulltime span, .cc-clock.fulltime b { color: var(--live); }
.cc-next .btn { justify-self: center; }
.cc-empty { flex: 1; margin: 0; padding: 18px 16px; color: var(--text-3); font-size: 14px; }
.cc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 16px;
  border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; color: var(--text-2);
}
.cc-foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-foot .link-btn { flex-shrink: 0; text-decoration: none; font-size: 13px; }

.checklist .steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.steps li div { display: grid; gap: 2px; }
.step-mark {
  display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border); font-size: 14px; font-weight: 800;
}
.steps li.done .step-mark { background: var(--success); border-color: var(--success); color: #fff; }

/* Spielbetrieb (Pausen, Teams pausieren/disqualifizieren) */
.ops { display: grid; gap: 12px; }
.ops-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ops-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ops-bar { margin-bottom: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ops-toggle { display: none; }
.break-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px;
}
.break-chip.past { opacity: 0.6; }
.break-chip.active { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.chip-paused { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.chip-disq { border-color: var(--live); color: var(--live); }

/* --- Mandanten (Systemadmin) ---------------------------------------------------------- */
.tenant-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0; padding: 16px 20px; flex-wrap: wrap; }
.tenant-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.tenant-card.locked { opacity: 0.75; }
.tenant-main { flex: 1; min-width: 260px; display: grid; gap: 4px; }
.tenant-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tenant-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.tenant-actions { display: flex; gap: 8px; align-items: center; }
.tenant-help { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.login-tenant { margin: -4px 0 0; font-size: 17px; font-weight: 700; color: var(--accent); }

/* --- Turnierliste --------------------------------------------------------------- */
.card-list { display: grid; gap: 12px; }
.t-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0; padding: 16px 20px; flex-wrap: wrap; }
.t-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.t-card-main { cursor: pointer; flex: 1; min-width: 240px; }
.t-card-main:hover h3 { color: var(--accent); }
.t-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.t-card .progress { margin-top: 10px; width: 320px; height: 6px; }
.t-card-actions { display: flex; gap: 8px; align-items: center; }
.tpl-list { display: grid; gap: 8px; }
.tpl-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.tpl-row strong { display: block; }
.tpl-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tpl-title strong { display: inline; }
.tpl-row.is-hidden > div:first-child { opacity: 0.62; }

/* --- Einrichtung ---------------------------------------------------------------- */
.jumpbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 0; margin-bottom: 10px; background: var(--bg);
}
.view .card[id] { scroll-margin-top: 64px; }
.group-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.team-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 110px 160px auto; gap: 8px; align-items: center; }
.team-list li:not(:has(select)) { grid-template-columns: 28px minmax(0, 1fr) auto; }
.team-list li:has(select):not(:has(select + select)) { grid-template-columns: 28px minmax(0, 1fr) 160px auto; }
.team-no { color: var(--text-3); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.team-tools { display: flex; gap: 2px; }
.add-teams { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; align-items: start; }
.disc-list ~ .check { margin-top: 14px; }
.disc-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.disc-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; }
.disc-chip input { width: 150px; min-height: 30px; padding: 4px 8px; font-weight: 600; }
.disc-chip .disc-min { width: 64px; text-align: right; }
.disc-chip .disc-sport { max-width: 180px; min-height: 30px; padding: 2px 6px; font-size: 13px; }

.group-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gb-col {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; min-height: 120px; transition: border-color 0.15s, background 0.15s;
}
.gb-col.over { border-color: var(--accent); background: var(--accent-soft); }
.gb-free { border-style: dashed; border-color: var(--warn); }
.gb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gb-head input { min-height: 30px; padding: 4px 8px; font-weight: 700; }
.gb-head strong { flex: 1; font-size: 14px; color: var(--warn); }
.gb-count { font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gb-count.warn { color: var(--warn); }
.gb-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gb-col li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gb-col li[draggable='true'] { cursor: grab; }
.gb-col li[draggable='true']:hover { border-color: var(--text-3); }
.gb-col li.dragging { opacity: 0.4; }
.gb-col li.gb-empty { background: none; border-style: dashed; color: var(--text-3); font-weight: 400; text-align: center; }

.court-list { display: grid; gap: 6px; }
.court-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 200px auto; gap: 8px; align-items: center; }
.court-row:not(:has(select)) { grid-template-columns: 28px minmax(0, 1fr) auto; }
.sub-head { font-size: 14px; margin: 18px 0 8px; }
.table-scroll { overflow-x: auto; }
.rotation-table { border-collapse: collapse; font-size: 13px; min-width: 360px; }
.rotation-table th, .rotation-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: center; }
.rotation-table thead th { background: var(--surface-2); }
.rotation-table tbody th { text-align: left; color: var(--text-2); font-weight: 600; }
.rotation-table td { font-weight: 600; }
.rotation-table td.idle { color: var(--text-3); font-weight: 400; font-style: italic; }

.draw-panel {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; background: var(--surface-2);
}
.draw-panel.active { border-color: var(--accent); background: var(--accent-soft); }
.draw-panel strong { display: block; }
.draw-last { margin-top: 6px; font-size: 18px; font-weight: 700; }
.draw-last span { color: var(--accent); margin: 0 6px; }

/* --- Spiele --------------------------------------------------------------------- */
.toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px 0; margin-bottom: 4px; background: var(--bg);
}
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 7px;
  background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button b {
  min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--border); color: var(--text-2);
  font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.seg button.has-live b { background: var(--live); color: #fff; }

.slot { margin-bottom: 8px; }
.slot-time {
  display: flex; align-items: center; gap: 10px; margin: 16px 0 8px 2px;
  font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3);
}
.slot-time::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.slot-time small { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.slot-live { display: inline-flex; align-items: center; gap: 6px; color: var(--live); font-weight: 750; }
.slot-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.4s ease-in-out infinite; }

.match {
  position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; align-items: center; gap: 10px 18px;
  padding: 10px 14px 10px 18px; margin-bottom: 6px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* Lange Spielelisten: Karten außerhalb des sichtbaren Bereichs nicht layouten/zeichnen */
.match { content-visibility: auto; contain-intrinsic-size: auto 84px; }
.match::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; }
.match.live { border-color: color-mix(in srgb, var(--live) 45%, var(--border)); background: color-mix(in srgb, var(--live) 4%, var(--surface)); }
.match.live::before { background: var(--live); }
.match.finished::before { background: var(--success); }
.match.finished .score-input input { background: var(--surface-2); }
.match.deferred { background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.match.deferred::before, .match.awaiting::before { background: var(--warn); }
.match.awaiting { border-color: var(--warn); }
.match-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; color: var(--text-2); align-items: center; }
.match-no { font-weight: 750; color: var(--text-3); font-variant-numeric: tabular-nums; }
.duel {
  padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.match-body { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; }
.team { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team.home { text-align: right; }
.team.placeholder { color: var(--text-3); font-weight: 500; font-style: italic; }
.team.winner { color: var(--success); }
.score-input { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text-3); }
.score-input input {
  width: 52px; height: 42px; text-align: center; font-size: 19px; font-weight: 750; padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.score-input input::-webkit-outer-spin-button, .score-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input.small input { width: 44px; height: 34px; font-size: 15px; }
.parts { display: grid; gap: 4px; justify-items: center; }
.part { display: grid; grid-template-columns: 64px auto; align-items: center; gap: 8px; }
.part-name { font-size: 12px; font-weight: 600; color: var(--text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part.total { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; width: 100%; grid-template-columns: 64px 1fr; }
.part.total strong { font-size: 17px; text-align: center; font-variant-numeric: tabular-nums; }
.part-extra { display: flex; justify-content: center; max-width: 100%; }
.sets-input { width: 240px; max-width: 100%; min-height: 32px; padding: 4px 8px; text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; }
.pen-row { grid-column: 2; display: flex; justify-content: center; align-items: center; gap: 12px; }
.decision { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; }
.decision-field { display: flex; align-items: center; gap: 10px; }
.match-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.slot-break .break-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px dashed var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); font-size: 14px;
}
.tentative { color: var(--accent); font-style: italic; font-weight: 600; }
small.tentative { font-size: 12px; }

/* Fairnesspunkte */
.fair-wrap { display: inline-flex; align-items: center; gap: 8px; }
.fair-chip {
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid #1f5a33; background: #12301d; color: #bbf7d0;
  font: inherit; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer; user-select: none;
}
.fair-chip.default { color: #7fc79b; font-weight: 700; }
:root[data-theme='light'] .fair-chip { background: #e6f6ec; border-color: #a7dfba; color: #14532d; }
:root[data-theme='light'] .fair-chip.default { color: #3f7a55; }
.fair-chip:disabled { opacity: 0.45; cursor: default; }
.part .fair-wrap .fair-chip { height: 30px; min-width: 30px; font-size: 13px; }

/* --- Tabellen --------------------------------------------------------------------- */
/* auto-fit: Eine einzelne Tabelle (Liga) nutzt die volle Breite */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 20px; }
.tables-grid .card { margin: 0; }
.tables-grid + .card { margin-top: 20px; }
.standings { width: 100%; border-collapse: collapse; font-size: 14px; }
.standings th { font-size: 12px; color: var(--text-3); font-weight: 650; text-align: center; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.standings td { text-align: center; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.standings .l { text-align: left; }
.standings td.l { font-weight: 600; }
.standings .pts { font-weight: 750; }
.standings tr.zone-direct td:first-child { box-shadow: inset 4px 0 0 var(--zone-direct); }
.standings tr.zone-chance td:first-child { box-shadow: inset 4px 0 0 var(--zone-chance); }
.standings tr.zone-out td:first-child { box-shadow: inset 4px 0 0 var(--zone-out); }
.standings tr.zone-second td:first-child { box-shadow: inset 4px 0 0 var(--zone-second); }
.standings tr.zone-second { background: color-mix(in srgb, var(--zone-second) 9%, transparent); }
.standings tr.zone-direct { background: color-mix(in srgb, var(--zone-direct) 8%, transparent); }
.standings tr.zone-chance { background: color-mix(in srgb, var(--zone-chance) 10%, transparent); }
.standings tr.zone-out td { color: var(--text-2); }
.standings tr:last-child td { border-bottom: 0; }
.standings td, .score-input input, .bm-match b, .progress { font-variant-numeric: tabular-nums; }

.bracket-mini { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 16px; overflow-x: auto; }
.bm-round { display: flex; flex-direction: column; gap: 10px; justify-content: space-around; }
.bm-round h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.bm-match { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.bm-match > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 14px; }
.bm-match > div + div { border-top: 1px solid var(--border); }
.bm-match .winner { font-weight: 700; color: var(--success); }
.bm-match .placeholder { color: var(--text-3); font-style: italic; }
.bm-match small { display: block; padding: 0 10px 6px; color: var(--text-3); }
.bm-match.deferred { border-color: var(--warn); }

.podium-card { display: flex; gap: 12px; flex-wrap: wrap; }
.podium-place { flex: 1; min-width: 160px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 700; font-size: 17px; }
.podium-place span { display: block; font-size: 13px; color: var(--text-2); }
.podium-place.p1 { color: var(--ecs-sun); box-shadow: inset 0 0 0 2px var(--ecs-sun); }
.podium-place.p1 span { color: var(--ecs-sun); }
.podium-title { flex-basis: 100%; margin: 0; font-size: 15px; }
.podium-card.second .podium-place.p1 { color: #e2e8f0; box-shadow: inset 0 0 0 2px #cbd5e1; }
.podium-card.second .podium-place.p1 span { color: #cbd5e1; }
:root[data-theme='light'] .podium-place.p1 { background: #fdf3d4; color: #7a5800; box-shadow: none; }
:root[data-theme='light'] .podium-place.p1 span { color: #a37a00; }
:root[data-theme='light'] .podium-card.second .podium-place.p1 { background: #e8edf3; color: #334155; }
:root[data-theme='light'] .podium-card.second .podium-place.p1 span { color: #64748b; }
.ko-second h2 { color: var(--zone-second); }

:root { --zone-direct: #16a34a; --zone-chance: #d97706; --zone-out: #dc2626; --zone-second: #64748b; }
/* Nur oben/unten: Die seitlichen Ränder zentrieren die Legende in der Inhaltsspalte (.view > *) */
.zone-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; margin-bottom: 20px; font-size: 13px; }
.zl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.zl::before { content: ''; width: 12px; height: 12px; border-radius: 3px; background: var(--zc); }
.zl.zone-direct { --zc: var(--zone-direct); }
.zl.zone-chance { --zc: var(--zone-chance); }
.zl.zone-out { --zc: var(--zone-out); }
.zl.zone-second { --zc: var(--zone-second); }

.fair-table { width: 100%; border-collapse: collapse; }
.fair-table th { font-size: 12px; color: var(--text-3); font-weight: 650; padding: 0 8px 6px; text-align: center; }
.fair-table td { padding: 7px 8px; border-top: 1px solid var(--border); text-align: center; font-variant-numeric: tabular-nums; }
.fair-table .l { text-align: left; }
.fair-table td.pts { font-weight: 800; }
.fair-table .bar-col { width: 40%; }
.fair-table td.bar-col i { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #4ade80, #16a34a); min-width: 2px; }
.disq { font-size: 11px; font-weight: 700; color: var(--live); text-transform: uppercase; letter-spacing: 0.04em; }
tr:has(.disq) td { color: var(--text-3); }

/* --- Anzeige ---------------------------------------------------------------------- */
.view-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.view-opt {
  text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; display: grid; gap: 2px;
}
.view-opt span { font-size: 12px; color: var(--text-2); }
.view-opt:hover { border-color: var(--text-3); }
.view-opt.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.preview { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 10px; box-shadow: 0 0 0 1px var(--border); }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.access-list { display: grid; gap: 8px; }
.access-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.access-name { display: grid; gap: 2px; }
.access-name code { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; color: var(--text); }

/* Farben der Anzeige */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 18px; }
.theme-opt {
  display: grid; gap: 2px; align-content: start; text-align: left; padding: 12px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
.theme-opt:hover { border-color: var(--text-3); }
.theme-opt.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-opt.custom { cursor: default; opacity: 0.7; }
.theme-opt.custom.active { opacity: 1; }
.theme-opt small { font-size: 12px; color: var(--text-2); line-height: 1.35; }
.theme-swatch {
  display: flex; align-items: flex-end; gap: 6px; height: 54px; margin-bottom: 8px; padding: 9px 10px; border-radius: 10px;
  background: var(--b); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25);
}
.theme-swatch i { display: block; height: 100%; flex: 1; border-radius: 6px; background: var(--s); }
.theme-swatch i:nth-child(1) { box-shadow: inset 0 6px 0 -1px var(--h); }
.theme-swatch i:nth-child(2) { flex: 0.45; background: var(--a); }
.theme-swatch i:nth-child(3) { box-shadow: inset 0 -5px 0 -1px var(--t); }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px 16px; }
.color-field {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) 92px; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2);
}
.color-field input[type='color'] { width: 46px; height: 40px; padding: 3px; border-radius: 10px; }
.color-field span { display: grid; min-width: 0; line-height: 1.3; }
.color-field strong { font-size: 14px; }
.color-field small { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-code { min-height: 34px; padding: 4px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; text-transform: lowercase; }

/* --- Vereine, Benutzer & Alarme ------------------------------------------------------- */
.search { max-width: 260px; }
.club-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.club-table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 650; padding: 0 6px 6px; }
.club-table td { padding: 3px 6px; }
.club-table td:nth-child(2) { width: 120px; }
.club-table td:nth-child(3) { width: 30%; }
.club-table td:last-child { width: 40px; }
.user-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.user-table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 650; padding: 0 8px 8px; }
.user-table td { padding: 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.user-table td.actions { display: flex; gap: 6px; justify-content: flex-end; }
.user-table tr.inactive td { color: var(--text-3); }
.user-table code { font-size: 13px; }
.alarm-log { display: grid; gap: 8px; margin-top: 12px; }
.alarm-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px;
  border: 1px solid var(--border); border-left: 4px solid var(--text-3); border-radius: var(--radius-sm);
}
.alarm-row.open { border-left-color: var(--live); background: var(--live-soft); }
.al-main { display: grid; gap: 2px; font-size: 14px; min-width: 0; }
.al-note { font-weight: 600; color: var(--live); }
.al-status { display: flex; align-items: center; gap: 8px; }

/* --- Dialoge ---------------------------------------------------------------------- */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}
.modal::backdrop { background: rgba(0, 3, 37, 0.62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.modal-form h2 { margin: 0; padding: 20px 22px 12px; font-size: 18px; }
.modal-body { padding: 4px 22px 8px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }
.modal-error { margin: 0 22px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--live-soft); color: var(--live); font-size: 14px; }
.pick-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.pick-tools .search { max-width: none; flex: 1; }
.pick-list { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.pick { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick.taken { opacity: 0.55; cursor: default; }
.pick small { font-size: 12px; }
.radio-group { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.radio-group legend { font-weight: 600; margin-bottom: 4px; padding: 0; }

/* --- Anmeldung -------------------------------------------------------------------- */
body.login-mode .sidebar, body.login-mode .appbar, body.login-mode .bottombar, body.login-mode .scrim { display: none !important; }
body.login-mode .view { margin-left: 0; }
body.login-mode {
  background:
    radial-gradient(70% 60% at 100% 0%, rgba(93, 114, 229, 0.3), transparent 60%),
    radial-gradient(50% 50% at 0% 100%, rgba(255, 225, 86, 0.07), transparent 60%),
    var(--bg);
}
:root[data-theme='light'] body.login-mode { background: radial-gradient(70% 60% at 100% 0%, rgba(93, 114, 229, 0.16), transparent 60%), var(--bg); }
.login { min-height: calc(100vh - 48px); display: grid; place-items: center; align-content: center; gap: 18px; }
.login-card { width: min(420px, 100%); padding: 30px 28px; display: grid; gap: 12px; margin: 0; border-radius: 26px; }
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 7px; margin-bottom: 6px; }
.login-card .brand img { display: block; width: auto; height: 44px; max-width: 100%; }
.login-card .brand span { padding-left: 0.16em; font-size: 12px; line-height: 1; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ecs-sun); }
:root[data-theme='light'] .login-card .brand span { color: var(--heading); }
.login-card .modal-error { margin: 0; }
.login-card a { color: var(--accent); }
.login-card a.btn-primary, .login-card a.btn-cta { color: inherit; }
.login-card a.btn-primary { color: #fff; }
.login-card a.btn-cta { color: var(--cta-text); }
.login-accounts { display: grid; gap: 8px; }
.login-account {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text) !important; text-decoration: none;
}
.login-account:hover { border-color: var(--primary); }
.login-account span { flex: 1; min-width: 0; display: grid; }
.login-account strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-account small { color: var(--text-2); font-size: 12.5px; }
.login-account i { font-style: normal; color: var(--text-3); }
.login .ecs-credit { width: min(420px, 100%); padding: 0 6px; }

/* Hinweise */
.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 50; }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2); transition: opacity 0.3s, transform 0.3s; max-width: 360px;
}
.toast.error { background: var(--live); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }


/* --- Schmale Bildschirme -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .appbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px;
    height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; background: var(--sb-bg); color: #fff;
  }
  .appbar-menu {
    display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px;
    background: none; color: #fff; cursor: pointer;
  }
  .appbar-title { flex: 1; min-width: 0; display: grid; padding: 0 4px; border: 0; background: none; color: #fff; font: inherit; text-align: left; cursor: pointer; }
  .appbar-title strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .appbar-title span { font-size: 12px; color: var(--sb-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .appbar-conn { width: 10px; height: 10px; margin: 0 12px; border-radius: 50%; background: #ef4444; flex-shrink: 0; }
  body.online .appbar-conn { background: #22c55e; }

  .sidebar { width: min(300px, 86vw); transform: translateX(-105%); transition: transform 0.22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.4); }
  body.nav-open .sidebar { transform: none; }
  .sb-close { display: grid; place-items: center; }
  .sb-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .sb-foot .ecs-credit { padding-left: 64px; }
  body.nav-open .panic { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 8, 14, 0.55); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }

  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  }
  .bottombar button {
    position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; border: 0; background: none;
    color: var(--text-2); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
  }
  .bottombar svg { width: 24px; height: 24px; fill: currentColor; }
  .bottombar button.active { color: var(--text); }
  .bottombar button.active svg { color: var(--accent); }
  .bottombar .sb-count { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10px; margin: 0; }

  .view { margin-left: 0; padding: 18px 16px calc(150px + env(safe-area-inset-bottom)); }
  body .panic { left: 12px; bottom: calc(74px + env(safe-area-inset-bottom)); }
  .toasts { left: 80px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .toolbar, .jumpbar { top: calc(56px + env(safe-area-inset-top)); }
  .view .card[id] { scroll-margin-top: 120px; }
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .match { grid-template-columns: 1fr; }
  .match-actions { justify-content: stretch; }
  .match-actions .btn { flex: 1; justify-content: center; }
  .pen-row, .decision { grid-column: 1; }
  .tables-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 24px; }
  .court-grid { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr; }
  .team-list li, .team-list li:has(select):not(:has(select + select)) { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .team-list li select { grid-column: 2; }
  .team-list li .team-tools { grid-column: 3; grid-row: 1; }
  .court-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .court-row select { grid-column: 2; }
  .view-picker { grid-template-columns: 1fr; }
  .score-input input { width: 48px; }
  /* Filter in einer wischbaren Zeile statt mehrerer Umbrüche */
  .toolbar { flex-wrap: nowrap; flex-direction: column; align-items: stretch; gap: 8px; }
  .seg { overflow-x: auto; scrollbar-width: none; }
  .chips.scroll, .jumpbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  /* Spielbetrieb am Handy zugeklappt: eine Zeile mit Kurzfassung */
  .ops-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 2px 0; border: 0; background: none;
    color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  }
  .ops-toggle span { flex: 1; min-width: 0; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ops-toggle i { font-style: normal; color: var(--text-3); transition: transform 0.15s; }
  .ops-bar.open .ops-toggle i { transform: rotate(180deg); }
  .ops-bar:not(.open) > .ops { display: none; }
  .ops-bar.open > .ops { margin-top: 10px; }
  .ops-actions .btn, .ops-actions .select-sm { flex: 1 1 100%; max-width: none; justify-content: center; }
  /* Teams oben nebeneinander, Ergebnisfelder darunter */
  .match-body { grid-template-columns: 1fr 1fr; row-gap: 10px; }
  .match-body .team { white-space: normal; overflow-wrap: anywhere; }
  .match-body .team.home { text-align: left; }
  .match-body .team.away { text-align: right; }
  .match-body > .score-input, .match-body > .parts, .match-body > .fair-wrap { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .standings { font-size: 13px; }
  .t-card-actions { width: 100%; }
  .t-card-actions > .btn { flex: 1; justify-content: center; }
  .t-card .progress { width: 100%; }
}
