/* =====================================================================
   EMMA — Pantalla de acceso (login) · kit visual multinegocio
   Basado en el kit aprobado (clases .emma-*). Autocontenida: no depende
   de app.css para no chocar con el tema claro del resto del panel.
   ===================================================================== */
:root {
  --emma-bg:#17141f; --emma-surface:#24202e; --emma-primary:#8465f6;
  --emma-accent:#a18aff; --emma-hover:#7455e8; --emma-text:#fff;
  --emma-muted:#c8c3d0; --emma-placeholder:#9991ac; --emma-border:#625b70;
  --emma-error:#ffb4b4; --emma-warm:#f3eee7; --emma-radius:12px;
}

html, body { margin:0; background:var(--emma-bg); }
[x-cloak] { display:none !important; }

.emma-login,.emma-login * { box-sizing:border-box; }
.emma-login {
  margin:0; min-height:100dvh; position:relative; isolation:isolate;
  color:var(--emma-text); background:var(--emma-bg);
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);
  gap:48px; padding:48px clamp(24px,4vw,64px) 80px;
}
/* Fotografía de fondo (recurso independiente) + oscurecimiento/gradiente */
.emma-login::before,.emma-login::after { content:""; position:absolute; inset:0; z-index:-1; pointer-events:none; }
.emma-login::before { background:url('../img/login-agentes.svg') left bottom/cover no-repeat; }
.emma-login::after {
  background:linear-gradient(90deg,
    rgba(23,20,31,.08) 0%,
    rgba(23,20,31,.06) 40%,
    rgba(23,20,31,.85) 67%,
    rgba(23,20,31,.98) 100%);
}

/* ------------------------------- Marca ----------------------------- */
/* Reusa el logo del proyecto (brand-mark: "C" + CAP·IA), en claro. */
.emma-promo { display:flex; flex-direction:column; }
.brand-mark { display:inline-flex; align-items:center; gap:.65rem; text-decoration:none; font-weight:700; letter-spacing:-.025em; }
.brand-logo {
  width:44px; height:44px; border-radius:11px; flex:0 0 auto;
  background:linear-gradient(135deg, var(--emma-accent), var(--emma-primary));
  color:#fff; display:grid; place-items:center; font-weight:800; font-size:1.25rem;
  box-shadow:0 6px 18px rgba(132,101,246,.45);
}
.brand-name { font-size:1.6rem; color:var(--emma-text); letter-spacing:-.02em; }
.brand-name b { color:var(--emma-accent); font-weight:800; }

/* ------------------------------- Promo ----------------------------- */
.emma-hero { padding-top:40px; max-width:680px; }
.emma-hero h1 { font-size:clamp(40px,4.2vw,68px); line-height:1.08; letter-spacing:-.035em; margin:0 0 24px; font-weight:700; text-wrap:balance; }
.emma-hero h1 span { color:var(--emma-accent); display:block; }
.emma-hero p { font-size:clamp(18px,1.4vw,20px); line-height:1.5; margin:0; color:var(--emma-text); }
.emma-hero p span { display:block; }

/* ------------------------------- Panel ----------------------------- */
.emma-panel { width:100%; max-width:440px; justify-self:end; align-self:center; padding:32px 0; }
.emma-panel h2 { font-size:clamp(28px,2.4vw,36px); font-weight:600; letter-spacing:-.02em; line-height:1.2; margin:24px 0 10px; }
.emma-subtitle { color:var(--emma-muted); font-size:17px; line-height:1.5; margin:0 0 38px; }

.emma-field { margin-bottom:24px; }
.emma-field label { display:block; font-size:14px; font-weight:600; margin-bottom:10px; }
.emma-input-wrap { position:relative; display:flex; align-items:center; }
.emma-input-wrap input {
  width:100%; min-width:0; height:56px; border:1px solid var(--emma-border);
  border-radius:var(--emma-radius); background:rgba(255,255,255,.04);
  color:var(--emma-text); padding:0 48px; font:inherit; font-size:16px;
  transition:border-color .18s, box-shadow .18s;
}
.emma-input-wrap input::placeholder { color:var(--emma-placeholder); opacity:1; }
.emma-input-wrap input:focus { outline:none; border-color:var(--emma-accent); box-shadow:0 0 0 3px rgba(161,138,255,.18); }
.emma-input-wrap input[aria-invalid=true] { border-color:var(--emma-error); }
/* Autofill legible sobre fondo oscuro */
.emma-input-wrap input:-webkit-autofill,
.emma-input-wrap input:-webkit-autofill:focus {
  -webkit-text-fill-color:var(--emma-text); caret-color:var(--emma-text);
  transition:background-color 9999s ease-out 0s;
}
.emma-icon { position:absolute; left:18px; width:20px; height:20px; color:var(--emma-muted); pointer-events:none; }
.emma-input-wrap:focus-within .emma-icon { color:var(--emma-accent); }
.emma-password-toggle { position:absolute; right:6px; display:grid; place-items:center; width:44px; height:44px; border:0; background:none; color:var(--emma-muted); cursor:pointer; border-radius:8px; transition:color .18s; }
.emma-password-toggle:hover { color:var(--emma-text); }
.emma-password-toggle svg { width:20px; height:20px; }

.emma-options { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin:4px 0 24px; font-size:14px; }
.emma-remember { display:flex; align-items:center; gap:10px; min-height:32px; cursor:pointer; color:var(--emma-muted); user-select:none; }
.emma-remember input { width:20px; height:20px; accent-color:var(--emma-primary); margin:0; }
.emma-login a { color:var(--emma-accent); text-decoration:none; }
.emma-login a:hover { text-decoration:underline; }

.emma-submit { width:100%; min-height:56px; padding:14px 24px; display:flex; align-items:center; justify-content:center; gap:14px; background:var(--emma-primary); color:#fff; font:inherit; font-size:16px; font-weight:600; border:0; border-radius:var(--emma-radius); cursor:pointer; transition:background .18s, transform .12s; }
.emma-submit:hover { background:var(--emma-hover); }
.emma-submit:active { transform:translateY(1px); }
.emma-submit:disabled { opacity:.65; cursor:wait; }
.emma-submit svg { width:20px; height:20px; }
.emma-submit > span { display:inline-flex; align-items:center; gap:12px; }
.emma-spin { width:18px; height:18px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:emma-spin .7s linear infinite; }
@keyframes emma-spin { to { transform:rotate(360deg); } }

.emma-login :is(button,a,input[type=checkbox]):focus-visible { outline:3px solid var(--emma-accent); outline-offset:4px; }

.emma-tagline { margin:44px 0 0; text-align:center; color:var(--emma-muted); font-size:14px; }
.emma-tagline::before { content:""; display:block; width:36px; height:1px; background:var(--emma-muted); margin:0 auto 18px; }

.emma-error { font-size:14px; line-height:1.5; color:var(--emma-error); margin-top:8px; }
/* Avisos (flash) puntuales, no permanentes */
.emma-flash { font-size:14px; line-height:1.5; border:1px solid transparent; border-radius:10px; padding:11px 14px; margin-bottom:22px; }
.emma-flash--error { color:var(--emma-error); background:rgba(255,180,180,.09); border-color:rgba(255,180,180,.38); }
.emma-flash--ok { color:#b6e6c7; background:rgba(182,230,199,.09); border-color:rgba(182,230,199,.34); }

.emma-footer { position:absolute; bottom:24px; left:clamp(24px,4vw,64px); right:clamp(24px,4vw,64px); display:flex; justify-content:space-between; gap:20px; flex-wrap:wrap; font-size:12px; color:var(--emma-muted); }
.emma-footer nav { display:flex; gap:24px; }
.emma-footer a { color:var(--emma-muted); }

/* ============================= Responsive ========================== */
@media(max-width:1024px) {
  .emma-login { gap:32px; grid-template-columns:1.2fr 1fr; padding-left:32px; padding-right:32px; }
  .emma-hero h1 { font-size:48px; }
  .emma-hero p { font-size:18px; }
}
@media(max-width:760px) {
  .emma-login { display:flex; flex-direction:column; justify-content:center; padding:32px 24px; gap:24px; }
  .emma-promo { display:none; }
  .emma-panel { align-self:center; padding:16px 0; }
  .emma-login::after { background:rgba(23,20,31,.9); }
  .emma-login::before { background-position:35% center; }
  .emma-footer { position:static; margin-top:12px; justify-content:center; text-align:center; }
  .emma-panel h2 { font-size:30px; }
  .emma-tagline { margin-top:32px; }
}
@media(prefers-reduced-motion:reduce) {
  .emma-login * { transition:none!important; animation:none!important; }
  .emma-submit:active { transform:none; }
}
