/* Controles compartidos de Spolum. Cargar después de main.css.
 * No modificar display/visibility: cada flujo decide cuándo mostrar el control.
 * Los selectores incluyen los IDs reales del chat para prevalecer sobre las
 * excepciones históricas de main.css sin duplicar reglas por pantalla.
 */
:root {
  --ui-control-size:44px;
  --ui-control-bg:#f3f4f6;
  --ui-control-fg:#4b5563;
  --ui-control-hover:#e5e7eb;
  --ui-header-inset:20px;
  --ui-title-size:24px;
}

/* Opciones de reporte: el texto determina la altura, nunca sale del botón. */
body .swal2-popup.uc-swal-report-actions {
  max-height:calc(100dvh - 24px)!important;
  padding-top:56px!important;
  overflow:hidden!important;
}
body .swal2-popup.uc-swal-report-actions .swal2-html-container {
  max-height:calc(100dvh - 80px)!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain;
}
body .ucp-report-sheet { min-height:0;padding:8px 20px calc(20px + var(--safe-bottom,0px)); }
body .ucp-report-badge { position:relative;top:auto;left:auto;transform:none;margin:0 auto 12px;width:40px;height:40px;border-radius:12px;box-shadow:none; }
body .ucp-report-badge::before { width:30px;height:30px; }
body .ucp-report-title { margin:4px 0 12px;line-height:1.25; }
body .ucp-report-station { max-width:100%;white-space:normal;overflow-wrap:anywhere;margin-bottom:20px;line-height:1.4; }
body .ucp-report-carousel {
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:10px!important;
  margin:0!important;padding:0!important;
  overflow:visible!important;scroll-snap-type:none;
}
body .ucp-report-carousel .report-card {
  width:100%!important;min-width:0!important;max-width:100%!important;
  min-height:52px;height:auto!important;
  padding:14px 16px!important;
  border:1px solid var(--c-border2)!important;border-radius:12px!important;
  background:var(--c-surface2)!important;color:var(--c-text)!important;
  font-size:15px!important;font-weight:600!important;line-height:1.4!important;
  justify-content:flex-start!important;text-align:left;
  white-space:normal!important;overflow-wrap:anywhere;
}
body .ucp-report-carousel .report-card span { min-width:0;max-width:100%;white-space:normal!important;overflow-wrap:anywhere; }
body .ucp-report-recent { min-height:44px;margin:12px 0 0!important;padding:10px 8px!important;color:var(--c-blue)!important;line-height:1.4;white-space:normal; }
body .ucp-report-reward { color:var(--c-muted);font-weight:400;line-height:1.5;margin-top:12px; }
body .ucp-report-carousel .report-card:focus-visible { outline:3px solid var(--c-blue);outline-offset:2px; }

/* Acciones con etiquetas largas: conservar el contenido a tamaños móviles. */
body :is(.ucp-menu-btn, .uc-notif-action, .uc-reservations-tabs button,
  .uc-wiz-choice, .trip-primary, .trip-secondary) {
  min-width:0;white-space:normal;overflow-wrap:anywhere;
  height:auto;min-height:48px;line-height:1.35;
}
body .ucp-menu-btn > span { min-width:0;white-space:normal;overflow-wrap:anywhere; }
body .uc-notif-action { padding:12px 10px; }
body .uc-reservations-tabs { grid-template-columns:repeat(2,minmax(0,1fr)); }
body .uc-notif-body { white-space:normal;overflow:visible;line-height:1.45; }
@media(max-width:360px) {
  body .uc-notif-actions { flex-wrap:wrap;gap:8px;padding-inline:16px; }
  body .uc-notif-action { flex:1 1 100%; }
  body .trip-actions { grid-template-columns:minmax(0,1fr); }
}
body.dark-mode {
  --ui-control-bg:#253246;
  --ui-control-fg:#e5e7eb;
  --ui-control-hover:#334155;
}

body :is(#closeChatBtn, .swal2-close, .uc-notif-close,
  .uc-hub-close, .uc-hub-root-back, .uc-hub-options-close, .trip-planner-close,
  #backChatBtn, .uc-auth-back, .uc-screen-back, .uc-hub-back,
  .uc-hub-view-back, .uc-recharge-back, .uc-mp-back, .uc-tarifa-back,
  .uc-calc-back, .uc-choice-back, .uc-ac-back) {
  box-sizing:border-box!important;
  width:var(--ui-control-size)!important;
  min-width:var(--ui-control-size)!important;
  max-width:var(--ui-control-size)!important;
  height:var(--ui-control-size)!important;
  min-height:var(--ui-control-size)!important;
  max-height:var(--ui-control-size)!important;
  flex:0 0 var(--ui-control-size)!important;
  padding:0!important;
  border:0!important;
  border-radius:50%!important;
  background:var(--ui-control-bg)!important;
  color:var(--ui-control-fg)!important;
  box-shadow:none!important;
  font-size:0!important;
  text-indent:0!important;
  line-height:1!important;
  text-align:center!important;
  align-items:center!important;
  justify-content:center!important;
  cursor:pointer;
  touch-action:manipulation;
}
body :is(#closeChatBtn, .swal2-close, .uc-notif-close,
  .uc-hub-close, .uc-hub-root-back, .uc-hub-options-close, .trip-planner-close,
  #backChatBtn, .uc-auth-back, .uc-screen-back, .uc-hub-back,
  .uc-hub-view-back, .uc-recharge-back, .uc-mp-back, .uc-tarifa-back,
  .uc-calc-back, .uc-choice-back, .uc-ac-back) > i { display:none!important; }

body :is(#closeChatBtn, .swal2-close, .uc-notif-close,
  .uc-hub-close, .uc-hub-root-back, .uc-hub-options-close, .trip-planner-close)::before {
  --ui-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 6 12 12M18 6 6 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  content:""!important;
  display:inline-block!important;
  width:24px!important;height:24px!important;
  background:currentColor!important;
  mask:var(--ui-icon) center/contain no-repeat;
  -webkit-mask:var(--ui-icon) center/contain no-repeat;
  vertical-align:middle;
}
body :is(#backChatBtn, .uc-auth-back, .uc-screen-back, .uc-hub-back,
  .uc-hub-view-back, .uc-recharge-back, .uc-mp-back, .uc-tarifa-back,
  .uc-calc-back, .uc-choice-back, .uc-ac-back)::before {
  --ui-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m14 5-7 7 7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  content:""!important;
  display:inline-block!important;
  width:24px!important;height:24px!important;
  margin:0!important;border:0!important;border-radius:0!important;
  transform:none!important;
  background:currentColor!important;
  mask:var(--ui-icon) center/contain no-repeat;
  -webkit-mask:var(--ui-icon) center/contain no-repeat;
  vertical-align:middle;
}
body :is(#closeChatBtn, .swal2-close, .uc-notif-close,
  .uc-hub-close, .uc-hub-root-back, .uc-hub-options-close, .trip-planner-close,
  #backChatBtn, .uc-auth-back, .uc-screen-back, .uc-hub-back,
  .uc-hub-view-back, .uc-recharge-back, .uc-mp-back, .uc-tarifa-back,
  .uc-calc-back, .uc-choice-back, .uc-ac-back):hover {
  background:var(--ui-control-hover)!important;
  color:var(--ui-control-fg)!important;
  transform:none!important;
}
body :is(#closeChatBtn, .swal2-close, .uc-notif-close,
  .uc-hub-close, .uc-hub-root-back, .uc-hub-options-close, .trip-planner-close,
  #backChatBtn, .uc-auth-back, .uc-screen-back, .uc-hub-back,
  .uc-hub-view-back, .uc-recharge-back, .uc-mp-back, .uc-tarifa-back,
  .uc-calc-back, .uc-choice-back, .uc-ac-back):focus-visible {
  outline:3px solid #1684d5!important;
  outline-offset:2px!important;
}

/* Cierres de diálogos: misma separación, sin activar controles ocultos. */
body .swal2-popup :is(.swal2-close, #closeChatBtn) {
  position:absolute!important;
  top:calc(12px + env(safe-area-inset-top,0px))!important;
  right:12px!important;
  margin:0!important;
  z-index:20!important;
}
body .uc-swal-auth .swal2-close { background:#fff!important;color:#4b5563!important; }
body .uc-notif-close { top:12px!important;right:12px!important; }
body .trip-planner-close { top:12px!important;right:12px!important; }
body .trip-planner-head { min-height:64px;height:auto;padding:8px 68px 12px; }
body .trip-planner-head h2 { white-space:normal;overflow-wrap:anywhere; }
body .chat-head { gap:10px; }
body .chat-head-info { min-width:0;flex:1; }
body #backChatBtn { margin:0; }
body #closeChatBtn { margin:0; }

/* Recuperación: título centrado, explicación debajo y regreso a la izquierda. */
body .uc-auth-recover-head {
  grid-template-columns:44px minmax(0,1fr) 44px;
  gap:0;
  align-items:start;
  margin-bottom:32px;
}
body .uc-auth-recover-head > div { display:contents; }
body .uc-auth-recover-head .uc-auth-back { grid-column:1;grid-row:1;align-self:center!important; }
body .uc-auth-recover-head h2 {
  grid-column:2;grid-row:1;
  align-self:center;min-height:44px;display:grid;align-content:center;
  text-align:center;font-size:var(--ui-title-size)!important;line-height:1.2;font-weight:800;
}
body .uc-auth-recover-head p { grid-column:1 / -1;grid-row:2;margin-top:16px;text-align:center; }
body :is(.uc-notif-head h2, .uc-reservations-popup .swal2-title) {
  font-size:var(--ui-title-size)!important;line-height:1.2!important;font-weight:800!important;
}
body .uc-notif-head { min-height:72px;padding:12px 68px; }
body .uc-notif-head h2 { min-width:0;overflow-wrap:anywhere;white-space:normal; }
body .uc-reservations-popup .swal2-title { margin:4px 0 20px!important;padding-inline:50px!important; }
body .uc-screen-head .uc-screen-title {
  font-size:var(--ui-title-size)!important;
  line-height:1.2!important;
  font-weight:800!important;
}

@media(max-width:700px) {
  :root { --ui-title-size:clamp(20px,5.6vw,24px); }
  body .uc-auth-recover { padding:calc(20px + var(--safe-top,0px)) var(--ui-header-inset) calc(22px + var(--safe-bottom,0px)); }
  body .uc-screen-head,
  body .uc-hub-panel.view-open .uc-hub-head.uc-screen-head {
    grid-template-columns:44px minmax(0,1fr) 44px!important;
    min-height:64px!important;height:auto!important;max-height:none!important;
    padding:8px var(--ui-header-inset)!important;
    margin-bottom:24px!important;
  }
  body .uc-screen-head .uc-screen-title { font-size:var(--ui-title-size)!important;line-height:1.2!important; }
}

/* Una sola silueta para el cuerpo y la punta del popup. */
body .ucp {
  box-shadow: none;
  filter: drop-shadow(0 18px 18px rgba(15, 23, 42, .18));
}
body.dark-mode .ucp {
  box-shadow: none;
  filter: drop-shadow(0 18px 21px rgba(0, 0, 0, .48));
}
body .ucp::after,
body.dark-mode .ucp::after {
  bottom: -13px;
  filter: none;
}
