html, body {
    height: 100%;
    margin: 0;
    background-color: var(--mud-palette-background, #111);
}

.no-padding {
    padding: 0;
}

.auth-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100svh;
}

.auth-grid {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

/* LEFT: Branding */
.branding-panel {
    position: relative;
    height: 100%;
    min-height: 50svh;
    overflow: hidden;
    color: #fff;
    isolation: isolate;
    background: linear-gradient(135deg, #6ac6b3 0%, #6ac6b3 18%, #0fa798 50%, #0fa798 68%, #055757 100%);
}

.branding-overlay::before,
.branding-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.branding-overlay::before {
    background:
        radial-gradient(1200px 600px at -20% -10%, rgba(255,255,255,0.14) 0%, transparent 60%),
        radial-gradient(1100px 500px at 120% 110%, rgba(255,255,255,0.10) 0%, transparent 65%),
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.08));
    mix-blend-mode: soft-light;
}

.branding-overlay::after {
    background-image:
        radial-gradient(rgba(255,255,255,0.06) 0.7px, transparent 0.7px),
        radial-gradient(rgba(0,0,0,0.06) 0.7px, transparent 0.7px);
    background-size: 24px 24px, 24px 24px;
    background-position: 0 0, 12px 12px;
    opacity: 0.25;
}

.branding-content {
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 48px 32px;
    height: 100%;
    width: 100%;
}

.branding-avatar {
    background: rgba(255,255,255,0.16);
    color: #fff;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.22);
}

.branding-title {
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #fff;
    text-shadow: 0 1px 12px rgba(0,0,0,0.25);
}

.branding-subtitle {
    max-width: 560px;
}

.divider-light {
    width: 160px;
    margin: 8px auto 2px;
    opacity: 0.45;
    border-color: rgba(255,255,255,0.45);
    background-color: rgba(255,255,255,0.45);
    height: 1px;
}

.features-list {
    margin-top: 8px;
    color: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.features-list .mud-icon-root {
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.25));
}

/* RIGHT: Form */
.form-panel {
    position: relative;
    background: var(--mud-palette-surface, #1f1f1f);
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: 100%;
    min-height: 50svh;
}

.form-panel-inner {
    position: relative;
    width: min(680px, 100%);
    padding: clamp(24px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 auto;
}

.form-theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

.form-stack {
    margin-top: clamp(12px, 4vh, 32px);
    margin-bottom: 24px;
}

.form-card {
    border-radius: 16px;
    backdrop-filter: saturate(1.05) blur(8px);
    background-color: var(--mud-palette-surface, #1f1f1f);
    outline: 1px solid var(--mud-palette-lines-default, #3b3b3b);
    box-shadow: 0 10px 25px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
}

.form-card-wrapper {
    position: relative;
}

.form-card-wrapper.loading-state .form-card {
    filter: grayscale(0.2) brightness(0.9);
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 150ms ease;
}

.loader-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(8, 8, 8, 0.45);
    backdrop-filter: blur(2px);
    border-radius: 16px;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.35));
}

.loader-text {
    opacity: 0.85;
}

.rounded-input .mud-input-root.mud-input-outlined,
.mud-input-root.mud-input-outlined.rounded-input {
    border-radius: 12px;
}

.mud-input-root.mud-input-outlined {
    transition: box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
    background-color: var(--mud-palette-surface, #1f1f1f);
}

.mud-input-root.mud-input-outlined:hover {
    box-shadow: 0 0 0 3px rgba(15, 167, 152, 0.18);
}

.mud-input-root.mud-input-outlined.mud-focused {
    box-shadow: 0 0 0 3px rgba(15, 167, 152, 0.24);
    border-color: rgba(15, 167, 152, 0.42);
}

.forgot-link {
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Primary gradient button */
.primary-gradient-btn {
    border-radius: 12px;
    color: #fff !important;
    background-image: linear-gradient(135deg, #6ac6b3 0%, #0fa798 50%, #055757 100%);
    background-size: 200% 200%;
    transition: transform 120ms ease, box-shadow 120ms ease, background-position 240ms ease;
    box-shadow: 0 8px 22px rgba(0,0,0,0.18);
}

.primary-gradient-btn:hover:not(.mud-disabled) {
    transform: translateY(-1px);
    background-position: 100% 0%;
    box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}

/* Mobile app card */
.mobile-app-card {
    border-radius: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #6ac6b3 0%, #0fa798 50%, #055757 100%);
    color: #fff;
    outline: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 14px 36px rgba(0,0,0,0.22);
}

.mobile-card-title {
    color: #fff;
    font-weight: 600;
}

.mobile-card-subtitle {
    color: rgba(255,255,255,0.92);
}

.store-badge {
    border-radius: 12px;
    text-transform: none;
    font-weight: 600;
    padding: 8px 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.16);
    color: #fff !important;
}

.badge-apple {
    background: linear-gradient(180deg, #0f1114, #1a1d21);
}

.badge-google {
    background: linear-gradient(180deg, #0d1a14, #10251c);
}

.mobile-app-text-center {
    text-align: center;
}

.mobile-app-text-center .mud-typography {
    width: 100%;
}

/* Footer */
.mobile-footer-powered {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 12px;
    padding-bottom: 8px;
}

.mobile-footer-text {
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.mobile-footer-logo {
    height: 16px;
}

/* Error states */
.mud-input-root.mud-input-outlined.mud-error {
    border-color: var(--mud-palette-error) !important;
    box-shadow: 0 0 0 3px rgba(214, 0, 170, 0.18);
}

.mud-input-helper-text.mud-input-error,
.mud-input-error .mud-input-helper-text {
    color: var(--mud-palette-error) !important;
}

.mud-input-label.mud-error,
.mud-input-root.mud-error .mud-input-label {
    color: var(--mud-palette-error) !important;
}

.mud-input-helper-text {
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 959.98px) {
    .form-panel-inner {
        max-width: 420px;
        width: 100%;
        padding: 20px 20px 28px;
        margin-top: 12px;
    }

    .mobile-app-card {
        position: static;
        margin-top: 20px;
    }

    .form-stack {
        margin-bottom: 12px;
    }

    body {
        overflow: auto;
    }

    .auth-container {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100svh;
    }

    .form-panel {
        background: transparent;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        height: 100%;
        min-height: 100%;
    }

    .mobile-footer-powered {
        margin-top: 16px;
        padding-bottom: 8px;
    }

    .mobile-footer-logo {
        height: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .primary-gradient-btn,
    .mud-input-root.mud-input-outlined {
        transition: none !important;
    }
}