@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #07111f;
  --bg2: #0c1a2e;
  --bg3: #112038;
  --surface: rgba(12, 26, 46, 0.88);
  --surface2: rgba(17, 32, 56, 0.92);
  --gold: #c8a832;
  --gold2: #e8c84a;
  --gold-dim: rgba(200, 168, 50, 0.12);
  --gold-glow: rgba(200, 168, 50, 0.25);
  --cyan: #00e5d4;
  --cyan-dim: rgba(0, 229, 212, 0.1);
  --cyan-glow: rgba(0, 229, 212, 0.2);
  --green: #4db847;
  --green-dim: rgba(77, 184, 71, 0.12);
  --red: #ff4466;
  --red-dim: rgba(255, 68, 102, 0.12);
  --amber: #ffaa00;
  --text: #e2eaf5;
  --text2: #7a9abd;
  --text3: #3d5a78;
  --border: rgba(0, 229, 212, 0.1);
  --border2: rgba(0, 229, 212, 0.2);
  --r2: 14px;
  --toolbar: 96px;
  --toolbar-compact: 56px;
  --focus: #00fff0;
}

body.theme-classic {
  --bg: #050a14;
  --bg2: #0b1220;
  --surface: rgba(11, 18, 32, 0.95);
  --cyan: #00d4ff;
  --gold: #00d4ff;
  --gold2: #7ee8ff;
  --gold-dim: rgba(0, 212, 255, 0.1);
  --gold-glow: rgba(0, 212, 255, 0.2);
  --border: rgba(0, 212, 255, 0.12);
  --border2: rgba(0, 212, 255, 0.22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}
body.app-ready { overflow: hidden; }
body.mobile-scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
html, body { max-width: 100vw; overflow-x: hidden; }

.hidden { display: none !important; }
.app { width: 100%; min-height: 100dvh; display: flex; flex-direction: column; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 20000;
  padding: 10px 16px; background: var(--cyan); color: #041018;
  font-weight: 700; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { left: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─── SPLASH (echtes ConformControl-Video, 9:16 mobil) ─── */
html.splash-active, html.splash-active body { overflow: hidden; background: #050a14; }

.mc-splash {
  position: fixed; inset: 0; z-index: 15000;
  display: flex; align-items: center; justify-content: center;
  background: #050a14; opacity: 1; transition: opacity 0.45s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.mc-splash.mc-splash-out { opacity: 0; pointer-events: none; }
.mc-splash-stage {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: hidden; background: #050a14;
}
.mc-splash-video {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center; background: #050a14;
}
.mc-splash-skip {
  position: absolute; top: max(1rem, env(safe-area-inset-top)); right: max(1rem, env(safe-area-inset-right));
  z-index: 3; padding: 0.45rem 0.85rem; border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px; background: rgba(8,18,36,0.62); color: #e8f4ff;
  font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.mc-splash-unmute {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; border: 0;
  background: rgba(5,10,20,0.55); color: #fff; font: inherit; cursor: pointer;
}
.mc-splash-unmute[hidden] { display: none !important; }
.mc-splash-unmute-icon {
  width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(0,212,255,0.55); background: rgba(0,212,255,0.12); font-size: 1.75rem;
}
.mc-splash-unmute-text { font-size: 0.95rem; font-weight: 600; }

@media (max-width: 768px) and (orientation: portrait) {
  .mc-splash { flex-direction: column; }
  .mc-splash-stage {
    position: relative; inset: auto; flex: 0 0 auto;
    aspect-ratio: 9 / 16;
    width: min(100%, calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 9 / 16));
    height: min(calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)), calc(100vw * 16 / 9));
    max-width: 100%; margin: auto;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .mc-splash-stage {
    position: relative; inset: auto;
    width: min(100vw, calc(100dvh * 16 / 9)); height: min(100dvh, calc(100vw * 9 / 16));
    aspect-ratio: 16 / 9; margin: auto;
  }
  .mc-splash-video { object-fit: contain; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ─── TOOLBAR ─── */
.toolbar {
  position: relative; z-index: 100;
  display: flex; flex-direction: column; gap: 0;
  padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: rgba(7,17,31,0.96);
  border-bottom: 1px solid var(--border2);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}
.toolbar-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.toolbar-row-main { min-height: 44px; }
.toolbar-row-actions {
  gap: 6px; padding-top: 6px; border-top: 1px solid rgba(0,229,212,0.06);
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; flex-wrap: nowrap;
}
.toolbar-row-actions::-webkit-scrollbar { display: none; }
.toolbar-row-actions .tbtn,
.toolbar-row-actions .fplus { flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-text { font-size: 15px; font-weight: 800; letter-spacing: -0.4px; line-height: 1; }
.logo-text span:first-child { color: var(--gold2); }
.logo-text span:last-child { color: var(--text); }
.sep { width: 1px; height: 26px; background: var(--border2); flex-shrink: 0; }
.device-sel {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px;
  cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text); font-family: inherit;
}
.status-pill {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.offline { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,68,102,0.3); }
.online { background: var(--green-dim); color: var(--green); border: 1px solid rgba(77,184,71,0.3); }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  .sdot { animation: blink 2s infinite; }
  .red-pulse { animation: blink 1s infinite; }
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.35} }
.spacer { flex: 1; min-width: 8px; }
.plan-toolbar-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; font-family: inherit; flex-shrink: 0;
}
.plan-toolbar-badge.is-starter {
  background: rgba(34, 211, 238, 0.12); border: 1px solid rgba(34, 211, 238, 0.35); color: var(--cyan);
}
.plan-toolbar-badge.is-family {
  background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.35); color: #60a5fa;
}
.plan-toolbar-badge.is-family-plus {
  background: linear-gradient(135deg, rgba(200,168,50,0.15), rgba(232,200,74,0.08));
  border: 1px solid rgba(200,168,50,0.4); color: var(--gold2);
}
.fplus {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: linear-gradient(135deg, rgba(200,168,50,0.15), rgba(232,200,74,0.08));
  border: 1px solid rgba(200,168,50,0.4); border-radius: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px; color: var(--gold2);
  cursor: pointer; font-family: inherit; text-transform: uppercase;
}
.fplus.is-upgrade { display: none; }
.fplus.is-upgrade.is-visible { display: flex; }
.fplus-star { font-size: 13px; }
.tbtn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px;
  font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid var(--border2);
  background: var(--surface); color: var(--text2); font-family: inherit;
}
.tbtn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.tbtn:disabled, .tbtn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tbtn-primary { background: var(--gold); color: #0a0800; border: none; font-weight: 800; }
.tbtn-primary:hover { background: var(--gold2); color: #0a0800; }

/* ─── GRID: volle Breite, keine Lücke rechts ─── */
.main {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 390px) minmax(180px, 210px);
  grid-template-rows: minmax(0, 0.76fr) minmax(0, 0.32fr) minmax(0, 0.46fr) minmax(0, 0.64fr);
  gap: 10px; padding: 10px;
  height: calc(100dvh - var(--toolbar));
  position: relative;
  box-sizing: border-box;
}
.map-panel { grid-column: 1; grid-row: 1 / 4; min-width: 0; }
.trail-panel { grid-column: 1; grid-row: 4; min-width: 0; min-height: 0; }
.cam-panel { grid-column: 2; grid-row: 1; min-width: 0; }
.audio-panel { grid-column: 2; grid-row: 2; min-width: 0; }
.data-panel {
  grid-column: 2; grid-row: 3 / -1; min-width: 0; min-height: 0;
  align-self: stretch; height: 100%;
}
.comm-stack {
  grid-column: 3; grid-row: 1 / 5; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.comm-panel { flex: 1 1 0; min-height: 0; }
.comm-panel.hidden { display: none !important; }
.comm-body { flex: 1; overflow: hidden; padding: 4px 6px; min-height: 0; }
.comm-body .acc-item { padding: 5px 6px; }

/* Call recording triggers inside SPA Anrufe panel */
.spa-call-triggers {
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.08);
}
.spa-call-notice {
  font-size: 10px;
  line-height: 1.35;
  color: #fbbf24;
  margin-bottom: 6px;
}
.spa-trigger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #fff;
}
.spa-trigger-status { font-size: 10px; color: var(--text2); }
.spa-trigger-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; max-height: 120px; overflow-y: auto; }
.spa-trigger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 11px;
}
.spa-trigger-row strong { color: #fff; font-weight: 600; }
.spa-trigger-row button {
  border: 0;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 10px;
}
.spa-trigger-add { display: flex; gap: 4px; align-items: center; }
.spa-trigger-add select,
.spa-trigger-add input {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.28);
  color: #fff;
}
.spa-trigger-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.35);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
#spaCallList { min-height: 0; }
.ph-compact { padding: 6px 8px !important; gap: 5px !important; }
.ph-compact .ph-title { font-size: 10px !important; }
.ph-compact .panel-expand-btn, .ph-compact .panel-detach-btn, .ph-compact .panel-close-expanded { padding: 2px 5px; font-size: 8px; }
.trail-table-scroll-panel { flex: 1; overflow: auto; min-height: 0; max-height: 100%; }
.panel.is-expanded .trail-table-scroll-panel { max-height: none !important; flex: 1 1 auto !important; }
.panel.is-expanded.comm-panel .comm-body { flex: 1 1 auto !important; overflow-y: auto !important; max-height: none !important; }
.panel.is-expanded.trail-panel { width: min(96vw, 1180px) !important; height: min(88dvh, 720px) !important; }
.panel.is-expanded.trail-panel .sv-card-body { flex: 1 1 auto !important; min-height: 0 !important; overflow: hidden !important; display: flex !important; flex-direction: column !important; }
.panel.is-expanded.trail-panel .sv-body { flex: 1 1 auto !important; min-height: 280px !important; }
.panel.is-expanded.trail-panel .sv-map-pane { display: block !important; }
.panel.is-expanded.trail-panel .sv-list-pane { max-height: none !important; }
.panel.is-expanded.trail-panel .sv-list-scroll { max-height: none !important; }
.panel.is-expanded.trail-panel > .sv-card-body,
.panel.is-floating.trail-panel > .sv-card-body {
  overflow: hidden !important; display: flex !important; flex-direction: column !important;
  flex: 1 1 auto !important; min-height: 0 !important;
}
.panel.is-floating.trail-panel .sv-map-pane { display: block; border-right: 1px solid var(--border); }
.panel.is-floating.trail-panel .sv-body { grid-template-columns: 1.35fr 1fr; min-height: 200px; }
.panel.is-floating.trail-panel .sv-list-scroll { max-height: none; }
.map-fs-btn { padding: 3px 7px !important; font-size: 9px !important; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2);
  backdrop-filter: blur(16px); display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.focusable-panel { cursor: default; }
.focusable-panel .ph { cursor: pointer; }
.focusable-panel:focus { outline: none; }
.focusable-panel:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0,229,212,0.35), 0 8px 28px rgba(0,0,0,0.35);
}
.panel-expand-btn {
  padding: 4px 9px; border-radius: 6px; font-size: 10px; font-weight: 600;
  border: 1px solid var(--border2); background: var(--surface2); color: var(--text2);
  cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.panel-expand-btn:hover { border-color: var(--cyan); color: var(--cyan); }

/* Fokus-Modus: Panel vergrößert in den Vordergrund (Barrierefreiheit) */
.focus-backdrop {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(5, 10, 20, 0.82);
  backdrop-filter: blur(6px);
}
.spa-expand-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 8100;
}
.spa-expand-layer > .panel.is-expanded { pointer-events: auto; }
.panel.is-expanded {
  position: fixed !important;
  z-index: 8100 !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: min(96vw, 1120px) !important;
  height: min(92dvh, 860px) !important;
  max-height: 92dvh !important;
  grid-column: unset !important;
  grid-row: unset !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-shadow: 0 28px 90px rgba(0,0,0,0.65), 0 0 0 2px var(--cyan);
  border-color: var(--cyan);
  cursor: default;
}
.panel.is-expanded .map-wrap {
  flex: 1 1 auto !important; min-height: 280px !important; height: auto !important;
}
.panel.is-expanded .cam-viewport {
  flex: 1 1 auto !important; min-height: 240px !important; display: flex !important;
  align-items: center !important; justify-content: center !important;
}
.panel.is-expanded.cam-panel .cam-square {
  width: min(100%, 68vh) !important; max-width: 100% !important;
  aspect-ratio: 1 / 1 !important; height: auto !important; max-height: none !important;
}
.panel.is-expanded .audio-body,
.panel.is-expanded .dtable-wrap,
.panel.is-expanded .act-list { flex: 1 1 auto !important; min-height: 180px !important; overflow: auto !important; }
.panel.is-expanded .tcontent.active {
  flex: 1 1 auto !important; min-height: 240px !important; overflow: hidden !important;
  display: flex !important; flex-direction: column !important;
}
.panel.is-expanded .cam-footer-bar,
.panel.is-expanded .audio-body { flex-shrink: 0; }
.panel.is-expanded .cam-viewport { flex: 1 1 auto !important; }
.panel.is-expanded .cam-placeholder,
.panel.is-expanded .cam-feed:not(.hidden),
.panel.is-expanded .audio-placeholder,
.panel.is-expanded .audio-active:not(.hidden) {
  flex: 1 1 auto !important; min-height: 200px !important;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
}
.panel.is-expanded .acc-body.open { max-height: none !important; overflow: visible !important; }
.panel.is-expanded.accordion-panel { overflow-y: auto !important; }
.panel.expandable-panel { cursor: pointer; }
.panel.expandable-panel.is-expanded { cursor: default; }
.panel.expandable-panel .ph { cursor: pointer; }
.panel.is-expanded > :not(.ph) {
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
}
.panel.is-expanded .ph { flex-shrink: 0; }
.panel.is-expanded .trail-playback-bar,
.panel.is-expanded .chips,
.panel.is-expanded .trail-table-wrap,
.panel.is-expanded .tabs,
.panel.is-expanded .cam-footer-bar { flex-shrink: 0; flex-grow: 0; min-height: 0; overflow: visible; }
.panel.is-expanded .comm-body,
.panel.is-expanded .trail-table-scroll-panel,
.panel.is-expanded .dtable-wrap,
.panel.is-expanded .act-list,
.panel.is-expanded .tcontent.active,
.panel.is-expanded .audio-body,
.panel.is-expanded .cam-viewport {
  flex: 1 1 auto !important;
  min-height: 200px !important;
  overflow: auto !important;
}
.panel.is-expanded .audio-wave { height: 80px; }
.panel.is-expanded .panel-expand-btn { display: none; }
.panel-detach-btn {
  padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 600;
  border: 1px solid rgba(200,168,50,0.35); background: rgba(200,168,50,0.1); color: var(--gold2);
  cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.panel-detach-btn:hover { border-color: var(--gold); color: var(--gold); }
.panel.is-expanded .panel-detach-btn,
.panel.is-floating .panel-detach-btn { display: none; }
.panel.is-expanded .panel-close-expanded,
.panel.is-floating .panel-close-expanded { display: inline-flex !important; }

/* Abgekoppelte Fenster */
.spa-float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8150; }
.spa-float-layer > .panel { pointer-events: auto; }
.panel.is-floating {
  position: absolute !important;
  z-index: 8160 !important;
  transform: none !important;
  left: 40px; top: 56px;
  width: min(480px, 40vw); height: min(420px, 48vh);
  max-height: none !important;
  grid-column: unset !important; grid-row: unset !important;
  display: flex !important; flex-direction: column !important;
  overflow: hidden !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px var(--cyan);
  border-color: var(--cyan);
  resize: none;
}
.panel.is-floating .ph { cursor: move; user-select: none; }
.panel-resize-handle {
  position: absolute; right: 0; bottom: 0; width: 16px; height: 16px;
  cursor: nwse-resize; z-index: 5;
  background: linear-gradient(135deg, transparent 50%, rgba(0,229,212,0.55) 50%);
}
.panel-placeholder {
  background: rgba(0,229,212,0.06); border: 1px dashed rgba(0,229,212,0.25); border-radius: var(--r2);
  padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10px; color: var(--text2); min-height: 44px;
}
.panel-placeholder-label { flex: 1; }

/* Karte Vollbild — kein Panel-Expand */
#mapFullscreenTarget:fullscreen,
#mapFullscreenTarget:-webkit-full-screen,
#mapFullscreenTarget.map-pseudo-fullscreen {
  background: #050a14; border-radius: 0; display: flex; flex-direction: column;
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
}
#mapFullscreenTarget:fullscreen .live-map,
#mapFullscreenTarget:-webkit-full-screen .live-map,
#mapFullscreenTarget.map-pseudo-fullscreen .live-map {
  flex: 1 1 auto !important; min-height: 0 !important; width: 100% !important; height: 100% !important;
}
.map-panel .mc-map-layer-toggle,
#mapFullscreenTarget .map-type-toggle { display: none !important; }
#mapFullscreenTarget.map-pseudo-fullscreen {
  position: fixed; inset: 0; z-index: 99990; margin: 0;
}
body.map-fs-active { overflow: hidden; }
.panel-close-expanded {
  padding: 4px 9px; border-radius: 6px; font-size: 10px; font-weight: 600;
  border: 1px solid var(--border2); background: var(--surface2); color: var(--text2);
  cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.panel-close-expanded:hover { border-color: var(--cyan); color: var(--cyan); }
.panel.is-expanded .panel-close-expanded { display: inline-flex !important; }
.panel-close-expanded { display: none; }
.ph {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ph-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ph-dot.green { background: var(--green); box-shadow: 0 0 8px var(--green); }
.ph-dot.gold { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.ph-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text2); flex: 1; margin: 0;
}
.ph-count {
  font-size: 10px; font-weight: 700; color: var(--cyan); background: var(--cyan-dim);
  padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(0,229,212,0.2);
}
.ph-count.gold { color: var(--gold); background: var(--gold-dim); border-color: rgba(200,168,50,0.2); }

.chips {
  display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; overflow-x: auto;
}
.chip {
  display: flex; flex-direction: column; align-items: center; padding: 6px 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 9px;
  flex-shrink: 0;
}
.chip-val { font-size: 17px; font-weight: 800; color: var(--cyan); line-height: 1; }
.chip-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text3); margin-top: 2px; }

.trail-playback-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: rgba(7,17,31,0.45);
}
.trail-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text2); padding: 4px 8px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
}
.trail-chip select {
  background: transparent; border: none; color: var(--text); font-size: 10px;
  font-family: inherit; cursor: pointer;
}
.trail-status {
  margin: 0; padding: 6px 12px; font-size: 10px; color: var(--text3);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.trail-status.is-playing { color: var(--gold2); }
.trail-table-wrap {
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.trail-table-wrap summary {
  padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text2);
  cursor: pointer; list-style: none;
}
.trail-table-wrap summary::-webkit-details-marker { display: none; }
.trail-table-scroll { max-height: 140px; overflow: auto; }
.trail-table td, .trail-table th { font-size: 11px; padding: 6px 10px; }
.trail-table tbody tr.is-playback td { background: rgba(200,168,50,0.08); color: var(--gold2); }

/* Standort-Verlauf (Karte + Liste + Scrubber) */
.trail-panel .sv-badge {
  font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,229,212,0.25);
  white-space: nowrap; flex-shrink: 0;
}
.trail-panel .sv-badge.muted {
  background: rgba(255,255,255,0.04); color: var(--text2); border-color: var(--border2);
}
.trail-panel .sv-card-body {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.trail-panel .sv-body {
  display: grid; grid-template-columns: 1fr; flex: 1; min-height: 0; overflow: hidden;
}
.trail-panel.is-expanded .sv-body,
.trail-panel.is-floating .sv-body { grid-template-columns: 1.35fr 1fr; }
.trail-panel .sv-map-pane {
  display: none; position: relative; border-bottom: 1px solid var(--border);
  background: #08131f; min-height: 0;
}
.trail-panel.is-expanded .sv-map-pane,
.trail-panel.is-floating .sv-map-pane { display: block; border-bottom: none; border-right: 1px solid var(--border); }
.trail-panel .sv-map { position: absolute; inset: 0; }
.trail-panel .sv-map-fade-top {
  position: absolute; top: 0; left: 0; right: 0; height: 28px;
  background: linear-gradient(180deg, rgba(6,15,28,.55), transparent);
  pointer-events: none; z-index: 5;
}
.trail-panel .sv-map .leaflet-container { background: #08131f; font-family: inherit; }
.trail-panel .sv-map .leaflet-control-zoom a {
  background: rgba(14,31,48,.92) !important; color: var(--cyan) !important; border-color: var(--border2) !important;
}
.trail-panel .sv-map-layer-toggle {
  display: flex; gap: 0; background: rgba(10,22,40,.92); border: 1px solid var(--border2);
  border-radius: 8px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.trail-panel .sv-layer-btn {
  border: none; background: transparent; color: var(--text2);
  font-size: 10px; font-weight: 600; padding: 5px 9px; cursor: pointer; font-family: inherit;
}
.trail-panel .sv-layer-btn:hover,
.trail-panel .sv-layer-btn.is-active {
  background: rgba(0,229,212,.14); color: var(--cyan);
}
.trail-panel .sv-map .leaflet-container { will-change: transform; }
.trail-panel .sv-list-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.trail-panel .sv-list-head {
  display: grid; grid-template-columns: 72px 1fr 52px; gap: 6px;
  padding: 8px 12px 6px; font-size: 9px; letter-spacing: .08em; font-weight: 700;
  color: var(--text3); border-bottom: 1px solid var(--border); text-transform: uppercase;
}
.trail-panel .sv-list-head > :last-child { text-align: right; }
.trail-panel .sv-list-scroll { overflow-y: auto; flex: 1; min-height: 0; max-height: 140px; }
.trail-panel.is-expanded .sv-list-scroll,
.trail-panel.is-floating .sv-list-scroll { max-height: none; }
.trail-panel .sv-list-empty { padding: 14px 12px; font-size: 11px; color: var(--text2); text-align: center; margin: 0; }
.trail-panel .sv-row {
  display: grid; grid-template-columns: 72px 1fr 52px; gap: 6px; align-items: center;
  padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.04);
  cursor: pointer; transition: background .15s ease; position: relative;
}
.trail-panel .sv-row:hover { background: rgba(0,229,212,.05); }
.trail-panel .sv-row.active { background: rgba(0,229,212,.1); }
.trail-panel .sv-row.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
}
.trail-panel .sv-row-time { font-size: 10px; color: var(--text2); line-height: 1.3; font-variant-numeric: tabular-nums; }
.trail-panel .sv-row-date { color: var(--text3); font-size: 9px; display: block; }
.trail-panel .sv-row-main { min-width: 0; }
.trail-panel .sv-row-addr {
  font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trail-panel .sv-row-addr.loading { color: var(--text3); font-weight: 400; font-style: italic; }
.trail-panel .sv-row-sub { font-size: 9px; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.trail-panel .sv-row-acc { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 5px; text-align: center; white-space: nowrap; }
.trail-panel .sv-acc-good { background: rgba(52,211,153,.12); color: var(--green); }
.trail-panel .sv-acc-mid { background: rgba(200,168,50,.13); color: var(--gold2); }
.trail-panel .sv-acc-bad { background: rgba(242,112,122,.13); color: #f2707a; }
.trail-panel .sv-playback {
  border-top: 1px solid var(--border); padding: 10px 12px 12px;
  background: rgba(255,255,255,.015); display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  position: relative; z-index: 6;
}
.trail-panel.sv-is-playing .sv-live-marker {
  animation-duration: 0.9s;
}
.trail-panel .sv-pb-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,229,212,.35);
  background: rgba(0,229,212,.08); color: var(--cyan); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.trail-panel .sv-pb-btn:hover { background: rgba(0,229,212,.18); }
.trail-panel .sv-pb-btn svg { width: 13px; height: 13px; }
.trail-panel .sv-pb-play { width: 36px; height: 36px; background: var(--cyan); color: #04211d; border-color: var(--cyan); }
.trail-panel .sv-pb-play:hover { background: var(--cyan2, #7ff3e3); }
.trail-panel .sv-pb-play svg { width: 15px; height: 15px; }
.trail-panel .sv-pb-track-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.trail-panel .sv-pb-times { display: flex; justify-content: space-between; font-size: 9px; color: var(--text3); font-variant-numeric: tabular-nums; }
.trail-panel .sv-pb-times .sv-now { color: var(--cyan); font-weight: 600; }
.trail-panel #svScrubber {
  -webkit-appearance: none; width: 100%; height: 4px; border-radius: 3px;
  background: linear-gradient(90deg, var(--cyan) var(--sv-fill, 0%), rgba(255,255,255,.08) var(--sv-fill, 0%));
  outline: none; cursor: pointer;
}
.trail-panel #svScrubber::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 0 3px rgba(0,229,212,.2), 0 0 8px rgba(0,229,212,.5);
  cursor: pointer; margin-top: -4px;
}
.trail-panel .sv-speed-group {
  display: flex; gap: 3px; background: rgba(255,255,255,.03); border: 1px solid var(--border2);
  border-radius: 7px; padding: 2px; flex-shrink: 0;
}
.trail-panel .sv-speed-btn {
  font-size: 10px; font-weight: 600; padding: 4px 7px; border-radius: 5px;
  color: var(--text2); background: transparent; border: none; cursor: pointer; font-family: inherit;
}
.trail-panel .sv-speed-btn.active { background: var(--cyan); color: #04211d; }
.trail-panel .sv-live-marker {
  width: 14px; height: 14px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(0,229,212,.55); animation: sv-livepulse 1.6s infinite; border: 2px solid #04211d;
}
@keyframes sv-livepulse {
  0% { box-shadow: 0 0 0 0 rgba(0,229,212,.55); }
  70% { box-shadow: 0 0 0 10px rgba(0,229,212,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,229,212,0); }
}
.trail-panel .leaflet-popup-content-wrapper {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border2); border-radius: 8px;
}
.trail-panel .sv-popup-time { color: var(--cyan); font-size: 10px; }
.trail-panel .sv-popup-addr { margin-top: 3px; font-weight: 600; font-size: 11px; }

/* Standort-Zeitleiste (Legacy — nicht mehr im SPA-Panel) */
.trail-timeline-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.trail-timeline-hint { font-size: 10px; color: var(--text3); flex: 1; min-width: 140px; }
.trail-timeline-scroll { flex: 1; overflow: auto; min-height: 0; padding: 8px 10px 12px; }
.trail-timeline-empty { padding: 16px 12px; font-size: 11px; color: var(--text2); text-align: center; }
.trail-timeline { display: flex; flex-direction: column; gap: 14px; }
.trail-day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 4px 2px 8px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2; background: var(--surface);
}
.trail-day-title { font-size: 12px; font-weight: 800; color: var(--text); letter-spacing: 0.2px; }
.trail-day-meta { font-size: 10px; color: var(--text3); }
.trail-day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.trail-seg { display: grid; grid-template-columns: 18px 1fr; gap: 8px; position: relative; }
.trail-seg-rail {
  display: flex; flex-direction: column; align-items: center; padding-top: 14px;
}
.trail-seg-dot {
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--cyan);
  background: var(--bg2); box-shadow: 0 0 0 3px rgba(0,229,212,0.12); flex-shrink: 0;
}
.trail-seg:not(:last-child) .trail-seg-rail::after {
  content: ''; flex: 1; width: 2px; margin-top: 4px;
  background: linear-gradient(to bottom, rgba(0,229,212,0.35), rgba(0,229,212,0.08));
  min-height: 24px;
}
.trail-seg-trip .trail-seg-dot { border-color: var(--gold2); box-shadow: 0 0 0 3px var(--gold-dim); }
.trail-seg-card {
  margin: 4px 0 10px; padding: 10px 10px 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(7,17,31,0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.trail-seg-card:hover, .trail-seg-card:focus-visible {
  border-color: var(--border2); box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  outline: none;
}
.trail-seg-card.is-active {
  border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(0,229,212,0.35);
  background: rgba(0,229,212,0.06);
}
.trail-seg-head { display: flex; align-items: flex-start; gap: 8px; }
.trail-seg-icon { font-size: 16px; line-height: 1.2; flex-shrink: 0; }
.trail-seg-titles { flex: 1; min-width: 0; }
.trail-seg-label {
  margin: 0; font-size: 12px; font-weight: 700; color: var(--text);
  line-height: 1.35; word-break: break-word;
}
.trail-seg-type {
  display: inline-block; margin-top: 2px; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--text3);
}
.trail-seg-trip .trail-seg-type { color: var(--gold2); }
.trail-seg-actions { display: flex; gap: 4px; flex-shrink: 0; }
.trail-seg-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text2); cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.trail-seg-btn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.trail-seg-time { margin: 6px 0 0; font-size: 11px; font-weight: 600; color: var(--text2); }
.trail-seg-sub { margin: 2px 0 0; font-size: 10px; color: var(--text2); }
.trail-seg-meta { margin: 2px 0 0; font-size: 10px; color: var(--text3); }
.trail-mode-walk .trail-seg-dot { border-color: #6ee7b7; }
.trail-mode-bike .trail-seg-dot { border-color: #93c5fd; }
.trail-mode-car .trail-seg-dot { border-color: var(--gold2); }
.trail-mode-fast .trail-seg-dot { border-color: #c4b5fd; }
.trail-raw-details { border-top: 1px solid var(--border); flex-shrink: 0; }
.trail-raw-details summary {
  padding: 8px 12px; font-size: 10px; color: var(--text3); cursor: pointer; list-style: none;
}
.trail-raw-details summary::-webkit-details-marker { display: none; }
.trail-raw-scroll { max-height: 160px; overflow: auto; }
.panel.is-expanded .trail-timeline-scroll { max-height: none !important; flex: 1 1 auto !important; }
.panel.is-expanded .trail-raw-scroll { max-height: 220px; }

.trail-playback-pin { background: none; border: none; }
.trail-playback-pin-inner {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #0a0800; font-weight: 900; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 14px var(--gold-glow); border: 2px solid #fff;
}

.map-wrap { flex: 1; position: relative; min-height: 160px; touch-action: pan-x pan-y pinch-zoom; }
.panel.is-expanded .trail-table-scroll { max-height: 220px; }
.live-map { width: 100%; height: 100%; background: #071220; }
.live-map .leaflet-control-zoom a { background: rgba(7,17,31,0.9); color: var(--text); border-color: var(--border2); }

.map-footer {
  padding: 8px 12px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 10px; flex-shrink: 0;
}
.mf-chip { font-size: 11px; color: var(--text2); }
.mf-chip.accent { color: var(--cyan); }

/* LIVE KAMERA — groß & quadratisch */
.cam-panel { min-height: 0; }
.cam-viewport {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 10px 12px; min-height: 0; overflow: hidden;
}
.cam-square {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 100%;
  max-width: min(100%, calc(100dvh - var(--toolbar) - 180px));
  margin: 0 auto;
  position: relative;
  background: radial-gradient(ellipse at center, #0c1a2e, #07111f);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
}
.cam-placeholder, .cam-feed {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 12px;
}
.cam-ring {
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(0,229,212,0.35);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.cam-label { font-size: 11px; color: var(--text2); margin: 0; }
.cam-sub { font-size: 10px; color: var(--text3); text-align: center; margin: 0; }
.cam-start-btn { margin-top: 4px; }
.cam-sim {
  width: 100%; height: 100%; position: relative;
  background: linear-gradient(135deg, #0e1c2e, #162a40);
  overflow: hidden;
}
.cam-footer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: 10px; color: var(--text3); flex-shrink: 0;
}
.cam-facing-switch {
  display: inline-flex; align-items: center; gap: 4px;
}
.cam-facing-btn {
  min-width: 52px; padding: 4px 8px; font-size: 10px; font-weight: 700;
}
.cam-facing-btn.active {
  color: var(--cyan); border-color: rgba(0,229,212,0.45);
  background: rgba(0,229,212,0.08);
}
.cam-sim-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(0,229,212,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,212,0.06) 1px, transparent 1px);
  background-size: 16px 16px;
}
.cam-sim-time {
  position: absolute; bottom: 8px; left: 8px; font-size: 10px; font-weight: 800;
  color: var(--red); letter-spacing: 0.5px;
}
.live-badge {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 5px;
  background: var(--red-dim); border: 1px solid rgba(255,68,102,0.4);
  padding: 3px 8px; border-radius: 5px; font-size: 10px; font-weight: 800; color: var(--red);
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

/* LIVE MIKROFON — eigenständiges Panel */
.audio-panel { min-height: 0; }
.audio-live-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.5px; color: var(--text3);
  background: rgba(122,154,189,0.1); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px;
}
.audio-live-pill.is-active { color: var(--green); background: var(--green-dim); border-color: rgba(77,184,71,0.35); }
.audio-live-pill.is-audit { color: var(--gold2); background: var(--gold-dim); border-color: rgba(200,168,50,0.35); }
.audio-body { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; }
.audio-icon { font-size: 1.5rem; line-height: 1; }
.audio-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
}
.audio-wave {
  display: flex; align-items: flex-end; justify-content: center; gap: 3px;
  height: 48px; padding: 6px 8px;
  background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 8px;
}
.audio-wave span {
  width: 4px; border-radius: 2px; background: linear-gradient(to top, var(--cyan), var(--gold2));
  height: 8px; opacity: 0.35; transition: height 0.12s ease;
}
.audio-wave.is-live span { opacity: 0.9; }
@media (prefers-reduced-motion: no-preference) {
  .audio-wave.is-live span { animation: wave-bounce 0.8s ease-in-out infinite alternate; }
  .audio-wave.is-live span:nth-child(odd) { animation-delay: 0.1s; }
  .audio-wave.is-live span:nth-child(3n) { animation-delay: 0.25s; }
}
@keyframes wave-bounce {
  from { height: 8px; }
  to { height: var(--h, 32px); }
}
.audio-meta {
  display: flex; flex-wrap: wrap; gap: 8px; font-size: 10px; color: var(--text3);
}
.audio-meta strong { color: var(--text2); font-weight: 600; }
.audio-actions {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto;
}
.audio-actions .tbtn { flex: 1; min-width: 0; justify-content: center; }
.tbtn-audit { border-color: rgba(200,168,50,0.35); color: var(--gold2); }
.tbtn-audit:hover { background: var(--gold-dim); border-color: var(--gold); color: var(--gold2); }

.scan-line {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.6; pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .scan-line { animation: scan 3s linear infinite; }
}
@keyframes scan { 0% { top: -2px; } 100% { top: 100%; } }

/* KEYLOGGER */
.data-panel .dtable-wrap { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tab {
  flex: 1; padding: 9px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text3); cursor: pointer; border: none; background: none; font-family: inherit;
  border-bottom: 2px solid transparent;
}
.tab.active, .tab[aria-selected="true"] { color: var(--cyan); border-bottom-color: var(--cyan); }
.tcontent { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.tcontent[hidden] { display: none !important; }
.dtable-wrap { flex: 1; overflow-y: auto; min-height: 0; }
table.dt { width: 100%; border-collapse: collapse; }
.app-group-row td { padding: 0; border-bottom: 1px solid var(--border); }
.app-group-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: none; border: none; color: var(--text); cursor: pointer; font-family: inherit;
  text-align: left;
}
.app-group-btn:hover { background: rgba(0,229,212,0.04); }
.app-group-meta { margin-left: auto; font-size: 10px; color: var(--text3); }
.app-group-body { padding: 0 12px 10px 12px; }
.app-group-body[hidden] { display: none; }
.kg-item {
  display: flex; justify-content: space-between; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid rgba(0,229,212,0.05); font-size: 12px;
}
.kg-item:last-child { border-bottom: none; }
.kg-item time { color: var(--text3); font-size: 10px; white-space: nowrap; }
.key-tag {
  display: inline-block; background: rgba(0,229,212,0.08); border: 1px solid rgba(0,229,212,0.2);
  border-radius: 4px; padding: 2px 7px; font-size: 11px; font-family: ui-monospace, monospace; color: var(--cyan);
}
.app-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.app-wa { background: var(--green-dim); color: var(--green); }
.app-chrome { background: var(--cyan-dim); color: var(--cyan); }
.app-def { background: rgba(122,154,189,0.1); color: var(--text2); }

.act-list { flex: 1; overflow-y: auto; padding: 4px 0; min-height: 0; }
.act-item { display: flex; gap: 10px; padding: 8px 12px; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.act-dot.cyan { background: var(--cyan); }
.act-dot.amber { background: var(--amber); }
.act-dot.green { background: var(--green); }
.act-dot.gold { background: var(--gold); }
.act-title { font-size: 12px; color: var(--text); font-weight: 500; }
.act-time { font-size: 10px; color: var(--text3); }

/* ACCORDION — schmale rechte Spalte */
.accordion-panel { overflow-y: auto; min-height: 0; }
.accordion-panel .ph { padding: 8px 10px; gap: 6px; }
.accordion-panel .ph-title { font-size: 10px; letter-spacing: 0.4px; }
.accordion-panel .panel-expand-btn { padding: 3px 6px; font-size: 9px; }
.acc-section { border-bottom: 1px solid var(--border); }
.acc-trigger {
  width: 100%; display: flex; align-items: center; gap: 6px; padding: 9px 8px;
  background: none; border: none; color: var(--text); cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit; text-align: left;
}
.acc-trigger:hover { background: rgba(0,229,212,0.04); }
.accordion-panel .acc-trigger { font-size: 11px; }
.acc-icon { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.accordion-panel .acc-icon { width: 20px; height: 20px; font-size: 10px; }
.cyan-bg { background: var(--cyan-dim); }
.green-bg { background: var(--green-dim); }
.gold-bg { background: var(--gold-dim); }
.acc-badge {
  margin-left: auto; background: var(--gold-dim); color: var(--gold);
  border: 1px solid rgba(200,168,50,0.25); border-radius: 10px; padding: 2px 8px; font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.accordion-panel .acc-badge { padding: 1px 5px; font-size: 9px; }
.acc-arrow { color: var(--text3); font-size: 10px; transition: transform 0.2s; }
.acc-trigger[aria-expanded="true"] .acc-arrow { transform: rotate(180deg); }
.acc-body { overflow: hidden; }
.acc-body[hidden] { display: none; }
.acc-item { padding: 8px 12px; border-bottom: 1px solid rgba(0,229,212,0.05); }
.accordion-panel .acc-item { padding: 6px 8px; }
.acc-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.acc-name { font-size: 12px; color: var(--text); font-weight: 500; }
.accordion-panel .acc-name,
.accordion-panel .acc-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accordion-panel .acc-name { font-size: 11px; }
.acc-time { font-size: 10px; color: var(--text3); flex-shrink: 0; }
.accordion-panel .acc-time { font-size: 9px; }
.acc-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }
.accordion-panel .acc-sub { font-size: 10px; }
.call-in { color: var(--green); }
.call-miss { color: var(--red); }

.modal-lead { color: var(--text2); margin: 0 0 14px; font-size: 0.92rem; line-height: 1.5; }

/* APK-Setup Vollbild (Erstanmeldung / kein Gerät / APK gelöscht) */
.apk-setup-screen {
  flex: 1; min-height: 0; overflow: auto;
  padding: 12px 14px 20px;
  background: radial-gradient(ellipse at top, rgba(0,229,212,0.04), transparent 55%), var(--bg);
}
.apk-setup-screen.hidden { display: none !important; }
.apk-setup-screen-inner {
  max-width: 820px; margin: 0 auto;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 16px;
  padding: 18px 20px 16px; box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}
.apk-setup-alert {
  margin-bottom: 14px; padding: 12px 14px; border-radius: 10px;
  font-size: 0.88rem; line-height: 1.45; font-weight: 500;
}
.apk-setup-alert.reason-first {
  background: rgba(200,168,50,0.12); border: 1px solid rgba(200,168,50,0.35); color: var(--gold2);
}
.apk-setup-alert.reason-nodevice {
  background: rgba(0,229,212,0.1); border: 1px solid rgba(0,229,212,0.3); color: var(--cyan);
}
.apk-setup-alert.reason-removed {
  background: rgba(255,68,102,0.12); border: 1px solid rgba(255,68,102,0.35); color: #ff8fa3;
}
.apk-setup-head h2 { font-size: 1.15rem; margin: 0 0 6px; color: var(--text); }
.apk-setup-download-status {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 8px;
  background: rgba(0,229,212,0.08); border: 1px solid rgba(0,229,212,0.2);
  font-size: 11px; color: var(--cyan); text-align: center;
}
.apk-setup-download-status:empty { display: none; }
.apk-setup-download-error {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 8px;
  background: rgba(242,112,122,0.12); border: 1px solid rgba(242,112,122,0.35);
  font-size: 11px; color: #f8a8b0;
}
.apk-setup-download-error.hidden { display: none !important; }
.apk-setup-handoff { margin: 12px 0 0; }
.apk-setup-handoff.hidden { display: none !important; }
.apk-setup-footer {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
}
.demo-state-wrap { flex-shrink: 0; }
.demo-state-select {
  padding: 5px 8px; border-radius: 8px; border: 1px dashed rgba(200,168,50,0.45);
  background: rgba(200,168,50,0.08); color: var(--gold2); font-size: 10px;
  font-family: inherit; cursor: pointer; max-width: 130px;
}
body.dashboard-active .main { display: grid; }
body.apk-setup-active .main { display: none !important; }
body.apk-setup-active { overflow: auto; }

/* Geräte-Dropdown */
.device-sel-wrap { position: relative; flex-shrink: 0; }
.device-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 9000;
  min-width: 220px; max-width: 320px; max-height: 280px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45); padding: 6px;
}
.device-menu.hidden { display: none !important; }
.device-menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--text); font-size: 12px; cursor: pointer; font-family: inherit;
}
.device-menu-item:hover, .device-menu-item.active { background: var(--cyan-dim); color: var(--cyan); }
.device-menu-empty { padding: 10px; font-size: 11px; color: var(--text2); margin: 0; }

/* Live-Kamera im SPA-Panel */
.spa-cam-player { background: transparent !important; border: none !important; box-shadow: none !important; }
.cam-feed:not(.hidden) {
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 0 !important;
}
.cam-feed:not(.hidden) .spa-cam-player,
.cam-feed:not(.hidden) .mc-live-player-body {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.spa-cam-viewport, .spa-cam-viewport .mc-live-viewport {
  width: 100% !important; height: 100% !important; min-height: 0 !important;
  position: relative !important; border-radius: 12px; overflow: hidden;
  background: #000; flex: 1 1 auto;
}
.cam-feed .mc-live-empty {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  padding: 12px; text-align: center;
  background: rgba(0, 0, 0, 0.4);
}
.cam-feed .mc-live-empty[hidden] { display: none !important; }
.spa-cam-viewport img[hidden], #backImg[hidden] { display: none !important; }
.spa-cam-viewport img:not([hidden]), #backImg:not([hidden]) {
  width: 100% !important; height: 100% !important; object-fit: contain !important;
  display: block !important; position: relative; z-index: 1;
}
.panel.is-expanded .spa-cam-viewport { min-height: min(58vh, 520px) !important; }

.spa-audio-player {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 100%;
}
.spa-audio-player .mc-live-audio-stage { width: 100%; }
.spa-audio-player #audioLiveState {
  font-size: 11px;
  color: var(--text2);
  text-align: center;
  margin-top: 6px;
}
.spa-audio-player .audio-wave.is-live span,
.spa-audio-player .mc-live-waveform.is-playing span {
  opacity: 0.9;
}
.panel.is-expanded .spa-audio-player .audio-wave { height: 80px; }

.spa-kg-group { border-bottom: 1px solid var(--border); padding: 6px 8px; }
.spa-kg-group .kg-item { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px; }
.spa-kg-live {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--gold, #c9a227) 8%, transparent);
}
.spa-kg-live .key-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}


.apk-guide-box {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.84rem;
  color: var(--text2);
  line-height: 1.45;
}
.apk-guide-box p { margin: 0 0 8px; }
.apk-guide-box p:last-child { margin-bottom: 0; }
.apk-guide-paid.hidden { display: none !important; }
.apk-card-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.apk-card-badge--free { background: rgba(80, 200, 120, 0.15); color: #7dcea0; }
.apk-card-badge--paid { background: rgba(0, 212, 255, 0.12); color: #7dd3fc; }
.apk-card-badge--plus { background: rgba(200, 168, 50, 0.15); color: var(--gold2); }
.apk-card-badge--exclusive { background: rgba(180, 120, 255, 0.12); color: #c4b5fd; }
.apk-card-tagline { font-size: 0.84rem; color: var(--text2); margin: 0 0 10px; font-weight: 600; }
.apk-card-facts { margin: 0 0 12px; font-size: 0.8rem; color: var(--text2); }
.apk-card-facts div { margin-bottom: 8px; }
.apk-card-facts dt { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.apk-card-facts dd { margin: 0; line-height: 1.4; }
.apk-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.apk-cards.apk-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.apk-size { font-weight: 600; opacity: 0.85; }
@media (max-width: 900px) {
  .apk-cards.apk-cards-3 { grid-template-columns: 1fr; }
}
.apk-card {
  padding: 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface);
}
.apk-card-full { border-color: rgba(200,168,50,0.35); }
.apk-card--locked {
  border-style: dashed;
  opacity: 0.92;
}
.apk-card--locked .tbtn[data-apk-action="upgrade"] {
  width: 100%;
}
.apk-upgrade-banner {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.08);
}
.apk-upgrade-banner.hidden { display: none !important; }
.apk-upgrade-banner p {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.45;
}
.apk-upgrade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.apk-card h3 { font-size: 0.95rem; margin-bottom: 6px; color: var(--gold2); }
.apk-card p { font-size: 0.82rem; color: var(--text2); margin-bottom: 10px; }
.apk-card ul { font-size: 0.82rem; color: var(--text2); margin: 0 0 12px 18px; }
.setup-guide h3 { font-size: 0.95rem; margin-bottom: 10px; }
.setup-steps { margin: 0 0 14px 20px; color: var(--text2); font-size: 0.88rem; }
.setup-steps li { margin-bottom: 6px; }
.setup-visual { margin-top: 8px; }
.gui-mock {
  border: 1px solid var(--border2); border-radius: 10px; overflow: hidden; max-width: 320px;
}
.gui-bar { padding: 8px 12px; background: rgba(0,0,0,0.25); font-size: 11px; font-weight: 600; }
.gui-row { padding: 10px 12px; border-top: 1px solid var(--border); font-size: 12px; }
.gui-row.dim { color: var(--text3); background: rgba(255,255,255,0.03); }
.gui-hint { float: right; color: var(--cyan); font-size: 10px; }

/* FOCUS */
:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

/* RESPONSIVE — Tablet */
@media (max-width: 1100px) {
  :root { --toolbar: 104px; }
  body.app-ready, body.mobile-scroll { overflow-y: auto; overflow-x: hidden; }
  .main {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(280px, 38vh) minmax(120px, auto) minmax(300px, 42vh) minmax(160px, auto) minmax(160px, auto) minmax(280px, auto);
    height: auto; min-height: calc(100dvh - var(--toolbar));
    overflow: visible; width: 100%;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .map-panel { grid-column: 1 / 3; grid-row: 1; min-height: 280px; }
  .map-panel .map-wrap { min-height: 34vh; height: 34vh; }
  .trail-panel { grid-column: 1 / 3; grid-row: 2; min-height: 120px; max-height: 200px; }
  .cam-panel { grid-column: 1 / 3; grid-row: 3; min-height: min(92vw, 420px); }
  .audio-panel { grid-column: 1; grid-row: 4; min-height: 160px; }
  .data-panel { grid-column: 2; grid-row: 4; min-height: 160px; }
  .comm-stack { grid-column: 1 / 3; grid-row: 5 / 7; max-height: none; min-height: 280px; }
  .comm-panel { flex: 0 0 auto; min-height: 80px; max-height: 160px; }
  .cam-square { max-width: min(92vw, 440px); margin: 0 auto; }
  .panel.is-expanded {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    left: 0 !important; top: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .device-menu {
    left: 0; right: 0; max-width: none; width: min(100vw - 24px, 360px);
  }
}

/* RESPONSIVE — Handys */
@media (max-width: 768px) {
  :root { --toolbar: 108px; }
  .toolbar-sep-main { display: none; }
  .toolbar-spacer { display: none; }
  .device-sel { max-width: 42vw; }
  #deviceSelLabel {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 18vw;
  }
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 8px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .map-panel, .trail-panel, .cam-panel, .audio-panel, .data-panel, .comm-stack {
    grid-column: 1; grid-row: auto;
  }
  .map-panel { min-height: 0; }
  .map-panel .map-wrap { min-height: 52vw; height: 52vw; max-height: 72vw; }
  .trail-panel { min-height: 140px; max-height: 240px; }
  .trail-panel .sv-playback { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .trail-panel .sv-pb-track-wrap { min-width: 120px; }
  .trail-table-scroll-panel { max-height: 160px; }
  .cam-panel { min-height: 0; padding-bottom: 4px; }
  .cam-square { width: 100%; max-width: 100%; aspect-ratio: 1 / 1; }
  .audio-panel, .data-panel { min-height: 200px; }
  .comm-stack { min-height: 0; gap: 8px; }
  .comm-panel { min-height: 96px; max-height: 180px; }
  .comm-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .ph { flex-wrap: wrap; row-gap: 6px; padding: 10px 10px !important; }
  .ph-title { flex: 1 1 100%; order: -1; font-size: 12px !important; }
  .ph-compact .ph-title { flex: 1 1 auto; order: 0; font-size: 11px !important; }
  .panel-expand-btn, .panel-detach-btn, .panel-close-expanded, .map-fs-btn {
    min-height: 40px; padding: 8px 10px !important; font-size: 11px !important;
  }
  .tbtn, .fplus, .device-sel {
    min-height: 44px; padding: 10px 12px; font-size: 12px;
  }
  .trail-playback-bar {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; gap: 6px; scrollbar-width: none;
  }
  .trail-playback-bar::-webkit-scrollbar { display: none; }
  .trail-chip, .trail-playback-bar .tbtn { flex-shrink: 0; }
  .chips { scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { min-width: 72px; padding: 8px 10px; }

  .panel.is-floating {
    left: max(6px, env(safe-area-inset-left)) !important;
    top: max(6px, env(safe-area-inset-top)) !important;
    width: calc(100vw - 12px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
    height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    max-width: none !important;
    border-radius: 12px !important;
  }
  .panel.is-floating .ph { touch-action: none; cursor: grab; }
  .panel-resize-handle {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, transparent 45%, rgba(0,229,212,0.7) 45%);
  }
  .panel-placeholder { min-height: 48px; flex-wrap: wrap; }
  .panel-redock-btn { min-height: 40px; }
  .apk-setup-screen { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .apk-setup-screen-inner { margin: 0 4px; padding: 14px 12px; }
  .focus-backdrop { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

  .leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; font-size: 18px !important; }
}

@media (max-width: 480px) {
  :root { --toolbar: 100px; }
  .logo-text { display: none; }
  .fplus { display: none; }
  .toolbar-hide-sm { display: none !important; }
  .status-pill #statusText { font-size: 10px; }
  .map-panel .map-wrap { min-height: 58vw; height: 58vw; }
  .ph-count, .audio-live-pill { font-size: 9px; }
  .acc-badge { font-size: 10px; padding: 2px 6px; }
}

@media (max-width: 700px) and (orientation: landscape) {
  .map-panel .map-wrap { min-height: 48vh; height: 48vh; max-height: none; }
  .cam-panel { min-height: 0; }
  .cam-square { max-width: min(42vh, 100%); }
}

/* Desktop: einzeilige Toolbar wenn Platz */
@media (min-width: 1101px) {
  :root { --toolbar: 56px; }
  .toolbar {
    flex-direction: row; flex-wrap: wrap; align-items: center;
    height: var(--toolbar); padding-top: 0; padding-bottom: 0;
  }
  .toolbar-row { display: contents; }
  .toolbar-row-actions {
    border-top: none; padding-top: 0; overflow: visible; flex-wrap: wrap;
  }
  .toolbar-sep-main { display: block; }
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }