/* Modal de acceso de PIA (#authModal). Extraído de pia-landing-harmonious.css para que lo compartan el home, el dashboard y el resto de páginas. */
/* --------------------------------------------------------------------------
   18. Modal de acceso / registro (#authModal) -- fondo animado + login social
   -------------------------------------------------------------------------- *
   Recuperado tal cual del index.html anterior a la migración (docs/backups/
   index-2026-09-19-antes-de-migrar.html): el rediseño de la landing había
   perdido tanto el fondo de velas financieras animado (auth-dynamic-canvas +
   pia-auth-background.js) como el login social Google/Meta, dejando una
   tarjeta distinta a la que el usuario ya conocía. */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 48%, rgba(24, 38, 70, 0.52) 0%, rgba(15, 25, 48, 0.65) 52%, rgba(9, 14, 28, 0.78) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: hidden;
}

.auth-dynamic-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.70;
  transition: opacity 0.3s ease;
}

.auth-modal-card {
  --text-primary: #f8fafc;
  --text-secondary: #f1f5f9;
  --text-muted: #e2e8f0;
  --border-subtle: rgba(255, 255, 255, 0.18);
  --border-medium: rgba(255, 255, 255, 0.30);
  --border-focus: #38bdf8;
  --bg-surface: #ffffff;
  color: var(--text-primary, #f1f5f9);
  background: rgba(13, 20, 36, 0.45) !important;
  backdrop-filter: blur(8px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(8px) saturate(150%) !important;
  border: 1px solid rgba(255, 255, 255, 0.20) !important;
  border-radius: var(--radius-lg, 16px);
  max-width: 440px;
  width: 100%;
  padding: 20px 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.70), 0 0 45px rgba(56, 189, 248, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  position: relative;
  z-index: 2300 !important;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.auth-modal-card .form-group label {
  color: #f1f5f9 !important;
  font-weight: 600 !important;
  font-size: 0.90rem !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6) !important;
  display: block;
  margin-bottom: 5px;
}

.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.auth-modal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.auth-modal-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-modal-card #authModalTitle {
  margin: 0;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 1.32rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  color: #f8fafc !important;
  line-height: 1.25 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7) !important;
}

.auth-modal-card .input-field {
  background: #ffffff !important;
  opacity: 1 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: var(--radius-sm, 8px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-modal-card .input-field:focus {
  background: #ffffff !important;
  border-color: #0891b2 !important;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25) !important;
}

.auth-modal-card #authSubmitBtn {
  opacity: 1 !important;
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 0.98rem !important;
  letter-spacing: 0.015em !important;
  border: none !important;
  border-radius: var(--radius-sm, 8px) !important;
  padding: 10px 18px !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease !important;
  cursor: pointer;
}

.auth-modal-card #authSubmitBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1 0%, #0f766e 100%) !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5) !important;
  transform: translateY(-1px);
}

/* Botones de login social */
.oauth-btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.oauth-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  font-weight: 600;
  font-size: 0.90rem;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 0 20px;
  user-select: none;
}

.oauth-btn img {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
  flex-shrink: 0;
}

.oauth-btn span {
  text-align: center;
}

.oauth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-modal-card .oauth-btn-google {
  background: #ffffff !important;
  color: #1f2937 !important;
  border: 1px solid #cbd5e1 !important;
}

.auth-modal-card .oauth-btn-google:hover:not(:disabled) {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.auth-modal-card .oauth-btn-meta {
  background: #1877F2 !important;
  color: #ffffff !important;
  border: 1px solid #166fe5 !important;
}

.auth-modal-card .oauth-btn-meta:hover:not(:disabled) {
  background: #166fe5 !important;
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.35) !important;
}

.auth-modal-card #authTurnstileContainer {
  margin: 2px auto 8px auto !important;
  min-height: 56px;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  opacity: 0.80;
  transform: scale(0.85);
  transform-origin: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.auth-modal-card #authTurnstileContainer:hover,
.auth-modal-card #authTurnstileContainer:focus-within {
  opacity: 1;
  transform: scale(0.88);
}

.auth-modal-card #authTurnstileContainer iframe {
  border-radius: 8px !important;
}

/* Ventanita emergente no invasiva de indicadores de instrumentos (pia-auth-background.js) */
.pia-auth-instrument-popup {
  position: fixed;
  z-index: 2200;
  width: 324px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 16px;
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.85), 0 0 30px rgba(6, 182, 212, 0.30);
  padding: 18px 20px;
  color: #f8fafc;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  pointer-events: auto;
  animation: piaPopupFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  transform-origin: center center;
}

.pia-auth-instrument-popup::-webkit-scrollbar {
  width: 5px;
}

.pia-auth-instrument-popup::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.pia-auth-instrument-popup::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.4);
  border-radius: 4px;
}

@keyframes piaPopupFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.pia-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.pia-popup-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pia-popup-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pia-popup-symbol {
  font-weight: 800;
  font-size: 1.12rem;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.pia-popup-name {
  font-size: 0.84rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.pia-popup-badge {
  font-size: 0.70rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pia-popup-close {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  line-height: 1;
  border: none;
}

/* Área táctil de 44 px sin cambiar el tamaño visual. */
.pia-popup-close::after { content: ''; position: absolute; inset: -9px; }

.pia-popup-close:hover {
  background: rgba(255, 255, 255, 0.20);
  color: #ffffff;
}

.pia-popup-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.pia-popup-price {
  font-family: var(--mono, ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace);
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.pia-popup-change-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pia-popup-change-pill.is-up { color: #34d399; background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.35); }
.pia-popup-change-pill.is-down { color: #fb7185; background: rgba(244, 63, 94, 0.15); border: 1px solid rgba(244, 63, 94, 0.35); }

.pia-popup-footer {
  margin: 0;
  font-size: 0.75rem;
  color: #cbd5e1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

@media (max-width: 480px) {
  .auth-modal-card {
    padding: 22px 18px !important;
    max-width: 95% !important;
    margin: auto !important;
  }
  .auth-modal-logo {
    height: 28px !important;
  }
  .auth-modal-card #authModalTitle {
    font-size: 1.15rem !important;
  }
  .oauth-btn {
    height: 40px !important;
    font-size: 0.88rem !important;
    padding-left: 36px !important;
  }
  .oauth-btn img {
    left: 12px !important;
    width: 18px !important;
    height: 18px !important;
  }
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px;
  font-size: 0.86rem !important;
  font-weight: 600 !important;
  color: #cbd5e1 !important;
}

.oauth-divider span {
  background: rgba(15, 23, 42, 0.75);
  padding: 3px 12px;
  border-radius: 6px;
  color: #f1f5f9 !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.22) !important;
}

.auth-modal-card #authForgotPasswordLink:hover {
  color: #7dd3fc !important;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.7) !important;
}

.auth-modal-card #authToggleLink:hover {
  color: #7dd3fc !important;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.8) !important;
}

.auth-error-banner {
  display: none;
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #fda4af;
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Pantalla "Iniciar sesión en PIA" (pia-auth-modal.js): <dialog class="auth-dialog">
   --------------------------------------------------------------------------
   Todo lo nuevo cuelga de .auth-dialog para no tocar la copia en línea del modal
   que mantiene inversion-inmobiliaria.html (.modal-backdrop + .auth-modal-card).
   Los tokens del sitio (site.css) se leen con respaldo: el dashboard y el home
   anterior no los definen, y ahí la tarjeta queda en su versión clara. */
.auth-dialog {
  --auth-surface: var(--surface, #FFFFFF);
  --auth-surface-2: var(--surface-2, #EEF0F3);
  --auth-text: var(--text, #0F1720);
  --auth-text-2: var(--text-2, #566170);
  --auth-border: var(--border, #DDE1E7);
  --auth-border-strong: var(--border-strong, #C4CAD3);
  --auth-accent: var(--accent, #1F7A4C);
  --auth-accent-ink: var(--accent-ink, #FFFFFF);
  --auth-accent-soft: var(--accent-soft, rgba(31, 122, 76, 0.1));
  --auth-danger: var(--danger, #B3261E);
  --auth-radius: var(--r-card, 12px);
  --auth-radius-input: var(--r-input, 8px);
  --auth-ease-out: var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));

  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(420px, calc(100vw - 32px));
  width: 100%;
  max-height: none;
  overflow: visible;
  color: var(--auth-text);
  font-family: var(--font, inherit);
}
.auth-dialog::backdrop { background: rgba(8, 10, 14, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* Fondo animado de velas (pia-auth-background.js): ocupa la pantalla detrás de la tarjeta. */
.auth-dialog .auth-dynamic-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0.7;
  pointer-events: none;
  transition: none;
}
.auth-dialog.is-pointing::backdrop { cursor: pointer; }

.auth-card {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--auth-surface);
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  padding: 24px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
}
.auth-card *, .auth-card *::before, .auth-card *::after { box-sizing: border-box; }
.auth-card [hidden] { display: none !important; }
.auth-card :focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 2px; }
.auth-dialog .icon { width: 20px; height: 20px; flex: none; fill: currentColor; }

/* Entrada y salida: opacidad + escala corta, centrada (es un modal, no un popover). */
.auth-dialog[open] .auth-card { animation: auth-in 220ms var(--auth-ease-out) both; }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
.auth-dialog.is-closing .auth-card { animation: auth-out 150ms var(--auth-ease-out) both; }
@keyframes auth-out { to { opacity: 0; transform: scale(0.98); } }
.auth-dialog[open]::backdrop,
.auth-dialog[open] .auth-dynamic-canvas { animation: auth-fade-in 220ms var(--auth-ease-out) both; }
.auth-dialog.is-closing::backdrop,
.auth-dialog.is-closing .auth-dynamic-canvas { animation: auth-fade-out 150ms var(--auth-ease-out) both; }
@keyframes auth-fade-in { from { opacity: 0; } }
@keyframes auth-fade-out { to { opacity: 0; } }

.auth-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding-right: 40px;
}
.auth-logo { height: 28px; width: auto; flex: none; }
.auth-title {
  margin: 0;
  font-size: var(--fs-title, 1.35rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: var(--tr-title, -0.02em);
  color: var(--auth-text);
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--auth-text-2);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 140ms var(--auth-ease-out);
}
.auth-close:active { transform: scale(0.97); }

.auth-banner {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--auth-radius-input);
  font-size: 0.875rem;
  line-height: 1.45;
}
.auth-banner-error {
  color: var(--auth-danger);
  background: color-mix(in srgb, var(--auth-danger) 8%, var(--auth-surface));
  border: 1px solid color-mix(in srgb, var(--auth-danger) 35%, transparent);
}
.auth-banner-ok {
  color: var(--auth-text);
  background: var(--auth-accent-soft);
  border: 1px solid color-mix(in srgb, var(--auth-accent) 40%, transparent);
}
.auth-form .auth-banner { margin: 0 0 14px; }

.auth-oauth { display: grid; gap: 10px; }
.auth-oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--auth-radius-input);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 140ms var(--auth-ease-out);
}
.auth-oauth-btn img { width: 18px; height: 18px; flex: none; }
.auth-oauth-btn:active:not(:disabled) { transform: scale(0.97); }
.auth-oauth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
/* Colores de marca: Google pide fondo blanco con borde #747775; Meta, su azul #0866FF (4,8:1 con blanco). */
.auth-oauth-google { background: #FFFFFF; color: #1F1F1F; border: 1px solid #747775; }
.auth-oauth-meta { background: #0866FF; color: #FFFFFF; border: 1px solid #0866FF; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: 0.875rem;
  color: var(--auth-text-2);
}
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--auth-border); }

.auth-form { margin: 0; }
.auth-field { display: grid; gap: 6px; margin: 0 0 14px; }
.auth-label { font-size: 0.9rem; font-weight: 600; color: var(--auth-text); }
.auth-input {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--auth-text);
  background: var(--auth-surface);
  border: 1px solid var(--auth-border-strong);
  border-radius: var(--auth-radius-input);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.auth-input::placeholder { color: var(--auth-text-2); opacity: 1; }
.auth-card .auth-input:focus-visible {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent) 30%, transparent);
}

/* "Nombre completo" entra con altura animada (0fr -> 1fr). inert lo saca del foco cuando está cerrado. */
.auth-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 200ms var(--auth-ease-out), opacity 150ms ease;
}
.auth-collapse.is-open { grid-template-rows: 1fr; opacity: 1; }
.auth-collapse-inner { min-height: 0; overflow: hidden; padding: 3px; margin: -3px; }

.auth-pass { position: relative; }
.auth-pass .auth-input { padding-right: 48px; }
.auth-pass-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 100%;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0 var(--auth-radius-input) var(--auth-radius-input) 0;
  background: transparent;
  color: var(--auth-text-2);
  cursor: pointer;
  transition: color 150ms ease;
}
.auth-card .auth-pass-toggle:focus-visible { outline-offset: -4px; }

.auth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
  margin: -4px 0 10px;
}
.auth-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.auth-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--auth-accent); cursor: pointer; }
.auth-check label { font-size: 0.875rem; color: var(--auth-text); cursor: pointer; user-select: none; }
.auth-link {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--auth-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-turnstile { display: flex; justify-content: center; margin: 0 0 14px; }
.auth-turnstile:empty { display: none; }
.auth-gate-hint { margin: 0 0 12px; font-size: 0.875rem; line-height: 1.5; text-align: center; color: var(--text-secondary, #94a3b8); }
.auth-gate-hint[hidden] { display: none; }

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill, 999px);
  background: var(--auth-accent);
  color: var(--auth-accent-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms var(--auth-ease-out), background-color 150ms ease, opacity 150ms ease;
}
.auth-submit:active:not(:disabled) { transform: scale(0.97); }
.auth-submit:disabled { opacity: 0.7; cursor: not-allowed; }
.auth-submit[aria-busy="true"] { opacity: 1; cursor: progress; }
.auth-spinner { display: none; }
.auth-submit[aria-busy="true"] .auth-spinner { display: inline-block; animation: auth-spin 700ms linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 6px;
  margin: 16px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--auth-border);
  font-size: 0.9rem;
  color: var(--auth-text-2);
}
.auth-switch .auth-link { font-size: 0.9rem; }

@media (hover: hover) and (pointer: fine) {
  .auth-close:hover { background: var(--auth-surface-2); color: var(--auth-text); }
  .auth-oauth-google:hover:not(:disabled) { background: #F2F2F2; }
  .auth-oauth-meta:hover:not(:disabled) { background: #0759D8; border-color: #0759D8; }
  .auth-pass-toggle:hover { color: var(--auth-text); }
  .auth-submit:hover:not(:disabled) { background: color-mix(in srgb, var(--auth-accent) 88%, #000); }
  .auth-link:hover { text-decoration-thickness: 2px; }
}

@media (max-width: 480px) {
  /* --auth-vvh / --auth-vvtop los fija pia-auth-modal.js con visualViewport cuando el teclado está abierto. */
  .auth-dialog { max-width: 100vw; height: var(--auth-vvh, 100dvh); max-height: var(--auth-vvh, 100dvh); margin: 0; top: var(--auth-vvtop, 0px); }
  .auth-card {
    min-height: var(--auth-vvh, 100dvh);
    max-height: var(--auth-vvh, 100dvh);
    border: 0;
    border-radius: 0;
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  }
  .auth-dialog .auth-dynamic-canvas { display: none; }
}

/* Compacto: pantallas angostas o bajas. La pestaña "Iniciar sesión" debe caber sin scroll desde 320x568.
   Se reduce el espacio entre elementos, no el tamaño de los objetivos táctiles (siguen en 44 px o más). */
@media (max-width: 480px), (max-height: 700px) {
  .auth-card { padding: 14px 16px; }
  .auth-head { margin: 0 0 10px; gap: 10px; padding-right: 44px; }
  .auth-logo { height: 24px; }
  .auth-title { font-size: 1.125rem; }
  .auth-close { top: 4px; right: 4px; }
  .auth-banner { margin: 0 0 10px; padding: 8px 10px; font-size: 0.8125rem; }
  .auth-form .auth-banner { margin: 0 0 10px; }
  .auth-oauth { grid-template-columns: 1fr 1fr; gap: 8px; }
  .auth-oauth-btn { gap: 8px; padding: 0 8px; font-size: 0.9rem; }
  .auth-oauth-pre { display: none; }
  .auth-divider { margin: 10px 0; font-size: 0.8125rem; }
  .auth-field { gap: 4px; margin: 0 0 8px; }
  .auth-label { font-size: 0.8125rem; }
  .auth-row { margin: 0; }
  .auth-check label, .auth-link, .auth-switch .auth-link { font-size: 0.8125rem; }
  .auth-turnstile { zoom: 0.92; margin: 0 0 6px; }
  .auth-gate-hint { margin: 0 0 6px; font-size: 0.8125rem; line-height: 1.35; }
  .auth-switch { margin: 6px 0 0; padding-top: 0; font-size: 0.8125rem; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-dialog[open] .auth-card { animation: auth-fade-in 150ms ease-out both; }
  .auth-dialog.is-closing .auth-card { animation: auth-fade-out 150ms ease-out both; }
  .auth-dialog[open]::backdrop, .auth-dialog[open] .auth-dynamic-canvas { animation-duration: 150ms; }
  .auth-dialog.is-closing::backdrop, .auth-dialog.is-closing .auth-dynamic-canvas { animation-duration: 150ms; }
  .auth-collapse { transition: opacity 150ms ease; }
  .auth-submit[aria-busy="true"] .auth-spinner { display: none; }
  .pia-auth-instrument-popup { animation-duration: 1ms; }
}
