:root {
    --primary: #614FBD;
    --primary-dark: #4B3A9F;
    --primary-light: #8A7BDD;
    --secondary: #F48218;
    --secondary-dark: #D96808;
    --secondary-light: #FFB15C;

    --bg: #F7F8FC;
    --surface: #FFFFFF;
    --surface-soft: #F1F0FA;

    --border: #E4E5EF;

    --text: #1D1D3E;
    --text-secondary: #66677A;
    --text-muted: #9293A5;
    --text-white: #FFFFFF;

    --success: #22A06B;
    --warning: #E9A21B;
    --danger: #D94A4A;
    --info: #3978D8;

    --primary-soft: rgba(97, 79, 189, 0.10);
    --secondary-soft: rgba(244, 130, 24, 0.10);

    --shadow-sm: 0 2px 8px rgba(29, 29, 62, 0.06);
    --shadow-md: 0 6px 20px rgba(29, 29, 62, 0.10);
    --shadow-lg: 0 12px 35px rgba(29, 29, 62, 0.14);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --transition: all 0.25s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
}

a {
    text-decoration: none;
}

/* ============================================================
    LAYOUT — Two column
============================================================ */
.auth-wrap {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* LEFT — Brand */
.brand-panel {
    flex: 1 1 55%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -120px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.brand-panel::after {
    content: "";
    position: absolute;
    bottom: -140px;
    left: -80px;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.brand-panel>* {
    position: relative;
    z-index: 1;
}

.brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.3rem;
}

.brand-logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
}

.brand-hero {
    max-width: 480px;
    margin: 60px 0;
}

.brand-hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 16px;
}

.brand-hero p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.6;
    margin: 0 0 32px;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.92);
}

.brand-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
}

.brand-footer {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
}

/* RIGHT — Form panel */
.form-panel {
    flex: 1 1 45%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.form-wrap {
    width: 100%;
    max-width: 440px;
}

/* ============================================================
    STEPPER
============================================================ */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.stepper::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.stepper-progress {
    position: absolute;
    top: 20px;
    left: 20px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    z-index: 1;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: var(--transition);
}

.step.active .step-dot {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary);
    color: var(--text-white);
    box-shadow: 0 6px 16px rgba(97, 79, 189, 0.35);
    transform: scale(1.05);
}

.step.completed .step-dot {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-white);
}

.step-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    transition: var(--transition);
}

.step.active .step-label {
    color: var(--primary);
}

.step.completed .step-label {
    color: var(--success);
}

/* ============================================================
    FORM HEADER
============================================================ */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    margin-bottom: 24px;
}

.step-header .step-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    margin-bottom: 14px;
}

.step-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
    line-height: 1.2;
}

.step-header p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.step-header p strong {
    color: var(--text);
    font-weight: 600;
}

/* ============================================================
    FORM FIELDS
============================================================ */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px 14px;
    font-size: 0.92rem;
    transition: var(--transition);
    height: 48px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-group-icon {
    position: relative;
}

.input-group-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: var(--transition);
}

.input-group-icon input {
    padding-left: 42px;
}

.input-group-icon input:focus~i {
    color: var(--primary);
}

/* Password toggle */
.pwd-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.pwd-toggle:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.input-group-icon input[type="password"] {
    padding-right: 48px;
}

.input-group-icon input[type="text"].pwd-visible {
    padding-right: 48px;
}

/* ============================================================
    OTP INPUT
============================================================ */
.otp-wrap {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.otp-input {
    width: 100%;
    max-width: 56px;
    height: 60px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--surface);
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    transition: var(--transition);
    font-variant-numeric: tabular-nums;
    padding: 0;
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    transform: scale(1.05);
}

.otp-input.filled {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.otp-input.error {
    border-color: var(--danger);
    background: rgba(217, 74, 74, 0.06);
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

/* OTP meta */
.otp-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.otp-meta .otp-time {
    color: var(--text-secondary);
}

.otp-meta .otp-time strong {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.otp-resend {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    font-family: inherit;
}

.otp-resend:hover:not(:disabled) {
    color: var(--primary-dark);
    text-decoration: underline;
}

.otp-resend:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Demo OTP hint */
.demo-otp-hint {
    background: var(--secondary-soft);
    border: 1px dashed var(--secondary-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.demo-otp-hint i {
    color: var(--secondary);
    font-size: 1rem;
    flex-shrink: 0;
}

.demo-otp-hint strong {
    color: var(--text);
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.15em;
    font-size: 0.88rem;
    background: var(--surface);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ============================================================
    PASSWORD STRENGTH METER
============================================================ */
.strength-wrap {
    margin-top: 8px;
}

.strength-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.strength-bar .seg {
    flex: 1;
    height: 5px;
    border-radius: 5px;
    background: var(--border);
    transition: background 0.3s ease;
}

.strength-bar.weak .seg:nth-child(1) {
    background: var(--danger);
}

.strength-bar.fair .seg:nth-child(-n+2) {
    background: var(--warning);
}

.strength-bar.good .seg:nth-child(-n+3) {
    background: var(--info);
}

.strength-bar.strong .seg {
    background: var(--success);
}

.strength-text {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.strength-text.weak {
    color: var(--danger);
}

.strength-text.fair {
    color: var(--warning);
}

.strength-text.good {
    color: var(--info);
}

.strength-text.strong {
    color: var(--success);
}

/* Password requirements checklist */
.pwd-reqs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--surface-soft);
    border-radius: var(--radius);
}

.pwd-req {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.pwd-req .req-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 0.6rem;
    color: transparent;
    flex-shrink: 0;
    transition: var(--transition);
}

.pwd-req.ok {
    color: var(--success);
}

.pwd-req.ok .req-dot {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-white);
}

/* ============================================================
           BUTTONS
           ============================================================ */
.btn-brand {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(97, 79, 189, 0.30);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-brand:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(97, 79, 189, 0.40);
}

.btn-brand:active {
    transform: translateY(0);
}

.btn-brand:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-brand .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-outline {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

/* ============================================================
    SUCCESS STATE
============================================================ */
.success-state {
    text-align: center;
    padding: 12px 0;
}

.success-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(34, 160, 107, 0.12);
    color: var(--success);
    display: grid;
    place-items: center;
    font-size: 3rem;
    margin: 0 auto 20px;
    animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-state h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
}

.success-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ============================================================
    BACK LINK
============================================================ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary);
    transform: translateX(-2px);
}

/* ============================================================
    FOOTER
============================================================ */
.form-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 24px;
}

.form-footer a {
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition);
}

.form-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================================
    TOAST
============================================================ */
.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-toast {
    min-width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    font-size: 0.86rem;
}

.app-toast.success {
    border-left-color: var(--success);
}

.app-toast.warning {
    border-left-color: var(--warning);
}

.app-toast.danger {
    border-left-color: var(--danger);
}

.app-toast.hide {
    animation: slideOut 0.3s ease forwards;
}

.app-toast .t-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--primary-soft);
    color: var(--primary);
}

.app-toast.success .t-icon {
    background: rgba(34, 160, 107, .12);
    color: var(--success);
}

.app-toast.warning .t-icon {
    background: rgba(233, 162, 27, .14);
    color: var(--warning);
}

.app-toast.danger .t-icon {
    background: rgba(217, 74, 74, .12);
    color: var(--danger);
}

.app-toast .t-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.86rem;
}

.app-toast .t-msg {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* ============================================================
    RESPONSIVE
============================================================ */
@media (max-width: 991.98px) {
    .brand-panel {
        flex: 0 0 320px;
        padding: 32px 28px;
        justify-content: flex-start;
    }

    .brand-hero {
        margin: 24px 0;
    }

    .brand-hero h1 {
        font-size: 1.6rem;
    }

    .brand-hero p {
        font-size: 0.88rem;
        margin-bottom: 20px;
    }

    .brand-features {
        display: none;
    }

    .brand-footer {
        display: none;
    }

    .form-panel {
        padding: 32px 22px;
    }
}

@media (max-width: 767.98px) {
    .auth-wrap {
        flex-direction: column;
    }

    .brand-panel {
        flex: 0 0 auto;
        padding: 28px 22px 32px;
        border-radius: 0 0 24px 24px;
    }

    .brand-hero {
        margin: 18px 0 0;
    }

    .brand-hero h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .brand-hero p {
        font-size: 0.82rem;
        margin-bottom: 0;
    }

    .form-panel {
        padding: 26px 20px 40px;
        align-items: flex-start;
    }

    .step-header h2 {
        font-size: 1.35rem;
    }

    /* Stepper labels shrink */
    .step-label {
        font-size: 0.66rem;
    }

    /* OTP inputs tighter */
    .otp-wrap {
        gap: 8px;
    }

    .otp-input {
        height: 54px;
        font-size: 1.25rem;
        max-width: 48px;
    }
}

@media (max-width: 380px) {
    .brand-hero h1 {
        font-size: 1.2rem;
    }

    .step-header h2 {
        font-size: 1.2rem;
    }

    .step-dot {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }

    .step-label {
        font-size: 0.62rem;
    }

    .otp-wrap {
        gap: 6px;
    }

    .otp-input {
        height: 50px;
        font-size: 1.15rem;
        max-width: 42px;
    }
}