
:root {
  --emergency-red: #b42318;
  --emergency-red-dark: #7a160f;
  --emergency-green: #137547;
  --emergency-amber: #f4b740;
  --emergency-surface: #ffffff;
}

.emergency-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  width: min(390px, calc(100vw - 28px));
  border: 1px solid rgba(180, 35, 24, .22);
  border-radius: 22px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 24px 70px rgba(4, 20, 43, .28);
  overflow: hidden;
  transform: translateY(18px);
  opacity: 0;
  transition: .28s ease;
}
.emergency-float.is-visible { transform: translateY(0); opacity: 1; }
.emergency-float__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
  background: linear-gradient(135deg, var(--emergency-red-dark), var(--emergency-red));
  color: #fff;
}
.emergency-float__bar strong { font-size: .79rem; letter-spacing: .08em; text-transform: uppercase; }
.emergency-float__close {
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; cursor: pointer; font-size: 1.1rem;
}
.emergency-float__body { padding: 18px; }
.emergency-float h3 { margin: 0 0 7px; font-size: 1.22rem; line-height: 1.2; }
.emergency-float p { margin: 0; color: #536176; font-size: .92rem; line-height: 1.5; }
.emergency-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.emergency-btn {
  border: 0; border-radius: 14px; padding: 12px 10px; font: inherit; font-weight: 900;
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease;
}
.emergency-btn:hover { transform: translateY(-1px); }
.emergency-btn--safe { background: #e7f7ef; color: #0d6840; box-shadow: inset 0 0 0 1px #b8e5ce; }
.emergency-btn--report { background: #fff0ed; color: #9d2118; box-shadow: inset 0 0 0 1px #f0c4bd; }
.emergency-float__footer {
  margin-top: 13px; display: flex; justify-content: space-between; gap: 10px; align-items: center;
  font-size: .78rem; color: #69778b;
}
.emergency-float__footer a { color: #0e5aa7; font-weight: 900; }
.emergency-stat { display: inline-flex; align-items: center; gap: 5px; }

.emergency-modal {
  position: fixed; inset: 0; z-index: 1000; display: none; place-items: center;
  padding: 20px; background: rgba(3, 14, 29, .72); backdrop-filter: blur(6px);
}
.emergency-modal.is-open { display: grid; }
.emergency-dialog {
  width: min(680px, 100%); max-height: calc(100vh - 36px); overflow: auto;
  border-radius: 24px; background: #fff; box-shadow: 0 30px 100px rgba(0,0,0,.35);
}
.emergency-dialog__head {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 16px;
  padding: 18px 22px; background: #061a33; color: #fff;
}
.emergency-dialog__head h2 { margin: 0; font-size: 1.22rem; }
.emergency-dialog__close { border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; }
.emergency-dialog__body { padding: 22px; }

.emergency-form { display: grid; gap: 16px; }
.emergency-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.emergency-field { display: grid; gap: 7px; }
.emergency-field label { font-size: .84rem; font-weight: 900; color: #26364c; }
.emergency-field input,
.emergency-field textarea,
.emergency-field select {
  width: 100%; border: 1px solid #cbd8e6; border-radius: 13px; padding: 12px 13px;
  font: inherit; color: #152033; background: #fff;
}
.emergency-field textarea { min-height: 112px; resize: vertical; }
.emergency-field input:focus,
.emergency-field textarea:focus,
.emergency-field select:focus { outline: 3px solid rgba(14, 90, 167, .16); border-color: #0e5aa7; }
.emergency-call-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.emergency-inline-btn {
  border: 0; border-radius: 12px; padding: 12px 15px; background: #0e5aa7; color: #fff;
  font: inherit; font-weight: 900; cursor: pointer; white-space: nowrap;
}
.emergency-location {
  border: 1px dashed #9db1c8; border-radius: 16px; padding: 14px; background: #f7faff;
}
.emergency-location__line { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.emergency-location p { margin: 6px 0 0; color: #617187; font-size: .84rem; }
.emergency-verify-result,
.emergency-form-message {
  display: none; border-radius: 13px; padding: 12px 14px; font-size: .9rem; line-height: 1.45;
}
.emergency-verify-result.is-visible,
.emergency-form-message.is-visible { display: block; }
.is-success { background: #e9f8f0; color: #0d6840; border: 1px solid #b9e5ce; }
.is-warning { background: #fff8e7; color: #77520b; border: 1px solid #efd59a; }
.is-error { background: #fff0ed; color: #8e2018; border: 1px solid #efc0b8; }
.emergency-consent { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem; color: #56657a; }
.emergency-consent input { margin-top: 4px; }
.emergency-submit {
  width: 100%; border: 0; border-radius: 14px; padding: 14px 18px;
  background: linear-gradient(135deg, #d7aa38, #f4d47b); color: #101820;
  font: inherit; font-weight: 900; cursor: pointer;
}
.emergency-submit:disabled { opacity: .55; cursor: wait; }
.emergency-warning {
  padding: 12px 14px; border-radius: 14px; background: #fff5e9; border: 1px solid #f1d5ad;
  color: #714918; font-size: .83rem; line-height: 1.5;
}
.emergency-center-page { min-height: 360px; }
.emergency-center-card {
  border: 1px solid #dbe5ef; border-radius: 24px; background: #fff; box-shadow: 0 22px 65px rgba(4,20,43,.12); overflow: hidden;
}
.emergency-center-card__top { padding: 22px; background: linear-gradient(135deg, #061a33, #0b4d7d); color: #fff; }
.emergency-center-card__top h2 { margin: 0 0 8px; }
.emergency-center-card__top p { margin: 0; color: rgba(255,255,255,.82); }
.emergency-center-card__body { padding: 22px; }
.emergency-center-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0; }
.emergency-center-stat { padding: 14px; border-radius: 16px; background: #f3f7fb; }
.emergency-center-stat strong { display: block; font-size: 1.45rem; color: #061a33; }
.emergency-center-stat span { color: #64748b; font-size: .83rem; }

@media (max-width: 640px) {
  .emergency-float { right: 14px; bottom: 14px; }
  .emergency-actions, .emergency-form__grid { grid-template-columns: 1fr; }
  .emergency-call-row { grid-template-columns: 1fr; }
  .emergency-location__line { align-items: flex-start; flex-direction: column; }
  .emergency-dialog__body { padding: 17px; }
}

.emergency-field small {
  color: #66758a;
  font-size: .78rem;
  line-height: 1.4;
}


/* Ubicación manual, confirmación y cierre fluido */
.emergency-location {
  display: grid;
  gap: 14px;
}
.emergency-location__title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.emergency-location__title p {
  margin: 5px 0 0;
}
.emergency-location__check {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: #dbe7f3;
  color: #6c7c8f;
  font-weight: 950;
  opacity: .45;
  transform: scale(.86);
  transition: .2s ease;
}
.emergency-location.is-confirmed {
  border-color: #65bb91;
  background: #effbf5;
  box-shadow: inset 0 0 0 1px rgba(19,117,71,.08);
}
.emergency-location.is-confirmed .emergency-location__check {
  background: #137547;
  color: #fff;
  opacity: 1;
  transform: scale(1);
}
.emergency-location__gps {
  width: 100%;
}
.emergency-location__separator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8090a3;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.emergency-location__separator::before,
.emergency-location__separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #d8e2ed;
}
.emergency-call-row--address {
  align-items: end;
}
.emergency-consent--public {
  padding: 14px;
  border-radius: 15px;
  background: #eef7ff;
  border: 1px solid #c9def3;
  color: #294e70;
}
.emergency-map-link {
  display: inline-flex;
  margin-top: 18px;
  font-weight: 900;
  color: #0e5aa7;
}
.emergency-float__links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.emergency-float__links a {
  color: #0e5aa7;
  font-weight: 900;
}
.emergency-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2500;
  width: min(620px, calc(100vw - 32px));
  padding: 15px 18px;
  border-radius: 16px;
  background: #061a33;
  color: #fff;
  box-shadow: 0 24px 70px rgba(3,14,29,.34);
  font-weight: 850;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: .22s ease;
}
.emergency-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.emergency-toast--success {
  background: #137547;
}
.emergency-toast--error {
  background: #a61b1b;
}

@media (max-width: 640px) {
  .emergency-call-row--address {
    grid-template-columns: 1fr;
  }
  .emergency-float__footer {
    align-items: flex-start;
  }
  .emergency-float__links {
    align-items: flex-start;
  }
}
