:root {
  color-scheme: light;
  font-family:
    "Alibaba PuHuiTi 2.0", Inter, "PingFang SC", "Microsoft YaHei", system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #eef3f8;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgb(35 113 185 / 18%), transparent 38rem),
    #eef3f8;
}

.formal-auth-page {
  color: #142033;
  background:
    radial-gradient(circle at 12% 46%, rgb(45 111 194 / 10%), transparent 30rem),
    radial-gradient(circle at 86% 30%, rgb(45 111 194 / 8%), transparent 28rem),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.formal-auth-header {
  height: 84px;
  display: flex;
  align-items: center;
  padding: 0 clamp(28px, 4.6vw, 72px);
  border-bottom: 1px solid #dde6f1;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 1px 0 rgb(16 42 77 / 2%);
}

.formal-auth-header-logo {
  width: clamp(252px, 22vw, 330px);
  height: auto;
  display: block;
}

.formal-auth-desktop-main {
  position: relative;
  width: min(1440px, 100%);
  min-height: calc(100vh - 84px);
  min-height: calc(100svh - 84px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(520px, 596px);
  grid-template-areas:
    "hero card"
    "browser browser";
  gap: clamp(48px, 6vw, 96px);
  align-items: center;
  align-content: center;
  margin: 0 auto;
  padding: clamp(30px, 5vh, 58px) clamp(36px, 5vw, 72px) 28px;
}

.formal-auth-hero {
  grid-area: hero;
  align-self: center;
  padding-left: clamp(0px, 2vw, 30px);
}

.formal-auth-hero h1 {
  margin: 0;
  color: #101d31;
  font-size: clamp(44px, 4.2vw, 64px);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.formal-auth-hero > p:last-child {
  margin: 24px 0 0;
  color: #495b72;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.75;
}

.formal-auth-desktop-card {
  grid-area: card;
  width: min(596px, 100%);
  justify-self: end;
  padding: clamp(26px, 3.6vh, 38px) clamp(38px, 3.8vw, 50px) 30px;
  border: 1px solid rgb(202 215 230 / 86%);
  border-radius: 14px;
  background: rgb(255 255 255 / 98%);
  box-shadow:
    0 26px 70px rgb(28 58 94 / 12%),
    0 3px 10px rgb(28 58 94 / 5%);
  text-align: center;
}

.formal-auth-desktop-card h2 {
  margin: 0;
  color: #111d31;
  font-size: clamp(28px, 2.3vw, 34px);
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.28;
}

.formal-auth-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.formal-auth-card {
  width: min(520px, 100%);
  padding: clamp(34px, 7vw, 54px) clamp(24px, 7vw, 52px);
  border: 1px solid rgb(196 211 228 / 82%);
  border-radius: 24px;
  background: rgb(255 255 255 / 96%);
  box-shadow:
    0 30px 80px rgb(24 60 96 / 13%),
    0 2px 8px rgb(24 60 96 / 5%);
  text-align: center;
}

.formal-auth-logo {
  width: min(232px, 72vw);
  height: auto;
  display: block;
  margin: 0 auto 30px;
}

.formal-auth-card h1 {
  margin: 0;
  color: #111c2e;
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.28;
}

.formal-auth-description {
  max-width: 390px;
  margin: 16px auto 0;
  color: #5a687a;
  font-size: 16px;
  line-height: 1.75;
}

.formal-auth-desktop-card .formal-auth-description {
  margin: 0;
  font-size: 16px;
}

.formal-auth-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 0;
  color: #174f91;
  font-size: 15px;
  font-weight: 700;
}

.formal-auth-path span:nth-child(even) {
  color: #91a3b8;
  font-weight: 500;
}

.formal-auth-action {
  min-width: 164px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  padding: 12px 22px;
  border-radius: 8px;
  color: #fff;
  background: #1769aa;
  box-shadow: 0 10px 24px rgb(23 105 170 / 20%);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
}

.formal-auth-action:hover,
.formal-auth-action:focus-visible {
  background: #0e568f;
}

.formal-auth-card-static .formal-auth-description {
  margin-top: 18px;
}

.formal-qr-shell {
  width: 100%;
  margin: 18px auto 0;
  background: transparent;
}

.formal-qr-state[hidden] {
  display: none !important;
}

.formal-qr-active {
  width: 100%;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 14px;
  align-content: start;
  justify-items: center;
}

.formal-qr-mount {
  width: min(400px, 100%);
  min-width: 0;
  display: grid;
  place-items: center;
  border: 1px solid #e0e7f0;
  border-radius: 8px;
  background: #fff;
}

.formal-qr-mount iframe {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border: 0;
}

.formal-qr-expired,
.formal-qr-unavailable {
  width: 100%;
  display: grid;
  justify-items: center;
  grid-template-rows: auto auto;
  gap: 22px;
  padding: 0 34px;
  color: #26364a;
  font-size: 18px;
}

.formal-qr-expired-frame,
.formal-qr-unavailable-frame {
  width: min(366px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  border-radius: 8px;
  color: #203149;
  background: linear-gradient(145deg, #f7f9fc, #f2f5f9);
}

.formal-qr-expired-mark {
  width: 88px;
  display: grid;
  grid-template-columns: repeat(2, 36px);
  gap: 10px;
}

.formal-qr-expired-mark i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 5px solid #7f96b3;
  border-radius: 5px;
  color: #7f96b3;
  font-size: 30px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
}

.formal-qr-expired-mark i:last-child {
  border-radius: 50%;
}

.formal-qr-unavailable-frame {
  gap: 12px;
  padding: 32px;
}

.formal-qr-unavailable-frame span {
  color: #68778a;
  font-size: 14px;
}

.formal-qr-expired .formal-auth-action,
.formal-qr-unavailable .formal-auth-action {
  width: min(366px, 100%);
  min-height: 52px;
  margin-top: 0;
  border-radius: 5px;
}

.formal-auth-session-note,
.formal-auth-browser-note {
  color: #5e6f84;
  font-size: 14px;
}

.formal-auth-session-note {
  margin: 0;
}

@media (min-width: 981px) and (max-height: 820px) {
  .formal-auth-header {
    height: 72px;
  }

  .formal-auth-header-logo {
    width: 260px;
  }

  .formal-auth-desktop-main {
    min-height: calc(100vh - 72px);
    min-height: calc(100svh - 72px);
    padding-block: 20px;
  }

  .formal-auth-desktop-card {
    padding-block: 22px 20px;
  }

  .formal-auth-desktop-card h2 {
    font-size: 28px;
  }

  .formal-qr-shell { margin-top: 10px; }

  .formal-qr-active {
    gap: 8px;
  }

  .formal-qr-expired,
  .formal-qr-unavailable {
    gap: 12px;
  }

  .formal-qr-expired-frame,
  .formal-qr-unavailable-frame,
  .formal-qr-expired .formal-auth-action,
  .formal-qr-unavailable .formal-auth-action { width: min(366px, 100%); }
}

.formal-auth-browser-note {
  grid-area: browser;
  margin: 0;
  text-align: center;
}

.local-login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 16px;
}

.local-login-panel {
  width: min(1080px, 100%);
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid #d6e0ea;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(31 57 84 / 12%);
}

.environment-badge {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #7c3500;
  background: #fff0d8;
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.18;
}

.environment-notice,
.login-footnote {
  color: #526174;
  line-height: 1.7;
}

.environment-notice {
  margin: 14px 0 24px;
  font-size: 16px;
}

.login-error {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #f0b7b7;
  border-radius: 10px;
  color: #8b1e1e;
  background: #fff2f2;
}

.account-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.account-card {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 18px;
  border: 1px solid #dce4ed;
  border-radius: 14px;
  background: #fbfcfe;
}

.account-card button {
  width: 100%;
}

.preview-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid #bdd4eb;
  border-radius: 14px;
  background: #f3f8fe;
}

.preview-entry strong {
  font-size: 16px;
}

.preview-entry p {
  margin: 6px 0 0;
  color: #526174;
  line-height: 1.55;
}

.preview-entry .secondary-link {
  margin: 0;
  white-space: nowrap;
}

.account-card strong {
  display: inline-block;
  margin-right: 8px;
  font-size: 17px;
}

.account-card p {
  margin: 7px 0 0;
  color: #647286;
  line-height: 1.55;
}

.role-label {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  color: #14538f;
  background: #e7f3ff;
  font-size: 12px;
  font-weight: 700;
}

button,
.secondary-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

button {
  padding: 10px 16px;
  border: 0;
  color: #fff;
  background: #1769aa;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #0e568f;
}

.secondary-link {
  margin-top: 12px;
  padding: 10px 16px;
  color: #14538f;
  background: #e7f3ff;
}

.login-footnote {
  margin: 22px 0 0;
  font-size: 13px;
}

@media (max-width: 980px) {
  .formal-auth-header {
    height: 76px;
    padding-inline: 28px;
  }

  .formal-auth-header-logo {
    width: 260px;
  }

  .formal-auth-desktop-main {
    min-height: calc(100vh - 76px);
    min-height: calc(100svh - 76px);
    grid-template-columns: 1fr;
    grid-template-areas:
      "card"
      "browser";
    gap: 22px;
    padding: 28px 24px;
  }

  .formal-auth-hero {
    display: none;
  }

  .formal-auth-desktop-card {
    justify-self: center;
  }

}

@media (max-width: 600px) {
  .local-login-shell {
    align-items: start;
    padding: 16px 10px;
  }

  .local-login-panel {
    padding: 22px 16px;
    border-radius: 16px;
  }

  .account-list,
  .preview-entry {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .account-card button {
    width: 100%;
  }

  button,
  input,
  select,
  .secondary-link {
    min-height: 48px;
    font-size: 16px;
    touch-action: manipulation;
  }

  .formal-auth-shell {
    align-items: center;
  }

  .formal-auth-card {
    padding: 36px 22px;
    border-radius: 20px;
  }

  .formal-auth-logo {
    margin-bottom: 26px;
  }

  .formal-auth-header {
    height: 68px;
    padding-inline: 18px;
  }

  .formal-auth-header-logo {
    width: min(232px, 70vw);
  }

  .formal-auth-desktop-main {
    min-height: calc(100vh - 68px);
    min-height: calc(100svh - 68px);
    padding: 18px 12px;
  }

  .formal-auth-desktop-card {
    padding: 28px 18px 22px;
    border-radius: 16px;
  }

  .formal-qr-mount { width: 100%; }
}
