/* =========================================================
   DESIGN TOKENS
========================================================= */
:root {
    --primary: #0F2114;
    --primary-hover: #14351F;
    --primary-dark: #07130D;
    --secondary: #E85D04;
    --secondary-hover: #C94D00;
    --primary-50: #F1F6F2;
    --primary-100: #DCE9DF;
    --primary-500: #3F7650;
    --primary-700: #1B4428;
    --secondary-50: #FFF5ED;
    --secondary-100: #FFE8D5;
    --secondary-300: #FFB17A;
    --secondary-400: #FF8A45;
    --background: #F7F4F1;
    --surface: #FFFFFF;
    --surface-soft: #FCFAF8;
    --surface-muted: #F4F1ED;
    --cream: #F8EBE1;
    --text: #272519;
    --text-secondary: #57534E;
    --muted: #78716C;
    --border: #E2DBD3;
    --border-light: #EEE9E4;
    --success: #16803C;
    --success-bg: #DCFCE7;
    --danger: #DC2626;
    --danger-bg: #FEE2E2;
    --warning: #D97706;
    --warning-bg: #FEF3C7;
    --info: #2563EB;
    --info-bg: #DBEAFE;
    --shadow-sm: 0 2px 8px rgba(15, 33, 20, .06);
    --shadow-md: 0 8px 22px rgba(15, 33, 20, .09);
    --shadow-lg: 0 14px 40px rgba(15, 33, 20, .12);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --t-fast: 150ms ease;
    --t: 250ms ease;
    --t-slow: 350ms ease;
}

* {
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    overflow-x: hidden;
    margin: 0;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
}

/* =========================================================
   SPLIT LAYOUT
========================================================= */
.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    min-height: 100vh;
}

@media(max-width:991.98px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   BRAND PANEL (left)
========================================================= */
.brand-panel {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 50%, var(--primary-dark) 100%);
    color: #fff;
    padding: clamp(2rem, 4vw, 3.5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(700px 500px at 85% 10%, rgba(232, 93, 4, .28), transparent 60%),
        radial-gradient(500px 400px at 5% 95%, rgba(40, 91, 57, .4), transparent 60%);
    pointer-events: none;
}

.brand-panel::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .08);
    pointer-events: none;
}

.brand-panel>* {
    position: relative;
    z-index: 1;
}

.brand-top {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.brand-top .logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--secondary);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 8px 20px -6px rgba(232, 93, 4, .6);
    flex-shrink: 0;
}

.brand-top .name {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: .04em;
    line-height: 1;
}

.brand-top .name span {
    color: var(--secondary-400);
}

.brand-top .tag {
    font-size: .65rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
    margin-top: 3px;
}

.brand-hero {
    max-width: 520px;
}

.brand-hero .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--secondary-300);
    background: rgba(232, 93, 4, .15);
    border: 1px solid rgba(232, 93, 4, .3);
    padding: .4rem .85rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.brand-hero h1 {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.03em;
    margin: 0 0 1rem;
    color: #fff;
}

.brand-hero h1 em {
    color: var(--secondary-400);
    font-style: italic;
}

.brand-hero p {
    color: rgba(255, 255, 255, .7);
    font-size: .95rem;
    line-height: 1.65;
    margin: 0 0 1.75rem;
    max-width: 440px;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    margin-top: 2rem;
}

.brand-feature {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, .85);
}

.brand-feature i {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .15);
    display: grid;
    place-items: center;
    color: var(--secondary-300);
    font-size: .95rem;
    flex-shrink: 0;
}

.brand-feature b {
    display: block;
    color: #fff;
    font-weight: 700;
    margin-bottom: .1rem;
}

.brand-feature span {
    font-size: .78rem;
    color: rgba(255, 255, 255, .6);
    line-height: 1.5;
}

.brand-footer {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: .75rem;
    color: rgba(255, 255, 255, .5);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand-footer a {
    color: rgba(255, 255, 255, .7);
}

.brand-footer a:hover {
    color: var(--secondary-300);
}

@media(max-width:991.98px) {
    .brand-panel {
        padding: 1.5rem;
        min-height: auto;
    }

    .brand-hero h1 {
        font-size: 1.5rem;
    }

    .brand-hero p {
        font-size: .85rem;
        margin-bottom: 1rem;
    }

    .brand-features {
        display: none;
    }

    .brand-footer {
        padding-top: 1rem;
        margin-top: 1rem;
    }
}

/* =========================================================
   FORM PANEL (right)
========================================================= */
.form-panel {
    background: var(--background);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.form-wrap {
    width: 100%;
    max-width: 440px;
    padding: 1rem 0;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 1.5rem;
    transition: color var(--t-fast);
}

.back-link:hover {
    color: var(--secondary);
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: .3rem;
    padding: .35rem;
    background: var(--surface-muted);
    border-radius: 12px;
    margin-bottom: 1.75rem;
}

.auth-tab {
    flex: 1;
    padding: .7rem 1rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--t-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.auth-tab:hover {
    color: var(--primary);
}

.auth-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Form header */
.form-header {
    margin-bottom: 1.75rem;
}

.form-header h2 {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.5rem, 3vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.15;
    color: var(--primary);
    margin: 0 0 .5rem;
}

.form-header p {
    font-size: .85rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}

.form-header p a {
    color: var(--secondary);
    font-weight: 700;
}

.form-header p a:hover {
    text-decoration: underline;
}

/* Form */
.form-panel-item {
    display: none;
}

.form-panel-item.active {
    display: block;
    animation: fadeIn .3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.form-group label .req {
    color: var(--danger);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: .85rem 2.75rem .85rem 2.75rem;
    font-size: .88rem;
    background: #fff;
    outline: 0;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    font-family: inherit;
    color: var(--text);
}

.input-wrap input::placeholder {
    color: var(--muted);
}

.input-wrap input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(63, 118, 80, .1);
}

.input-wrap input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

.input-wrap .ico-left {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 1rem;
    pointer-events: none;
}

.input-wrap .ico-right {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: .35rem;
    border-radius: 6px;
    font-size: 1rem;
    transition: all var(--t-fast);
}

.input-wrap .ico-right:hover {
    color: var(--primary);
    background: var(--surface-muted);
}

.form-group .err-msg {
    font-size: .72rem;
    color: var(--danger);
    font-weight: 600;
    display: none;
}

.form-group.has-error .err-msg {
    display: block;
}

.form-group .hint {
    font-size: .72rem;
    color: var(--muted);
}

/* Row of 2 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

@media(max-width:575.98px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Remember + forgot */
.form-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-size: .82rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--secondary);
    cursor: pointer;
    margin: 0;
}

.forgot-link {
    font-size: .82rem;
    font-weight: 700;
    color: var(--secondary);
    transition: color var(--t-fast);
}

.forgot-link:hover {
    color: var(--secondary-hover);
    text-decoration: underline;
}

/* Submit */
.btn-submit {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .9rem 1.5rem;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: .9rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--t);
}

.btn-submit:hover:not(:disabled) {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -10px rgba(232, 93, 4, .55);
}

.btn-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-submit .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}

.btn-submit.loading .spinner {
    display: inline-block;
}

.btn-submit.loading .label {
    opacity: .7;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Social */
.social-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
    margin-bottom: 1.25rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t-fast);
}

.social-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.social-btn i {
    font-size: 1.1rem;
}

.social-btn.google i {
    color: #EA4335;
}

.social-btn.apple i {
    color: #000;
}

.social-btn.facebook i {
    color: #1877F2;
}

@media(max-width:575.98px) {
    .social-btn span {
        display: none;
    }
}

/* Password strength */
.strength-meter {
    display: flex;
    gap: .3rem;
    margin-top: .4rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background var(--t-fast);
}

.strength-bar.weak {
    background: var(--danger);
}

.strength-bar.fair {
    background: var(--warning);
}

.strength-bar.good {
    background: var(--info);
}

.strength-bar.strong {
    background: var(--success);
}

.strength-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    margin-top: .35rem;
}

.strength-label.weak {
    color: var(--danger);
}

.strength-label.fair {
    color: var(--warning);
}

.strength-label.good {
    color: var(--info);
}

.strength-label.strong {
    color: var(--success);
}

/* Terms */
.terms-row {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    font-size: .78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.terms-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--secondary);
    cursor: pointer;
    margin: 2px 0 0;
    flex-shrink: 0;
}

.terms-row a {
    color: var(--secondary);
    font-weight: 700;
}

.terms-row a:hover {
    text-decoration: underline;
}

/* OTP */
.otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: .5rem;
    margin: .75rem 0 1.25rem;
}

.otp-inputs input {
    width: 100%;
    aspect-ratio: 1/1;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    color: var(--primary);
    outline: 0;
    transition: all var(--t-fast);
    font-family: 'Courier New', monospace;
    padding: 0;
}

.otp-inputs input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(63, 118, 80, .1);
}

.otp-inputs input.filled {
    border-color: var(--secondary);
    background: var(--secondary-50);
}

/* Reset sent state */
.sent-state {
    text-align: center;
    padding: 1rem 0;
}

.sent-ico {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
    display: grid;
    place-items: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
    animation: successPop .5s cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.sent-state h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--primary);
    margin: 0 0 .5rem;
}

.sent-state p {
    font-size: .85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.25rem;
}

.sent-state .resend {
    font-size: .78rem;
    color: var(--muted);
}

.sent-state .resend a {
    color: var(--secondary);
    font-weight: 700;
    cursor: pointer;
}

.sent-state .resend a:hover {
    text-decoration: underline;
}

.sent-state .resend a:disabled {
    color: var(--muted);
    cursor: not-allowed;
    text-decoration: none;
}

/* Trust row */
.trust-row {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: .72rem;
    color: var(--muted);
    font-weight: 600;
}

.trust-row .t {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.trust-row .t i {
    color: var(--secondary);
    font-size: .85rem;
}

/* =========================================================
   TOAST
========================================================= */
.toast-wrap {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    pointer-events: none;
}

@media(max-width:575.98px) {
    .toast-wrap {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

.toast-el {
    background: var(--primary-dark);
    color: #fff;
    padding: .85rem 1.1rem;
    border-radius: 12px;
    font-size: .85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .6rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    opacity: 0;
    animation: toastIn .3s ease forwards;
    pointer-events: auto;
    max-width: 340px;
}

.toast-el i {
    color: var(--secondary-400);
    font-size: 1.15rem;
}

.toast-el.out {
    animation: toastOut .3s ease forwards;
}

@keyframes toastIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}