:root {
  --ink: #152236;
  --muted: #6c7b8f;
  --line: #d8e0ea;
  --nav: #10233b;
  --gold: #d6a73b;
  --green: #159566;
  --red: #b43b43;
  --red-soft: #ffedef;
  --orange: #ae6618;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: #eef2f7;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input { font: inherit; }

.auth-shell {
  width: min(1080px, calc(100% - 40px));
  min-height: min(700px, calc(100vh - 64px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr);
  overflow: hidden;
  border: 1px solid rgba(31, 54, 82, .08);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(14, 34, 58, .14);
}

.brand-panel {
  position: relative;
  min-height: 100%;
  padding: 46px 50px;
  overflow: hidden;
  background:
    radial-gradient(circle at 13% 8%, rgba(230, 190, 79, .25), transparent 27%),
    radial-gradient(circle at 92% 88%, rgba(41, 102, 153, .22), transparent 30%),
    linear-gradient(150deg, #142f4e 0%, #0b1c30 72%, #102942 100%);
  color: #f5f8fc;
}
.brand-panel::after {
  content: "";
  position: absolute;
  right: -92px;
  bottom: -105px;
  width: 320px;
  height: 320px;
  border: 42px solid rgba(218, 176, 62, .08);
  border-radius: 50%;
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 14px;
  background: linear-gradient(145deg, #f5d778, #c99a2a);
  color: #172337;
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
  font-size: 23px;
  font-weight: 900;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 21px; letter-spacing: .08em; }
.brand span { margin-top: 1px; color: #a8b9ca; font-size: 13px; }
.brand-copy { position: relative; z-index: 1; margin-top: 102px; }
.eyebrow { margin: 0 0 8px; color: #8594a8; font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.brand-copy .eyebrow { color: #dcb951; }
.brand-copy h1 { margin: 0; font-size: clamp(31px, 4vw, 46px); line-height: 1.25; letter-spacing: -.04em; }
.brand-copy > p:last-child { max-width: 500px; margin: 22px 0 0; color: #aebdcd; font-size: 14px; line-height: 1.9; }
.guard-list { position: relative; z-index: 1; display: grid; gap: 14px; margin-top: 52px; }
.guard-list > div { display: flex; align-items: flex-start; gap: 12px; }
.guard-list i {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(41, 174, 124, .18);
  color: #64d3a2;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}
.guard-list strong, .guard-list small { display: block; }
.guard-list strong { color: #eef5fb; font-size: 13px; }
.guard-list small { margin-top: 2px; color: #8ea3b8; font-size: 11px; }

.form-panel { align-self: center; width: 100%; padding: 48px 56px; }
.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2f6;
  color: #65758a;
  font-size: 11px;
  font-weight: 800;
}
.connection-state i { width: 8px; height: 8px; border-radius: 50%; background: #8a98a8; }
.connection-state.secure { background: #e7f7f0; color: #0e7650; }
.connection-state.secure i { background: var(--green); box-shadow: 0 0 0 3px rgba(21,149,102,.12); }
.connection-state.local { background: #eaf3ff; color: #356591; }
.connection-state.local i { background: #3d82c8; }
.connection-state.warning { background: #fff0df; color: var(--orange); }
.connection-state.warning i { background: #d18127; }

.auth-card { animation: card-in .22s ease-out; }
.auth-card[hidden], .loading-panel[hidden] { display: none; }
@keyframes card-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card-heading { margin-bottom: 28px; }
.card-heading h2 { margin: 0; font-size: 29px; letter-spacing: -.035em; }
.card-heading > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.setup-badge { display: inline-flex; margin-bottom: 14px; padding: 4px 9px; border-radius: 999px; background: #fff5d7; color: #806016; font-size: 11px; font-weight: 900; }

form { display: grid; gap: 18px; }
label > span:first-child { display: block; margin-bottom: 7px; color: #344961; font-size: 13px; font-weight: 800; }
label small { display: block; margin-top: 6px; color: #8390a0; font-size: 11px; }
input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  background: #fbfcfd;
  color: var(--ink);
  transition: border .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus { border-color: #477da9; background: #fff; box-shadow: 0 0 0 4px #e9f1f8; }
input::placeholder { color: #a0aaba; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 65px; }
.password-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: #edf1f5;
  color: #52667c;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.password-toggle:hover { background: #e2e8ef; }
.submit-button {
  width: 100%;
  height: 49px;
  margin-top: 3px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #173858, #0e243c);
  color: #fff;
  box-shadow: 0 10px 24px rgba(16, 42, 70, .18);
  cursor: pointer;
  font-weight: 900;
}
.submit-button:hover { background: linear-gradient(135deg, #214a71, #12304f); }
.submit-button:disabled { opacity: .62; cursor: wait; }
.setup-warning { padding: 11px 13px; border: 1px solid #ead59a; border-radius: 9px; background: #fff8e3; color: #735719; font-size: 11px; line-height: 1.65; }
.auth-error { margin: 0 0 18px; padding: 11px 13px; border: 1px solid #edbdc1; border-radius: 9px; background: var(--red-soft); color: #91353a; font-size: 12px; line-height: 1.6; }
.retry-button { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #42566e; cursor: pointer; font-weight: 800; }
.retry-button:hover { background: #f5f7fa; }
.form-footer { margin: 25px 0 0; color: #8a96a5; font-size: 11px; text-align: center; }
.loading-panel { min-height: 270px; display: grid; place-items: center; align-content: center; color: #44576e; text-align: center; }
.loading-panel strong, .loading-panel span { display: block; }
.loading-panel span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.spinner { width: 30px; height: 30px; margin-bottom: 17px; border: 3px solid #e2e8ef; border-top-color: var(--gold); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 850px) {
  .auth-shell { grid-template-columns: 1fr; margin: 20px auto; }
  .brand-panel { min-height: auto; padding: 28px 34px; }
  .brand-copy { margin-top: 42px; }
  .brand-copy h1 { font-size: clamp(28px, 7vw, 38px); }
  .guard-list { display: none; }
  .form-panel { padding: 38px 34px 42px; }
}

@media (max-width: 520px) {
  .auth-shell { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .brand-panel { padding: 22px 21px 25px; }
  .brand-copy { margin-top: 30px; }
  .brand-copy h1 br { display: none; }
  .brand-copy > p:last-child { margin-top: 13px; line-height: 1.7; }
  .form-panel { padding: 30px 21px 36px; }
  .card-heading h2 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
