:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --text: #17191d;
  --text-secondary: #60656f;
  --text-tertiary: #858b95;
  --border: #e1e4e9;
  --border-strong: #c9ced6;
  --brand: #b4232d;
  --brand-hover: #941d26;
  --danger: #b42318;
  --danger-soft: #fef0ee;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(21, 94, 239, 0.2);
  outline-offset: 2px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.login-panel {
  width: min(100%, 420px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(18, 22, 31, 0.08);
}

.login-header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 24px 26px 22px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-header h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
}

.login-header p {
  margin: 2px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.4;
}

.login-form {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.field > input,
.password-field > input {
  width: 100%;
  height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field > input:hover,
.password-field > input:hover {
  border-color: #aeb4bd;
}

.field > input:focus,
.password-field > input:focus {
  border-color: #7b8491;
}

.password-field {
  position: relative;
  display: block;
}

.password-field > input {
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--text-secondary);
  background: transparent;
}

.password-toggle:hover {
  color: var(--text);
  background: var(--surface-muted);
}

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

.eye-hidden,
.password-shown .eye-visible {
  display: none;
}

.password-shown .eye-hidden {
  display: block;
}

.login-error {
  margin: -2px 0 0;
  padding: 10px 11px;
  border-radius: 5px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.login-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  background: var(--brand);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition: background-color 0.15s, opacity 0.15s;
}

.login-button:hover:not(:disabled) {
  background: var(--brand-hover);
}

.login-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

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

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

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

@media (max-width: 480px) {
  .login-shell {
    align-items: start;
    padding: 20px 14px;
  }

  .login-panel {
    margin-top: min(14vh, 72px);
  }

  .login-header,
  .login-form {
    padding-inline: 20px;
  }
}

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