﻿:root {
    color-scheme: light;
    --login-primary: #4f6ef7;
    --login-primary-dark: #3c55d5;
    --login-dark: #0f1623;
    --login-ink: #111827;
    --login-muted: #6b7280;
    --login-border: #e4e8ef;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

body {
    margin: 0;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    color: var(--login-ink);
    background: #ffffff;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

.login-shell {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
    margin: 0;
    overflow: hidden;
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.login-showcase {
    position: relative;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 12% 12%, rgba(79, 110, 247, .28), transparent 32%),
        linear-gradient(145deg, #111a2a 0%, #0f1623 58%, #101929 100%);
}

.login-grid-pattern {
    position: absolute;
    inset: 0;
    opacity: .22;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    animation: loginFloat 9s ease-in-out infinite;
}

.login-orb-one {
    top: -120px;
    right: -90px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle at 35% 35%, rgba(95, 132, 255, .38), rgba(79, 110, 247, .04) 68%);
}

.login-orb-two {
    left: -120px;
    bottom: -150px;
    width: 390px;
    height: 390px;
    animation-delay: -3s;
    background: radial-gradient(circle at 55% 45%, rgba(42, 184, 230, .20), rgba(42, 184, 230, 0) 70%);
}

@keyframes loginFloat {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(0, 18px, 0) scale(1.04); }
}

.login-showcase-content {
    position: relative;
    z-index: 2;
    width: min(500px, 100%);
    padding: 50px 54px 30px;
}

.login-logo {
    width: 190px;
    height: auto;
    display: block;
    margin-bottom: 66px;
}

.login-showcase-copy {
    margin-bottom: 38px;
}

.login-showcase-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 17px;
    padding: 6px 10px;
    color: #bfcaff;
    background: rgba(79, 110, 247, .13);
    border: 1px solid rgba(124, 148, 255, .22);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.login-showcase-copy h1 {
    max-width: 500px;
    margin: 0 0 18px;
    color: #fff;
    font-size: clamp(31px, 3.2vw, 45px);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.1;
}

.login-showcase-copy p {
    max-width: 470px;
    margin: 0;
    color: #9aa9bc;
    font-size: 13px;
    line-height: 1.75;
}

.login-feature-list {
    display: grid;
    gap: 11px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: 13px;
    backdrop-filter: blur(8px);
}

.login-feature-icon {
    width: 37px;
    height: 37px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 37px;
    color: #aebcff;
    background: rgba(79, 110, 247, .15);
    border: 1px solid rgba(124, 148, 255, .17);
    border-radius: 10px;
    font-size: 15px;
}

.login-feature strong,
.login-feature small {
    display: block;
}

.login-feature strong {
    margin-bottom: 3px;
    color: #eef2ff;
    font-size: 11px;
    font-weight: 650;
}

.login-feature small {
    color: #8290a3;
    font-size: 9px;
    line-height: 1.45;
}

.login-showcase-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 21px 54px;
    color: #8290a3;
    border-top: 1px solid rgba(255, 255, 255, .06);
    font-size: 10px;
}

.login-status-dot {
    width: 7px;
    height: 7px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, .10);
}

.login-access {
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

.login-access-inner {
    width: min(390px, calc(100% - 60px));
    max-height: calc(100dvh - 58px);
    margin: auto;
    padding: clamp(18px, 5.5vh, 54px) 0 clamp(14px, 3.5vh, 34px);
}

.login-mobile-brand {
    display: none;
}

.login-form-heading {
    margin-bottom: 27px;
}

.login-heading-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: var(--login-primary);
    background: #eef2ff;
    border: 1px solid #dce3ff;
    border-radius: 13px;
    font-size: 17px;
}

.login-form-heading > span {
    display: block;
    margin-bottom: 7px;
    color: var(--login-primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.login-form-heading h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -.025em;
}

.login-form-heading p {
    margin: 0;
    color: #7b8494;
    font-size: 12px;
    line-height: 1.6;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 20px;
    padding: 12px 13px;
    color: #b91c1c;
    background: #fff7f7;
    border: 1px solid #fecaca;
    border-radius: 12px;
    animation: loginAlertIn .28s ease, loginShake .36s ease .28s;
}

@keyframes loginAlertIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes loginShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.login-alert-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    background: #fee2e2;
    border-radius: 9px;
    font-size: 13px;
}

.login-alert strong {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
}

.login-alert p {
    margin: 0;
    font-size: 10px;
    line-height: 1.5;
}

.login-field {
    margin-bottom: 17px;
}

.login-field label,
.login-label-row {
    color: #374151;
    font-size: 11px;
    font-weight: 650;
}

.login-field > label,
.login-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.login-label-row span {
    color: #a0a8b5;
    font-size: 9px;
    font-weight: 500;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa4b2;
    font-size: 14px;
    pointer-events: none;
}

.login-input-wrap input {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px 11px 42px;
    color: #253044;
    background: #fbfcfd;
    border: 1px solid var(--login-border);
    border-radius: 12px;
    outline: 0;
    font-size: 12px;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.login-password-wrap input {
    padding-right: 45px;
}

.login-input-wrap input::placeholder {
    color: #b0b7c2;
}

.login-input-wrap input:focus {
    background: #fff;
    border-color: #91a5ff;
    box-shadow: 0 0 0 4px rgba(79, 110, 247, .10);
}

.login-input-wrap input.input-validation-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .08);
}

.login-password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 33px;
    height: 33px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    color: #8b95a4;
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-size: 13px;
    cursor: pointer;
}

.login-password-toggle:hover {
    color: var(--login-primary);
    background: #f2f4ff;
}

.login-validation {
    display: block;
    min-height: 14px;
    margin-top: 5px;
    color: #dc2626;
    font-size: 9px;
}

.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 1px 0 23px;
    color: #5f6978;
    font-size: 10px;
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.login-checkmark {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    background: #fff;
    border: 1px solid #d7dce4;
    border-radius: 6px;
    font-size: 11px;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.login-remember input:checked + .login-checkmark {
    color: #fff;
    background: var(--login-primary);
    border-color: var(--login-primary);
}

.login-submit {
    width: 100%;
    min-height: 49px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #5877ff, #445fe2);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 12px 25px rgba(79, 110, 247, .24);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 15px 30px rgba(79, 110, 247, .30);
    filter: brightness(.99);
}

.login-submit:disabled {
    cursor: wait;
    transform: none;
    opacity: .9;
}

.login-submit-content,
.login-submit-loading {
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-submit-content {
    display: flex;
}

.login-submit-loading {
    display: none;
}

.login-submit.is-loading .login-submit-content {
    display: none;
}

.login-submit.is-loading .login-submit-loading {
    display: flex;
}

.login-button-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loginSpin .7s linear infinite;
}

@keyframes loginSpin {
    to { transform: rotate(360deg); }
}

.login-security-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 20px;
    color: #9ca3af;
    font-size: 9px;
    text-align: center;
}

.login-security-message i {
    color: #6f7c8d;
}

.login-access-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 20px;
    color: #a0a8b4;
    border-top: 1px solid #f0f2f5;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .06em;
}

.login-footer-separator {
    width: 3px;
    height: 3px;
    background: #c8cdd5;
    border-radius: 50%;
}

@media (max-width: 980px) {
    .login-shell {
        grid-template-columns: minmax(0, .9fr) minmax(390px, 1.1fr);
    }

    .login-showcase-content {
        padding-left: 38px;
        padding-right: 38px;
    }

    .login-showcase-footer {
        padding-left: 38px;
        padding-right: 38px;
    }

    .login-feature-list {
        display: none;
    }
}

@media (max-width: 760px) {
    body {
        background: #f4f6fa;
    }

    .login-shell {
        width: 100%;
        height: 100dvh;
        min-height: 0;
        grid-template-columns: 1fr;
        margin: 0;
        border-radius: 0;
    }

    .login-showcase {
        display: none;
    }

    .login-access {
        height: 100dvh;
        min-height: 0;
    }

    .login-mobile-brand {
        display: block;
        margin-bottom: 38px;
        padding: 13px 18px;
        background: #0f1623;
        border-radius: 14px;
    }

    .login-mobile-brand img {
        width: 145px;
        display: block;
        margin: 0 auto;
    }

    .login-access-inner {
        width: min(390px, calc(100% - 32px));
        max-height: calc(100dvh - 52px);
        padding: clamp(14px, 3.5vh, 28px) 0 clamp(10px, 2.5vh, 20px);
    }

    .login-heading-icon {
        display: none;
    }
}


/* Ajustes para pantallas de poca altura: evita scroll sin recortar el formulario. */
@media (min-width: 761px) and (max-height: 820px) {
    .login-showcase-content {
        width: min(480px, 100%);
        padding: clamp(24px, 4vh, 38px) 44px 18px;
    }

    .login-logo {
        width: 165px;
        margin-bottom: clamp(20px, 4.5vh, 40px);
    }

    .login-showcase-copy {
        margin-bottom: clamp(16px, 3vh, 26px);
    }

    .login-showcase-label {
        margin-bottom: 12px;
        padding: 5px 9px;
    }

    .login-showcase-copy h1 {
        margin-bottom: 12px;
        font-size: clamp(29px, 4.5vh, 39px);
        line-height: 1.06;
    }

    .login-showcase-copy p {
        font-size: 12px;
        line-height: 1.55;
    }

    .login-feature-list {
        gap: 8px;
    }

    .login-feature {
        padding: 10px 12px;
    }

    .login-feature-icon {
        width: 33px;
        height: 33px;
        flex-basis: 33px;
    }

    .login-showcase-footer {
        padding: 15px 44px;
    }

    .login-access-inner {
        padding-top: clamp(16px, 3vh, 28px);
        padding-bottom: clamp(10px, 2vh, 18px);
    }

    .login-form-heading {
        margin-bottom: 19px;
    }

    .login-heading-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 12px;
    }

    .login-form-heading h2 {
        font-size: 24px;
    }

    .login-field {
        margin-bottom: 12px;
    }

    .login-input-wrap input {
        min-height: 44px;
    }

    .login-remember {
        margin-bottom: 16px;
    }

    .login-submit {
        min-height: 45px;
    }

    .login-security-message {
        margin-top: 13px;
    }

    .login-access-footer {
        padding: 14px;
    }
}

@media (min-width: 761px) and (max-height: 650px) {
    .login-showcase-content {
        padding-top: 20px;
    }

    .login-logo {
        width: 145px;
        margin-bottom: 18px;
    }

    .login-showcase-copy h1 {
        font-size: clamp(26px, 5.2vh, 33px);
    }

    .login-showcase-copy p {
        line-height: 1.4;
    }

    .login-feature-list {
        grid-template-columns: 1fr 1fr;
    }

    .login-feature:last-child {
        display: none;
    }

    .login-form-heading {
        margin-bottom: 13px;
    }

    .login-heading-icon {
        display: none;
    }

    .login-form-heading > span {
        margin-bottom: 4px;
    }

    .login-form-heading h2 {
        margin-bottom: 4px;
        font-size: 22px;
    }

    .login-alert {
        margin-bottom: 10px;
        padding: 9px 11px;
    }

    .login-validation {
        min-height: 10px;
        margin-top: 2px;
    }

    .login-security-message {
        display: none;
    }
}

@media (max-width: 760px) {
    .login-mobile-brand {
        margin-bottom: clamp(16px, 4vh, 28px);
        padding: 10px 16px;
        border-radius: 12px;
    }

    .login-mobile-brand img {
        width: clamp(118px, 34vw, 145px);
    }

    .login-form-heading {
        margin-bottom: clamp(16px, 3vh, 23px);
    }

    .login-form-heading h2 {
        font-size: clamp(23px, 7vw, 27px);
    }

    .login-field {
        margin-bottom: clamp(10px, 2vh, 15px);
    }

    .login-input-wrap input {
        min-height: clamp(44px, 7vh, 48px);
    }

    .login-remember {
        margin-bottom: clamp(14px, 2.5vh, 21px);
    }

    .login-security-message {
        margin-top: clamp(11px, 2vh, 17px);
    }

    .login-access-footer {
        flex: 0 0 auto;
        padding: 13px;
    }
}

@media (max-width: 760px) and (max-height: 700px) {
    .login-mobile-brand {
        margin-bottom: 12px;
        padding: 8px 14px;
    }

    .login-mobile-brand img {
        width: 112px;
    }

    .login-form-heading {
        margin-bottom: 12px;
    }

    .login-form-heading > span {
        margin-bottom: 3px;
    }

    .login-form-heading h2 {
        margin-bottom: 4px;
        font-size: 22px;
    }

    .login-form-heading p {
        font-size: 10px;
        line-height: 1.35;
    }

    .login-alert {
        margin-bottom: 9px;
        padding: 8px 10px;
    }

    .login-field {
        margin-bottom: 8px;
    }

    .login-field > label,
    .login-label-row {
        margin-bottom: 4px;
    }

    .login-input-wrap input {
        min-height: 42px;
    }

    .login-validation {
        min-height: 8px;
        margin-top: 1px;
    }

    .login-remember {
        margin-bottom: 11px;
    }

    .login-submit {
        min-height: 43px;
    }

    .login-security-message {
        display: none;
    }

    .login-access-footer {
        padding: 9px;
    }
}

@media (max-width: 760px) and (max-height: 560px),
       (max-width: 920px) and (orientation: landscape) and (max-height: 520px) {
    .login-mobile-brand,
    .login-security-message,
    .login-access-footer {
        display: none;
    }

    .login-access-inner {
        width: min(520px, calc(100% - 28px));
        max-height: 100dvh;
        padding: 10px 0;
    }

    .login-form-heading {
        margin-bottom: 8px;
    }

    .login-form-heading p {
        display: none;
    }

    .login-field {
        margin-bottom: 5px;
    }

    .login-remember {
        margin-bottom: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   Selector de empresa - Etapa multiempresa
   ───────────────────────────────────────────────────────────── */
.empresa-selector-inner {
    width: min(560px, calc(100% - 56px));
}

.empresa-selector-list {
    display: grid;
    gap: 12px;
    max-height: min(44vh, 430px);
    overflow-y: auto;
    padding: 2px 4px 4px 2px;
    scrollbar-width: thin;
}

.empresa-selector-form {
    margin: 0;
}

.empresa-selector-card {
    width: 100%;
    border: 1px solid #e5e9f0;
    background: #fff;
    border-radius: 14px;
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.empresa-selector-card:hover {
    border-color: #9cabfb;
    box-shadow: 0 10px 26px rgba(39, 58, 120, .09);
    transform: translateY(-1px);
}

.empresa-selector-card:focus-visible {
    outline: 3px solid rgba(79, 110, 247, .2);
    outline-offset: 2px;
}

.empresa-selector-card:disabled {
    cursor: wait;
    opacity: .72;
}

.empresa-selector-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    flex: 0 0 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef1ff;
    color: #4f6ef7;
    font-size: 20px;
}

.empresa-selector-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.empresa-selector-content strong {
    color: #162033;
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empresa-selector-content small {
    color: #7c8798;
    font-size: 11px;
}

.empresa-selector-role {
    width: fit-content;
    margin-top: 3px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f2f5f9;
    color: #526174;
    font-size: 10px;
    font-weight: 600;
}

.empresa-selector-arrow {
    color: #a3adba;
    font-size: 18px;
    transition: transform .18s ease, color .18s ease;
}

.empresa-selector-card:hover .empresa-selector-arrow {
    color: #4f6ef7;
    transform: translateX(3px);
}

.empresa-selector-back {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #637083;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.empresa-selector-back:hover {
    color: #4f6ef7;
}

@media (max-width: 760px) {
    .empresa-selector-inner {
        width: min(560px, calc(100% - 28px));
    }

    .empresa-selector-list {
        max-height: 42vh;
    }

    .empresa-selector-card {
        padding: 12px 13px;
    }
}
