:root {
    --login-bg: #f5f0eb;
    --login-card: #fdfcfa;
    --login-orange: #ff6709;
    --login-orange-deep: #e55a00;
    --login-text: #14151a;
    --login-muted: #6b6f7a;
    --login-line: rgba(20, 21, 26, 0.12);
    --login-line-focus: rgba(20, 21, 26, 0.45);
    --login-shadow: 0 28px 80px rgba(28, 24, 20, 0.12), 0 8px 24px rgba(28, 24, 20, 0.06);
    --login-radius: 28px;
    --login-font: "Inter", system-ui, sans-serif;
    --login-display: "Poppins", "Inter", system-ui, sans-serif;
    --parrot-stack-max: 420px;
    --parrot-stack-h: 72%;
    --parrot-stack-bottom: 0;
    --parrot-pop-shift: min(4rem, 9vw);
    --parrot-object-x: 50%;
    --parrot-object-y: 100%;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body.login-page {
    font-family: var(--login-font);
    color: var(--login-text);
    background: var(--login-bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.login-shell {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.65rem, 2vw, 1.5rem);
}

.login-card {
    width: 100%;
    max-width: 1040px;
    max-height: calc(100dvh - 1.25rem);
    background: var(--login-card);
    border-radius: var(--login-radius);
    box-shadow: var(--login-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
}

/* ========== Parrot column ========== */
.login-parrot-col {
    flex: 0 0 42%;
    max-width: 42%;
    min-width: 0;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.login-parrot-orange {
    flex: 1;
    width: 100%;
    margin: clamp(0.65rem, 1.5vw, 1.25rem);
    border-radius: 22px;
    background: linear-gradient(165deg, var(--login-orange) 0%, var(--login-orange-deep) 100%);
    position: relative;
    overflow: hidden;
    min-height: 0;
    padding-inline: clamp(0.25rem, 1vw, 0.5rem);
}

.login-parrot-stack {
    position: absolute;
    left: 50%;
    bottom: var(--parrot-stack-bottom);
    transform: translateX(calc(-50% + var(--parrot-pop-shift)));
    width: min(var(--parrot-stack-max), 128%);
    height: var(--parrot-stack-h);
    max-height: calc(100% - 0.25rem);
    overflow: hidden;
    z-index: 2;
    pointer-events: none;
}

.login-parrot-character {
    position: relative;
    width: 100%;
    height: 100%;
}

.login-parrot-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: var(--parrot-object-x) var(--parrot-object-y);
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
}

.login-parrot-layer.is-active {
    z-index: 2;
    opacity: 1;
}

/* ========== Form column ========== */
.login-form-col {
    flex: 1 1 58%;
    min-width: 0;
    position: relative;
    z-index: 1;
    background: var(--login-card);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 3vw, 2.5rem);
    padding-left: clamp(1.5rem, 4vw, 3rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--login-text);
    margin-bottom: clamp(1rem, 2.5vw, 1.75rem);
    flex-shrink: 0;
}

.login-brand-logo-img {
    height: clamp(40px, 5vw, 52px);
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.login-brand-name {
    font-family: var(--login-display);
    font-weight: 700;
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.login-heading {
    font-family: var(--login-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 0.35rem;
    flex-shrink: 0;
}

.login-lead {
    color: var(--login-muted);
    font-size: clamp(0.88rem, 2vw, 0.96rem);
    margin: 0 0 clamp(1rem, 2vw, 1.5rem);
    max-width: 28rem;
    flex-shrink: 0;
}

.login-flash {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.login-flash-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.login-flash-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.login-flash-text {
    color: inherit;
    opacity: 0.92;
}

.login-flash-close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.login-flash-close:hover {
    opacity: 1;
}

.login-flash--info {
    background: #e8f4fd;
    border-color: #b8daf5;
    color: #1a4d72;
}

.login-flash--success {
    background: #e8f7ee;
    border-color: #b8e6c8;
    color: #1f5c36;
}

.login-flash--warning {
    background: #fff6e6;
    border-color: #f5d9a6;
    color: #7a4e00;
}

.login-flash--danger {
    background: #fdecea;
    border-color: #f5c2c0;
    color: #8a1f17;
}

.login-field {
    margin-bottom: clamp(1rem, 2vw, 1.4rem);
    flex-shrink: 0;
}

.login-field-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--login-muted);
    margin-bottom: 0.3rem;
}

.login-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1.5px solid var(--login-line);
    transition: border-color 0.25s ease;
}

.login-field-wrap:focus-within {
    border-bottom-color: var(--login-line-focus);
}

.login-input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.55rem 0 0.7rem;
    font-size: 1rem;
    color: var(--login-text);
    outline: none;
    min-width: 0;
}

.login-input::placeholder {
    color: rgba(107, 111, 122, 0.55);
}

.login-password-toggle {
    border: 0;
    background: transparent;
    padding: 0.35rem;
    margin-right: -0.25rem;
    color: var(--login-muted);
    cursor: pointer;
    border-radius: 8px;
    flex-shrink: 0;
}

.login-password-toggle:hover {
    color: var(--login-text);
    background: rgba(20, 21, 26, 0.05);
}

.login-password-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.3rem;
}

.login-forgot {
    font-size: 0.82rem;
    color: var(--login-orange);
    text-decoration: none;
    font-weight: 500;
}

.login-forgot:hover {
    text-decoration: underline;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--login-muted);
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.login-remember input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--login-orange);
}

.login-actions {
    margin-top: clamp(0.75rem, 2vw, 1.25rem);
    flex-shrink: 0;
}

.btn-login-primary {
    width: 100%;
    border: 0;
    background: linear-gradient(135deg, var(--login-orange) 0%, var(--login-orange-deep) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 1.25rem;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s;
    cursor: pointer;
}

.btn-login-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 12px 32px rgba(255, 103, 9, 0.35);
    transform: translateY(-1px);
}

.btn-login-primary:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.btn-login-primary.is-loading {
    opacity: 0.75;
    cursor: wait;
    transform: none;
}

.login-footer {
    margin-top: clamp(1rem, 2.5vw, 1.5rem);
    text-align: center;
    font-size: 0.85rem;
    color: var(--login-muted);
    flex-shrink: 0;
}

.login-footer a {
    color: var(--login-orange);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-powered {
    margin-top: clamp(0.75rem, 2vw, 1.25rem);
    text-align: center;
    font-size: 0.78rem;
    color: var(--login-muted);
    flex-shrink: 0;
}

.login-powered img {
    vertical-align: middle;
    margin-left: 0.35rem;
    max-height: 28px;
    width: auto;
}

/* Tablet landscape / pantallas bajas (ej. Redmi Pad 2 horizontal ~800px alto) */
@media (min-width: 768px) and (max-height: 860px) {
    .login-shell {
        padding: 0.5rem;
    }

    .login-card {
        max-height: calc(100dvh - 1rem);
    }

    .login-parrot-orange {
        margin: 0.5rem;
    }

    .login-parrot-stack {
        --parrot-stack-max: 340px;
        --parrot-pop-shift: min(2.5rem, 6vw);
        height: 78%;
    }

    .login-form-col {
        padding: 1rem 1.25rem;
        justify-content: center;
    }

    .login-brand {
        margin-bottom: 0.75rem;
    }

    .login-lead {
        margin-bottom: 0.75rem;
    }

    .login-field {
        margin-bottom: 0.85rem;
    }

    .login-flash {
        margin-bottom: 0.75rem;
        padding: 0.55rem 0.75rem;
    }

    .login-footer {
        margin-top: 0.75rem;
    }

    .login-powered {
        margin-top: 0.5rem;
    }
}

/* Tablet portrait: mantener 2 columnas desde 768px (Redmi Pad ~800px ancho) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .login-card {
        max-width: min(96vw, 900px);
    }

    .login-parrot-col {
        flex: 0 0 40%;
        max-width: 40%;
    }

    .login-form-col {
        flex: 1 1 60%;
        padding: 1.15rem 1.35rem;
    }

    .login-parrot-stack {
        --parrot-stack-max: 300px;
        --parrot-pop-shift: min(1.75rem, 5vw);
        height: 80%;
    }
}

/* Móvil: una columna, loro como banner compacto */
@media (max-width: 767.98px) {
    .login-shell {
        align-items: flex-start;
        padding: 0.5rem;
        min-height: 100dvh;
    }

    .login-card {
        flex-direction: column;
        flex-wrap: nowrap;
        max-width: 100%;
        max-height: none;
        border-radius: 22px;
    }

    .login-parrot-col {
        order: -1;
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        min-height: 0;
    }

    .login-parrot-orange {
        margin: 0.65rem 0.65rem 0;
        height: clamp(168px, 26dvh, 220px);
        min-height: 0;
        display: flex;
        align-items: flex-end;
        justify-content: center;
    }

    .login-parrot-stack {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;
        width: min(240px, 68%);
        height: 100%;
        max-height: 100%;
        --parrot-pop-shift: 0;
    }

    .login-form-col {
        flex: 1 1 auto;
        width: 100%;
        padding: 1rem 1.15rem 1.25rem;
        justify-content: flex-start;
        overflow-y: visible;
    }

    .login-brand {
        margin-bottom: 1rem;
    }

    .login-heading {
        font-size: 1.55rem;
    }

    .login-lead {
        margin-bottom: 1rem;
    }
}

@media (max-width: 399.98px) {
    .login-parrot-orange {
        height: clamp(150px, 24dvh, 190px);
        margin: 0.5rem 0.5rem 0;
    }

    .login-parrot-stack {
        width: min(200px, 72%);
    }

    .login-form-col {
        padding: 0.85rem 1rem 1rem;
    }

    .login-brand-logo-img {
        height: 36px;
    }

    .login-brand-name {
        font-size: 0.9rem;
    }
}
