:root { --bg: #0a0e17; --surface: #111827; --surface2: #1a2235; --border: #1e2d45; --accent: #00d4ff; --accent2: #ff6b35; --accent3: #39ff14; --text: #e2e8f0; --muted: #64748b; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; min-height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }

/* ── GRID BACKGROUND ── */

.grid-bg { position: fixed; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 40px 40px; opacity: 0.3; pointer-events: none; }

/* ── GLOW ORBS ── */

.orb { position: fixed; border-radius: 50%; filter: blur(80px); pointer-events: none; opacity: 0.12; }
.orb-1 { width: 400px; height: 400px; background: var(--accent); top: -100px; left: -100px; animation: pulse 6s ease-in-out infinite alternate; }
.orb-2 { width: 300px; height: 300px; background: var(--accent2); bottom: -80px; right: -80px; animation: pulse 8s ease-in-out infinite alternate-reverse; }

@keyframes pulse {
    from { transform: scale(1); opacity: 0.12; }  
    to { transform: scale(1.2); opacity: 0.18; }
}

/* ── SCAN LINE ── */

.scanline { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: scan 4s linear infinite; opacity: 0.4; pointer-events: none; }
@keyframes scan {
    from { top: 0; }
    to { top: 100vh; }
}

/* ── LOGIN CARD ── */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px 36px; animation: fadeUp 0.5s ease both; position: relative; z-index: 10; width: 100%; max-width: 400px; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
}

/* Línea acento superior */
.card::before { content: ''; position: absolute; top: 0; left: 24px; right: 24px; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); border-radius: 2px; }

/* ── LOGO ── */

.login-icon { display: block; margin: 0 auto 16px; border-radius: 14px; }
.logo-wrap { text-align: center; margin-bottom: 32px; }
.logo { font-family: 'Space Mono', monospace; font-size: 1.4rem; color: var(--accent); letter-spacing: 0.08em; }
.logo span { color: var(--accent2); }
.logo-sub { font-size: 0.68rem; font-family: 'Space Mono', monospace; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; margin-top: 6px; }

/* ── FORM ── */

.field { margin-bottom: 16px; }
.field-label { font-family: 'Space Mono', monospace; font-size: 0.62rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: block; }
.field-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 6px; font-size: 0.88rem; font-family: 'DM Sans', sans-serif; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08); }
.field-input::placeholder { color: var(--muted); }

/* ── REMEMBER / FORGOT ── */

.row-options { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; font-size: 0.78rem; }
.remember { display: flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; user-select: none; }
.remember input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.forgot { color: var(--accent); text-decoration: none; font-size: 0.78rem; transition: color 0.2s; }
.forgot:hover { color: var(--accent2); }

/* ── SUBMIT BTN ── */

.btn-submit { width: 100%; padding: 11px; background: var(--accent); color: #000; border: none; border-radius: 6px; font-family: 'Space Mono', monospace; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; cursor: pointer; transition: background 0.2s, transform 0.1s, box-shadow 0.2s; text-transform: uppercase; }
.btn-submit:hover { background: #00bbdd; box-shadow: 0 0 20px rgba(0, 212, 255, 0.3); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── ERROR MSG ── */

.error-msg { display: none; background: rgba(255, 68, 68, 0.08); border: 1px solid rgba(255, 68, 68, 0.3); border-radius: 6px; padding: 9px 12px; font-size: 0.78rem; color: #ff6b6b; margin-bottom: 16px; font-family: 'Space Mono', monospace; }
.error-msg.visible { display: block; }

/* ── LOADING STATE ── */

.btn-submit.loading { position: relative; color: transparent; }
.btn-submit.loading::after { content: ''; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; border: 2px solid #000; border-top-color: transparent; border-radius: 50%; transform: translate(-50%, -50%); animation: spin 0.6s linear infinite; }

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── FOOTER ── */

.card-footer { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.version { font-family: 'Space Mono', monospace; font-size: 0.58rem; color: var(--muted); letter-spacing: 0.1em; }
.status-dot { display: flex; align-items: center; gap: 6px; font-family: 'Space Mono', monospace; font-size: 0.58rem; color: var(--accent3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent3); animation: blink 2s ease-in-out infinite; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Ojo para mostrar / ocultar la contraseña */
.password-wrap { position: relative; }
.password-wrap .field-input { padding-right: 42px; }
.btn-ojo { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 4px 6px; border-radius: 4px; line-height: 1; }
.btn-ojo:hover, .btn-ojo[aria-pressed="true"] { color: var(--accent); }
.btn-ojo:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Elegir empresa (persona con cuentas en varias empresas, 01-10-2026) */
body.eligiendo-empresa .card > .field,
body.eligiendo-empresa .card > .row-options,
body.eligiendo-empresa #loginBtn { display: none; }
.panel-empresas { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.lista-empresas { display: flex; flex-direction: column; gap: 8px; }
.btn-empresa {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    width: 100%; padding: 14px 16px; border-radius: 10px; cursor: pointer; text-align: left;
    background: var(--surface2, rgba(255,255,255,0.04)); color: var(--text, inherit);
    border: 1px solid var(--border, rgba(255,255,255,0.12)); font: inherit;
}
.btn-empresa:hover:not(:disabled), .btn-empresa:focus-visible { border-color: var(--accent, #00e5ff); outline: none; }
.btn-empresa:disabled { opacity: .6; cursor: wait; }
.empresa-nombre { font-weight: 600; }
.empresa-rol { font-size: .8rem; opacity: .7; }
.link-volver { background: none; border: 0; color: var(--accent, #00e5ff); cursor: pointer; font: inherit; font-size: .85rem; align-self: flex-start; padding: 4px 0; }

.panel-empresas[hidden] { display: none; }
