:root {
    --auth-bg: #ffffff;
    --auth-fg: #0a0a0a;
    --auth-muted: #737373;
    --auth-faint: #a3a3a3;
    --auth-line: #e5e5e5;
    --auth-fill: #fafafa;
    --auth-accent: #0a0a0a;
    --auth-accent-hover: #262626;
    --auth-accent-fg: #ffffff;
    --wl-accent: #0a0a0a;
    --wl-accent-hover: #262626;
    --wl-link-hover: #404040;
}

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

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--auth-bg);
    color: var(--auth-fg);
    font-family: "Helvetica World", "Helvetica Neue", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea,
.auth-btn,
.auth-input,
.auth-top-link,
.auth-toggle {
    font-family: "Helvetica World", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.auth-phone-row {
    display: flex;
    gap: 8px;
}
.auth-phone-row select { width: 42%; }
.auth-phone-row input { flex: 1; width: auto; }
.auth-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--auth-muted);
}
.auth-org-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-org-card {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    padding: 14px 14px 14px 16px;
    background: #fff;
}
.auth-org-card svg { flex-shrink: 0; }
.auth-org-copy { flex: 1; min-width: 0; }
.auth-org-copy strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.auth-org-copy span {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--auth-muted);
}
.auth-org-card form { margin: 0; flex-shrink: 0; }
.auth-org-card .auth-btn { width: auto; height: 40px; padding: 0 14px; }
.auth-btn-compact { width: auto !important; padding: 0 16px; height: 40px; }

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    isolation: isolate;
}

.auth-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(to right, rgba(10, 10, 10, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(10, 10, 10, 0.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 18%, transparent 78%);
    pointer-events: none;
}

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    position: relative;
    z-index: 2;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.auth-logo img {
    height: 28px;
    width: auto;
    display: block;
}

.auth-logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.04em;
    color: var(--auth-fg);
}

.auth-top-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-muted);
    text-decoration: none;
    border: 1px solid var(--auth-line);
    border-radius: 999px;
    padding: 8px 14px;
    background: #fff;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.auth-top-link:hover {
    color: var(--auth-fg);
    border-color: #cfcfcf;
    background: var(--auth-fill);
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 64px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card-wide { max-width: 460px; }

.auth-step {
    margin: 0 0 8px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--auth-faint);
}

.auth-btn-secondary {
    background: #fff;
    color: var(--auth-fg);
    border: 1px solid var(--auth-line);
}
.auth-btn-secondary:hover {
    background: var(--auth-fill);
    border-color: #d4d4d4;
}

select.auth-input { cursor: pointer; }

.auth-code-input {
    letter-spacing: 0.28em;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.auth-card h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.12;
    letter-spacing: -0.045em;
    font-weight: 600;
}

.auth-lede {
    margin: 10px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--auth-muted);
}

.auth-lede a,
.auth-foot a,
.auth-legal a {
    color: var(--auth-fg);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-lede a:hover,
.auth-foot a:hover,
.auth-legal a:hover { opacity: 0.7; }

.auth-stack { margin-top: 28px; }

.auth-alert {
    border: 1px solid #fecaca;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 20px;
}

.auth-alert h3 {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #991b1b;
}

.auth-alert ul {
    margin: 0;
    padding-left: 18px;
    color: #7f1d1d;
    font-size: 13px;
    line-height: 1.5;
}

button { appearance: none; -webkit-appearance: none; }

.auth-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 46px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, transform .12s ease, opacity .15s ease;
}

.auth-btn:active { transform: scale(0.985); }

.auth-btn-google {
    background: #fff;
    color: var(--auth-fg);
    border: 1px solid var(--auth-line);
}

.auth-btn-google:hover {
    background: var(--auth-fill);
    border-color: #d4d4d4;
}

.auth-btn-google:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.12);
}

.auth-btn-primary {
    background: var(--wl-accent, var(--auth-accent));
    color: var(--auth-accent-fg);
    border: 1px solid transparent;
}

.auth-btn-primary:hover {
    background: var(--wl-accent-hover, var(--auth-accent-hover));
}

.auth-btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.16);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--auth-faint);
    font-size: 12px;
}

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

.auth-field { margin-bottom: 14px; }

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 7px;
    color: var(--auth-fg);
}

.auth-input-wrap { position: relative; }

.auth-input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    padding: 0 14px;
    font-size: 14.5px;
    color: var(--auth-fg);
    background: #fff;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-input::placeholder { color: #a3a3a3; }

.auth-input:focus {
    outline: none;
    border-color: var(--auth-fg);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}

.auth-input.has-toggle { padding-right: 44px; }

.auth-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.auth-toggle:hover { color: var(--auth-fg); background: var(--auth-fill); }

.auth-row {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0 18px;
}

.auth-row a {
    font-size: 13px;
    color: var(--auth-muted);
    text-decoration: none;
    font-weight: 500;
}

.auth-row a:hover { color: var(--auth-fg); }

.auth-legal {
    margin: 22px 0 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.55;
    color: var(--auth-muted);
}

.auth-foot {
    margin: 28px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--auth-muted);
}

.auth-wl-brand {
    margin-bottom: 22px;
}

.auth-wl-brand img {
    height: 36px;
    max-width: 220px;
    object-fit: contain;
}

.loader {
    display: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    animation: auth-spin 0.7s linear infinite;
}

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

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    -webkit-text-fill-color: var(--auth-fg) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.auth-toast-wrap {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
}

.alert {
    position: relative;
    max-width: 380px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--auth-line);
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    transform: translateX(110%);
    opacity: 0;
    transition: all 0.25s ease;
}

.alert.show { transform: translateX(0); opacity: 1; }
.alert.success { border-color: #0a0a0a; color: var(--auth-fg); }
.alert.error { border-color: #fecaca; color: #7f1d1d; }
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-close {
    margin-left: auto;
    background: none;
    border: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    padding: 2px;
}
.alert-close:hover { opacity: 1; }
.alert-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    background: #0a0a0a;
    animation: auth-progress 5s linear forwards;
}
.alert.error .alert-progress { background: #ef4444; }

@keyframes auth-progress {
    from { width: 100%; }
    to { width: 0; }
}

@media (max-width: 640px) {
    .auth-top { padding: 16px 16px; }
    .auth-card h1 { font-size: 28px; }
    .auth-org-card { flex-wrap: wrap; }
    .auth-org-card form { width: 100%; }
    .auth-org-card .auth-btn { width: 100%; }
    .auth-phone-row { flex-direction: column; }
    .auth-phone-row select,
    .auth-phone-row input { width: 100%; }
}
