/* 登录页样式（T2）：自包含最小可用样式，不依赖其它样式表。
   字体/配色的整体视觉规范由 T3 统管，本文件只保证登录页可用、可读、不喧哗。 */

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

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f4f7;
  color: #1c2024;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 会话判定完成前隐藏表单：已登录用户不会看到登录框闪一下（T2 需求 7） */
.login-checking .login-panel {
  visibility: hidden;
}

.login-panel {
  width: 340px;
  max-width: calc(100vw - 32px);
  padding: 32px 32px 28px;
  background: #ffffff;
  border: 1px solid #e2e5ea;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
}

.login-title {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 13px;
  color: #5b636e;
}

.login-input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid #d4d9e0;
  border-radius: 6px;
  background: #ffffff;
  color: inherit;
  font: inherit;
  outline: none;
}

.login-input:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #3d444d;
  cursor: pointer;
  user-select: none;
}

.login-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1f6feb;
  cursor: pointer;
}

.login-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #f3c0bb;
  border-radius: 6px;
  background: #fdecea;
  color: #b42318;
  font-size: 13px;
}

.login-error[hidden] {
  display: none;
}

.login-submit {
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: #1f6feb;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.login-submit:hover:enabled {
  background: #1a5fcc;
}

.login-submit:disabled {
  background: #94b4ee;
  cursor: default;
}
/* 右上角 toast：登录页不加载 app.js，样式与 app.css 的 .toast 等价，配色就地写死。 */
#toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e5ea;
  border-left: 3px solid #1f6feb;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
  color: #1c2024;
  font-size: 13px;
  line-height: 1.45;
  pointer-events: auto;
  cursor: pointer;
  animation: toast-in 160ms ease-out both;
}

.toast--success {
  border-left-color: #0f7b46;
}

.toast--error {
  border-left-color: #b42318;
}

.toast-body {
  flex: 1 1 auto;
  word-break: break-word;
}

.toast-close {
  flex: 0 0 auto;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #5b636e;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}

.toast-close:hover {
  color: #1c2024;
}

.toast.is-leaving {
  animation: toast-out 180ms ease-in both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(12px); }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-leaving {
    animation: none;
  }
}

/* ---------- 手机（≤768px）：满宽面板 + 触控友好 ----------
   输入框字号必须 ≥16px，否则 iOS Safari 聚焦时会自动放大页面；
   按钮与输入框高度按触控目标放大到 48px。 */
@media (max-width: 768px) {
  body.login-body {
    align-items: flex-start;
    padding: max(12vh, 56px) 0 24px;
  }

  .login-panel {
    width: 100%;
    max-width: none;
    margin: 0 16px;
    padding: 24px 20px 20px;
  }

  .login-input,
  .login-submit {
    height: 48px;
  }

  .login-input {
    font-size: 16px;
  }

  .login-panel,
  .login-checkbox {
    font-size: 16px;
  }

  .login-checkbox {
    width: 20px;
    height: 20px;
  }

  #toast-stack {
    left: 16px;
    right: 16px;
    width: auto;
    align-items: stretch;
  }
}
