* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: #111827;
  background: #f3f4f6;
}

#status-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #0f172a;
  color: #f8fafc;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 16px;
}

.muted { color: #94a3b8; font-weight: 400; font-size: 13px; }

.metrics {
  display: flex;
  gap: 28px;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
}

.metric .label {
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric span:last-child {
  font-size: 16px;
  font-weight: 600;
}

#map {
  position: fixed;
  top: 56px;
  left: 0;
  right: 340px;
  bottom: 0;
}

#side-panel {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 340px;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  overflow-y: auto;
  padding: 16px;
}

.panel-block { margin-bottom: 24px; }

.sim-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sim-btn {
  width: 36px;
  height: 32px;
  background: #0f172a;
  color: #f8fafc;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sim-btn:hover { background: #1e293b; }
.sim-btn.paused { background: #f59e0b; }
.sim-btn.paused:hover { background: #d97706; }

.sim-speed-group {
  display: flex;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.sim-speed-btn {
  background: #fff;
  border: none;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #4b5563;
}

.sim-speed-btn:hover { background: #f3f4f6; }

.sim-speed-btn.active {
  background: #2563eb;
  color: #fff;
}

.sim-speed-btn + .sim-speed-btn { border-left: 1px solid #e5e7eb; }

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

.scenario-btn {
  text-align: left;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: #1f2937;
  line-height: 1.4;
}

.scenario-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.scenario-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.scenario-btn .scenario-meta {
  display: block;
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}
.scenario-btn.active .scenario-meta { color: #dbeafe; }

.scenario-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.scenario-banner strong { display: block; color: #1e40af; }
.scenario-banner .hint { display: block; margin-top: 2px; font-size: 12px; }

.secondary-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #374151;
}
.secondary-btn:hover { background: #f3f4f6; }

.risk-legend {
  margin-top: 12px;
  border-top: 1px solid #f3f4f6;
  padding-top: 8px;
}

.risk-legend-bar {
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(to right, #22c55e 0%, #84cc16 25%, #eab308 50%, #f97316 75%, #dc2626 100%);
}

.risk-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-block h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}

#moveups-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#moveups-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  line-height: 1.5;
}

#moveups-list li:last-child { border-bottom: none; }

#moveups-list li.muted { color: #9ca3af; font-style: italic; }

.moveup-actions { margin-top: 6px; display: flex; gap: 6px; }
.moveup-actions button {
  font-size: 11px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid #d0d7de; cursor: pointer; font-weight: 600;
}
.moveup-actions .btn-accept { background: #e6f4ea; color: #137333; border-color: #cde9d3; }
.moveup-actions .btn-decline { background: #fce8e6; color: #b3261e; border-color: #f4c7c3; }
.moveup-actions .btn-accept:hover { background: #d4ecda; }
.moveup-actions .btn-decline:hover { background: #f5cfca; }

.dash-nav { margin-left: 18px; display: flex; gap: 12px; }
.dash-nav a {
  color: #1a73e8; text-decoration: none; font-size: 12px;
  padding: 4px 8px; border-radius: 4px; background: #eef4fd;
}
.dash-nav a:hover { background: #d8e6fb; }

#zone-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#zone-table th, #zone-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid #f3f4f6;
}

#zone-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6b7280;
  font-weight: 500;
}

#zone-table td:last-child, #zone-table th:last-child {
  text-align: right;
  font-weight: 600;
}

.legend > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
}

.legend .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend .line {
  width: 16px; height: 0;
  border-top: 2px dashed #f59e0b;
  display: inline-block;
}

.unit-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  border: 3px solid #22c55e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.station-marker {
  width: 14px;
  height: 14px;
  background: #1f2937;
  border: 2px solid white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  border-radius: 2px;
  cursor: pointer;
}

.station-marker.vpsd { background: #1e40af; }
.station-marker.scfems { background: #166534; }

.call-marker {
  width: 24px; height: 24px;
  background: #dc2626;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  animation: callPulse 1.6s ease-in-out infinite;
}

.moveup-marker {
  width: 30px;
  height: 30px;
  background: rgba(254, 243, 199, 0.95);   /* amber-50 */
  border: 2px dashed #f59e0b;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #92400e;
  cursor: pointer;
  letter-spacing: 0.2px;
}
.moveup-marker:hover {
  background: #fef3c7;
  transform: scale(1.05);
}

@keyframes callPulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(220, 38, 38, 0.6); }
  50%      { box-shadow: 0 2px 14px rgba(220, 38, 38, 1.0); }
}

/* Buttons */
.primary-btn, .secondary-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.primary-btn {
  background: #1e40af;
  color: white;
  width: 100%;
}
.primary-btn:hover { background: #1e3a8a; }
.primary-btn.active { background: #dc2626; }
.primary-btn.active:hover { background: #b91c1c; }
.secondary-btn {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.secondary-btn:hover { background: #e5e7eb; }

.hint {
  font-size: 12px;
  color: #6b7280;
  margin: 8px 0 0 0;
  line-height: 1.4;
}

.count-badge {
  display: inline-block;
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

#active-calls-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
#active-calls-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  line-height: 1.4;
}
#active-calls-list li:last-child { border-bottom: none; }
#active-calls-list li.muted { color: #9ca3af; font-style: italic; }
.call-tag {
  display: inline-block;
  background: #fee2e2;
  color: #991b1b;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.call-tag.priority-1 { background: #fee2e2; color: #991b1b; }
.call-tag.priority-2 { background: #fef3c7; color: #92400e; }
.call-tag.priority-3 { background: #dbeafe; color: #1e40af; }
.call-tag.priority-4 { background: #f3f4f6; color: #4b5563; }

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: 8px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
}
.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}
.modal-row label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}
.modal-row select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  flex: 1;
  max-width: 220px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.modal-actions .primary-btn { width: auto; }
.modal-result {
  margin-top: 12px;
  padding: 10px;
  border-radius: 4px;
  font-size: 13px;
  display: none;
}
.modal-result.success {
  background: #d1fae5;
  color: #065f46;
  display: block;
}
.modal-result.error {
  background: #fee2e2;
  color: #991b1b;
  display: block;
}

/* Crosshair cursor on map when in place-call mode */
body.place-call-mode #map .maplibregl-canvas { cursor: crosshair !important; }

/* Tab group for Fire / EMS toggle */
.tab-group {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}
.tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-right: 1px solid #d1d5db;
  background: white;
  color: #374151;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: #f9fafb; }
.tab-btn.active {
  background: #1e40af;
  color: white;
}

#loaded-stations-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}
#loaded-stations-list li {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
  font-variant-numeric: tabular-nums;
}
#loaded-stations-list li:last-child { border-bottom: none; }
.station-load-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}
