:root {
  color-scheme: light;
  --page: #f3f5f7;
  --surface: #ffffff;
  --surface-subtle: #f7f9fb;
  --border: #dfe4ea;
  --border-strong: #c8d0da;
  --text: #17202e;
  --text-secondary: #5d6877;
  --text-muted: #7d8795;
  --primary: #2463d4;
  --primary-hover: #1d51ae;
  --primary-soft: #eaf1fd;
  --success: #137a5a;
  --success-soft: #e6f5ef;
  --warning: #9a5c0a;
  --warning-soft: #fff2d9;
  --danger: #bf3939;
  --danger-soft: #fdecec;
  --neutral-strong: #182231;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 12px 34px rgb(16 24 40 / 7%);
  --radius-card: 8px;
  --radius-control: 7px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #10151c;
    --surface: #191f28;
    --surface-subtle: #202731;
    --border: #303a47;
    --border-strong: #465363;
    --text: #edf1f6;
    --text-secondary: #b4bdc9;
    --text-muted: #8d98a7;
    --primary: #76a2f3;
    --primary-hover: #97b8f5;
    --primary-soft: #20365b;
    --success: #55c79f;
    --success-soft: #153a31;
    --warning: #efb85f;
    --warning-soft: #44341d;
    --danger: #f18080;
    --danger-soft: #482728;
    --neutral-strong: #edf1f6;
    --shadow: 0 1px 2px rgb(0 0 0 / 22%), 0 14px 36px rgb(0 0 0 / 24%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  display: grid;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  grid-template-rows: auto 1fr auto;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
summary {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-150%);
  transition: transform .16s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

button,
a,
input,
summary {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 38%, transparent);
  outline-offset: 2px;
}

.auth-topbar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #2866d5;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.3;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  color: var(--text-muted);
  font-size: 11px;
}

.connection-state {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.connection-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-muted);
}

.connection-state[data-connection-state="online"] .connection-dot {
  background: var(--success);
}

.connection-state[data-connection-state="online"] {
  color: var(--success);
}

.connection-state[data-connection-state="offline"] .connection-dot {
  background: var(--danger);
}

.connection-state[data-connection-state="offline"] {
  color: var(--danger);
}

.auth-layout {
  display: grid;
  width: min(100% - 48px, 1080px);
  align-items: center;
  justify-self: center;
  gap: 76px;
  grid-template-columns: minmax(260px, 1fr) minmax(380px, 460px);
  padding: 56px 0;
}

.auth-intro {
  min-width: 0;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.auth-intro h1 {
  max-width: 580px;
  margin-top: 12px;
  color: var(--neutral-strong);
  font-size: 40px;
  font-weight: 760;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.intro-copy {
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 17px;
}

.platform-facts {
  display: grid;
  max-width: 520px;
  margin-top: 40px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

.platform-facts > div {
  min-width: 0;
  padding: 15px 18px;
  border-left: 1px solid var(--border);
}

.platform-facts > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.platform-facts dt {
  color: var(--text-muted);
  font-size: 11px;
}

.platform-facts dd {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-card {
  width: 100%;
  min-height: 500px;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-view {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
}

.auth-view--loading {
  min-height: 430px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-view--loading h2,
.auth-view--ready h2,
.view-heading h2 {
  color: var(--text);
  font-size: 20px;
  line-height: 1.3;
}

.auth-view--loading p,
.auth-view--ready p,
.view-heading p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: auth-spin .75s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.view-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.view-heading > div {
  min-width: 0;
}

.heading-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
}

.heading-icon--success {
  background: var(--success-soft);
  color: var(--success);
}

.heading-icon--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

form {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 17px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field label {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.field small {
  color: var(--text-muted);
  font-size: 11px;
}

input {
  width: 100%;
  height: 44px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  transition: border-color .14s ease, box-shadow .14s ease;
}

input:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--border-strong) 55%, var(--text));
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

.captcha-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 160px 34px;
  align-items: center;
  gap: 7px;
}

.captcha-image {
  width: 160px;
  height: 48px;
  display: block;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
}

.captcha-refresh {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
}

.captcha-refresh svg {
  width: 17px;
  height: 17px;
}

.password-control {
  position: relative;
  min-width: 0;
}

.password-control input {
  padding-right: 48px;
}

.icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
}

.icon-button:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.tenant-option {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.tenant-option summary {
  padding: 11px 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.tenant-option[open] summary {
  color: var(--text);
}

.field--nested {
  padding: 2px 0 14px;
}

.tenant-guidance {
  margin: 0;
  padding: 14px 15px;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
  color: var(--text-secondary);
  line-height: 1.65;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.button--primary:hover:not(:disabled) {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.button--secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: var(--surface-subtle);
  color: var(--text);
}

.button--full {
  width: 100%;
}

.button .spinner-inline {
  width: 17px;
  height: 17px;
  border: 2px solid rgb(255 255 255 / 48%);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: auth-spin .75s linear infinite;
}

.auth-notice {
  display: grid;
  min-width: 0;
  margin-bottom: 22px;
  padding: 12px 13px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-subtle);
}

.notice-icon {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.notice-copy {
  min-width: 0;
}

.notice-copy strong {
  display: block;
  font-size: 12px;
}

.notice-copy p {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.auth-notice[data-kind="success"] {
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
  background: var(--success-soft);
}

.auth-notice[data-kind="success"] .notice-icon {
  background: var(--success);
}

.auth-notice[data-kind="warning"] {
  border-color: color-mix(in srgb, var(--warning) 32%, var(--border));
  background: var(--warning-soft);
}

.auth-notice[data-kind="warning"] .notice-icon {
  background: var(--warning);
}

.auth-notice[data-kind="error"] {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
}

.auth-notice[data-kind="error"] .notice-icon {
  background: var(--danger);
}

.text-button {
  min-height: 28px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.context-strip {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
}

.context-strip strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-requirements {
  padding: 11px 13px;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
  color: var(--text-secondary);
  font-size: 12px;
}

.auth-view--ready {
  min-height: 430px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-view--ready .button {
  max-width: 300px;
}

.ready-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
}

.ready-mark svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.2;
}

.noscript-alert {
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px solid var(--danger);
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
}

.auth-footer {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(24px, calc((100vw - 1120px) / 2));
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
}

@media (max-width: 840px) {
  .auth-layout {
    width: min(100% - 40px, 580px);
    align-content: center;
    gap: 30px;
    grid-template-columns: minmax(0, 1fr);
    padding: 38px 0;
  }

  .auth-intro {
    text-align: center;
  }

  .auth-intro h1 {
    max-width: none;
    margin-top: 7px;
    font-size: 30px;
  }

  .intro-copy {
    margin-top: 7px;
    font-size: 14px;
  }

  .platform-facts {
    max-width: none;
    margin-top: 19px;
    text-align: left;
  }

  .platform-facts > div:first-child {
    padding-left: 18px;
  }
}

@media (max-width: 520px) {
  .auth-topbar {
    min-height: 62px;
    padding: 10px 14px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
  }

  .brand-copy small {
    display: none;
  }

  .connection-state {
    padding-inline: 8px;
  }

  .auth-layout {
    width: 100%;
    gap: 22px;
    padding: 26px 14px 32px;
  }

  .auth-intro h1 {
    font-size: 27px;
  }

  .platform-facts {
    margin-top: 16px;
  }

  .platform-facts > div,
  .platform-facts > div:first-child {
    padding: 11px 9px;
  }

  .auth-card {
    min-height: 480px;
    padding: 24px 20px;
  }

  .captcha-row {
    grid-template-columns: minmax(0, 1fr) 132px 34px;
  }

  .captcha-image {
    width: 132px;
  }

  .auth-view--loading,
  .auth-view--ready {
    min-height: 430px;
  }

  .auth-notice {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .auth-notice .text-button {
    grid-column: 2;
    justify-self: start;
  }

  .auth-footer {
    padding: 12px 14px;
  }
}

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

@media (forced-colors: active) {
  .connection-dot,
  .notice-icon {
    forced-color-adjust: none;
  }

  .auth-card,
  input,
  .button,
  .auth-notice {
    border-color: CanvasText;
  }
}
