*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; }
.auth-page { overflow: hidden; }
.auth-shell { position: fixed; top: var(--app-top, 0px); width: 100%; height: var(--app-height, 100dvh); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
.auth-topbar { width: min(1024px, 100%); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 auto; padding: 16px 24px; }
.auth-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 23px; font-weight: 750; letter-spacing: -.7px; }
.auth-brand svg { width: 29px; height: 29px; color: var(--accent); }
.auth-topbar .auth-theme { width: auto; max-width: 148px; min-height: 44px; padding: 10px 12px; font-size: 13px; background: var(--surface); }
.auth-main { flex: 1 0 auto; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 20px 24px; }
.auth-card { width: min(440px, 100%); flex: 0 0 auto; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); }
.auth-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 19px; background: var(--accent-soft); color: var(--accent); margin-bottom: 23px; }
.auth-mark svg { width: 32px; height: 32px; }
.auth-card h1 { margin: 0; font-size: 29px; line-height: 1.18; letter-spacing: -.9px; font-weight: 750; }
.auth-intro { margin: 10px 0 24px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.auth-tabs { display: flex; padding: 4px; margin-bottom: 24px; gap: 4px; background: var(--surface-soft); border-radius: 15px; }
.auth-tabs button { flex: 1 1 0; min-height: 44px; border: 0; border-radius: 12px; padding: 9px 6px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 2px 6px rgba(25, 16, 48, .07); }
.auth-field { margin-bottom: 19px; }
.auth-field .ui-label { font-size: 13px; }
.auth-field .ui-input { min-height: 52px; font-size: 16px; line-height: 24px; outline-offset: 2px; }
.auth-field .ui-input[aria-invalid="true"] { border-color: var(--danger); }
.auth-password { position: relative; }
.auth-password input { padding-inline-end: 56px; }
.auth-password .ui-icon-button { position: absolute; inset-inline-end: 4px; top: 4px; background: transparent; color: var(--muted); }
.auth-submit { width: 100%; min-height: 52px; margin-top: 6px; }
.auth-submit:disabled { opacity: .65; }
.auth-card[aria-busy="true"] .auth-submit::before { content: ""; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: auth-spin .8s linear infinite; }
.auth-connection { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-connection:has(#authStatus:empty):has(#authRetry[hidden]) { display: none; }
#authRetry { min-height: 44px; padding: 8px 12px; border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 12px; cursor: pointer; }
.auth-footer { max-width: 350px; margin: 22px 0 0; font-size: 12px; line-height: 1.6; text-align: center; color: var(--muted); }
.auth-card .ui-error { margin: -3px 0 16px; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
  .auth-topbar { padding: 12px 20px; }
  .auth-main { padding: 16px 16px 24px; justify-content: flex-start; }
  .auth-card { padding: 26px 22px; border-radius: 25px; }
}
@media (max-height: 560px) {
  .auth-topbar { padding-block: 8px; }
  .auth-main { padding-top: 4px; justify-content: flex-start; }
  .auth-card { padding-block: 20px; }
  .auth-mark, .auth-footer { display: none; }
  .auth-card h1 { font-size: 24px; }
  .auth-intro { margin-bottom: 16px; }
  .auth-tabs { margin-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) { .auth-card[aria-busy="true"] .auth-submit::before { animation: none; } }
