/* BioAnálisis — pantalla de inicio de sesión. Sin dependencias externas.
   Usa los mismos colores y componentes que css/styles.css (que solo se entrega con sesión iniciada). */

:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #e2e7ed;
  --text: #0f1b26;
  --text-2: #4a5a6a;
  --muted: #74828f;
  --accent: #0b7285;
  --accent-hover: #095c6c;
  --accent-ink: #ffffff;
  --crit: #d03b3b;
  --crit-soft: #fdecec;
  --crit-text: #a12626;
  --ok: #0ca30c;
  --side-bg: #0f1f2e;
  --side-text: #b8c5d1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 38, .05), 0 4px 16px rgba(15, 27, 38, .04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1117;
  --surface: #131b23;
  --surface-2: #19232d;
  --border: #25313d;
  --text: #f0f4f7;
  --text-2: #b3bfca;
  --muted: #8794a1;
  --accent: #3bb3c6;
  --accent-hover: #5cc5d6;
  --accent-ink: #05222a;
  --crit-soft: #3a1a1c;
  --crit-text: #f3a3a3;
  --side-bg: #0a141d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- Estructura ---------- */
.login { display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; min-height: 100%; }

.login-brand {
  background: var(--side-bg); color: var(--side-text);
  background-image: radial-gradient(circle at 15% 0%, rgba(20, 163, 184, .28), transparent 55%),
                    radial-gradient(circle at 100% 100%, rgba(11, 114, 133, .25), transparent 50%);
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 44px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(140deg, #14a3b8, #0b7285); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-text strong { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand-text small { color: var(--side-text); font-size: 12px; }
.login-pitch h2 { color: #fff; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; letter-spacing: -.02em; font-weight: 650; max-width: 16em; }
.login-pitch p { margin-top: 14px; font-size: 15.5px; max-width: 28em; }
.login-foot { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }

.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; animation: rise .3s ease both; }
.brand-sm { display: none; color: var(--text); font-size: 17px; margin-bottom: 8px; }
.login-card h1 { font-size: 26px; letter-spacing: -.02em; line-height: 1.2; }
.lead { color: var(--text-2); margin-top: -10px; margin-bottom: 4px; }

/* ---------- Formulario ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.input {
  height: 44px; width: 100%; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  padding: 0 12px; min-width: 0; color: var(--text); font-weight: 400; font-size: 16px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--crit); }

.pass { position: relative; display: block; }
.pass .input { padding-right: 46px; }
.pass-toggle {
  position: absolute; top: 2px; right: 2px; width: 40px; height: 40px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); display: grid; place-items: center;
}
.pass-toggle:hover { color: var(--text); background: var(--surface-2); }
.pass-toggle .ico-ocultar, .pass-toggle[aria-pressed="true"] .ico-ver { display: none; }
.pass-toggle[aria-pressed="true"] .ico-ocultar { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 44px; padding: 0 14px; margin-top: 4px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; white-space: nowrap; color: var(--text);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[disabled] { opacity: .7; cursor: progress; }
.spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.cargando .spinner { display: block; }

.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 9px;
  background: var(--crit-soft); color: var(--crit-text); border: 1px solid color-mix(in srgb, var(--crit) 35%, transparent);
  font-size: 13.5px; font-weight: 500;
}
.alert svg { width: 18px; height: 18px; margin-top: 1px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin-top: 4px; }
.noscript { padding: 24px; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Móvil ---------- */
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .brand-sm { display: flex; }
  .login-main { align-items: start; padding-top: max(40px, 12vh); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; }
  .spinner { animation-duration: 1.2s !important; }
}
