:root {
    --orqit-brand-dark: #0f172a;
    --orqit-brand-mid: #1e1b4b;
    --orqit-brand-light: #312e81;
    --orqit-accent: #6366f1;
    --orqit-accent-hover: #4f46e5;
    --orqit-portal-accent: #0e7490;

    --auth-bg: #f1f5f9;
    --auth-surface: #ffffff;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-input-bg: #ffffff;
    --auth-input-soft: #f8fafc;
    --auth-danger-bg: #fef2f2;
    --auth-danger-border: #fecaca;
    --auth-danger-text: #991b1b;
    --auth-success-bg: #ecfdf5;
    --auth-success-border: #a7f3d0;
    --auth-success-text: #065f46;
    --auth-shadow: 0 24px 54px rgba(15, 23, 42, 0.14);
    --auth-card-radius: 16px;
    --auth-input-radius: 12px;
}

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

body.orqit-auth-page {
    margin: 0;
    min-height: 100dvh;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--auth-text);
    background: var(--auth-bg);
    -webkit-font-smoothing: antialiased;
}

.auth-link {
    color: var(--orqit-accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover {
    color: var(--orqit-accent-hover);
    text-decoration: underline;
}

.auth-muted-link {
    color: var(--auth-muted);
    text-decoration: none;
    font-weight: 500;
}

.auth-muted-link:hover {
    color: var(--auth-text);
}

.auth-alert {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.875rem;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.auth-alert--error {
    background: var(--auth-danger-bg);
    border-color: var(--auth-danger-border);
    color: var(--auth-danger-text);
}

.auth-alert--success {
    background: var(--auth-success-bg);
    border-color: var(--auth-success-border);
    color: var(--auth-success-text);
}

.auth-input,
.workspace-input-wrap {
    height: 48px;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-input-radius);
    background: var(--auth-input-bg);
    transition: border-color .2s, box-shadow .2s;
}

.auth-input {
    width: 100%;
    padding: 0 14px;
    font-size: 0.95rem;
    color: var(--auth-text);
}

.auth-input:focus,
.workspace-input-wrap:focus-within,
.otp-box:focus {
    outline: none;
    border-color: var(--orqit-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.auth-input::placeholder {
    color: var(--auth-muted);
}

.btn-primary,
.btn-google,
.btn-ghost {
    height: 48px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    border: none;
    color: #ffffff;
    background: var(--orqit-accent);
    transition: background .2s;
}

.btn-primary:hover {
    background: var(--orqit-accent-hover);
}

.btn-ghost {
    border: 1.5px solid var(--auth-border);
    color: var(--auth-text);
    background: var(--auth-input-soft);
}

.btn-google {
    border: 1.5px solid var(--auth-border);
    color: var(--auth-text);
    background: #ffffff;
    transition: border-color .2s, box-shadow .2s;
}

.btn-google:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.or-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #94a3b8;
    font-size: 13px;
}

.or-divider::before,
.or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-tagline {
    margin: 10px 0 0;
    font-size: 1rem;
    color: #cbd5e1;
}

.auth-global-wrap {
    min-height: auto;
    padding: 34px 16px 110px;
    background: #f8fafc;
}

.auth-global-content {
    width: 100%;
    max-width: 510px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 8px 4px;
    animation: authCardIn .4s ease both;
}

.auth-global-content .auth-logo {
    color: var(--auth-text);
    text-align: left;
}

.auth-global-content .auth-tagline {
    color: var(--auth-muted);
    text-align: left;
    margin-bottom: 12px;
}

.workspace-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.workspace-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.workspace-input-wrap input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0 14px;
    height: 48px;
    font-size: 15px;
    color: var(--auth-text);
}

.workspace-input-wrap input::placeholder {
    color: var(--auth-muted);
}

.workspace-input-row .btn-primary {
    width: auto;
    min-width: 150px;
    flex: 0 0 auto;
    padding: 0 20px;
}

.workspace-input-wrap input:focus {
    outline: none;
}

.workspace-suffix {
    padding: 0 14px;
    color: var(--auth-muted);
    font-size: 14px;
    border-left: 1px solid var(--auth-border);
    height: 48px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    background: var(--auth-input-soft);
}

.auth-link-row {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.auth-global-stage {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(20px, 3.5vw, 40px);
}

.auth-hero-visual {
    position: relative;
    min-height: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    padding: 0;
}

.auth-hero-visual img {
    display: block;
    width: 100%;
    max-width: 620px;
    margin-left: auto;
    object-fit: contain;
}

.auth-global-title {
    margin: 0 0 6px;
    font-size: clamp(1.9rem, 3.6vw, 2.9rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.auth-global-copy {
    margin: 0 0 14px;
    color: var(--auth-muted);
    font-size: .98rem;
}

.auth-split {
    min-height: 100dvh;
    display: flex;
}

.auth-brand-panel {
    flex: 1 1 44%;
    color: #ffffff;
    padding: clamp(24px, 5vw, 56px);
    background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-brand-top {
    max-width: 460px;
}

.auth-brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.auth-tenant-logo {
    max-height: 44px;
    width: auto;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
}

.auth-brand-panel h1 {
    margin: 14px 0 8px;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.15;
}

.auth-brand-panel p {
    margin: 0;
    color: #cbd5e1;
}

.auth-feature-list {
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
}

.auth-feature-list li {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.2);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.92rem;
}

.auth-form-panel {
    flex: 1 1 56%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 4vw, 42px);
    background: var(--auth-bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: var(--auth-card-radius);
    border: 1px solid var(--auth-border);
    padding: 28px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
    animation: authCardIn .4s ease both;
}

.auth-card h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.auth-card-lead {
    margin: 0 0 18px;
    color: var(--auth-muted);
    font-size: 0.92rem;
}

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

.auth-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.84rem;
    font-weight: 600;
}

.password-wrap {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--auth-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.login-meta-row {
    margin: 4px 0 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.87rem;
    color: var(--auth-muted);
}

.pwd-strength {
    height: 4px;
    background: var(--auth-border);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.pwd-bar {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width .3s, background .3s;
}

.pwd-label {
    margin: 8px 0 0;
    font-size: 0.82rem;
    min-height: 1em;
}

.otp-wrap {
    min-height: 100dvh;
    background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.otp-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: var(--auth-card-radius);
    border: 1px solid var(--auth-border);
    box-shadow: var(--auth-shadow);
    padding: 28px;
    text-align: center;
    animation: authCardIn .4s ease both;
}

.otp-boxes {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-box {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    background: var(--auth-input-soft);
    transition: border-color .2s, box-shadow .2s;
}

.auth-portal .btn-primary {
    background: var(--orqit-portal-accent);
}

.auth-portal .btn-primary:hover {
    background: #0b5f77;
}

.auth-portal .auth-link {
    color: var(--orqit-portal-accent);
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .auth-split {
        flex-direction: column;
    }

    .auth-brand-panel {
        min-height: auto;
        padding: 16px 20px;
    }

    .auth-brand-panel h1,
    .auth-brand-panel p,
    .auth-feature-list {
        display: none;
    }
    .auth-global-stage {
        grid-template-columns: 1fr;
    }

    .auth-hero-visual {
        min-height: 0;
        order: 2;
        margin-top: 4px;
    }

    .auth-global-content {
        max-width: 100%;
    }

    .auth-hero-visual img {
        margin: 0 auto;
        max-width: 520px;
    }
}

@media (max-width: 640px) {
    .workspace-input-row {
        flex-direction: column;
    }

    .workspace-input-row .btn-primary {
        width: 100%;
    }

    .auth-global-content,
    .auth-card,
    .otp-card {
        padding: 10px 4px;
    }

    .otp-box {
        width: 44px;
        height: 52px;
        font-size: 20px;
    }

    .auth-global-wrap {
        padding: 10px 12px 14px;
    }

    .auth-global-title {
        font-size: 2rem;
    }
}
