/*
 * Sign-in and registration pages (shared design).
 * Palette and fonts match the public landing (Landing2).
 */
:root {
    --auth-brand-50: #f5f3ff;
    --auth-brand-100: #ede9fe;
    --auth-brand-500: #6366f1;
    --auth-brand-600: #4f46e5;
    --auth-brand-700: #4338ca;
    --auth-brand-900: #312e81;
    --auth-ink: #0f172a;
    --auth-text: #334155;
    --auth-muted: #64748b;
    --auth-line: #cbd5e1;
    --auth-danger: #dc2626;
    --auth-success: #059669;
}

body.auth-body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--auth-text);
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

.auth-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* ---------- Page shell ---------- */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    background: #f8fafc;
}

/* ---------- Brand panel ---------- */
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 48px clamp(32px, 5vw, 72px);
    color: #fff;
    background: linear-gradient(145deg, var(--auth-brand-900) 0%, var(--auth-brand-600) 58%, var(--auth-brand-500) 100%);
}

.auth-brand::before,
.auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-brand::before {
    width: 520px;
    height: 520px;
    top: -180px;
    right: -160px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%);
}

.auth-brand::after {
    width: 420px;
    height: 420px;
    bottom: -160px;
    left: -120px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.28), transparent 70%);
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    align-self: flex-start;
    font-family: "Outfit", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    text-decoration: none;
}

.auth-logo:hover {
    color: #fff;
}

.auth-logo-mark {
    width: 42px;
    height: 42px;
    display: block;
    flex-shrink: 0;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.auth-brand-body h1 {
    margin: 0 0 16px;
    max-width: 520px;
    font-family: "Outfit", sans-serif;
    font-size: clamp(1.9rem, 3.2vw, 2.9rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #fff;
}

.auth-lead {
    max-width: 480px;
    margin: 0 0 32px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.86);
}

.auth-benefits {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.auth-benefit-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-benefits strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.auth-benefits span:not(.auth-benefit-icon) {
    display: block;
    margin-top: 2px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.auth-brand-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
}

.auth-brand-foot .auth-icon {
    width: 1rem;
    height: 1rem;
}

/* ---------- Form panel ---------- */
.auth-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 24px clamp(20px, 4vw, 56px);
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--auth-muted);
    text-decoration: none;
}

.auth-back:hover {
    color: var(--auth-ink);
}

.auth-back .auth-icon {
    width: 1rem;
    height: 1rem;
}

.auth-card-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 0 16px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

.auth-head {
    margin-bottom: 28px;
}

.auth-head h2 {
    margin: 0 0 8px;
    font-family: "Outfit", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--auth-ink);
}

.auth-head p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--auth-muted);
}

.auth-brand-logo {
    display: block;
    max-width: 200px;
    max-height: 110px;
    margin: 0 0 20px;
    object-fit: contain;
}

/* ---------- Fields ---------- */
.auth-field {
    margin-bottom: 18px;
}

.auth-field > label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--auth-ink);
}

.auth-optional {
    font-weight: 400;
    color: var(--auth-muted);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    display: inline-flex;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    height: 50px;
    padding: 0 16px 0 44px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--auth-ink);
    background: #fff;
    border: 1.5px solid var(--auth-line);
    border-radius: 12px;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:hover {
    border-color: #94a3b8;
}

.auth-input:focus {
    border-color: var(--auth-brand-600);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
}

.auth-input.is-invalid {
    border-color: var(--auth-danger);
}

.auth-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.auth-input.has-toggle {
    padding-right: 48px;
}

.auth-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #94a3b8;
    background: transparent;
    border: 0;
    border-radius: 8px;
    transform: translateY(-50%);
    cursor: pointer;
}

.auth-toggle:hover {
    color: var(--auth-ink);
    background: #f1f5f9;
}

.auth-toggle .icon-hide {
    display: none;
}

.auth-toggle.is-visible .icon-show {
    display: none;
}

.auth-toggle.is-visible .icon-hide {
    display: inline-flex;
}

.auth-hint {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--auth-muted);
}

.auth-field-error,
.field-validation-error.auth-field-error {
    display: block;
    min-height: 0;
    margin-top: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--auth-danger);
}

.auth-field-error:empty {
    display: none;
}

.auth-alert,
.validation-summary-errors.auth-alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
}

.auth-alert ul {
    margin: 0;
    padding-left: 18px;
}

.auth-alert.validation-summary-valid {
    display: none;
}

.auth-alert.is-info {
    color: #1e3a8a;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.auth-alert.is-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.auth-forgot {
    margin: -6px 0 18px;
    text-align: right;
    font-size: 0.9rem;
}

.auth-forgot a {
    font-weight: 600;
    color: var(--auth-brand-600);
    text-decoration: none;
}

.auth-forgot a:hover {
    color: var(--auth-brand-700);
    text-decoration: underline;
}

/* ---------- Checkbox ---------- */
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--auth-text);
    cursor: pointer;
}

.auth-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--auth-brand-600);
    cursor: pointer;
}

/* ---------- Buttons ---------- */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 22px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 150ms cubic-bezier(0.23, 1, 0.32, 1), background-color 150ms ease, box-shadow 150ms ease;
}

.auth-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.auth-btn:disabled {
    cursor: wait;
    opacity: 0.75;
}

.auth-btn-block {
    width: 100%;
}

.auth-btn-primary {
    color: #fff;
    background: var(--auth-brand-600);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

.auth-btn-primary:hover:not(:disabled) {
    background: var(--auth-brand-700);
}

.auth-btn-ghost {
    color: var(--auth-text);
    background: #fff;
    border-color: var(--auth-line);
}

.auth-btn-ghost:hover:not(:disabled) {
    background: #f1f5f9;
}

.auth-btn .auth-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.auth-btn.is-loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

.auth-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.auth-actions .auth-btn-primary {
    flex: 1;
}

.auth-switch {
    margin: 24px 0 0;
    font-size: 0.95rem;
    text-align: center;
    color: var(--auth-muted);
}

.auth-switch a {
    margin-left: 4px;
    font-weight: 600;
    color: var(--auth-brand-600);
    text-decoration: none;
}

.auth-switch a:hover {
    color: var(--auth-brand-700);
    text-decoration: underline;
}

.auth-note {
    margin: 16px 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
    color: var(--auth-muted);
}

/* ---------- Registration steps ---------- */
.auth-steps {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.auth-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-muted);
}

.auth-step-num {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--auth-muted);
    background: #e2e8f0;
    border-radius: 50%;
    transition: background-color 150ms ease, color 150ms ease;
}

.auth-step-item.is-active {
    color: var(--auth-ink);
}

.auth-step-item.is-active .auth-step-num {
    color: #fff;
    background: var(--auth-brand-600);
}

.auth-step-item.is-done .auth-step-num {
    color: #fff;
    background: var(--auth-success);
    font-size: 0;
}

.auth-step-item.is-done .auth-step-num::before {
    content: "\2713";
    font-size: 0.9rem;
}

.auth-step-line {
    flex: 1;
    height: 2px;
    min-width: 24px;
    background: #e2e8f0;
}

.auth-step-section {
    display: none;
}

.auth-step-section.is-active {
    display: block;
    animation: auth-fade 280ms ease;
}

@keyframes auth-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* Honeypot: invisible for people, tempting for bots. */
.auth-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Branded variant (external and company sign-in) ---------- */
.auth-page.is-branded {
    grid-template-columns: minmax(0, 1fr);
    background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 60%);
}

.auth-page.is-branded .auth-card {
    padding: 36px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .auth-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-brand {
        gap: 12px;
        padding: 20px 24px;
    }

    .auth-brand-body,
    .auth-brand-foot {
        display: none;
    }

    .auth-panel {
        padding: 16px 20px 28px;
    }

    .auth-card-wrap {
        align-items: flex-start;
        padding-top: 20px;
    }
}

@media (max-width: 480px) {
    .auth-head h2 {
        font-size: 1.65rem;
    }

    .auth-page.is-branded .auth-card {
        padding: 24px 20px;
    }

    .auth-step-item span:last-child {
        display: none;
    }

    .auth-step-item.is-active span:last-child {
        display: inline;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-btn,
    .auth-input,
    .auth-step-section.is-active,
    .auth-btn.is-loading::after {
        animation-duration: 0s !important;
        transition-duration: 0s !important;
    }
}


/* Free trial highlight (register page) */
.auth-trial {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid #a7f3d0;
    border-radius: 0.75rem;
    background: #ecfdf5;
    color: #065f46;
    font-size: 0.875rem;
    line-height: 1.4;
}

.auth-trial strong {
    display: block;
    font-size: 1rem;
    color: #047857;
}

.auth-trial-icon {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--auth-success);
}

.auth-pill {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.auth-trial-icon svg {
    width: 100%;
    height: 100%;
}

/* Terms / privacy acceptance checkbox (register) */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--auth-brand-600);
}

.auth-check a {
    font-weight: 600;
    color: var(--auth-brand-600);
}

/* Legal links under the auth card */
.auth-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
    padding: 16px 12px 20px;
    font-size: 0.8rem;
}

.auth-legal-links a,
.auth-legal-links button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--auth-muted);
    text-decoration: none;
    cursor: pointer;
}

.auth-legal-links a:hover,
.auth-legal-links button:hover {
    color: var(--auth-brand-700);
    text-decoration: underline;
}