:root {
  --bg: #020617;
  --panel: #0f172a;
  --border: rgba(51, 65, 85, 0.9);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --danger: #f87171;
  --ok: #4ade80;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
  min-height: 100vh;
}

.login-body {
  position: relative;
  overflow: hidden;
}

.login-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(14, 165, 233, 0.28), transparent 60%),
    radial-gradient(700px 420px at 88% 108%, rgba(56, 189, 248, 0.14), transparent 55%),
    linear-gradient(165deg, #031525 0%, #020617 48%, #01040c 100%);
  pointer-events: none;
}
.login-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(226, 232, 240, 0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 68%, rgba(148, 163, 184, 0.4) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 46% 18%, rgba(226, 232, 240, 0.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 42%, rgba(148, 163, 184, 0.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 14%, rgba(226, 232, 240, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 72%, rgba(148, 163, 184, 0.4) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 18% 88%, rgba(226, 232, 240, 0.35) 50%, transparent 51%);
  opacity: 0.9;
  animation: drift 18s linear infinite;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-12px, 8px, 0); }
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  min-height: min(640px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 400px);
  gap: 40px;
  align-items: stretch;
}

.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 20px 28px 8px;
  overflow: hidden;
  perspective: 640px;
  animation: rise 0.7s ease both;
}
.hero-orbit {
  position: absolute;
  right: -8%;
  top: 42%;
  width: 280px;
  height: 280px;
  transform: translateY(-50%);
  transform-style: preserve-3d;
  pointer-events: none;
  opacity: 0.55;
}
.hero-orbit-core {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(125, 211, 252, 0.35), transparent 55%),
    radial-gradient(circle at 50% 55%, rgba(14, 165, 233, 0.22), rgba(2, 6, 23, 0.2) 70%);
  box-shadow: 0 0 40px rgba(14, 165, 233, 0.18);
}
.hero-orbit-ring {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.18);
}
.hero-orbit-ring.r1 { inset: 8%; border-color: rgba(56, 189, 248, 0.12); }
.hero-orbit-ring.r2 { inset: 22%; transform: rotateX(66deg) rotateZ(-18deg); }
.hero-orbit-ring.r3 { inset: 34%; transform: rotateX(66deg) rotateZ(28deg); border-color: rgba(125, 211, 252, 0.22); }
.hero-orbit-sat {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), 0 0 10px rgba(56, 189, 248, 0.55);
}
.hero-orbit-sat.s1 { top: 18%; right: 28%; }
.hero-orbit-sat.s2 { bottom: 26%; left: 22%; background: #fde047; box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.18), 0 0 10px rgba(250, 204, 21, 0.45); }
.hero-orbit-sat.s3 { top: 48%; right: 12%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18), 0 0 10px rgba(74, 222, 128, 0.4); }

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.login-mark-wrap {
  flex-shrink: 0;
  border-radius: 18px;
  padding: 2px;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.7), rgba(14, 165, 233, 0.12) 55%, rgba(51, 65, 85, 0.45));
  box-shadow: 0 0 28px rgba(14, 165, 233, 0.28);
}
.login-mark {
  width: 72px;
  height: 72px;
  display: block;
  border-radius: 16px;
  background: #0b1220;
}
.hero-brand-text { min-width: 0; }
.login-kicker {
  margin: 0 0 4px;
  color: #7dd3fc;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.login-product {
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.05;
  background: linear-gradient(180deg, #f8fafc 18%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-title {
  position: relative;
  margin: 0;
  font-size: 1.28rem;
  font-weight: 650;
  color: #e2e8f0;
  letter-spacing: 0.04em;
}
.login-lead {
  position: relative;
  margin: 12px 0 0;
  max-width: 36ch;
  color: #94a3b8;
  line-height: 1.65;
  font-size: 0.98rem;
}

.hero-sats {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  max-width: 420px;
}
.hero-sats li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(51, 65, 85, 0.75);
  font-size: 0.92rem;
  font-weight: 650;
  color: #e2e8f0;
}
.hero-sats small {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
}
.hero-sats .sys-gps { border-color: rgba(0, 212, 255, 0.28); }
.hero-sats .sys-bds { border-color: rgba(255, 204, 0, 0.28); }
.hero-sats .sys-glo { border-color: rgba(255, 59, 92, 0.28); }
.hero-sats .sys-gal { border-color: rgba(34, 255, 136, 0.28); }
.fi {
  display: inline-block;
  width: 1.15em;
  height: 0.86em;
  background: center / cover no-repeat;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #0007;
  flex-shrink: 0;
  align-self: center;
}
.fi-us { background-image: url("/assets/img/flags/us.svg"); }
.fi-cn { background-image: url("/assets/img/flags/cn.svg"); }
.fi-ru { background-image: url("/assets/img/flags/ru.svg"); }
.fi-eu { background-image: url("/assets/img/flags/eu.svg"); }

.hero-points {
  position: relative;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  max-width: 440px;
}
.hero-points li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}
.hero-idx {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #38bdf8;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.hero-points strong {
  display: block;
  font-size: 0.92rem;
  color: #f1f5f9;
  font-weight: 650;
}
.hero-points span {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.45;
}

.login-panel {
  align-self: center;
  width: 100%;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  backdrop-filter: blur(10px);
  animation: rise 0.7s ease 0.08s both;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--border);
}
.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.auth-tab:hover { color: #e2e8f0; }
.auth-tab.active {
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}
.auth-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}
.auth-error[hidden],
.auth-ok[hidden],
.login-form[hidden] { display: none !important; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
}

.auth-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}
.auth-brand h1 { margin: 0; font-size: 1.35rem; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }

.auth-form label,
.login-form label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-form input,
.login-form input,
.admin-form-row input,
.admin-form-row select,
.settings-grid input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #020617;
  color: var(--text);
  font: inherit;
}
.auth-form input:focus,
.login-form input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.captcha-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.captcha-field { margin-bottom: 0 !important; }
.captcha-refresh {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #020617;
  cursor: pointer;
  overflow: hidden;
  min-width: 148px;
}
.captcha-refresh:hover { border-color: rgba(56, 189, 248, 0.5); }
.captcha-refresh:disabled { opacity: 0.6; cursor: wait; }
.captcha-img {
  display: block;
  width: 148px;
  height: 48px;
}
.captcha-hint {
  font-size: 0.72rem;
  color: var(--muted);
  padding-bottom: 4px;
}

.auth-form button[type="submit"],
.login-form button[type="submit"],
.admin-form-row button,
.admin-actions button,
.admin-table button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--cyan);
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.login-form button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: wait;
}
.admin-form-row button,
.admin-actions button,
.admin-table button { width: auto; }
.admin-table button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.admin-table button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.auth-error { color: var(--danger); font-size: 0.9rem; margin: 0 0 12px; }
.auth-ok { color: var(--ok); font-size: 0.9rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

@media (max-width: 820px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 18px;
    min-height: 0;
  }
  .login-hero { padding: 8px 4px 4px; }
  .hero-orbit { display: none; }
  .login-lead { max-width: none; }
  .hero-sats, .hero-points { max-width: none; }
  .captcha-block { grid-template-columns: 1fr; }
  .captcha-refresh { width: 100%; }
  .captcha-img { width: 100%; height: auto; }
}

.admin-body {
  display: block;
  place-items: unset;
  padding: 0;
}
.admin-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
}
.admin-back { color: var(--cyan); text-decoration: none; }
.admin-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 20px;
}
.admin-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.admin-panel h2 { margin: 0 0 12px; font-size: 1.1rem; }
.admin-form-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
@media (max-width: 720px) {
  .admin-form-row { grid-template-columns: 1fr; }
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.admin-table td.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.settings-grid {
  display: grid;
  gap: 12px;
}
.settings-grid label {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}
.settings-grid .meta { color: var(--muted); font-size: 0.8rem; }
.settings-grid button.reset {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 10px;
}
.admin-actions { margin-top: 14px; }
@media (max-width: 720px) {
  .settings-grid label { grid-template-columns: 1fr; }
}
