﻿:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #1d1d1f;
  background: #f3f6fb;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #f3f6fb; }
button, input { font: inherit; }
button { cursor: pointer; }

.auth-home-link {
  position: fixed;
  z-index: 10;
  top: max(28px, env(safe-area-inset-top));
  left: max(42px, env(safe-area-inset-left));
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 11px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 12px;
  color: #475569;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.auth-home-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-home-link:hover { color: #0879e8; background: #fff; border-color: rgba(8, 121, 232, 0.28); }
.auth-home-link:active { transform: translateY(1px); }
.auth-home-link:focus-visible { outline: 3px solid rgba(8, 121, 232, 0.24); outline-offset: 2px; }

.auth-autofill-decoys {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.auth-autofill-decoys input {
  width: 1px;
  min-height: 1px;
  padding: 0;
  border: 0;
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 420px);
  padding: 38px 40px 40px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.14), 0 3px 12px rgba(15, 23, 42, 0.06);
  transition: opacity 160ms ease, transform 160ms ease;
}

.auth-checking .auth-card { opacity: 0; transform: translateY(6px); pointer-events: none; }
.auth-checking .auth-loading { display: block; }
.auth-loading {
  display: none;
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  color: #64748b;
  font-size: 14px;
}

.auth-brand { text-align: center; margin-bottom: 30px; }
.auth-brand h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -0.03em; }
.auth-brand-link { color: inherit; text-decoration: none; border-radius: 8px; }
.auth-brand-link:hover { opacity: 0.72; }
.auth-brand-link:focus-visible { outline: 3px solid rgba(8, 121, 232, 0.24); outline-offset: 3px; }
.auth-brand p { margin: 8px 0 0; color: #64748b; font-size: 14px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f3f6;
}

.auth-tab {
  border: 0;
  border-radius: 9px;
  padding: 9px 12px;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.auth-tab.is-active {
  color: #0879e8;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.auth-tab:focus-visible, .auth-submit:focus-visible, input:focus-visible {
  outline: 3px solid rgba(8, 121, 232, 0.24);
  outline-offset: 2px;
}

.auth-field { margin-bottom: 12px; }
.auth-field[hidden] { display: none; }

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dfe3e8;
  border-radius: 12px;
  padding: 10px 13px;
  color: #1f2937;
  background: #fff;
  font-size: 15px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder { color: #8a94a3; }
.auth-password-input::placeholder { font-size: 12px; }
input:focus { border-color: #1687ef; box-shadow: 0 0 0 3px rgba(22, 135, 239, 0.1); outline: none; }

.auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 1px;
  border: 0;
  border-radius: 22px;
  padding: 10px 16px;
  color: #fff;
  background: #0879e8;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(8, 121, 232, 0.18);
  transition: background 150ms ease, transform 120ms ease, opacity 150ms ease;
}

.auth-submit:hover { background: #066bcf; }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { cursor: wait; opacity: 0.62; }

.auth-error {
  margin: 12px 0 0;
  color: #dc2626;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.auth-noscript {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  color: #b91c1c;
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .auth-home-link {
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    min-height: 38px;
    padding: 0 12px 0 9px;
    border-radius: 10px;
    font-size: 13px;
  }
  .auth-shell { padding: 16px; }
  .auth-card { padding: 30px 22px 28px; border-radius: 22px; }
  .auth-brand { margin-bottom: 24px; }
  .auth-brand h1 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.auth-code-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
.auth-code-button { min-height: 44px; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; color: #0879e8; font-size: 13px; font-weight: 600; }
.auth-code-button:hover { background: #f8fafc; }
.auth-code-button:disabled { cursor: not-allowed; color: #94a3b8; background: #f8fafc; }
.auth-actions { display: flex; justify-content: flex-end; margin: -2px 2px 10px; }
.auth-actions[hidden] { display: none; }
.auth-text-button, .auth-back-button { border: 0; background: transparent; color: #0879e8; font-size: 13px; padding: 2px 0; }
.auth-back-button { width: 100%; margin-top: 12px; color: #64748b; }
.auth-panel-title { margin: 0 0 16px; text-align: center; color: #334155; font-size: 17px; font-weight: 700; }
.auth-error.is-success { color: #059669; }
