:root {
    --brand: #6d28d9;
    --brand-dark: #5520ad;
    --brand-light: #f1ebff;
    --ink: #121321;
    --muted: #687085;
    --line: #e5e7ef;
    --surface: #ffffff;
    --success: #168557;
    --danger: #c6374c;
    --shadow: 0 24px 70px rgba(31, 19, 55, 0.12);
}

* {
    box-sizing: border-box;
}

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

body.auth-page {
    margin: 0;
    color: var(--ink);
    background: #fff;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(520px, 0.92fr) minmax(560px, 1.08fr);
}

.auth-visual {
    position: relative;
    display: flex;
    min-height: 100vh;
    padding: 42px clamp(42px, 5vw, 82px);
    overflow: hidden;
    flex-direction: column;
    color: #fff;
    background:
        radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.18), transparent 28%),
        radial-gradient(circle at 12% 90%, rgba(170, 120, 255, 0.5), transparent 32%),
        linear-gradient(145deg, #4f16b7 0%, #6d28d9 48%, #8b5cf6 100%);
}

.auth-visual::before,
.auth-visual::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 50%;
    content: "";
}

.auth-visual::before {
    top: -210px;
    right: -180px;
    width: 520px;
    height: 520px;
}

.auth-visual::after {
    bottom: -300px;
    left: -250px;
    width: 620px;
    height: 620px;
}

.brand {
    position: relative;
    z-index: 2;
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 13px;
    color: var(--ink);
    text-decoration: none;
}

.brand img {
    flex: 0 0 auto;
}

.brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand strong {
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.brand small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.68rem;
}

.brand-on-color,
.brand-on-color small {
    color: #fff;
}

.brand-on-color img {
    border-radius: 13px;
    box-shadow: 0 8px 26px rgba(36, 12, 87, 0.25);
}

.visual-copy {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin-top: clamp(74px, 11vh, 132px);
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 16px;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow::before {
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    content: "";
}

.eyebrow-dark {
    color: var(--brand);
}

.visual-copy h1 {
    max-width: 560px;
    margin: 0;
    font-size: clamp(2.55rem, 4vw, 4.7rem);
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 1.01;
}

.visual-copy p {
    max-width: 520px;
    margin: 25px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.05rem;
    line-height: 1.7;
}

.preview-window {
    position: relative;
    z-index: 2;
    width: min(690px, 112%);
    margin-top: clamp(40px, 7vh, 76px);
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 70px rgba(32, 9, 80, 0.25);
    backdrop-filter: blur(16px);
    transform: rotate(-1.2deg);
}

.preview-header {
    display: flex;
    padding: 5px 5px 14px;
    align-items: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.72rem;
}

.preview-header b {
    margin-left: auto;
    font-size: 0.64rem;
    font-weight: 500;
}

.window-dots {
    display: flex;
    gap: 5px;
}

.window-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.62);
}

.preview-grid {
    display: grid;
    min-height: 225px;
    padding: 22px;
    border-radius: 12px;
    grid-template-columns: 138px 1fr;
    gap: 22px;
    color: #22243a;
    background: rgba(255, 255, 255, 0.96);
}

.preview-stat {
    display: flex;
    padding: 19px;
    align-self: start;
    border: 1px solid #edeaf4;
    border-radius: 11px;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(45, 25, 80, 0.08);
}

.preview-stat span,
.chart-label {
    color: #73788a;
    font-size: 0.67rem;
}

.preview-stat strong {
    margin-top: 5px;
    font-size: 1.7rem;
    letter-spacing: -0.04em;
}

.preview-stat small {
    margin-top: 5px;
    color: #15a267;
    font-weight: 700;
}

.preview-chart {
    position: relative;
    padding-top: 10px;
    overflow: hidden;
}

.preview-chart::before {
    position: absolute;
    inset: 38px 0 22px;
    background: repeating-linear-gradient(to bottom, #ececf2 0 1px, transparent 1px 42px);
    content: "";
}

.preview-chart svg {
    position: relative;
    display: block;
    width: 100%;
    margin-top: 15px;
    overflow: visible;
}

.chart-area {
    fill: url(#chartFill);
}

.chart-line {
    fill: none;
    stroke: var(--brand);
    stroke-linecap: round;
    stroke-width: 4;
}

.preview-chart circle {
    fill: var(--brand);
    stroke: white;
    stroke-width: 4;
}

.chart-days {
    display: flex;
    justify-content: space-between;
    color: #878b9a;
    font-size: 0.58rem;
}

.visual-trust {
    position: relative;
    z-index: 2;
    margin: auto 0 0;
    padding-top: 28px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
}

.visual-trust span {
    display: inline-grid;
    width: 21px;
    height: 21px;
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    place-items: center;
}

.auth-content {
    display: flex;
    min-height: 100vh;
    padding: 44px clamp(40px, 8vw, 138px) 26px;
    flex-direction: column;
    background:
        radial-gradient(circle at 90% 5%, rgba(109, 40, 217, 0.045), transparent 24%),
        #fff;
}

.mobile-brand {
    display: none;
}

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

.form-heading {
    margin-bottom: 34px;
}

.form-heading .eyebrow {
    margin-bottom: 12px;
}

.form-heading h2,
.success-state h2 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.7rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.12;
}

.form-heading p,
.success-state > p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.app-alert {
    margin-bottom: 24px;
    padding: 13px 15px;
    border-radius: 10px;
    font-size: 0.875rem;
}

.alert-danger {
    border-color: #f2cdd3;
    color: #9c2639;
    background: #fff5f6;
}

.alert-success {
    border-color: #cbe9dc;
    color: #176b4a;
    background: #f0fbf6;
}

.form-group {
    margin-bottom: 23px;
}

.label-row {
    display: flex;
    justify-content: space-between;
}

.form-label {
    margin-bottom: 9px;
    color: #303246;
    font-size: 0.85rem;
    font-weight: 650;
}

.form-control {
    min-height: 54px;
    padding: 12px 15px;
    border: 1px solid #dcdfea;
    border-radius: 10px;
    color: var(--ink);
    font-size: 0.94rem;
    box-shadow: 0 1px 2px rgba(20, 20, 35, 0.025);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-control::placeholder {
    color: #a1a5b2;
}

.form-control:hover {
    border-color: #c5c8d5;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.1);
}

.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--danger);
    background-image: none;
}

.form-control.is-invalid:focus,
.was-validated .form-control:invalid:focus {
    box-shadow: 0 0 0 4px rgba(198, 55, 76, 0.1);
}

.invalid-feedback {
    margin-top: 7px;
    color: var(--danger);
    font-size: 0.78rem;
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    top: 12px;
    right: 11px;
    display: grid;
    width: 32px;
    height: 32px;
    padding: 5px;
    border: 0;
    border-radius: 7px;
    place-items: center;
    color: #72778a;
    background: transparent;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--brand);
    background: var(--brand-light);
    outline: none;
}

.password-toggle svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.password-toggle .eye-closed,
.password-toggle[aria-pressed="true"] .eye-open {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
    display: block;
}

.btn {
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 650;
}

.btn-lg {
    min-height: 54px;
    padding: 12px 20px;
}

.btn-primary {
    border-color: var(--brand);
    background: var(--brand);
    box-shadow: 0 10px 24px rgba(109, 40, 217, 0.2);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    border-color: var(--brand-dark) !important;
    background: var(--brand-dark) !important;
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.18);
}

.button-loading {
    display: none;
}

.login-submit.is-loading .button-label {
    display: none;
}

.login-submit.is-loading .button-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.register-prompt {
    display: flex;
    margin-top: 29px;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.88rem;
}

.register-prompt a {
    font-weight: 700;
    text-decoration: none;
}

.register-prompt a:hover {
    text-decoration: underline;
}

.next-step-message {
    min-height: 20px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    text-align: center;
}

.auth-footer {
    display: flex;
    width: min(100%, 660px);
    margin: 34px auto 0;
    justify-content: space-between;
    color: #9296a5;
    font-size: 0.72rem;
}

.success-state {
    text-align: center;
}

.success-state .eyebrow {
    margin-top: 24px;
}

.success-icon {
    display: grid;
    width: 78px;
    height: 78px;
    margin: 0 auto;
    border: 8px solid #ecfaf4;
    border-radius: 50%;
    place-items: center;
    color: #fff;
    background: var(--success);
    box-shadow: 0 12px 32px rgba(22, 133, 87, 0.2);
}

.success-icon svg {
    width: 34px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.5;
}

.signed-in-user {
    display: flex;
    margin: 28px 0 24px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    align-items: center;
    gap: 13px;
    text-align: left;
    background: #faf9fd;
}

.signed-in-user > span {
    display: grid;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    place-items: center;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(145deg, #7c3aed, #5b21b6);
}

.signed-in-user div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.signed-in-user strong,
.signed-in-user small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signed-in-user small {
    margin-top: 3px;
    color: var(--muted);
}

.simple-error {
    display: flex;
    min-height: 100vh;
    padding: 40px 24px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    background: radial-gradient(circle at 50% 25%, var(--brand-light), transparent 27%);
}

.simple-error .brand {
    margin-bottom: 60px;
}

.error-code {
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.simple-error h1 {
    margin: 12px 0 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: -0.05em;
}

.simple-error p {
    margin: 14px 0 28px;
    color: var(--muted);
}

@media (max-width: 1180px) {
    .auth-shell {
        grid-template-columns: minmax(440px, 0.85fr) minmax(500px, 1fr);
    }

    .auth-visual {
        padding-inline: 42px;
    }

    .preview-grid {
        grid-template-columns: 1fr;
    }

    .preview-stat {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .preview-stat small {
        grid-column: 2;
        grid-row: 1;
    }

    .preview-stat strong {
        grid-column: 1;
    }
}

@media (max-width: 991.98px) {
    .auth-shell {
        display: block;
    }

    .auth-visual {
        display: none;
    }

    .auth-content {
        min-height: 100vh;
        padding: 28px 24px 24px;
    }

    .mobile-brand {
        display: block;
    }

    .auth-card {
        padding: 60px 0;
    }
}

@media (max-width: 575.98px) {
    .auth-content {
        padding: 22px 18px 18px;
    }

    .auth-card {
        padding: 54px 0 34px;
    }

    .form-heading {
        margin-bottom: 27px;
    }

    .form-heading h2,
    .success-state h2 {
        font-size: 2rem;
    }

    .auth-footer {
        gap: 8px;
        flex-direction: column;
        text-align: center;
    }
}

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

