/* Sign-in, sign-up and password reset. Loaded after brand.css: this file owns #authDialog. */
#authDialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 30px 32px 28px; }
#authDialog > .dialog-close { position: absolute; top: 18px; right: 18px; margin: 0; }
#authDialog > .dialog-close button { width: 36px; height: 36px; font-size: 20px; line-height: 1; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.03em; color: var(--text); }
#authDialog h2 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
.auth-lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.55; }

#authDialog .auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 20px; background: var(--night-2); border: 1px solid var(--rail); border-radius: 12px; }
#authDialog .auth-tabs [data-auth-tab] { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 14px var(--font-ui); box-shadow: none; transition: background .18s, color .18s; }
#authDialog .auth-tabs [data-auth-tab]:hover { color: #fff; }
#authDialog .auth-tabs [data-auth-tab][aria-selected=true] { background: var(--hall-3); color: #fff; box-shadow: 0 1px 0 #ffffff12 inset, 0 6px 16px -10px #000; }
#authDialog #authError { margin: 0 0 16px; padding: 11px 14px; font-size: 14px; line-height: 1.5; }

.auth-form { display: grid; gap: 16px; }
.auth-form.hidden, .auth-owner.hidden, .auth-help.hidden, .auth-roles.hidden, .auth-invite.hidden { display: none; }
.auth-field { display: grid; gap: 7px; min-width: 0; margin: 0; }
.auth-label, .auth-field-head label { color: #DCDEFA; font-size: 13px; font-weight: 600; }
.auth-label em { margin-left: 6px; color: var(--subtle); font-style: normal; font-weight: 500; }
.auth-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#authDialog input:not([type=checkbox]):not([type=radio]) { width: 100%; min-height: 46px; font-size: 15px; }
#authDialog input[readonly] { color: var(--muted); background-color: var(--night-2); }
.auth-hint { margin: 0; color: var(--subtle); font-size: 12.5px; line-height: 1.45; }
.auth-hint:empty { display: none; }
.auth-hint.bad { color: #FFA3B1; }
.auth-hint.ok { color: #7FF0BF; }
.auth-note { margin: 0; padding: 12px 14px; border: 1px solid #8C7CFF33; border-radius: 12px; background: #8C7CFF10; color: #CFD1F3; font-size: 13px; line-height: 1.55; }
.auth-note:empty { display: none; }

.password-wrap { position: relative; }
#authDialog .password-wrap input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 5px; display: grid; place-items: center; width: 38px; height: 38px; transform: translateY(-50%); border: 0; border-radius: 9px; background: transparent; color: var(--subtle); cursor: pointer; transition: color .18s, background .18s; }
.password-toggle:hover { background: #ffffff0b; color: #fff; }
.password-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.password-toggle svg { width: 19px; height: 19px; }
.password-toggle .eye-closed, .password-toggle[aria-pressed=true] .eye-open { display: none; }
.password-toggle[aria-pressed=true] .eye-closed { display: block; }

.password-rules { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 0; padding: 0; list-style: none; }
.password-rules li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--night-2); border: 1px solid var(--rail); color: var(--subtle); font-size: 12px; font-weight: 500; transition: color .2s, border-color .2s, background .2s; }
.password-rules li:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.password-rules li.ok { color: #7FF0BF; border-color: #4BE3A040; background: #4BE3A012; }
.password-rules li.ok:before { opacity: 1; }

.auth-link { padding: 0; border: 0; background: none; color: var(--volt-hi); font: 600 13px var(--font-ui); cursor: pointer; text-decoration: underline; text-decoration-color: #ABA0FF55; text-underline-offset: 3px; }
.auth-link:hover { color: #fff; text-decoration-color: currentColor; }
.auth-switch { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; text-align: center; }
.auth-help { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--rail); border-radius: 12px; background: var(--night-2); color: #CFD1F3; font-size: 13px; line-height: 1.55; }
.auth-help b { color: #fff; font-size: 13.5px; }
.auth-help i { color: #fff; font-style: normal; font-weight: 600; }
.auth-help a { color: var(--volt-hi); }

#authDialog .auth-submit { min-height: 48px; margin-top: 4px; font-size: 15px; }
#authDialog form[aria-busy=true] .auth-submit { opacity: .8; cursor: progress; }
#authDialog form[aria-busy=true] .auth-submit span:after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.auth-roles legend { grid-column: 1 / -1; margin-bottom: 8px; padding: 0; }
.auth-role { position: relative; display: grid; gap: 10px; align-content: start; padding: 14px; border: 1px solid var(--rail); border-radius: 14px; background: var(--night-2); cursor: pointer; transition: border-color .18s, background .18s, transform .2s var(--ease); }
.auth-role:hover { border-color: var(--rail-2); transform: translateY(-1px); }
.auth-role input { position: absolute; opacity: 0; pointer-events: none; }
.auth-role:has(input:checked) { border-color: var(--volt); background: linear-gradient(160deg, #8C7CFF26, #8C7CFF0a); box-shadow: 0 10px 26px -18px #8C7CFF; }
.auth-role:has(input:focus-visible) { box-shadow: var(--ring); }
.auth-role:after { content: ""; position: absolute; top: 14px; right: 14px; width: 16px; height: 16px; border: 1.5px solid var(--rail-2); border-radius: 50%; transition: border .18s, background .18s; }
.auth-role:has(input:checked):after { border: 5px solid var(--volt); background: var(--volt-ink); }
.auth-role-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #8C7CFF22; color: var(--volt-hi); }
.auth-role-icon svg { width: 20px; height: 20px; }
.auth-role-copy { display: grid; gap: 4px; }
.auth-role-copy b { color: #fff; font-size: 14px; font-weight: 650; }
.auth-role-copy small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

.auth-invite { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid #5CD0FF40; border-radius: 14px; background: linear-gradient(160deg, #5CD0FF1a, #5CD0FF06); }
.auth-invite.bad { border-color: #FF6B8150; background: #FF6B8112; }
.auth-invite-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px; background: #5CD0FF22; color: var(--sky); }
.auth-invite-icon svg { width: 20px; height: 20px; }
.auth-invite > span:last-child { display: grid; gap: 3px; }
.auth-invite b { color: #fff; font-size: 14px; }
.auth-invite small { color: #CFD1F3; font-size: 13px; line-height: 1.5; }

.auth-owner { display: grid; gap: 12px; padding-top: 16px; border-top: 1px dashed var(--rail); }
.auth-row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 12px; }

@media (max-width: 480px) {
  #authDialog { padding: 24px 20px 22px; border-radius: 18px; }
  #authDialog > .dialog-close { top: 14px; right: 14px; }
  #authDialog h2 { font-size: 21px; }
  .auth-roles { grid-template-columns: 1fr; }
  .auth-role { grid-template-columns: 36px minmax(0, 1fr); align-items: center; padding-right: 40px; }
  .auth-role:after { top: 50%; margin-top: -8px; }
  .auth-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-role, .password-rules li { transition: none; }
  #authDialog form[aria-busy=true] .auth-submit span:after { animation: none; }
}

/* Admin domains have an authentication screen, never a marketing backdrop. */
html[data-staff-surface="true"] #landing { display: none !important; }
html[data-staff-surface="true"] body { min-height: 100vh; background: var(--night); }
html[data-staff-surface="true"] #authDialog::backdrop { background: radial-gradient(ellipse at 50% 0, #8C7CFF26, transparent 60%), var(--night); }
html[data-staff-surface="true"] #authDialog > .dialog-close { display: none; }
html[data-staff-surface="true"] #authDialog { border-radius: 20px; }
/* The dialog carries its own logo row. */
html[data-staff-surface="true"] #authDialog::before { content: none; display: none; }
.auth-consent { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; text-align: center; }
.auth-consent a { color: inherit; }
