:root {
  --brand: #155eef;
  --brand-dark: #0b2f7a;
  --brand-light: #3e7bfa;
  --ink: #101828;
  --text: #475467;
  --muted: #667085;
  --border: #d0d5dd;
  --surface: #ffffff;
  --background: #f5f7fa;
  --danger: #d92d20;
  --font: "PingFang SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--background); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }

.login-layout { display: grid; grid-template-columns: 58fr 42fr; min-height: 100vh; }

.brand-pane {
  background: linear-gradient(138deg, var(--brand-dark) 0%, #1247b5 48%, var(--brand) 78%, var(--brand-light) 100%);
  color: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(32px, 4vw, 64px);
  position: relative;
}

.brand-header { align-items: center; display: flex; gap: 16px; position: relative; z-index: 2; }
.brand-header p { font-size: 18px; font-weight: 600; letter-spacing: .01em; line-height: 1.4; margin: 0; }
.brand-logo {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(5, 24, 68, .18);
  display: block;
  flex: 0 0 auto;
  height: 58px;
  overflow: hidden;
  position: relative;
  width: 58px;
}
.brand-logo img { height: auto; left: -31px; max-width: none; position: absolute; top: -10px; width: 121px; }
.brand-logo::after { background: var(--surface); bottom: 0; content: ""; height: 9px; left: 0; position: absolute; width: 100%; }

.brand-visual { margin: auto 0; max-width: 680px; padding: 72px 0; position: relative; z-index: 2; }
.brand-visual h1 { font-size: clamp(44px, 4.4vw, 72px); font-weight: 700; letter-spacing: -.045em; line-height: 1.16; margin: 0 0 24px; text-wrap: balance; }
.brand-visual p { color: rgba(255, 255, 255, .82); font-size: clamp(16px, 1.25vw, 20px); line-height: 1.8; margin: 0; }

.supply-network { bottom: -3%; color: rgba(255, 255, 255, .2); height: 78%; position: absolute; right: -8%; width: 94%; z-index: 1; }
.supply-network path { stroke-width: 2; }
.supply-network .network-dash { stroke-dasharray: 10 14; stroke-width: 1.5; }
.network-nodes circle { fill: rgba(255, 255, 255, .2); stroke: rgba(255, 255, 255, .52); stroke-width: 2; }
.warehouse-node { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .5); stroke-linejoin: round; stroke-width: 2; }

.auth-pane {
  align-items: center;
  background: var(--background);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 48px clamp(28px, 4vw, 72px) 32px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid rgba(208, 213, 221, .72);
  border-radius: 20px;
  box-shadow: 0 24px 56px rgba(16, 24, 40, .08), 0 3px 10px rgba(16, 24, 40, .04);
  max-width: 420px;
  padding: 48px 40px;
  width: 100%;
}

.auth-heading h2 { color: var(--ink); font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; margin: 0 0 8px; }
.auth-heading p { color: var(--text); font-size: 15px; line-height: 1.7; margin: 0; }

.login-form { display: grid; gap: 24px; margin-top: 40px; }
.login-form label { display: grid; gap: 8px; }
.login-form label > span:first-child { color: var(--ink); font-size: 14px; font-weight: 600; line-height: 20px; }
.login-form input {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  height: 52px;
  outline: none;
  padding: 0 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  width: 100%;
}
.login-form input:hover { border-color: #98a2b3; }
.login-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(21, 94, 239, .13); }
.login-form.has-error input[aria-invalid="true"] { border-color: var(--danger); }

.password-field { display: block; position: relative; }
.password-field input { padding-right: 52px; }
.password-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 36px;
}
.password-toggle:hover { background: var(--background); color: var(--ink); }
.password-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.password-toggle svg { fill: none; height: 20px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; width: 20px; }
.password-toggle .eye-closed, .password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }

.login-error { background: #fef3f2; border: 1px solid #fecdca; border-radius: 10px; color: var(--danger); font-size: 13px; line-height: 20px; margin: -8px 0 0; padding: 12px 14px; }

.login-submit {
  align-items: center;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  color: var(--surface);
  cursor: pointer;
  display: flex;
  font-weight: 600;
  gap: 10px;
  height: 52px;
  justify-content: center;
  margin-top: 8px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 100ms ease;
  width: 100%;
}
.login-submit:hover { background: #0f50d5; border-color: #0f50d5; box-shadow: 0 8px 20px rgba(21, 94, 239, .18); }
.login-submit:active { background: #0b46c2; border-color: #0b46c2; transform: translateY(1px); }
.login-submit:focus-visible { outline: 3px solid rgba(21, 94, 239, .25); outline-offset: 3px; }
.login-submit:disabled { cursor: wait; opacity: .78; transform: none; }
.submit-spinner { animation: spin .8s linear infinite; border: 2px solid rgba(255, 255, 255, .45); border-radius: 50%; border-top-color: var(--surface); display: none; height: 17px; width: 17px; }
.login-submit.is-loading .submit-spinner { display: block; }

.auth-pane footer { color: var(--muted); font-size: 12px; line-height: 20px; margin-top: 32px; text-align: center; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .submit-spinner { animation-duration: 1.2s; }
}

@media (max-width: 920px) {
  .login-layout { display: flex; flex-direction: column; min-height: 100vh; }
  .brand-pane { background: var(--background); color: var(--ink); min-height: auto; overflow: visible; padding: 24px 24px 8px; }
  .brand-header { justify-content: center; }
  .brand-header p { font-size: 15px; }
  .brand-logo { border: 1px solid #eaecf0; box-shadow: none; height: 50px; width: 50px; }
  .brand-logo img { left: -27px; top: -9px; width: 105px; }
  .brand-logo::after { height: 8px; }
  .brand-visual, .supply-network { display: none; }
  .auth-pane { flex: 1; justify-content: flex-start; min-height: auto; padding: 24px 20px 32px; }
  .auth-card { margin: auto 0; padding: 40px 32px; }
  .auth-pane footer { margin-top: 24px; }
}

@media (max-width: 480px) {
  .brand-pane { padding-top: 20px; }
  .brand-header { gap: 12px; }
  .brand-header p { font-size: 14px; }
  .auth-pane { padding-left: 16px; padding-right: 16px; }
  .auth-card { border-radius: 18px; padding: 32px 24px; }
  .auth-heading h2 { font-size: 28px; }
  .login-form { margin-top: 32px; }
}
