:root {
  color-scheme: light;
  --brand-purple: #c367ef;
  --brand-blue: #64c9ed;
  --brand-ink: #171131;
  --text: #1c1b2e;
  --muted: #7a7a8c;
  --muted-soft: #9a9aa8;
  --page: #f8f8fd;
  --card: #ffffff;
  --field: #fafafc;
  --border: #e8e8f0;
  --border-strong: #d8d7e2;
  --danger: #b52f43;
  --danger-soft: #fff1f3;
  --success: #16803c;
  --success-soft: #ecfdf3;
  --focus: 0 0 0 3px rgba(195, 103, 239, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

/* 登录页：移植自 Electron 新版左右分栏视觉。 */
.split-login-layout {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(390px, 1fr) minmax(440px, 1fr);
}

.brand-panel {
  position: relative;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(42px, 6vw, 86px);
  color: #fff;
  background:
    radial-gradient(circle at 85% 90%, rgba(100, 201, 237, 0.14), transparent 55%),
    linear-gradient(160deg, #171131 0%, #0d0b1e 55%, #0a0918 100%);
}

.brand-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(54px);
  pointer-events: none;
}

.brand-glow-purple {
  top: -180px;
  left: -170px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(195, 103, 239, 0.5) 0%, transparent 68%);
}

.brand-glow-blue {
  right: -190px;
  bottom: -210px;
  width: 610px;
  height: 610px;
  background: radial-gradient(circle, rgba(100, 201, 237, 0.38) 0%, transparent 68%);
}

.brand-content {
  position: relative;
  z-index: 1;
  width: min(100%, 500px);
}

.product-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
  color: #fff;
  text-decoration: none;
}

.product-brand:focus-visible {
  border-radius: 12px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(100, 201, 237, 0.32);
}

.siamese-logo {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 32px rgba(195, 103, 239, 0.2);
  backdrop-filter: blur(12px);
}

.siamese-logo svg {
  width: 50px;
  height: 50px;
  filter: drop-shadow(0 4px 14px rgba(195, 103, 239, 0.24));
}

.product-name {
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-blue) 100%);
  background-clip: text;
  color: transparent;
  font-size: 23px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.brand-content h1 {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(28px, 2.5vw, 36px);
  font-weight: 650;
  letter-spacing: 0.05em;
  line-height: 1.35;
}

.brand-subtitle {
  max-width: 430px;
  margin: 0 0 38px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 14px;
  line-height: 1.8;
}

.feature-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.feature-list li {
  display: flex;
  min-width: 0;
  align-items: center;
  padding: 15px 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.feature-list li:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  transform: translateX(4px);
}

.feature-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  margin-right: 16px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, rgba(195, 103, 239, 0.3), rgba(100, 201, 237, 0.3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.feature-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.feature-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.feature-copy strong {
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.45;
}

.feature-copy > span {
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  line-height: 1.55;
}

.form-panel {
  position: relative;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(34px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(26px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 82% 8%, rgba(195, 103, 239, 0.08), transparent 44%),
    radial-gradient(circle at 12% 92%, rgba(100, 201, 237, 0.11), transparent 44%),
    #f8f8fd;
}

.form-panel-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background-image: radial-gradient(rgba(23, 17, 49, 0.08) 1px, transparent 1.2px);
  background-size: 24px 24px;
  mask-image: linear-gradient(145deg, rgba(0, 0, 0, 0.9), transparent 80%);
  pointer-events: none;
}

.form-panel-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
}

.login-card {
  position: relative;
  width: 100%;
  padding: 44px 40px 28px;
  border: 1px solid rgba(23, 17, 49, 0.07);
  border-radius: 16px;
  background: var(--card);
  box-shadow:
    0 1px 2px rgba(23, 17, 49, 0.04),
    0 12px 32px -8px rgba(23, 17, 49, 0.1),
    0 32px 64px -24px rgba(124, 77, 216, 0.16);
  animation: card-enter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.card-glow,
.mobile-brand {
  display: none;
}

.card-header {
  margin-bottom: 34px;
}

.card-header h1,
.card-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.card-header p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.login-form {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 20px;
}

.login-form > *,
.field-group,
.field-control,
.submit-button {
  min-width: 0;
  max-width: 100%;
}

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

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

.field-control {
  position: relative;
  display: flex;
  height: 46px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field-control:hover {
  border-color: rgba(195, 103, 239, 0.42);
}

.field-control:focus-within {
  border-color: var(--brand-purple);
  background: #fff;
  box-shadow: var(--focus);
}

.field-control > svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin-left: 14px;
  color: #9897a8;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.field-control input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 13px 0 10px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

.field-control input::placeholder {
  color: #a3a3b3;
}

.field-control input:-webkit-autofill,
.field-control input:-webkit-autofill:focus {
  box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--text);
}

.password-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #8e8d9d;
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.password-toggle:hover {
  color: var(--brand-purple);
  background: rgba(195, 103, 239, 0.08);
}

.password-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.password-toggle .eye-closed,
.password-toggle.is-visible .eye-open {
  display: none;
}

.password-toggle.is-visible .eye-closed {
  display: block;
}

.remember-control {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.remember-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.checkmark {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: #fff;
  background: #fff;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.checkmark svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 120ms ease, transform 120ms ease;
}

.remember-control input:checked + .checkmark {
  border-color: var(--brand-purple);
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-blue));
}

.remember-control input:checked + .checkmark svg {
  opacity: 1;
  transform: scale(1);
}

.remember-control input:focus-visible + .checkmark {
  box-shadow: var(--focus);
}

.submit-button,
.secondary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
}

.submit-button {
  width: 100%;
  border: 0;
  color: #9291a0;
  background: #f0f0f5;
  cursor: pointer;
}

.submit-button.is-ready,
.logout-actions .submit-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-blue) 100%);
  box-shadow: 0 10px 20px -6px rgba(195, 103, 239, 0.4);
}

.submit-button.is-ready:hover:not(:disabled),
.logout-actions .submit-button:hover:not(:disabled) {
  box-shadow: 0 12px 25px -6px rgba(195, 103, 239, 0.52);
  transform: translateY(-1px);
}

.submit-button:active:not(:disabled) {
  transform: translateY(0);
}

.submit-button:focus-visible,
.secondary-button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit-button.is-loading .button-spinner {
  display: block;
}

.status-message,
.noscript-message {
  margin: -11px 0 20px;
  padding: 11px 13px;
  border: 1px solid rgba(181, 47, 67, 0.16);
  border-radius: 9px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
  line-height: 1.5;
}

.status-message.is-success {
  border-color: rgba(22, 128, 60, 0.16);
  color: var(--success);
  background: var(--success-soft);
}

.status-message:focus {
  outline: none;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 28px;
  color: var(--muted-soft);
  font-size: 11px;
}

.secure-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a45d;
  box-shadow: 0 0 0 3px rgba(34, 164, 93, 0.11);
}

.separator {
  width: 1px;
  height: 11px;
  margin: 0 2px;
  background: var(--border-strong);
}

.form-note {
  margin: 26px 0 0;
  color: var(--muted-soft);
  font-size: 12px;
  text-align: center;
}

/* 退出页继续复用安全网关样式。 */
body[data-page="logout"] {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 82% 8%, rgba(195, 103, 239, 0.08), transparent 44%),
    radial-gradient(circle at 12% 92%, rgba(100, 201, 237, 0.11), transparent 44%),
    var(--page);
}

.page-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.grid-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.65;
  background-image: radial-gradient(rgba(23, 17, 49, 0.08) 1px, transparent 1.2px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.login-layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(88px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) calc(52px + env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.brand {
  position: fixed;
  top: max(28px, calc(env(safe-area-inset-top) + 16px));
  left: max(34px, calc(env(safe-area-inset-left) + 18px));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand:focus-visible {
  border-radius: 10px;
  outline: none;
  box-shadow: var(--focus);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-blue));
  box-shadow: 0 8px 18px -8px rgba(195, 103, 239, 0.55);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
  fill: currentColor;
}

.brand-mark .spark {
  fill: #e0f2fe;
}

.brand-word {
  color: var(--text);
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.brand-word span {
  color: #9568df;
}

.logout-card {
  width: min(100%, 430px);
  text-align: center;
}

.logout-card .card-header {
  margin-bottom: 26px;
}

.logout-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid rgba(195, 103, 239, 0.16);
  border-radius: 16px;
  color: #9b5fda;
  background: linear-gradient(135deg, rgba(195, 103, 239, 0.11), rgba(100, 201, 237, 0.12));
}

.logout-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.logout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.secondary-button {
  border: 1px solid var(--border);
  color: var(--text);
  background: #fff;
}

.secondary-button:hover {
  border-color: rgba(195, 103, 239, 0.38);
  background: #faf9fd;
}

.page-note {
  position: fixed;
  right: 0;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  left: 0;
  margin: 0;
  color: var(--muted-soft);
  font-size: 12px;
  text-align: center;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.988);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 1050px) {
  .split-login-layout {
    grid-template-columns: minmax(350px, 0.85fr) minmax(430px, 1.15fr);
  }

  .brand-panel {
    padding: 38px;
  }

  .brand-content h1 {
    font-size: 28px;
  }

  .feature-copy > span {
    display: none;
  }
}

@media (max-width: 760px) {
  .split-login-layout {
    display: block;
  }

  .brand-panel {
    min-height: auto;
    justify-content: flex-start;
    padding: calc(22px + env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 28px max(22px, env(safe-area-inset-left));
  }

  .brand-content {
    width: 100%;
  }

  .product-brand {
    gap: 10px;
    margin-bottom: 18px;
  }

  .siamese-logo {
    width: 43px;
    height: 43px;
    border-radius: 13px;
  }

  .siamese-logo svg {
    width: 41px;
    height: 41px;
  }

  .product-name {
    font-size: 19px;
  }

  .brand-content h1 {
    margin-bottom: 7px;
    font-size: 24px;
  }

  .brand-subtitle {
    max-width: 520px;
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
  }

  .feature-list {
    display: none;
  }

  .brand-glow-purple {
    top: -260px;
    left: -220px;
  }

  .brand-glow-blue {
    right: -290px;
    bottom: -350px;
  }

  .form-panel {
    min-height: calc(100vh - 174px);
    min-height: calc(100dvh - 174px);
    align-items: flex-start;
    padding: 32px max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .form-panel-inner {
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .brand-panel {
    padding-bottom: 24px;
  }

  .brand-content h1 {
    font-size: 22px;
  }

  .brand-subtitle {
    font-size: 12px;
  }

  .form-panel {
    padding-top: 22px;
  }

  .login-card {
    padding: 32px 23px 23px;
    border-radius: 15px;
  }

  .card-header {
    margin-bottom: 28px;
  }

  .card-header h1,
  .card-header h2 {
    font-size: 22px;
  }

  .form-note {
    margin-top: 20px;
  }

  .login-layout {
    padding-right: 16px;
    padding-left: 16px;
  }

  .logout-actions {
    grid-template-columns: 1fr;
  }
}

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