/* ==========================================================================
   KALYPSO BEHÖRDEN- & LEITSTELLEN-PORTAL (OFFLINE-SYSTEM)
   Bereitgestellt durch JSC-IT GbR (www.jsc-it.de)
   Taktisches Leitstellen-Design für 24/7-Einsatzleitplätze & ELW-Tablets
   ========================================================================== */

:root {
  --bg-primary: #0f141c;
  --bg-secondary: #171f2c;
  --bg-tertiary: #1f2a3a;
  --bg-card: #151d2a;
  --bg-card-hover: #1c2738;
  --border-color: #273549;
  --border-focus: #3b82f6;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b0f17;

  /* BOS Einsatz-Farben */
  --bos-red: #ef4444;
  --bos-red-dark: #b91c1c;
  --bos-red-bg: rgba(239, 68, 68, 0.14);
  --bos-amber: #f59e0b;
  --bos-amber-dark: #b45309;
  --bos-amber-bg: rgba(245, 158, 11, 0.14);
  --bos-green: #10b981;
  --bos-green-dark: #047857;
  --bos-green-bg: rgba(16, 185, 129, 0.14);
  --bos-blue: #3b82f6;
  --bos-blue-dark: #1d4ed8;
  --bos-blue-bg: rgba(59, 130, 246, 0.14);
  --bos-purple: #8b5cf6;
  --bos-purple-bg: rgba(139, 92, 246, 0.14);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.35);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.35);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.35);
}

/* Light Mode Toggle */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   HEADER & TOP STATUS BAR
   ========================================================================== */
.leitstelle-header {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.top-bar-classified {
  background: #7f1d1d;
  color: #fecaca;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.classified-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulse-red 1.6s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.header-main-nav {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-crest {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.brand-meta h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--bos-red);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Status Indicators in Header */
.status-dock {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-badge-active {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
}

.auth-badge-role {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.crypto-seal-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bos-green);
  background: var(--bos-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.offline-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.offline-status-pill.is-offline {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  color: #60a5fa;
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.offline-status-pill.is-offline .offline-dot {
  background: #3b82f6;
  box-shadow: 0 0 6px #3b82f6;
}

.time-clock {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
}

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

/* ==========================================================================
   TABS NAVIGATION
   ========================================================================== */
.leitstelle-tabs {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 2px;
  padding: 0 20px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.tab-btn.active {
  color: var(--bos-blue);
  border-bottom-color: var(--bos-blue);
  background: var(--bg-tertiary);
}

.tab-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bos-red);
  color: white;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.tab-badge.green {
  background: var(--bos-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   LAYOUT CONTAINER
   ========================================================================== */
.leitstelle-container {
  flex: 1;
  padding: 20px;
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   BUTTONS & COMMON UI
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--bos-blue);
  color: white;
}
.btn-primary:hover {
  background: var(--bos-blue-dark);
}

.btn-danger {
  background: var(--bos-red);
  color: white;
}
.btn-danger:hover {
  background: var(--bos-red-dark);
}

.btn-success {
  background: var(--bos-green);
  color: white;
}
.btn-success:hover {
  background: var(--bos-green-dark);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

/* Cards & Panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   1. LOGIN SCREEN (SAME CRYPTOGRAPHY & LOOK AS APP)
   ========================================================================== */
#loginModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 22, 0.94);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.login-banner {
  background: linear-gradient(135deg, #b91c1c, #7f1d1d);
  color: white;
  padding: 24px;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.1);
}

.login-banner h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.login-banner p {
  font-size: 0.85rem;
  opacity: 0.9;
}

.login-body {
  padding: 24px;
}

.auth-method-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.method-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.method-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-control.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.login-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.preset-card-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.preset-card-btn:hover {
  border-color: var(--bos-blue);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.preset-qr-thumb {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: var(--radius-sm);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preset-qr-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preset-info {
  flex: 1;
  min-width: 0;
}

.preset-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-token {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--bos-blue);
  word-break: break-all;
}

/* QR Camera Scanner View */
#qrScannerContainer {
  background: black;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  max-width: 480px;
  margin: 0 auto 16px;
  display: none;
}

#qrVideo {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.qr-target-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 220px;
  border: 3px solid #10b981;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.qr-target-box::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: scan-line 2s infinite ease-in-out;
}

@keyframes scan-line {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 0; }
}

/* ==========================================================================
   2. NOTRUF-ZENTRALE (112 INGRESS & EINSATZLEITSTELLE)
   ========================================================================== */
.dispatch-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
}

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

.sos-inbox-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inbox-toolbar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inbox-counter {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sos-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-right: 4px;
}

/* SOS Incident Card */
.sos-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.sos-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--bos-blue);
  transform: translateY(-1px);
}

.sos-card.active {
  background: var(--bg-card-hover);
  border-color: var(--bos-blue);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
}

/* Priority styling */
.sos-card.prio-1 {
  border-left-color: var(--bos-red);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08), var(--bg-card) 60%);
}
.sos-card.prio-1.new-alert {
  animation: urgent-pulse 1.8s infinite;
}

@keyframes urgent-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sos-card.prio-2 {
  border-left-color: var(--bos-amber);
}
.sos-card.prio-3 {
  border-left-color: var(--bos-blue);
}

.sos-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sos-id-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.sos-prio-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.prio-1 .sos-prio-tag { background: var(--bos-red); color: white; }
.prio-2 .sos-prio-tag { background: var(--bos-amber); color: #0b0f17; }
.prio-3 .sos-prio-tag { background: var(--bos-blue); color: white; }

.sos-type-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sos-location {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.sos-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sos-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 6px;
}

.sos-status-pill {
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.68rem;
}
.status-received { background: var(--bos-red-bg); color: var(--bos-red); border: 1px solid rgba(239, 68, 68, 0.3); }
.status-dispatched { background: var(--bos-amber-bg); color: var(--bos-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.status-enroute { background: var(--bos-blue-bg); color: var(--bos-blue); border: 1px solid rgba(59, 130, 246, 0.3); }
.status-progress { background: var(--bos-purple-bg); color: var(--bos-purple); border: 1px solid rgba(139, 92, 246, 0.3); }
.status-resolved { background: var(--bos-green-bg); color: var(--bos-green); border: 1px solid rgba(16, 185, 129, 0.3); }

/* Detail Panel for Selected Incident */
.dispatch-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.incident-hero {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.incident-hero h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.incident-meta-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.workflow-status-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.workflow-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.workflow-btn:hover {
  border-color: var(--bos-blue);
  color: var(--text-primary);
}

.workflow-btn.active {
  background: var(--bos-blue);
  color: white;
  border-color: var(--bos-blue);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.incident-grid-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.detail-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius-md);
}

.detail-box h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-box p {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Incident Log Timeline */
.incident-timeline {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.timeline-header {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  border-left: 2px solid var(--bos-blue);
  padding-left: 10px;
}

.timeline-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.timeline-desc {
  color: var(--text-primary);
}

/* ==========================================================================
   3. EINSATZTAGEBUCH (CHRONOLOGISCHES PROTOKOLL & AUDIT LOG)
   ========================================================================== */
.protocol-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.bos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.bos-table th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.bos-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.bos-table tr:hover td {
  background: var(--bg-card-hover);
}

/* ==========================================================================
   4. AMTLICHE WARNMELDUNGEN (ECDSA BROADCAST)
   ========================================================================== */
.warn-composer-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(380px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.warn-composer-left-col,
.warn-history-right-col {
  min-width: 0;
}

@media (max-width: 980px) {
  .warn-composer-grid {
    grid-template-columns: 1fr;
  }
}

.char-counter-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}
.char-counter-pill.warn {
  color: var(--bos-amber);
  border-color: var(--bos-amber);
}
.char-counter-pill.error {
  color: var(--bos-red);
  border-color: var(--bos-red);
}

.preview-smartphone {
  background: #000;
  border: 8px solid #222;
  border-radius: 32px;
  padding: 20px;
  max-width: 380px;
  margin: 0 auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  color: white;
}

.preview-alert-card {
  background: #fff;
  color: #111;
  border-radius: 14px;
  padding: 16px;
  border-left: 6px solid var(--bos-red);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.preview-alert-header {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--bos-red);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-alert-body {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 10px;
}

.preview-seal {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   5. NOTFALLUNTERKÜNFTE (SHELTER MANAGEMENT)
   ========================================================================== */
.shelter-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.shelter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s ease;
}

.shelter-card:hover {
  border-color: var(--bos-blue);
  transform: translateY(-2px);
}

.shelter-capacity-bar {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}

.shelter-capacity-fill {
  height: 100%;
  background: var(--bos-green);
  transition: width 0.3s ease;
}
.shelter-capacity-fill.high {
  background: var(--bos-amber);
}
.shelter-capacity-fill.full {
  background: var(--bos-red);
}

.shelter-amenities {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.amenity-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* ==========================================================================
   6. TAKTISCHE LAGEKARTE (100% OFFLINE VECTOR GIS ENGINE)
   ========================================================================== */
.tactical-map-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  height: 720px;
}

@media (max-width: 1024px) {
  .tactical-map-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.map-viewport-wrapper {
  background: #0a0f16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.map-toolbar-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 20, 28, 0.88);
  backdrop-filter: blur(6px);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.map-title-short {
  display: none;
}
.map-title-full {
  display: inline;
}

.map-layer-toggles {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  gap: 6px;
  background: rgba(15, 20, 28, 0.88);
  backdrop-filter: blur(6px);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.map-svg-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  user-select: none;
}
.map-svg-canvas:active {
  cursor: grabbing;
}

.map-sidebar-poi {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 720px;
  overflow-y: auto;
}

/* ==========================================================================
   7. KRISEN-CHECKLISTEN & LORA-MASTEN MONITOR
   ========================================================================== */
.checklist-item-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: all 0.2s;
}

.checklist-item-row.completed {
  opacity: 0.65;
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.3);
}

.checklist-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--bos-green);
  cursor: pointer;
  margin-top: 3px;
}

.mast-monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.mast-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.mast-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex !important;
}

.demo-read-only-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-read-only-banner strong {
  color: #fde68a;
}

.btn-readonly-locked {
  opacity: 0.65;
  cursor: not-allowed;
  position: relative;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   OFFICIAL PRINT STYLESHEET (BOS EINSATZPROTOKOLL / DIN NACHWEIS)
   ========================================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .leitstelle-header,
  .leitstelle-tabs,
  .protocol-toolbar,
  .btn,
  .modal-overlay {
    display: none !important;
  }
  .leitstelle-container {
    padding: 0 !important;
    max-width: 100% !important;
  }
  #tabPaneProtokoll {
    display: block !important;
  }
  .table-responsive {
    border: none !important;
  }
  .bos-table th,
  .bos-table td {
    color: black !important;
    border-color: #444 !important;
  }
  .print-only-header {
    display: block !important;
    margin-bottom: 20px;
    border-bottom: 2px solid black;
    padding-bottom: 10px;
  }
}

.print-only-header {
  display: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--bos-blue);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 0.88rem;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.success { border-left-color: var(--bos-green); }
.toast.danger { border-left-color: var(--bos-red); }
.toast.warn { border-left-color: var(--bos-amber); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Demo Mode Banner */
.demo-mode-banner {
  background: linear-gradient(90deg, #b45309, #d97706, #b45309);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.demo-mode-banner.hidden {
  display: none !important;
}

/* Radar Target Pulse on Map */
.radar-target-pulse {
  animation: radar-wave 1.6s infinite ease-out;
  transform-origin: center;
}

@keyframes radar-wave {
  0% { transform: scale(0.6); opacity: 1; stroke-width: 4px; }
  100% { transform: scale(2.8); opacity: 0; stroke-width: 1px; }
}

/* Unit Selection Grid in Dispatch Modal */
.unit-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.unit-group-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.unit-group-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.unit-check-label input {
  accent-color: var(--bos-blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ==========================================================================
   15. OPENSTREETMAP LEAFLET STYLING & BOS MARKERS
   ========================================================================== */
.osm-map-container {
  width: 100%;
  height: 100%;
  min-height: 680px;
  background: #0b0f17;
  border-radius: var(--radius-lg);
  overflow: hidden;
  z-index: 1;
}

/* Custom BOS DivIcon styling */
.bos-map-marker {
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}
.bos-map-marker:hover {
  transform: scale(1.25);
  z-index: 9999 !important;
}

.bos-marker-sos {
  background: #ef4444;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
  animation: markerPulse 1.4s infinite;
}
.bos-marker-shelter {
  background: #10b981;
  border-radius: 6px;
}
.bos-marker-fire {
  background: #dc2626;
}
.bos-marker-thw {
  background: #2563eb;
}
.bos-marker-rescue {
  background: #059669;
}
.bos-marker-hospital {
  background: #9333ea;
}
.bos-marker-mast {
  background: #0891b2;
}
.bos-marker-hq {
  background: linear-gradient(135deg, #f59e0b, #b45309) !important;
  border: 2px solid #fef08a !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.8) !important;
  animation: hqPulse 2s infinite !important;
}

@keyframes hqPulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); }
  70% { box-shadow: 0 0 0 16px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.tactical-route-hud {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid #38bdf8;
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 90%;
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-family: sans-serif;
  animation: slideUpHud 0.3s ease-out;
}

@keyframes slideUpHud {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes markerPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Leaflet Dark BOS Popups */
.leaflet-popup-content-wrapper {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}
.leaflet-popup-tip {
  background: #0f172a !important;
  border: 1px solid #334155;
}
.leaflet-container a.leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding: 8px 8px 0 0 !important;
}
.leaflet-container a.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}

/* Empty Inbox State */
.sos-empty-state {
  text-align: center;
  padding: 48px 24px;
  background: rgba(15, 23, 42, 0.5);
  border: 2px dashed rgba(51, 65, 85, 0.7);
  border-radius: var(--radius-lg);
  margin: 12px 0;
}
.sos-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

/* ==========================================================================
   16. COMPREHENSIVE RESPONSIVE DESIGN (SMARTPHONES, TABLETS & ELW MONITORS)
   ========================================================================== */

/* Universal Touch & Mobile Ergonomics */
button, input, select, textarea, .tab-btn, .workflow-btn, .chip, .sos-card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.table-responsive,
.sos-cards-list,
.timeline-items,
.modal-dialog,
.leitstelle-tabs,
.map-sidebar-poi {
  -webkit-overflow-scrolling: touch;
}

/* Default Desktop/Wide Screen Setup for Mobile Elements */
.tab-label-short {
  display: none;
}
.tab-label-full {
  display: inline;
}
.mobile-header-quick-bar {
  display: none;
}
.mobile-sos-view-switch {
  display: none;
}
.mobile-back-to-list-btn {
  display: none;
}

/* --- TABLETS & LAPTOPS (<= 1024px) --- */
@media (max-width: 1024px) {
  .leitstelle-container {
    padding: 14px 12px;
  }

  .tab-label-full {
    display: none;
  }
  .tab-label-short {
    display: inline;
  }

  .warn-composer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .preview-smartphone {
    max-width: 440px;
  }

  .shelter-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }

  .tactical-map-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 16px;
  }

  .osm-map-container {
    min-height: 440px;
    height: 52vh;
  }

  .map-sidebar-poi {
    height: auto;
    max-height: 360px;
  }

  .mast-monitor-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* --- TABLETS & SMARTPHONES (<= 900px) --- MASTER-DETAIL NOTRUFZENTRALE */
@media (max-width: 900px) {
  /* Master-Detail View Switcher for Tab 1 */
  .mobile-sos-view-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
  }

  .mobile-view-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
  }

  .mobile-view-btn.active {
    background: var(--bos-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  }

  .mobile-back-to-list-btn {
    display: inline-flex !important;
    margin-bottom: 14px;
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
  }
  .mobile-back-to-list-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--bos-blue);
  }

  .dispatch-grid {
    display: block !important;
  }

  /* Default on mobile: Show list, hide details until a card is tapped */
  .dispatch-grid .sos-inbox-column {
    display: flex;
    width: 100%;
  }
  .dispatch-grid .dispatch-detail-panel {
    display: none;
    width: 100%;
  }

  /* When showing detail view on mobile */
  .dispatch-grid.mobile-show-detail .sos-inbox-column {
    display: none !important;
  }
  .dispatch-grid.mobile-show-detail .dispatch-detail-panel {
    display: block !important;
  }

  /* When showing list view on mobile */
  .dispatch-grid.mobile-show-list .sos-inbox-column {
    display: flex !important;
  }
  .dispatch-grid.mobile-show-list .dispatch-detail-panel {
    display: none !important;
  }

  .sos-cards-list {
    max-height: calc(100vh - 240px) !important;
  }
}

/* --- SMARTPHONES & SMALL TABLETS PORTRAIT (<= 768px) --- */
@media (max-width: 768px) {
  /* 1. Slim Top Bar & Classified Notice */
  .top-bar-classified {
    display: none; /* Hide classified banner on mobile to save vertical space */
  }

  .demo-mode-banner {
    padding: 6px 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .demo-banner-desc {
    display: none; /* Hide verbose demo explanation on small screens */
  }

  .demo-mode-banner > div:first-child strong {
    font-size: 0.76rem;
  }

  .demo-mode-banner > div:last-child {
    display: flex;
    gap: 4px;
  }

  /* 2. Compact 1-Row Header with Mobile Quick Controls */
  .header-main-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 6px 10px !important;
    gap: 0 !important;
  }

  .header-brand-row {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-height: 40px !important;
  }

  .brand-section {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .brand-crest {
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
  }

  .brand-meta {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .brand-meta h1 {
    font-size: clamp(0.78rem, 3.8vw, 1.05rem) !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 0 !important;
  }

  .brand-badge {
    font-size: 0.55rem !important;
    padding: 1px 4px !important;
    letter-spacing: 0.04em !important;
    flex-shrink: 0 !important;
  }

  .brand-subtitle {
    display: none !important; /* Hide subtitle to preserve clean 1-row header */
  }

  .mobile-header-quick-bar {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }

  .mobile-header-quick-bar .btn {
    padding: 5px 9px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-header-quick-bar .btn.active {
    background: var(--bos-red) !important;
    color: white !important;
    border-color: var(--bos-red) !important;
  }

  /* Status Dock collapses cleanly below the brand bar as a full-width drawer card */
  .status-dock {
    display: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 8px !important;
    padding: 12px !important;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    flex-direction: column !important;
    gap: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  }

  .status-dock.open {
    display: flex !important;
    animation: slideDownMenu 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  @keyframes slideDownMenu {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .auth-badge-active {
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: space-between !important;
    padding: 6px 10px !important;
  }

  .offline-status-pill {
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    padding: 6px 10px !important;
  }

  .time-clock {
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
    padding: 6px 10px !important;
  }

  .header-actions {
    width: 100% !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .header-actions .btn {
    width: 100% !important;
    padding: 9px 8px !important;
    font-size: 0.8rem !important;
    justify-content: center !important;
  }

  /* 3. Sleek Non-Disappearing 2-Row / Adaptive Tab Navigation */
  .leitstelle-tabs-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
  }

  .leitstelle-tabs-wrapper::after {
    display: none !important;
  }

  .leitstelle-tabs {
    padding: 4px 6px;
    gap: 4px;
    scrollbar-width: none;
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }

  .leitstelle-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 1 1 calc(25% - 4px); /* Row 1 gets 4 tabs, Row 2 gets 3 tabs */
    min-width: 65px;
    padding: 6px 4px;
    font-size: 0.72rem;
    font-weight: 700;
    min-height: 36px;
    gap: 3px;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
  }

  .tab-btn.active {
    background: var(--bos-blue) !important;
    color: white !important;
    border-color: var(--bos-blue) !important;
  }

  .tab-btn:hover {
    background: var(--bg-elevated);
  }

  .tab-badge {
    font-size: 0.65rem;
    padding: 1px 5px;
    min-width: 15px;
  }

  /* 4. Container & Cards */
  .leitstelle-container {
    padding: 10px 8px;
  }

  .card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-title {
    font-size: 0.98rem;
  }

  /* 5. Tab 1: Notrufzentrale */
  .inbox-toolbar {
    padding: 8px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .inbox-toolbar > div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }

  .inbox-toolbar > div:last-child .btn {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
  }

  .sos-cards-list {
    gap: 8px;
  }

  .sos-card {
    padding: 12px;
  }

  .sos-type-title {
    font-size: 0.95rem;
  }

  .sos-location {
    font-size: 0.8rem;
  }

  .sos-snippet {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .dispatch-detail-panel {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }

  .incident-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .incident-hero h2 {
    font-size: 1.18rem;
  }

  .incident-hero > div:last-child {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .incident-hero > div:last-child .btn {
    flex: 1;
    justify-content: center;
    padding: 9px 8px;
  }

  .workflow-status-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .workflow-btn {
    padding: 10px 8px;
    font-size: 0.8rem;
    justify-content: center;
    white-space: nowrap;
  }

  .workflow-btn:last-child {
    grid-column: span 2;
  }

  .incident-grid-details {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .detail-box {
    padding: 12px;
  }

  .detail-box h4 {
    font-size: 0.74rem;
  }

  .detail-box p {
    font-size: 0.88rem;
  }

  .timeline-items {
    max-height: 200px;
  }

  /* 6. Tab 2: Protokoll */
  .protocol-toolbar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .protocol-toolbar .btn {
    width: 100%;
    justify-content: center;
    padding: 9px;
  }

  .bos-table {
    min-width: 620px;
    font-size: 0.8rem;
  }

  .bos-table th, .bos-table td {
    padding: 8px 10px;
  }

  /* 7. Tab 3: Warnmeldungen */
  #warnComposerForm > div:last-child {
    flex-direction: column;
    gap: 8px;
  }

  #warnComposerForm > div:last-child .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  #composerBridgeStatus {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  #composerBridgeStatus button {
    width: 100%;
    justify-content: center;
  }

  .preview-smartphone {
    max-width: 100%;
    width: 100%;
    border-width: 4px;
    border-radius: 16px;
    padding: 10px;
  }

  .preview-alert-card {
    padding: 12px;
  }

  .preview-alert-header {
    font-size: 0.75rem;
  }

  .preview-alert-body {
    font-size: 0.85rem;
  }

  /* 8. Tab 4: Notfallunterkünfte */
  .shelter-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .shelter-card {
    padding: 12px;
  }

  /* 9. Tab 5: Lagekarte */
  .tactical-map-layout {
    gap: 10px;
  }

  .osm-map-container {
    min-height: 320px;
    height: 48vh;
    border-radius: var(--radius-md);
  }

  .map-title-full {
    display: none !important;
  }

  .map-title-short {
    display: inline !important;
  }

  .map-toolbar-overlay {
    top: 6px;
    left: 6px;
    right: auto;
    max-width: calc(100% - 12px);
    gap: 4px;
    padding: 4px;
    flex-wrap: wrap;
  }

  .map-toolbar-overlay .btn {
    padding: 4px 7px;
    font-size: 0.72rem;
  }

  .map-layer-toggles {
    bottom: 6px;
    left: 6px;
    right: 6px;
    gap: 3px;
    padding: 4px;
    justify-content: center;
  }

  .map-layer-toggles .btn {
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  .map-sidebar-poi {
    height: auto;
    max-height: 280px;
    padding: 12px 10px;
    border-radius: var(--radius-md);
  }

  /* 10. Tab 6: LoRa-Masten */
  .mast-monitor-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mast-card {
    padding: 12px;
  }

  /* 11. Modals & Dialogs */
  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }

  .modal-dialog {
    max-width: 100%;
    width: 100%;
    max-height: 94vh;
    margin: 0;
    border-radius: 14px 14px 0 0;
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-header h3 {
    font-size: 0.98rem !important;
  }

  .modal-body {
    padding: 14px 12px;
  }

  .modal-footer {
    padding: 12px 14px;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 0.88rem;
  }

  /* 12. Login Screen */
  #loginModalOverlay {
    padding: 8px;
  }

  .login-card {
    border-radius: 12px;
  }

  .login-banner {
    padding: 16px 12px;
  }

  .login-banner h2 {
    font-size: 1.15rem;
  }

  .login-banner p {
    font-size: 0.8rem;
  }

  .login-body {
    padding: 14px 10px;
  }

  .demo-login-box {
    padding: 12px !important;
  }

  #selectDemoRole {
    max-width: 100% !important;
    width: 100% !important;
    margin-bottom: 8px;
  }

  #btnStartDemoLogin {
    width: 100% !important;
    justify-content: center;
  }

  /* 13. Toast Notifications - positioned safely at bottom on mobile */
  .toast-container {
    top: auto;
    bottom: 16px;
    left: 8px;
    right: 8px;
  }

  .toast {
    max-width: 100%;
    font-size: 0.82rem;
    padding: 10px 14px;
  }
}

/* --- COMPACT SMARTPHONES (<= 480px) --- */
@media (max-width: 480px) {
  /* Prevent iOS zoom on inputs */
  input, select, textarea {
    font-size: 16px !important;
  }

  .time-clock {
    display: none;
  }

  .sos-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ==========================================================================
   SAR-RADAR & NOT-PEILSIGNAL STYLES (SEARCH & RESCUE)
   ========================================================================== */
.sar-peil-banner {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 2px solid #ef4444;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.15);
  animation: sarPulse 1.4s infinite alternate;
}

@keyframes sarPulse {
  0% {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 35px rgba(239, 68, 68, 0.85);
    transform: scale(1.006);
  }
}

@keyframes radarPing {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 1; filter: drop-shadow(0 0 8px #facc15); }
}

.sar-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.sar-stat-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
  transition: transform 0.15s ease;
}

.sar-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.sar-stat-val {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
}

.sar-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.sar-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding: 16px 0;
}

.sar-node-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.sar-node-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card);
}

.sar-node-card.is-sos {
  border-color: var(--bos-red);
  background: rgba(239, 68, 68, 0.06);
}

.sar-node-card.is-active-peil {
  border-color: #facc15;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
}

.sar-node-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.sar-node-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.sar-node-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sar-node-badge.sos {
  background: var(--bos-red-bg);
  color: var(--bos-red);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.sar-node-badge.peer {
  background: var(--bos-blue-bg);
  color: var(--bos-blue);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.sar-node-badge.tablet {
  background: var(--bos-purple-bg);
  color: var(--bos-purple);
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.sar-node-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.sar-proximity-label {
  font-weight: 700;
  color: var(--text-primary);
}

.sar-signal-bars {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 1px;
}

.sar-node-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.sar-node-actions button {
  flex: 1;
  font-size: 0.8rem;
  padding: 6px 10px;
  font-weight: 700;
}

/* --- SAR TACTICAL FOCUS PANEL --- */
.sar-focus-panel {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 2px solid var(--bos-blue);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(59, 130, 246, 0.25);
  animation: fadeIn 0.25s ease-out;
}

.sar-focus-panel.is-sos-focus {
  border-color: var(--bos-red);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(239, 68, 68, 0.35);
}

.sar-focus-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.sar-focus-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sar-focus-details-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.sar-focus-meter-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.sar-focus-rssi-val {
  font-size: 1.6rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-primary);
  min-width: 95px;
}

.sar-focus-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sar-focus-bar {
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}

.sar-focus-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.3s ease, background 0.3s ease;
}

.sar-focus-dist {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  min-width: 130px;
}

.sar-focus-trend {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: right;
}

.sar-focus-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- CATEGORY HEADERS --- */
.sar-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  margin-bottom: 12px;
  border-left: 5px solid;
}

.sar-category-header.is-sos-cat {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--bos-red);
  color: var(--bos-red);
}

.sar-category-header.is-kalypso-cat {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--bos-blue);
  color: #60a5fa;
}

.sar-category-header.is-other-cat {
  background: rgba(100, 116, 139, 0.12);
  border-color: #64748b;
  color: #94a3b8;
}

.sar-category-title {
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sar-category-sub {
  font-size: 0.76rem;
  opacity: 0.85;
  margin-top: 2px;
}

/* --- CARD VARIATIONS --- */
.sar-node-card.is-focused {
  border-color: var(--bos-blue) !important;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}

.sar-node-card.is-sos.is-focused {
  border-color: var(--bos-red) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45);
}

.sar-node-card.is-other {
  border-left-color: #64748b;
  opacity: 0.9;
}

.sar-radar-map-card {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

@keyframes radarHaloPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.3; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-xs {
  padding: 3px 8px !important;
  font-size: 0.72rem !important;
  line-height: 1.3 !important;
  border-radius: var(--radius-sm) !important;
}

.btn-station-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.btn-station-preset:hover {
  background: var(--bos-blue);
  color: #fff;
  border-color: var(--bos-blue);
}


