/* ==========================================================================
   CPS-i40 Mobile AR WebApp - HeroUI & SevDesk Responsive Stylesheet
   - 100% Fullscreen Kamera ohne Balken (iOS Safari & Android)
   - Komplett neu gestaltet im HeroUI (NextUI) & SevDesk Design-System
   - Glasmorphismus mit weichen Schatten, 18px-24px Radien & haptischem Feedback
   - Deutsches Industrie-Farbschema: Smaragdgrün, Rubinrot, Bernstein, Schiefer
   - Strikt kein Blau im Interface
   ========================================================================== */

:root {
  --camera-zoom: 1;

  /* HeroUI & SevDesk Tokens */
  --heroui-surface: rgba(18, 22, 33, 0.82);
  --heroui-card: rgba(27, 33, 49, 0.72);
  --heroui-card-hover: rgba(35, 43, 64, 0.85);
  --heroui-border: rgba(255, 255, 255, 0.1);
  --heroui-border-focus: rgba(255, 255, 255, 0.28);
  --heroui-divider: rgba(255, 255, 255, 0.08);

  --text-white: #ffffff;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-dim: #71717a;

  /* Statusfarben: SevDesk Smaragd & HeroUI Ruby Danger */
  --status-ok: #10b981;
  --status-ok-bg: rgba(16, 185, 129, 0.14);
  --status-ok-border: rgba(16, 185, 129, 0.4);

  --status-fault: #ef4444;
  --status-fault-bg: rgba(239, 68, 68, 0.16);
  --status-fault-border: rgba(239, 68, 68, 0.45);

  --safe-top: max(env(safe-area-inset-top, 0px), 14px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), 14px);
  --safe-left: max(env(safe-area-inset-left, 0px), 14px);
  --safe-right: max(env(safe-area-inset-right, 0px), 14px);

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) rgba(0, 0, 0, 0.25);
}

/* Elegante HeroUI Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text-primary);
  touch-action: none !important;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TRUE FULLSCREEN KAMERA-STREAM (Inkl. Hardware & iOS Safari Zoom Skalierung)
   ========================================================================== */
#arjs-video, 
video {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  -webkit-transform: translate(-50%, -50%) !important;
  transform-origin: center center !important;
  -webkit-transform-origin: center center !important;
  width: calc(100vw * var(--camera-zoom, 1)) !important;
  height: calc(100vh * var(--camera-zoom, 1)) !important;
  height: calc(100dvh * var(--camera-zoom, 1)) !important;
  min-width: calc(100vw * var(--camera-zoom, 1)) !important;
  min-height: calc(100vh * var(--camera-zoom, 1)) !important;
  min-height: calc(100dvh * var(--camera-zoom, 1)) !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: cover !important;
  z-index: -1 !important;
  transition: width 0.15s ease-out, height 0.15s ease-out;
}

.a-canvas, 
a-scene canvas {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  -webkit-transform: translate(-50%, -50%) !important;
  min-width: 100vw !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  width: 100vw !important;
  height: 100dvh !important;
  margin: 0 !important;
  z-index: 1 !important;
  pointer-events: none;
}

/* ==========================================================================
   HEROUI & SEVDESK AR FRAMEWORK
   ========================================================================== */
.ar-frame {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.interactive {
  pointer-events: auto;
}

/* 1. Header: HeroUI Floating Glassmorphic Pill */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: min(480px, 100%);
  margin: 0 auto;
  gap: 10px;
}

.top-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 16px;
  box-sizing: border-box;
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  border-radius: 9999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: clamp(10px, 2.8vw, 12px);
  letter-spacing: 0.3px;
  line-height: 1;
  color: var(--text-secondary);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--heroui-border);
}

.top-indicator strong {
  color: var(--text-white);
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-ok);
  box-shadow: 0 0 8px var(--status-ok);
  transition: background-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.header-ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* HeroUI Pill Button für Zoom */
.zoom-pill {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 14px;
  box-sizing: border-box;
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  border-radius: 9999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-family: var(--font-mono);
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 700;
  line-height: 1;
  color: var(--text-white);
  cursor: pointer;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--heroui-border);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-pill:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--heroui-border-focus);
}

/* HeroUI Pill Button für Konfiguration & Auth */
.config-pill,
.auth-pill {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 12px;
  box-sizing: border-box;
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  border-radius: 9999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1;
  color: var(--text-white);
  cursor: pointer;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--heroui-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.config-pill:active,
.auth-pill:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--heroui-border-focus);
}

/* HeroUI SevDesk Leitstand Nav Button */
.overview-nav-btn {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 14px;
  box-sizing: border-box;
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  border-radius: 9999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-family: var(--font-sans);
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 600;
  line-height: 1;
  color: #34d399;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--heroui-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.overview-nav-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--status-ok-border);
}

.overview-nav-btn:active {
  transform: scale(0.95);
}

/* 2. Zielsucher (HeroUI Refined HUD) */
.viewfinder {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: opacity 0.25s ease;
}

.viewfinder-box {
  width: clamp(210px, 62vw, 300px);
  height: clamp(210px, 62vw, 300px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.14);
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.viewfinder-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #ffffff;
  border-style: solid;
}
.c-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-top-left-radius: 12px; }
.c-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-top-right-radius: 12px; }
.c-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-bottom-left-radius: 12px; }
.c-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-bottom-right-radius: 12px; }

.viewfinder-label {
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: clamp(10px, 2.8vw, 12px);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   3. BOTTOM-PANEL: HEROUI & SEVDESK TELEMETRIE-KARTE
   ========================================================================== */
.station-card {
  display: none;
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  border-radius: 22px;
  padding: clamp(12px, 3.2vw, 18px);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--heroui-border);
  max-width: min(480px, 100%);
  width: 100%;
  align-self: center;
  animation: herouiCardAppear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes herouiCardAppear {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.station-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--heroui-divider);
  margin-bottom: 12px;
  gap: 10px;
}

.station-title {
  font-size: clamp(13px, 3.6vw, 15px);
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-sub {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 2px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* HeroUI Close Button */
.btn-close-card {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--heroui-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-close-card:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: var(--heroui-border-focus);
}

.btn-close-card:active {
  transform: scale(0.92);
}

/* HeroUI Status Chip */
.station-status-tag {
  font-family: var(--font-mono);
  font-size: clamp(9px, 2.4vw, 11px);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--status-ok-bg);
  color: #34d399;
  border: 1px solid var(--status-ok-border);
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.station-status-tag.alert-state {
  background: var(--status-fault-bg) !important;
  color: #f87171 !important;
  border-color: var(--status-fault-border) !important;
  animation: heroui-alert-glow 1.6s infinite;
}

/* 4. SevDesk Sensor Tiles (3 Spalten) */
.sensor-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 1.8vw, 10px);
}

.sensor-item {
  background: var(--heroui-card);
  border: 1px solid var(--heroui-border);
  border-radius: 14px;
  padding: clamp(8px, 2.2vw, 12px) clamp(6px, 1.8vw, 10px);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 60px;
  transition: all 0.2s ease;
}

.sensor-item:hover {
  background: var(--heroui-card-hover);
  border-color: var(--heroui-border-focus);
}

.sensor-item.alert-active {
  border-color: var(--status-fault);
  background: var(--status-fault-bg);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
}

.sensor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.sensor-name {
  display: block;
  font-size: clamp(8px, 2.2vw, 10px);
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sensor-trend {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  transition: color 0.2s;
}

.sensor-trend.trend-up { color: #34d399; }
.sensor-trend.trend-down { color: #f59e0b; }

.sensor-value {
  font-family: var(--font-mono);
  font-size: clamp(14px, 4.2vw, 18px);
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
}

.sensor-unit {
  font-size: clamp(9px, 2.4vw, 11px);
  font-weight: 500;
  color: var(--text-secondary);
}

.sensor-sparkline-wrap {
  display: none;
  height: 20px;
  width: 100%;
  margin-top: 4px;
}

.sensor-sparkline {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  color: var(--text-secondary);
}

.sensor-sparkline polyline {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  transition: stroke 0.2s;
}

.sensor-item.alert-active .sensor-sparkline {
  color: var(--status-fault);
}

/* HeroUI Alert Banner */
.alert-strip {
  display: none;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--status-fault-bg);
  border: 1px solid var(--status-fault-border);
  font-size: clamp(10px, 2.6vw, 11px);
  font-weight: 600;
  color: #f87171;
  text-align: center;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

/* HeroUI Buttons */
.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.btn-action {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--heroui-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: clamp(11px, 3vw, 12px);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--heroui-border-focus);
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-fault {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.btn-fault:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: var(--status-fault);
}

.btn-fault:active {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(0.97);
}

/* Desktop-Test Schalter */
.sim-toggle {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 8px);
  right: calc(var(--safe-right) + 8px);
  z-index: 25;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  border-radius: 9999px;
  backdrop-filter: blur(16px);
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.sim-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--heroui-border-focus);
  color: #fff;
}

@media (hover: none) and (pointer: coarse) {
  .sim-toggle {
    display: none !important;
  }
}

/* ==========================================================================
   5. TABLET & GROSSBILDSCHIRM COCKPIT (>= 768px)
   ========================================================================== */
.tablet-details {
  display: none;
}

@media (min-width: 768px) {
  .station-card {
    max-width: min(920px, 94vw);
    padding: 18px 24px;
    border-radius: 24px;
  }

  .station-body {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 18px;
    align-items: start;
  }

  .sensor-sparkline-wrap {
    display: block;
  }

  .sensor-item {
    padding: 12px 10px;
    min-height: 80px;
  }

  .tablet-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--heroui-card);
    border: 1px solid var(--heroui-border);
    border-radius: 16px;
    padding: 14px 16px;
  }

  .detail-section-title {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--heroui-divider);
  }

  .tablet-badge {
    font-size: 9px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--heroui-border);
    border-radius: 6px;
    padding: 2px 7px;
    color: var(--text-dim);
  }

  .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .detail-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--heroui-border);
    border-radius: 10px;
    padding: 8px 10px;
  }

  .detail-lbl {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
    font-family: var(--font-mono);
  }

  .detail-val {
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-white);
    margin-top: 2px;
  }

  .detail-val.text-ok { color: #34d399; }
  .detail-val.text-fault { color: #f87171; }

  /* 5-Minuten SevDesk KPI Ledger */
  .detail-5m-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .detail-5m-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--heroui-border);
    border-radius: 10px;
    padding: 6px 8px;
  }

  .node-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--heroui-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    overflow: hidden;
  }

  .node-lbl {
    color: var(--text-dim);
    font-weight: 700;
    flex-shrink: 0;
  }

  .node-id {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .trend-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
    padding-top: 2px;
  }

  .trend-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--status-ok);
    box-shadow: 0 0 8px var(--status-ok);
    flex-shrink: 0;
  }
  .trend-indicator-dot.alert-active {
    background: var(--status-fault);
    box-shadow: 0 0 8px var(--status-fault);
  }
}

/* ==========================================================================
   LANDSCAPE / TABLET QUERY
   ========================================================================== */
@media (orientation: landscape) and (max-height: 500px) {
  .ar-frame {
    padding: 8px var(--safe-right) 8px var(--safe-left);
  }
  .viewfinder-box {
    width: 110px;
    height: 110px;
  }
  .station-card {
    padding: 10px 14px;
    border-radius: 16px;
  }
  .card-actions {
    margin-top: 8px;
  }
  .btn-action {
    min-height: 38px;
  }
}

/* ==========================================================================
   HEROUI CONFIGURATION MODAL (AR WEBAPP)
   ========================================================================== */
.heroui-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.heroui-modal-dialog {
  background: var(--heroui-surface);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--heroui-border);
  border-radius: 20px;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--heroui-border-focus);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.heroui-modal-dialog.auth-dialog {
  max-width: 440px;
}

.heroui-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--heroui-divider);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--heroui-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.modal-main-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-white);
}

.modal-sub-title {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.heroui-modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--heroui-border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
}

.heroui-tabs-bar {
  display: flex;
  padding: 6px 16px;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--heroui-divider);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.heroui-tabs-bar::-webkit-scrollbar {
  display: none;
}

.heroui-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.heroui-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--heroui-border-focus);
  color: var(--text-white);
}

.heroui-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-pane.active {
  display: flex;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-white);
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.form-hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.heroui-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--heroui-surface-focus);
  border: 1px solid var(--heroui-border);
  color: var(--text-white);
  font-size: 0.82rem;
  outline: none;
  font-family: var(--font-sans);
}

.heroui-input:focus {
  border-color: var(--status-ok);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.heroui-input.font-mono {
  font-family: var(--font-mono);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action .heroui-input {
  flex: 1;
}

.preset-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--heroui-border);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
}

.preset-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-white);
}

.status-summary-box {
  background: var(--heroui-surface-focus);
  border: 1px solid var(--heroui-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
}

.status-lbl { color: var(--text-secondary); }
.status-val { color: var(--text-white); font-weight: 600; }

.test-feedback-badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
}

.test-feedback-badge.success {
  background: var(--status-ok-subtle);
  border: 1px solid var(--status-ok-border);
  color: #34d399;
}

.test-feedback-badge.error {
  background: var(--status-fault-subtle);
  border: 1px solid var(--status-fault-border);
  color: #f87171;
}

.stations-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.station-cfg-card {
  background: var(--heroui-surface-focus);
  border: 1px solid var(--heroui-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.station-cfg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--heroui-divider);
  padding-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}

.station-cfg-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-white);
}

.sensors-cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.sensor-cfg-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--heroui-border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sensor-cfg-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.tolerance-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.tolerance-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tolerance-field label {
  font-size: 0.62rem;
  color: var(--text-muted);
}

.tolerance-field input {
  padding: 3px 6px;
  font-size: 0.74rem;
  border-radius: 6px;
}

.heroui-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--heroui-divider);
  gap: 10px;
  flex-wrap: wrap;
}

.modal-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.heroui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.heroui-btn-primary {
  background: var(--status-ok);
  color: #042f2e;
  font-weight: 700;
}

.heroui-btn-flat {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
  border-color: var(--heroui-border);
}

.heroui-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--heroui-border);
  color: var(--text-white);
}

.heroui-btn-danger {
  background: var(--status-fault-subtle);
  border-color: var(--status-fault-border);
  color: #f87171;
}

.modal-feedback-msg {
  font-size: 0.74rem;
  font-weight: 600;
}

.modal-feedback-msg.success { color: #34d399; }
.modal-feedback-msg.error { color: #f87171; }

.source-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 12px;
}

.source-choice-card {
  background: rgba(18, 20, 26, 0.7);
  border: 1px solid var(--heroui-border);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.source-choice-card.active {
  border-color: var(--status-ok);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.source-choice-icon { font-size: 1.2rem; }
.source-choice-title { font-weight: 700; font-size: 0.8rem; color: var(--text-white); }
.source-choice-desc { font-size: 0.68rem; color: var(--text-dim); line-height: 1.3; }
.section-title-tag { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: var(--status-ok); margin-bottom: 8px; }

.ar-source-tag {
  display: none !important;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.18);
  color: var(--status-ok);
  border: 1px solid rgba(34, 197, 94, 0.35);
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
}

/* Hilfs-Banner bei fehlendem Marker */
.ar-no-marker-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(18, 20, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 8px 14px;
  margin: 8px auto;
  max-width: min(480px, 100%);
  width: 100%;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.hint-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-hint-show {
  background: var(--heroui-surface);
  border: 1px solid var(--heroui-border);
  color: #38bdf8;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-hint-show:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
}

.btn-hint-leitstand {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-hint-leitstand:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
}

/* ========================================================================
   AR ZABBIX & MYSQL 24H AVAILABILITY STRIP
   ======================================================================== */
.ar-zabbix-strip {
  display: none !important;
  align-items: center;
  gap: 4px;
  background: rgba(18, 20, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 2px 6px;
  margin-left: 6px;
}

.ar-zbx-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid transparent;
}

.ar-zbx-badge.zbx-active {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.ar-zbx-badge.mysql-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

/* ========================================================================
   AR 24H SHIFT TIME SWITCHER (TABLET COCKPIT)
   ======================================================================== */
.ar-time-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 8px;
}

.ar-time-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.ar-time-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.06);
}

.ar-time-btn.active {
  background: var(--heroui-primary);
  color: #0f172a;
  font-weight: 700;
}

/* ========================================================================
   A-FRAME & WEBXR DIALOG / MODAL DARK THEME OVERRIDES (iOS & Mobile)
   High-contrast dark styling ensuring perfect readability on mobile browsers
   ======================================================================== */
.a-dialog,
.a-modal,
.a-dialog-container {
  background-color: #121621 !important;
  color: #f4f4f5 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important;
  font-family: var(--font-sans) !important;
}

.a-dialog-text,
.a-dialog p,
.a-dialog span,
.a-dialog h1,
.a-dialog h2,
.a-dialog h3 {
  color: #f4f4f5 !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
}

.a-dialog-buttons {
  display: flex !important;
  gap: 12px !important;
  margin-top: 18px !important;
}

.a-dialog-button {
  flex: 1 !important;
  border-radius: 10px !important;
  padding: 10px 18px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border: none !important;
  text-align: center !important;
}

.a-dialog-allow-button,
.a-dialog-ok-button {
  background: var(--heroui-primary) !important;
  color: #ffffff !important;
}

.a-dialog-allow-button:hover,
.a-dialog-ok-button:hover {
  background: var(--heroui-primary-hover) !important;
}

.a-dialog-deny-button {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #d4d4d8 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.a-dialog-deny-button:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}




