:root {
    --auth-bg: #f4f7fb;
    --auth-panel: #ffffff;
    --auth-hero-bg: #0a0f1a;
    --auth-hero-text: #f1f5f9;
    --auth-hero-muted: #94a3b8;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-border-focus: #14b8a6;
    --auth-primary: #0d9488;
    --auth-primary-hover: #0f766e;
    --auth-primary-glow: rgba(13, 148, 136, 0.22);
    --auth-accent: #2dd4bf;
    --auth-success: #059669;
    --auth-success-bg: #ecfdf5;
    --auth-error: #dc2626;
    --auth-error-bg: #fef2f2;
    --auth-radius: 16px;
    --auth-radius-sm: 10px;
    --auth-shadow: 0 24px 64px rgba(15, 23, 42, 0.08);
    --auth-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.auth-app {
    margin: 0;
    min-height: 100vh;
    font-family: "DM Sans", system-ui, -apple-system, sans-serif;
    background: var(--auth-bg);
    color: var(--auth-text);
    -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */
.auth-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

@media (max-width: 960px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── Hero panel ─── */
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 3rem;
    background: var(--auth-hero-bg);
    color: var(--auth-hero-text);
    overflow: hidden;
}

@media (max-width: 960px) {
    .auth-hero { display: none; }
}

.auth-hero__mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(13, 148, 136, 0.35), transparent 55%),
        radial-gradient(ellipse 60% 50% at 85% 80%, rgba(45, 212, 191, 0.2), transparent 50%),
        linear-gradient(165deg, #0c1222 0%, #0f172a 45%, #0a1628 100%);
}

.auth-hero__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    animation: auth-float 12s ease-in-out infinite;
}

.auth-hero__orb--1 {
    width: 320px;
    height: 320px;
    top: -80px;
    right: -60px;
    background: rgba(13, 148, 136, 0.45);
}

.auth-hero__orb--2 {
    width: 240px;
    height: 240px;
    bottom: 15%;
    left: -40px;
    background: rgba(45, 212, 191, 0.3);
    animation-delay: -4s;
}

.auth-hero__orb--3 {
    width: 180px;
    height: 180px;
    top: 45%;
    right: 20%;
    background: rgba(59, 130, 246, 0.2);
    animation-delay: -8s;
}

@keyframes auth-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(12px, -18px) scale(1.05); }
}

.auth-hero__grid {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black, transparent);
}

.auth-hero__content {
    position: relative;
    z-index: 1;
    max-width: 28rem;
}

.auth-hero__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: inherit;
    text-decoration: none;
    margin-bottom: 3.5rem;
}

.auth-hero__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.4);
}

.auth-hero__logo svg {
    width: 1.35rem;
    height: 1.35rem;
    color: #fff;
}

.auth-hero__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.auth-hero__brand-text strong {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-hero__brand-text small {
    font-size: 0.75rem;
    color: var(--auth-hero-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-hero__eyebrow {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--auth-accent);
}

.auth-hero__headline h2 {
    margin: 0 0 1rem;
    font-family: "Instrument Serif", Georgia, serif;
    font-size: clamp(2.25rem, 4vw, 3rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.auth-hero__headline h2 em {
    font-style: italic;
    color: var(--auth-accent);
}

.auth-hero__lead {
    margin: 0 0 2.5rem;
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--auth-hero-muted);
}

.auth-hero__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-hero__features li {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--auth-hero-muted);
}

.auth-hero__features strong {
    display: block;
    color: var(--auth-hero-text);
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.auth-hero__feature-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--auth-accent);
}

.auth-hero__feature-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.auth-hero__footer {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.8rem;
    color: var(--auth-hero-muted);
}

/* ─── Form panel ─── */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    overflow-y: auto;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(13, 148, 136, 0.06), transparent),
        var(--auth-bg);
}

.auth-panel__inner {
    width: 100%;
    max-width: 440px;
    animation: auth-slide-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-panel__inner:has(.auth-form-shell--register) {
    max-width: 480px;
}

.auth-panel__inner:has(.vendor-register) {
    max-width: 560px;
}

.auth-panel:has(.vendor-register) {
    align-items: flex-start;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

@keyframes auth-slide-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-panel__mobile-brand {
    display: none;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
    color: var(--auth-text);
    text-decoration: none;
    font-size: 1.1rem;
}

@media (max-width: 960px) {
    .auth-panel__mobile-brand { display: inline-flex; }
}

.auth-panel__mobile-logo {
    display: flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
    color: #fff;
}

.auth-panel__mobile-logo svg {
    width: 1.15rem;
    height: 1.15rem;
}

.auth-panel__legal {
    margin: 1.75rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--auth-muted);
}

/* ─── Alerts ─── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: var(--auth-radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.45;
    animation: auth-slide-in 0.35s ease both;
}

.auth-alert svg {
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.1rem;
}

.auth-alert--success {
    background: var(--auth-success-bg);
    color: var(--auth-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.auth-alert--error {
    background: var(--auth-error-bg);
    color: var(--auth-error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ─── Form card ─── */
.auth-card,
.auth-form-shell {
    background: var(--auth-panel);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 2rem 2rem 1.75rem;
    box-shadow: var(--auth-shadow);
}

@media (max-width: 480px) {
    .auth-card,
    .auth-form-shell {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 14px;
    }
}

.auth-form-header {
    margin-bottom: 1.75rem;
}

.auth-form-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--auth-primary);
}

.auth-form-header h1 {
    margin: 0 0 0.5rem;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.auth-form-subtitle {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--auth-muted);
}

/* ─── Fields ─── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 520px) {
    .auth-form-grid {
        grid-template-columns: 1fr;
    }
}

.auth-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--auth-text);
}

.auth-optional {
    font-weight: 500;
    color: var(--auth-muted);
    font-size: 0.78rem;
}

.auth-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.auth-field-label-row label {
    margin-bottom: 0;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 0.9rem;
    display: flex;
    color: var(--auth-muted);
    pointer-events: none;
    transition: color var(--auth-transition);
}

.auth-input-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.auth-input-wrap input {
    width: 100%;
    padding: 0.8rem 0.9rem 0.8rem 2.65rem;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: #fafbfc;
    color: var(--auth-text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color var(--auth-transition), box-shadow var(--auth-transition), background var(--auth-transition);
}

.auth-input-wrap input::placeholder {
    color: #a8b4c4;
}

.auth-input-wrap input:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.auth-input-wrap input:focus {
    outline: none;
    border-color: var(--auth-border-focus);
    background: #fff;
    box-shadow: 0 0 0 4px var(--auth-primary-glow);
}

.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--auth-primary);
}

.auth-input-wrap--error input {
    border-color: var(--auth-error);
    background: var(--auth-error-bg);
}

.auth-input-wrap--error:focus-within input {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.auth-input-action {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    transition: color var(--auth-transition), background var(--auth-transition);
}

.auth-input-action:hover {
    color: var(--auth-text);
    background: rgba(15, 23, 42, 0.05);
}

.auth-input-action .icon-hide { display: none; }

.auth-input-action[aria-pressed="true"] .icon-show { display: none; }
.auth-input-action[aria-pressed="true"] .icon-hide { display: block; }

.auth-input-action svg {
    width: 1.1rem;
    height: 1.1rem;
}

.auth-input-wrap:has(.auth-input-action) input {
    padding-right: 2.75rem;
}

.auth-field-hint {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: var(--auth-muted);
}

.auth-field-hint kbd {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid var(--auth-border);
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--auth-text);
}

.auth-field-error {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--auth-error);
}

/* ─── Password strength ─── */
.auth-strength {
    margin-top: 0.5rem;
}

.auth-strength[hidden] {
    display: none;
}

.auth-strength__bars {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.auth-strength__bars span {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--auth-border);
    transition: background var(--auth-transition);
}

.auth-strength[data-level="1"] .auth-strength__bars span:nth-child(1) { background: #f59e0b; }
.auth-strength[data-level="2"] .auth-strength__bars span:nth-child(-n+2) { background: #f59e0b; }
.auth-strength[data-level="3"] .auth-strength__bars span:nth-child(-n+3) { background: var(--auth-primary); }
.auth-strength[data-level="4"] .auth-strength__bars span { background: var(--auth-success); }

.auth-strength__label {
    margin: 0;
    font-size: 0.78rem;
    color: var(--auth-muted);
}

/* ─── Checkbox ─── */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    position: relative;
    cursor: pointer;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--auth-muted);
}

/* Thymeleaf emits a hidden false value before the checkbox — keep it out of the hit area */
.auth-check input[type="hidden"] {
    display: none;
}

.auth-check input[type="checkbox"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.auth-check__box {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    border: 1.5px solid var(--auth-border);
    border-radius: 6px;
    background: #fafbfc;
    transition: all var(--auth-transition);
}

.auth-check__box svg {
    width: 0.75rem;
    height: 0.75rem;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: all var(--auth-transition);
}

.auth-check input:checked + .auth-check__box {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.auth-check input:checked + .auth-check__box svg {
    opacity: 1;
    transform: scale(1);
}

.auth-check input:focus-visible + .auth-check__box {
    box-shadow: 0 0 0 4px var(--auth-primary-glow);
}

.auth-check--error .auth-check__box {
    border-color: var(--auth-error);
}

.auth-check__text a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-check__text a:hover {
    text-decoration: underline;
}

/* ─── Button ─── */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: var(--auth-radius-sm);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow var(--auth-transition), background var(--auth-transition);
}

.auth-btn svg {
    width: 1.1rem;
    height: 1.1rem;
    transition: transform var(--auth-transition);
}

.auth-btn--primary {
    background: linear-gradient(135deg, var(--auth-primary) 0%, #0f766e 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.auth-btn--primary:hover {
    background: linear-gradient(135deg, var(--auth-primary-hover) 0%, #115e59 100%);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
    transform: translateY(-1px);
}

.auth-btn--primary:hover svg {
    transform: translateX(3px);
}

.auth-btn--primary:active {
    transform: translateY(0);
}

.auth-btn--vendor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.75rem;
    text-decoration: none;
    background: #fff;
    color: var(--auth-primary);
    border: 1px solid var(--auth-primary);
    box-shadow: none;
}

.auth-btn--vendor:hover {
    background: #f0fdfa;
    transform: translateY(-1px);
}

/* ─── Footer links ─── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0 1rem;
    color: var(--auth-muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-switch {
    margin: 0;
    text-align: center;
    font-size: 0.92rem;
    color: var(--auth-muted);
}

.auth-link {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--auth-transition);
}

.auth-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

.auth-link--sm {
    font-size: 0.82rem;
}

.auth-dev-notice {
    margin: 1.25rem 0;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.2);
    font-size: 0.9rem;
}

.auth-dev-token code {
    display: block;
    margin: 0.75rem 0;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: var(--auth-surface);
    word-break: break-all;
    font-size: 0.78rem;
}

.auth-btn--secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: var(--auth-text);
    font-weight: 600;
    text-decoration: none;
}

.auth-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin: 0 0 1.25rem;
    padding: 0.35rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid var(--auth-border);
}

.auth-method-tab {
    border: 0;
    border-radius: 9px;
    padding: 0.7rem 0.75rem;
    background: transparent;
    color: var(--auth-muted, #64748b);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.auth-method-tab.is-active {
    background: var(--auth-surface);
    color: var(--auth-text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.auth-channel-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.auth-channel-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    cursor: pointer;
    font-weight: 600;
}

.auth-channel-option:has(input:checked) {
    border-color: rgba(13, 148, 136, 0.55);
    background: rgba(13, 148, 136, 0.08);
}

.auth-form.is-hidden {
    display: none;
}

.auth-input-wrap select {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: var(--auth-text);
    font: inherit;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    .auth-hero__orb,
    .auth-panel__inner,
    .auth-alert {
        animation: none;
    }

    .auth-btn--primary:hover {
        transform: none;
    }
}
