/**
 * Stage 4a — emergency trust + offline surfaces (hospitals / pharmacies).
 * Tokens-first; does not restyle legacy hospital cards in style.css.
 */

.emergency-trust-strip {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--sm-line, var(--color-border));
  background: var(--sm-surface-warm, var(--color-bg-alt, rgba(0, 0, 0, 0.03)));
  color: var(--sm-ink-2, var(--color-text-main));
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 600;
}

.emergency-offline-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px dashed rgba(179, 120, 43, 0.45);
  background: var(--honey-bg, rgba(246, 173, 85, 0.12));
  color: var(--honey, #b3782b);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

.emergency-offline-banner[hidden] {
  display: none !important;
}

body.dark-theme .emergency-offline-banner,
:root[data-theme="dark"] .emergency-offline-banner {
  color: var(--honey, #d7a45c);
  border-color: rgba(215, 164, 92, 0.45);
}

.emergency-section-title {
  font-size: 1.1rem;
  color: var(--sm-ink, var(--color-text-main));
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.emergency-section-copy {
  font-size: 0.85rem;
  color: var(--sm-muted, var(--color-text-muted));
  margin: 0 0 0.85rem;
  line-height: 1.4;
}

.hospitals-estimate-shell {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    #319795 100%
  );
  border-radius: var(--border-radius);
  padding: 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.hospitals-estimate-shell h3 {
  color: white;
  margin-bottom: 0.25rem;
  font-size: 1.15rem;
}

.hospitals-estimate-shell > p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* Stage 4b — contacts answer-first */
.contacts-section {
  margin: 0 0 1.15rem;
}

.contacts-section-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--teal-deep, var(--color-primary));
}

.contacts-section-kicker--secondary {
  color: var(--sm-muted, var(--color-text-muted));
}

.contacts-call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--sm-line, var(--color-border));
}

.contacts-section .contacts-call-row:last-of-type {
  border-bottom: none;
}

.contacts-call-row--secondary {
  opacity: 0.96;
}

.contacts-call-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.contacts-call-copy strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--sm-ink, var(--color-text-main));
  line-height: 1.2;
}

.contacts-call-copy span {
  font-size: 0.82rem;
  color: var(--sm-ink-2, var(--color-text-muted));
  line-height: 1.3;
}

.contacts-tel-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  background: var(--teal, var(--color-primary));
  color: var(--sm-bg);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
}

.contacts-tel-btn--support {
  background: var(--teal-bg);
  color: var(--teal-deep);
  border: 1px solid var(--teal);
}

.contacts-tel-btn--secondary {
  background: var(--sm-ink-2);
  color: var(--sm-bg);
}

.contacts-transport-note {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sm-muted, var(--color-text-muted));
}

.contacts-bus-ref {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.55rem 0 0.65rem;
  padding: 0.55rem 0 0;
  border-top: 1px dashed var(--sm-line, var(--color-border));
}

.contacts-bus-ref strong {
  font-size: 0.92rem;
  color: var(--sm-ink, var(--color-text-main));
}

.contacts-bus-ref span {
  font-size: 0.8rem;
  color: var(--sm-muted, var(--color-text-muted));
  line-height: 1.35;
}

.contacts-schedule-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--sm-line, var(--color-border));
  background: var(--sm-surface-warm, transparent);
  color: var(--teal-deep, var(--color-primary));
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

/* Stage 4c — Pillar Info emergency quick hub (unframed) */
.emergency-quick-hub {
  margin: 0 0 1.25rem;
  padding: 0;
  letter-spacing: 0;
}

.emergency-quick-hub__title {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--sm-ink, var(--color-text-main));
}

.emergency-quick-hub__copy {
  margin: 0 0 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--sm-muted, var(--color-text-muted));
}

.emergency-quick-hub__sos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 48px;
  margin: 0 0 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--sos);
  background: var(--sos);
  color: var(--sm-bg);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.emergency-quick-hub__sos:focus-visible {
  outline: 2px solid var(--sos);
  outline-offset: 3px;
}

.emergency-quick-hub__sos-icon {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--sos-bg);
  color: var(--sm-ink);
}

.emergency-quick-hub__sos-icon .premium-vector-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.emergency-quick-hub__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.emergency-quick-hub__action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  min-height: 72px;
  height: 72px;
  padding: 0.45rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--sm-line, var(--color-border));
  background: var(--sm-surface, var(--color-surface));
  color: var(--sm-ink, var(--color-text-main));
  font: inherit;
  letter-spacing: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.emergency-quick-hub__action:focus-visible {
  outline: 2px solid var(--teal, var(--color-primary));
  outline-offset: 2px;
}

.emergency-quick-hub__action-icon {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--teal-bg, var(--color-primary-light));
  color: var(--teal-deep, var(--color-primary));
}

.emergency-quick-hub__action-icon .premium-vector-icon {
  width: 1.15rem;
  height: 1.15rem;
  stroke: currentColor;
  fill: none;
}

.emergency-quick-hub__action > span:last-child {
  display: block;
  max-width: 100%;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  color: var(--sm-ink, var(--color-text-main));
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Stage T2 — Global SOS Beacon (overrides style.css .sos-floating-btn) */
body:not(.app-ready) #sos-header-button.sos-floating-btn {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

body.app-ready #sos-header-button.sos-floating-btn {
  position: fixed !important;
  left: 1rem;
  right: auto;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--sos-bg);
  background: var(--sos);
  color: var(--sm-bg);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  z-index: 10001;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transform: none;
  transition: outline-color 0.15s ease, outline-offset 0.15s ease;
  animation: sos-beacon-pulse 2.8s ease-in-out infinite;
}

body.app-ready #sos-header-button.sos-floating-btn::before,
body.app-ready #sos-header-button.sos-floating-btn::after {
  content: none !important;
  display: none !important;
  animation: none !important;
}

body.app-ready #sos-header-button.sos-floating-btn:hover {
  transform: none;
  box-shadow: none;
}

body.app-ready #sos-header-button.sos-floating-btn:focus {
  outline: none;
}

body.app-ready #sos-header-button.sos-floating-btn:focus-visible {
  outline: 3px solid var(--sos);
  outline-offset: 3px;
}

@keyframes sos-beacon-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.88;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.app-ready #sos-header-button.sos-floating-btn {
    animation: none !important;
  }

  body.app-ready #sos-header-button.sos-floating-btn::before,
  body.app-ready #sos-header-button.sos-floating-btn::after {
    animation: none !important;
  }
}

#sos-modal {
  z-index: 10002;
}

/* Stage T3a — SOS dialog focus affordances (no visual redesign) */
#sos-modal #close-sos-modal.close-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#sos-modal a:focus-visible,
#sos-modal button:focus-visible {
  outline: 2px solid var(--sos);
  outline-offset: 3px;
}

#sos-modal a:focus:not(:focus-visible),
#sos-modal button:focus:not(:focus-visible) {
  outline: none;
}
