/* === CSS Variables for Theming === */
:root {
  --bg-primary: #f6f8fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f9fafb;
  --text-primary: #101828;
  --text-secondary: #475467;
  --text-muted: #667085;
  --border-color: #d0d5dd;
  --border-light: #eaecf0;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-border: #93c5fd;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --error: #b42318;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #475569;
  --border-light: #334155;
  --accent: #60a5fa;
  --accent-light: #1e3a5f;
  --accent-border: #3b82f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

/* === Performance Optimizations === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* GPU-accelerated transforms */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* === Base === */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background 0.2s ease-out, color 0.2s ease-out;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === Header === */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

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

.logo {
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.tagline {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.logout-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.logout-link:hover {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}

.logout-link svg {
  width: 16px;
  height: 16px;
}

.icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
}

.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* === Container === */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

@media (min-width: 840px) {
  .container {
    max-width: 1180px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 34%);
    gap: 16px;
    align-items: stretch;
  }

  .score-panel {
    grid-column: 1;
    margin-bottom: 0;
  }

  .map-section {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 0;
  }

  .safety-tools-section,
  .chat-shell,
  .notifications-panel {
    grid-column: 1 / -1;
  }

  .map-section.expanded {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .container > .score-panel,
  .container > .map-section {
    margin-bottom: 0;
  }
}

/* === Safety Score Panel === */
.score-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.score-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.score-header svg {
  width: 18px;
  height: 18px;
}

#scoreTitle {
  transition: all 0.3s ease;
}

.current-location {
  display: none;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: 4px;
}

.current-location.visible {
  display: inline-block;
}

.refresh-btn {
  margin-left: auto;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.refresh-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.refresh-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-primary);
}

.refresh-btn.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.score-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  padding: 20px;
  align-items: center;
}

@media (max-width: 600px) {
  .score-body {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.score-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.score-circle {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 8;
}

.score-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 1s ease-out, stroke 0.3s;
}

.score-progress.low { stroke: #22c55e; }
.score-progress.moderate { stroke: #f59e0b; }
.score-progress.high { stroke: #ef4444; }

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-value span:first-child {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.score-max {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.score-label {
  font-weight: 600;
  font-size: 1rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.score-label.low { background: #dcfce7; color: #166534; }
.score-label.moderate { background: #fef3c7; color: #92400e; }
.score-label.high { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .score-label.low { background: #14532d; color: #86efac; }
[data-theme="dark"] .score-label.moderate { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .score-label.high { background: #7f1d1d; color: #fca5a5; }

.score-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.score-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-value.improving { color: #22c55e; }
.stat-value.worsening { color: #ef4444; }

.stat-source {
  font-size: 0.75rem;
  color: var(--accent);
  line-height: 1.3;
}

.sources-stat {
  grid-column: span 2;
}

.score-footer {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-light);
}

.weight-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  align-items: center;
}

.weight-label {
  font-weight: 600;
}

.weight-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.weight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.weight-dot.violent { background: #ef4444; }
.weight-dot.property { background: #f59e0b; }
.weight-dot.public { background: #3b82f6; }

/* === Section Labels === */
.section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.section-icon {
  width: 18px;
  height: 18px;
}

/* === Map Section === */
.map-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.09);
}

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

.map-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.map-expand-btn {
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 7px 10px;
}

.map-expand-btn:hover {
  background: rgba(37, 99, 235, 0.14);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.map-container {
  position: relative;
  min-height: 200px;
  background:
    radial-gradient(circle at 18% 22%, rgba(37, 99, 235, 0.08), transparent 30%),
    linear-gradient(135deg, #eef6ff, #f8fafc);
}

#map {
  height: 200px;
  width: 100%;
  background: #edf5f8;
  filter: saturate(0.96) contrast(1.02);
}

.map-section.expanded .map-container,
.map-section.expanded #map {
  min-height: 520px;
  height: 520px;
}

.map-section:not(.expanded) .map-legend {
  display: none;
}

.leaflet-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.32) !important;
  border-radius: 14px !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14) !important;
}

.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  border: 0 !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #0f172a !important;
  line-height: 38px !important;
  font-size: 20px !important;
  backdrop-filter: blur(16px);
}

.leaflet-control-zoom a + a {
  border-top: 1px solid rgba(148, 163, 184, 0.28) !important;
}

.leaflet-control-attribution {
  margin: 0 8px 8px 0 !important;
  padding: 4px 8px !important;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82) !important;
  color: #64748b;
  backdrop-filter: blur(14px);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.risk-marker {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 4px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}

.risk-marker::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.16;
}

.risk-marker span {
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.84);
}

.risk-marker.low {
  background: #22c55e;
  color: #22c55e;
}

.risk-marker.medium {
  background: #f59e0b;
  color: #f59e0b;
}

.risk-marker.high {
  background: #ef4444;
  color: #ef4444;
}

.map-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), var(--bg-tertiary));
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

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

.legend-dot.low { background: #22c55e; }
.legend-dot.medium { background: #f59e0b; }
.legend-dot.high { background: #ef4444; }

/* === Chat Shell === */
.chat-shell {
  margin-top: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.guardian-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  display: none;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 16px 10px 10px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: white;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  cursor: pointer;
}

.guardian-launcher.visible {
  display: inline-flex;
}

.guardian-launcher-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.guardian-launcher-icon svg {
  width: 20px;
  height: 20px;
}

.guardian-launcher-text {
  display: grid;
  gap: 1px;
  text-align: left;
}

.guardian-launcher-text strong {
  font-size: 0.95rem;
}

.guardian-launcher-text span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 700;
}

.guardian-popup {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 901;
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 44px));
  margin-top: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.guardian-popup.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.guardian-popup .messages {
  min-height: 280px;
  max-height: min(480px, calc(100vh - 240px));
}

.guardian-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
}

.guardian-close-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.guardian-close-btn svg {
  width: 16px;
  height: 16px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.chat-header svg {
  width: 18px;
  height: 18px;
}

/* Voice Output Toggle */
.voice-output-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-language-select {
  min-width: 94px;
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.location-access-btn {
  appearance: none;
  height: 34px;
  min-width: 112px;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.location-access-btn.active {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.04));
  color: var(--primary);
}

.location-access-btn:hover {
  border-color: var(--accent-border);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.08);
}

.voice-language-select:focus,
.location-access-btn:focus-visible {
  outline: 2px solid var(--accent-border);
  outline-offset: 2px;
}

.voice-output-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.voice-output-btn svg {
  width: 18px;
  height: 18px;
}

.voice-output-btn .speaker-on {
  display: none;
}

.voice-output-btn .speaker-off {
  display: block;
}

.voice-output-btn.active {
  background: #22c55e;
  color: white;
}

.voice-output-btn.active .speaker-on {
  display: block;
}

.voice-output-btn.active .speaker-off {
  display: none;
}

[data-theme="dark"] .voice-output-btn {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .voice-output-btn:hover {
  background: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .voice-output-btn.active {
  background: #22c55e;
}

/* Location Context Indicator */
.location-context {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent-light), transparent);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: slideDown 0.2s ease-out;
}

.location-context.active {
  display: flex;
}

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

.location-context .location-icon {
  font-size: 1rem;
}

.location-context .location-name {
  font-weight: 600;
  color: var(--accent);
}

.location-context .clear-location {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.location-context .clear-location:hover {
  color: var(--danger);
}

.messages {
  min-height: 350px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-primary);
}

.message {
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.bubble {
  max-width: min(700px, 85%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 18px;
  line-height: 1.7;
  background: var(--bg-secondary);
  font-size: 0.95rem;
}

.message.user .bubble {
  background: var(--accent-light);
  border-color: var(--accent-border);
}

.message.assistant .bubble {
  background: var(--bg-secondary);
}

/* Reduce padding when using response cards */
.message.assistant .bubble:has(.response-cards) {
  padding: 8px;
}

.message.assistant .bubble:has(.incident-command-card) {
  padding: 0;
  overflow: hidden;
}

.incident-command-card {
  border-left: 5px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(37, 99, 235, 0.04));
}

.location-command-card {
  border-left: 5px solid #2563eb;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.05));
}

.incident-command-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.72);
}

.incident-command-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.location-command-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.location-command-icon svg {
  width: 22px;
  height: 22px;
}

.incident-command-icon svg {
  width: 22px;
  height: 22px;
}

.incident-command-header strong {
  display: block;
  font-size: 1rem;
  color: var(--text-primary);
}

.incident-command-header span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.incident-command-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 18px 8px;
}

.incident-command-grid > div {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-primary);
}

.incident-command-grid small {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.incident-command-grid p {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.45;
}

.incident-command-grid em {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-style: normal;
}

.incident-command-steps {
  display: grid;
  gap: 8px;
  padding: 8px 18px 12px;
}

.incident-command-steps div {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
}

.incident-command-steps b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  font-size: 0.78rem;
}

.incident-command-steps span {
  color: var(--text-secondary);
  line-height: 1.45;
}

.incident-command-packet {
  width: calc(100% - 36px);
  min-height: 132px;
  margin: 0 18px 14px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.incident-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 16px;
}

.incident-command-actions button,
.incident-command-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: white;
  color: #2563eb;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.incident-command-actions button:first-child {
  background: #2563eb;
  color: white;
}

.incident-command-note {
  margin: -4px 18px 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .incident-command-grid {
    grid-template-columns: 1fr;
  }
}

.guardian-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(76px, 88px);
  gap: 14px;
  padding: 14px 2px 4px;
  margin-top: 14px;
  overflow-x: auto;
  border-top: 1px solid var(--border-light);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(37, 99, 235, 0.35) transparent;
  scrollbar-width: thin;
}

.guardian-feedback {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.guardian-feedback button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 0.92rem;
}

.guardian-feedback button:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.guardian-feedback.submitted {
  border-radius: 12px;
  color: var(--text-secondary);
}

.guardian-actions::-webkit-scrollbar {
  display: block;
  height: 7px;
}

.guardian-actions::-webkit-scrollbar-track {
  background: transparent;
}

.guardian-actions::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.28);
  border-radius: 999px;
}

.guardian-action {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  border-radius: 18px;
  padding: 0;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 74px;
  max-width: 88px;
  text-align: center;
  white-space: normal;
  box-shadow: none;
  transition: transform 0.15s ease, color 0.15s ease;
}

.guardian-action:hover {
  transform: translateY(-1px);
  color: var(--accent);
}

.guardian-action:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.guardian-action-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  color: #0a84ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(10, 132, 255, 0.16);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.guardian-action-icon svg {
  display: block;
  width: 25px;
  height: 25px;
  stroke-width: 2.35;
}

.guardian-action span:last-child {
  max-width: 82px;
  overflow-wrap: anywhere;
}

.service-next-steps {
  display: grid;
  gap: 10px;
}

.consent-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
  color: var(--text-primary);
}

.modal-body .consent-option {
  margin-top: 6px;
}

.consent-option input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.consent-option span {
  font-size: 0.9rem;
  line-height: 1.35;
}

/* === Enhanced Bubble Content for Readability === */
.bubble h1, .bubble h2, .bubble h3 {
  margin: 1em 0 0.5em;
  color: var(--text-primary);
  line-height: 1.3;
}

.bubble h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child {
  margin-top: 0;
}

/* Quick Take - highlight style */
.bubble h3:first-child,
.bubble h3:contains("Quick") {
  background: linear-gradient(90deg, var(--accent-light) 0%, transparent 100%);
  margin: 0 -18px 0.75em;
  padding: 8px 18px;
  border-radius: 12px 12px 0 0;
}

.bubble p {
  margin: 0.6em 0;
  color: var(--text-primary);
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble ul, .bubble ol {
  margin: 0.75em 0;
  padding-left: 0;
  list-style: none;
}

.bubble li {
  margin: 0.5em 0;
  padding-left: 1.5em;
  position: relative;
}

/* Custom list markers */
.bubble ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.bubble ol {
  counter-reset: item;
}

.bubble ol li::before {
  content: counter(item);
  counter-increment: item;
  position: absolute;
  left: 0;
  width: 1.2em;
  height: 1.2em;
  background: var(--accent);
  color: white;
  font-size: 0.75em;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0.2em;
}

.bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  font-size: 0.9em;
}

.bubble th, .bubble td {
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  text-align: left;
}

.bubble th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

.bubble a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
}

.bubble a:hover {
  text-decoration: underline;
}

/* Links on their own line */
.bubble p > a:only-child {
  display: block;
  margin: 0.5em 0;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 0.9em;
}

.bubble strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Section headers with emoji */
.bubble p strong:first-child {
  display: block;
  margin-top: 1em;
  margin-bottom: 0.3em;
  font-size: 1.05em;
}

.bubble p:first-child strong:first-child {
  margin-top: 0;
}
.bubble strong:first-child {
  color: var(--accent);
}

.response-cards strong:first-child,
.response-card strong:first-child {
  color: inherit;
}

.bubble hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 1.25em 0;
}

/* Code/highlight styling */
.bubble code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Blockquote for tips */
.bubble blockquote {
  margin: 1em 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent-light), transparent);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-style: normal;
}

/* === AI Response Cards === */
.response-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.response-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  transition: transform 0.15s, box-shadow 0.15s;
}

.response-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.card-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 6px;
  background: var(--accent-light);
  border-radius: 8px;
  color: var(--accent);
}

.card-icon svg {
  width: 100%;
  height: 100%;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-content h4 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Quick Answer Card */
.card-quick {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent);
}

.card-quick .card-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.quick-answer {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.section-intro {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* Risk Card */
.card-risk {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), transparent);
}

.card-risk .card-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.risk-meter {
  margin-bottom: 8px;
}

.risk-meter-bar {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.risk-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.risk-meter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.risk-score {
  font-size: 1.25rem;
  font-weight: 700;
}

.risk-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.risk-reason {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Do This Card */
.card-do {
  border-left-color: #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), transparent);
}

.card-do .card-icon {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.action-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #22c55e;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-text {
  flex: 1;
}

.action-text strong {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.action-text span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Skip Card */
.card-skip {
  border-left-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), transparent);
}

.card-skip .card-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.skip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skip-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.skip-list li::before {
  content: "✕";
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: bold;
}

/* Tip Card */
.card-tip {
  border-left-color: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), transparent);
}

.card-tip .card-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.card-tip p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-style: italic;
}

/* Links Card */
.card-links {
  border-left-color: #06b6d4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), transparent);
}

.card-links .card-icon {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.link-list a:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.link-list a::after {
  content: "↗";
  font-size: 0.9em;
  opacity: 0.6;
}

/* Fallback styling */
.response-fallback {
  line-height: 1.6;
}

.response-fallback.formatted {
  padding: 12px;
}

.response-fallback.formatted strong {
  color: var(--accent);
  display: inline-block;
  margin-top: 12px;
}

.response-fallback.formatted hr.section-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 16px 0;
}

.response-fallback.formatted li {
  margin: 6px 0;
  padding-left: 8px;
  list-style-type: none;
}

.response-fallback.formatted li::before {
  content: "•";
  color: var(--accent);
  margin-right: 8px;
}

.response-fallback.formatted .num {
  color: var(--accent);
  font-weight: 600;
}

/* Vibe Card (new format) */
.card-vibe {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent);
}

.card-vibe .card-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.card-vibe p {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Spots Card */
.card-spots {
  border-left-color: #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), transparent);
}

.card-spots .card-icon {
  background: rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.spots-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spots-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.spot-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #22c55e;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spot-text {
  flex: 1;
}

.spot-text strong {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.spot-text span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Parking Card */
.card-parking {
  border-left-color: #06b6d4;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), transparent);
}

.card-parking .card-icon {
  background: rgba(6, 182, 212, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.parking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parking-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.55;
}

.parking-list li:last-child {
  border-bottom: none;
}

.parking-list strong {
  display: block;
  color: var(--text-primary);
  min-width: 0;
  margin-bottom: 3px;
}

.list-arrow {
  flex: 0 0 auto;
  color: #2563eb;
  font-weight: 800;
  line-height: 1.45;
}

.list-text {
  min-width: 0;
  flex: 1;
}

.list-text span {
  display: block;
}

/* Avoid Card */
.card-avoid {
  border-left-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), transparent);
}

.card-avoid .card-icon {
  background: rgba(239, 68, 68, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.avoid-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avoid-list li {
  display: flex;
  align-items: start;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.avoid-list li::before {
  content: none;
}

.avoid-list strong {
  display: block;
  color: var(--text-primary);
  min-width: 0;
  margin-bottom: 3px;
}

/* === Composer === */
.composer {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  align-items: center;
}

/* === Voice Button === */
.voice-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.voice-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.voice-btn svg {
  width: 22px;
  height: 22px;
}

.voice-btn .stop-icon {
  display: none;
}

.voice-btn .pulse-ring {
  display: none;
}

.voice-btn.recording {
  border-color: #ef4444;
  background: #fee2e2;
  color: #ef4444;
  animation: pulse-border 1.5s ease-in-out infinite;
}

[data-theme="dark"] .voice-btn.recording {
  background: #7f1d1d;
  color: #fca5a5;
}

.voice-btn.recording .mic-icon {
  display: none;
}

.voice-btn.recording .stop-icon {
  display: block;
}

.voice-btn.recording .pulse-ring {
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid #ef4444;
  border-radius: 50%;
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-border {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

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

.voice-btn.unsupported {
  display: none;
}

.composer input {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.composer button {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
}

.composer button:hover {
  transform: scale(1.05);
}

.composer button:active {
  transform: scale(0.95);
}

.composer button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.composer button svg {
  width: 22px;
  height: 22px;
}

/* === Status === */
#status {
  margin: 12px 0;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.error {
  color: var(--error) !important;
}

/* === Footer === */
.app-footer {
  margin-top: 24px;
  padding: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

.app-footer p {
  margin: 0;
}

/* === Utilities === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* === Dark Mode Map Tiles === */
[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.74) contrast(1.08) saturate(0.72);
}

[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.82) !important;
  color: var(--text-muted) !important;
}

[data-theme="dark"] .leaflet-control-attribution a {
  color: var(--accent) !important;
}

/* ============================================
   SAFETY FEATURES
   ============================================ */

/* === SOS Button (Map Overlay) === */
.sos-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
  z-index: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}

.sos-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(239, 68, 68, 0.6);
}

.sos-btn:active {
  transform: scale(0.95);
}

.sos-btn svg {
  width: 28px;
  height: 28px;
}

.sos-btn span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* === SOS Modal === */
.sos-modal .modal-content {
  max-width: 380px;
}

.sos-modal-content {
  padding: 0;
}

.sos-modal-header {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 24px;
  text-align: center;
  border-radius: 16px 16px 0 0;
}

.sos-icon-pulse {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sosPulse 1.5s ease-in-out infinite;
}

@keyframes sosPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.sos-icon-pulse svg {
  width: 32px;
  height: 32px;
}

.sos-modal-header h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}

.sos-modal-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.sos-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sos-call-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.sos-call-btn.emergency-911 {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.sos-call-btn.emergency-911:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.sos-call-btn.contact-call {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.sos-call-btn.contact-call:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.call-btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-call .call-btn-icon {
  background: var(--accent-light);
  color: var(--accent);
}

.call-btn-icon svg {
  width: 22px;
  height: 22px;
}

.call-btn-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.call-btn-name {
  font-size: 1rem;
  font-weight: 600;
}

.call-btn-desc {
  font-size: 0.8rem;
  opacity: 0.8;
}

.sos-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 4px 0;
}

.sos-divider::before,
.sos-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.sos-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

/* 911 Section */
.sos-911-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 12px;
  color: white;
}

.sos-911-number {
  display: flex;
  flex-direction: column;
}

.big-911 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
}

.sos-911-label {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 2px;
}

/* Copy 911 Button */
.copy-911-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  color: #dc2626;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-911-btn:hover {
  background: #fee2e2;
  transform: scale(1.02);
}

.copy-911-btn svg {
  width: 20px;
  height: 20px;
}

.dial-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 8px 0 4px;
  font-style: italic;
}

/* Contact Cards */
.sos-contact-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.sos-contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sos-contact-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.sos-contact-phone {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  letter-spacing: 0.5px;
}

/* Copy Contact Button */
.copy-contact-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-contact-btn:hover {
  background: var(--accent-dark);
  transform: scale(1.02);
}

.copy-contact-btn svg {
  width: 16px;
  height: 16px;
}

.no-contacts-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 16px;
}

.sos-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-tertiary);
  border-radius: 0 0 16px 16px;
}

.sos-modal-footer button {
  flex: 1;
}

.sos-modal-footer .btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sos-modal-footer .btn-primary svg {
  width: 18px;
  height: 18px;
}

/* === Safety Toolbar === */
/* === Inline Safety Tools Section === */
.safety-tools-section {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.safety-tools-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.safety-tools-header .section-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.safety-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (min-width: 840px) {
  .safety-tools-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.safety-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.safety-tool:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.safety-tool-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.safety-tool-icon.heart {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.safety-tool-icon.sos-icon {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.24);
}

.priority-tool {
  border-color: rgba(220, 38, 38, 0.32);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.98), var(--bg-primary));
}

.priority-tool .safety-tool-name {
  color: #b91c1c;
  font-weight: 900;
}

.priority-tool:hover {
  background: #fef2f2;
  border-color: #dc2626;
}

.safety-tool-icon svg {
  width: 18px;
  height: 18px;
}

.safety-tool-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.safety-tool-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.safety-tool-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Modal Base === */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.modal-body textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-body .consent-option input {
  width: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 auto;
}

.modal-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.safet-toast {
  position: fixed;
  left: 50%;
  top: 14px;
  z-index: 4000;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 32px;
  align-items: start;
  gap: 12px;
  width: min(620px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.2);
  color: var(--text-primary);
  transform: translate(-50%, -120%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.24s ease;
}

.safet-toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.safet-toast-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.safet-toast-copy {
  min-width: 0;
}

.safet-toast strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
  line-height: 1.25;
}

.safet-toast span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.4;
}

.safet-toast-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.safet-toast-close:hover {
  background: rgba(15, 23, 42, 0.12);
  color: var(--text-primary);
}

[data-theme="dark"] .safet-toast {
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(96, 165, 250, 0.28);
}

/* === Buttons === */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  width: 100%;
  padding: 14px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

[data-theme="dark"] .btn-danger {
  background: #7f1d1d;
  color: #fca5a5;
  border-color: #991b1b;
}

.btn-danger:hover {
  background: #fecaca;
}

/* === Timer Display === */
.timer-display {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  padding: 20px;
  background: var(--bg-primary);
  border-radius: 12px;
  font-family: 'Courier New', monospace;
  color: var(--accent);
}

.timer-display.warning {
  color: var(--warning);
  animation: pulse-text 1s ease-in-out infinite;
}

.timer-display.danger {
  color: var(--danger);
  animation: pulse-text 0.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.timer-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.timer-preset {
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timer-preset:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.timer-preset.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.timer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

/* === Timer Indicator (floating) === */
.timer-indicator {
  position: fixed;
  top: 80px;
  right: 24px;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}

.timer-indicator svg {
  width: 20px;
  height: 20px;
}

.timer-indicator-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

#indicatorTime {
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.quick-checkin {
  padding: 6px 12px;
  background: white;
  color: var(--accent);
  border: none;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.quick-checkin:hover {
  background: #f0f9ff;
}

/* === Fake Call Screen === */
.fake-call-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

.fake-call-screen.active {
  display: flex;
}

.fake-call-content {
  text-align: center;
  color: white;
}

.caller-avatar {
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.caller-avatar svg {
  width: 60px;
  height: 60px;
}

.caller-name {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.call-status {
  color: rgba(255,255,255,0.7);
  margin-bottom: 60px;
  animation: pulse-text 2s ease-in-out infinite;
}

.call-actions {
  display: flex;
  justify-content: center;
  gap: 60px;
}

.call-decline, .call-accept {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-decline {
  background: #ef4444;
}

.call-accept {
  background: #22c55e;
}

.call-decline svg, .call-accept svg {
  width: 32px;
  height: 32px;
  color: white;
}

/* === Verify Ride === */
.verify-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.verify-result {
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  margin-top: 10px;
}

.verify-result.safe {
  background: #dcfce7;
  color: #166534;
}

.verify-result.danger {
  background: #fee2e2;
  color: #991b1b;
}

[data-theme="dark"] .verify-result.safe {
  background: #14532d;
  color: #86efac;
}

[data-theme="dark"] .verify-result.danger {
  background: #7f1d1d;
  color: #fca5a5;
}

/* === Contacts List === */
#contactsList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.contact-sync-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin: 12px 0 16px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.08));
}

.contact-sync-panel strong,
.contact-sync-panel span {
  display: block;
}

.contact-sync-panel span {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.4;
}

.contact-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-sync-option {
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 8px 11px;
}

.contact-sync-option:hover {
  border-color: var(--accent-border);
  background: var(--accent-light);
}

.contact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.contact-info {
  display: flex;
  flex-direction: column;
}

.contact-name {
  font-weight: 600;
}

.contact-phone {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.contact-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
}

.add-contact-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === SafeT Calendar === */
.calendar-modal-content {
  max-width: 390px;
  max-height: min(92vh, 760px);
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .calendar-modal-content {
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

.calendar-body {
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
}

.calendar-subtitle {
  margin: 2px 0 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.calendar-toolbar,
.calendar-agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 10px;
}

.calendar-toolbar strong {
  flex: 1;
  font-size: 1.08rem;
  color: var(--text-primary);
  text-align: center;
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.45rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.calendar-weekdays,
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-weekdays {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  margin: 8px 0 6px;
}

.calendar-day {
  -webkit-appearance: none;
  appearance: none;
  aspect-ratio: 1;
  min-height: 0;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.9rem;
  font-weight: 650;
  box-shadow: none;
}

.calendar-day:hover {
  background: var(--accent-light);
}

.calendar-day.is-muted {
  color: var(--text-muted);
  opacity: 0.55;
}

.calendar-day.is-today {
  color: var(--accent);
}

.calendar-day.is-selected {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.calendar-day.has-plans small {
  min-height: 5px;
  display: inline-flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
}

.calendar-day.has-plans small i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.calendar-plans-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 14px;
  padding-bottom: 18px;
}

.calendar-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.calendar-plan-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendar-plan-main strong {
  color: var(--text-primary);
}

.calendar-plan-main span,
.calendar-plan-main small {
  color: var(--text-secondary);
}

.calendar-agenda-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.calendar-agenda-header .btn-primary,
.calendar-create-btn {
  width: auto;
  min-width: 118px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.calendar-export {
  width: auto;
  border-radius: 999px;
  padding: 9px 12px;
}

.inline-map-link {
  display: inline;
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.inline-map-link:hover {
  color: #1d4ed8;
}

.inline-map-action {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.inline-map-action:hover {
  background: rgba(37, 99, 235, 0.08);
}

.safet-link-status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.safet-link-status strong {
  color: var(--text-primary);
}

.safet-link-events {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.safet-link-event {
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.safet-link-event-header,
.safet-link-member,
.safet-link-flag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.safet-link-event-header strong {
  color: var(--text-primary);
}

.safet-link-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.safet-link-badge.needs_attention {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.safet-link-badge.watch {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.safet-link-members,
.safet-link-flags {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.safet-link-member,
.safet-link-flag {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.safet-link-flag {
  align-items: flex-start;
  border-left: 3px solid #f59e0b;
}

.safet-link-flag.urgent {
  border-left-color: #ef4444;
}

.safet-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.safet-link-actions button {
  width: auto;
  min-width: 96px;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

/* === Mobile Adjustments === */
@media (max-width: 600px) {
  .guardian-launcher {
    right: 16px;
    bottom: 16px;
    min-height: 54px;
  }

  .guardian-popup {
    inset: auto 10px 10px 10px;
    width: auto;
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .guardian-popup .chat-header {
    flex-wrap: wrap;
  }

  .guardian-popup .messages {
    min-height: 260px;
    max-height: calc(100vh - 250px);
  }

  .guardian-popup .composer {
    padding: 10px;
  }

  .calendar-modal-content {
    width: calc(100vw - 20px);
    max-width: none;
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
  }

  .calendar-body {
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
  }

  .calendar-day {
    border-radius: 12px;
    font-size: 0.84rem;
  }

  .calendar-plan {
    align-items: flex-start;
    flex-direction: column;
  }

  .safety-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .safety-tool {
    padding: 10px;
  }

  .safety-tool-desc {
    display: none;
  }

  .sos-btn {
    width: 56px;
    height: 56px;
    bottom: 12px;
    right: 12px;
  }

  .sos-btn svg {
    width: 22px;
    height: 22px;
  }

  .sos-btn span {
    font-size: 0.6rem;
  }
}
