/* S2 · 账号中心 / 强制改密 / 管理员 */
.s2-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(18, 24, 38, .46);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.s2-overlay.hidden { display: none; }
#s2-panel-overlay { z-index: 1200; }
#s2-pwd-overlay { z-index: 1310; }
.s2-toast { z-index: 1320; }

/* S2 · 登录页统一为改密弹窗的卡片风格 */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1250;
  background: rgba(18, 24, 38, .46);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-overlay.hidden { display: none; }
.auth-card {
  width: min(430px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .26);
  padding: 28px;
  margin: 0;
}
.auth-brand { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-brand span { color: var(--accent); }
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.6; }
.auth-field { display: block; margin: 12px 0; }
.auth-field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.auth-field input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
.auth-field input:focus { outline: 2px solid #bfd3ff; border-color: var(--accent); }
.auth-mid {
  color: var(--muted); font-size: 12px; margin: 10px 0 4px;
  word-break: break-all;
}
.auth-mid code { font-size: 11.5px; }
.auth-err {
  color: var(--bad-fg); background: var(--bad-bg); border: 1px solid #f0c9c9;
  border-radius: 8px; padding: 8px 10px; margin: 10px 0;
}
.auth-err.hidden { display: none; }
.auth-submit { width: 100%; margin-top: 12px; }
.auth-note { color: var(--muted); font-size: 11.5px; line-height: 1.65; margin-top: 12px; }

/* 手机号：输入框占满剩余空间，按钮固定宽度，禁止被 .primary 的 100% 撑开 */
.s2-inline .s2-input { flex: 1 1 auto; min-width: 0; }
.s2-inline > button {
  flex: 0 0 auto; width: auto; min-width: 112px;
  padding: 8px 16px;
}

.s2-card {
  width: min(560px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .26);
  padding: 26px;
}
.s2-panel-card { width: min(920px, 100%); }
.s2-eyebrow { font-size: 12px; color: var(--accent); letter-spacing: .08em; margin-bottom: 4px; }
.s2-card h2 { margin: 0 0 8px; font-size: 20px; }
.s2-sub { color: var(--muted); margin: 0 0 16px; }
.s2-field { display: block; margin: 12px 0; }
.s2-field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.s2-field input, .s2-input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
.s2-field input:focus, .s2-input:focus { outline: 2px solid #bfd3ff; border-color: var(--accent); }
.s2-err { color: var(--bad-fg); background: var(--bad-bg); border: 1px solid #f0c9c9; border-radius: 8px; padding: 8px 10px; margin: 10px 0; }
.s2-err.hidden { display: none; }
.s2-hint { color: var(--muted); font-size: 12px; margin: 8px 0; }
.s2-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.s2-actions-left { justify-content: flex-start; }
.s2-x {
  border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.s2-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.s2-panel-body { min-height: 120px; }
.s2-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.s2-kv { border-bottom: 1px dashed var(--line); padding: 7px 0; }
.s2-kv span { display: block; color: var(--muted); font-size: 12px; }
.s2-kv strong { font-weight: 500; }
.s2-block { margin-top: 16px; }
.s2-block-title { font-weight: 500; margin-bottom: 8px; }
.s2-inline { display: flex; gap: 8px; align-items: center; }
.s2-inline .s2-input { flex: 1; }
.s2-machines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.s2-machine {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.s2-machine:last-child { border-bottom: 0; }
.s2-machine code { font-size: 12px; }
.s2-machine .s2-muted { margin-left: auto; }
.s2-tag { font-size: 11px; color: var(--accent); background: #eef4ff; border: 1px solid #d6e4ff; border-radius: 999px; padding: 1px 7px; }
.s2-muted { color: var(--muted); }
.s2-tiny { font-size: 11px; }
.s2-admin-tools { display: grid; grid-template-columns: 1fr 1.2fr 1fr auto; gap: 8px; margin-bottom: 6px; }
.s2-admin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.s2-admin-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.s2-admin-main { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.s2-admin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.s2-temp { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid #e6c88a; border-radius: 8px; padding: 9px 10px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.s2-toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 1300;
  background: #111827; color: #fff; border-radius: 8px; padding: 9px 14px;
  font-size: 13px; box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.s2-toast.hidden { display: none; }
#btn-account, #btn-logout { white-space: nowrap; }
#btn-account { position: relative; }
#btn-account::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #111827; color: #fff;
  border-radius: 7px; padding: 6px 10px;
  font-size: 12px; line-height: 1.4; white-space: nowrap;
  opacity: 0; pointer-events: none; transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
  z-index: 40;
}
#btn-account:hover::after, #btn-account:focus-visible::after {
  opacity: 1; transform: translateY(0);
}
@media (max-width: 720px) {
  .s2-profile-grid { grid-template-columns: 1fr; }
  .s2-admin-tools { grid-template-columns: 1fr; }
  .s2-card { padding: 18px; }
}

/* ---------------- 4.1.34 · 试用 Key / 我的 Key / 额度 ----------------
   弹窗沿用 .ai-dialog 的骨架（<dialog> 自带焦点陷阱与 Esc 关闭），
   这里只补额度徽标、引导文案与"我的 Key"面板的排版。 */
.ai-quota-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; justify-content: center; }
.ai-quota-row.hidden { display: none; }
.ai-quota {
  font-size: 12px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 10px; white-space: nowrap;
}
.ai-quota.ai-quota-empty { color: var(--bad-fg); background: var(--bad-bg); border-color: #f0c9c9; }
.link-btn {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 12px; line-height: 1.6;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: #1d4ed8; }

/* 登录后提示：与改密弹窗同重量级，但不阻塞（可以"先用试用额度"） */
.ai-trial-dialog { width: min(560px, 92vw); }
.ai-trial-lead { font-size: 13px; line-height: 1.7; margin: 6px 0 10px; }
.ai-trial-lead b { color: var(--accent); }
.ai-trial-points { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; line-height: 1.8; color: var(--muted); }
.ai-trial-points b { color: var(--text); }

/* 我的 Key */
.ai-me-dialog { width: min(560px, 92vw); }
.ai-me-quota {
  font-size: 12.5px; line-height: 1.7; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin: 10px 0 14px;
}
.ai-me-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; word-break: break-all; }
.ai-me-msg { font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.ai-me-msg.ok-text { color: var(--ok-fg); }
.ai-me-msg.warn-text { color: var(--bad-fg); }
.ai-me-dialog select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff;
}
.ai-key-managed {
  font-size: 12px; line-height: 1.7; color: var(--muted);
  background: var(--warn-bg); border: 1px solid #e6c88a;
  border-radius: 8px; padding: 8px 10px; margin: 10px 0;
}
.ai-key-managed.hidden, .field.hidden { display: none; }

/* 线A：额度用尽时的灰条（判定照常，只是没有 AI 参考） */
.ai-quota-note {
  margin: 8px 0 0; padding: 8px 12px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.6;
  background: #f4f6fa; border: 1px solid var(--line); color: var(--muted);
}
.ai-quota-note.hidden { display: none; }

/* ===== 2026-11-15 S4 手机 390px 适配（≤480px，与 style.css 断点同步；口径见 S4 改造清单） ===== */
@media (max-width: 480px) {
  /* 3.7 input 字号 16px：本文件在 style.css 之后加载，同特异性规则在此处覆盖才生效
     （首版只写在 style.css 里，被本文件原有 .s2-field/.auth-field 规则压回 12px，实测 V13 FAIL） */
  input, select, textarea,
  .auth-field input, .s2-field input, .s2-input, .field input, .s2-machine code { font-size: 16px; }

  /* 3.10 个人中心机器行：机器码+状态+按钮 换行不溢出 */
  .s2-machine { flex-wrap: wrap; row-gap: 6px; }
  .s2-machine code { word-break: break-all; }
  .s2-machine .s2-muted { margin-left: 0; flex-basis: 100%; }

  /* 3.9 AI 试用/我的 Key 弹窗：窄屏收窄宽度 */
  .ai-trial-dialog, .ai-me-dialog { width: 94vw; }
}

