/* ══════════════════════════════════════════════════════════════════
   assets/ux.css —— 设计规范与通用交互的唯一真源
   ══════════════════════════════════════════════════════════════════
   来源：UX-PLAN.md §5「设计规范（tokens）」。

   为什么需要这个文件：
     修复前 packages/server/src/index.js 的静态处理器**只放行 .html**，
     六套页面各自内联一整套 CSS，无法共享 —— 设计规范只能靠人肉同步。
     2026-10-17 的 0-2 改动加了 `assets/` 白名单 + 真实路径校验，
     这个文件才第一次有可能存在。

   ⚠️ 当前状态：**仅落地 tokens 与基础基类**，尚未把六个页面切过来
      （那是 UX-PLAN §4.F/§4.I 的 P1 工作）。
      页面引入方式（幂等，可逐页上）：
        <link rel="stylesheet" href="/assets/ux.css">

   安全说明：本文件必须留在 packages/web/assets/ 内 ——
     静态处理器会 path.resolve 后校验是否仍在 WEB_DIR 内，
     越界路径（如 /assets/../../wtest1.html）一律 404。
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* ── 字号：21 档 → 6 档 ── */
  --fs-xs: 13px;   /* 次要说明（原 11/11.5/12/12.5 全部并到这里） */
  --fs-sm: 14px;   /* 正文 */
  --fs-md: 15px;   /* 卡片标题 */
  --fs-lg: 17px;   /* 页面标题 */
  --fs-xl: 22px;   /* 金额 */
  --fs-2xl: 28px;  /* 主金额 */

  /* ── 颜色 ──
     ★ 实测：原色直接当文字用多数不达标
       #00b42a/#e8ffea = 2.63:1、#1677ff/#fff = 4.10:1、#f53f3f/#fff = 3.71:1
     故 token 拆成「填充色」与「文字色」两套，文字色取加深版。 */
  --c-primary: #1677ff;        /* 填充：按钮底色、边框 */
  --c-primary-text: #0b5fd1;   /* 文字/链接：on #fff = 5.88:1 */
  --c-success: #00b42a;        /* 填充 */
  --c-success-text: #0a7a22;   /* 文字：on #e8ffea = 5.22:1 */
  --c-warn: #d25f00;
  --c-danger: #f53f3f;         /* 填充 */
  --c-danger-text: #d32029;    /* 文字：on #fff = 5.24:1 */
  --c-text: #1d2129;           /* on #fff = 16.13:1 */
  --c-text-2: #4e5969;         /* on #fff = 7.10:1 */
  /* ★ 取 #667085 而非 #6b7280：#6b7280 在页面底色 #f5f6f8 上只有 4.47:1（不达标） */
  --c-text-3: #667085;         /* 原 #86909c 只有 3.00~3.24:1 */
  --c-line: #e5e6eb;
  --c-bg: #f5f6f8;
  --c-card: #ffffff;

  /* ── 圆角 / 间距 ── */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;

  /* ── 硬约束 ── */
  --tap-min: 44px;
  --focus-ring: 2px solid var(--c-primary);
}

/* ── 触控目标 ≥ 44px（UX-PLAN §4.F1）── */
.link, .link-btn, .rp {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  margin-left: 0;
}
/* 列表行内的密集操作：至少 36px，且不与相邻项重叠 */
.acct-ops .link { min-height: 36px; }
/* 底部 tab：37px → 56px */
.tabbar div {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 焦点可见（UX-PLAN §4.F2）──
   用 :focus-visible 兼顾鼠标用户（鼠标点击不出现 outline，键盘可见） */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: 4px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 0;
}
:focus:not(:focus-visible) { outline: none; }

/* ── 动效豁免（UX-PLAN §4.F4）── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ── Toast 队列宿主（UX-PLAN §4.D1）── */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast-host .toast {
  pointer-events: auto;
  background: rgba(29, 33, 41, .92);
  color: #fff;
  font-size: var(--fs-sm);
  line-height: 1.6;
  padding: 10px 16px;
  border-radius: var(--r-md);
  max-width: 100%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  opacity: 1;
  transition: opacity .2s ease;
}
.toast-host .toast.out { opacity: 0; }
.toast-host .toast-success { background: var(--c-success-text); }
.toast-host .toast-error { background: var(--c-danger-text); }
.toast-host .toast-warn { background: var(--c-warn); }

/* ── 服务状态卡（UX-PLAN §4.B 三态）── */
.status-card { border-left: 4px solid var(--c-success); }
.status-card.svc-warn { border-left-color: var(--c-warn); }
.status-card.svc-off { border-left-color: var(--c-danger); }
.svc-line { font-size: var(--fs-xs); line-height: 1.9; color: var(--c-text); }
.svc-line.muted { color: var(--c-text-3); }
.svc-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }

/* ── 消息里的操作跳转（PLAN-UX B1）── */
.msg-link {
  color: var(--c-primary-text);
  font-size: var(--fs-xs);
  cursor: pointer;
  margin-left: var(--sp-2);
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 6px;
}
