/* ===== P Auth — lock / glass terminal entry ===== */

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

html, body { min-height: 100%; }

.auth-body {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --auth-ink: #07090f;
  --auth-panel: #12141c;
  --auth-panel-2: #171a24;
  --auth-text: #f4f6fb;
  --auth-muted: #9aa3b5;
  --auth-sub: #6b7386;
  --auth-line: rgba(255, 255, 255, 0.08);
  --auth-line-hi: rgba(255, 255, 255, 0.14);
  --auth-blue: #4f8cff;
  --auth-accent-rgb: 79, 140, 255;
  --auth-blue-soft: rgba(var(--auth-accent-rgb), 0.28);
  background: #05060a;
  color: var(--auth-text);
  font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(28px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(28px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  color-scheme: dark;
}

.auth-body .tc-bg {
  background: #05060a;
}

.auth-body .tc-bg-wallpaper { display: none; }

.auth-body .tc-bg-wash {
  display: block;
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 42% 36% at 50% 18%, rgba(var(--auth-accent-rgb), 0.16), transparent 62%),
    radial-gradient(ellipse 50% 40% at 18% 88%, rgba(var(--auth-accent-rgb), 0.1), transparent 60%),
    radial-gradient(ellipse 40% 34% at 88% 72%, rgba(var(--auth-accent-rgb), 0.08), transparent 58%),
    linear-gradient(180deg, #0a0c14 0%, #05060a 48%, #070912 100%);
}

.auth-body .tc-bg-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, transparent 26%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 30%, rgba(0, 0, 0, 0.5));
}

.auth-stage {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  animation: authIn 0.55s var(--ease-out) both;
}

@keyframes authIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.auth-card {
  position: relative;
  overflow: hidden;
  padding: 28px 28px 26px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 34%),
    linear-gradient(165deg, #171a24 0%, #10131b 55%, #0d1018 100%);
  box-shadow:
    0 0 0 1px rgba(var(--auth-accent-rgb), 0.08),
    0 28px 64px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(var(--auth-accent-rgb), 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.012) 2px,
    rgba(255, 255, 255, 0.012) 3px
  );
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 70%);
}

.auth-card::after {
  content: '';
  position: absolute;
  width: 220px;
  height: 140px;
  left: 50%;
  top: -40px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--auth-accent-rgb), 0.16), transparent 70%);
  pointer-events: none;
  filter: blur(10px);
}

.auth-logo {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}

.auth-logo img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  display: block;
  border-radius: 22px;
  overflow: hidden;
  filter: drop-shadow(0 10px 28px rgba(var(--auth-accent-rgb), 0.4));
}

.auth-kicker {
  position: relative;
  z-index: 1;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--auth-sub);
  text-align: center;
  margin-bottom: 10px;
}

.auth-title {
  position: relative;
  z-index: 1;
  font-size: clamp(26px, 5vw, 32px);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.12;
  color: #fff;
  margin: 0 0 10px;
  text-align: center;
}

.auth-sub {
  position: relative;
  z-index: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--auth-muted);
  margin: 0 auto 16px;
  text-align: center;
  max-width: 32ch;
}

.auth-themes {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 20px;
}
.auth-theme {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 8px 6px 7px;
  color: var(--auth-muted);
  cursor: pointer;
  display: grid;
  gap: 6px;
  justify-items: center;
  font-family: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}
.auth-theme.is-on {
  border-color: rgba(var(--auth-accent-rgb), 0.5);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(var(--auth-accent-rgb), 0.16), 0 8px 18px rgba(0, 0, 0, 0.28);
}
.auth-theme span {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
}
.auth-theme-swatch {
  width: 100%;
  height: 18px;
  border-radius: 8px;
  display: block;
}
.auth-theme-swatch--classic {
  background: radial-gradient(circle at 30% 40%, #4f8cff, #101522 72%);
}
.auth-theme-swatch--canopy {
  background: radial-gradient(circle at 30% 40%, #2bfff8, #07140f 72%);
}
.auth-theme-swatch--ember {
  background: radial-gradient(circle at 30% 40%, #ff6d29, #1a1314 72%);
}
.auth-theme-swatch--vesper {
  background: radial-gradient(circle at 30% 40%, #b56cff, #0c0614 72%);
}

.auth-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.auth-field { display: grid; gap: 8px; }

.auth-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--auth-muted);
  padding-left: 2px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  min-height: 52px;
  background: rgba(8, 10, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--auth-text);
  font-size: 15px;
  font-weight: 450;
  font-family: inherit;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 8px 18px rgba(0, 0, 0, 0.28);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.auth-input::placeholder { color: #5c6475; }

.auth-input:focus {
  border-color: rgba(var(--auth-accent-rgb), 0.7);
  background: rgba(10, 14, 24, 0.9);
  box-shadow:
    0 0 0 3px rgba(var(--auth-accent-rgb), 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px #0c1018 inset;
  -webkit-text-fill-color: #f4f6fb;
  caret-color: #f4f6fb;
}

.auth-toggle {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--auth-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 160ms ease, background 160ms ease;
}

.auth-toggle:hover {
  color: var(--auth-text);
  background: rgba(255, 255, 255, 0.05);
}

.auth-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--auth-accent-rgb), 0.35);
}

.auth-toggle svg { width: 18px; height: 18px; }

.auth-alert {
  position: relative;
  z-index: 1;
  display: none;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 2px;
}

.auth-alert.show { display: block; }

.auth-alert.is-error {
  background: rgba(255, 107, 122, 0.1);
  border: 1px solid rgba(255, 107, 122, 0.28);
  color: #fecdd3;
}

.auth-alert.is-ok {
  background: rgba(61, 207, 142, 0.12);
  border: 1px solid rgba(61, 207, 142, 0.28);
  color: #a7f3d0;
}

.auth-captcha { display: none; }

.auth-captcha.show,
.auth-captcha.is-always {
  display: grid;
  gap: 8px;
}

.auth-captcha-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.auth-captcha-img {
  flex: 1;
  min-width: 0;
  min-height: 70px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 16, 0.72);
}

.auth-captcha-img img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  display: block;
}

.auth-captcha-refresh {
  width: 52px;
  flex-shrink: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--auth-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.auth-captcha-refresh:hover {
  color: var(--auth-text);
  border-color: rgba(var(--auth-accent-rgb), 0.4);
  background: rgba(var(--auth-accent-rgb), 0.08);
}

.auth-captcha-refresh.spin svg { animation: authSpin 0.52s linear; }

.auth-submit {
  width: 100%;
  min-height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #e7e9ef);
  color: #0a0c12;
  font-size: 15px;
  font-weight: 650;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease, filter 160ms ease;
}

.auth-submit:hover {
  filter: brightness(1.03);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 14px 28px rgba(0, 0, 0, 0.4);
}

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

.auth-submit:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
  filter: none;
}

.auth-submit:focus-visible {
  outline: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 0 0 3px rgba(var(--auth-accent-rgb), 0.28);
}

.auth-foot {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--auth-muted);
}

.auth-foot a {
  color: var(--auth-blue);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--auth-blue) 28%, transparent);
}

.auth-foot a:hover { color: #fff; }

.auth-meta {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--auth-sub);
}

.auth-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(10, 12, 18, 0.2);
  border-top-color: #0a0c12;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .auth-card {
    padding: 22px 18px 20px;
    border-radius: 24px;
  }

  .auth-title { font-size: 26px; }

  .auth-input,
  .auth-submit { min-height: 50px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-stage,
  .auth-captcha-refresh.spin svg,
  .auth-spinner {
    animation: none;
  }

  .auth-submit,
  .auth-input,
  .auth-toggle,
  .auth-captcha-refresh {
    transition: none;
  }
}
