:root {
  /* Mobile Drawer: gleiche Schwelle wie mockups/index.html (880px) */
  --nav-drawer-max: 880px;
  /* Corporate Identity */
  --accent: #1931e4;
  --accent-mid: #2f46ec;
  --accent-dark: #1529c7;
  --accent-light: #e1eaff;
  --accent-glow: rgba(25, 49, 228, 0.2);
  --brand-green: #82f4ad;
  --ok: #146a45;
  --warn: #f59e0b;
  --off: #9ca3af;
  --bg: #f4f6fc;
  --surface: #ffffff;
  --border: #dde2f0;
  --text: #1a1f36;
  --muted: #5c6488;
  --subtle: #8890b0;
  --nav-w: 220px;
  --dd-shadow: 0 8px 24px rgba(25, 49, 228, 0.12);
  --font: "Montserrat", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  /* Einheitliche Eingabefelder / Form-Controls */
  --control-font-size: 13px;
  --control-height: 40px;
  --control-radius: 8px;
  --control-padding-x: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

/* iOS/Safari: Bereich unter Statusleiste/Notch nutzt oft den html-Hintergrund (sonst weiß). */
html.app-shell {
  background-color: var(--accent);
}

body.app-body {
  background-color: var(--accent);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  background-color: var(--accent);
}

/* ── Left Nav ── */
.nav-sidebar {
  width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 12px 14px;
  z-index: 20;
  flex-shrink: 0;
}

.nav-brand {
  width: 100%;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

/* Logo in Akzentfarbe, volle Breite der Nav-Bar */
.nav-brand-mark {
  width: 100%;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.nav-brand-mark img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  object-position: center;
  filter: brightness(0) invert(1);
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: #f3f4f6;
  color: var(--muted);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-link svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-sep {
  height: 1px;
  background: var(--border);
  margin: 8px 6px;
}

.nav-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  margin-right: 2px;
  margin-left: -6px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-menu-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.nav-menu-toggle svg {
  display: block;
}

.nav-drawer-backdrop {
  display: none;
}

/* ── Right side ── */
.right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

/* ── Top Bar ── */
.topbar {
  position: relative;
  z-index: 30;
  background: var(--accent);
  /* Statusleiste / Notch (Desktop: nur env) */
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
  padding-left: 20px;
  padding-right: 20px;
  padding-bottom: 0;
  min-height: calc(52px + constant(safe-area-inset-top));
  min-height: calc(52px + env(safe-area-inset-top));
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}

.app-name {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  font-size: 13px;
  flex: 0 0 auto;
  flex-shrink: 0;
  max-width: 100%;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.training-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1.15;
  white-space: nowrap;
  --training-badge-accent: #fbbf24;
  --training-badge-accent-muted: rgba(251, 191, 36, 0.82);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) inset;
  transition: border-color 0.18s ease, background 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.stall-activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1.15;
  white-space: nowrap;
  --stall-badge-accent: #fbbf24;
  --stall-badge-accent-muted: rgba(251, 191, 36, 0.82);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) inset;
  transition: border-color 0.18s ease, background 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.stall-activity-badge--motor {
  --stall-badge-accent: #f87171;
  --stall-badge-accent-muted: rgba(248, 113, 113, 0.88);
  border-color: rgba(248, 113, 113, 0.85);
}

.stall-activity-badge[hidden] {
  display: none !important;
}

.stall-activity-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--stall-badge-accent);
  flex-shrink: 0;
}

.stall-activity-badge__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stall-activity-badge__eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stall-badge-accent-muted);
}

.stall-activity-badge__detail {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--stall-badge-accent);
}

.stall-activity-badge__compact {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--stall-badge-accent);
}

@media (max-width: 880px) {
  .stall-activity-badge__body {
    display: none;
  }
  .stall-activity-badge__compact {
    display: inline;
  }
}

.training-mode-badge[hidden] {
  display: none !important;
}

.training-mode-badge:hover {
  background: rgba(0, 0, 0, 0.24);
  filter: brightness(1.04);
  border-color: rgba(252, 211, 77, 0.92);
}

.training-mode-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--training-badge-accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  animation: training-mode-pulse 1.6s ease-in-out infinite;
}

.training-mode-badge__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.training-mode-badge__eyebrow {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--training-badge-accent-muted);
}

.training-mode-badge__detail {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--training-badge-accent);
}

.training-mode-badge__compact {
  display: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--training-badge-accent);
}

@keyframes training-mode-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

@media (max-width: 440px) {
  .training-mode-badge__body {
    display: none;
  }

  .training-mode-badge__compact {
    display: inline;
  }
}

.lut-cal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1.15;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid var(--lut-badge-accent, rgba(255, 255, 255, 0.35));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) inset;
  transition: border-color 0.18s ease, background 0.18s ease, filter 0.18s ease;
}

.lut-cal-badge:hover {
  background: rgba(0, 0, 0, 0.19);
  filter: brightness(1.04);
}

.lut-cal-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--lut-badge-accent, rgba(255, 255, 255, 0.75));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.lut-cal-badge__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.lut-cal-badge__eyebrow {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lut-badge-accent-muted, rgba(255, 255, 255, 0.65));
}

.lut-cal-badge__detail {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--lut-badge-accent, rgba(255, 255, 255, 0.92));
}

.lut-cal-badge__compact {
  display: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--lut-badge-accent, rgba(255, 255, 255, 0.92));
}

.lut-cal-badge--ok {
  --lut-badge-accent: #7ee0a8;
  --lut-badge-accent-muted: rgba(190, 242, 200, 0.82);
  background: rgba(0, 0, 0, 0.16);
  border-color: rgba(126, 224, 168, 0.72);
}

.lut-cal-badge--ok:hover {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(167, 243, 208, 0.88);
}

.lut-cal-badge--warn {
  --lut-badge-accent: #fde68a;
  --lut-badge-accent-muted: rgba(253, 230, 138, 0.78);
  background: rgba(0, 0, 0, 0.16);
  border-color: rgba(253, 224, 71, 0.72);
}

.lut-cal-badge--warn:hover {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(250, 204, 21, 0.85);
}

@media (max-width: 440px) {
  .lut-cal-badge__body {
    display: none;
  }

  .lut-cal-badge__compact {
    display: inline;
  }

  .lut-cal-badge {
    padding: 6px 10px 6px 9px;
    gap: 7px;
  }

  .topbar-actions {
    gap: 6px;
  }
}

/* Nutzer-Dropdown (Optik wie mockups/index.html) */
.user-menu-wrap {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

.user-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.user-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-mid);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-name {
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  flex-shrink: 0;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  max-width: min(210px, calc(100vw - 24px));
  background: var(--surface);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  box-shadow: var(--dd-shadow);
  overflow: hidden;
  display: none;
  z-index: 900;
}

.dropdown.open {
  display: block;
}

.dd-header {
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
}

.dd-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  word-break: break-word;
}

.dd-role {
  font-size: 11px;
  color: var(--subtle);
  margin-top: 2px;
}

.dd-item {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-family: inherit;
  border: none;
  width: 100%;
  text-align: left;
  background: none;
  cursor: pointer;
  box-sizing: border-box;
}

.dd-item:hover {
  background: var(--accent-light);
}

.dd-item.danger {
  color: #c02020;
}

.dd-item.danger:hover {
  background: #fef2f2;
}

/* ── Content (Mockup: .content gap 16px, padding 20px) ── */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Trinkliniensteuerung (combined status + stream + control) ── */
.tls-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-shrink: 0;
}

.tls-mode-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  flex-shrink: 0;
}

.tls-mode-badge__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}

.tls-mode-badge__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #111827);
}

.metrics--tls {
  grid-template-columns: repeat(4, 1fr);
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .metrics--tls {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .metrics--tls {
    grid-template-columns: 1fr;
  }
}

.metrics--tls .m-val--compact {
  font-size: 1.35rem;
}

.tls-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tls-stream .stream-grid {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin: 0;
}

.tls-stream .stream-feed-card {
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.tls-stream .stream-feed-card.stream-feed-card--lower-half:not(.stream-feed-card--portrait),
.tls-stream .stream-feed-card.stream-feed-card--full:not(.stream-feed-card--portrait),
.tls-stream .stream-feed-card.stream-feed-card--portrait {
  max-width: 100%;
}

.ctrl-grid--tls-ki-only {
  grid-template-columns: 1fr;
}

.tls-page .user-admin-header {
  margin-bottom: 0;
}

.steuerung-height-card[hidden],
.steuerung-offset-card[hidden] {
  display: none !important;
}

/*
 * Desktop: fit Trinkliniensteuerung in one viewport.
 * Header + KPIs stay fixed; stream scales down to remaining height (contain).
 */
@media (min-width: 961px) {
  .content:has(> .tls-page) {
    /* Stream is height-capped; allow rare overflow (e.g. send confirmation card) */
    overflow-x: hidden;
    overflow-y: auto;
  }

  .tls-page {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
  }

  .tls-page > .app-message {
    flex-shrink: 0;
  }

  .tls-main {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .tls-stream {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tls-stream .stream-grid {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  .tls-stream .stream-feed-card {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* Override global stream-feed-card max-width calcs that ignore TLS chrome */
    max-width: 100% !important;
  }

  .tls-stream .stream-feed-card__hd {
    flex-shrink: 0;
  }

  .tls-stream .live-stream-viewport {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    container-type: size;
    container-name: tls-stream-view;
  }

  /*
   * Fit stream frame inside remaining viewport slot (letterbox/pillarbox).
   * width = min(column width, height × aspect) so neither axis overflows.
   */
  .tls-stream .live-stream-viewport__frame {
    flex: 0 1 auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
  }

  .tls-stream .live-stream-viewport--lower-half.live-stream-viewport--landscape .live-stream-viewport__frame {
    aspect-ratio: 16 / 4.5;
    width: min(100cqw, calc(100cqh * 16 / 4.5));
  }

  .tls-stream .live-stream-viewport--full.live-stream-viewport--landscape .live-stream-viewport__frame {
    aspect-ratio: 16 / 9;
    width: min(100cqw, calc(100cqh * 16 / 9));
  }

  .tls-stream .live-stream-viewport--lower-half.live-stream-viewport--portrait .live-stream-viewport__frame {
    aspect-ratio: 9 / 8;
    width: min(100cqw, calc(100cqh * 9 / 8));
  }

  .tls-stream .live-stream-viewport--full.live-stream-viewport--portrait .live-stream-viewport__frame {
    aspect-ratio: 9 / 16;
    width: min(100cqw, calc(100cqh * 9 / 16));
  }

  /* When height-clamped, fill the constrained frame; lower-half crop still via absolute inner */
  .tls-stream .live-stream-viewport--full .live-stream-viewport__inner {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    max-height: none;
  }

  .tls-stream .live-stream-viewport--lower-half .live-stream-viewport__inner {
    width: 100%;
  }

  .tls-control {
    min-height: 0;
    overflow: auto;
  }
}

@media (max-width: 960px) {
  .tls-main {
    grid-template-columns: 1fr;
  }
}

/* ── Metrics ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .metrics {
    grid-template-columns: 1fr;
  }
}

.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.m-card::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0.12;
  border-radius: 0 0 12px 12px;
}

a.m-card--link {
  display: block;
  text-decoration: none;
  text-decoration-line: none;
  color: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

a.m-card--link:hover,
a.m-card--link:focus,
a.m-card--link:active,
a.m-card--link:focus-visible {
  text-decoration: none;
  text-decoration-line: none;
}

a.m-card--link:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(25, 49, 228, 0.1);
}

a.m-card--link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

a.m-card--link *,
a.m-card--link *:hover,
a.m-card--link *:focus {
  text-decoration: none;
  text-decoration-line: none;
}

a.m-card--link .link-accent:hover {
  text-decoration: none;
}

.m-label {
  font-size: 11px;
  color: var(--subtle);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.m-val {
  font-size: 26px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.m-val .unit {
  font-size: 13px;
  color: var(--subtle);
  font-weight: 400;
  margin-left: 2px;
}

.m-sub {
  font-size: 12px;
  color: var(--subtle);
  margin-top: 5px;
}

.m-sub.ok {
  color: var(--ok);
  font-weight: 500;
}

.m-card.highlight::before {
  opacity: 1;
  background: linear-gradient(90deg, var(--accent), var(--brand-green));
}

.m-sub.warn {
  color: var(--warn);
  font-weight: 500;
}

.m-sub .link-accent {
  font-size: inherit;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 0;
  box-shadow: none;
  text-align: center;
}

.card-hd {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

/* Seiten-Hinweise: einheitlich (Erfolg = Akzent, Fehler = rot) */
.app-message {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 13px;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.app-message--success,
.info {
  background: var(--accent-light);
  color: #152a8a;
  border-color: rgba(25, 49, 228, 0.15);
}

.app-message--error {
  background: #fee2e2;
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.22);
}

.app-message--warn {
  background: #fef3c7;
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.28);
}

.steuerung-cal-warn {
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 0.7rem;
  font-size: 13px;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"] {
  width: 100%;
  padding: 0 var(--control-padding-x);
  margin-top: 0.25rem;
  min-height: var(--control-height);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  box-sizing: border-box;
  font-family: var(--font);
  font-size: var(--control-font-size);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

button {
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: #f3f4f6;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--control-font-size);
}

button.primary,
button.f-btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(25, 49, 228, 0.3);
}

button.primary:hover {
  background: var(--accent-mid);
}

button:disabled {
  background: #9ca3af;
  color: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.7;
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

.value-display {
  font-size: 13px;
  margin-bottom: 1rem;
  text-align: center;
  position: relative;
  overflow: visible;
  color: var(--text);
  line-height: 1.45;
}

.value-display--left {
  text-align: left;
}

.value-display--stellwert-hint {
  margin-bottom: 10px;
}

.ctrl-value-big {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.link-accent {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
}

.link-accent:hover {
  text-decoration: underline;
}

.m-val-note {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.value {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 1.1rem;
}

.additional-value {
  font-style: italic;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Livestream ── */
.stream-grid {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

/* Karte so breit wie der Stream (16:9 bzw. 9:16), begrenzt durch Viewport-Höhe */
.stream-feed-card {
  width: 100%;
  max-width: min(100%, calc((100svh - 10.5rem) * 16 / 9));
  box-sizing: border-box;
}

.stream-feed-card--portrait {
  max-width: min(100%, calc((100svh - 10.5rem) * 9 / 16));
}

/* Untere Hälfte (Default): flacherer Rahmen → Karte darf breiter werden */
.stream-feed-card--lower-half:not(.stream-feed-card--portrait) {
  max-width: min(100%, calc((100svh - 10.5rem) * 16 / 4.5));
}

.stream-feed-card--lower-half.stream-feed-card--portrait {
  max-width: min(100%, calc((100svh - 10.5rem) * 9 / 8));
}

.stream-feed-card__hd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.stream-feed-card__title {
  flex: 0 1 auto;
}

.stream-view-tabs {
  margin-top: 0;
  flex: 0 1 auto;
  min-width: min(100%, 220px);
  text-transform: none;
  letter-spacing: normal;
}

.stream-view-tabs .mode-tab {
  flex: 1 1 0;
  padding: 7px 10px;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}

/*
 * Livestream viewport: lower-half crop (same idea as admin panel) or full frame.
 * __frame is the visible picture box; __inner is the full stream stage (cropped when lower-half).
 * Fullscreen: black letterbox + frame centered with contain scaling (nothing cropped).
 */
.live-stream-viewport {
  width: 100%;
  position: relative;
}

.live-stream-viewport__frame {
  width: 100%;
  position: relative;
  background: #0d1117;
  border-radius: 10px;
  overflow: hidden;
}

.live-stream-viewport--lower-half.live-stream-viewport--landscape .live-stream-viewport__frame {
  aspect-ratio: 16 / 4.5;
}

.live-stream-viewport--lower-half.live-stream-viewport--portrait .live-stream-viewport__frame {
  aspect-ratio: 9 / 8;
}

.live-stream-viewport--lower-half .live-stream-viewport__inner {
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  top: auto;
  height: auto;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

/* Gesamt (non-fullscreen): full 16:9 / 9:16 frame, inner in normal flow */
.live-stream-viewport--full.live-stream-viewport--landscape .live-stream-viewport__frame {
  aspect-ratio: 16 / 9;
}

.live-stream-viewport--full.live-stream-viewport--portrait .live-stream-viewport__frame {
  aspect-ratio: 9 / 16;
}

.live-stream-viewport--full .live-stream-viewport__inner {
  position: relative;
  inset: auto;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

/* Fullscreen stage: center the frame, scale with contain (letterbox / pillarbox). */
.live-stream-viewport:fullscreen,
.live-stream-viewport:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  aspect-ratio: auto;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.live-stream-viewport:fullscreen .live-stream-viewport__frame,
.live-stream-viewport:-webkit-full-screen .live-stream-viewport__frame {
  border-radius: 0;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
}

.live-stream-viewport--full:fullscreen.live-stream-viewport--landscape .live-stream-viewport__frame,
.live-stream-viewport--full:-webkit-full-screen.live-stream-viewport--landscape .live-stream-viewport__frame {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
}

.live-stream-viewport--full:fullscreen.live-stream-viewport--portrait .live-stream-viewport__frame,
.live-stream-viewport--full:-webkit-full-screen.live-stream-viewport--portrait .live-stream-viewport__frame {
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
}

.live-stream-viewport--lower-half:fullscreen.live-stream-viewport--landscape .live-stream-viewport__frame,
.live-stream-viewport--lower-half:-webkit-full-screen.live-stream-viewport--landscape .live-stream-viewport__frame {
  width: min(100vw, calc(100vh * 16 / 4.5));
  height: min(100vh, calc(100vw * 4.5 / 16));
  aspect-ratio: 16 / 4.5;
}

.live-stream-viewport--lower-half:fullscreen.live-stream-viewport--portrait .live-stream-viewport__frame,
.live-stream-viewport--lower-half:-webkit-full-screen.live-stream-viewport--portrait .live-stream-viewport__frame {
  width: min(100vw, calc(100vh * 9 / 8));
  height: min(100vh, calc(100vw * 8 / 9));
  aspect-ratio: 9 / 8;
}

.live-stream-viewport:fullscreen .live-stream-viewport__inner,
.live-stream-viewport:-webkit-full-screen .live-stream-viewport__inner {
  border-radius: 0;
  max-height: none;
}

.live-stream-viewport--full:fullscreen .live-stream-viewport__inner,
.live-stream-viewport--full:-webkit-full-screen .live-stream-viewport__inner {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  max-height: none;
}

.live-stream-viewport--lower-half:fullscreen .live-stream-viewport__inner,
.live-stream-viewport--lower-half:-webkit-full-screen .live-stream-viewport__inner {
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  top: auto;
  height: auto;
  max-height: none;
}

.live-stream-viewport--lower-half:fullscreen.live-stream-viewport--landscape .live-stream-viewport__inner,
.live-stream-viewport--lower-half:-webkit-full-screen.live-stream-viewport--landscape .live-stream-viewport__inner {
  aspect-ratio: 16 / 9;
}

.live-stream-viewport--lower-half:fullscreen.live-stream-viewport--portrait .live-stream-viewport__inner,
.live-stream-viewport--lower-half:-webkit-full-screen.live-stream-viewport--portrait .live-stream-viewport__inner {
  aspect-ratio: 9 / 16;
}

.live-stream-viewport:fullscreen .stream-ctrl-fs .stream-fs-icon--enter,
.live-stream-viewport:-webkit-full-screen .stream-ctrl-fs .stream-fs-icon--enter {
  display: none;
}

.live-stream-viewport:fullscreen .stream-ctrl-fs .stream-fs-icon--exit,
.live-stream-viewport:-webkit-full-screen .stream-ctrl-fs .stream-fs-icon--exit {
  display: block;
}

.stream-wrap {
  background: #0d1117;
  border-radius: 10px;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
  container-name: stream-view;
}

/* Hochformat-Fenster: gedrehtes Querformat (16:9) füllt die Fläche ohne Randstreifen */
.stream-wrap--rot-portrait {
  aspect-ratio: 9 / 16;
  max-height: 92vh;
}

.stream-wrap:fullscreen,
.stream-wrap:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  aspect-ratio: auto;
}

.stream-rot-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Drehung nur auf dem Bild-Wrapper — natives Video-UI würde mitrotieren; Steuerleiste liegt außerhalb. */
.stream-video-picture {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  transform-origin: center center;
  pointer-events: none;
}

.stream-video-picture.is-active {
  display: block;
}

.stream-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: auto;
}

/* 0° / 180°: klassisches Vollbild im 16:9-Rahmen */
.stream-wrap--r0 .stream-video-picture.is-active,
.stream-wrap--r180 .stream-video-picture.is-active {
  transform: none;
}

.stream-wrap--r180 .stream-video-picture.is-active {
  transform: rotate(180deg); /* CCW 180° = CW 180° */
}

/*
 * 90° / 270°: Element vor der Drehung als H×W (16:9), nach Drehung genau W×H des 9:16-Containers.
 * translate(-50%,-50%) + left/top 50% zentriert; cqh/cqw beziehen sich auf .stream-wrap (container-type: size).
 */
.stream-wrap--rot-portrait .stream-video-picture.is-active {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 100cqh;
  height: 100cqw;
  max-width: none;
  max-height: none;
}

.stream-wrap--rot-portrait .stream-video {
  object-fit: cover;
}

/* DB-Winkel ist CCW; positives CSS-rotate = CW → 90 CCW ≡ rotate(270deg) */
.stream-wrap--r90 .stream-video-picture.is-active {
  transform: translate(-50%, -50%) rotate(270deg);
}

.stream-wrap--r270 .stream-video-picture.is-active {
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Ältere Browser ohne Container-Query-Einheiten: grobe Anpassung */
@supports not (width: 1cqh) {
  .stream-wrap--rot-portrait .stream-video-picture.is-active {
    width: 178%;
    height: 100%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(270deg);
  }
  .stream-wrap--r270 .stream-video-picture.is-active {
    transform: translate(-50%, -50%) rotate(90deg);
  }
}

.stream-custom-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 12px;
  box-sizing: border-box;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), transparent);
}

.stream-custom-controls[hidden] {
  display: none !important;
}

.stream-ctrl-btn {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #f0f6fc;
  font-size: 0.75rem;
  line-height: 1;
}

.stream-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.stream-ctrl-seek {
  flex: 1 1 auto;
  min-width: 0;
  height: 4px;
  accent-color: var(--accent, #3b5bdb);
  cursor: pointer;
}

.stream-ctrl-seek:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stream-ctrl-time {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #c9d1d9;
  white-space: nowrap;
}

.stream-ctrl-fs .stream-fs-icon {
  display: block;
}

.stream-ctrl-fs .stream-fs-icon--exit {
  display: none;
}

.stream-wrap:fullscreen .stream-ctrl-fs .stream-fs-icon--enter,
.stream-wrap:-webkit-full-screen .stream-ctrl-fs .stream-fs-icon--enter {
  display: none;
}

.stream-wrap:fullscreen .stream-ctrl-fs .stream-fs-icon--exit,
.stream-wrap:-webkit-full-screen .stream-ctrl-fs .stream-fs-icon--exit {
  display: block;
}

.stream-placeholder {
  text-align: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.stream-placeholder.is-hidden {
  display: none;
}

.stream-placeholder svg {
  width: 40px;
  height: 40px;
  stroke: #6b7280;
  fill: none;
  margin-bottom: 8px;
}

.stream-placeholder p {
  color: #9ca3af;
  font-size: 13px;
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.45;
}

.body-text-muted {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* ── Control (Steuerung) — Abstände wie Mockup (.content gap 16px, .ctrl-grid gap 14px) ── */
.steuerung-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ctrl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ctrl-grid--steuerung {
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.ctrl-grid--steuerung > .steuerung-ki-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.ctrl-grid--steuerung > .steuerung-ki-cell > .steuerung-ki-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

/* display:flex oben überschreibt das native [hidden]-Verhalten (Spezifität) */
.ctrl-grid--steuerung > .steuerung-ki-cell > .steuerung-ki-card[hidden] {
  display: none !important;
}

.ctrl-grid--steuerung > .stall-status-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Hauptinhalt der oberen Steuerungskarten: gleiche Höhe, KI-Inhalt vertikal zentriert */
.steuerung-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
}

.steuerung-card-body--center {
  justify-content: center;
}

.stall-status-body.steuerung-card-body--center {
  text-align: center;
}

.stall-status-body .stall-status-caption {
  font-style: normal;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.4;
}

.stall-status-body .stall-status-caption:first-child {
  margin-bottom: 6px;
}

.stall-status-body .mode-proposed-val.stall-status-val {
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.2;
}

.stall-status-body .stall-status-caption:last-of-type {
  margin-top: 8px;
}

.settings-steuerung-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-offset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.settings-global-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.settings-page-footer-actions {
  margin-top: 8px;
}

.settings-page-footer-actions .settings-save-hint {
  margin-top: 0;
}

.settings-save-hint {
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 0.95rem;
}

.steuerung-ki-cell {
  gap: 14px;
}

.steuerung-auto-last-when {
  margin-top: 6px;
}

.steuerung-auto-last-body {
  justify-content: flex-start;
}

.steuerung-auto-last-body .body-text-muted {
  margin-top: 10px;
}

.steuerung-ki-card .mode-proposed-val {
  margin-top: 6px;
}

.steuerung-ki-card .steuerung-card-body > .mode-proposed-val:first-child {
  margin-top: 0;
}

.steuerung-height-card {
  width: 100%;
}

/* TEMP DEBUG: day-cutoff slider above admin panel */
.steuerung-admin-debug-day {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  width: 100%;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(234, 88, 12, 0.45);
  background: rgba(255, 247, 237, 0.95);
}

.steuerung-admin-debug-day__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
  white-space: nowrap;
}

.steuerung-admin-debug-day__value {
  min-width: 1.75em;
  font-variant-numeric: tabular-nums;
  color: #c2410c;
}

.steuerung-admin-debug-day__slider {
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 420px;
  accent-color: #ea580c;
}

.steuerung-admin-debug-day__hint {
  font-size: 11px;
  color: #b45309;
  white-space: nowrap;
}

/* Admin-Panel page: full Kamera-Feed + side controls (50/50) */
.admin-panel-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-panel-stream .stream-grid {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin: 0;
}

.admin-panel-stream .stream-feed-card {
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.admin-panel-side .steuerung-cards {
  gap: 14px;
}

.admin-panel-chart-card {
  text-align: left;
  padding: 14px 16px;
}

.admin-panel-chart-card .steuerung-admin-panel__growth-chart {
  height: auto;
  min-height: 520px;
  border: none;
  background: transparent;
  padding: 0;
}

.admin-panel-chart-card .steuerung-admin-panel__growth-chart-svg {
  min-height: 440px;
  height: 480px;
  flex: none;
}

.admin-panel-height-card {
  text-align: left;
}

.admin-panel-height-card .steuerung-admin-panel__height {
  padding-top: 4px;
}

@media (max-width: 960px) {
  .admin-panel-main {
    grid-template-columns: 1fr;
  }
}

/* Legacy Admin-only panel styles (kept for shared chart/height classes) */
.steuerung-admin-panel {
  width: 100%;
  text-align: left;
  border: 2px solid rgba(25, 49, 228, 0.35);
  border-radius: 14px;
  background: linear-gradient(145deg, #f4f6ff 0%, #ffffff 58%);
  box-shadow:
    0 0 0 1px rgba(25, 49, 228, 0.08),
    0 10px 28px rgba(25, 49, 228, 0.1);
  position: relative;
  overflow: hidden;
  padding-top: 18px;
}

.steuerung-admin-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent) 0%, #5b6ef7 100%);
  border-radius: 14px 0 0 14px;
}

.steuerung-admin-panel__header {
  padding: 0 10px;
  margin-bottom: 14px;
}

.steuerung-admin-panel__body {
  position: relative;
  padding: 0 10px 14px;
}

.steuerung-admin-panel__stream-col {
  width: calc((100% - 18px) / 2);
  min-width: 0;
}

.steuerung-admin-panel__side-col {
  position: absolute;
  top: 0;
  right: 10px;
  bottom: 14px;
  width: calc((100% - 18px) / 2);
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  min-width: 0;
  min-height: 0;
}

.steuerung-admin-panel__growth-chart {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(25, 49, 228, 0.16);
}

.steuerung-admin-panel__growth-chart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 10px;
  margin: 0 0 4px;
  min-height: 0;
}

.steuerung-admin-panel__growth-chart-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #98a2b3;
  white-space: nowrap;
}

.steuerung-admin-panel__growth-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px 8px;
  margin-left: auto;
}

.steuerung-admin-panel__growth-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: #667085;
  white-space: nowrap;
}

.steuerung-admin-panel__legend-mark {
  display: inline-block;
  flex-shrink: 0;
}

.steuerung-admin-panel__legend-mark--soll {
  width: 12px;
  height: 0;
  border-top: 2px solid #1931e4;
  border-radius: 1px;
}

.steuerung-admin-panel__legend-mark--ist {
  width: 12px;
  height: 0;
  border-top: 2.5px solid #ea580c;
  border-radius: 1px;
}

.steuerung-admin-panel__legend-mark--motor-aruco {
  width: 12px;
  height: 0;
  border-top: 2px dashed #0f766e;
  border-radius: 1px;
}

.steuerung-admin-panel__legend-mark--fit {
  width: 12px;
  height: 0;
  border-top: 2px dashed #059669;
  border-radius: 1px;
}

.steuerung-admin-panel__legend-mark--shadow {
  width: 12px;
  height: 0;
  border-top: 2px solid #7c3aed;
  border-radius: 1px;
}

.steuerung-admin-panel__legend-mark--slot {
  width: 1.5px;
  height: 7px;
  background: #1931e4;
  opacity: 0.8;
  border-radius: 1px;
}

.steuerung-admin-panel__growth-chart-params {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(25, 49, 228, 0.1);
  font-size: 10px;
  line-height: 1.45;
  color: #667085;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.steuerung-admin-panel__growth-chart-params:empty {
  display: none;
}

.steuerung-admin-panel__growth-chart-params strong {
  color: #059669;
  font-weight: 700;
}

.steuerung-admin-panel__growth-chart-svg {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.steuerung-admin-panel__growth-chart-svg.is-panning {
  cursor: grabbing;
}

.steuerung-admin-panel__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.steuerung-admin-panel__title {
  margin-bottom: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.09em;
}

.steuerung-admin-panel__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(25, 49, 228, 0.12);
  border: 1px solid rgba(25, 49, 228, 0.22);
}

/*
 * Admin stream: lower half of the rotated picture (not sensor axes).
 * Clip aspect = half of the full Livestream frame (16/9 → 16/4.5, 9/16 → 9/8).
 * Inner frame keeps the full Livestream aspect ratio and is bottom-aligned.
 */
.steuerung-admin-panel__stream-clip {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #0d1117;
  border-radius: 10px;
}

.steuerung-admin-panel__stream-clip--landscape {
  aspect-ratio: 16 / 4.5;
}

.steuerung-admin-panel__stream-clip--portrait {
  aspect-ratio: 9 / 8;
}

.steuerung-admin-panel__stream-inner {
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 0;
  top: auto;
  height: auto;
  max-width: none;
  border-radius: 0;
}

.steuerung-admin-panel__stream-inner.stream-wrap--rot-portrait {
  max-height: none;
}

.steuerung-admin-panel__stream-inner .stream-placeholder {
  position: absolute;
  inset: 0;
  min-height: 0;
}

.steuerung-admin-panel__actions-col {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(25, 49, 228, 0.28);
}

.steuerung-admin-panel__height {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.steuerung-admin-panel__h-display {
  padding: 6px 0 2px;
}

.steuerung-admin-panel__h-num {
  font-size: 34px;
}

.steuerung-admin-panel__h-unit {
  font-size: 14px;
}

.steuerung-admin-panel__slider-wrap {
  margin: 2px 0 8px;
}

.steuerung-admin-panel__adj-row {
  margin-top: 0;
}

.steuerung-admin-panel__confirm-row {
  margin-top: 10px;
}

.steuerung-admin-panel__confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steuerung-admin-panel__aruco-btn,
.steuerung-admin-panel__confirm-btn {
  width: 100%;
  justify-content: center;
}

.steuerung-admin-panel__last-confirm {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted, #666);
  text-align: center;
}

@media (max-width: 768px) {
  .steuerung-admin-panel__stream-col {
    width: 100%;
  }

  .steuerung-admin-panel__side-col {
    position: static;
    width: 100%;
    margin-top: 18px;
    grid-template-rows: auto auto;
  }

  .steuerung-admin-panel__growth-chart {
    min-height: 220px;
  }

  .steuerung-admin-panel__actions-col {
    padding: 12px;
  }
}

.steuerung-ki-hint {
  margin-top: 6px;
}

.steuerung-ki-hint__text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 22em;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  .ctrl-grid {
    grid-template-columns: 1fr;
  }

  .ctrl-grid--steuerung {
    grid-template-columns: 1fr;
  }
}

.card--has-corner-hint {
  position: relative;
}

.card--has-corner-hint > .card-hd {
  padding-right: 2.25rem;
}

.card-corner-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
}

.card-corner-hint .tooltip-icon {
  margin-left: 0;
}

.card-corner-hint .tooltip-text.tooltip-text--below {
  bottom: auto;
  top: calc(100% + 8px);
  left: auto;
  right: 0;
  transform: none;
  margin: 0;
  min-width: 220px;
  max-width: min(320px, 70vw);
}

.card-corner-hint .tooltip-text.tooltip-text--below::after {
  top: auto;
  bottom: 100%;
  left: auto;
  right: 10px;
  transform: none;
  border: 5px solid transparent;
  border-top-width: 0;
  border-bottom-color: #1f2937;
}

.card-corner-hint .tooltip-icon--corner:hover .tooltip-text,
.card-corner-hint .tooltip-icon--corner:focus-within .tooltip-text {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.mode-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 10px;
}

.mode-tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  font-size: var(--control-font-size);
  cursor: pointer;
  border: none;
  background: #fff;
  color: var(--muted);
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}

.mode-tab.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.mode-tab--disabled,
.mode-tab:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.mode-proposed {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.mode-proposed-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.mode-proposed-val {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}

.mode-proposed-date {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
}

.slider-label {
  font-size: 11px;
  color: var(--subtle);
  font-family: var(--mono);
  min-width: 28px;
}

.slider-label--right {
  text-align: right;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: #e5e7eb;
  border-radius: 99px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(25, 49, 228, 0.4);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(25, 49, 228, 0.4);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: #e5e7eb;
  border-radius: 99px;
}

.h-display {
  text-align: center;
  padding: 16px 0 10px;
}

.h-num {
  font-size: 52px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
  font-family: var(--mono);
}

.h-unit-lg {
  font-size: 18px;
  color: var(--subtle);
  margin-left: 4px;
}

.adj-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.adj-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: #fff;
  font-size: var(--control-font-size);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.1s;
}

.adj-btn:hover {
  background: #f9fafb;
}

.apply-btn {
  padding: 8px 22px;
  border: none;
  border-radius: var(--control-radius);
  background: var(--accent);
  color: #fff;
  font-size: var(--control-font-size);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
  box-shadow: 0 2px 8px rgba(25, 49, 228, 0.3);
}

.apply-btn:hover:not(:disabled) {
  background: var(--accent-mid);
}

.apply-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.offset-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.offset-row--stepper-save {
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.offset-row--flush {
  margin-top: 0;
}

.stepper--readonly {
  background: #f9fafb;
}

.stepper--readonly .st-mid {
  border: none;
  min-width: 72px;
  padding: 8px 12px;
}

.no-shrink {
  flex-shrink: 0;
}

.offset-info {
  flex: 1;
}

.offset-title {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.offset-desc {
  font-size: 11px;
  color: var(--subtle);
  margin-top: 3px;
  line-height: 1.4;
}

/* Steuerungsseite – Offset-Karte (nur Automatik-Modus) */
.steuerung-offset-card {
  width: 100%;
}

.steuerung-offset-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0 2px;
}

.steuerung-offset-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.offset-feedback {
  font-size: 13px;
  min-height: 18px;
  text-align: center;
  color: transparent;
  transition: color 0.2s;
}

.offset-feedback--success {
  color: var(--success, #16a34a);
}

.offset-feedback--error {
  color: var(--error, #dc2626);
}

.page-subtitle-link {
  color: var(--accent);
  text-decoration: none;
}

.page-subtitle-link:hover {
  text-decoration: underline;
}

.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.st-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: #f9fafb;
  font-size: 17px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.st-btn:hover {
  background: #f0f2f6;
}

.st-mid {
  min-width: 58px;
  text-align: center;
  font-size: var(--control-font-size);
  font-weight: 500;
  color: var(--text);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 7px 6px;
  font-family: var(--mono);
}

/* Einstellungen (ohne Cards, wie Nutzerverwaltung) */
.settings-page {
  text-align: left;
}

.settings-analysis-form {
  margin: 0 0 28px;
  padding: 0;
}

/* Analyse: Uhrzeiten (kompakt, wie Mein Profil) */
.analysis-times-simple {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  /* Schmale Viewports: Zeile scrollt statt × unter den Rand zu brechen */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.analysis-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Kein wrap: sonst steht der ×-Button allein auf Zeile 2 links am Rand */
  flex-wrap: nowrap;
  min-width: 0;
}

.analysis-time-row__num {
  flex-shrink: 0;
  width: 1.5rem;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.analysis-time-row .user-admin-form-input.analysis-time-input {
  /* Einheitliche Breite für alle Zeilen (nicht browserabhängig „auto“) */
  --analysis-time-w: 7.75rem;
  box-sizing: border-box;
  width: var(--analysis-time-w);
  min-width: var(--analysis-time-w);
  max-width: var(--analysis-time-w);
  flex: 0 0 var(--analysis-time-w);
  margin-top: 0;
}

.analysis-time-row__remove {
  flex-shrink: 0;
  padding: 0.45rem 0.65rem;
  font-size: 14px;
  line-height: 1;
}

@media (max-width: 640px) {
  .analysis-time-row {
    gap: 8px;
  }

  .analysis-time-row .user-admin-form-input.analysis-time-input {
    --analysis-time-w: min(7.75rem, calc(100% - 4.5rem));
    width: var(--analysis-time-w);
    min-width: var(--analysis-time-w);
    max-width: var(--analysis-time-w);
    flex: 0 0 var(--analysis-time-w);
  }

  .analysis-time-row__remove {
    flex-shrink: 0;
  }
}

.settings-mail-form {
  margin: 0;
  padding: 0;
}

.settings-textarea-mono {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  min-height: 100px;
}

.settings-mail-section-gap {
  margin-top: 28px;
}

.settings-block-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
  line-height: 1.25;
}

.settings-block-lead {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.45;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin-bottom: 0;
}

.settings-form-grid--mail {
  margin-bottom: 0;
}

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

.settings-field--full {
  grid-column: 1 / -1;
}

.settings-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  display: block;
}

.settings-input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--control-padding-x);
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  box-sizing: border-box;
  font-family: var(--font);
  font-size: var(--control-font-size);
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.settings-select {
  cursor: pointer;
  background: #fff;
}

.settings-inline-actions {
  margin-bottom: 4px;
}

.settings-mail-footer-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 0;
}

.settings-subsection {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.settings-subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.settings-hint {
  margin: 0 0 0.75rem;
  font-size: 12.5px;
}

.settings-email-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.settings-email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.settings-email-row .settings-input,
.settings-email-row .user-admin-form-input {
  flex: 1 1 220px;
  margin-top: 0;
  min-width: 0;
}

.settings-email-remove {
  flex: 0 0 auto;
}

.settings-email-remove-btn {
  flex-shrink: 0;
  height: var(--control-height);
  align-self: center;
}

/* ── Settings form ── */
.settings-offset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 14px;
}

.settings-mm-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.footer-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  margin-top: 4px;
}

.f-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: #fff;
  font-size: var(--control-font-size);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
}

.f-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(25, 49, 228, 0.3);
}

.f-btn.primary:hover {
  background: var(--accent-mid);
}

.f-btn--compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  min-height: 36px;
  font-size: var(--control-font-size);
  box-sizing: border-box;
}

/* Tooltip */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--muted);
  position: relative;
}

.tooltip-icon svg {
  width: 100%;
  height: 100%;
}

.tooltip-text {
  position: absolute !important;
  display: block;
  visibility: hidden;
  opacity: 0;
  background-color: #1f2937;
  color: #fff;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 1000;
  bottom: calc(100% + 8px);
  left: -9999px;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  line-height: 1.4;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  pointer-events: none;
  max-width: 250px;
  white-space: normal;
  width: max-content;
  min-width: 200px;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, left 0s 0.2s;
  margin: 0;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f2937;
}

.tooltip-icon:hover .tooltip-text {
  visibility: visible !important;
  opacity: 1 !important;
  left: 50% !important;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, left 0s;
}

/* Login (Layout wie mockup-login.html) */
body.login-body {
  margin: 0;
  background: var(--bg);
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}

#screen-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 36px 40px;
  width: 360px;
  max-width: 100%;
  box-shadow: 0 8px 32px rgba(25, 49, 228, 0.09);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.login-logo-img {
  max-width: 180px;
  width: 100%;
  height: auto;
  display: block;
}

.login-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  display: block;
}

.login-card .login-input {
  width: 100%;
  height: var(--control-height);
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  color: var(--text);
  font-family: var(--font);
  outline: none;
  margin-bottom: 14px;
  margin-top: 0;
  box-sizing: border-box;
}

.login-card .login-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-card .login-input::placeholder {
  color: var(--subtle);
  opacity: 1;
}

.login-pw-wrap {
  position: relative;
  margin-bottom: 22px;
}

.login-pw-wrap .login-input {
  margin-bottom: 0;
  padding-right: 42px;
}

.login-card .pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  margin: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.login-card .pw-eye:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.login-card .login-btn {
  width: 100%;
  height: var(--control-height);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: var(--control-font-size);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  box-shadow: 0 2px 8px rgba(25, 49, 228, 0.3);
}

.login-card .login-btn:hover {
  background: var(--accent-mid);
}

.login-card .login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-card .login-btn--secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: none;
  margin-top: 10px;
}

.login-card .login-btn--secondary:hover {
  background: var(--accent-light);
}

.login-card .login-btn--secondary:disabled {
  background: #fff;
}

.login-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  box-sizing: border-box;
}

.login-error--visible {
  display: block;
}

.login-forgot-wrap {
  margin-top: 14px;
  text-align: center;
}

.login-card .login-forgot-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  text-decoration: underline;
  font-family: var(--font);
}

.login-card .login-forgot-link:hover {
  color: var(--accent-mid);
}

@media (max-width: 520px) {
  .login-card {
    width: 100%;
    max-width: 400px;
    padding: 28px 22px;
  }
}

.wizard-card {
  width: 420px;
}

.wizard-device-id {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.wizard-title {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
}

.wizard-lead,
.wizard-copy {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 14px;
}

.wizard-steps {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.wizard-step {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--subtle);
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  cursor: pointer;
}

.wizard-step--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.wizard-code {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 0.2em;
  text-align: center;
  margin: 12px 0 8px;
}

.wizard-countdown {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  min-height: 1.3em;
  margin: 0 0 16px;
}

.wizard-scan-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.wizard-scan-status[hidden] {
  display: none;
}

.wizard-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: wizard-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes wizard-spin {
  to {
    transform: rotate(360deg);
  }
}

.wizard-panel .login-pw-wrap {
  margin-bottom: 14px;
}

.wizard-done-mark {
  width: 56px;
  height: 56px;
  margin: 8px auto 14px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-done-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 10px;
}

.wizard-panel#wizardPanelDone .wizard-copy {
  text-align: center;
  margin-bottom: 8px;
}

.wizard-panel#wizardPanelDone .wizard-countdown {
  margin-bottom: 18px;
}

.wizard-hotspot-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}

.wizard-back {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
}

.wizard-back a {
  color: var(--accent);
}

.setup-pairing-banner {
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text);
}

.setup-pairing-banner a {
  color: var(--accent);
  font-weight: 600;
  margin-left: 6px;
}

.content::-webkit-scrollbar {
  width: 5px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 99px;
}

/* ── Responsive: Drawer-Navigation & kompakteres Layout (vgl. mockups/index.html) ── */
@media (max-width: 880px) {
  body.app-body {
    min-height: 100dvh;
    min-height: 100vh;
  }

  .nav-menu-toggle {
    display: inline-flex;
  }

  .nav-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(25, 49, 228, 0.38);
    border: none;
    padding: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  #app.nav-drawer-open .nav-drawer-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 100%;
    z-index: 960;
    padding-top: calc(14px + constant(safe-area-inset-top));
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: 12px;
    box-shadow: 8px 0 40px rgba(25, 49, 228, 0.14);
    transform: translateX(-105%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #app.nav-drawer-open .nav-sidebar {
    transform: translateX(0);
  }

  /* Fixiert am Viewport (Zoom/Layout); Abstand nur über env(safe-area), kein künstliches Minimum */
  .right {
    padding-top: calc(52px + constant(safe-area-inset-top));
    padding-top: calc(52px + env(safe-area-inset-top));
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    z-index: 850;
    box-sizing: border-box;
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top);
    padding-bottom: 0;
    padding-left: max(12px, constant(safe-area-inset-left));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, constant(safe-area-inset-right));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 8px;
    min-height: calc(52px + constant(safe-area-inset-top));
    min-height: calc(52px + env(safe-area-inset-top));
    height: auto;
  }

  .user-btn {
    min-height: 44px;
    padding: 6px 10px;
  }
}

@media (max-width: 720px) {
  .user-menu-wrap .user-name {
    display: none;
  }

  .topbar-right {
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .content {
    padding: 16px 14px 20px;
    gap: 14px;
  }

  .topbar .app-name {
    font-size: 14px;
  }

  .m-card,
  .card {
    padding: 14px 16px;
  }

  .h-num {
    font-size: 42px;
  }
}

/* Nutzerverwaltung (Mockup-nah, ohne Card-Layout) */
.user-admin-page {
  text-align: left;
  min-width: 0; /* Flex-Kind von .content: Tabelle darf im Wrapper scrollen statt die Seite zu verbreitern */
}

.user-admin-denied {
  max-width: 520px;
}

.user-admin-denied__text {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.user-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.user-admin-header__text {
  min-width: 0;
}

.user-admin-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 3px;
  line-height: 1.25;
}

.user-admin-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.user-admin-btn-mint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--control-height);
  padding: 0 14px;
  border: none;
  border-radius: var(--control-radius);
  font-family: var(--font);
  font-size: var(--control-font-size);
  font-weight: 600;
  cursor: pointer;
  background: var(--brand-green);
  color: #0a5a30;
  flex-shrink: 0;
}

.user-admin-btn-mint:hover {
  filter: brightness(0.96);
}

.user-admin-btn-mint svg {
  flex-shrink: 0;
}

.user-admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.user-admin-filters__search {
  flex: 1 1 160px;
  min-width: 140px;
}

.user-admin-filters__role {
  width: 130px;
  flex-shrink: 0;
}

.user-admin-form-input {
  height: var(--control-height);
  border-radius: var(--control-radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  color: var(--text);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}

.user-admin-form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.user-admin-form-select {
  height: var(--control-height);
  border-radius: var(--control-radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.user-admin-form-select:focus {
  border-color: var(--accent);
}

/* Tabelle wie Mockup — horizontal scrollbar auf schmalen Viewports (Flex-Kind braucht min-width: 0) */
.user-table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.user-table th {
  font-size: 10px;
  color: var(--muted);
  text-align: left;
  padding: 12px 14px 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.user-table td {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.user-table tr:hover td {
  background: var(--accent-light);
}

.user-table thead tr {
  background: rgba(25, 49, 228, 0.06);
}

.user-table-elevated {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.user-table__muted {
  color: var(--muted);
}

.user-table__actions {
  text-align: right;
  white-space: nowrap;
}

.u-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.u-mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  background: var(--accent);
}

.user-admin-you-pill {
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.role-admin {
  background: #e8eaff;
  color: var(--accent);
}

.role-user {
  background: #eef0f5;
  color: var(--muted);
}

.role-guest {
  background: #f3f4f6;
  color: var(--subtle);
}

.tbl-role-select {
  height: 34px;
  min-width: 100px;
  max-width: 140px;
  padding: 0 8px;
  font-size: var(--control-font-size);
}

.tbl-action {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: var(--control-font-size);
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  margin-left: 4px;
}

.tbl-action:first-child {
  margin-left: 0;
}

.tbl-action:hover {
  background: var(--accent-light);
}

.tbl-action.danger {
  color: #c02020;
  border-color: #f5c0c0;
}

.tbl-action.danger:hover {
  background: #fff5f5;
}

.tbl-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.user-admin-summary {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Modals Nutzerverwaltung */
.user-admin-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(18, 19, 80, 0.22);
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.user-admin-modal-overlay.open {
  display: flex;
}

/* LUT-Kalibrierung: über anderen Modals, kein Schließen per Backdrop (kein Click-Handler) */
.lut-cal-wizard-overlay.open {
  z-index: 2100;
}

/* ArUco-Auslesen: blockiert Eingabe während Aufnahme/Auswertung */
.admin-aruco-read-overlay.open {
  z-index: 2100;
}

.admin-aruco-read-busy-text {
  margin-bottom: 16px;
}

.admin-aruco-read-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 4px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: admin-aruco-spin 0.8s linear infinite;
}

@keyframes admin-aruco-spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-aruco-read-result.admin-aruco-read-result--error {
  color: #f87171;
}

.lut-cal-wizard-modal .lut-cal-wizard-intro,
.lut-cal-wizard-modal .lut-cal-wizard-running {
  font-size: 13px;
  line-height: 1.5;
}

.lut-cal-wizard-overlay .lut-cal-wizard-modal {
  max-width: 480px;
}

.lut-cal-live__phase {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.lut-cal-live__message {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text, #1a1a1a);
  min-height: 2.9em;
}

.lut-cal-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(25, 49, 228, 0.1);
  overflow: hidden;
  margin-bottom: 6px;
}

.lut-cal-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1931e4, #4f6bff);
  transition: width 0.35s ease;
}

.lut-cal-progress__caption {
  margin: 0 0 14px;
  font-size: 12px;
  color: #64748b;
}

.lut-cal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 0 0 8px;
}

.lut-cal-stats__item {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.lut-cal-stats__item dt {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.lut-cal-stats__item dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.lut-cal-wizard-footer {
  border-top: none;
  padding-top: 0;
  margin-top: 8px;
}

.lut-cal-wizard-footer--done {
  margin-top: 16px;
}

.lut-cal-wizard-result.lut-cal-wizard-result--error {
  color: #f87171;
}

.settings-leave-footer {
  flex-wrap: wrap;
  align-items: center;
}

.settings-leave-footer__grow {
  flex: 1 1 auto;
  min-width: 8px;
}

.user-admin-modal {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 24px 28px;
  box-shadow: var(--dd-shadow);
}

.user-admin-modal__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 4px;
}

.user-admin-modal__sub {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.45;
}

.user-admin-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.user-admin-field__label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}

.user-admin-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-admin-btn-primary {
  height: var(--control-height);
  padding: 0 14px;
  border: none;
  border-radius: var(--control-radius);
  font-family: var(--font);
  font-size: var(--control-font-size);
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.user-admin-btn-primary:hover {
  background: var(--accent-mid);
}

.user-admin-btn-secondary {
  height: var(--control-height);
  padding: 0 14px;
  border-radius: var(--control-radius);
  font-family: var(--font);
  font-size: var(--control-font-size);
  font-weight: 600;
  cursor: pointer;
  background: #f3f4f6;
  color: var(--accent);
  border: 1px solid var(--border);
}

.user-admin-btn-secondary:hover {
  background: var(--accent-light);
}

a.user-admin-btn-secondary {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  box-sizing: border-box;
}

.user-admin-btn-danger {
  height: var(--control-height);
  padding: 0 14px;
  border: 1px solid #b91c1c;
  border-radius: var(--control-radius);
  font-family: var(--font);
  font-size: var(--control-font-size);
  font-weight: 600;
  cursor: pointer;
  background: #dc2626;
  color: #fff;
}

.user-admin-btn-danger:hover {
  background: #b91c1c;
}

.user-admin-btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.user-admin-temp-pw {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding: 12px 14px;
  margin: 8px 0 0;
  background: var(--accent-light);
  border-radius: 8px;
  border: 1px solid var(--border);
  word-break: break-all;
  user-select: all;
}

/* Mein Profil — Kompakte Identitätskarte (Rest nutzt settings-page / user-admin-* wie Einstellungen) */
.profile-identity-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.profile-identity-card__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.profile-identity-card__text {
  flex: 1;
  min-width: 0;
}

.profile-identity-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.25;
}

.profile-identity-card__meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .profile-identity-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mein Profil — E-Mail-Benachrichtigungen (erweiterbare Liste) */
.profile-notify-section {
  margin-top: 28px;
  margin-bottom: 8px;
}

.profile-notify-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.profile-notify-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.profile-notify-item:last-child {
  border-bottom: none;
}

.profile-notify-item__text {
  flex: 1;
  min-width: 0;
}

.profile-notify-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.profile-notify-item__desc {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.profile-notify-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.profile-notify-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.profile-notify-switch__track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--border);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.profile-notify-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.profile-notify-switch input:checked + .profile-notify-switch__track {
  background: var(--accent-dark);
}

.profile-notify-switch input:checked + .profile-notify-switch__track::after {
  transform: translateX(20px);
}

.profile-notify-switch input:focus-visible + .profile-notify-switch__track {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.profile-notify-actions {
  margin-top: 4px;
}

@media (max-width: 520px) {
  .profile-notify-item {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-notify-switch {
    align-self: flex-end;
  }
}
