/* ============================================================================
   account.css —— 账号 / 余额 / 账本 / 登录 / 账号安全页面（G-01）
   ----------------------------------------------------------------------------
   复用既有 token 变量（/static/tokens.css）与外壳类（.cy-topbar / .cy-nav）。
   本文件是账号相关页面**唯一**的页面级样式来源：可以在原处调整既有
   .ac-* 类的视觉，不新增业务状态，也不改任何脚本读取的属性。

   视觉口径与医院工作台一致：深海军蓝导航、浅色阅读面、克制的青绿主操作；
   红 / 琥珀只用于真实错误与需要多一步确认的动作，未读取与「无记录」保持中性。
   复选框、按钮、输入框都保留原生语义；本文件不覆盖 hidden、disabled、aria。

   ⚠ 本文件与 account.js 都**不得**出现服务端内部结构字段名（账本与交付
      链路的**内部列名**）：那些属于服务端内部结构，写进前端资产等于把它们
      随静态文件公开发布。⇒ 注释里也**不**逐项列举，只写这条规则本身。
      该约束由 tests/test_v3_account_http_api.py::test_g01_25 断言。
   ============================================================================ */

body {
  background: var(--cy-warm-white, #fbfcfe);
  color: var(--cy-slate-700, #334155);
}

.ac-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 16px 72px;
  font-size: 14px;
  line-height: 1.65;
}

.ac-page--auth { max-width: 520px; }
.ac-page--secure { max-width: 720px; }

.ac-page :where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--cy-teal-700, #0f766e);
  outline-offset: 2px;
}

/* ── 页面标题区 ─────────────────────────────────────────────────────── */

.ac-head { margin: 0 0 18px; }

.ac-title {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--cy-slate-900, #0f172a);
}

.ac-sub {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 650;
  color: var(--cy-slate-900, #0f172a);
}

.ac-hint {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--cy-slate-500, #5b6879);
}

.ac-hint:last-child { margin-bottom: 0; }

/* 统一的次级说明：贴着一组控件，但不抢正文。 */
.ac-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--cy-slate-500, #5b6879);
}

/* ── 卡片 ───────────────────────────────────────────────────────────── */

.ac-card {
  background: #fff;
  border: 1px solid var(--cy-slate-200, #e6eaf2);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--cy-shadow-1, 0 1px 2px rgba(15, 23, 42, 0.05));
  min-width: 0;
}

/* 登录页的前置挑战容器由脚本读取，不渲染内容；空卡片不留白框。 */
.ac-card:empty { display: none; }

/* 登录态摘要：比普通卡片更紧凑，先读结论再读账号。 */
#acSession {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  background: var(--cy-navy-050, #eef3fa);
  border-color: #d9e4f4;
  box-shadow: none;
}

#acSession .ac-row { padding: 3px 0; }
#acSession .ac-v { font-weight: 600; color: var(--cy-navy-700, #1b3c6e); }

/* ── 资料行 ─────────────────────────────────────────────────────────── */

.ac-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--cy-slate-200, #eef0f3);
  font-size: 14px;
  min-width: 0;
}

.ac-row:last-child { border-bottom: 0; }
.ac-row:first-child { padding-top: 0; }

.ac-k {
  flex: 0 0 auto;
  color: var(--cy-slate-500, #5b6879);
  font-size: 13px;
}

.ac-v {
  min-width: 0;
  color: var(--cy-slate-900, #0f172a);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-align: right;
}

/* 长邮箱 / 用户 ID 优先换行，不把行撑出卡片。 */
#acUser { font-family: var(--cy-font-mono, monospace); font-size: 13px; }

/* ── 表单 ───────────────────────────────────────────────────────────── */

.ac-field { margin-bottom: 14px; min-width: 0; }
.ac-field:last-child { margin-bottom: 0; }

.ac-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cy-slate-700, #334155);
}

.ac-input {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 9px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--cy-slate-300, #cdd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--cy-slate-900, #0f172a);
}

.ac-input::placeholder { color: var(--cy-slate-400, #75839d); }

.ac-input:focus {
  border-color: #8fbfb2;
  outline: 2px solid rgba(20, 107, 96, 0.42);
  outline-offset: 1px;
}

.ac-input:disabled {
  background: var(--cy-slate-100, #f4f6fa);
  color: var(--cy-slate-500, #5b6879);
}

/* 输入框与它专属的次级动作同一行：发送验证码贴在邮箱后面。 */
.ac-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.ac-input-row .ac-input { flex: 1 1 auto; min-width: 0; }
.ac-input-row .ac-btn { flex: 0 0 auto; }

/* 复选框整行可点，触控面积覆盖文字本身。 */
.ac-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--cy-slate-200, #e6eaf2);
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 13px;
  line-height: 1.6;
  color: var(--cy-slate-700, #334155);
  cursor: pointer;
}

.ac-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--cy-teal-700, #0f766e);
}

/* ── 操作 ───────────────────────────────────────────────────────────── */

.ac-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ac-actions--stack { align-items: stretch; }
.ac-actions--stack .ac-btn-primary { flex: 1 1 auto; }

.ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  appearance: none;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.3;
  border: 1px solid var(--cy-slate-300, #cdd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--cy-slate-900, #0f172a);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ac-btn:hover { background: var(--cy-slate-100, #f4f6fa); border-color: #b9c4d4; }

/* 唯一主操作：低饱和青绿 + 白字（teal-700 于白字 5.47:1）。 */
.ac-btn-primary {
  background: var(--cy-teal-700, #0f766e);
  border-color: var(--cy-teal-700, #0f766e);
  color: #fff;
  font-weight: 600;
}

.ac-btn-primary:hover {
  background: var(--cy-teal-800, #115e59);
  border-color: var(--cy-teal-800, #115e59);
}

.ac-btn-quiet { background: var(--cy-slate-100, #f4f6fa); }

/* 让「退出并忘记此设备」这类多一步后果的动作与普通操作区分开。 */
.ac-btn-warn {
  background: var(--cy-amber-050, #fffbeb);
  border-color: #e0bd85;
  color: #7a4a12;
}

.ac-btn-warn:hover { background: #fff3dd; border-color: #d3a762; }

.ac-btn:disabled,
.ac-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--cy-slate-100, #f4f6fa);
  border-color: var(--cy-slate-200, #e6eaf2);
  color: var(--cy-slate-500, #5b6879);
}

.ac-page a:not(.ac-btn) { color: var(--cy-navy-700, #1b3c6e); }
.ac-page a:not(.ac-btn):hover { color: var(--cy-navy-600, #24507f); }

/* ── 反馈 ─────────────────────────────────────────────────────────────
   同一元素既承载「验证码已发送」也承载错误：用中性提示块，不用红底冒充
   成功，也不让错误淹没在正文里。role="alert" 由脚本既有属性保留。 */

.ac-msg {
  margin: 12px 0 0;
  padding: 9px 12px;
  border: 1px solid #d9e4f4;
  border-left: 3px solid var(--cy-navy-600, #24507f);
  border-radius: 6px;
  background: #f6f9fd;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--cy-slate-900, #0f172a);
  overflow-wrap: anywhere;
}

.ac-msg:empty,
#securityStatus:empty { display: none; }

#securityStatus {
  display: inline-block;
  margin: 0;
  padding: 3px 10px;
  border-radius: var(--cy-r-pill, 999px);
  background: var(--cy-slate-100, #f4f6fa);
  border: 1px solid var(--cy-slate-200, #e6eaf2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cy-slate-700, #334155);
}

/* 角色为 alert 的安全页消息也用同一中性口径。 */
#securityMessage { white-space: pre-wrap; }

.ac-alt { margin: 14px 0 0; font-size: 13px; }

/* ── 表格：可横向滚动，长邮箱 / 订单号不挤成一列 ─────────────────── */

.ac-table-wrap {
  margin: 12px 0 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.ac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ac-table-wrap--wide .ac-table { min-width: 520px; }

.ac-table th,
.ac-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cy-slate-200, #eef0f3);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.ac-table th {
  color: var(--cy-slate-500, #5b6879);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  background: #fafbfd;
}

.ac-table tbody tr:last-child td { border-bottom: 0; }
.ac-table tbody tr:hover td { background: #fbfcfe; }

/* ── 免费模式：历史资金折叠壳 ───────────────────────────────────────── */

.ac-history { padding: 0; }

.ac-history > summary {
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--cy-slate-900, #0f172a);
  cursor: pointer;
}

.ac-history > summary:hover { color: var(--cy-teal-700, #0f766e); }

.ac-history[open] > summary { border-bottom: 1px solid var(--cy-slate-200, #e6eaf2); }

.ac-history-hint { margin: 12px 18px 0; }

.ac-history > .ac-card {
  margin: 0 18px 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ac-history > .ac-card:first-of-type { margin-top: 16px; }
.ac-history .ac-sub { font-size: 14px; }

/* ── 账号页脚：返回与退出同组，说明独立成行 ───────────────────────── */

.ac-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--cy-slate-200, #e6eaf2);
}

.ac-footer .ac-actions { margin: 0; flex: 0 0 auto; }
.ac-footer .ac-note { flex: 1 1 260px; min-width: 0; }

/* ── 管理员区：先二次验证，再按权限轴分区 ─────────────────────────── */

.ac-admin > .ac-sub { margin-bottom: 4px; }
.ac-admin > .ac-hint { margin-bottom: 0; }
.ac-admin #acAdminNote { margin-top: 14px; }

.ac-block {
  margin-top: 14px;
  padding: 14px 14px 16px;
  border: 1px solid var(--cy-slate-200, #e6eaf2);
  border-radius: 8px;
  background: #fbfcfe;
  min-width: 0;
}

.ac-block .ac-sub {
  margin: 16px 0 10px;
  font-size: 14px;
}

.ac-block .ac-sub:first-child { margin-top: 0; }
.ac-axis + .ac-sub { margin-top: 0; }

.ac-axis {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--cy-slate-500, #5b6879);
}

.ac-axis:not(:first-child) { margin-top: 18px; }

.ac-block .ac-field { margin-bottom: 10px; }

.ac-block .ac-btn { width: 100%; }

.ac-block .ac-row { padding: 5px 0; font-size: 13px; }

.ac-plainlist {
  margin: 10px 0 0;
  padding: 10px 12px 10px 28px;
  border-radius: 6px;
  background: var(--cy-slate-100, #f4f6fa);
  font-family: var(--cy-font-mono, monospace);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--cy-slate-900, #0f172a);
  overflow-wrap: anywhere;
}

.ac-plainlist:empty { display: none; }

.ac-sep {
  border: 0;
  border-top: 1px solid var(--cy-slate-200, #eef0f3);
  margin: 16px 0;
}

/* ── 账号安全页 ─────────────────────────────────────────────────────── */

#securityPage .ac-card > .ac-sub:first-child { margin-top: 0; }

#securityPage .ac-sub { font-size: 15px; }

#securityPage .ac-card > p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.7; }

#securityPage .ac-hint { font-size: 12.5px; color: var(--cy-slate-500, #5b6879); }

#securityPage #limitedSecurity {
  border-left: 3px solid var(--cy-amber-600, #d97706);
}

#securityPage #limitedSecurity .ac-sub { color: var(--cy-amber-800, #7c2d12); }

#securityPage #manualRecoveryState {
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--cy-slate-100, #f4f6fa);
  color: var(--cy-slate-700, #334155);
}

#securityPage #credentialPanel {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--cy-slate-400, #75839d);
  border-radius: 8px;
  background: #fbfcfe;
}

#securityPage #issuedCredential {
  font-family: var(--cy-font-mono, monospace);
  font-size: 13px;
}

#securityPage #securityLogout,
#securityPage #forgetDevice {
  margin: 0 8px 10px 0;
}

/* ── 登录页 ─────────────────────────────────────────────────────────── */

.ac-login .ac-field { margin-bottom: 16px; }

.ac-login .ac-check + .ac-hint { margin-top: 8px; }

.ac-login .ac-actions { margin-top: 18px; }

.ac-login .ac-msg { margin-top: 14px; }

.ac-login .ac-alt {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--cy-slate-200, #e6eaf2);
  font-size: 13px;
}

/* ── 窄屏 / 手持设备 ────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .ac-page { padding: 18px 12px 56px; }
  .ac-title { font-size: 21px; }
  .ac-card { padding: 15px; border-radius: 9px; }

  /* 资料行在窄屏改为上下两行：标签在上，值在左，长值可换行。 */
  .ac-row { flex-direction: column; align-items: stretch; gap: 2px; }
  .ac-row .ac-v { text-align: left; }
  #acSession .ac-row { flex-direction: row; align-items: baseline; }
  #acSession .ac-v { text-align: right; }

  .ac-input { font-size: 16px; min-height: 44px; }
  .ac-btn { min-height: 44px; }
  .ac-btn--sm { min-height: 36px; padding: 6px 10px; }

  .ac-block { padding: 12px 12px 14px; }
  .ac-table { font-size: 12.5px; }
  .ac-table th,
  .ac-table td { padding: 7px 8px; }

  .ac-footer { gap: 12px; }
  .ac-footer .ac-note { flex: 1 1 100%; }
  .ac-footer .ac-actions { flex: 1 1 auto; }
  .ac-footer .ac-btn { flex: 1 1 auto; }

  #securityPage #securityLogout,
  #securityPage #forgetDevice { width: 100%; margin: 0 0 8px; }

  #credentialPanel .ac-btn { width: 100%; }
}

@media (max-width: 420px) {
  .ac-input-row { flex-wrap: wrap; }
  .ac-input-row .ac-btn { width: 100%; }
  .ac-actions--stack .ac-btn { width: 100%; }
}
