/* ==========================================================================
   LOGIN — dos paneles: formulario a la izquierda y muro inclinado de maquetas a la derecha.
   Sigue el tema (data-theme claro/oscuro) y el color de acento del sistema.
   Todo va bajo .login-page para no tocar el resto del sistema.
   ========================================================================== */

.login-page {
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --accent: var(--system-accent, #007AFF);
  --accent-rgb: var(--system-accent-rgb, 0, 122, 255);
  --danger: #D70015;
  /* claro */
  --lp-bg: #ffffff; --lp-fg: #0b0b0d; --lp-mut: rgba(11, 11, 13, 0.58); --lp-line: rgba(11, 11, 13, 0.2);
  --lp-btn: #0b0b0d; --lp-btn-fg: #ffffff; --lp-wall: #ececf1; --lp-track: rgba(11, 11, 13, 0.18);
  position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  background: var(--lp-bg); color: var(--lp-fg); font-family: var(--font-family);
}
:root[data-theme="dark"] .login-page {
  --lp-bg: #000000; --lp-fg: #ffffff; --lp-mut: rgba(255, 255, 255, 0.62); --lp-line: rgba(255, 255, 255, 0.24);
  --lp-btn: #ffffff; --lp-btn-fg: #000000; --lp-wall: #0e0e11; --lp-track: rgba(255, 255, 255, 0.24); --danger: #ff6b6b;
}

.login-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }
.login-page.leaving .login-split { opacity: 0; transform: scale(0.985); }

/* ---------- Panel del formulario ---------- */
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.25rem, env(safe-area-inset-bottom)); }
.login-card { width: 100%; max-width: 440px; }
.login-inner { position: relative; }
.login-inner .s { animation: lg-sube 0.7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes lg-sube { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.login-head { text-align: center; margin-bottom: 2.2rem; }
.login-logo { width: 56px; height: 56px; margin: 0 auto 1.7rem; display: grid; place-items: center; border-radius: 17px; color: #fff; background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.78), var(--accent)); box-shadow: 0 12px 30px rgba(var(--accent-rgb), 0.35); animation: lg-sube 0.7s var(--ease) both; }
.login-title { margin: 0; font-size: clamp(1.9rem, 3.4vw, 2.5rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.login-sub { margin: 0.55rem 0 0; font-size: 1rem; color: var(--lp-mut); }

.login-fields { display: grid; gap: 0.75rem; }
.login-field { position: relative; height: 58px; }
.login-field input {
  width: 100%; height: 100%; padding: 22px 54px 6px 22px; border-radius: 999px; border: 1px solid var(--lp-line); outline: 0;
  background: transparent; color: var(--lp-fg); font: inherit; font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input:focus { border-color: var(--lp-fg); box-shadow: 0 0 0 2px var(--lp-bg), 0 0 0 4px var(--lp-fg); }
.login-field label { position: absolute; left: 23px; top: 50%; transform: translateY(-50%); color: var(--lp-mut); pointer-events: none; font-size: 1rem; transition: top 0.2s var(--ease), font-size 0.2s var(--ease), transform 0.2s var(--ease); }
.login-field input:focus + label, .login-field input:not(:placeholder-shown) + label, .login-field input:-webkit-autofill + label { top: 11px; transform: none; font-size: 0.7rem; letter-spacing: 0.02em; }
.login-field input:-webkit-autofill { -webkit-text-fill-color: var(--lp-fg); box-shadow: inset 0 0 0 100px var(--lp-bg); transition: background-color 9999s; }
.login-fields.has-error .login-field input { border-color: var(--danger); }

.reveal { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--lp-mut); cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s; }
.reveal:hover { background: color-mix(in srgb, var(--lp-fg) 10%, transparent); color: var(--lp-fg); }
.reveal:active { transform: translateY(-50%) scale(0.92); }
.reveal:focus-visible { outline: 2px solid var(--lp-fg); outline-offset: 1px; }
.reveal svg { grid-area: 1 / 1; transition: opacity 0.2s, transform 0.3s var(--ease); }
.reveal .off { opacity: 0; transform: scale(0.6) rotate(-20deg); }
.reveal[aria-pressed="true"] .on { opacity: 0; transform: scale(0.6) rotate(20deg); }
.reveal[aria-pressed="true"] .off { opacity: 1; transform: none; }

.collapse { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.3s var(--ease), opacity 0.25s; }
.collapse > div { overflow: hidden; min-height: 0; }
.collapse.open { grid-template-rows: 1fr; opacity: 1; }
.login-note, .login-msg { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.8rem 0.4rem 0; font-size: 0.875rem; line-height: 1.35; }
.login-note { color: #e08a00; }
.login-msg { color: var(--danger); font-weight: 500; }
.login-note svg, .login-msg svg { flex: none; margin-top: 1px; }


.login-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.1rem 0.3rem 1.2rem; }
.login-remember { display: inline-flex; align-items: center; gap: 0.65rem; font-size: 0.92rem; color: var(--lp-mut); cursor: pointer; user-select: none; }
.ios-switch { position: relative; flex: none; width: 44px; height: 26px; }
.ios-switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ios-switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--lp-track); transition: background 0.25s; }
.ios-switch .thumb { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--ease), width 0.2s; }
.ios-switch input:checked ~ .track { background: #34C759; }
.ios-switch input:checked ~ .thumb { transform: translateX(18px); }
.ios-switch input:focus-visible ~ .track { outline: 2px solid var(--lp-fg); outline-offset: 2px; }
.link-btn { border: 0; background: none; padding: 0.3rem 0.2rem; font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--lp-fg); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: 6px; }
.link-btn:hover { opacity: 0.7; }
.link-btn:focus-visible { outline: 2px solid var(--lp-fg); outline-offset: 2px; }

.login-btn { position: relative; width: 100%; height: 56px; display: grid; place-items: center; border: 0; border-radius: 999px; background: var(--lp-btn); color: var(--lp-btn-fg); font: inherit; font-size: 1.05rem; font-weight: 600; cursor: pointer; overflow: hidden; transition: transform 0.2s var(--ease), box-shadow 0.25s, background 0.3s, opacity 0.2s; }
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22); }
.login-btn:active { transform: scale(0.98); }
.login-btn:focus-visible { outline: 3px solid rgba(var(--accent-rgb), 0.55); outline-offset: 3px; }
.login-btn > * { grid-area: 1 / 1; }
.login-btn .lbl { transition: opacity 0.25s var(--ease), transform 0.35s var(--ease); }
.login-btn[data-state="loading"] .lbl, .login-btn[data-state="success"] .lbl { opacity: 0; transform: translateY(-10px); }
.login-btn[data-state="loading"] { cursor: progress; }
.login-btn .spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--lp-btn-fg) 28%, transparent); border-top-color: var(--lp-btn-fg); opacity: 0; transform: scale(0.6); transition: opacity 0.2s, transform 0.3s var(--ease); }
.login-btn[data-state="loading"] .spin { opacity: 1; transform: none; animation: lg-gira 0.8s linear infinite; }
.login-btn .check { opacity: 0; transform: scale(0.5); transition: opacity 0.25s var(--ease), transform 0.35s var(--ease); }
.login-btn .check path { stroke-dasharray: 26; stroke-dashoffset: 26; }
.login-btn[data-state="success"] { background: #34C759; color: #fff; }
.login-btn[data-state="success"] .check { opacity: 1; transform: none; }
.login-btn[data-state="success"] .check path { animation: lg-traza 0.45s var(--ease) 0.12s forwards; }
@keyframes lg-gira { to { transform: rotate(360deg); } }
@keyframes lg-traza { to { stroke-dashoffset: 0; } }

.login-legal { margin: 1.4rem 0.5rem 0; text-align: center; font-size: 0.82rem; line-height: 1.45; color: var(--lp-mut); }
.login-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; font-size: 0.78rem; font-weight: 600; color: var(--lp-mut); }
.login-foot i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.login-foot i:nth-child(1) { background: #0A84FF; } .login-foot i:nth-child(3) { background: #5E5CE6; } .login-foot i:nth-child(5) { background: #00C7BE; }
.login-foot-copy { margin-top: 1.6rem; text-align: center; font-size: 0.75rem; color: var(--lp-mut); opacity: 0.8; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shake { animation: lg-sacude 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes lg-sacude { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }

/* ---------- Muro inclinado de maquetas ---------- */
.login-muro { position: relative; overflow: hidden; background: var(--lp-wall); }
.muro-rot {
  position: absolute; left: 50%; top: 50%; width: 170%; height: 170%; display: flex; justify-content: center; gap: 22px;
  transform: translate(-50%, -50%) rotate(28deg); animation: lg-muro-entra 1.3s var(--ease) both;
}
@keyframes lg-muro-entra { from { opacity: 0; transform: translate(-50%, -46%) rotate(24deg) scale(1.08); } to { opacity: 1; transform: translate(-50%, -50%) rotate(28deg) scale(1); } }
.muro-col { flex: 0 0 min(200px, 15vw); display: flex; flex-direction: column; will-change: transform; backface-visibility: hidden; animation: lg-muro-sube 60s linear infinite; }
@keyframes lg-muro-sube { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, calc(var(--dist, 50%) * -1), 0); } }
.muro-set { display: flex; flex-direction: column; gap: 22px; padding-bottom: 22px; }
.login-muro.muro-pausa .muro-col { animation-play-state: paused; }

.tel { position: relative; width: 100%; aspect-ratio: var(--ar, 9 / 18.5); border-radius: 28px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; overflow: hidden; font-size: 11px; line-height: 1.25; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
:root[data-theme="dark"] .tel { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.tel h4 { margin: 4px 0 2px; font-size: 14px; font-weight: 800; letter-spacing: -0.01em; }
.tel small { font-size: 9.5px; opacity: 0.72; }
.t-bar { display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; font-weight: 700; padding: 0 4px; }
.t-bar i { width: 16px; height: 7px; border-radius: 3px; background: currentColor; opacity: 0.55; }
.t-grande { margin: 2px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.t-fila { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent); font-size: 10.5px; }
.t-fila b { font-weight: 700; white-space: nowrap; }
.t-dos { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.t-chip { padding: 3px 8px; border-radius: 99px; font-size: 9.5px; font-weight: 700; color: #fff; }
.t-barras { display: flex; align-items: flex-end; gap: 5px; height: 64px; margin-top: auto; }
.t-barras span { flex: 1; border-radius: 4px 4px 2px 2px; }
.t-linea { width: 100%; height: 54px; margin: 4px 0; }
.t-dona { width: 92px; height: 92px; margin: 6px auto; border-radius: 50%; background: conic-gradient(#0a84ff 0 31%, #bf5af2 31% 58%, #ff9f0a 58% 76%, #30d158 76% 100%); -webkit-mask: radial-gradient(circle 28px at center, transparent 98%, #000 100%); mask: radial-gradient(circle 28px at center, transparent 98%, #000 100%); }
.t-avs { display: flex; gap: -4px; }
.t-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; margin-right: 4px; }
.t-camion { width: 100%; margin: 8px 0; }
.t-burbuja { align-self: flex-start; max-width: 88%; padding: 7px 10px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, 0.2); font-size: 10.5px; }
.t-burbuja.t-resp { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: rgba(255, 255, 255, 0.92); color: #2b1055; font-weight: 600; }
.tel-cover { padding-top: 0; }
.t-portada { margin: 0 -14px 0; height: 62px; background: linear-gradient(120deg, #0a84ff, #bf5af2 55%, #ff9f0a); }
.tel-cover .t-bar { position: absolute; top: 12px; left: 14px; right: 14px; color: #fff; }
.t-avatar { width: 46px; height: 46px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #0a84ff, #5e5ce6); color: #fff; font-weight: 800; font-size: 15px; border: 3px solid #fff; }
.t-mat { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 4px 0; }
.t-mat span { aspect-ratio: 1; border-radius: 4px; background: #0a84ff; }
.t-user { display: flex; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.7); }
.t-user span:nth-child(2) { flex: 1; font-weight: 700; }
.t-aros { display: flex; justify-content: space-between; gap: 4px; margin: 6px 0; }
.t-aro { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, 0.14) 0); -webkit-mask: radial-gradient(circle 16px at center, transparent 98%, #000 100%); mask: radial-gradient(circle 16px at center, transparent 98%, #000 100%); }
.t-aro b { display: none; }

/* ---------- Pantallas pequeñas y accesibilidad ---------- */
@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-muro { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .login-inner .s, .login-logo, .muro-rot { animation: none; }
  .muro-col { animation: none; }
  .muro-set + .muro-set { display: none; }
  .login-split { transition: none; }
  .shake { animation: none; }
}

/* ---------- Recuperar contraseña ---------- */
.login-recup { display: flex; gap: 0.85rem; align-items: flex-start; margin: 0 0 1.2rem; padding: 1rem 1.1rem; border-radius: 20px; border: 1px solid var(--lp-line); background: color-mix(in srgb, var(--lp-fg) 5%, transparent); }
.login-recup-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.78), var(--accent)); }
.login-recup-txt h2 { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.login-recup-txt p { margin: 0 0 0.35rem; font-size: 0.88rem; line-height: 1.45; color: var(--lp-mut); }
.login-recup-txt .link-btn { padding-left: 0; }

/* ---------- Pantallas de marca (Farmamed, R&R y Sersumorca en claro y oscuro) ---------- */
.tel-marca { align-items: center; text-align: center; justify-content: flex-start; gap: 8px; }
.tel-marca .t-bar { align-self: stretch; }
.tel-marca h4 { margin: 2px 0 0; font-size: 15px; letter-spacing: -0.02em; }
.tel-marca small { font-size: 10px; opacity: 0.7; margin-top: -4px; }
.tel-marca .t-centro { justify-content: center; }
.tel-marca .t-logo { position: relative; z-index: 1; width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 6px 4px 0; }
.tel-marca .t-logo img { display: block; max-width: 90%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.14)); }
.t-halo { position: absolute; z-index: 0; left: 50%; top: 38%; width: 150%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; filter: blur(8px); pointer-events: none; }
.t-modo { position: absolute; z-index: 2; top: 34px; right: 12px; padding: 3px 8px; border-radius: 99px; font-size: 9px; font-weight: 800; letter-spacing: 0.02em; background: rgba(0, 0, 0, 0.07); color: inherit; }
.tel-oscuro .t-modo { background: rgba(255, 255, 255, 0.14); }
.t-metrica { position: relative; z-index: 1; align-self: stretch; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 15px; font-size: 10px; background: rgba(255, 255, 255, 0.72); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
.t-metrica b { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.tel-oscuro .t-metrica { background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.tel-marca .t-dos { position: relative; z-index: 1; }

.m-farma.tel-claro .t-halo { background: radial-gradient(circle, rgba(104, 190, 60, 0.28), rgba(30, 120, 214, 0.14) 45%, transparent 68%); }
.m-farma.tel-oscuro .t-halo { background: radial-gradient(circle, rgba(104, 210, 70, 0.34), rgba(30, 120, 214, 0.22) 46%, transparent 68%); }
.m-ryr.tel-claro .t-halo { background: radial-gradient(circle, rgba(245, 160, 0, 0.25), transparent 62%); }
.m-ryr.tel-oscuro .t-halo { background: radial-gradient(circle, rgba(255, 176, 32, 0.34), rgba(255, 120, 0, 0.1) 46%, transparent 66%); }
.m-ryr .t-logo img { max-width: 78%; }
.m-ryr.tel-claro .t-logo img { filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.22)); }
.m-sers.tel-claro .t-halo { background: radial-gradient(circle, rgba(32, 201, 151, 0.26), rgba(15, 96, 145, 0.1) 48%, transparent 68%); }
.m-sers.tel-oscuro .t-halo { background: radial-gradient(circle, rgba(32, 201, 170, 0.32), rgba(20, 90, 170, 0.2) 46%, transparent 68%); }
/* Sersumorca en vertical: las gotas arriba, el nombre debajo */
.m-sers .t-logo { gap: 12px; }
.m-sers .t-logo .mk { max-width: 50%; max-height: 52%; }
.m-sers .t-logo .nm { max-width: 90%; max-height: 22%; }
.m-sers.tel-oscuro .t-logo .nm { filter: invert(1) hue-rotate(180deg) brightness(1.08) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)); }
.m-sers.tel-oscuro .t-logo .mk { filter: brightness(1.3) saturate(1.15) drop-shadow(0 8px 18px rgba(32, 201, 170, 0.45)); }
.m-farma.tel-oscuro .t-logo img { filter: drop-shadow(0 8px 20px rgba(104, 210, 70, 0.3)); }
.m-ryr.tel-oscuro .t-logo img { filter: drop-shadow(0 8px 20px rgba(255, 176, 32, 0.28)); }
