/* ---===[ Google Fonts & Root Variables (EchoAlert-style) ]===--- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* Component stylesheets */
@import url('./components/index.css');

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

:root {
  /* Light Theme Palette */
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef2f7;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --border-color: #e2e8f0;
  --accent-primary: #3b82f6;
  --accent-primary-darker: #2563eb;
  --accent-primary-text: #ffffff;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --danger-border: #fecaca;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;
  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --success-bg: #f0fdf4;
  --success-text: #14532d;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);

  /* Spacing + motion tokens (used across layout/components) */
  --spacing-2xs: 0.125rem;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.75rem;
  --spacing-lg: 1rem;
  --spacing-xl: 1.5rem;
  --spacing-2xl: 2rem;
  --transition-fast: 150ms ease;
  --transition: 250ms ease;

  /* CAD: square edges by default */
  --radius: 0px;

  /* Derived / app-specific */
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active: rgba(0, 0, 0, 0.08);
  --text-muted: var(--text-tertiary);
  --border-light: var(--border-color);
  --text-on-accent: var(--accent-primary-text);

  /* Priority Colors */
  --priority-1: #dc2626;
  --priority-2: #d97706;
  --priority-3: #2563eb;
  --priority-4: #6b7280;
}

body.dark {
  /* Dark Theme Palette */
  /* True black / very dark like classic CAD */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #151515;
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --border-color: #222222;
  --accent-primary: #60a5fa;
  --accent-primary-darker: #3b82f6;
  --accent-primary-text: #1f2937;
  --danger-bg: #3f2222;
  --danger-text: #fca5a5;
  --danger-border: #b91c1c;
  --warning-bg: #4a2c0d;
  --warning-text: #fcd34d;
  --info-bg: #1e293b;
  --info-text: #60a5fa;
  --success-bg: #14532d;
  --success-text: #a7f3d0;

  /* Derived / app-specific */
  --bg-hover: #1a1a1a;
  --bg-active: #222222;
  --text-muted: var(--text-tertiary);
  --border-light: var(--border-color);
  --text-on-accent: var(--accent-primary-text);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* Google Places Autocomplete (dark theme) */
.pac-container {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 0 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.6) !important;
  overflow: hidden !important;
  /* Must be above modal overlay (dashboard modal uses z-index: 10000) */
  z-index: 20001 !important;
}

.pac-item {
  background: transparent !important;
  color: var(--text-primary) !important;
  border-top: 1px solid var(--border-color) !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
}

.pac-item:first-child {
  border-top: none !important;
}

.pac-item:hover,
.pac-item-selected {
  background: var(--bg-hover) !important;
}

.pac-item .pac-icon {
  filter: invert(1) !important;
  opacity: 0.8 !important;
}

.pac-item-query {
  color: var(--text-primary) !important;
}

.pac-matched {
  color: var(--text-primary) !important;
  font-weight: 700 !important;
}

.pac-logo:after {
  /* keep powered-by logo visible on dark bg */
  filter: invert(1) !important;
  opacity: 0.85 !important;
}

/* Google Maps POI Info Window Styling - Dark theme to match units/calls */

/* Target ALL info window elements and make them dark */
.gm-style .gm-style-iw,
.gm-style .gm-style-iw-c,
.gm-style .gm-style-iw-d,
.gm-style .gm-style-iw-chr,
.gm-style .gm-style-iw-ch {
  background: #1a1a1a !important;
  background-color: #1a1a1a !important;
}

/* The title and all text elements */
.gm-style .gm-title,
.gm-style .gm-title.gm-full-width,
.gm-style .transit-container,
.gm-style .transit-container * {
  color: #fff !important;
  background: transparent !important;
  background-color: transparent !important;
}

/* Grey X button */
.gm-style .gm-ui-hover-effect span {
  background-color: #9ca3af !important;
}

/* POI specific content */
.gm-style .poi-info-window,
.gm-style .poi-info-window * {
  background: #1a1a1a !important;
  background-color: #1a1a1a !important;
}

.gm-style .poi-info-window .gm-title,
.gm-style .poi-info-window .transit-container {
  background: transparent !important;
}

.gm-style .address,
.gm-style .address-line,
.gm-style .address-line.full-width {
  color: #d1d5db !important;
  background: transparent !important;
}

.gm-style .view-link,
.gm-style .view-link a,
.gm-style .view-link span {
  color: #60a5fa !important;
  background: transparent !important;
}

/* Arrow pointer */
.gm-style .gm-style-iw-tc::after,
.gm-style .gm-style-iw-t::after {
  background: #1a1a1a !important;
}

/* Layout */
.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.25rem 0.5rem; /* small padding around logo */
  min-height: 40px;
}

.brand-logo img {
  height: 28px;
  width: auto;
  display: block;
}

.brand-text {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}

/* If logo image fails, keep the CAD name readable */
.brand-logo.brand-logo-fallback {
  gap: 0.5rem;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 50px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-md);
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.topbar-new-call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--accent-color);
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.1s ease;
}

.topbar-new-call-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.topbar-new-call-btn .material-symbols-outlined {
  font-size: 20px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Agency Filter Dropdown */
.topbar-agency-filter {
  position: relative;
}
.agency-filter-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.agency-filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.agency-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  max-height: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  overflow: hidden;
}
.agency-filter-header {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}
.agency-filter-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
}
.agency-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.agency-filter-option:hover {
  background: var(--bg-hover);
}
.agency-filter-option input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.topbar-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

.topbar-link:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-link.active {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.75rem;
}

.user-name-sm {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.logout-link {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.875rem;
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-left: var(--spacing-sm);
  border-left: 1px solid var(--border-color);
}

.logout-link:hover {
  color: #ef4444;
}

.settings-link {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.25rem;
  transition: color 0.15s ease;
}

.settings-link:hover {
  color: var(--text-primary);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
}

/* Buttons */
.btn-primary {
  padding: var(--spacing-sm) var(--spacing-lg);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* Small action button (used in topbar + SSE refresh indicator) */
.btn-action {
  padding: 0.35rem 0.6rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.8125rem;
}

.btn-action:hover {
  background-color: var(--bg-hover);
}

.btn-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Form controls (including textareas like Initial Call Data) */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-primary);
}

/* Force square edges in CAD */
.cad-panel,
.modal-content,
.modal-header,
.modal-body,
.unit-tag,
.unit-selector,
.unit-autocomplete-results,
.call-type-autocomplete-results {
  border-radius: 0 !important;
}

.emd-modal-prompt {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.emd-modal-prompt-btn {
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 3px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.emd-modal-prompt-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
}

.btn-primary:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
}

/* Tables */
.table-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.table th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

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

.table tbody tr:hover {
  background-color: var(--bg-hover);
}

/* Badges */
.priority-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--spacing-xs);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.priority-badge.priority-1 {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.priority-badge.priority-2 {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.priority-badge.priority-3 {
  background-color: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.status-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--spacing-xs);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.status-active {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.status-badge.status-closed {
  background-color: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

.status-badge.status-dispatched {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.status-badge.status-enroute {
  background-color: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.status-badge.status-onscene {
  background-color: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

/* Quick Status Buttons (A/B/O) - Subtle, non-distracting */
.status-buttons {
  display: inline-flex;
  gap: 2px;
}

.status-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

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

.status-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-secondary);
  font-weight: 700;
}

/* Compact unit table layout */
.units-table .unit-row-main td {
  padding: 0.35rem 0.5rem;
  vertical-align: middle;
}

.units-table .unit-info-secondary {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.units-table .unit-info-secondary .info-item {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.units-table .unit-info-secondary .info-label {
  color: var(--text-tertiary);
}

.units-table .unit-info-secondary .info-value {
  color: var(--text-secondary);
}

/* Dashboard styles */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--spacing-md);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-filters {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ============================================
   Unit Sensor Data Indicators
   ============================================ */

.unit-sensors {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.5rem;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

/* Sensor row below unit name (incident view units list) */
.unit-sensors-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.unit-sensors-row:empty {
  display: none;
}

/* Sensor row in unit table (second row per unit) */
.unit-row-sensors {
  background: var(--bg-tertiary) !important;
}

.unit-row-sensors:hover {
  background: var(--bg-tertiary) !important;
}

.unit-row-main + .unit-row-sensors {
  border-top: none;
}

/* Inline sensors next to unit name */
.unit-cell-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.unit-cell-content .unit-name {
  font-size: 0.85rem;
}

.unit-sensors-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex: 1;
}

.unit-sensors-inline:empty {
  display: none;
}

.unit-sensors-inline .unit-sensors {
  gap: 0.5rem;
  margin: 0 auto;
}

/* Secondary row (JD/Notes/Post) - only shown if has content */
.unit-row-secondary {
  background: var(--bg-tertiary) !important;
}

.unit-row-secondary:hover {
  background: var(--bg-tertiary) !important;
}

.unit-row-main + .unit-row-secondary {
  border-top: none;
}

.unit-row-main.no-secondary td {
  border-bottom: 1px solid var(--border-color) !important;
}

.unit-row-main:not(.no-secondary) td {
  border-bottom: none !important;
}

.unit-secondary-cell {
  padding: 0.15rem 0.5rem 0.25rem 0.5rem !important;
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.unit-secondary-cell .info-item {
  display: inline-flex;
  gap: 0.2rem;
}

.unit-secondary-cell .info-label {
  color: var(--text-tertiary);
}

/* Add unit input in incident view */
.add-unit-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0;
}

.add-unit-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.unit-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0 0 0.375rem 0.375rem;
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.unit-autocomplete-list {
  padding: 0.25rem 0;
}

.unit-autocomplete-empty {
  padding: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.unit-autocomplete-item {
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.unit-autocomplete-item:last-child {
  border-bottom: none;
}

.unit-autocomplete-item:hover {
  background: var(--bg-hover);
}

.unit-autocomplete-item .unit-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.unit-autocomplete-item .unit-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.unit-autocomplete-item .unit-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.125rem;
}

.unit-autocomplete-item .unit-info .unit-name {
  flex: none;
}

.unit-autocomplete-item .unit-dept {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.unit-autocomplete-item .unit-status-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

.unit-autocomplete-item .unit-status-badge.avail {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.unit-autocomplete-item .unit-status-badge.busy {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.unit-autocomplete-actions {
  padding: 0.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.add-units-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.add-units-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.add-units-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sensor-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Battery indicator - readable size */
.sensor-battery {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sensor-battery .battery-body {
  width: 16px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  position: relative;
  display: flex;
  align-items: center;
  padding: 1px;
}

.sensor-battery .battery-tip {
  position: absolute;
  right: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 4px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}

.sensor-battery .battery-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Battery levels: 3=Green (25%+), 2=Yellow (10-24%), 1=Red (<10%) */
/* Width is set dynamically via inline style based on actual percentage */
.sensor-battery.level-3 { color: #22c55e; }
.sensor-battery.level-3 .battery-fill { background: #22c55e; }
.sensor-battery.level-2 { color: #eab308; }
.sensor-battery.level-2 .battery-fill { background: #eab308; }
.sensor-battery.level-1 { color: #ef4444; }
.sensor-battery.level-1 .battery-fill { background: #ef4444; }

/* Signal indicator (bars) - compact size */
.sensor-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
  height: 10px;
}

.sensor-signal .bar {
  width: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  opacity: 0.3;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.sensor-signal .bar:nth-child(1) { height: 3px; }
.sensor-signal .bar:nth-child(2) { height: 5px; }
.sensor-signal .bar:nth-child(3) { height: 6px; }
.sensor-signal .bar:nth-child(4) { height: 8px; }
.sensor-signal .bar:nth-child(5) { height: 10px; }

.sensor-signal.level-1 .bar:nth-child(1) { opacity: 1; background: #ef4444; }
.sensor-signal.level-2 .bar:nth-child(1),
.sensor-signal.level-2 .bar:nth-child(2) { opacity: 1; background: #f97316; }
.sensor-signal.level-3 .bar:nth-child(1),
.sensor-signal.level-3 .bar:nth-child(2),
.sensor-signal.level-3 .bar:nth-child(3) { opacity: 1; background: #eab308; }
.sensor-signal.level-4 .bar:nth-child(1),
.sensor-signal.level-4 .bar:nth-child(2),
.sensor-signal.level-4 .bar:nth-child(3),
.sensor-signal.level-4 .bar:nth-child(4) { opacity: 1; background: #84cc16; }
.sensor-signal.level-5 .bar { opacity: 1; background: #22c55e; }

/* No sensor data message */
.sensor-no-data {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.7;
}

/* Radio offline indicator - subtle, non-attention-grabbing */
.radio-offline {
  font-size: 0.65rem;
  color: var(--text-muted, #6b7280);
  font-weight: 500;
  opacity: 0.8;
  white-space: nowrap;
}

/* Radio online/offline dot indicator */
.radio-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.radio-dot.online {
  background-color: #22c55e; /* green */
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}
.radio-dot.offline {
  background-color: #ef4444; /* red */
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

/* Smooth transitions for sensor updates - no flashing */
.unit-sensors,
[data-sensor-battery],
[data-sensor-signal],
[data-sensor-speed] {
  transition: opacity 0.3s ease;
}

/* Add space between battery and signal */
.sensor-battery {
  margin-right: 0.25rem;
}

/* GPS indicator - compact size with external SVG */
.sensor-gps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}

.sensor-gps img {
  width: 14px;
  height: 14px;
}

.sensor-gps.no-data {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Speed indicator next to GPS */
.sensor-speed {
  font-size: 0.6rem;
  font-weight: 600;
  color: #3b82f6;
  white-space: nowrap;
}

/* Speed value in column (dashboard units table) */
.sensor-speed-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: #3b82f6;
}

/* Sensor cells in units table */
.sensor-cell {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0.25rem !important;
}

/* Unit distance/ETA display */
.unit-distance {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.unit-distance .distance-value {
  font-weight: 600;
  color: var(--text-primary);
}

.unit-distance .eta-value {
  color: #3b82f6;
  font-weight: 500;
}

.unit-distance .separator {
  color: var(--text-muted);
}

/* Sensor rows are hidden when empty (no sensor data) */

/* Map unit markers */
.unit-marker {
  background: #3b82f6;
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.unit-marker.enroute {
  background: #8b5cf6;
}

.unit-marker.on-scene {
  background: #22c55e;
}

.unit-marker.closest {
  background: #6b7280;
  cursor: pointer;
}

.unit-marker.closest:hover {
  background: #4b5563;
}

/* Assign unit button on map */
.assign-unit-btn {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 0.25rem;
}

.assign-unit-btn:hover {
  background: #2563eb;
}

/* ============================================
   Global Modal System (Alert/Confirm)
   ============================================ */
.echo-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.echo-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.echo-modal-dialog {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 320px;
  max-width: 450px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  animation: echoModalFadeIn 0.15s ease-out;
}

@keyframes echoModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.echo-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.echo-modal-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.echo-modal-icon.alert { color: #f59e0b; }
.echo-modal-icon.error { color: #ef4444; }
.echo-modal-icon.success { color: #22c55e; }
.echo-modal-icon.confirm { color: #3b82f6; }
.echo-modal-icon.warning { color: #f97316; }

.echo-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.echo-modal-body {
  padding: 1.25rem;
}

.echo-modal-message {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.echo-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: 0 0 8px 8px;
}

.echo-modal-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.echo-modal-cancel {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.echo-modal-cancel:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.echo-modal-confirm {
  background: #3b82f6;
  color: #fff;
}

.echo-modal-confirm:hover {
  background: #2563eb;
}

.echo-modal-confirm.danger {
  background: #ef4444;
}

.echo-modal-confirm.danger:hover {
  background: #dc2626;
}

.echo-modal-confirm.success {
  background: #22c55e;
}

.echo-modal-confirm.success:hover {
  background: #16a34a;
}

/* Hide cancel button for alert-only modals */
.echo-modal.alert-only .echo-modal-cancel {
  display: none;
}

/* ============================================
   Media Upload & Gallery
   ============================================ */
.upload-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: var(--bg-tertiary);
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drop-zone-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.drop-zone-content p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.drop-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: var(--accent-primary-darker);
}

.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  width: 0%;
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.media-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.media-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.media-item-pdf .pdf-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.media-item-pdf .pdf-name {
  font-size: 0.65rem;
  text-align: center;
  color: var(--text-secondary);
  word-break: break-word;
  line-height: 1.2;
}

.media-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.media-item:hover .media-item-overlay {
  opacity: 1;
}

.media-item-name {
  font-size: 0.65rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-item-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  font-size: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-item:hover .media-item-delete {
  opacity: 1;
}

.media-item-delete:hover {
  background: #ef4444;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-info {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Comment thumbnails */
.comment-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.comment-thumbnail {
  display: inline-block;
}

.comment-thumbnail img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.comment-thumbnail img:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.media-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =====================================
   SMS Location & Chat Styles
   ===================================== */

.sms-section {
  margin-top: 1rem;
}

.sms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sms-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-popout {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-popout:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sms-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-sms-location {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sms-location:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-sms-location:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-sms-location-sent {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-terminate-tracking {
  background: #4b5563;
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.btn-terminate-tracking:hover {
  background: #6b7280;
}

.btn-terminate-tracking:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-terminate-tracking.terminated {
  background: #374151;
  color: #9ca3af;
}

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

.sms-no-phone {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.sms-chat-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.sms-messages {
  max-height: 300px;
  min-height: 150px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sms-loading,
.sms-no-messages {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2rem 0;
}

.sms-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.sms-message.inbound {
  align-self: flex-start;
}

.sms-message.outbound {
  align-self: flex-end;
}

.sms-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  position: relative;
}

.sms-message.inbound .sms-bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.sms-message.outbound .sms-bubble {
  background: #3b82f6;
  color: white;
  border-bottom-right-radius: 4px;
}

.sms-translated {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.sms-original.has-translation {
  font-size: 0.75rem;
  opacity: 0.7;
  font-style: italic;
}

.sms-lang-tag {
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 0.6rem;
  background: #f59e0b;
  color: #1a1a1a;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.sms-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  padding: 0 0.25rem;
}

.sms-message.outbound .sms-meta {
  text-align: right;
}

.sms-location-received {
  background: rgba(22, 163, 74, 0.2);
  border: 1px solid #16a34a;
  color: #4ade80;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.sms-compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.sms-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 4px;
}

.sms-input::placeholder {
  color: var(--text-muted);
}

.btn-sms-send {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.btn-sms-send:hover {
  background: #2563eb;
}

.btn-sms-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sms-language-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(245, 158, 11, 0.15);
  border-top: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.75rem;
}

.sms-language-info .lang-badge {
  background: #f59e0b;
  color: #1a1a1a;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.65rem;
}

.sms-language-info .lang-text {
  color: var(--text-secondary);
}

/* SMS Toast Notification */
.sms-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
}

.sms-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sms-toast-success {
  border-color: #16a34a;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.2), rgba(22, 163, 74, 0.1));
}

.sms-toast-error {
  border-color: #dc2626;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.2), rgba(220, 38, 38, 0.1));
}

/* SMS Chat Popout Styles */
.sms-popout-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.sms-popout-header {
  padding: 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.sms-popout-header h2 {
  font-size: 1rem;
  margin: 0 0 0.25rem 0;
}

.sms-popout-header .incident-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sms-popout-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sms-popout-compose {
  padding: 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

/* =============================================
   Incident ID Display Styles
   ============================================= */

/* Master ID - global incident identifier (for multi-agency users) */
.master-id {
  font-weight: 600;
  color: var(--text-primary);
}

/* Master ID shown as secondary info */
.master-id-secondary {
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: 400;
}

/* Agency Call ID - primary identifier (for single-agency users) */
.call-id {
  font-weight: 600;
  color: var(--text-primary);
}

/* Call ID shown as secondary info (for multi-agency users) */
.call-id-secondary {
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: 400;
}

/* Pending badge for calls without assigned agency */
.pending-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-text);
  border-radius: 3px;
  letter-spacing: 0.025em;
}

@keyframes pttPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── SOS / Emergency Alert ─────────────────────────────────────── */
@keyframes sosFlash {
  0%, 100% { background: transparent; }
  50% { background: rgba(239, 68, 68, 0.35); }
}

.unit-sos-active {
  animation: sosFlash 0.5s ease-in-out 5;
  animation-fill-mode: forwards;
}

.unit-sos-active.sos-persist {
  background: rgba(239, 68, 68, 0.15) !important;
}

.sos-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
}

.sos-alert-content {
  background: var(--bg-primary, #1a1a2e);
  border: 2px solid #dc2626;
  border-radius: 12px;
  width: min(520px, 94vw);
  box-shadow: 0 8px 32px rgba(220, 38, 38, 0.4);
  overflow: hidden;
}

.sos-alert-header {
  background: #dc2626;
  color: #fff;
  padding: 0.75rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sos-alert-header .material-symbols-outlined {
  font-size: 1.4rem;
}

.sos-alert-body {
  padding: 1.25rem;
  color: var(--text-primary, #e0e0e0);
  font-size: 0.95rem;
  line-height: 1.6;
}

.sos-alert-body .sos-unit-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ef4444;
  margin-bottom: 0.5rem;
}

.sos-alert-body .sos-detail {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.sos-alert-body .sos-detail-label {
  font-weight: 600;
  color: var(--text-secondary, #aaa);
  min-width: 80px;
}

.sos-alert-body .sos-call-info {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sos-alert-dismiss {
  display: block;
  width: calc(100% - 2.5rem);
  margin: 0 1.25rem 1.25rem;
  padding: 0.6rem;
  background: rgba(220, 38, 38, 0.15);
  color: #ef4444;
  border: 1px solid #dc2626;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.sos-alert-dismiss:hover {
  background: rgba(220, 38, 38, 0.3);
}

/* SOS toast (used on map page) */
.sos-toast {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99998;
  background: #dc2626;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.5);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  animation: sosFlash 0.5s ease-in-out 3;
}

.sos-toast .sos-toast-close {
  margin-left: 0.5rem;
  opacity: 0.7;
  cursor: pointer;
  font-size: 1.1rem;
}

.sos-toast .sos-toast-close:hover {
  opacity: 1;
}