:root {
  --bg-primary: #0a0e17;
  --bg-surface: #121826;
  --bg-card: #182234;
  --bg-glass: rgba(18, 24, 38, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #0284c7;

  --accent-cyan: #06b6d4;
  --accent-blue: #0284c7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
header.dispatcher-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-badge {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-user-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Toasts */
#toast-container {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.2s ease-out;
}

.toast.toast-error { background: #261114; border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }
.toast.toast-success { background: #0c261c; border: 1px solid rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.toast.toast-info { background: #0e1e38; border: 1px solid rgba(6, 182, 212, 0.4); color: #a5f3fc; }

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

/* Guest Intro Banner */
.guest-intro-banner-dispatcher {
  max-width: 1700px;
  width: 100%;
  margin: 16px auto 0;
  padding: 0 24px;
}

.guest-intro-dispatcher-inner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(24, 34, 52, 0.95) 0%, rgba(18, 24, 38, 0.98) 100%);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 20px rgba(6, 182, 212, 0.08);
  animation: slideInDown 0.3s ease-out;
}

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

.guest-intro-dispatcher-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.guest-intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
}

.guest-intro-badge-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: badgePulse 2s infinite ease-in-out;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.6;
  }
}

.guest-intro-p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.guest-intro-p strong {
  color: #fff;
  font-weight: 700;
}

/* Layout Grid */
.dashboard-container {
  display: grid;
  grid-template-columns: 340px 1fr 380px;
  gap: 20px;
  padding: 20px 24px;
  flex: 1;
  max-width: 1700px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 1200px) {
  .dashboard-container {
    grid-template-columns: 300px 1fr;
  }
  .telemetry-column {
    grid-column: 1 / -1;
  }
}

@media (max-width: 800px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
}

/* Cards & Columns */
.panel-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

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

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Lists & Items */
.interactive-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.interactive-item:hover {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(18, 24, 38, 0.95);
}

.interactive-item.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-owner { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-dispatcher { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.4); }
.badge-member { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.3); }

/* Buttons & Inputs */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.input-control {
  background: rgba(10, 14, 23, 0.8);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: 100%;
}

.input-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Waypoint Editor Row */
.wp-row {
  display: grid;
  grid-template-columns: 36px 1fr 120px 120px 100px;
  gap: 8px;
  align-items: center;
  background: var(--bg-card);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.wp-char-counter {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 2px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

/* Radar & Telemetry Card */
.telemetry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
