/* =============================================================================
   Pulse — Layout (Views, Grids, Dock).
   Farben und Komponenten liegen in theme.css / components.css.
   Performance: nur Compositor-Properties (transform/opacity) animieren.
   ============================================================================= */

body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

/*
  .app füllt nur die 1fr-Zelle, nicht das ganze Viewport.
  height: 100% + z-index über dem Footer würde Impressum/Datenschutz
  unklickbar machen (Klicks treffen die App-Fläche).
*/
.app {
  min-height: 0;
  height: 100%;
  overflow: auto;
  overflow-x: hidden;
  width: 100%;
  min-width: 0;
}

.view {
  width: 100%;
  min-height: 100%;
  display: grid;
  padding: calc(var(--pad) + env(safe-area-inset-top)) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
}

.view[hidden] {
  display: none !important;
}

/* Verhindert, dass #view-home vor dem Hash-Routing aufblitzt (Screen-Share). */
html.route-booting #view-home {
  display: none !important;
}

/* Hub #/admin hat hidden im Markup; zusätzlich ausblenden, falls JS den Hash später setzt. */
html.route-booting #view-admin {
  display: none !important;
}

/* ----- Home (nur Mitmachen) ----- */
.view-home {
  grid-template-rows: auto auto auto auto;
  gap: 24px;
  /* 1fr soll den Rest füllen — align-content:start würde die Zeile schrumpfen
     und den Admin-Link auf kleinen Viewports unter den Footer schieben. */
  overflow: auto;
}

.view.view-admin {
  /* Block statt Grid mit 1fr: sonst wird das Formular auf Viewport-Höhe
     beschnitten und ist nicht nach unten scrollbar (html/body: overflow hidden). */
  display: block;
  overflow: auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.view-admin .home-brand {
  display: flex;
  flex-wrap: wrap;
  grid-template-columns: none;
  margin-bottom: 24px;
}

.view-admin .home-tools {
  grid-column: auto;
  flex-wrap: wrap;
  margin-left: auto;
}

.home-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  width: 100%;
  min-width: 0;
}

.home-title {
  grid-column: 2;
  min-width: 0;
}

.home-title h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  line-height: 1.25;
}

.home-tools {
  grid-column: 3;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

a#btn-admin-home {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
}

/* Startseite: Join zentriert, große Eingabe, kein Zwei-Spalten-Create. */
.home-join {
  width: min(28rem, 100%);
  margin-inline: auto;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-join .join-panel {
  overflow: visible;
}

.home-join #join-code-input {
  font-size: 1.5rem;
  letter-spacing: 0.28em;
  text-align: center;
  min-height: 3.25rem;
  font-variant-numeric: tabular-nums;
}

.home-join .btn.primary {
  width: 100%;
  min-height: 48px;
}

.admin-back {
  color: var(--link);
  font-weight: 650;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
}

.admin-back:hover,
.admin-back:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ----- Sessions-Hub (#/admin): Übersicht + Create-Form + Sidebar ----- */
.admin-sessions-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(17rem, 100%);
  gap: 14px;
  align-items: start;
  max-width: 72rem;
}

/* Linke Spalte: Hub-Übersicht + Create-Form (Listen-Chrome). */
.admin-sessions-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.admin-create-form.panel {
  padding: 16px 18px;
}

.admin-form-intro {
  margin-bottom: 12px;
}

.admin-form-intro h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.admin-form-lead {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.admin-form-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Admin-Listen (Teams/Users): gleicher Abschnitts-Chrome wie Events-Liste. */
.admin-list-chrome.admin-form-sections {
  margin-top: 12px;
}

.admin-list-chrome .users-toolbar,
.admin-list-chrome .teams-grid {
  margin-top: 8px;
}

.admin-list-chrome .table-wrap,
.admin-list-chrome .list-pager-wrap {
  margin-top: 8px;
}

.admin-form-section--collapsible > summary.admin-form-section__title {
  cursor: pointer;
  list-style: none;
}

.admin-form-section--collapsible > summary.admin-form-section__title::-webkit-details-marker {
  display: none;
}

.admin-form-section--collapsible > summary.admin-form-section__title::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.admin-form-section--collapsible[open] > summary.admin-form-section__title::before {
  transform: rotate(90deg);
}

.admin-form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
}

.admin-form-section--compact {
  padding: 10px 14px;
}

.admin-form-section__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-form-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-form-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.admin-form-grid {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.admin-form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form-grid--type-q {
  grid-template-columns: minmax(9rem, 11rem) minmax(0, 1fr);
}

.admin-form-grid__span {
  grid-column: 1 / -1;
}

.field--compact {
  margin-top: 0;
  gap: 6px;
}

/* Plattform-Workspaces: Plan/Override-Controls in einer Zellen-Spalte */
.workspaces-admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  min-width: 14rem;
}

.workspaces-admin-actions .field--compact {
  margin: 0;
}

.workspaces-admin-actions select {
  max-width: 11rem;
}

.field--inline {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.options-editor--compact {
  margin-top: 8px;
}

.options-editor--compact .field {
  margin-top: 8px;
}

.deck-editor.admin-form-section {
  border-top: none;
  margin-top: 0;
  padding-top: 12px;
}

.deck-draft-host {
  margin-top: 8px;
}

.admin-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-form-actions__secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

/* UX-Transfer Session-Start: Ablauf-Gruppe + Untertitel in Nested-Blöcken. */
.admin-form-section--flow {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form-section__title--sub {
  font-size: 0.95em;
  font-weight: 600;
  margin: 0 0 4px;
}

.admin-form-section--nested {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* Dynamische Formular-Abschnitte: weiches Ein-/Ausblenden (300 ms). */
.form-section--anim {
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  max-height: 2400px;
  opacity: 1;
}

.form-section--anim[hidden] {
  display: block !important;
  max-height: 0;
  opacity: 0;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0;
  pointer-events: none;
}

.admin-form-section--collapsible summary {
  cursor: pointer;
  list-style: none;
}

.admin-form-section--collapsible summary::-webkit-details-marker {
  display: none;
}

.option-fields-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: max-height 0.3s ease;
}

/* Picker: Teilnehmer- und Ergebnis-Ansicht */
.picker-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 36rem;
  margin: 0 auto;
}

.picker-search {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.picker-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.picker-cat-btn {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 0.85rem;
}

.picker-cat-btn.is-active {
  border-color: var(--primary-color, #003399);
  background: color-mix(in srgb, var(--primary-color, #003399) 12%, transparent);
}

.picker-options {
  display: grid;
  gap: 8px;
  max-height: min(60vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.picker-options--grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.picker-options--list,
.picker-options--dropdown {
  grid-template-columns: 1fr;
}

.picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg);
  contain: content;
}

/* Join: Kurzbezeichnung größer und fett — voller Labeltext nur als Tooltip/ARIA. */
.picker-option .picker-label {
  font-size: clamp(0.98rem, 2.9vw, 1.14rem);
  font-weight: 650;
  line-height: 1.2;
}

.picker-option.is-selected {
  border-color: var(--primary-color, #003399);
  box-shadow: inset 0 0 0 1px var(--primary-color, #003399);
}

.picker-option:focus-visible {
  outline: 2px solid var(--secondary-color, #ffcc00);
  outline-offset: 2px;
}

.picker-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.picker-label mark {
  background: color-mix(in srgb, var(--secondary-color, #ffcc00) 55%, transparent);
  padding: 0 2px;
}

.picker-virtual-viewport {
  position: relative;
  max-height: min(60vh, 420px);
  overflow: auto;
}

.picker-virtual-window {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: grid;
  gap: 8px;
}

.picker-confirm {
  align-self: flex-start;
}

.picker-counter {
  margin: 0;
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .picker-options--grid {
    grid-template-columns: 1fr;
  }
}

/* Dropdown Single-Select */
.picker-input--dropdown {
  max-width: 28rem;
}

.picker-dropdown {
  position: relative;
}

.picker-dropdown-trigger {
  width: 100%;
  min-height: 48px;
  text-align: left;
  padding: 0.65rem 2rem 0.65rem 0.85rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg);
  position: relative;
}

.picker-dropdown-trigger::after {
  content: "▾";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
}

.picker-dropdown-trigger.has-value {
  border-color: var(--primary-color, #003399);
}

.picker-dropdown-panel {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: min(50vh, 320px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
  padding: 8px;
}

.picker-dropdown-search {
  margin-bottom: 6px;
}

.picker-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.picker-dropdown-item {
  width: 100%;
  text-align: left;
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: clamp(0.98rem, 2.9vw, 1.14rem);
  font-weight: 650;
}

.picker-dropdown-item:hover,
.picker-dropdown-item:focus-visible {
  background: var(--bg-soft);
  outline: none;
}

.picker-dropdown-item.is-selected {
  border-color: var(--primary-color, #003399);
  background: color-mix(in srgb, var(--primary-color, #003399) 8%, transparent);
}

/* Kategorien-Editor (Admin) */
.picker-categories-editor {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.picker-cat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.picker-cat-row input[type="text"] {
  min-height: 36px;
}

.picker-cat-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.option-row .picker-opt-cat-slot select,
.slide-edit-option .picker-opt-cat {
  min-height: 36px;
  max-width: 10rem;
}

.picker-result-display-settings {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.picker-result-display-settings legend {
  padding: 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.picker-result-count-label-count {
  display: block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.picker-editor-preview {
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.picker-preview-box {
  max-height: 180px;
  overflow: auto;
  border-radius: 8px;
  padding: 4px;
  background: var(--bg-soft);
}

.picker-results-cat-title {
  margin: 12px 0 6px;
  padding-left: 8px;
  border-left: 4px solid var(--primary-color, #003399);
  font-size: 0.9rem;
}

/* Picker: zweistufige Kategorie-Navigation (Join) */
.picker-step-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.picker-step-title {
  margin: 0;
  font-weight: 650;
  font-size: 1.05rem;
}

.picker-category-step__intro {
  margin: 0 0 0.65rem;
}

.picker-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  gap: 0.65rem;
}

.picker-category-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 44px;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg);
  border-left-width: 4px;
  border-left-color: var(--cat-accent, var(--primary-color, #003399));
}

.picker-category-tile__name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.picker-category-tile__count {
  font-size: 0.85rem;
}

/* Picker: Bubble-Ergebnisse (stimmenzentriert, ohne Kategoriegruppen) */
.picker-results--bubbles {
  width: 100%;
  min-width: 0;
}

.picker-bubble-grid {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: min(58vh, 480px);
}

.picker-bubble-canvas {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-height: 10rem;
  margin: 0;
}

/* Kategorielegende: Overlay oben rechts, Swatch rechts neben Beschriftung. */
.picker-results-legend {
  position: absolute;
  top: 0.25rem;
  /* Minimaler Rand — Legende liegt nah am rechten Bildschirmrand. */
  right: 0.08rem;
  z-index: 3;
  max-width: min(38%, 280px);
  pointer-events: none;
  box-sizing: border-box;
}

.picker-results-legend[hidden] {
  display: none;
}

.picker-category-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Vertikale Stapelung für Stage/Join-Ergebnisse */
.picker-category-legend--stacked {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0.28rem;
  text-align: right;
}

.picker-category-legend__item {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  max-width: 100%;
  /* Eine Stufe größer als zuvor; JS setzt px-Wert aus Metriken wenn verfügbar. */
  font-size: var(--picker-legend-font-size, clamp(0.76rem, 1.55vw, 0.92rem));
  color: #000;
}

.picker-category-legend__swatch {
  flex: 0 0 auto;
  width: var(--picker-legend-swatch-size, 12px);
  height: var(--picker-legend-swatch-size, 12px);
  border-radius: 50%;
  background: var(--legend-color, #2563eb);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.picker-category-legend__label {
  overflow-wrap: anywhere;
}

.picker-bubble-canvas--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
}

.picker-results-empty {
  margin: 0;
  font-size: var(--stage-body-size, 1rem);
  text-align: center;
}

.picker-bubble {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--bubble-width, var(--bubble-size, 104px));
  height: var(--bubble-height, var(--bubble-size, 104px));
  border-radius: 50%;
  background: var(--picker-bubble-surface, rgba(255, 255, 255, 0.94));
  border: var(--picker-bubble-border-width, 4px) solid var(--picker-bubble-color, #2563eb);
  color: #000;
  text-align: center;
  padding: 0.28rem 0.55rem;
  box-sizing: border-box;
  /* Text muss vollständig in der Ellipse bleiben — kein Überlauf nach außen. */
  overflow: hidden;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.07);
  transition: left 0.35s ease, top 0.35s ease, width 0.35s ease, height 0.35s ease;
  --float-x: 3px;
  --float-y: 2px;
  --float-duration: 7s;
  --float-delay: -2s;
}

.picker-bubble--live {
  animation: picker-bubble-float var(--float-duration) ease-in-out var(--float-delay) infinite alternate;
  will-change: transform;
}

.picker-bubble-grid[data-page-hidden="true"] .picker-bubble--live {
  animation-play-state: paused;
}

@keyframes picker-bubble-float {
  from {
    transform: translate3d(calc(var(--float-x) * -1), calc(var(--float-y) * -1), 0);
  }
  to {
    transform: translate3d(var(--float-x), var(--float-y), 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .picker-bubble,
  .picker-bubble--live {
    animation: none;
    transition: none;
  }
}

.picker-bubble__label {
  display: block;
  /* 94 % Innenbreite — muss mit PICKER_BUBBLE_INSET_X in bubbleViewModel übereinstimmen. */
  max-width: 94%;
  font-weight: 650;
  font-size: var(--picker-bubble-label-size, clamp(0.72rem, 2vw, 0.96rem));
  line-height: 1.14;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  /* Kein text-overflow: ellipsis — Beschriftung muss vollständig sichtbar bleiben. */
  white-space: normal;
  color: #000;
}

/* Screenreader-Reihenfolge (visuell ausgeblendet) */
.picker-bubble-sr-list {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fallback-Liste bei Platzmangel */
.picker-bubble-canvas--list {
  min-height: auto;
}

/* Abgerundete Ergebnis-Rechtecke: Kachelfläche skaliert mit den Stimmen (Treemap) */
.picker-bubble-canvas--tiles {
  min-height: auto;
}

.picker-tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  /* Innenabstand muss zu TILE_INSET_X/Y in treemapLayout.js passen. */
  padding: 0.25rem 0.375rem;
  border-radius: var(--picker-tile-radius, 0.45rem);
  background: var(--picker-bubble-surface, #fff);
  border: var(--picker-bubble-border-width, 3px) solid var(--picker-tile-color, #2563eb);
  color: #000;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.picker-tile__label {
  display: block;
  max-width: 100%;
  font-weight: 650;
  font-size: var(--picker-bubble-label-size, clamp(0.85rem, 2.2vw, 1.35rem));
  line-height: 1.12;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  color: #000;
}

.picker-results-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Mehrspaltige Ergebnisliste — dynamische Spaltenanzahl aus Layout-Berechnung */
.picker-results-list--grid {
  display: grid;
  grid-template-columns: repeat(var(--picker-list-columns, 1), minmax(0, 1fr));
  column-gap: var(--picker-list-col-gap, 0.65rem);
  row-gap: var(--picker-list-row-gap, 0.35rem);
  width: 100%;
  height: 100%;
  align-content: start;
  box-sizing: border-box;
}

.picker-results-list__item {
  /* Kompakte Zeile: Punkt, Label und Stimmen direkt nebeneinander — kein Vollbreiten-Grid. */
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  max-width: 100%;
}

.picker-results-list__dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-top: 0.2rem;
  background: var(--picker-bubble-surface, #fff);
  border: var(--picker-bubble-border-width, 3px) solid var(--dot-color, #2563eb);
  box-sizing: border-box;
}

.picker-results-list__label {
  flex: 0 1 auto;
  font-size: var(--picker-bubble-label-size, 0.96rem);
  color: #000;
  overflow-wrap: anywhere;
}

.picker-results-list__votes {
  flex: 0 0 auto;
  margin-left: 0.15rem;
  font-size: var(--picker-bubble-count-size, 0.78rem);
  color: #000;
  opacity: 0.85;
  white-space: nowrap;
}

/* Picker-Editor: Option und Kurzbezeichnung in einer Zeile */
.picker-options-hint {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
}

.picker-option-header {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(5.5rem, 0.72fr) auto;
  gap: 0.35rem 0.5rem;
  align-items: end;
  padding: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #666);
  border-bottom: 1px solid var(--line);
}

.picker-option-header--cats {
  grid-template-columns: minmax(0, 1.15fr) minmax(5rem, 0.62fr) minmax(5.5rem, 0.55fr) auto;
}

.picker-option-header__actions {
  justify-self: end;
}

.slide-edit-option--picker {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(5.5rem, 0.72fr) auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}

.slide-edit-option--picker-cats {
  grid-template-columns: minmax(0, 1.15fr) minmax(5rem, 0.62fr) minmax(5.5rem, 0.55fr) auto;
}

.slide-edit-option--picker .slide-option-row__label,
.slide-edit-option--picker .slide-option-row__short {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  box-sizing: border-box;
}

.slide-edit-option__short-cell {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.slide-edit-option__short-cell .slide-option-row__short {
  flex: 1 1 auto;
}

.slide-edit-option__cat-slot {
  min-width: 0;
}

.slide-edit-option__cat-slot .picker-opt-cat {
  width: 100%;
  max-width: none;
}

.slide-edit-option__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
  align-items: center;
  justify-self: end;
}

.picker-short-label-count {
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: var(--muted, #666);
  white-space: nowrap;
}

.picker-editor-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
}

.picker-preview-collapsible {
  margin-top: 0.5rem;
}

.picker-preview-collapsible > summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  list-style-position: outside;
}

.picker-editor-preview {
  margin-top: 0.35rem;
}

.admin-sessions-sidebar {
  position: sticky;
  top: calc(var(--admin-chrome-height, 52px) + 8px);
  padding: 14px 16px;
}

.recent-list--compact {
  gap: 6px;
}

.recent-list--compact a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  text-decoration: none;
  font-size: 0.88rem;
}

.recent-list--compact a:hover,
.recent-list--compact a:focus-visible {
  border-color: var(--btn-primary-bg);
}

.recent-list--compact strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.recent-list--compact .muted {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn--sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.88rem;
}

.admin-create-form .deck-item {
  padding: 6px 8px;
  border-radius: 10px;
}

.admin-create-form .deck-list {
  gap: 6px;
}

.create-panel {
  overflow: visible;
}

.join-panel {
  overflow: auto;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.option-row .picker-opt-cat-slot:not([hidden]) select {
  min-width: 7rem;
}

.home-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.recent-panel {
  margin-top: 16px;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-list a {
  color: var(--link);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ----- Presenter ----- */
.view-present {
  /* Kopf | Bühne (dominant) | Steuerung */
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.view-present .present-head {
  min-height: 0;
}

.view-present .present-stage {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.present-stage-head {
  flex: 0 0 auto;
  padding: 12px 16px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg-elev, #fff) 96%, transparent);
  /* Über #results-teaser (z-index: 2) — Frage bleibt beim Folienwechsel sichtbar */
  position: relative;
  z-index: 3;
}

.present-stage-live-meta {
  margin: 0 0 8px;
  font-size: clamp(0.75rem, 1.6vw, 0.88rem);
  font-weight: 650;
  line-height: 1.35;
  color: color-mix(in srgb, var(--ink, #111) 68%, transparent);
}

.present-stage-question {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  line-height: 1.3;
  font-weight: 700;
}

.present-stage-subtitle,
.present-stage-prompt {
  margin: 6px 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

/* Multiple Choice: Antwortoptionen in der Presenter-Infobox */
.present-stage-choice-options {
  margin-top: 10px;
}

.present-stage-choice-options-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.present-stage-choice-option {
  margin: 0;
  padding: 8px 10px 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-soft, #f5f5f5) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--line, #ddd) 80%, transparent);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--ink, #111);
}

.present-stage-choice-option[data-color="0"] { border-left: 5px solid var(--c1, #b42318); }
.present-stage-choice-option[data-color="1"] { border-left: 5px solid var(--c2, #175cd3); }
.present-stage-choice-option[data-color="2"] { border-left: 5px solid var(--c3, #027a48); }
.present-stage-choice-option[data-color="3"] { border-left: 5px solid var(--c4, #93370d); }
.present-stage-choice-option[data-color="4"] { border-left: 5px solid var(--c5, #6941c6); }
.present-stage-choice-option[data-color="5"] { border-left: 5px solid var(--c6, #155eef); }

.view-present .present-stage > .stage-panel,
.view-present .present-stage > .wordcloud-stage,
.view-present .present-stage > .present-slide-canvas {
  flex: 1 1 auto;
  min-height: 0;
}

.view-present #present-question {
  /* Frage nur in der Vorschau — Header bleibt kompakt */
}

/* ----- Presenter Overview-First ----- */
.present-top--overview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 0;
}

.present-top-brand {
  flex: 1 1 12rem;
  min-width: 0;
}

.present-top-back {
  flex-shrink: 0;
  white-space: nowrap;
}

.present-top-sep {
  opacity: 0.45;
  margin: 0 2px;
}

.present-event-title {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(28vw, 20rem);
  display: inline-block;
  vertical-align: bottom;
}

.present-top-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
}

.present-live-badge {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.present-live-badge[data-state="live"] {
  color: var(--status-ok, #0a7);
}

.present-live-badge[data-state="pause"],
.present-live-badge[data-state="countdown"] {
  color: var(--status-warn, #c80);
}

.present-live-badge[data-state="ended"] {
  color: var(--danger, #c33);
}

.present-header-stat,
.present-header-join {
  font-size: 0.82rem;
  min-height: 34px;
  padding: 4px 10px;
}

.present-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.present-live-status {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.35;
  color: color-mix(in srgb, var(--ink, #111) 88%, transparent);
}

/* Kontext steht in #present-stage-head — alte Zeile unter der Box ausblenden */
.present-live-status:not(.sr-only) {
  display: none;
}

.present-control-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink, #111) 55%, transparent);
}

.present-slide-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.present-slide-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  max-width: 11rem;
  padding: 4px 10px;
  border-radius: var(--radius-pulse-sm, 0.75rem);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 0.8rem;
  cursor: pointer;
  scroll-snap-align: start;
}

.present-slide-chip.is-active {
  border-color: color-mix(in srgb, var(--accent, #0066cc) 55%, var(--line));
  background: color-mix(in srgb, var(--accent, #0066cc) 10%, var(--bg-elev));
  font-weight: 650;
}

.present-slide-chip-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  opacity: 0.75;
}

.present-slide-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.present-slide-chip-add {
  justify-content: center;
  min-width: 36px;
  font-size: 1.1rem;
  font-weight: 700;
}

.present-special-bar {
  min-height: 0;
}

.present-special-bar-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.present-special-bar-btn {
  min-height: 38px;
  font-size: 0.82rem;
}

.present-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.view-present .present-nav-overflow {
  position: relative;
}

.present-toolbar-stage {
  font-size: 0.82rem;
  min-height: 36px;
}

.present-toolbar-more {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-pulse-sm, 0.75rem);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-weight: 750;
  font-size: 1.1rem;
}

.present-panel-dialog {
  max-width: min(92vw, 28rem);
  border: none;
  border-radius: 16px;
  padding: 0;
}

.present-panel-dialog::backdrop {
  background: color-mix(in srgb, #000 45%, transparent);
}

.present-panel-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.present-panel-dialog-head h2 {
  margin: 0;
  font-size: 1rem;
}

.present-panel-close {
  min-width: 36px;
  min-height: 36px;
  font-size: 1.25rem;
  line-height: 1;
}

.present-panel-dialog .presenter-stats {
  border: none;
  border-radius: 0;
  margin: 0;
}

.present-join-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 18px;
}

.present-join-url {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  word-break: break-all;
}

.present-join-fallback {
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
}

.present-join-code-line {
  margin: 0;
  font-size: 1.05rem;
}

.present-join-qr {
  width: min(220px, 70vw);
  height: auto;
  aspect-ratio: 1;
}

/* Status-Badge oben rechts in der Hauptbox (aktive Sonderfolie) */
.present-stage-status {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 6;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink, #111);
  background: color-mix(in srgb, var(--bg-elev, #fff) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink, #111) 12%, transparent);
  box-shadow: 0 1px 4px color-mix(in srgb, #000 8%, transparent);
  pointer-events: none;
}

.present-stage-status[hidden] {
  display: none !important;
}

.present-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 52px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.92rem;
}

.present-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}

.lobby-overlay[hidden] {
  display: none !important;
}

.lobby-qr {
  width: min(42vh, 240px);
  height: auto;
  aspect-ratio: 1 / 1;
}

/* Deckt nur die Folienfläche — Kopf (#present-stage-head) bleibt darüber sichtbar */
.results-teaser {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.results-teaser[hidden] {
  display: none !important;
}

.reaction-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.reaction-float {
  position: absolute;
  bottom: 6%;
  font-size: 2.4rem;
  animation: reaction-rise 1.6s ease-out forwards;
}

.reaction-float--subtle {
  font-size: 1.85rem;
  opacity: 0.88;
  animation-duration: 2s;
}

.reaction-float--reduced {
  animation: reaction-rise-reduced 0.9s ease-out forwards;
}

@keyframes reaction-rise {
  to {
    transform: translateY(-72vh) scale(1.35);
    opacity: 0;
  }
}

@keyframes reaction-rise-reduced {
  to {
    transform: translateY(-24vh);
    opacity: 0;
  }
}

.reaction-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: auto;
  padding-top: 8px;
}

.join-lobby {
  text-align: center;
  font-size: 1.1rem;
}

.stage-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.stage-panel[hidden] {
  display: none !important;
}

.wordcloud-stage {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 22%);
  min-height: 0;
  height: 100%;
}

.wordcloud-stage .wordcloud-surface {
  min-height: 0;
  height: 100%;
}

#wordcloud-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.deck-chip-add {
  font-size: 1.2rem;
}

/* Sonderfolien-Chips in der Presenter-Folienleiste (Countdown / Pause / Ende) */
.deck-chip-special {
  min-width: auto;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-style: dashed;
}

.deck-chip-special-icon {
  font-size: 1rem;
  line-height: 1;
}

.deck-chip-special-label {
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-chip-special.is-active {
  border-style: solid;
  border-color: var(--btn-primary-bg, var(--accent, #2563eb));
  background: color-mix(in srgb, var(--btn-primary-bg, var(--accent, #2563eb)) 12%, var(--bg-soft));
}

.deck-chip-special--end.is-active.is-confirmed {
  font-weight: 700;
}

@media (max-width: 640px) {
  .deck-chip-special-label {
    display: none;
  }

  .deck-chip-special {
    min-width: 44px;
    padding: 0;
  }
}

.deck-editor {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.deck-editor h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.deck-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deck-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.deck-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-actions {
  display: flex;
  gap: 4px;
}

.deck-empty {
  margin: 8px 0;
}

.join-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slide-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ----- Teilnehmer ----- */
.view-join {
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.join-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.join-top strong {
  font-family: var(--mono);
  letter-spacing: 0.2em;
}

.join-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow: auto;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.rating-scale {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

@media (max-width: 860px) {
  .admin-sessions-layout,
  .admin-form-grid--2,
  .admin-form-grid--type-q,
  .admin-template-grid,
  .wordcloud-stage,
  .present-top,
  .qa-top3,
  .quiz-head,
  .quiz-cards {
    grid-template-columns: 1fr;
  }

  .present-top {
    justify-items: start;
  }

  .slide-question {
    text-align: left;
  }

  .word-rank {
    display: none;
  }

  .poll-row {
    grid-template-columns: 1fr auto;
  }

  .poll-label {
    grid-column: 1 / -1;
  }

  .qa-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-sessions-layout {
    grid-template-columns: 1fr;
  }

  .admin-sessions-sidebar {
    position: static;
  }
}

/* ----- Admin-Leiste (Sessions, Branding, Datenschutz, SSL, Einstellungen) ----- */
.admin-chrome {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  padding: 8px var(--pad);
}

.admin-chrome[hidden] {
  display: none !important;
}

.admin-chrome-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

/* ----- Admin-Navigation: Bereiche + Links (Seitenleiste und Schublade) ----- */
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.admin-nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-nav-section[hidden],
.admin-nav-link[hidden] {
  display: none !important;
}

.admin-nav-section__title,
.admin-nav-section__toggle {
  margin: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.admin-nav-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.admin-nav-section__toggle:hover,
.admin-nav-section__toggle:focus-visible {
  background: var(--bg-soft);
  color: var(--ink);
}

.admin-nav-section__toggle:focus-visible,
.admin-nav-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.admin-nav-section__chevron {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}

.admin-nav-section__toggle[aria-expanded="false"] .admin-nav-section__chevron {
  transform: rotate(-90deg);
}

.admin-nav-section__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-nav-section__list.is-collapsed {
  display: none;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.admin-nav-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-nav-link:hover {
  background: var(--bg-soft);
}

.admin-nav-link.is-active {
  background: color-mix(in srgb, var(--primary-color) 16%, var(--bg-elev));
  box-shadow: inset 3px 0 0 var(--primary-color);
}

@media (prefers-reduced-motion: reduce) {
  .admin-nav-section__chevron {
    transition: none;
  }
}

/* ----- Admin-Seitenleiste (ab 68.75rem) ----- */
.admin-sidebar {
  display: none;
}

.admin-chrome-current {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-section__heading {
  margin: 0;
}

/* Namen-Tooltip der Icon-Leiste bei Tastaturfokus (title erscheint nur beim Hovern). */
.admin-rail-tip {
  position: fixed;
  z-index: 50;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg-elev);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  transform: translateY(-50%);
  white-space: nowrap;
}

@media (min-width: 68.75rem) {
  body.admin-area {
    --admin-sidebar-w: 15rem;
  }

  body.admin-area.admin-sidebar-collapsed {
    --admin-sidebar-w: 4rem;
  }

  body.admin-area .app {
    padding-left: var(--admin-sidebar-w);
  }

  body.admin-area .app-footer {
    padding-left: calc(var(--admin-sidebar-w) + var(--pad));
  }

  body.admin-area .admin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: fixed;
    z-index: 31;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--admin-sidebar-w);
    box-sizing: border-box;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
    background: var(--bg-elev);
    border-right: 1px solid var(--line);
  }

  body.admin-area .admin-sidebar__title {
    margin: 0;
    padding: 0.35rem 0.75rem;
    font-weight: 700;
  }

  body.admin-area .admin-sidebar__collapse {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    background: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
  }

  body.admin-area .admin-sidebar__collapse:hover,
  body.admin-area .admin-sidebar__collapse:focus-visible {
    background: var(--bg-soft);
  }

  body.admin-area .admin-sidebar__collapse svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body.admin-area.admin-sidebar-collapsed .admin-sidebar__collapse svg {
    transform: rotate(180deg);
  }

  body.admin-area .admin-nav-toggle {
    display: none;
  }

  /* Icon-Leiste: Labels nur visuell weg (Screenreader behalten sie), alle Icons erreichbar. */
  body.admin-sidebar-collapsed .admin-sidebar .admin-nav-link__label,
  body.admin-sidebar-collapsed .admin-sidebar .admin-sidebar__title,
  body.admin-sidebar-collapsed .admin-sidebar .admin-nav-section__title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  /* Bereichs-Umschalter würden hier nur unsichtbare Tab-Stopps sein; die Gruppen behalten ihren
     Namen über role="group" + aria-label an der Liste. */
  body.admin-sidebar-collapsed .admin-sidebar .admin-nav-section__heading {
    display: none;
  }

  body.admin-sidebar-collapsed .admin-sidebar .admin-nav-section__list.is-collapsed {
    display: flex;
  }

  body.admin-sidebar-collapsed .admin-sidebar .admin-nav-link {
    justify-content: center;
    padding: 0;
  }
}

/* ----- Nutzer-Menü (Kopfleiste) ----- */
.admin-user-menu {
  position: relative;
}

.admin-user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.admin-user-menu__trigger::-webkit-details-marker {
  display: none;
}

.admin-user-menu__trigger:hover,
.admin-user-menu__trigger:focus-visible {
  background: var(--bg-soft);
}

.admin-user-menu__trigger:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.admin-user-menu__trigger svg,
.admin-user-menu__link svg {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-user-menu__panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 16rem;
  padding: 0.6rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.admin-user-menu__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0 0.6rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.admin-user-menu__link:hover,
.admin-user-menu__link:focus-visible {
  background: var(--bg-soft);
}

.admin-user-menu__link.is-active {
  background: color-mix(in srgb, var(--primary-color) 16%, var(--bg-elev));
}

.admin-user-menu__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0 0.6rem;
  font-weight: 600;
}

/* Usability M6: Workspace-Hub auf dem Sessions-Start
 * .admin-sessions-layout ist ein Grid (Hauptbereich + Sidebar) — ohne grid-column würde dieses Kind als
 * normales Grid-Item in die erste Spalte fallen und den eigentlichen Hauptbereich (.admin-sessions-main)
 * in die schmale Sidebar-Spalte verdrängen (siehe Kommentar in index.html: "vor Sessions-Chrome" = volle
 * Breite, eigene Zeile oberhalb — nicht Spalten-Geschwister). Funktioniert unverändert im 1-Spalten-Fall
 * (admin-mobile.css, < 56rem), da grid-column dort nur eine einzige Spalte überspannt.
 */
.admin-workspace-hub {
  grid-column: 1 / -1;
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-elev, #fff) 88%, var(--primary-color) 12%);
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.admin-workspace-hub__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

.admin-workspace-hub__checklist,
.admin-workspace-hub__status {
  margin-top: 1rem;
}

.admin-setup-checklist,
.admin-hub-warnings {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.admin-hub-warnings a {
  color: inherit;
  font-weight: 650;
}

/* Usability M8: Join-Mini-Vorschau auf Branding */
.brand-contrast-status {
  margin: 0.35rem 0 0.75rem;
}

.brand-join-preview {
  margin: 0 0 1rem;
}

.brand-join-preview__card {
  max-width: 18rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background: var(--brand-join-preview-bg, #fff);
  color: var(--brand-join-preview-ink, #1a1d23);
}

.brand-join-preview__logo {
  max-height: 2rem;
  max-width: 8rem;
  margin-bottom: 0.5rem;
  object-fit: contain;
}

.brand-join-preview__name {
  margin: 0 0 0.25rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-join-preview__hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}

.brand-join-preview__cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.9rem;
  border-radius: 8px;
  background: var(--brand-join-preview-accent, var(--primary-color, #007cc1));
  color: var(--brand-join-preview-cta-ink, #fff);
  font-weight: 650;
  font-size: 0.9rem;
}

.admin-chrome-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ----- Einheitlicher Admin-Seitenkopf: Pfad › Titel › Kurztext (+ Aktion rechts) ----- */
.admin-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 1.25rem;
}

.admin-page-head__main {
  display: flex;
  flex: 1 1 18rem;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.admin-page-head__title {
  margin: 0;
  font-size: clamp(1.3rem, 3.5vw, 1.65rem);
  line-height: 1.2;
}

.admin-page-head__lead {
  max-width: 62ch;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.admin-page-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.admin-page-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.admin-crumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  list-style: none;
}

.admin-crumbs__item + .admin-crumbs__item::before {
  content: "›";
  margin-right: 0.25rem;
}

.admin-crumbs a {
  color: inherit;
}

.admin-crumbs [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* Die öffentliche Hilfe (#/help) hat keinen Admin-Pfad. */
.view-help:not(.is-admin-help) .admin-crumbs {
  display: none;
}

/*
  Admin-Seiten scrollen im .app, damit die Leiste sticky bleibt
  (interne View-Scrollcontainer würden sie mit wegschieben).
*/
body.admin-area .view:not([hidden]) {
  display: block;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: visible;
}

/* ----- Login / Benutzerverwaltung ----- */
.view-login,
.view-users,
.view-profile,
.view-forbidden {
  max-width: 720px;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(3rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.view-login .login-page .btn,
.view-forbidden .modal-actions .btn {
  min-height: 48px;
}

.admin-user-link {
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-user-link:hover {
  text-decoration: underline;
}

.step-up-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.admin-login-dialog {
  border: none;
  padding: 0;
  max-width: min(480px, calc(100vw - 2rem));
  width: 100%;
  background: transparent;
  z-index: 100;
}

.admin-login-host .login-page.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.admin-login-host .login-page {
  margin: 0;
}

.admin-forbidden-panel {
  max-width: 36rem;
  margin: 2rem auto;
}

.admin-login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0;
  border: none;
}

.backup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.backup-table th,
.backup-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08));
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.backup-checksum {
  font-size: 0.82rem;
}

.backups-panel,
.backups-upload,
.backup-list-wrap {
  margin-bottom: 1.25rem;
}

.backup-msg-error {
  color: var(--danger, #b91c1c);
}

.backup-restore-dialog .panel {
  max-width: 36rem;
  max-height: 85vh;
  overflow: auto;
}

.backup-restore-groups {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.backup-restore-section {
  border: 1px solid var(--line, #ddd);
  border-radius: 6px;
  padding: 0.5rem 0.75rem 0.65rem;
  margin: 0;
}

.backup-restore-section legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

.backup-restore-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.35rem 0;
  font-size: 0.92rem;
}

.backup-restore-item.is-missing {
  opacity: 0.55;
}

.backup-restore-hint {
  font-size: 0.88rem;
}

.backup-version-warn {
  color: var(--status-warn, #d35400);
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.onboarding-panel {
  max-width: 40rem;
}

.btn-warning {
  border-color: var(--status-warn-bg, #e67e22);
  color: var(--status-warn, #d35400);
}

.login-page {
  padding: 1.5rem;
  /* M-001: Karte darf auf schmalen Phones nicht über den Viewport hinausragen. */
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.login-step[hidden] {
  display: none !important;
}

/*
  M-001 — PIN-Zeile mobil ohne horizontalen Overflow.
  Festes 2.75rem × 6 + Gaps (~19rem) sprengt 320–375 px inkl. Panel-/View-Padding.
  Flex + schrumpfbare Felder halten Touch-Ziele ≥2rem und zentrieren auf Desktop.
*/
.pin-input-row {
  display: flex;
  gap: clamp(0.2rem, 1.8vw, 0.5rem);
  justify-content: center;
  align-items: stretch;
  margin: 1rem 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.pin-digit {
  flex: 1 1 0;
  width: 0;
  max-width: 2.75rem;
  /* Untergrenze: noch tippbar, aber schmal genug für iPhone-SE-Breite. */
  min-width: 2rem;
  height: 3rem;
  text-align: center;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  border: 2px solid var(--line, #ccc);
  border-radius: 8px;
  box-sizing: border-box;
}

.pin-digit:focus {
  border-color: var(--primary-color, #007cc1);
  outline: 2px solid var(--primary-color, #007cc1);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  /* Weniger Horizontal-Padding → mehr Platz für die sechs PIN-Felder. */
  .login-page {
    padding: 1.15rem 0.75rem;
  }

  .view-login {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .pin-digit {
    height: 2.75rem;
    /* ≥16px gegen iOS-Auto-Zoom; kompakter als Desktop für kurze Viewports. */
    font-size: 1.25rem;
  }
}

.login-error {
  color: var(--danger, #b91c1c);
  margin-top: 1rem;
}

.login-dev-mailbox {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px dashed var(--line, #ccc);
  border-radius: 8px;
  font-size: 0.875rem;
}

.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.users-table th,
.users-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line, #e0e0e0);
  text-align: left;
}

.users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.admin-user-label {
  font-size: 0.875rem;
  margin-right: 0.5rem;
}

/* Team-Verwaltung (#/admin/teams) */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

/* H-007: clientseitige Listen-Pager (z. B. Teams) */
.list-pager-wrap {
  margin-top: 1rem;
}

.list-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.list-pager__status {
  font-size: 0.875rem;
}

.team-card-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.team-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.teams-dialog-panel {
  max-width: 36rem;
}

.add-member-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.members-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.member-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line, #e0e0e0);
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.team-events-section {
  margin-top: 1.5rem;
}
