#nexdirectory-global-auth-modal[hidden] { display: none !important; }

#nexdirectory-global-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
    background: var(--nd-overlay, rgba(15, 23, 42, 0.48));
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-family: var(--nd-font, inherit);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--nd-dur-3, 0.24s) var(--nd-ease, ease);
}

#nexdirectory-global-auth-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.nexdirectory-auth-modal-open {
    overflow: hidden !important;
}

#nexdirectory-global-auth-modal .nexdirectory-global-auth-modal__dialog {
    width: min(480px, 100%);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    border: 1px solid var(--nd-line, #e5e7eb);
    border-radius: var(--nd-radius-xl, 1.25rem);
    background: var(--nd-surface, #fff);
    box-shadow: var(--nd-shadow-4, 0 28px 84px rgba(2, 6, 23, 0.42));
    transform: translateY(16px) scale(0.98);
    transition: transform var(--nd-dur-3, 0.26s) var(--nd-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

#nexdirectory-global-auth-modal.is-open .nexdirectory-global-auth-modal__dialog {
    transform: none;
}

.nexdirectory-global-auth-modal__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1rem 0.9rem 1.4rem;
    border-bottom: 1px solid var(--nd-line, #f3f4f6);
    background: var(--nd-surface, #fff);
}

.nexdirectory-global-auth-modal__title {
    margin: 0;
    color: var(--nd-ink, #111827);
    font: 700 1.125rem/1.25 var(--nd-font-display, inherit);
    letter-spacing: -0.015em;
}

.nexdirectory-global-auth-modal__close {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--nd-radius, 12px);
    background: transparent;
    color: var(--nd-muted, #374151);
    cursor: pointer;
    transition: background-color var(--nd-dur-2, 0.2s) var(--nd-ease, ease), color var(--nd-dur-2, 0.2s) var(--nd-ease, ease);
}

.nexdirectory-global-auth-modal__close:hover {
    background: rgba(15, 23, 42, 0.05);
    color: var(--nd-ink, #111827);
}

.nexdirectory-global-auth-modal__close svg {
    display: block;
    width: 20px;
    height: 20px;
}

.nexdirectory-global-auth-modal__body {
    padding: 1.2rem 1.4rem 1.5rem;
}

.nexdirectory-global-auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 1.1rem;
    padding: 3px;
    border-radius: calc(var(--nd-radius-sm, 10px) + 2px);
    background: rgba(15, 23, 42, 0.05);
}

.nexdirectory-global-auth-tab {
    min-height: 38px;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: var(--nd-radius-sm, 10px);
    background: transparent;
    color: var(--nd-muted, #6b7280);
    font: 600 0.875rem/1 var(--nd-font, inherit);
    cursor: pointer;
    transition: background-color var(--nd-dur-2, 0.2s) var(--nd-ease, ease), color var(--nd-dur-2, 0.2s) var(--nd-ease, ease);
}

.nexdirectory-global-auth-tab:hover {
    color: var(--nd-ink, #111827);
}

.nexdirectory-global-auth-tab.is-active {
    background: var(--nd-surface, #fff);
    color: var(--nd-ink, #111827);
    box-shadow: var(--nd-shadow-1, 0 1px 3px rgba(0, 0, 0, 0.08)), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.nexdirectory-global-auth-panel[hidden] { display: none !important; }

.nexdirectory-global-auth-form {
    display: grid;
    gap: 0.85rem;
}

.nexdirectory-global-auth-form p {
    margin: 0;
}

.nexdirectory-global-auth-form label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--nd-ink, #374151);
    font: 600 0.8125rem/1.3 var(--nd-font, inherit);
}

.nexdirectory-global-auth-form input[type="text"],
.nexdirectory-global-auth-form input[type="email"],
.nexdirectory-global-auth-form input[type="password"] {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--nd-line-strong, #d1d5db);
    border-radius: var(--nexdirectory-input-radius, var(--nd-radius-sm, 0.75rem));
    background: var(--nexdirectory-input-bg, #fff);
    color: var(--nd-ink, #111827);
    font: 400 1rem/1.4 var(--nd-font, inherit);
    box-shadow: var(--nd-shadow-1, none);
    outline: none;
    transition: border-color var(--nd-dur-2, 0.2s) var(--nd-ease, ease), box-shadow var(--nd-dur-2, 0.2s) var(--nd-ease, ease);
}

.nexdirectory-global-auth-form input:focus {
    border-color: var(--nd-accent, #ff5e14);
    box-shadow: var(--nd-ring, 0 0 0 3px rgba(var(--nexdirectory-primary-rgb, 255, 94, 20), 0.14));
}

.nexdirectory-global-auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: var(--nd-btn-radius, 0.75rem);
    background: var(--nd-accent, #ff5e14);
    color: var(--nd-on-accent, #fff) !important;
    -webkit-text-fill-color: var(--nd-on-accent, #fff) !important;
    font: 650 0.9375rem/1 var(--nd-font, inherit);
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 6px 16px -8px rgba(var(--nd-accent-rgb, 255, 94, 20), 0.6);
    transition: background-color var(--nd-dur-2, 0.2s) var(--nd-ease, ease), box-shadow var(--nd-dur-2, 0.2s) var(--nd-ease, ease);
}

.nexdirectory-global-auth-submit:hover {
    background: var(--nd-accent-hover, #ea580c);
}

.nexdirectory-global-auth-minor {
    justify-self: start;
    padding: 0.25rem 0;
    border: 0;
    background: transparent;
    color: var(--nd-muted, #4b5563);
    font: 500 0.85rem/1.3 var(--nd-font, inherit);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.nexdirectory-global-auth-minor:hover {
    color: var(--nd-ink, #111827);
}

.nexdirectory-global-auth-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--nd-ink-2, #4b5563);
    font: 400 0.85rem/1.35 var(--nd-font, inherit);
}

.nexdirectory-global-auth-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--nd-accent, #ff5e14);
}

#nexdirectory-global-auth-modal :focus-visible {
    outline: 2px solid var(--nd-accent, #ff5e14);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    #nexdirectory-global-auth-modal,
    #nexdirectory-global-auth-modal .nexdirectory-global-auth-modal__dialog {
        transition: none;
    }
}
