*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --color-black: #1a1f2e;
    --color-white: #fafafa;
    --color-cream: #f7f4f0;
    --color-accent: #C67B5C;
    --color-accent-bright: #e09a7d;
    --color-accent-dark: #a65f42;
    --color-gray: #6b7280;
    --color-gray-muted: #9ca3af;
    --color-dark: #08090d;
    --color-dark-card: #111318;
    --color-dark-elevated: #191c24;
    --color-dark-border: rgba(255, 255, 255, 0.05);
    --color-error: #ef4444;
    --color-success: #22c55e;
    --font-display: 'Clash Display', sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { height: 100%; }

body {
    font-family: var(--font-body);
    background: var(--color-dark);
    min-height: 100vh;
    display: flex;
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   GRAIN OVERLAY (full page)
   ============================================================ */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ============================================================
   SPLIT LAYOUT
   ============================================================ */
.auth-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ============================================================
   LEFT PANEL — THE CANVAS
   ============================================================ */
.auth-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 3.5rem;
    position: relative;
    overflow: hidden;
    background: var(--color-dark);
}

/* Grid lines — architectural blueprint effect */
.auth-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-grid__line {
    position: absolute;
    background: rgba(255, 255, 255, 0.025);
}

.auth-grid__line--v {
    width: 1px;
    top: 0;
    bottom: 0;
}

.auth-grid__line--v:nth-child(1) { left: 25%; }
.auth-grid__line--v:nth-child(2) { left: 50%; }
.auth-grid__line--v:nth-child(3) { left: 75%; }

.auth-grid__line--h {
    height: 1px;
    left: 0;
    right: 0;
}

.auth-grid__line--h:nth-child(4) { top: 33.33%; }
.auth-grid__line--h:nth-child(5) { top: 66.66%; }

/* Animated accent line that traces the grid */
.auth-grid__accent {
    position: absolute;
    width: 1px;
    height: 120px;
    background: linear-gradient(180deg, transparent, var(--color-accent), transparent);
    opacity: 0.15;
    left: 25%;
    animation: gridTrace 8s ease-in-out infinite;
}

.auth-grid__accent:nth-child(7) {
    left: 75%;
    animation-delay: -4s;
    height: 80px;
    opacity: 0.1;
}

@keyframes gridTrace {
    0% { top: -120px; }
    100% { top: calc(100% + 120px); }
}

/* Ambient glow */
.auth-brand__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
}

.auth-brand__glow--1 {
    width: 500px;
    height: 500px;
    background: var(--color-accent);
    opacity: 0.06;
    top: -20%;
    right: -15%;
    animation: glowPulse 12s ease-in-out infinite;
}

.auth-brand__glow--2 {
    width: 300px;
    height: 300px;
    background: var(--color-accent-bright);
    opacity: 0.04;
    bottom: 10%;
    left: -10%;
    animation: glowPulse 12s ease-in-out infinite reverse;
    animation-delay: -6s;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.06; transform: scale(1); }
    50% { opacity: 0.09; transform: scale(1.08); }
}

/* Brand header (logo + nav hint) */
.auth-brand__header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeDown 0.6s ease-out 0.1s both;
}

.auth-brand__logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.03em;
    text-decoration: none;
    transition: transform 0.3s var(--ease-out-expo);
}

.auth-brand__logo:hover {
    transform: scale(1.04);
}

.auth-brand__logo span {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--color-accent);
    background: rgba(198, 123, 92, 0.08);
    border: 1px solid rgba(198, 123, 92, 0.12);
    border-radius: 100px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-brand__badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-accent);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Brand center content */
.auth-brand__center {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
}

.auth-brand__eyebrow {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-accent);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    animation: fadeUp 0.6s ease-out 0.2s both;
}

.auth-brand__headline {
    font-family: var(--font-display);
    font-size: clamp(2.75rem, 4.5vw, 4.5rem);
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.04em;
    line-height: 1.0;
    margin-bottom: 1.5rem;
    animation: fadeUp 0.7s ease-out 0.3s both;
}

.auth-brand__headline .outline {
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.4);
    -webkit-text-fill-color: transparent;
    display: block;
}

.auth-brand__headline .accent {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand__desc {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.7;
    max-width: 420px;
    animation: fadeUp 0.7s ease-out 0.45s both;
}

/* Brand manifesto */
.auth-brand__manifesto {
    margin-top: 3rem;
    padding-left: 1.5rem;
    border-left: 2px solid rgba(198, 123, 92, 0.25);
    position: relative;
    animation: fadeUp 0.7s ease-out 0.6s both;
}

.auth-brand__manifesto::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-accent), var(--color-accent-bright));
    opacity: 0;
    animation: manifestoBorder 0.8s ease-out 1.2s forwards;
}

@keyframes manifestoBorder {
    to { opacity: 1; }
}

.auth-brand__quote {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
    letter-spacing: -0.01em;
    margin: 0;
}

.auth-brand__quote em {
    font-style: normal;
    color: var(--color-accent-bright);
}

.auth-brand__signature {
    display: block;
    margin-top: 1rem;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgba(198, 123, 92, 0.5);
    letter-spacing: 0.06em;
}

/* Brand footer */
.auth-brand__footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeUp 0.6s ease-out 0.7s both;
}

.auth-brand__footer-link {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.3s;
}

.auth-brand__footer-link:hover {
    color: rgba(255, 255, 255, 0.4);
}

.auth-brand__footer-copy {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.1);
    letter-spacing: 0.02em;
}

/* ============================================================
   RIGHT PANEL — THE FORM
   ============================================================ */
.auth-panel {
    width: 500px;
    min-width: 440px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    background: var(--color-dark-card);
    border-left: 1px solid var(--color-dark-border);
    position: relative;
}

/* Top accent edge */
.auth-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -1px;
    right: 0;
    height: 100%;
    width: 2px;
    background: linear-gradient(180deg, var(--color-accent), transparent 50%);
    opacity: 0.3;
}

.auth-panel__inner {
    width: 100%;
    max-width: 340px;
}

/* Mobile logo (hidden desktop) */
.auth-panel__logo {
    display: none;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.03em;
    text-decoration: none;
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-panel__logo span {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card */
.auth-card {
    animation: panelReveal 0.6s var(--ease-out-expo) 0.15s both;
}

@keyframes panelReveal {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: 0.375rem;
    letter-spacing: -0.02em;
}

.auth-card__desc {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Alerts */
.auth-alert {
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: alertSlide 0.4s var(--ease-out-back);
}

@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-alert--success {
    background: rgba(34, 197, 94, 0.06);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.1);
}

.auth-alert--success::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.auth-alert--error {
    background: rgba(239, 68, 68, 0.06);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.auth-alert--error::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-error);
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Form */
.auth-form__group {
    margin-bottom: 1.125rem;
    position: relative;
}

.auth-form__label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 0.5rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.3s;
}

.auth-form__group:focus-within .auth-form__label {
    color: var(--color-accent);
}

.auth-form__input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: var(--font-body);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    background: var(--color-dark-elevated);
    color: var(--color-white);
    transition: all 0.3s var(--ease-out-expo);
    outline: none;
}

.auth-form__input:focus {
    border-color: rgba(198, 123, 92, 0.3);
    box-shadow:
        0 0 0 3px rgba(198, 123, 92, 0.06),
        0 0 20px -4px rgba(198, 123, 92, 0.1);
    background: rgba(25, 28, 36, 0.8);
}

.auth-form__input::placeholder {
    color: rgba(255, 255, 255, 0.15);
    font-weight: 300;
}

.auth-form__input--error {
    border-color: rgba(239, 68, 68, 0.3);
}

.auth-form__error {
    display: block;
    font-size: 0.6875rem;
    color: #fca5a5;
    margin-top: 0.375rem;
}

.auth-form__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.auth-form__checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: color 0.2s;
}

.auth-form__checkbox:hover {
    color: rgba(255, 255, 255, 0.55);
}

.auth-form__checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    background: var(--color-dark-elevated);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.auth-form__checkbox input[type="checkbox"]:checked {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.auth-form__checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 4.5px;
    width: 4px;
    height: 7px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

/* Button */
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.8125rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--color-white);
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.auth-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.auth-btn:hover {
    background: var(--color-accent-dark);
    transform: translateY(-1px);
    box-shadow:
        0 8px 24px -6px rgba(198, 123, 92, 0.4),
        0 0 0 1px rgba(198, 123, 92, 0.2);
}

.auth-btn:hover::before {
    left: 100%;
}

.auth-btn:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 2px 8px -2px rgba(198, 123, 92, 0.3);
}

.auth-btn__arrow {
    transition: transform 0.3s var(--ease-out-expo);
    font-size: 1.125rem;
    line-height: 1;
}

.auth-btn:hover .auth-btn__arrow {
    transform: translateX(4px);
}

.auth-btn--loading {
    pointer-events: none;
    color: transparent;
}

.auth-btn--loading::before { display: none; }

.auth-btn--loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Divider */
.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.auth-switch__btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    letter-spacing: 0.01em;
}

.auth-switch__btn:hover {
    color: var(--color-accent);
    background: rgba(198, 123, 92, 0.06);
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.25);
}

.auth-footer a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--color-accent-bright);
}

/* Mobile bottom */
.auth-panel__bottom {
    display: none;
    text-align: center;
    margin-top: 2rem;
}

.auth-panel__bottom a {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ============================================================
   CONNECTION LOADER
   ============================================================ */
.auth-loader {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-dark);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-loader.active {
    display: flex;
    animation: loaderIn 0.3s ease-out;
}

@keyframes loaderIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-loader__ring {
    width: 56px;
    height: 56px;
    position: relative;
}

.auth-loader__ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.auth-loader__ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 2.5;
}

.auth-loader__ring-progress {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    animation: ring-fill 1.4s ease-in-out infinite;
}

@keyframes ring-fill {
    0% { stroke-dashoffset: 157; }
    50% { stroke-dashoffset: 39; }
    100% { stroke-dashoffset: 157; }
}

.auth-loader__letter {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-white);
}

.auth-loader__text {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.08em;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .auth-brand {
        padding: 2rem 2.5rem;
    }

    .auth-brand__headline {
        font-size: clamp(2.25rem, 4vw, 3.5rem);
    }
}

@media (max-width: 860px) {
    .auth-split {
        flex-direction: column;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        width: 100%;
        min-width: unset;
        min-height: 100vh;
        border-left: none;
        padding: 2rem 1.5rem;
        background: var(--color-dark);
    }

    .auth-panel::before {
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
        opacity: 0.2;
    }

    .auth-panel__logo {
        display: block;
    }

    .auth-panel__bottom {
        display: block;
    }

    .auth-panel__inner {
        max-width: 380px;
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 1.5rem 1.25rem;
    }
}

@media (min-width: 1440px) {
    .auth-brand {
        padding: 3rem 5rem;
    }
}
