:root {
  --comsec-blue: #2f7fc1;
  --comsec-blue-dark: #1d5fa6;
  --screen: #e9ecef;
  --screen-2: #dfe3e6;
  --text: #20252b;
  --muted: #777d84;
  --border: #cfd4d8;
  --nav-active: #4697f4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: #f4f6f8;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body { min-height: 100vh; min-height: 100dvh; }
#app { min-height: 100vh; min-height: 100dvh; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* ---------------- LOGIN ---------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 390px);
  background: #fff;
  border: 1px solid #e0e4e8;
  border-radius: 22px;
  padding: 30px 28px 28px;
  box-shadow: 0 16px 48px rgba(23, 33, 48, .14);
}

.login-brand {
  display: grid;
  place-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.login-brand .comsec-system-logo {
  width: 92px;
  height: 80px;
}

.login-subtitle {
  color: #6d737a;
  font-size: 13px;
}

.login-card h1 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 24px;
}

.login-help {
  margin: 0 0 22px;
  text-align: center;
  color: #747b82;
  font-size: 14px;
  line-height: 1.45;
}

.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; }
.login-form label span { font-size: 13px; font-weight: 600; }
.login-form input {
  width: 100%;
  height: 46px;
  border: 1px solid #cfd5db;
  border-radius: 10px;
  padding: 0 12px;
  outline: none;
  background: #fff;
}
.login-form input:focus {
  border-color: #3e8dd2;
  box-shadow: 0 0 0 3px rgba(62, 141, 210, .14);
}
.login-button {
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--comsec-blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.login-button:disabled { opacity: .65; }
.form-error {
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff1f0;
  color: #a61b17;
  font-size: 13px;
}

/* ---------------- APP ---------------- */
.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone-app {
  width: min(100%, 390px);
  height: min(780px, calc(100vh - 48px));
  min-height: 620px;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr) 68px;
  overflow: hidden;
  background: linear-gradient(180deg, #edf0f2 0%, #dfe3e6 100%);
  border: 1px solid #bfc5ca;
  border-radius: 24px;
  box-shadow: 0 18px 55px rgba(22, 31, 42, .22);
}

.app-header {
  display: grid;
  place-items: center;
  padding: 0 16px;
  background: linear-gradient(180deg, #4e98cf 0%, #387fb6 100%);
  border-bottom: 1px solid rgba(0, 0, 0, .18);
}

.community-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
}

.app-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 28px 24px 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,0) 28%),
    linear-gradient(180deg, #e5e8ea 0%, #d9dde0 100%);
}

.upper-row {
  display: grid;
  grid-template-columns: 104px 1fr 104px;
  align-items: start;
  justify-items: center;
  gap: 12px;
}

.round-icon {
  width: 100px;
  height: 100px;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: default;
}

.main-feature-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-center {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: start;
  padding-top: 4px;
}

.comsec-system-logo {
  display: block;
  width: 78px;
  height: 66px;
  object-fit: contain;
}

.version {
  margin-top: -2px;
  color: #222;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1;
}

.action-zone {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 30px;
  padding-bottom: 10px;
}

.alert-button,
.panic-button {
  padding: 0;
}

.alert-button { cursor: pointer; touch-action: manipulation; }
.alert-button:active { transform: scale(.94); }
.alert-button:disabled { cursor: wait; opacity: .65; }
.panic-button { cursor: pointer; touch-action: manipulation; }
.panic-button:active { transform: scale(.97); }

.alert-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 5px solid #eee9cf;
  background: radial-gradient(circle at 38% 30%, #fffbd3 0 13%, #ffe82e 28%, #ffc400 59%, #d29400 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.32), inset 0 1px 2px rgba(255,255,255,.9);
}

.panic-button {
  position: relative;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  border: 8px solid #f8f8f8;
  background: radial-gradient(circle at 40% 28%, #ffb7b3 0 7%, #ff4a43 18%, #e81712 56%, #c30a06 100%);
  box-shadow: 0 4px 5px rgba(0,0,0,.34), 0 0 0 2px #b6b6b6, inset 0 -5px 10px rgba(99,0,0,.28);
}

.panic-glare {
  position: absolute;
  width: 21px;
  height: 32px;
  left: 24px;
  top: 14px;
  transform: rotate(22deg);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,.94) 0, rgba(255,255,255,.35) 42%, rgba(255,255,255,0) 75%);
}

.bottom-nav {
  background: rgba(255,255,255,.98);
  border-top: 1px solid #d4d8dc;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 4px 6px;
}

.nav-item {
  min-width: 0;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: #777;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  font-size: 10px;
  cursor: default;
}

.nav-item.active { color: var(--nav-active); }
.nav-icon { width: 22px; height: 22px; }
.nav-icon svg { display: block; width: 100%; height: 100%; }
.static-control { pointer-events: none; }

/* Teléfono: ocupar exactamente el viewport visible de Safari/iPhone */
@media (max-width: 480px) {
  html, body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: #dfe3e6;
  }

  body.app-mode {
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.app-mode #app {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .page-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    place-items: stretch;
    overflow: hidden;
  }

  .phone-app {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    grid-template-rows:
      calc(50px + env(safe-area-inset-top, 0px))
      minmax(0, 1fr)
      calc(66px + env(safe-area-inset-bottom, 0px));
  }

  .app-header {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .bottom-nav {
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .app-content { padding: 22px 18px 12px; }
  .upper-row { grid-template-columns: 92px 1fr 92px; gap: 8px; }
  .round-icon { width: 88px; height: 88px; }
  .comsec-system-logo { width: 68px; height: 58px; }
  .version { font-size: 15px; }
  .community-name { font-size: 16px; }
  .action-zone { gap: 24px; padding-bottom: 8px; }
  .panic-button { width: 86px; height: 86px; }
}

@media (max-height: 680px) {
  .app-content { padding-top: 18px; }
  .upper-row { grid-template-columns: 82px 1fr 82px; }
  .round-icon { width: 78px; height: 78px; }
  .comsec-system-logo { width: 60px; height: 52px; }
  .action-zone { gap: 18px; }
  .panic-button { width: 76px; height: 76px; border-width: 7px; }
  .alert-button { width: 26px; height: 26px; border-width: 4px; }
}

/* ---------------- VENTANA COMUNIDAD ---------------- */
.feature-button {
  cursor: pointer;
  border-radius: 50%;
  transition: transform .12s ease, filter .12s ease;
}

.feature-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.feature-button:active {
  transform: scale(.97);
}

.feature-button:focus-visible {
  outline: 3px solid rgba(47, 127, 193, .35);
  outline-offset: 3px;
}

.community-modal-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.phone-app {
  position: relative;
}

.community-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 29, 38, .48);
  cursor: pointer;
}

.community-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 78%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #f8fafb;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 35px rgba(18, 28, 38, .26);
  animation: community-sheet-in .18s ease-out;
}

@keyframes community-sheet-in {
  from { transform: translateY(18px); opacity: .82; }
  to { transform: translateY(0); opacity: 1; }
}

.community-modal-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px 13px 20px;
  background: #fff;
  border-bottom: 1px solid #dde2e6;
}

.community-modal-eyebrow {
  margin-bottom: 2px;
  color: var(--comsec-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.community-modal-header h2 {
  margin: 0;
  max-width: 275px;
  color: #252b31;
  font-size: 18px;
  line-height: 1.2;
}

.community-modal-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #eef1f3;
  color: #596168;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.community-modal-body {
  min-height: 180px;
  overflow-y: auto;
  padding: 14px 14px 22px;
  -webkit-overflow-scrolling: touch;
}

.community-count {
  margin: 0 4px 10px;
  color: #737b82;
  font-size: 12px;
  font-weight: 600;
}

.community-list {
  display: grid;
  gap: 9px;
}

.community-member-card {
  min-height: 70px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e0e5e9;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(28, 39, 49, .05);
}

.community-member-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f2fb;
  color: var(--comsec-blue);
}

.community-member-icon svg {
  width: 24px;
  height: 24px;
}

.community-member-data {
  min-width: 0;
}

.community-member-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #242a30;
  font-size: 15px;
  font-weight: 750;
}

.community-member-owner {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b737a;
  font-size: 13px;
}

.community-modal-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #6f777e;
  text-align: center;
  font-size: 14px;
}

.community-modal-error {
  padding: 14px;
  border-radius: 12px;
  background: #fff1f0;
  color: #a61b17;
  font-size: 13px;
  line-height: 1.45;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d9e7f3;
  border-top-color: var(--comsec-blue);
  border-radius: 50%;
  animation: community-spin .8s linear infinite;
}

@keyframes community-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .community-modal {
    max-height: 82%;
  }

  .community-modal-header h2 {
    max-width: calc(100vw - 105px);
  }
}


/* ---------------- GRUPO FAMILIAR ---------------- */
.family-member-card {
  min-height: 66px;
}

.family-member-icon {
  background: #edf5fc;
}

.family-member-data {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.family-lastlogin {
  min-width: 108px;
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.family-lastlogin-label {
  color: #7b838a;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.family-lastlogin-value {
  color: #4f5961;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .family-member-card {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
    padding-left: 9px;
    padding-right: 9px;
  }

  .family-member-icon {
    width: 38px;
    height: 38px;
  }

  .family-member-data {
    gap: 8px;
  }

  .family-lastlogin {
    min-width: 94px;
  }

  .family-lastlogin-label {
    font-size: 9px;
  }

  .family-lastlogin-value {
    font-size: 10px;
  }
}

/* ---------------- CHAT COMUNITARIO ---------------- */
.chat-modal {
  max-height: 88%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #eef1f3;
}

.chat-modal-header {
  min-height: 82px;
}

.chat-community-name {
  margin-top: 3px;
  color: #737b82;
  font-size: 11px;
  font-weight: 600;
}

.chat-messages {
  min-height: 220px;
  overflow-y: auto;
  padding: 14px 11px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.45) 0 1px, transparent 1px) 0 0 / 18px 18px,
    #e5e8ea;
  -webkit-overflow-scrolling: touch;
}

.chat-empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #697178;
  text-align: center;
  font-size: 13px;
}

.chat-row {
  width: 100%;
  display: flex;
}

.chat-row-other { justify-content: flex-start; }
.chat-row-own { justify-content: flex-end; }

.chat-bubble {
  position: relative;
  width: fit-content;
  max-width: 82%;
  padding: 8px 10px 6px;
  border-radius: 13px;
  box-shadow: 0 1px 2px rgba(30, 39, 48, .13);
}

.chat-bubble-other {
  background: #fff;
  border-top-left-radius: 4px;
}

.chat-bubble-own {
  background: #d9f0ff;
  border-top-right-radius: 4px;
}

.chat-sender {
  margin-bottom: 3px;
  color: var(--comsec-blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.chat-message-text {
  color: #242a30;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-time {
  margin-top: 3px;
  color: #7a8289;
  font-size: 9px;
  line-height: 1;
  text-align: right;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #d8dde1;
}

.chat-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #cfd6dc;
  border-radius: 22px;
  background: #f7f9fa;
  color: #22282e;
  outline: none;
  font-size: 16px;
}

.chat-input:focus {
  border-color: #7fb3dc;
  box-shadow: 0 0 0 3px rgba(47, 127, 193, .12);
}

.chat-send {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--comsec-blue);
  color: #fff;
  cursor: pointer;
}

.chat-send:disabled,
.chat-input:disabled {
  opacity: .6;
}

.chat-send svg {
  width: 21px;
  height: 21px;
  transform: translateX(1px);
}

@media (max-width: 480px) {
  .chat-modal {
    max-height: 92%;
  }
}

/* ---------------- CABECERA CHAT / CIERRE DE EVENTO / MAPA ---------------- */
.chat-modal-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding-left: 10px;
  padding-right: 10px;
}

.chat-title-block {
  min-width: 0;
}

.chat-title-block h2 {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #eef1f3;
  color: #4f5961;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chat-header-button:disabled {
  opacity: .5;
  cursor: default;
}

.chat-header-button[hidden] {
  display: none !important;
}

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

.chat-back-button svg {
  width: 23px;
  height: 23px;
}

.chat-close-event {
  background: #fff0ef;
  color: #c51f1a;
  font-size: 28px;
  line-height: 1;
}

.event-map-layer {
  z-index: 30;
}

.event-map-modal {
  max-height: 92%;
  grid-template-rows: auto minmax(0, 1fr);
  background: #f5f7f8;
}

.event-map-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 76px;
  padding-left: 10px;
}

.event-map-title-wrap {
  min-width: 0;
}

.event-map-title-wrap h2 {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-map-body {
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.event-map-canvas {
  width: 100%;
  height: min(52vh, 430px);
  min-height: 300px;
  border: 1px solid #d6dde2;
  border-radius: 16px;
  overflow: hidden;
  background: #e9eef2;
}

.event-map-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #667079;
  text-align: center;
  font-size: 13px;
}

.event-map-legend {
  margin-top: 10px;
  display: grid;
  gap: 7px;
}

.event-map-legend > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 14px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid #e0e5e9;
  color: #5f6870;
  font-size: 11px;
}

.event-map-legend strong {
  color: #31383e;
  font-size: 12px;
}

.event-map-legend span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-map-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid;
}

.event-map-dot-home { border-color: #1d6fb8; }
.event-map-dot-emitter { border-color: #d32f2f; }

@media (max-width: 360px) {
  .chat-modal-header {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 6px;
    padding-left: 7px;
    padding-right: 7px;
  }

  .chat-header-button {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .chat-header-actions {
    gap: 3px;
  }

  .chat-title-block h2 {
    font-size: 15px;
  }

  .event-map-canvas {
    height: 46vh;
    min-height: 260px;
  }
}

/* ---------------- PULSACIÓN SEGURA 4 SEGUNDOS ---------------- */
.alert-button,
.panic-button {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.alert-button {
  position: relative;
}

.alert-button.is-holding::after,
.panic-button.is-holding::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .8);
  border-top-color: rgba(38, 91, 134, .95);
  border-right-color: rgba(38, 91, 134, .35);
  pointer-events: none;
  animation: emergency-hold-spin .8s linear infinite;
  box-shadow: 0 0 0 2px rgba(47, 127, 193, .14);
}

.alert-button.is-holding,
.panic-button.is-holding {
  filter: brightness(1.06);
}

@keyframes emergency-hold-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .alert-button.is-holding::after,
  .panic-button.is-holding::after {
    animation: none;
    border-color: rgba(38, 91, 134, .8);
  }
}

/* ---------------- ETAPA 13: BOTONES MÁS GRANDES + PROGRESO HORIZONTAL ---------------- */
.phone-app {
  position: relative;
}

.action-zone {
  justify-content: flex-end;
  gap: 38px;
  padding-bottom: 26px;
}

.alert-button {
  width: 52px;
  height: 52px;
  border-width: 7px;
  box-shadow:
    0 4px 7px rgba(0,0,0,.34),
    0 0 0 2px rgba(180, 146, 0, .18),
    inset 0 2px 3px rgba(255,255,255,.9);
}

.panic-button {
  width: 124px;
  height: 124px;
  border-width: 10px;
  box-shadow:
    0 7px 10px rgba(0,0,0,.34),
    0 0 0 2px #b6b6b6,
    inset 0 -7px 13px rgba(99,0,0,.30);
}

.panic-glare {
  width: 28px;
  height: 42px;
  left: 31px;
  top: 18px;
}

/* La barra cruza todo el ancho de la pantalla de la app y se sitúa justo sobre la navegación. */
.emergency-hold-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 68px;
  height: 6px;
  z-index: 30;
  overflow: hidden;
  background: rgba(255,255,255,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}

.emergency-hold-progress__bar {
  width: 0%;
  height: 100%;
  background: #e31b16;
  box-shadow: 0 0 6px rgba(190, 0, 0, .38);
}

.emergency-hold-progress.is-active {
  opacity: 1;
}

.emergency-hold-progress.is-active .emergency-hold-progress__bar {
  animation: emergency-screen-progress var(--hold-duration, 4000ms) linear forwards;
}

@keyframes emergency-screen-progress {
  from { width: 0%; }
  to { width: 100%; }
}

/* Quitamos el antiguo aro giratorio; el avance ahora se comunica solo con la línea horizontal. */
.alert-button.is-holding::after,
.panic-button.is-holding::after {
  content: none !important;
  animation: none !important;
}

.alert-button.is-holding,
.panic-button.is-holding {
  transform: scale(.97);
  filter: brightness(1.08);
}

@media (max-width: 520px) {
  .app-content {
    padding: 20px 18px 10px;
  }

  .action-zone {
    gap: 34px;
    padding-bottom: 22px;
  }

  .alert-button {
    width: 50px;
    height: 50px;
    border-width: 7px;
  }

  .panic-button {
    width: 116px;
    height: 116px;
    border-width: 9px;
  }

  .panic-glare {
    width: 26px;
    height: 39px;
    left: 29px;
    top: 17px;
  }

  .emergency-hold-progress {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-height: 720px) {
  .action-zone {
    gap: 24px;
    padding-bottom: 12px;
  }

  .alert-button {
    width: 44px;
    height: 44px;
    border-width: 6px;
  }

  .panic-button {
    width: 102px;
    height: 102px;
    border-width: 8px;
  }

  .panic-glare {
    width: 23px;
    height: 35px;
    left: 25px;
    top: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .emergency-hold-progress.is-active .emergency-hold-progress__bar {
    animation-timing-function: linear;
  }
}


/* Etapa 16: sesión persistente y cierre explícito */
.settings-modal {
  max-width: 440px;
}

.settings-modal-body {
  display: grid;
  gap: 18px;
}

.settings-account-card {
  padding: 18px;
  border-radius: 18px;
  background: #f4f7fa;
  border: 1px solid #dce4eb;
}

.settings-account-name {
  font-size: 18px;
  font-weight: 750;
  color: #25313d;
  margin-bottom: 4px;
}

.settings-account-email {
  font-size: 14px;
  color: #607080;
  overflow-wrap: anywhere;
}

.settings-session-note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #6a7784;
}

.logout-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: #b42318;
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.logout-button:active {
  transform: scale(.99);
}

.session-restoring-card {
  min-height: 300px;
  display: grid;
  align-content: center;
  gap: 24px;
}
