/* Auth pages — match client panel (blue / sky corporate theme) */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap');

html.auth-html,
html:has(body.auth-page) {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

.auth-page {
    --auth-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #0ea5e9 100%);
    --auth-glow: rgba(59, 130, 246, 0.15);
    --auth-primary: #1e40af;
    --auth-primary-light: #3b82f6;
    --auth-accent: #0ea5e9;
    --auth-text: #0f172a;
    --auth-text-2: #334155;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-card: #ffffff;
    --auth-bg: #f1f5f9;

    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    font-family: 'DM Sans', system-ui, sans-serif;
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 0% 100%, rgba(14, 165, 233, 0.1) 0%, transparent 45%),
        linear-gradient(165deg, #f8fafc 0%, #eef2ff 40%, #f1f5f9 100%);
    color: var(--auth-text);
}

#auth-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

.auth-orbs {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.45;
    animation: authOrbFloat 10s ease-in-out infinite;
}
.auth-orb.a1 { width: 380px; height: 380px; background: #3b82f6; top: -8%; left: -5%; opacity: 0.22; }
.auth-orb.a2 { width: 300px; height: 300px; background: #0ea5e9; bottom: 5%; right: -5%; animation-delay: -3s; opacity: 0.18; }
.auth-orb.a3 { width: 220px; height: 220px; background: #1e40af; top: 40%; left: 55%; animation-delay: -5s; opacity: 0.14; }

@keyframes authOrbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(15px, -20px); }
}

.auth-page .auth-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 16px 12px 28px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    background: transparent;
}

.auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    align-items: start;
}

.auth-layout.register-layout {
    max-width: 1060px;
}

.auth-side {
    padding: 8px 4px;
}

.auth-side .site-logo {
    margin-bottom: 12px;
    width: 72px;
    height: 72px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25), 0 8px 20px rgba(30, 64, 175, 0.14);
}

.auth-card .site-logo,
.auth-card .auth-logo {
    display: block;
    margin: 0 auto 8px;
    width: 56px;
    height: 56px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2), 0 6px 14px rgba(30, 64, 175, 0.1);
}

@media (min-width: 861px) {
    .login-page .auth-card > .auth-logo,
    .register-page .auth-card > .auth-logo {
        display: none;
    }
}

.auth-card-mobile-head .site-logo {
    margin: 0 auto 10px;
}

.auth-side-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--auth-primary);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 12px;
    border: 1px solid rgba(59, 130, 246, 0.22);
}

.auth-side h2 {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: clamp(1.45rem, 2.8vw, 2rem);
    font-weight: 800;
    color: var(--auth-text);
    line-height: 1.28;
    margin-bottom: 10px;
    letter-spacing: 0;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
    font-stretch: normal;
    transform: none;
}

.auth-side h2 span {
    display: inline;
    background: var(--auth-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0;
    font-stretch: normal;
}

.auth-side p {
    color: var(--auth-muted);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 14px;
}

.auth-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.auth-pill {
    padding: 5px 10px;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--auth-text-2);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.05);
}

.auth-pill.blue { border-left: 3px solid #1e40af; }
.auth-pill.sky { border-left: 3px solid #3b82f6; }
.auth-pill.teal { border-left: 3px solid #0ea5e9; }

.auth-page .auth-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 16px 14px 18px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    box-shadow: 0 10px 32px rgba(30, 64, 175, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    border: 1px solid var(--auth-border);
    position: relative;
    overflow: visible;
    color: var(--auth-text);
}

.auth-page .auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--auth-gradient);
    border-radius: 16px 16px 0 0;
}

.auth-page .auth-card h1 {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--auth-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: clamp(1.2rem, 3.8vw, 1.45rem);
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: center;
    margin-bottom: 4px;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
    font-stretch: normal;
    transform: none;
}

.auth-page .auth-card .subtitle {
    text-align: center;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.auth-page .btn-primary {
    background: var(--auth-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 40px;
    font-size: 0.9rem;
    width: 100%;
    font-weight: 700;
    padding: 8px 12px;
}

.auth-page .form-group {
    margin-bottom: 10px;
}

.auth-page .form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    color: var(--auth-text-2);
}

.auth-page .form-group input,
.auth-page .form-group select {
    width: 100%;
    min-height: 40px;
    font-size: 16px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-stretch: normal;
    letter-spacing: 0;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--auth-border);
    background: #fff;
    color: var(--auth-text);
}

.auth-page .form-group input::placeholder { color: #94a3b8; }

.auth-page .form-group input:focus,
.auth-page .form-group select:focus {
    border-color: var(--auth-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

.auth-page .phone-input-group {
    display: grid;
    grid-template-columns: minmax(110px, 36%) 1fr;
    gap: 8px;
}

.auth-page .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.auth-page .password-wrap input {
    padding-right: 64px;
    min-height: 40px;
}

.auth-page .password-toggle {
    min-width: 40px;
    min-height: 36px;
    font-size: 0.75rem;
}

.auth-page .btn-primary:hover {
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.35);
}

.auth-page .btn-primary:active {
    transform: scale(0.98);
}

.auth-back {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--auth-muted);
    font-size: 0.78rem;
    margin-bottom: 6px;
    text-decoration: none;
}

.auth-back:hover { color: var(--auth-primary); }

.auth-page .auth-card .form-footer {
    text-align: center;
    font-size: 0.8rem;
    margin-top: 8px;
}

.auth-page .auth-card .subtitle,
.auth-page .auth-card .form-footer,
.auth-page .auth-card .form-footer a {
    color: var(--auth-muted);
}

.auth-page .auth-card .form-footer a {
    color: var(--auth-primary);
    font-weight: 600;
}

.auth-page .auth-card .form-footer a:hover { color: var(--auth-primary-light); }

.auth-card-mobile-head {
    display: none;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--auth-border);
}

.auth-card-mobile-head h2 {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--auth-text);
    margin: 6px 0 0;
    word-break: normal;
    overflow-wrap: break-word;
    font-stretch: normal;
    transform: none;
}

.auth-card-mobile-head h2 span {
    background: var(--auth-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== MOBILE ===== */
@media (max-width: 860px) {
    .auth-page .auth-wrapper {
        display: block;
        max-width: 100%;
        padding: 12px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .auth-layout,
    .auth-layout.register-layout {
        display: block;
        width: 100%;
    }

    .auth-side {
        display: none !important;
    }

    .auth-mobile-strip {
        display: none !important;
    }

    .auth-card-mobile-head {
        display: block;
    }

    .auth-page .auth-card {
        max-width: 100%;
        width: 100%;
        margin: 0;
        padding: 20px 16px 24px;
        border-radius: 16px;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .register-page .auth-card {
        max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .auth-page .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-page .phone-input-group {
        grid-template-columns: 1fr;
    }

    .auth-orb.a1 { width: 200px; height: 200px; opacity: 0.22; }
    .auth-orb.a2 { width: 160px; height: 160px; opacity: 0.18; }
    .auth-orb.a3 { display: none; }

    #auth-canvas {
        opacity: 0.4;
    }
}

@media (max-width: 480px) {
    .auth-page .auth-card {
        padding: 16px 14px 20px;
    }

    .auth-page .auth-card h1 {
        font-size: 1.25rem;
    }

    .auth-page .form-group {
        margin-bottom: 14px;
    }
}

.auth-page .alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.auth-page .alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.auth-page .sponsor-hint {
    color: var(--auth-muted);
    font-size: 0.82rem;
    margin-top: 6px;
}

.auth-page .sponsor-hint.found {
    color: #059669;
}

.auth-page .sponsor-hint.not-found {
    color: #dc2626;
}

.auth-page .password-toggle {
    color: var(--auth-muted);
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.auth-page .password-toggle:hover {
    color: var(--auth-primary);
    background: #e0e7ff;
}

.auth-office-address {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--auth-border);
    color: var(--auth-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.auth-office-address .auth-office-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--auth-primary);
}

.auth-office-address--card {
    display: none;
    margin-top: 16px;
    text-align: center;
}

@media (max-width: 860px) {
    .auth-office-address--card {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-orb { animation: none; }
}
