:root {
    --auth-page-bg: #080914;
    --auth-surface: rgba(24, 22, 40, .82);
    --auth-surface-light: rgba(35, 35, 58, .92);
    --auth-accent: #2375ad;
    --auth-accent-bright: #25c4e8;
    --auth-text: #ffffff;
    --auth-muted: #a7a9b9;
    --auth-line: rgba(255, 255, 255, .16);
    --auth-danger: #ff98a8;
}

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

html, body {
    min-height: 100%;
}

body.auth-body {
    margin: 0;
    color: var(--auth-text);
    background: var(--auth-page-bg);
    font-family: 'Fira Sans Condensed', sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Base Desktop Layout (min-width: 1025px) */
.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(460px, .85fr);
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--auth-page-bg);
}

.auth-body-signup { overflow: hidden; }
.auth-body-signup .auth-page { min-height: 100dvh; }

/* Intro Left Column */
.auth-intro {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 0;
    padding: clamp(36px, 6vw, 100px);
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(6, 8, 20, .78) 0%, rgba(6, 8, 20, .48) 58%, rgba(9, 30, 54, .62) 100%),
        linear-gradient(180deg, rgba(4, 5, 14, .1), rgba(4, 5, 14, .64)),
        url('../images/auth-bg.jpg') center / cover;
}

.auth-intro::before,
.auth-intro::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(34, 191, 230, .22);
    border-radius: 50%;
    pointer-events: none;
}

.auth-intro::before {
    width: 620px;
    height: 620px;
    right: -290px;
    top: -220px;
    box-shadow: 0 0 0 42px rgba(34, 191, 230, .04), 0 0 0 84px rgba(34, 191, 230, .025);
}

.auth-intro::after {
    width: 280px;
    height: 280px;
    bottom: -150px;
    left: -110px;
}

.auth-intro-content { position: relative; z-index: 1; max-width: 520px; }

.auth-brand {
    display: inline-flex;
    align-items: center;
    color: var(--auth-text);
    font-family: Raleway, sans-serif;
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
}

.auth-brand img {
    width: auto;
    max-width: 205px;
    max-height: 66px;
    object-fit: contain;
}

.auth-intro h1 {
    max-width: 500px;
    margin: clamp(48px, 10vh, 120px) 0 20px;
    color: var(--auth-text);
    font-family: Raleway, sans-serif;
    font-size: clamp(36px, 4.2vw, 64px);
    line-height: 1.06;
    letter-spacing: -.03em;
}

.auth-intro p {
    max-width: 440px;
    margin: 0;
    color: rgba(255, 255, 255, .72);
    font-size: 18px;
    line-height: 1.55;
}

.auth-intro-rule {
    width: 90px;
    height: 2px;
    margin-top: 30px;
    background: var(--auth-accent-bright);
}

/* Panel Right Column */
.auth-panel {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: clamp(32px, 5vh, 64px) clamp(28px, 4.5vw, 80px);
    border-left: 1px solid rgba(255, 255, 255, .09);
    background:
        radial-gradient(circle at 20% 8%, rgba(42, 100, 145, .14), transparent 34%),
        linear-gradient(145deg, #11111f 0%, #090a15 100%);
    -webkit-overflow-scrolling: touch;
}

.auth-panel-signup { align-items: start; }

.auth-card { width: min(100%, 432px); }
.auth-card.auth-card-wide { width: min(100%, 548px); }

.auth-mobile-brand { display: none; margin-bottom: 28px; }

.auth-heading { margin-bottom: 28px; }

.auth-heading h2 {
    margin: 0 0 7px;
    color: var(--auth-text);
    font-family: Raleway, sans-serif;
    font-size: clamp(28px, 2.3vw, 36px);
    line-height: 1.15;
}

.auth-heading p { margin: 0; color: var(--auth-muted); font-size: 15.5px; }

.auth-status,
.auth-errors {
    margin: 0 0 22px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 141, 157, .35);
    border-radius: 8px;
    color: var(--auth-danger);
    background: rgba(255, 91, 115, .1);
    font-size: 14px;
}

.auth-status { border-color: rgba(34, 191, 230, .35); color: #8fe8ff; background: rgba(34, 191, 230, .1); }
.auth-errors { padding-left: 30px; }

.auth-field { margin-bottom: 18px; }

.auth-field label {
    display: block;
    margin-bottom: 7px;
    color: rgba(255, 255, 255, .9);
    font-size: 14.5px;
    font-weight: 500;
}

.auth-required { color: var(--auth-danger); }
.auth-input-wrap { position: relative; }

.auth-input {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 9px;
    outline: 0;
    color: var(--auth-text);
    background: var(--auth-surface);
    font-family: inherit;
    font-size: 16px; /* 16px strictly prevents iOS Safari auto-zoom */
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.auth-input::placeholder { color: #858494; }
.auth-input:hover { border-color: rgba(255, 255, 255, .28); }
.auth-input:focus {
    border-color: var(--auth-accent-bright);
    background: var(--auth-surface-light);
    box-shadow: 0 0 0 4px rgba(34, 191, 230, .12);
}
.auth-input.is-valid { border-color: #55bc91; }
.auth-input.is-invalid { border-color: var(--auth-danger); }
.auth-password-input { padding-right: 48px !important; }

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    color: var(--auth-muted);
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 6px;
    font-size: 16px;
    transition: color .2s ease;
}

.auth-password-toggle:hover { color: var(--auth-accent-bright); }
.auth-field-error { display: block; margin-top: 6px; color: var(--auth-danger); font-size: 13px; }
.auth-feedback { display: block; min-height: 16px; margin: 4px 0 0 2px; font-size: 12px; }
.auth-feedback:empty { display: none; }
.auth-feedback.success { color: #75d6aa; }
.auth-feedback.error { color: var(--auth-danger); }

.auth-field-status {
    position: absolute;
    top: 50%;
    right: 14px;
    display: none;
    transform: translateY(-50%);
    font-size: 17px;
    font-weight: 700;
}

.auth-field-status.show { display: block; }
.auth-field-status.available { color: #75d6aa; }
.auth-field-status.taken { color: var(--auth-danger); }
.auth-field-status.checking { color: var(--auth-accent-bright); animation: auth-pulse .8s infinite; }
@keyframes auth-pulse { 50% { opacity: .35; } }

.auth-password-hint { margin: 4px 0 0 2px; color: var(--auth-muted); font-size: 12px; }

.auth-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 22px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--auth-muted);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.auth-remember input { accent-color: var(--auth-accent-bright); width: 16px; height: 16px; cursor: pointer; }

.auth-form-links { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.auth-link, .auth-secondary-link, .auth-back-link { color: var(--auth-accent-bright); text-decoration: none; }
.auth-link:hover, .auth-secondary-link:hover, .auth-back-link:hover { color: #fff; }

.auth-recaptcha { margin-bottom: 18px; overflow-x: auto; max-width: 100%; }

.auth-submit {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-accent), var(--auth-accent-bright));
    box-shadow: 0 10px 24px rgba(13, 155, 212, .24);
    cursor: pointer;
    font: 600 16px 'Fira Sans Condensed', sans-serif;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(13, 155, 212, .34); }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: .7; cursor: wait; }

.auth-secondary-link { display: block; margin: 24px 0 0; color: var(--auth-muted); text-align: center; font-size: 14.5px; }
.auth-secondary-link a { color: var(--auth-accent-bright); font-weight: 500; text-decoration: none; }
.auth-back-link { display: inline-block; margin-top: 26px; color: var(--auth-muted); font-size: 14px; }

.auth-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.auth-field.full { grid-column: 1 / -1; }

.auth-plans-heading { margin: 4px 0 10px; color: rgba(255, 255, 255, .9); font-size: 14.5px; font-weight: 500; }
.auth-plans-list { display: grid; gap: 8px; margin-bottom: 22px; }

.auth-plan-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 9px;
    color: var(--auth-text);
    background: var(--auth-surface);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.auth-plan-option:hover,
.auth-plan-option:has(input:checked) {
    border-color: var(--auth-accent-bright);
    background: var(--auth-surface-light);
    box-shadow: 0 0 0 3px rgba(34, 191, 230, .1);
}
.auth-plan-option::before {
    content: '';
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px transparent;
}
.auth-plan-option:has(input:checked)::before {
    border-color: var(--auth-accent-bright);
    background: var(--auth-accent-bright);
    box-shadow: inset 0 0 0 3px #141527;
}
.auth-plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.auth-plan-info { min-width: 0; }
.auth-plan-name, .auth-plan-description { display: block; overflow-wrap: anywhere; }
.auth-plan-name { font-size: 15px; font-weight: 600; }
.auth-plan-description { margin-top: 2px; color: var(--auth-muted); font-size: 12px; }
.auth-plan-price { flex: 0 0 auto; color: var(--auth-accent-bright); font-size: 16px; font-weight: 700; text-align: right; white-space: nowrap; }
.auth-plan-duration { display: block; color: var(--auth-muted); font-size: 11px; font-weight: 400; text-align: right; }
.auth-no-plans { margin: 4px 0 20px; padding: 12px 14px; border: 1px solid rgba(255, 141, 157, .35); border-radius: 7px; color: var(--auth-danger); background: rgba(255, 91, 115, .1); font-size: 13px; }

/* OTP Component */
.auth-card-otp { text-align: center; }
.auth-otp-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border: 1px solid rgba(34, 191, 230, .22);
    border-radius: 18px;
    color: var(--auth-accent-bright);
    background: rgba(34, 191, 230, .1);
    font-size: 26px;
}
.auth-card-otp .auth-heading { margin-bottom: 22px; }
.auth-card-otp .auth-heading p { line-height: 1.55; }
.auth-otp-email {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
    color: var(--auth-text);
    font-weight: 600;
}
.auth-otp-input {
    height: 54px;
    padding-right: 14px;
    padding-left: calc(14px + .36em);
    text-align: center;
    letter-spacing: .36em;
    font-size: 24px;
    font-weight: 700;
}
.auth-otp-message { margin: -6px 0 12px; text-align: center; }
.auth-otp-success { margin: -6px 0 12px; color: #75d6aa; font-size: 13px; }
.auth-otp-form .auth-submit { margin-top: 15px; }
.auth-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.auth-otp-actions { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 22px; color: var(--auth-muted); font-size: 13.5px; }
.auth-otp-actions form { margin: 0; }
.auth-otp-actions button { padding: 0; border: 0; color: var(--auth-accent-bright); background: transparent; cursor: pointer; font: inherit; font-weight: 600; }
.auth-otp-actions button:hover { color: #fff; }
.auth-otp-actions button:disabled { opacity: .6; cursor: wait; }
.auth-otp-security { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid var(--auth-line); color: var(--auth-muted); font-size: 11px; line-height: 1.5; }

/* =========================================================
   TABLET & LAPTOP RESPONSIVE RULES (max-width: 1024px)
   Covers iPad Mini (768px), iPad (810px), iPad Air (820px),
   Surface (912px), and iPad Pro portrait (1024px)
========================================================= */
@media (max-width: 1024px) {
    .auth-page {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    body.auth-body,
    body.auth-body-signup {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .auth-body-signup .auth-page {
        min-height: 0;
    }

    .auth-intro {
        min-height: auto;
        padding: clamp(32px, 5vw, 56px) clamp(24px, 4vw, 48px);
        align-items: center;
        justify-content: center;
        text-align: left;
    }

    .auth-intro-content {
        max-width: 580px;
        margin: 0 auto;
        width: 100%;
    }

    .auth-intro h1 {
        margin: clamp(24px, 4vh, 40px) 0 12px;
        font-size: clamp(32px, 4.5vw, 44px);
    }

    .auth-intro p {
        font-size: 16px;
        max-width: 520px;
    }

    .auth-intro-rule {
        margin-top: 20px;
    }

    .auth-panel {
        max-height: none;
        overflow-y: visible;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, .09);
        padding: clamp(36px, 5vw, 56px) clamp(24px, 4vw, 48px);
        align-items: center;
    }

    .auth-card {
        margin-inline: auto;
        width: min(100%, 460px);
    }

    .auth-card.auth-card-wide {
        width: min(100%, 560px);
        margin-inline: auto;
    }
}

/* =========================================================
   MOBILE RESPONSIVE RULES (max-width: 767px)
   Covers standard smartphones (iPhone, Galaxy, Pixel, etc.)
========================================================= */
@media (max-width: 767px) {
    .auth-intro {
        padding: 24px 20px 20px;
    }

    .auth-brand img {
        max-height: 44px;
        max-width: 160px;
    }

    .auth-intro h1 {
        margin: 14px 0 6px;
        font-size: clamp(23px, 6vw, 30px);
        line-height: 1.15;
    }

    .auth-intro p {
        font-size: 13.5px;
        line-height: 1.45;
        max-width: 100%;
    }

    .auth-intro-rule {
        display: none;
    }

    .auth-panel {
        padding: 26px 16px 42px;
        padding-bottom: max(36px, env(safe-area-inset-bottom));
    }

    .auth-card,
    .auth-card.auth-card-wide {
        width: 100%;
        max-width: 100%;
    }

    .auth-heading {
        margin-bottom: 20px;
    }

    .auth-heading h2 {
        font-size: clamp(23px, 5.5vw, 28px);
        margin-bottom: 6px;
    }

    .auth-heading p {
        font-size: 13.5px;
    }

    .auth-field {
        margin-bottom: 14px;
    }

    .auth-field label {
        font-size: 13.5px;
        margin-bottom: 5px;
    }

    .auth-input {
        height: 48px;
        font-size: 16px;
        padding: 0 12px;
        border-radius: 8px;
    }

    .auth-submit {
        min-height: 48px;
        font-size: 15.5px;
        border-radius: 8px;
    }

    .auth-field-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-field.full {
        grid-column: auto;
    }

    .auth-form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin: 4px 0 20px;
    }

    .auth-form-links {
        width: 100%;
        justify-content: space-between;
        font-size: 13.5px;
    }

    .auth-remember {
        font-size: 13.5px;
    }

    .auth-secondary-link {
        margin-top: 18px;
        font-size: 13.5px;
    }

    .auth-back-link {
        margin-top: 20px;
        font-size: 13px;
    }

    /* Plan options in Signup */
    .auth-plan-option {
        padding: 10px 12px;
        gap: 10px;
        border-radius: 8px;
    }

    .auth-plan-name {
        font-size: 14px;
    }

    .auth-plan-price {
        font-size: 14.5px;
    }

    .auth-plan-duration {
        font-size: 10.5px;
    }

    /* OTP on Mobile */
    .auth-otp-icon {
        width: 54px;
        height: 54px;
        font-size: 24px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .auth-otp-input {
        height: 50px;
        font-size: clamp(20px, 5.5vw, 24px);
        letter-spacing: clamp(0.24em, 3.5vw, 0.4em);
        padding-left: calc(12px + clamp(0.24em, 3.5vw, 0.4em));
        border-radius: 8px;
    }

    .auth-otp-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px 8px;
        font-size: 13px;
    }
}

/* =========================================================
   COMPACT SMARTPHONES (max-width: 420px)
========================================================= */
@media (max-width: 420px) {
    .auth-intro {
        padding: 20px 14px 16px;
    }

    .auth-brand img {
        max-height: 38px;
        max-width: 140px;
    }

    .auth-intro h1 {
        font-size: 22px;
    }

    .auth-panel {
        padding: 20px 12px 34px;
    }

    .auth-input {
        height: 46px;
        font-size: 16px;
        padding: 0 11px;
    }

    .auth-recaptcha {
        transform: scale(0.88);
        transform-origin: 0 0;
        margin-bottom: 8px;
    }

    .auth-plan-option {
        padding: 9px 10px;
        gap: 8px;
    }

    .auth-plan-name {
        font-size: 13.5px;
    }

    .auth-plan-price {
        font-size: 13.5px;
    }
}

/* Landscape on short screens */
@media (max-height: 720px) and (min-width: 1025px) {
    .auth-intro h1 {
        margin-top: 36px;
    }
    .auth-panel {
        padding-top: 24px;
        padding-bottom: 24px;
    }
}

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