/* =====================================================================
   账号安全卡片（重置密码 / 注销账号）
   只服务 account.html 右侧栏、mobile-account.html 与工作台账户设置页。
   颜色全部取自现有设计 token / 既有 danger 样式，不引入新配色：
     · 品牌蓝 #00ACEB（--ac-brand）
     · 正文 #172033、次要 #667085、描边 #E7EDF3、浅蓝底 #F3FBFE
     · 危险色沿用 account.css 的 .account-danger-btn：#b91c1c / #dc6a6a / #fef2f2
   ===================================================================== */

.acs-card {
  /* 优先复用 account-redesign.css 的页面 token；手机端没有这些 token 时回落同一色值，
     不新增颜色。危险色沿用 account.css 的 .account-danger-btn（#b91c1c / #dc6a6a / #fef2f2）。 */
  --acs-brand: var(--ac-brand, #00aceb);
  --acs-brand-strong: var(--ac-brand-hover, #009bd4);
  --acs-text: var(--ac-text, #172033);
  --acs-muted: var(--ac-muted, #667085);
  --acs-border: var(--ac-border, #e7edf3);
  --acs-surface: var(--ac-surface, #ffffff);
  --acs-soft: var(--ac-soft-blue, #f3fbfe);
  --acs-danger: #b91c1c;
  --acs-danger-border: rgba(220, 100, 100, 0.55);
  --acs-danger-bg: #fef2f2;
  --acs-radius: var(--ac-radius, 16px);
  --acs-radius-sm: var(--ac-radius-sm, 10px);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--acs-border);
  border-radius: var(--acs-radius);
  background: var(--acs-surface);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04), 0 8px 24px rgba(23, 32, 51, 0.04);
  color: var(--acs-text);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

.acs-card [hidden] { display: none !important; }

.acs-head { display: grid; gap: 4px; margin-bottom: 18px; min-width: 0; }
.acs-kicker {
  justify-self: start;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--acs-soft);
  border: 1px solid rgba(0, 172, 235, 0.2);
  color: #00698f;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.acs-head h2 { margin: 4px 0 0; font-size: 20px; line-height: 1.3; color: var(--acs-text); }
.acs-sub { margin: 0; color: var(--acs-muted); font-size: 13px; line-height: 1.6; }
.acs-sub.is-error { color: var(--acs-danger); }

.acs-section { min-width: 0; }
.acs-section + .acs-section { margin-top: 22px; }
.acs-section-head h3,
.acs-danger-head h3 { margin: 0; font-size: 16px; line-height: 1.4; color: var(--acs-text); }
.acs-section-head p { margin: 4px 0 0; color: var(--acs-muted); font-size: 12.5px; }

/* ---------------- 步骤条：PC 横向，手机纵向 ---------------- */
.acs-steps {
  display: flex;
  gap: 8px;
  margin: 16px 0 18px;
  padding: 0;
  list-style: none;
}
.acs-steps li {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--acs-border);
  border-radius: var(--acs-radius-sm);
  background: #fbfcfe;
  color: var(--acs-muted);
}
.acs-steps li[data-state="current"] {
  border-color: rgba(0, 172, 235, 0.45);
  background: var(--acs-soft);
  color: var(--acs-text);
}
.acs-steps li[data-state="done"] { border-color: var(--acs-border); background: #fff; color: var(--acs-muted); }
.acs-step-no {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef3f8;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}
.acs-steps li[data-state="current"] .acs-step-no { background: var(--acs-brand); color: #002e3d; }
.acs-steps li[data-state="done"] .acs-step-no { background: rgba(0, 172, 235, 0.12); color: #00698f; }
.acs-steps b { display: block; font-size: 13px; line-height: 1.4; color: inherit; }
.acs-steps em { display: block; margin-top: 2px; font-style: normal; font-size: 11.5px; line-height: 1.45; color: var(--acs-muted); }

/* ---------------- 表单 ---------------- */
.acs-panel { min-width: 0; }
.acs-identity { display: grid; gap: 12px; }
.acs-field { display: grid; gap: 6px; min-width: 0; }
.acs-field > span:first-child { color: var(--acs-muted); font-size: 12.5px; font-weight: 600; }
.acs-field > span:first-child b { color: var(--acs-danger); font-weight: 700; }
.acs-field input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--acs-border);
  border-radius: var(--acs-radius-sm);
  background: #fbfcfe;
  color: var(--acs-text);
  font: inherit;
  font-size: 14px;
}
.acs-field input:focus {
  outline: none;
  border-color: rgba(0, 172, 235, 0.55);
  background: #fff;
}
.acs-field input:disabled { background: #f4f6f9; color: #98a2b3; }
.acs-inline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acs-inline input { flex: 1 1 auto; }
.acs-inline .acs-btn { flex: 0 0 auto; }
.acs-note { margin: 0; color: var(--acs-muted); font-size: 12px; line-height: 1.6; }
.acs-note.is-error { color: var(--acs-danger); }
.acs-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #00698f;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.acs-link:hover { color: var(--acs-brand-strong); }

.acs-rules-wrap { margin: 12px 0; padding: 10px 12px; border-radius: var(--acs-radius-sm); background: #f8fafc; border: 1px dashed var(--acs-border); }
.acs-rules-title { margin: 0 0 6px; color: var(--acs-muted); font-size: 12px; font-weight: 600; }
.acs-rules { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.acs-rules li { position: relative; padding-left: 20px; color: var(--acs-muted); font-size: 12.5px; }
.acs-rules li::before {
  content: "○";
  position: absolute;
  left: 2px;
  top: 0;
  color: #98a2b3;
  font-size: 11px;
}
.acs-rules li[data-state="ok"] { color: #157f52; }
.acs-rules li[data-state="ok"]::before { content: "✓"; color: #157f52; font-weight: 700; }
.acs-rules li[data-state="info"]::before { content: "i"; font-weight: 700; color: #00698f; }
.acs-rules li[data-state="info"] { color: #00698f; }

/* ---------------- 按钮 ---------------- */
.acs-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.acs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--acs-radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.acs-btn-primary { background: var(--acs-brand); color: #002e3d; }
.acs-btn-primary:hover { background: var(--acs-brand-strong); }
.acs-btn-ghost { background: #fff; border-color: var(--acs-border); color: #475467; }
.acs-btn-ghost:hover { border-color: #d5dee8; color: var(--acs-text); }
.acs-btn:disabled,
.acs-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.acs-btn:focus-visible { outline: 3px solid #0087b3; outline-offset: 2px; }
.acs-danger-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  background: #fff;
  border-color: #dc6a6a;
  color: var(--acs-danger);
}
.acs-danger-btn:hover:not(:disabled) { background: var(--acs-danger-bg); }
.acs-danger-btn:disabled { background: #f8fafc; border-color: var(--acs-border); color: #98a2b3; }

.acs-status { margin: 10px 0 0; min-height: 1.2em; color: var(--acs-muted); font-size: 12.5px; line-height: 1.6; }
.acs-status.is-error { color: var(--acs-danger); }
.acs-status.is-success { color: #157f52; }

/* ---------------- 成功态 ---------------- */
.acs-success { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid rgba(0, 172, 235, 0.24); border-radius: var(--acs-radius-sm); background: var(--acs-soft); }
.acs-success-icon { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--acs-brand); color: #002e3d; font-weight: 800; }
.acs-success h4 { margin: 0 0 2px; font-size: 14px; color: var(--acs-text); }
.acs-success p { margin: 0; color: var(--acs-muted); font-size: 12.5px; line-height: 1.6; }

/* ---------------- 注销危险区 ---------------- */
.acs-danger {
  margin-top: 24px;
  padding: 18px;
  border: 2px solid var(--acs-danger-border);
  border-radius: var(--acs-radius);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.7), #fff 55%);
  min-width: 0;
}
.acs-danger-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.acs-danger-head h3 { color: var(--acs-danger); }
.acs-danger-tag { padding: 2px 8px; border-radius: 999px; background: var(--acs-danger-bg); border: 1px solid var(--acs-danger-border); color: var(--acs-danger); font-size: 11.5px; font-weight: 700; }
.acs-danger-lead { margin: 8px 0 10px; color: #7f1d1d; font-size: 12.5px; line-height: 1.6; }
.acs-consequences { display: grid; gap: 6px; margin: 0 0 14px; padding: 0 0 0 18px; color: #475467; font-size: 12.5px; line-height: 1.65; }
.acs-consequences li::marker { color: var(--acs-danger); }
.acs-danger-form { display: grid; gap: 12px; }
.acs-danger-guest { display: grid; gap: 10px; }
.acs-danger-guest .acs-btn { justify-self: start; }
.acs-danger .acs-status { margin-top: 0; }

/* ---------------- 登录页右侧栏 / 手机登录页 ---------------- */
@media (min-width: 801px) {
  body[data-page="account-login"]:not(.mobile-page) .account-shell {
    display: block;
    width: min(1180px, calc(100vw - 48px));
    min-height: 0;
    padding: 40px 0 64px;
  }
  body[data-page="account-login"]:not(.mobile-page) .ac-login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 560px;
    margin: 0 auto;
    align-items: start;
  }
  body[data-page="account-login"]:not(.mobile-page) .acs-card { padding: 26px 26px 22px; }
}

@media (max-width: 1080px) and (min-width: 801px) {
  body[data-page="account-login"]:not(.mobile-page) .ac-login-layout { grid-template-columns: minmax(0, 1fr); max-width: 560px; margin: 0 auto; }
}

/* 登录页手机：卡片全宽；默认折叠，点「忘记密码」才展开 */
.account-security-mobile {
  width: 100%;
  max-width: 100%;
  margin: 18px auto 28px;
  padding: 0 16px;
  box-sizing: border-box;
}
.account-security-mobile[hidden] { display: none !important; }
body.mobile-page .account-security-mobile .acs-card { padding: 20px 16px; }

/* Login is a single-purpose view. Recovery is opened explicitly on both devices. */
[data-account-password-recovery][hidden],
body[data-page="account-login"] #account-gate[hidden] { display: none !important; }
.account-password-recovery { min-width: 0; }
.account-recovery-back { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 10px; padding: 0 12px; border: 1px solid var(--account-line, #dae6ee); border-radius: 10px; background: #fff; color: var(--account-text, #203a53); font: inherit; font-size: 13px; cursor: pointer; }
.account-recovery-back:hover { border-color: #a5d8eb; background: #f5fbfe; }
.account-recovery-back:focus-visible { outline: 2px solid #008cbd; outline-offset: 3px; }

/* ---------------- 手机：按钮 ≥44px，步骤纵向 ---------------- */
body.mobile-page .acs-steps { flex-direction: column; }
body.mobile-page .acs-btn { min-height: 44px; font-size: 15px; }
@media (max-width: 640px) {
  .acs-steps { flex-direction: column; }
  .acs-card { padding: 20px 16px; }
  .acs-btn { min-height: 44px; font-size: 15px; }
  .acs-actions { flex-direction: column; }
  .acs-actions .acs-btn { width: 100%; }
  .acs-inline { flex-wrap: wrap; }
  .acs-inline .acs-btn { width: 100%; }
  .acs-head h2 { font-size: 19px; }
  .acs-danger { padding: 16px 14px; }
}

/* 工作台设置页：卡片与既有分组间距一致 */
/* 工作台设置页：分组标题已写明「账号安全」，卡片内不再重复 kicker */
#account-security-card .acs-kicker { display: none; }
#account-security-card { min-width: 0; }
#account-security-card .acs-card { box-shadow: none; }
.ac-settings-group .acs-card { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .acs-card * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
