:root {
    --auth-primary: #4f2473;
    --auth-secondary: #764ba2;
    --auth-accent: #19a7ae;
    --auth-ink: #172033;
    --auth-muted: #667085;
    --auth-line: #dfe3ec;
    --auth-danger: #b42318;
    --auth-success: #067647;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
button, input { font: inherit; }
a { color: inherit; }

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

.auth-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(145deg, #fcfbfd 0%, #f0eaf3 100%);
}

.auth-page__inner {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 28px 16px;
}

.auth-layout {
    width: min(100%, 500px);
}

.auth-layout--wide {
    width: min(100%, 760px);
}

.auth-panel {
    padding: 28px 34px 34px;
    border: 1px solid rgba(118, 75, 162, .12);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(79, 59, 120, .12);
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.auth-brand__logo {
    display: block;
    width: 138px;
    height: auto;
    flex: 0 0 auto;
}

.auth-language {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid #ded7eb;
    border-radius: 999px;
    color: #5f417f;
    background: #fff;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 750;
    transition: .18s ease;
}

.auth-language:hover { border-color: #9b82bd; background: #f8f5fb; }
.auth-language:focus-visible { outline: 3px solid rgba(79, 36, 115, .2); outline-offset: 2px; }

.auth-card { width: 100%; }
.auth-card h1 {
    margin: 0 0 24px;
    color: #111827;
    font-size: clamp(1.7rem, 4vw, 2rem);
    line-height: 1.15;
    letter-spacing: -.025em;
}

.auth-card__description {
    margin: -12px 0 24px;
    color: var(--auth-muted);
    font-size: .9rem;
    line-height: 1.6;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 13px;
    border: 1px solid;
    border-radius: 12px;
    font-size: .82rem;
    line-height: 1.45;
}

.auth-alert i { flex: 0 0 auto; margin-top: 1px; }
.auth-alert ul { margin: 0; padding-inline-start: 18px; }
.auth-alert--success { border-color: #abefc6; color: var(--auth-success); background: #ecfdf3; }
.auth-alert--danger { border-color: #fecdca; color: var(--auth-danger); background: #fef3f2; }
.auth-alert--info { border-color: #ded7eb; color: #65408c; background: #f8f5fb; }

.auth-form { display: grid; gap: 17px; }
.auth-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.auth-field { min-width: 0; }

.auth-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    color: #344054;
    font-size: .8rem;
    font-weight: 750;
}

.auth-label small { color: #98a2b3; font-size: .7rem; font-weight: 650; }
.auth-input-wrap { position: relative; }
.auth-input-wrap > i {
    position: absolute;
    top: 50%;
    left: 15px;
    z-index: 2;
    color: #98a2b3;
    transform: translateY(-50%);
    pointer-events: none;
}

.auth-input {
    width: 100%;
    min-height: 50px;
    padding: 12px 46px 12px 43px;
    border: 1px solid var(--auth-line);
    border-radius: 13px;
    color: #101828;
    background: #fff;
    outline: none;
    transition: .18s ease;
}

.auth-input::placeholder { color: #a0a7b4; }
.auth-input:hover { border-color: #c4b8d5; }
.auth-input:focus { border-color: var(--auth-secondary); box-shadow: 0 0 0 4px rgba(79, 36, 115, .1); }
.auth-input.is-invalid { border-color: #f04438; }
.auth-input[readonly] { color: #475467; background: #f8fafc; }

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 9px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    color: #667085;
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
}

.auth-password-toggle:hover { color: var(--auth-primary); background: #f5f0fb; }
.auth-error { margin: 6px 2px 0; color: var(--auth-danger); font-size: .76rem; font-weight: 650; }
.auth-help { margin: 6px 2px 0; color: #7b8496; font-size: .72rem; line-height: 1.4; }

[dir="rtl"] .auth-input-wrap > i { right: 15px; left: auto; }
[dir="rtl"] .auth-password-toggle { right: auto; left: 9px; }
[dir="rtl"] .auth-input { padding-right: 43px; padding-left: 46px; }

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.auth-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.auth-check input { position: absolute; opacity: 0; pointer-events: none; }
.auth-check__box { position: relative; flex: 0 0 auto; width: 36px; height: 21px; border-radius: 999px; background: #d0d5dd; transition: .2s ease; }
.auth-check__box::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .22); transition: .2s ease; }
.auth-check input:checked + .auth-check__box { background: var(--auth-primary); }
.auth-check input:checked + .auth-check__box::after { transform: translateX(15px); }
[dir="rtl"] .auth-check input:checked + .auth-check__box::after { transform: translateX(-15px); }
[dir="rtl"] .auth-check__box::after { right: 3px; left: auto; }
.auth-check input:focus-visible + .auth-check__box { outline: 3px solid rgba(118, 75, 162, .18); outline-offset: 2px; }
.auth-check__text { color: #344054; font-size: .77rem; font-weight: 700; }

.auth-link { color: var(--auth-primary); font-size: .8rem; font-weight: 750; text-decoration: none; }
.auth-link:hover { color: #553176; text-decoration: underline; }

.auth-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    padding: 11px 18px;
    overflow: hidden;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, #4f2473 0%, #764ba2 100%);
    box-shadow: 0 10px 22px rgba(118, 75, 162, .2);
    cursor: pointer;
    font-weight: 800;
    transition: .18s ease;
}

.auth-button:hover { transform: translateY(-1px); box-shadow: 0 13px 25px rgba(118, 75, 162, .27); }
.auth-button:focus-visible { outline: 3px solid rgba(79, 36, 115, .24); outline-offset: 3px; }
.auth-button.is-loading { pointer-events: none; opacity: .82; }
.auth-button.is-loading::after { content: ""; width: 17px; height: 17px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
.auth-button--secondary { color: #344054; border: 1px solid var(--auth-line); background: #fff; box-shadow: none; }
.auth-button--secondary:hover { background: #f8fafc; box-shadow: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-bottom-link { margin: 20px 0 0; color: var(--auth-muted); text-align: center; font-size: .8rem; }
.auth-actions-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Signed-in change password page */
.security-page { width: min(620px, calc(100% - 28px)); margin: 34px auto 56px; }
.security-card { overflow: hidden; border: 1px solid #e7e0f0; border-top: 4px solid var(--auth-primary); border-radius: 20px; background: #fff; box-shadow: 0 12px 36px rgba(79, 36, 115, .1); }
.security-form { padding: 30px; }
.security-form__heading { margin-bottom: 24px; }
.security-form__heading h1 { margin: 0 0 7px; color: var(--auth-primary); font-size: 1.65rem; }
.security-form__heading p { margin: 0; color: #667085; font-size: .8rem; line-height: 1.5; }

@media (max-width: 620px) {
    .auth-page__inner { padding: 12px; }
    .auth-panel { padding: 22px 20px 26px; border-radius: 20px; }
    .auth-topbar { margin-bottom: 24px; }
    .auth-brand__logo { width: 124px; }
    .auth-language { min-height: 35px; padding: 0 11px; font-size: .74rem; }
    .auth-card h1 { margin-bottom: 22px; font-size: 1.65rem; }
    .auth-card__description { margin-top: -11px; margin-bottom: 21px; }
    .auth-form__grid { grid-template-columns: 1fr; }
    .auth-options { gap: 10px; }
    .auth-check__text, .auth-link { font-size: .72rem; }
    .auth-actions-row { grid-template-columns: 1fr; }
    .security-page { margin-top: 20px; }
    .security-form { padding: 24px 20px; }
}

@media (max-width: 360px) {
    .auth-options { align-items: flex-start; flex-direction: column; }
}

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