/* ============================================================================
   auth.css —— 面板登录 / 注册 / 找回密码页（R388 建 · R514 按参考稿重做视觉）
   ----------------------------------------------------------------------------
   ⭐ 本轮只做**视觉**：配色 / 形状 / 字号 / 间距 / 交互态。
   ⛔ 不改 DOM 结构、id、接口字段、请求体；⛔ 不引外部字体 / CDN / 框架。
   设计语言（只借参考稿的视觉，不借它的业务文案）：
     · 配色：奶油纸底 #f8eedb、卡片 #fffaf0、主色琥珀 #d58a2d、木色 #8c5522
     · 形状：卡片 20px 圆角 + 暖棕低透明度大阴影；输入 10px / 按钮 11px 圆角
     · 字体：标题 19px/700、正文 14px、标签 12px/700、页脚 12px
     · 间距：卡片 30px 内边距、字段 14px 间距、输入 40px 高、主按钮 42px 高
   ========================================================================== */

:root {
  --bg: #f8eedb;
  --bg-soft: #fdf6e7;
  --card: #fffaf0;
  --card-2: #fff6e3;
  --line: #e5c98c;
  --line-soft: #ecd9b4;
  --text: #5c3b1f;
  --text-dim: #8c6b44;
  --text-faint: #a98a5f;
  --accent: #d58a2d;
  --accent-deep: #b9741f;
  --accent-soft: #f7e3bf;
  --wood: #8c5522;
  --ok: #2e7d4f;
  --ok-bg: #e8f5ea;
  --danger: #b33a3a;
  --danger-bg: #fbe6e3;
  --radius: 10px;
  --shadow: 0 26px 60px -18px rgba(120, 80, 30, 0.34);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 8% -10%, rgba(213, 138, 45, 0.16), transparent 30rem),
    radial-gradient(circle at 95% 0%, rgba(100, 129, 255, 0.08), transparent 28rem),
    radial-gradient(circle at 50% 108%, rgba(232, 196, 106, 0.20), transparent 30rem),
    linear-gradient(180deg, #fdf6e7 0%, var(--bg) 62%, #f2dfbe 100%);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── 卡片 ───────────────────────────────────────────── */
.auth-card {
  position: relative;
  width: min(432px, 100%);
  padding: 30px 30px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fffdf6 0%, var(--card) 62%, var(--card-2) 100%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: card-in 0.34s ease both;
}
/* 顶部一条琥珀细带（只做装饰） */
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #f2cf95 0%, var(--accent) 45%, var(--accent-deep) 100%);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(160deg, #fff8e9 0%, #f9e8c9 55%, var(--accent-soft) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 5px 14px rgba(140, 85, 34, 0.16);
  font-size: 23px;
  line-height: 1;
}
.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
}
.brand-text p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── 页签（当前页面不渲染；保留样式以防回挂） ────────── */
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 20px 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf1dd;
}
.auth-tab {
  height: 32px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab[aria-selected="true"] {
  border-color: var(--line);
  background: linear-gradient(180deg, #fffdf6, #fff4dd);
  color: var(--wood);
  box-shadow: 0 2px 8px rgba(140, 85, 34, 0.12);
}

/* ── 表单 ───────────────────────────────────────────── */
.auth-form { display: none; margin-top: 18px; }
.auth-form.is-active {
  display: block;
  animation: form-in 0.22s ease both;
}
@keyframes form-in {
  from { opacity: 0.55; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-dim);
}
.field-row { display: flex; gap: 8px; }
.field-row > input { flex: 1 1 auto; min-width: 0; }

.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf6;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(120, 80, 30, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.auth-input::placeholder { color: var(--text-faint); }
.auth-input:hover { border-color: #d9a75c; }
.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fffefb;
  box-shadow: 0 0 0 3px rgba(213, 138, 45, 0.22), inset 0 1px 2px rgba(120, 80, 30, 0.05);
}
.auth-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(179, 58, 58, 0.15);
}
.auth-input[aria-invalid="true"]:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(179, 58, 58, 0.2);
}
/* 浏览器自动填充 ⇒ 保持奶油底色，不要变蓝 */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #fffdf6 inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}

.code-btn {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 13px;
  border: 1px solid #d9a75c;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fdf0d5, #f4dfb8);
  color: #7a4a12;
  font-size: 12.5px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, box-shadow 0.15s;
}
.code-btn:hover:not(:disabled) { filter: brightness(1.03); }
.code-btn:disabled { cursor: not-allowed; opacity: 0.55; filter: grayscale(0.3); }

.hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-faint);
}
.hint.err { color: var(--danger); }
.hint.ok  { color: var(--ok); }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 3px 0 18px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.link-btn {
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #a8641a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s;
}
.link-btn:hover { color: #7a4a12; }

.submit-btn {
  width: 100%;
  height: 42px;
  border: 1px solid #c07a2c;
  border-radius: 11px;
  background: linear-gradient(180deg, #e8a84e 0%, #d58a2d 58%, var(--accent-deep) 100%);
  color: #fffdf6;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(160, 100, 30, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition: filter 0.15s, transform 0.06s, box-shadow 0.15s;
}
.submit-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 8px 20px rgba(160, 100, 30, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}
.submit-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(160, 100, 30, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.submit-btn:disabled {
  cursor: progress;
  opacity: 0.62;
  filter: grayscale(0.15);
  box-shadow: 0 3px 10px rgba(160, 100, 30, 0.18);
}

.foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-soft);
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.9;
}
.foot .link-btn { font-size: 12px; }
.foot span[aria-hidden="true"] { color: #c9ad80; }

/* ── 已登录状态条（当前页面不渲染；样式保持一致，便于回挂） ── */
.account-bar {
  display: none;
  margin: 18px 0 2px;
  padding: 12px 14px;
  border: 1px solid #b9dcc4;
  border-radius: 12px;
  background: var(--ok-bg);
  color: #255f3d;
  font-size: 12.5px;
  line-height: 1.7;
}
.account-bar.is-active { display: block; }
.account-bar[hidden] { display: none; }
.account-bar b { color: #164a2b; }
.account-bar .account-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.account-bar .account-actions a,
.account-bar .account-actions button {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid #7fb98f;
  border-radius: 8px;
  background: #f2fbf4;
  color: #1f5c39;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.account-bar .account-actions a:hover,
.account-bar .account-actions button:hover { border-color: var(--ok); filter: brightness(0.98); }

/* ── 提示（toast） ──────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  max-width: min(440px, calc(100% - 32px));
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  box-shadow: 0 16px 36px rgba(120, 80, 30, 0.22);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: #e3b0aa; background: var(--danger-bg); color: #8f2c2c; }
.toast.ok  { border-color: #b9dcc4; background: var(--ok-bg); color: #22603c; }

/* ── 键盘可达性 ─────────────────────────────────────── */
.auth-input:focus-visible,
.submit-btn:focus-visible,
.code-btn:focus-visible,
.link-btn:focus-visible,
.auth-tab:focus-visible,
.check input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 18px 16px; }
  .auth-card { padding: 24px 18px 18px; border-radius: 16px; }
  .auth-brand { gap: 11px; padding-bottom: 15px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 21px; }
  .brand-text h1 { font-size: 17.5px; }
  .auth-input, .code-btn { height: 42px; }
  .submit-btn { height: 44px; }
  .toast { bottom: 20px; }
}
@media (max-width: 360px) {
  .row-between { flex-wrap: wrap; gap: 8px; }
  .foot { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
