/* Shared iEmpyrean Ecosystem auth layout */
html.neo-auth-html,
body.neo-auth-shell {
    margin: 0;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    background: var(--neo-bg-gradient, var(--neo-bg));
    color: var(--neo-text);
    font-family: Inter, system-ui, sans-serif;
}

body.neo-auth-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, color-mix(in srgb, var(--neo-accent) 12%, transparent), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 100%, color-mix(in srgb, var(--neo-accent) 8%, transparent), transparent 50%);
}

body.neo-auth-shell::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.neo-auth-chrome {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 56px;
    padding: 0 clamp(12px, 3vw, 20px);
    border-bottom: 1px solid var(--neo-line);
    background: color-mix(in srgb, var(--neo-surface) 90%, transparent);
    backdrop-filter: blur(12px);
}

.neo-auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.neo-auth-brand .neo-switcher-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.neo-auth-brand-text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.neo-auth-chrome-utils {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.neo-auth-chrome-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--neo-line);
    background: var(--neo-surface2);
    color: var(--neo-text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.neo-auth-chrome-btn:hover {
    background: var(--neo-accent-soft);
    border-color: color-mix(in srgb, var(--neo-accent) 35%, var(--neo-line));
}

.neo-auth-chrome-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--neo-muted);
    text-decoration: none;
}

.neo-auth-chrome-link:hover {
    color: var(--neo-accent);
    background: var(--neo-accent-soft);
}

.neo-auth-lang-btn {
    min-width: 0;
}

.neo-auth-lang-btn .neo-lang-btn-flag {
    width: 20px;
    height: 15px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.neo-auth-lang-btn #neoAuthLangLabel {
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.neo-auth-shell .neo-modal-backdrop.neo-picker-panel {
    z-index: 200;
}

.neo-auth-main {
    position: fixed;
    inset: 56px 0 0;
    z-index: 1;
    display: grid;
    place-items: center;
    padding: clamp(12px, 2vh, 20px) clamp(12px, 3vw, 20px);
    overflow: hidden;
    box-sizing: border-box;
}

.neo-auth-card {
    width: min(440px, 100%);
    max-height: calc(100vh - 72px);
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--neo-surface);
    border: 1px solid var(--neo-line);
    border-radius: 18px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: var(--neo-shadow);
    box-sizing: border-box;
}

.neo-auth-shell-wide .neo-auth-card,
.neo-auth-card-wide {
    width: min(720px, 100%);
    max-width: 100%;
}

.neo-auth-card h1 {
    margin: 0 0 6px;
    font-size: clamp(1.35rem, 3vw, 1.6rem);
    letter-spacing: -0.03em;
}

.neo-auth-card .sub,
.neo-auth-lead {
    margin: 0 0 20px;
    color: var(--neo-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.neo-field {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.neo-field-control {
    position: relative;
    display: grid;
}

.neo-field-control input,
.neo-field-control select,
.neo-field-control textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 40px 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--neo-line);
    background: var(--neo-surface2);
    color: var(--neo-text);
    box-sizing: border-box;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.neo-field-status {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    pointer-events: none;
}

.neo-field-status-icon {
    width: 18px;
    height: 18px;
}

.neo-field-status-valid {
    color: var(--neo-good, #22c55e);
}

.neo-field-status-error {
    color: var(--neo-bad);
}

.neo-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--neo-muted);
}

.neo-field input,
.neo-field select,
.neo-field textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--neo-line);
    background: var(--neo-surface2);
    color: var(--neo-text);
    box-sizing: border-box;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.neo-field input:hover,
.neo-field-control input:hover,
.neo-field select:hover,
.neo-field-control select:hover,
.neo-field textarea:hover,
.neo-field-control textarea:hover {
    border-color: color-mix(in srgb, var(--neo-accent) 25%, var(--neo-line));
}

.neo-field input:focus,
.neo-field-control input:focus,
.neo-field select:focus,
.neo-field-control select:focus,
.neo-field textarea:focus,
.neo-field-control textarea:focus {
    outline: none;
    border-color: var(--neo-accent);
    box-shadow: 0 0 0 3px var(--neo-accent-soft);
}

.neo-field.neo-field-error input,
.neo-field.neo-field-error select,
.neo-field.neo-field-error textarea,
.neo-field.neo-field-error .neo-field-control input,
.neo-field.neo-field-error .neo-field-control select,
.neo-field.neo-field-error .neo-field-control textarea {
    border-color: var(--neo-bad);
    background: color-mix(in srgb, var(--neo-bad) 8%, var(--neo-surface2));
}

.neo-field.neo-field-valid input,
.neo-field.neo-field-valid select,
.neo-field.neo-field-valid textarea,
.neo-field.neo-field-valid .neo-field-control input,
.neo-field.neo-field-valid .neo-field-control select,
.neo-field.neo-field-valid .neo-field-control textarea {
    border-color: var(--neo-good, #22c55e);
    background: color-mix(in srgb, var(--neo-good, #22c55e) 8%, var(--neo-surface2));
}

.neo-field-error-msg,
.neo-field-error-slot {
    margin: 4px 0 0;
    min-height: 1.15rem;
    font-size: 0.78rem;
    color: var(--neo-bad);
}

.neo-field-error-slot:empty {
    visibility: hidden;
}

.neo-field-password input {
    padding-right: 72px;
}

.neo-field-password .neo-password-toggle {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--neo-muted);
    cursor: pointer;
}

.neo-field-password .neo-password-toggle:hover {
    color: var(--neo-text);
    background: var(--neo-accent-soft);
}

.neo-field-password .neo-password-toggle svg {
    width: 18px;
    height: 18px;
}

.neo-auth-trust {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.72rem;
    color: var(--neo-muted);
    letter-spacing: 0.01em;
}

.neo-auth-benefit {
    margin: 6px 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--neo-faint, var(--neo-muted));
}

.neo-auth-recovery {
    margin: 10px 0 0;
    text-align: center;
    font-size: 0.82rem;
}

.neo-auth-recovery a {
    color: var(--neo-accent);
    font-weight: 700;
    text-decoration: none;
}

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

.neo-magic-link {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--neo-accent);
    text-decoration: none;
    border-radius: 10px;
    border: 1px dashed color-mix(in srgb, var(--neo-accent) 35%, var(--neo-line));
    background: transparent;
}

.neo-magic-link:hover {
    background: var(--neo-accent-soft);
}

.neo-oauth-row {
    display: grid;
    gap: 8px;
}

.neo-auth-social-block {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.neo-auth-social-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 560px) {
    .neo-auth-social-row {
        grid-template-columns: 1fr;
    }
}

.neo-auth-sso-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--neo-line);
    background: var(--neo-surface2);
    color: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.neo-auth-sso-btn:hover {
    border-color: color-mix(in srgb, var(--neo-accent) 35%, var(--neo-line));
    background: var(--neo-accent-soft);
}

.neo-auth-sso-btn i,
.neo-auth-sso-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.neo-auth-or-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 2px;
    color: var(--neo-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: lowercase;
}

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

.neo-auth-foot-prompt {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--neo-muted);
}

.neo-auth-foot-prompt a {
    color: var(--neo-accent);
    font-weight: 700;
    text-decoration: none;
}

.neo-auth-foot-prompt a:hover {
    text-decoration: underline;
}

.neo-auth-foot-help {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.82rem;
}

.neo-auth-foot-help a {
    color: var(--neo-accent);
    font-weight: 600;
    text-decoration: none;
}

.neo-auth-foot-help a:hover {
    text-decoration: underline;
}

.neo-auth-legal {
    margin: 0 0 12px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--neo-muted);
}

#magic-link-slot {
    margin-top: 10px;
}

.neo-oauth-btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--neo-line);
    background: var(--neo-surface2);
    color: inherit;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
}

.neo-auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: center;
    margin-top: 16px;
    font-size: 0.85rem;
}

.neo-auth-links a {
    color: var(--neo-muted);
    text-decoration: none;
    font-weight: 600;
    padding: 4px 2px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
}

.neo-auth-links a:hover {
    color: var(--neo-accent);
    text-decoration: underline;
}

.neo-auth-form-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--neo-bad) 45%, var(--neo-line));
    background: color-mix(in srgb, var(--neo-bad) 10%, var(--neo-surface2));
    color: var(--neo-bad);
    font-size: 0.85rem;
    font-weight: 700;
}

.neo-form-loading {
    opacity: 0.85;
    pointer-events: none;
}

.neo-auth-btn,
.neo-auth-card button[type="submit"],
.neo-auth-card .neo-auth-primary {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: var(--neo-accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.neo-auth-btn:hover,
.neo-auth-card button[type="submit"]:hover {
    filter: brightness(1.05);
}

.neo-auth-btn:disabled,
.neo-auth-card button[type="submit"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.neo-auth-btn.ghost {
    width: auto;
    background: transparent;
    border: 1px solid var(--neo-line);
    color: var(--neo-text);
}

.neo-auth-links.neo-auth-links-stack {
    flex-direction: row;
    align-items: center;
    gap: 8px 16px;
}

.neo-auth-links.neo-auth-links-stack a {
    display: inline-flex;
    align-items: center;
    padding: 4px 2px;
    border: none;
    background: transparent;
    text-decoration: none;
}

.neo-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--neo-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

/* QR */
.neo-qr-panel {
    display: grid;
    gap: 14px;
    place-items: center;
    text-align: center;
}

.neo-qr-box {
    width: min(240px, 70vw);
    min-height: min(240px, 70vw);
    border-radius: 16px;
    border: 1px dashed var(--neo-line);
    background: var(--neo-surface2);
    display: grid;
    place-items: center;
    color: var(--neo-muted);
    font-size: 0.85rem;
    padding: 12px;
    box-sizing: border-box;
}

.neo-qr-canvas {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
}

.neo-qr-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.neo-qr-actions .neo-auth-btn {
    flex: 1;
}

.neo-spin {
    animation: neo-spin 0.9s linear infinite;
}

@keyframes neo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Choose account (minimal chrome) */
.neo-auth-layout {
    position: fixed;
    inset: 56px 0 0;
    display: flex;
    justify-content: center;
    padding: var(--neo-content-gap, 12px);
    overflow: hidden;
    box-sizing: border-box;
}

.neo-auth-layout-main {
    width: 100%;
    max-width: 720px;
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
}

.neo-auth-card-wide .neo-account-picker {
    padding: 0;
}

.neo-auth-card-wide .neo-profile-list-item {
    background: var(--neo-surface2);
    border-color: var(--neo-line);
}

@media (max-width: 640px) {
    .neo-auth-brand-text {
        max-width: 42vw;
    }

    .neo-auth-chrome-btn.neo-auth-lang-btn span {
        display: none;
    }
}

/* Password strength meter (register + security) */
.neo-password-strength {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.neo-password-strength-bars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.neo-password-strength-bar {
    height: 4px;
    border-radius: 999px;
    background: var(--neo-line);
}

.neo-password-strength-bar.active.tone-low {
    background: #ef4444;
}

.neo-password-strength-bar.active.tone-medium {
    background: #f59e0b;
}

.neo-password-strength-bar.active.tone-high {
    background: #22c55e;
}

.neo-password-strength-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--neo-muted);
    text-align: right;
}

.neo-password-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    font-size: 11px;
    color: var(--neo-muted);
}

.neo-password-checklist li::before {
    content: "○ ";
    color: var(--neo-faint);
}

.neo-password-checklist li.met {
    color: var(--neo-good);
}

.neo-password-checklist li.met::before {
    content: "✓ ";
    color: var(--neo-good);
}

.neo-password-caps-hint {
    margin: 0;
    font-size: 11px;
    color: var(--neo-warn);
}
