/* ============================================================
   项目管理系统 · 样式
   配色取自品牌 logo：主色 #0d8ee5（明源云蓝）、强调色 #0a6fb5（同色系深调）
   布局：左侧深色导航 + 顶栏 + 内容区；≤900px 时侧栏转为抽屉
   ============================================================ */

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

:root {
  --brand: #0d8ee5;
  --brand-dark: #0a6fb5;
  --brand-deep: #085a94;
  --brand-soft: #e8f4fd;
  --brand-line: #bfe0f7;
  --accent: #0a6fb5;
  --accent-soft: #e4f0fb;

  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --ink: #1a2332;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: #e3e8ef;
  --line-2: #eef2f6;

  /* 表格行悬停底色（v0.13.26）。
     原来是**两处硬编码** `#f8fbfe` 直接写在 td 上 —— 深色主题只改了
     `tbody tr:hover` 的背景，而 td 自己有不透明底色，永远盖在 tr 上面。
     结果：深色下鼠标一划过行，整行变成近白色，字还是浅色 → 整行看不见。
     立成变量后，深色主题只需换这一个值，不会再出现"改了 tr 忘了 td"。 */
  --row-hover: #f8fbfe;
  /* 冻结列的悬停底色：**必须完全不透明**。
     冻结格是 sticky 的，横向滚动时它下面压着其它列的内容；
     底色一旦带 alpha，下面的单元格就会透出来（见 826 行的坑）。 */
  --row-hover-fz: #f8fbfe;

  --ok: #1e7d44;   --ok-bg: #e8f5ec;
  --warn: #9a6b00; --warn-bg: #fdf5e3;
  --fail: #b42318; --fail-bg: #fdecea;
  --info: #0d6efd; --info-bg: #e8f1ff;

  /* 侧边栏 */
  --sb-bg: #16202d;
  --sb-bg-2: #1d2937;
  --sb-ink: #a8b6c7;
  --sb-ink-hi: #ffffff;
  --sb-line: #26333f;

  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow: 0 2px 4px rgba(16,24,40,.05), 0 12px 28px -16px rgba(16,24,40,.16);
  --shadow-lg: 0 8px 16px rgba(16,24,40,.08), 0 24px 48px -20px rgba(16,24,40,.24);
  --topbar-h: 58px;
  --sidebar-w: 232px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.9;
      stroke-linecap: round; stroke-linejoin: round; }
/* sprite 定义块自身不显示 */
body > svg[aria-hidden] { display: none; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c8d2dd; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #adb9c7; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(1100px 520px at 12% -8%, #d9ecfb 0%, rgba(217,236,251,0) 62%),
    radial-gradient(900px 460px at 104% 108%, #dbeafb 0%, rgba(219,234,251,0) 58%),
    linear-gradient(160deg, #f7fafd 0%, #eef4fa 100%);
}
.login-wrap {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 0;
  width: 100%; max-width: 940px; background: var(--panel);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.login-brand {
  position: relative; padding: 44px 40px; color: #fff;
  background: linear-gradient(150deg, #0d8ee5 0%, #0a6fb5 52%, #085a94 100%);
  display: flex; flex-direction: column;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(420px 200px at 88% 6%, rgba(255,255,255,.20), transparent 70%),
    radial-gradient(300px 220px at 6% 96%, rgba(255,255,255,.16), transparent 72%);
}
.login-brand > * { position: relative; z-index: 1; }
.login-title { margin: 26px 0 6px; font-size: 26px; font-weight: 700; letter-spacing: .6px; }
.login-sub { margin: 0 0 26px; font-size: 13.5px; color: rgba(255,255,255,.88); letter-spacing: .3px; }
.login-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.login-feats li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: rgba(255,255,255,.94); }
.login-feats .dot { width: 6px; height: 6px; border-radius: 50%; background: #cfe8fb; flex: none;
  box-shadow: 0 0 0 3px rgba(207,232,251,.24); }
.login-foot { margin-top: auto; padding-top: 28px; font-size: 12px; color: rgba(255,255,255,.66); }

.login-card { padding: 44px 40px; display: flex; flex-direction: column; }
.login-card-head { margin-bottom: 22px; }
.login-nav-logo { height: 40px; width: auto; display: block; }
.login-h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.login-tip { margin: 0 0 22px; font-size: 13px; color: var(--ink-3); }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field-box {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field-box:focus-within { border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px rgba(13,142,229,.14); }
.field-icon { color: var(--ink-3); font-size: 17px; flex: none; }
.field-box input, .field-box select {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%;
}
.field-box input::placeholder { color: #aab4c0; }
.field-suffix { border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  padding: 4px; display: flex; font-size: 17px; border-radius: 6px; }
.field-suffix:hover { color: var(--brand-dark); background: var(--brand-soft); }
.captcha-img { height: 34px; width: auto; border-radius: 6px; cursor: pointer; border: 1px solid var(--line); }

.login-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--fail-bg); color: var(--fail); font-size: 13px;
  border: 1px solid #f3c9c9; }
.login-msg.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dfae; }

/* ---- 企业微信免登入口（v0.13.39）----
   绿色是企微的品牌色，但**没有**用企微的 logo：那是商标，仿得不像反而更糟；
   一颗对话气泡 + 明确的文字，识别度已经足够，也不会给人"这是官方组件"的错觉。 */
.login-alt { margin-top: 16px; }
.login-or {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; color: var(--ink-3); font-size: 12px;
}
.login-or::before, .login-or::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
/* .btn 用的是 inline-flex + gap，这里的图标只需要固定尺寸，
   尺寸交给 width/height 而不是 font-size（`use` 引用的是 24×24 的符号）。 */
.btn-wecom { background: #1aad19; border-color: #1aad19; color: #fff; font-weight: 500; }
.btn-wecom:hover { background: #179b16; border-color: #179b16; color: #fff; }
.btn-wecom:active { background: #148712; border-color: #148712; }
.btn-ico { width: 18px; height: 18px; flex: none; }
.login-alt-tip { margin: 10px 0 0; font-size: 12px; line-height: 1.7; color: var(--ink-3); text-align: center; }
/* 深色主题下 #1aad19 与深底对比度足够，但按钮阴影会显脏，压一层 --panel-2 的描边。 */
html[data-theme="dark"] .btn-wecom { border-color: #23c022; }
html[data-theme="dark"] .btn-wecom:hover { border-color: #2bd62a; }

.btn-lg { height: 44px; font-size: 15px; }

/* ============================================================
   应用布局
   ============================================================ */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--sb-bg); display: flex; flex-direction: column;
  transition: transform .22s ease;
}
.sidebar-head {
  height: var(--topbar-h); flex: none; display: flex; align-items: center;
  padding: 0 16px; border-bottom: 1px solid var(--sb-line);
}
.sidebar-logo { height: 30px; width: auto; filter: brightness(0) invert(1); opacity: .95; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #35455a; }
.sidebar-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--sb-line);
  font-size: 11.5px; color: #64748b; line-height: 1.5; }

/* 侧边栏底部：平台状态（v0.13.20）。
   底色比侧栏略深一点，让它是"常驻状态条"而不是又一条菜单。 */
.sf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sf-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  color: #94a3b8; font-weight: 500; }
.sf-state.ok { color: #4ade80; }
.sf-state.warn { color: #fbbf24; }
.sf-state.bad { color: #f87171; }
.sf-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  display: inline-block; flex: none; box-shadow: 0 0 0 3px rgba(148,163,184,.12); }
.sf-btn { border: 0; background: transparent; color: #64748b; cursor: pointer;
  padding: 2px; border-radius: 5px; display: grid; place-items: center; font-size: 13px; }
.sf-btn:hover { color: var(--sb-ink-hi); background: var(--sb-bg-2); }
.sf-deps { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 5px; color: #7c8ba0; }
.sf-dep { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.sf-dep.ok { color: #86efac; }
.sf-dep.bad { color: #fca5a5; }
.sf-meta { display: flex; flex-direction: column; gap: 1px; margin-top: 5px;
  color: #52627a; font-size: 10.5px; }
.sf-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.snav-group { margin-bottom: 2px; }
.snav-link, .snav-groupbtn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 0; background: transparent; color: var(--sb-ink);
  border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  font-size: 13.5px; text-decoration: none; transition: background .14s, color .14s;
}
.snav-link:hover, .snav-groupbtn:hover { background: var(--sb-bg-2); color: var(--sb-ink-hi); text-decoration: none; }
.snav-link.active { background: var(--brand); color: #fff; font-weight: 500;
  box-shadow: 0 6px 14px -8px rgba(13,142,229,.9); }
.snav-link svg, .snav-groupbtn svg:first-child { font-size: 17px; flex: none; }
.snav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snav-chev { font-size: 15px; color: #64748b; transition: transform .2s; flex: none; }
.snav-group.open > .snav-groupbtn .snav-chev { transform: rotate(90deg); }
.snav-sub { overflow: hidden; padding-left: 8px; }
.snav-sub .snav-link { padding-left: 12px; font-size: 13px; }
.snav-sub .snav-link .snav-text { padding-left: 0; }

.sidebar-mask { position: fixed; inset: 0; background: rgba(10,18,28,.44); z-index: 39; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none; position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 34px; height: 34px; flex: none; display: none; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm);
  color: var(--ink-2); cursor: pointer; font-size: 18px;
}
.icon-btn:hover { color: var(--brand-dark); border-color: var(--brand-line); background: var(--brand-soft); }

.crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--ink-2); overflow: hidden; }
.crumb-item { white-space: nowrap; }
.crumb-item.current { color: var(--ink); font-weight: 600; }
.crumb-sep { color: #c3ccd8; }

.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.sys-name { font-size: 13.5px; font-weight: 600; color: var(--ink);
  padding-right: 14px; border-right: 1px solid var(--line); }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px;
  border: 1px solid transparent; border-radius: 22px; background: transparent; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.user-btn:hover { background: var(--panel-2); border-color: var(--line); }
.avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-deep));
  color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .3px;
}
.user-info { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.user-nick { font-size: 13px; font-weight: 500; color: var(--ink); }
.user-role { font-size: 11px; color: var(--ink-3); }
.user-btn .chev { font-size: 14px; color: var(--ink-3); }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 176px; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 5px; animation: pop .13s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.dropdown-item {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 7px; cursor: pointer;
  font-size: 13.5px; color: var(--ink-2); text-align: left;
}
.dropdown-item:hover { background: var(--panel-2); color: var(--ink); }
.dropdown-item.danger:hover { background: var(--fail-bg); color: var(--fail); }
.dropdown-item svg { font-size: 16px; flex: none; }
.dropdown-sep { height: 1px; background: var(--line-2); margin: 4px 2px; }

.content { flex: 1; padding: 20px; }

/* ============================================================
   卡片 / 页面头
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.page-desc { margin: 3px 0 0; font-size: 13px; color: var(--ink-3); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 页内页签（项目管理页：项目列表 / 账号授权）
   注意它是**普通 div 而不是 card**：`.card + .card` 那条相邻兄弟规则靠
   "紧邻"生效，中间插一张卡片会把它断开，于是第一个卡片丢掉上边距。 */
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 16px; flex-wrap: wrap; }
.tab { appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 9px 14px; font-size: 13.5px; color: var(--ink-2); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tab-pane[hidden] { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
/* 卡片内部有焦点（下拉展开后搜索框/选项按钮都有焦点）时把它抬一层。
   这是「筛选区的下拉不该被结果区盖住」的结构化保证：不依赖动画不留痕，
   也不必把面板 portal 到 body（后者会打断现有的点外部关闭判据）。 */
.card:focus-within { position: relative; z-index: 4; }
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title svg { color: var(--brand); font-size: 17px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* 统计卡 */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.stat.accent::before { background: var(--accent); }
.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat-label { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; margin: 5px 0 1px;
  font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 11.5px; color: var(--ink-3); }

/* 待办卡（工作台首屏）。
   原来这里是「模块卡」(.mod*)，本版工作台把「业务模块」换成了「待办」，
   那组样式一并删掉 —— 留着的死样式会让人以为那个卡片还在，
   而它已经没有任何一个文件在用了（改产品时"下架就要真下架"）。 */
.todo-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.todo {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; font: inherit;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.todo:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--brand-line); }
.todo-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 18px; flex: none; }
.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.todo-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.todo-desc { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
/* 数字用 tabular-nums：几条待办并排时，等宽数字让它们看起来是对齐的一列 */
.todo-count { font-size: 22px; font-weight: 700; color: var(--brand-dark);
  font-variant-numeric: tabular-nums; flex: none; }
.todo-go { display: inline-flex; align-items: center; gap: 2px; flex: none;
  font-size: 12.5px; color: var(--ink-3); }
.todo:hover .todo-go { color: var(--brand); }

/* ============================================================
   每日行业快讯（v0.13.20，工作台待办下方）
   ============================================================ */
/* 卡片头右侧那组「日期下拉 + 一行说明」。
   **必须允许换行**：说明文字在 360px 宽的手机上是 300 多 px，而下拉本身要 120px，
   两者并排是 450px —— 卡头装不下就会把整张卡片顶宽，进而把**整份文档**顶宽。
   文档一宽，`position: fixed` 的底部导航就按更宽的包含块布局，最后两个 tab
   被推到屏幕外（2026-10-30 企微里的"底部图标显示不全"就是这么来的）。
   `min-width: 0` 同理：flex 子项的默认 min-width 是 min-content，不给 0 就压不下去。 */
.news-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
/* 原先这里是内联 `white-space:nowrap`（JS 里写死的），窄屏无解。
   现在收成类，让它在放不下时自然折行；宽屏空间足够，不会折。 */
.news-hint { color: var(--ink-3); font-size: 12px; min-width: 0; }
.news-sel {
  height: 28px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink-2); font: inherit; font-size: 12.5px; cursor: pointer;
}
.news-stale {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12.5px;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
}
.news-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.news-summary {
  margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-2);
  font-size: 13.5px; line-height: 1.85; color: var(--ink); text-align: justify;
}
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { padding: 9px 0; border-top: 1px dashed var(--line-2); }
.news-list li:first-child { border-top: 0; padding-top: 2px; }
.news-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.news-line a { color: var(--ink); font-size: 13.5px; font-weight: 500; text-decoration: none;
  overflow-wrap: anywhere; }
.news-line a:hover { color: var(--brand); text-decoration: underline; }
.news-day { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.news-gist { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.news-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.news-h { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink);
  padding-left: 8px; border-left: 3px solid var(--brand); }
.news-src-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.news-src-table th, .news-src-table td { text-align: left; padding: 7px 8px;
  border-bottom: 1px solid var(--line-2); vertical-align: top; }
.news-src-table th { color: var(--ink-3); font-weight: 500; background: var(--panel-2); }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  font-size: 13.5px; white-space: nowrap; transition: all .14s; vertical-align: middle;
}
.btn svg { font-size: 15px; }
.btn:hover { border-color: #cbd5e1; color: var(--ink); background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn-accent:hover { background: #085a94; border-color: #085a94; color: #fff; }
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.btn-danger:hover { background: #98180f; border-color: #98180f; color: #fff; }
.btn-ghost-danger { color: var(--fail); border-color: #f0c9c5; background: #fff; }
.btn-ghost-danger:hover { background: var(--fail-bg); border-color: #e9b3ae; color: var(--fail); }
.btn-block { width: 100%; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; }

/* 表格内文字按钮 */
.linkbtn {
  border: 0; background: transparent; color: var(--brand-dark); cursor: pointer;
  padding: 2px 5px; border-radius: 6px; font-size: 13px;
}
.linkbtn:hover { background: var(--brand-soft); }
.linkbtn.danger { color: var(--fail); }
.linkbtn.danger:hover { background: var(--fail-bg); }
.linkbtn:disabled { color: var(--ink-3); cursor: not-allowed; background: transparent; }

/* ============================================================
   表单
   ============================================================ */
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.fitem { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fitem > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.fitem .req::after { content: " *"; color: var(--fail); }
/* ⚠️ `.form-grid input` 这条**必须排除复选/单选**（:not([type=checkbox]):not([type=radio])）。
   写成裸 `.form-grid input` 时，下面那组 `height:36px / width:100% / border` 会一并套到
   复选框上 —— 一个本该 13px 的小方块被撑成整行宽、36px 高、带边框的"大方框"，
   表单里凡是"勾选式"的说明行（如执行分配弹窗的「这些合同无需交付」）都会显示成一片
   空白方块。这类错**不会报任何错**，只在界面上一眼看出来；而 .check 那组规则只设
   width/height，盖得住尺寸、盖不住 padding/border/background，所以治本只有排除。
   新增任何放在 .form-grid 里的 checkbox/radio，都不要靠内联样式去救。 */
.fitem input[type=text], .fitem input[type=password], .fitem input[type=number],
.fitem input[type=email], .fitem input[type=date], .fitem select, .fitem textarea,
.form-grid input:not([type=checkbox]):not([type=radio]),
.form-grid select, .form-grid textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); outline: 0; transition: border-color .15s, box-shadow .15s, background .15s;
  width: 100%; min-width: 0;
}

/* 日期区间：起止两个输入共用一个标签，中间用 ~ 连接 */
.drange { display: flex; align-items: center; gap: 6px; min-width: 0; }
.drange input[type=date] { flex: 1 1 130px; width: auto; min-width: 130px; }
.drange-sep { color: var(--ink-3); flex: none; font-size: 12.5px; }

/* ------------------------------------------------------------
   日期输入：两处必须修的地方
   ------------------------------------------------------------
   1) **显示不全**：原生日期控件要完整显示 yyyy-mm-dd 至少需要 ~130px，
      而工具条里一个筛选项只有 172px、日期区间还要塞两个 —— 文本被硬生生截断。
      这里给它一个下限宽度（配合 .drange-item 把整格加宽），并在右侧留出
      自绘图标的位置。
   2) **点输入框不能弹出日历**：Chromium 的日期控件只在点右侧那个小图标时
      才唤起选择器，点文字只会聚焦到"年 / 月 / 日"的某一段 —— 这是原生行为，
      不是坏掉。修法是把原生 indicator 拉伸铺满整个输入框并设成透明，
      于是"点输入框任意位置"在浏览器看来都等于点了那个图标：仍然是原生行为、
      不依赖 JS，也就没有"我们调 showPicker() 与原生各弹一次"的竞态。
      （`opacity: 0` 的元素**仍然可以被点击**，`visibility: hidden` 才不行 ——
      这是本修法成立的前提，别顺手改成 visibility。）
      图标改由 background-image 自绘，否则拉伸后原生图标也一并消失了。
   注意：这两条必须写成与上面基础规则**同等优先级且在其之后**，
   否则 `padding: 0 10px` / `min-width: 0` 会把它们盖回去。
   ------------------------------------------------------------ */
.fitem input[type=date], .form-grid input[type=date] {
  position: relative;
  min-width: 130px;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='17' rx='2'/%3E%3Cpath d='M8 2.5v4M16 2.5v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 15px 15px;
}
input[type=date]::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; opacity: 0; cursor: pointer;
}
/* 三段日期文本垂直居中：只给 height 不给行高时，字会被挤到上沿 */
input[type=date]::-webkit-datetime-edit { line-height: 34px; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
.form-grid textarea { height: auto; min-height: 68px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
/* 同样必须排除复选/单选：否则复选框聚焦时会套上输入框的蓝色描边与阴影 */
.form-grid input:not([type=checkbox]):not([type=radio]):focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(13,142,229,.13); }
.form-grid input:not([type=checkbox]):not([type=radio]):disabled, .form-grid select:disabled { background: #f1f4f8; color: var(--ink-3); cursor: not-allowed; }
.fhelp { font-size: 11.5px; color: var(--ink-3); }
.ferr { font-size: 11.5px; color: var(--fail); }

/* 复选/单选组 */
.checkbox-grid { display: grid; gap: 7px 14px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.check {
  display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer;
  padding: 5px 7px; border-radius: 7px; border: 1px solid transparent;
}
.check:hover { background: var(--panel-2); border-color: var(--line-2); }
.check input { width: 15px; height: 15px; accent-color: var(--brand); flex: none; cursor: pointer; }

/* 树形选择 */
.tree-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  max-height: 340px; overflow: auto; padding: 8px; }
.tree-node { user-select: none; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.tree-row:hover { background: #eef4fa; }
.tree-toggle { width: 18px; height: 18px; flex: none; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 13px; border-radius: 4px; }
.tree-toggle:hover { background: #dde7f0; color: var(--ink-2); }
.tree-toggle.ph { visibility: hidden; }
.tree-label { flex: 1; min-width: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { padding-left: 18px; }
.tree-type { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--line-2);
  color: var(--ink-3); flex: none; }
.tree-type.M { background: var(--warn-bg); color: var(--warn); }
.tree-type.C { background: var(--brand-soft); color: var(--brand-dark); }
.tree-type.F { background: #eef0f4; color: var(--ink-3); }

/* 搜索栏 */
.toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.toolbar .fitem { flex: 0 1 172px; min-width: 132px; }
.toolbar .fitem.wide { flex-basis: 220px; }
/* 日期区间占两格：一个原生日期控件至少 ~130px，两个加分隔符 ~268px */
.toolbar .fitem.drange-item { flex: 1 1 300px; min-width: 268px; }
.toolbar .spacer { flex: 1; }
.filter-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--brand-soft); color: var(--brand-dark); border: 1px solid var(--brand-line);
  border-radius: 20px; padding: 2px 9px; }
.filter-tag button { border: 0; background: transparent; cursor: pointer; color: inherit;
  display: flex; padding: 0; font-size: 13px; }

/* ------------------------------------------------------------
   可搜索下拉（原生 select 打不出搜索，见 ui.js 的同名区块）
   ------------------------------------------------------------
   真值在隐藏 input 上，这里纯粹是"看得见的那一层"：
   触发器 + 面板（搜索框 + 候选列表）。面板用绝对定位挂在容器上，
   容器在弹窗/工具条里的宽度都是 100%，因此面板宽度跟着走。
   ------------------------------------------------------------ */
.sselect { position: relative; min-width: 0; }
.sselect-btn {
  display: flex; align-items: center; gap: 6px; width: 100%; height: 36px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--ink); cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.sselect-btn:hover { border-color: #cbd5e1; }
.sselect-btn:focus-visible, .sselect.open .sselect-btn {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(13,142,229,.13);
  outline: 0;
}
.sselect.disabled .sselect-btn, .sselect-btn:disabled {
  background: #f1f4f8; color: var(--ink-3); cursor: not-allowed;
}
.sselect-text {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px;
}
/* 占位文案（还没选）用弱化色，与"已经选中了某一项"区分开 */
.sselect-text.ph { color: #aab4c0; }
.sselect-chev { font-size: 15px; color: var(--ink-3); flex: none; transition: transform .18s; }
.sselect.open .sselect-chev { transform: rotate(180deg); }

.sselect-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); animation: pop .12s ease-out; overflow: hidden;
}
/* 下方空间不够时往上翻（在靠近屏幕底部的行上开面板会跑到可视区外） */
.sselect.drop-up .sselect-pop { top: auto; bottom: calc(100% + 4px); }
.sselect-search {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px;
  border-bottom: 1px solid var(--line-2); color: var(--ink-3);
}
.sselect-searchicon { font-size: 15px; flex: none; }
.sselect-key {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 13.5px; height: 22px; color: var(--ink);
}
.sselect-list { max-height: 232px; overflow-y: auto; padding: 4px; }
.sselect-opt {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0;
  background: transparent; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: var(--ink-2); line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sselect-opt:hover { background: var(--panel-2); color: var(--ink); }
.sselect-opt.cursor { background: var(--panel-2); }
/* 选项内侧的分组小标签（替代原生 optgroup：面板里塞不进真正的分组标题） */
.sselect-tag {
  display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 4px;
  background: var(--line-2); color: var(--ink-3); font-size: 10.5px; font-weight: 400;
  vertical-align: 1px;
}
.sselect-opt.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.sselect-none { padding: 14px 10px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.tbl th { background: var(--panel-2); color: var(--ink-2); font-weight: 600; font-size: 12.5px;
  position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); }
table.tbl tbody tr:hover td { background: var(--row-hover); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.wrap { white-space: normal; min-width: 180px; }
table.tbl td.num { font-variant-numeric: tabular-nums; }
table.tbl .col-actions { white-space: nowrap; }
.empty { padding: 44px 16px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.empty svg { font-size: 34px; color: #cfd8e3; display: block; margin: 0 auto 10px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.pager-info { font-size: 12.5px; color: var(--ink-3); }
.pager-ctrl { display: flex; align-items: center; gap: 6px; }
.pgbtn { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; }
.pgbtn:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand-dark); background: var(--brand-soft); }
.pgbtn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pgbtn:disabled { opacity: .45; cursor: not-allowed; }
.pgbtn svg { font-size: 14px; }
.pgselect { height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 0 6px;
  background: var(--panel); font-size: 12.5px; }

/* ============================================================
   标签 / 徽章
   ============================================================ */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 20px;
  font-size: 12px; line-height: 1.75; background: var(--tag-bg); color: var(--ink-2); white-space: nowrap; }
.tag.success { background: var(--ok-bg); color: var(--ok); }
.tag.danger  { background: var(--fail-bg); color: var(--fail); }
.tag.warning, .tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.info    { background: var(--info-bg); color: var(--info); }
.tag.brand   { background: var(--brand-soft); color: var(--brand-dark); }
.tag.accent  { background: var(--accent-soft); color: var(--accent-ink); }
.tag.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.tag.plain { background: transparent; color: var(--ink-3); padding: 0; }

/* 进度条（项目列表用） */
.pbar { height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-bottom: 3px; }
.pbar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px;
  transition: width .3s ease; }

.avatar-sm { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 11px; font-weight: 600;
  flex: none; vertical-align: middle; }
.ucell { display: flex; align-items: center; gap: 8px; }
.ucell-main { line-height: 1.3; }
.ucell-name { font-weight: 500; }
.ucell-sub { font-size: 11.5px; color: var(--ink-3); }

/* ============================================================
   模态框
   ============================================================ */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center;
  justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,23,35,.5); backdrop-filter: blur(2px);
  animation: fade .16s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-box { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 40px);
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slidein .18s ease-out; }
.modal-box.wide { max-width: 720px; }
.modal-box.narrow { max-width: 420px; }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
.modal-title { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-close { border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  font-size: 18px; display: flex; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--panel-2); color: var(--ink); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line-2); display: flex;
  justify-content: flex-end; gap: 9px; flex: none; }
.modal-msg { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.modal-msg strong { color: var(--ink); }

/* 详情列表 */
.detail-list { display: grid; gap: 1px; background: var(--line-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); overflow: hidden; }
.detail-row { display: grid; grid-template-columns: 132px 1fr; background: var(--panel); }
.detail-row > dt { padding: 9px 12px; background: var(--panel-2); color: var(--ink-2);
  font-size: 12.5px; margin: 0; }
.detail-row > dd { padding: 9px 12px; margin: 0; font-size: 13px; word-break: break-all; }
pre.code { margin: 0; padding: 10px 12px; background: #f7f9fc; border: 1px solid var(--line-2);
  border-radius: 7px; font-size: 12px; line-height: 1.6; overflow: auto; max-height: 260px;
  font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

/* ============================================================
   Toast
   ============================================================ */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex;
  flex-direction: column; gap: 9px; pointer-events: none; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: flex-start; gap: 9px; min-width: 220px; max-width: 380px;
  padding: 11px 13px; border-radius: var(--radius-sm); background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px;
  pointer-events: auto; animation: slidein .18s ease-out;
}
.toast.leaving { animation: fadeout .2s ease-in forwards; }
@keyframes fadeout { to { opacity: 0; transform: translateX(14px); } }
.toast svg { font-size: 17px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--ok); }
.toast.error svg { color: var(--fail); }
.toast.warning svg { color: var(--warn); }
.toast.info svg { color: var(--info); }
.toast-text { flex: 1; min-width: 0; word-break: break-word; }

/* 字典管理：左类型 / 右字典项 双栏 */
.dict-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.dict-types { max-height: 620px; overflow-y: auto; }
.dict-type-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-2);
  background: transparent; cursor: pointer; transition: background .14s;
}
.dict-type-item:hover { background: var(--panel-2); }
.dict-type-item.active { background: var(--brand-soft); }
.dict-type-item.active .dc-name { color: var(--brand-dark); font-weight: 600; }
.dc-main { flex: 1; min-width: 0; }
.dc-name { display: block; font-size: 13.5px; }
.dc-code { display: block; font-size: 11.5px; color: var(--ink-3);
  font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 900px) {
  .dict-layout { grid-template-columns: 1fr; }
  .dict-types { max-height: 260px; }
}

/* ============================================================
   加载 / 骨架 / 空状态
   ============================================================ */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: #d6dfe9; border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 40px; color: var(--ink-3); font-size: 13.5px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .icon-btn { display: inline-flex; }
  .sys-name { display: none; }
  .content { padding: 14px; }
  .login-wrap { grid-template-columns: 1fr; max-width: 460px; }
  .login-brand { padding: 26px 24px 22px; }
  .login-title { font-size: 22px; margin-top: 16px; }
  .login-feats { display: none; }
  .login-foot { padding-top: 14px; }
  .login-card { padding: 26px 24px 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .detail-row { grid-template-columns: 104px 1fr; }
  .toolbar .fitem { flex: 1 1 100%; }
  .user-info { display: none; }
  .user-btn .chev { display: none; }
  .page-title { font-size: 17px; }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal-box { max-width: none; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal-box.narrow { max-width: none; }
}

@media (max-width: 560px) {
  .stat-grid, .todo-grid { grid-template-columns: 1fr; }
  .toast-wrap { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
  .pager { justify-content: center; }
}

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .pager { display: none !important; }
  .main { margin-left: 0; }
}

/* ============================================================
   表格个性化设置（冻结列 / 列顺序 / 显隐 / 默认排序）
   ============================================================ */

/* 「表格设置」齿轮所在的一行：右对齐、位于表格上方。
   刻意**不**用绝对定位把它浮在表头右上角 —— 那会盖住最右一列（多数列表是
   「操作」），一个展示设置不该挡住"编辑/删除"。独占一行虽然多占十几像素，
   但横向滚动列表时它不会跟着滚、也不会与表头吸顶争层级。 */
.table-tools { display: flex; justify-content: flex-end; padding: 8px 12px 0; }

.iconbtn { width: 30px; height: 30px; padding: 0; flex: none; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); color: var(--ink-2);
  transition: background .12s, border-color .12s, color .12s; }
.iconbtn:hover { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-dark); }
.iconbtn.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.iconbtn:disabled { opacity: .4; cursor: not-allowed; }
.iconbtn:disabled:hover { border-color: var(--line); background: var(--panel); color: var(--ink-2); }
.iconbtn svg { font-size: 16px; }
.iconbtn.xs { width: 24px; height: 24px; border-radius: 6px; }
.iconbtn.xs svg { font-size: 13px; }

/* 雪碧图里只有 chevron-down（没有 chevron-up），「上移」复用同一个图标旋转 180°：
   为它单独加一条几乎一样的路径，不如让 CSS 说明"这是同一支箭头"。 */
.iconbtn.up svg { transform: rotate(180deg); }

/* ---- 冻结列 ----
   left 偏移由 ui.js 量出真实列宽后写在 inline style 上（见 applyFrozenOffsets），
   这里只负责把它钉住、并盖住从底下滚过去的内容。

   三层 z-index 不能合并：
     td.fz  2  冻结的数据格要盖住横向滚过来的普通单元格
     th     1  非冻结表头（既有规则）只需竖向吸顶
     th.fz  3  表头里的冻结列**同时**吸顶与吸左，必须压在所有格之上，
               否则横向滚动时它会被非冻结表头盖住一半。
   两个冻结规则都只补 z-index / 背景，不重写 position：`top: 0` 仍来自
   既有的 `table.tbl th` 规则，`left` 来自 inline style，属性级联逐条生效。 */
table.tbl td.fz { position: sticky; z-index: 2; background: var(--panel); }
table.tbl th.fz { position: sticky; z-index: 3; background: var(--panel-2); }

/* 冻结区右侧给一条内侧阴影，让"哪几列是钉住的"一眼可见。
   只在**紧邻的下一列不冻结**时出现：整张表都冻结时不该凭空多出一道分界。 */
table.tbl th.fz + th:not(.fz),
table.tbl td.fz + td:not(.fz) { box-shadow: inset 7px 0 7px -7px rgba(16, 24, 40, .28); }

/* 悬停时冻结列的底色会盖掉行高亮，这里显式补回来。
   ⚠️ 必须用 `--row-hover-fz`（**实色**），不能用 `--row-hover`：
   后者在深色主题里是 rgba(56,166,245,.10)。半透明的冻结格等于没冻结 ——
   横向滚动时下面的单元格会直接透上来（2026-10-26 实测就是这个症状）。
   顺带一提：`tbody tr:hover td`(0,2,4) 的特异性**高于** `td.fz`(0,2,2)，
   所以不显式写这一条，冻结格连 `--panel` 都保不住。 */
table.tbl tbody tr:hover td.fz { background: var(--row-hover-fz); }

/* 兜底：冻结格在任何状态下都必须是不透明实色。
   写在这里是因为"将来又加了一条带 alpha 的行底色"是必然会再发生的事，
   而症状（内容透出来）与"冻结失效"太像，排查一次要花很久。 */
table.tbl tbody td.fz { background-color: var(--panel); background-image: none; }
table.tbl tbody tr:hover td.fz { background-color: var(--row-hover-fz); }

/* ---- 设置面板 ---- */
.tset { font-size: 13.5px; }
.tset-hint { margin: 0 0 14px; color: var(--ink-3); font-size: 12.5px; line-height: 1.7; }
.tset-sec { padding: 14px 0; border-top: 1px solid var(--line-2); }
.tset-sec:first-of-type { padding-top: 0; border-top: 0; }
.tset-sec-title { margin-bottom: 9px; font-weight: 600; color: var(--ink); }
.tset-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tset-row select { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); color: var(--ink); font-size: 13px; }
.tset-row select:disabled { background: var(--panel-2); color: var(--ink-3); cursor: not-allowed; }
.tset-note { color: var(--ink-3); font-size: 12.5px; line-height: 1.7; }
.tset-note strong { color: var(--ink-2); }
.tset-warn { margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn); font-size: 12.5px; line-height: 1.6; }

.tset-cols { margin: 10px 0 0; padding: 0; list-style: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.tset-col { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--panel); border-top: 1px solid var(--line-2); }
.tset-col:first-child { border-top: 0; }
.tset-col.dragging { opacity: .45; }
.tset-col.over { background: var(--brand-soft); }
.tset-drag { display: inline-flex; flex: none; color: var(--ink-3); cursor: grab; font-size: 15px; }
.tset-check { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; cursor: pointer; }
.tset-check input { margin: 0; cursor: pointer; }
.tset-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tset-tag { flex: none; padding: 1px 8px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel-2); color: var(--ink-3); font-size: 11.5px; }
.tset-move { display: inline-flex; flex: none; gap: 4px; }

/* ---- 投放账户多选（「执行分配」弹窗里关联合同用） ---- */
.ad-cand { margin-top: 2px; max-height: 168px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.ad-opt { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: 7px 10px; border: 0; border-top: 1px solid var(--line-2);
  background: transparent; color: var(--ink); font-size: 13px; cursor: pointer; }
.ad-opt:first-child { border-top: 0; }
.ad-opt:hover { background: var(--brand-soft); }
.ad-opt-name { font-weight: 500; }
.ad-opt-sub { color: var(--ink-3); font-size: 11.5px; }
.ad-hint { display: block; padding: 9px 10px; color: var(--ink-3); font-size: 12.5px; }
.ad-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-x { padding: 0 0 0 2px; border: 0; background: transparent; color: inherit;
  font-size: 14px; line-height: 1; cursor: pointer; opacity: .65; }
.tag-x:hover { opacity: 1; }

@media (max-width: 560px) {
  /* 窄屏把说明文字换到下一行，别把下拉挤成几十像素宽 */
  .tset-row { flex-direction: column; align-items: stretch; }
  .tset-note { display: block; }
}

/* ============================================================
   管理看板（v0.13.22 按管理逻辑重排）
   ------------------------------------------------------------
   新增的都是"这一页独有"的结构件：结论条、分段标题、占比条、风险行。
   卡片 / 表格 / 标签一律沿用全局的 .stat / .tbl / .tag —— 看板是读数的地方，
   样式漂移比多几个类更伤：同一组数字在列表页和看板里长得不一样时，
   人会以为它们不是同一个数。
   ============================================================ */
.brief { display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius);
  border: 1px solid #f3ddcd; background: linear-gradient(90deg, #fff8f3, var(--panel) 62%); }
.brief-txt { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.brief-txt b { font-size: 19px; color: var(--fail); margin: 0 3px;
  font-variant-numeric: tabular-nums; }
.brief-txt .ok-num { color: var(--ok); }
.brief-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; }
.brief-chip { display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 6px 11px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2);
  background: var(--panel); border: 1px solid var(--line); border-left-width: 3px;
  transition: border-color .15s, color .15s; }
.brief-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.brief-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.brief-chip.high { border-left-color: var(--fail); }
.brief-chip.mid { border-left-color: var(--warn); }
.brief-chip.low { border-left-color: var(--brand); }

.board-sec { margin-top: 20px; }
.board-h { display: flex; align-items: baseline; gap: 9px; margin: 0 0 11px; flex-wrap: wrap; }
.board-h strong { font-size: 14px; }
.board-h .no { display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 5px; background: var(--brand); color: #fff;
  font-size: 11.5px; font-weight: 600; }
.board-h .hint { font-size: 12px; color: var(--ink-3); }
.board-h .hint-q { cursor: help; border-bottom: 1px dashed var(--line); }

.stackbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  background: var(--line-2); margin: 12px 0 9px; }
.stackbar > span { height: 100%; transition: width .3s ease; }
.stackleg { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.stackleg i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.stackleg b { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 4px; }

.board-2col { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.board-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.risk-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.risk-link { white-space: nowrap; }
.risk-desc { color: var(--ink-3); font-size: 12px; }
@media (max-width: 560px) {
  .brief { padding: 12px; }
  .brief-chips { flex: 1 1 100%; }
  .board-2col { grid-template-columns: 1fr; }
}

/* ============================================================
   v0.13.23 · 科技感与动效
   ------------------------------------------------------------
   三条纪律（改之前先读）

   1. **只加不删。** 这一整段是追加的覆盖，同权重下靠"写在最后"生效；
      没有删除或改写上方任何一条既有规则。要回滚就删掉本段，一步到位。

   2. **可读性优先于观感。** 对比度、字号、行高、间距一律不动。
      "科技感"只体现在层叠（光晕 / 网格 / 玻璃）、边界（渐变与细高光）
      与动效上，不靠缩小字号、降低对比度去换"高级感"——那种做法在
      投屏和低亮度屏上会立刻变成看不清。

   3. **动效必须能被关掉。** 所有动画都包在
      ``prefers-reduced-motion: no-preference`` 里，系统开了"减少动态效果"
      就完全静止。**不要**给本段动画补 !important，否则这条逃生通道失效。
   ============================================================ */

:root {
  --grad-brand: linear-gradient(135deg, #0d8ee5 0%, #0a6fb5 52%, #0a4c81 100%);
  --glow-brand: 0 0 0 1px rgba(13,142,229,.16), 0 10px 26px -12px rgba(13,142,229,.55);
  --grid-line: rgba(13,60,110,.05);
  --ease: cubic-bezier(.22,.61,.36,1);
  --foot-h: 0px;
}

/* ---------- 全局底：网格 + 两处冷光 ---------- */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(880px 520px at 86% -14%, rgba(13,142,229,.10), rgba(13,142,229,0) 62%),
    radial-gradient(720px 460px at -6% 106%, rgba(10,111,181,.08), rgba(10,111,181,0) 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
  background-attachment: fixed, fixed, fixed, fixed;
}

/* ---------- 侧边栏：深空渐变 + 顶部冷光 ---------- */
.sidebar {
  background:
    radial-gradient(190px 130px at 18% -8%, rgba(13,142,229,.30), rgba(13,142,229,0) 70%),
    linear-gradient(180deg, #101a27 0%, #16202d 46%, #0e1723 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.045);
}
.sidebar-head { position: relative; }
.sidebar-head::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px;
  background: linear-gradient(90deg, rgba(13,142,229,.55), rgba(13,142,229,0));
}
.snav-link { position: relative; border-radius: 8px; }
.snav-link.active {
  background: linear-gradient(90deg, rgba(13,142,229,.28), rgba(13,142,229,.04));
  box-shadow: inset 2px 0 0 #35a7f0, 0 6px 18px -14px rgba(13,142,229,.9);
  color: var(--sb-ink-hi);
}

/* ---------- 顶栏：更薄的一层玻璃 ---------- */
.topbar {
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(13,60,110,.08);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset;
}
.sys-name {
  letter-spacing: .2px;
  background: linear-gradient(92deg, var(--ink) 0%, var(--brand-dark) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- 卡片：细边界 + 抬升感（不做位移动画，避免列表页跳） ---------- */
.card {
  border-color: rgba(13,60,110,.085);
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 14px 34px -26px rgba(9,50,90,.55);
  transition: box-shadow .26s var(--ease), border-color .26s var(--ease);
}
.card:hover {
  border-color: rgba(13,142,229,.18);
  box-shadow: 0 2px 6px rgba(16,24,40,.05), 0 22px 44px -26px rgba(9,50,90,.6);
}

/* 统计卡：悬浮微抬 + 左侧色条发光；数字等宽便于纵向比对 */
.stat { transition: transform .26s var(--ease), box-shadow .26s var(--ease); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--glow-brand); }
.stat::before { box-shadow: 0 0 14px -2px currentColor; }
.stat-value { font-variant-numeric: tabular-nums; }

/* ---------- 按钮：主按钮走渐变，按下有回弹 ---------- */
.btn { transition: all .16s var(--ease); }
.btn-primary {
  background: var(--grad-brand); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -10px rgba(13,142,229,.85);
}
.btn-primary:hover {
  background: var(--grad-brand); border-color: transparent; color: #fff;
  box-shadow: 0 10px 24px -10px rgba(13,142,229,.95);
  filter: brightness(1.04);
}
.btn:active { transform: translateY(1px) scale(.995); }

/* ---------- 新组件：提示条 / 卡片右侧说明 ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px;
  border-radius: 10px; font-size: 13px; line-height: 1.75;
}
.notice > svg { flex: none; margin-top: 2px; font-size: 16px; }
.notice-info {
  background: var(--info-bg); color: var(--notice-info-ink);
  border: 1px solid rgba(13,110,253,.16);
}
.notice-warn {
  background: var(--warn-bg); color: var(--notice-warn-ink);
  border: 1px solid rgba(154,107,0,.18);
}
.card-hint { font-size: 12px; color: var(--ink-3); }

/* ---------- 页脚（版权 / 备案） ---------- */
.app-footer {
  flex: none; padding: 8px 20px 14px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-3);
}
.app-footer a { color: var(--ink-3); text-decoration: none; }
.app-footer a:hover { color: var(--brand-dark); text-decoration: underline; }
.foot-sep { opacity: .45; }

/* ============================================================
   基础设置页
   ============================================================ */
.set-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 336px; align-items: start; }
.set-card + .set-card { margin-top: 16px; }
.set-side { position: sticky; top: calc(var(--topbar-h) + 16px); }

.set-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--panel); box-shadow: var(--shadow-sm); }
.set-preview-h { display: flex; align-items: center; gap: 7px; padding: 10px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  border-bottom: 1px solid var(--line-2); background: var(--panel-2); }
.set-preview-h svg { color: var(--brand); font-size: 15px; }
.set-preview-note { margin: 9px 2px 0; font-size: 11.5px; line-height: 1.7; color: var(--ink-3); }

.pv-card { display: grid; grid-template-columns: 1fr; }
.pv-brand { padding: 16px 16px 18px; color: #fff; background: var(--grad-brand); }
.pv-title { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.pv-sub { margin-top: 4px; font-size: 11px; opacity: .88; line-height: 1.6; }
.pv-feats { list-style: none; margin: 11px 0 0; padding: 0; font-size: 10.5px; line-height: 1.85; }
.pv-feats li { display: flex; gap: 6px; align-items: flex-start; }
.pv-feats .dot { flex: none; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,.85); margin-top: 7px; }
.pv-foot { margin-top: 11px; font-size: 10px; opacity: .72; }
.pv-form { padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.pv-line { height: 9px; border-radius: 5px; background: var(--line-2); display: block; }
.pv-line.short { width: 62%; }
.pv-btn { height: 22px; border-radius: 6px; background: var(--grad-brand); opacity: .9; display: block; margin-top: 4px; }

@media (max-width: 1080px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-side { position: static; }
}

/* ============================================================
   动效（全部可关）
   ============================================================ */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

@media (prefers-reduced-motion: no-preference) {
  /* 页面级入场：只在 .content 的直接子块上做，不碰内部表格行 */
  /* ⚠️ 填充模式必须用 backwards，不能用 both。
   both 会让动画的最终帧永久生效，于是每张 .card 永远是一个层叠上下文 ——
   后果是筛选卡片里那些 z-index: 60 的下拉面板再也压不过后面那张结果卡片
   （z-index 只在同一个层叠上下文内比较），表现就是「下拉被结果区遮住」。
   backwards 只保留「开始前」的初帧（错峰淡入仍成立），结束后不残留任何效果。 */
.content > * { animation: riseIn .36s var(--ease) backwards; }
  .content > *:nth-child(2) { animation-delay: .05s; }
  .content > *:nth-child(3) { animation-delay: .10s; }
  .content > *:nth-child(4) { animation-delay: .14s; }
  .content > *:nth-child(n+5) { animation-delay: .18s; }

  /* 加载态扫光：比转圈更能说明"正在取数据" */
  .loading { position: relative; overflow: hidden; }
  .loading::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(13,142,229,.10), transparent);
    animation: shimmer 1.5s linear infinite;
  }

  /* 登录页左上角缓慢呼吸的冷光 */
  .login-wrap { animation: riseIn .5s var(--ease) both; }
}

/* 打印与"减少动态"下一律静止（这里显式兜底，防止上面被误加 !important） */
@media (prefers-reduced-motion: reduce) {
  .content > *, .login-wrap, .loading::after { animation: none !important; }
}

/* ============================================================
   v0.13.25 · 深空主题 + 光效（默认深色，可一键切回浅色）
   ------------------------------------------------------------
   需求：「整体风格可以尝试更加酷炫和科技感，符合现在主流 UI 审美」。

   为什么是"换一套变量"而不是"重写一套样式"
   ----------------------------------------
   全站 361 处颜色都走 var()，所以换主题 = 换 20 个变量 + 修 6 处硬编码白色。
   浅色主题**一行没删**：把 <html data-theme> 切回 "light" 就是原来的样子。
   这一点很重要 —— 内部系统是天天要用的工具，审美升级可以激进，
   但不能出现"改完看不清了却回不去"的局面。

   为什么默认深色
   --------------
   深色 + 冷光 + 细网格是当下工具类产品的通行做法（长时间盯屏不刺眼，
   且能把状态色/数字凸显出来）。浅色不是"降级"，而是留在顶栏一颗按钮上。

   三条纪律沿用 v0.13.23
   ---------------------
   1. 只加不删（整段可整块回滚）；
   2. 可读性优先：对比度、字号、行高、间距一律不动；
   3. 所有动画都包在 prefers-reduced-motion: no-preference 里，
      系统开了"减少动态效果"就完全静止，且 reduce 分支有 !important 兜底。
   ============================================================ */

/* ---------- 调色板 ---------- */
html[data-theme="dark"] {
  --brand: #38a6f5;
  --brand-dark: #1f8ad6;
  --brand-deep: #146ea9;
  --brand-soft: rgba(56,166,245,.14);
  --brand-line: rgba(56,166,245,.42);
  --accent: #22d3ee;
  --accent-soft: rgba(34,211,238,.12);

  --bg: #070b12;
  --panel: #0e1622;
  --panel-2: #121c2a;
  --ink: #e9eff8;
  --ink-2: #a3b2c6;
  --ink-3: #6b7d94;
  --line: #1d2938;
  --line-2: #16202d;

  /* 行悬停：半透明冷光，压在面板色上仍保持深底浅字（对比度 ≈13:1）。
     这里**必须**是半透明 —— 不透明色在深色下就成了一块浅色板。 */
  --row-hover: rgba(56,166,245,.10);
  /* 10% 的 rgb(56,166,245) 压在 --panel #0e1622 上的合成结果。
     公式 0.1*C + 0.9*panel，逐通道取整 → #122437。
     不能直接用 rgba：冻结格半透明就等于没冻结。 */
  --row-hover-fz: #122437;

  --ok: #34d399;   --ok-bg: rgba(52,211,153,.13);
  --warn: #fbbf24; --warn-bg: rgba(251,191,36,.13);
  --fail: #f87171; --fail-bg: rgba(248,113,113,.13);
  --info: #60a5fa; --info-bg: rgba(96,165,250,.13);

  /* 侧边栏比正文更深一档：靠"更黑"而不是边框来分出层次 */
  --sb-bg: #050910;
  --sb-bg-2: #0a121d;
  --sb-ink: #93a4bb;
  --sb-ink-hi: #ffffff;
  --sb-line: rgba(120,170,255,.10);

  --grid-line: rgba(120,170,255,.055);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow: 0 2px 6px rgba(0,0,0,.45), 0 18px 40px -24px rgba(0,0,0,.9);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.55), 0 40px 80px -40px rgba(0,0,0,.95);
  --glow-brand: 0 0 0 1px rgba(56,166,245,.22), 0 14px 34px -14px rgba(56,166,245,.65);
  --grad-brand: linear-gradient(135deg, #2ea6f7 0%, #1f7fd0 48%, #10527f 100%);
  color-scheme: dark;
}

/* 极光底：一层很慢的冷光漂移 + 更密的网格。
   刻意做成 22s 才走完一轮 —— 6 秒一轮会变成"屏幕在闪"。 */
html[data-theme="dark"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 560px at 82% -16%, rgba(56,166,245,.22), rgba(56,166,245,0) 62%),
    radial-gradient(760px 520px at -8% 104%, rgba(34,211,238,.16), rgba(34,211,238,0) 60%),
    radial-gradient(620px 420px at 50% 120%, rgba(120,80,255,.12), rgba(120,80,255,0) 62%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, auto, 44px 44px, 44px 44px;
  background-attachment: fixed, fixed, fixed, fixed, fixed;
}

/* 卡片：玻璃拟态 + 一圈极淡的内高光（深色下没有这层高光，卡片会糊成一片） */
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .set-card,
html[data-theme="dark"] .set-side {
  background-image: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,0) 42%);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .card:hover { border-color: rgba(56,166,245,.42); }

/* 硬编码的白色底：深色下必须逐个改回面板色，否则会一块块"发白光" */
html[data-theme="dark"] .form-grid input:not([type=checkbox]):not([type=radio]):focus,
html[data-theme="dark"] .form-grid select:focus,
html[data-theme="dark"] .form-grid textarea:focus,
html[data-theme="dark"] .sselect-btn:focus-visible,
html[data-theme="dark"] .sselect.open .sselect-btn,
html[data-theme="dark"] .field-box:focus-within { background: var(--panel-2); }

html[data-theme="dark"] .form-grid input:not([type=checkbox]):not([type=radio]):disabled,
html[data-theme="dark"] .form-grid select:disabled,
html[data-theme="dark"] .sselect.disabled .sselect-btn,
html[data-theme="dark"] .sselect-btn:disabled { background: #0b131e; }

html[data-theme="dark"] .btn-ghost-danger { background: transparent; border-color: rgba(248,113,113,.34); }

/* 顶栏与侧边栏：玻璃 + 极细分隔线 */
html[data-theme="dark"] .topbar {
  background: rgba(9,14,22,.72);
  border-bottom: 1px solid rgba(120,170,255,.10);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
html[data-theme="dark"] .sidebar {
  background:
    radial-gradient(220px 150px at 16% -10%, rgba(56,166,245,.34), rgba(56,166,245,0) 70%),
    linear-gradient(180deg, #050910 0%, #0a1220 48%, #04070d 100%);
  box-shadow: inset -1px 0 0 rgba(120,170,255,.08);
}
html[data-theme="dark"] .sys-name {
  background: linear-gradient(92deg, #eaf3ff 0%, #7fd0ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-theme="dark"] .content { color: var(--ink); }

/* 表格：深色下的斑马纹必须靠"更亮一点"而不是"更暗一点"。
   行悬停**不在这里改** —— 单元格 td 有自己的背景，改 tr 会被 td 盖住，
   这正是 v0.13.25「深色下悬停行一片白、字看不见」的成因。
   悬停统一走上面的 `--row-hover` 变量，两处（普通格 / 冻结格）同时生效。 */
html[data-theme="dark"] thead th { background: #0b131e; color: var(--ink-2); }
html[data-theme="dark"] td, html[data-theme="dark"] th { border-color: var(--line-2); }

/* ---------- 交互光效（两套主题都生效） ---------- */
.btn-primary {
  background: var(--grad-brand);
  border-color: transparent;
  box-shadow: 0 6px 18px -10px rgba(13,142,229,.9);
}
.btn-primary:hover {
  background: var(--grad-brand);
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px -12px rgba(13,142,229,1);
}
.btn-primary:active { transform: translateY(0); }

/* 数字/版本这类"要能一眼扫到"的文本用等宽，位数不会跳 */
.sf-meta span, .stat-num, .table td.num { font-variant-numeric: tabular-nums; }

/* 滚动条：细、半透明，hover 才明显 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140,160,185,.42);
  border-radius: 8px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(56,166,245,.62); background-clip: padding-box; }

/* ---------- 顶栏主题开关 ---------- */
.theme-toggle {
  width: 34px; height: 34px; flex: none; display: inline-flex;
  align-items: center; justify-content: center; margin-right: 2px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-2); border-radius: var(--radius-sm); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.theme-toggle:hover {
  color: var(--brand); border-color: var(--brand-line); transform: translateY(-1px);
}
.theme-toggle svg { width: 16px; height: 16px; }

/* ---------- 动效（可关） ---------- */
@media (prefers-reduced-motion: no-preference) {
  html[data-theme="dark"] body { animation: auroraShift 22s ease-in-out infinite alternate; }
  @keyframes auroraShift {
    from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
    to   { background-position: 60px 40px, -50px -30px, 0 -40px, 22px 22px, 22px 22px; }
  }
  /* 卡片入场：轻微上浮 + 淡入，错峰 40ms 一级，最多 6 级 */
  /* 同 §:root 那条：深色主题下也必须 backwards，否则卡片永久是层叠上下文，
     下拉面板仍会被后面的结果卡片盖住。 */
  .content > * { animation: riseIn .26s var(--ease) backwards; }
  .content > *:nth-child(2) { animation-delay: .04s; }
  .content > *:nth-child(3) { animation-delay: .08s; }
  .content > *:nth-child(4) { animation-delay: .12s; }
  .content > *:nth-child(5) { animation-delay: .16s; }
  .content > *:nth-child(n+6) { animation-delay: .2s; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] body,
  .content > *,
  .btn-primary:hover,
  .theme-toggle:hover { animation: none !important; transition: none !important; transform: none !important; }
}


/* ============================================================
   v0.13.26 · 深色可读性补漏
   ------------------------------------------------------------
   需求原话：「深色的 UI 列表高亮行显示的时候看不清文字」。

   **真正的病根不是"高亮"**，是"背景写死浅色 + 文字走 var()"这一组合：
   只要一条规则的底色是字面量浅色、颜色却取 `--ink*`，切到深色就必然
   变成浅底浅字。表格悬停只是被看见的那一处，同一类在全站还有 7 处
   （标签、提示条、快讯旧闻条、树形行、代码块、登录页）。

   处理原则：
   1. 表格悬停改走 `--row-hover` 变量（见 `:root` 与深色调色板），
      两处硬编码不可能再走偏；
   2. 其余逐条补**深色覆盖**。浅色主题一行不改 —— 内部系统天天在用，
      出问题必须能一键切回去（顶栏那颗太阳/月亮按钮）。
   ============================================================ */

/* 普通标签：原来写死 #eef1f5，深色下是"亮片 + 浅灰字"，对比度只有 1.9:1。
   **不能**用 `html[data-theme="dark"] .tag { ... }` 去覆盖 ——
   它的特异性 (0,2,1) 高于 `.tag.success` / `.tag.danger` / `.tag.plain` 的 (0,2,0)，
   一覆盖就会把所有彩色标签打成同一个灰片（`.tag.plain` 还会凭空长出底色）。
   正确做法是把**底色立成变量**（与表格行 `--row-hover` 同一套思路）。 */
html[data-theme="dark"] .tag.brand { color: #7cc6ff; }

/* 提示条 / 标签的底色与文字色见文件末尾「深色可读性补漏」一节：
   这几条统一改走变量（`--tag-bg` / `--accent-ink` / `--notice-*-ink`），
   不在这里写深色覆盖 —— 覆盖会压掉 `.tag.success` 这类变体，见那节的说明。 */

/* 快讯"非今日"提示条：整块是浅黄硬编码，深色下是一块发光黄板 */
html[data-theme="dark"] .news-stale {
  background: rgba(251,191,36,.10);
  border-color: rgba(251,191,36,.26);
  color: #fbbf24;
}

/* 组织树：悬停同样是浅色硬编码（与表格行同一个毛病） */
html[data-theme="dark"] .tree-row:hover { background: rgba(56,166,245,.10); }
html[data-theme="dark"] .tree-toggle:hover { background: rgba(56,166,245,.16); color: var(--ink); }
html[data-theme="dark"] .tree-type.F { background: rgba(148,163,184,.14); }

/* 代码块（日志详情 / 接口原始返回）：浅底 + 继承来的浅字 = 一片白 */
html[data-theme="dark"] pre.code {
  background: #0a121d;
  color: var(--ink-2);
  border-color: var(--line);
}

/* 登录页：外框是浅色渐变、卡片却是深色面板 —— 一块深色砖浮在亮底上 */
html[data-theme="dark"] .login-page {
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(56,166,245,.20), rgba(56,166,245,0) 62%),
    radial-gradient(760px 460px at 104% 106%, rgba(120,80,255,.16), rgba(120,80,255,0) 60%),
    linear-gradient(160deg, #070b12 0%, #0a1220 58%, #04070d 100%);
}
html[data-theme="dark"] .login-wrap { border: 1px solid rgba(120,170,255,.12); }

/* ============================================================
   v0.13.26 · 精致化（2026 观感）
   ------------------------------------------------------------
   需求原话：「整体风格可以更加酷炫精致，符合 2026 年网站 UI 的审美」。

   做法上刻意**不做**三件事：
   - 不缩小字号、不压低对比度去换"高级感"——投屏和低亮度屏上会立刻看不清；
   - 不加大位移/视差——列表页每翻一页都重新入场，位移会变成"页面在抖"；
   - 不用 `color-mix()` / `:has()` 这类新特性做基础配色——万一运行环境版本
     偏旧，整条规则静默失效，而失效的表现是"配色错乱"，很难查。

   只做三件事：**分层**（阴影分三档、边界用发丝线）、**材质**（卡片顶部内高光、
   弹窗玻璃）、**细节**（焦点环、选中色、按钮内高光、提示条左色条）。
   全部追加在本段，同权重靠"写在最后"生效；整段删掉即回到 v0.13.25。
   ============================================================ */

:root {
  /* 圆角升一档：11~16px 是当下工具类产品的舒适区，10px 偏"前几年的后台" */
  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 16px;

  /* 发丝线：比 --line 更淡一档，用于"容器与容器之间"的边界，
     避免整屏都是同强度的框（那是后台模板最容易显廉价的地方） */
  --hair: rgba(16,24,40,.06);
  --sheen: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,0) 40%);

  /* 阴影三档拉开：小件用 sm，卡片用中档，浮层用大档。
     原来是两档且都偏"糊"，层次感出不来。 */
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 1px rgba(16,24,40,.03);
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 20px -12px rgba(16,24,40,.18),
            0 24px 48px -34px rgba(16,24,40,.22);
  --shadow-lg: 0 2px 6px rgba(16,24,40,.06), 0 16px 32px -14px rgba(16,24,40,.16),
               0 48px 80px -40px rgba(16,24,40,.28);

  --sel: rgba(13,142,229,.22);

  /* ---- 因"浅色硬编码"而立的主题变量（v0.13.26） ----
     这些值原来直接写成字面量，切深色时变量会变、字面量不变 → 浅底浅字。
     立成变量后，主题切换只改这一处，不会再漏。 */
  --tag-bg: #eef1f5;
  --accent-ink: #085a94;
  --notice-info-ink: #0b4a8f;
  --notice-warn-ink: #6d4b00;
  /* 说明文字：原 #8a94a6 在白底只有 3.06:1、页面底 2.82:1，
     低于 WCAG AA 的 4.5:1 —— 「提示/副标题看不清」在浅色下同样成立。
     #667085 在白底 4.97、页面底 4.59、二级面板 4.80，三处都过线，
     且仍明显浅于正文（--ink-2 是 7.4:1），层级没塌。 */
  --ink-3: #667085;
}

html[data-theme="dark"] {
  --hair: rgba(120,170,255,.10);
  --sheen: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 42%);
  /* 次要文字提亮一档：#6b7d94 在 #0e1622 上只有 4.3:1，
     低于正文 4.5:1 的门槛 —— 深色主题下"说明文字看不清"多半是它。 */
  --ink-3: #7d8fa6;
  --sel: rgba(56,166,245,.30);

  /* 浅色硬编码的四个替身（深色取值） —— 半透明底 + 提亮的字 */
  --tag-bg: rgba(148,163,184,.14);
  --accent-ink: #67e8f9;
  --notice-info-ink: #a9ccf5;
  --notice-warn-ink: #f3d489;
}

/* ---------- 选中文字 ---------- */
::selection { background: var(--sel); }

/* ---------- 键盘焦点环 ----------
   鼠标点击不显示（:focus-visible），键盘 Tab 才显示。
   原来只有个别控件有焦点样式，表单里 Tab 一圈基本"看不见自己在哪"。 */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- 卡片：顶部一道内高光，边界换成发丝线 ---------- */
.card, .stat, .panel, .set-card, .set-side {
  background-image: var(--sheen);
  border-color: var(--hair);
}

/* ---------- 按钮 ---------- */
.btn { border-radius: var(--radius-sm); }
/* 主按钮顶部内高光：这是"实体按钮"与"色块"的区别所在，成本一行 */
.btn-primary {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 6px 16px -9px rgba(13,142,229,.8);
}
.btn-primary:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 10px 24px -10px rgba(13,142,229,.95);
}
.btn-ghost-danger { border-color: rgba(180,35,24,.22); }

/* ---------- 分页：当前页走品牌渐变 ---------- */
.pgbtn { border-radius: 8px; }
.pgbtn.active {
  background: var(--grad-brand);
  border-color: transparent;
  box-shadow: 0 4px 12px -6px rgba(13,142,229,.85);
}

/* ---------- 弹窗：玻璃遮罩 + 分区底色 ---------- */
.modal-mask {
  background: rgba(9,14,22,.52);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
}
.modal-box {
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.modal-head { background: var(--panel-2); }
.modal-foot { background: var(--panel-2); }
.modal-close { border-radius: 8px; }
.modal-close:hover { background: var(--line-2); }

/* ---------- Toast：左侧一道状态色条，颜色即类型 ---------- */
.toast { border-left: 3px solid var(--line); border-radius: var(--radius-sm); }
.toast.success { border-left-color: var(--ok); }
.toast.error   { border-left-color: var(--fail); }
.toast.warning { border-left-color: var(--warn); }
.toast.info    { border-left-color: var(--info); }

/* ---------- 表头：加一点字距，长表头更易扫读 ---------- */
table.tbl th { letter-spacing: .2px; }

/* ---------- 标题：字距收紧，中文标题在大字号下更"实" ---------- */
.page-title { letter-spacing: -.2px; }
.card-title { letter-spacing: -.1px; }

/* ---------- 表格行的悬停过渡 ----------
   只过渡背景色：过渡 transform 会让"扫过一行"产生拖影。 */
table.tbl tbody td { transition: background-color .13s var(--ease); }


/* ============================================================
   v0.13.43 · 合同与回款合并 / 产品级明细 / 批量导入
   ------------------------------------------------------------
   放在移动端适配段**之前**：那一段是追加覆盖层，必须最后生效。
   ============================================================ */

/* ---------- 模块页签（合同 / 回款 / 批量导入） ----------
   用分段控件而不是下边框 tab：这个页面里已经有两处 `.tabs`
   （统计分析维度、详情页签），再来一条同样的下边框，
   使用者会分不清"哪一排是切模块、哪一排是切视角"。 */
.hub-tabs {
  display: inline-flex; flex-wrap: wrap; gap: 4px;
  padding: 4px; margin: 0 0 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
.hub-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-family: inherit; cursor: pointer;
  transition: background-color .13s var(--ease), color .13s var(--ease);
}
.hub-tab svg { font-size: 16px; }
.hub-tab:hover { color: var(--ink); background: var(--line-2); }
.hub-tab.active {
  background: var(--panel); color: var(--brand-dark);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .hub-tab.active { color: var(--accent-ink); }

/* ---------- 回款的产品明细编辑器 ---------- */
.pay-items { display: flex; flex-direction: column; gap: 6px; }
.pay-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 132px 36px;
  gap: 8px; align-items: center;
}
.pay-item select, .pay-item input {
  width: 100%; min-width: 0;
  height: 34px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink);
  font-size: 13px; font-family: inherit;
}
.pay-item .pi-amt { text-align: right; font-variant-numeric: tabular-nums; }
.pay-item .pi-del { color: var(--ink-3); }
.pay-item .pi-del:hover { color: var(--fail); }
.pay-items-foot {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-top: 8px;
}
.pay-items-foot .fhelp { margin: 0; }

/* 统计维度的口径说明：用 info 底色而不是警告色 ——
   它是"这个数怎么算的"，不是"哪里出错了"。 */
.pay-note {
  display: flex; gap: 7px; align-items: flex-start;
  margin: 0 0 10px; padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: rgba(13, 142, 229, .07);
  border-left: 3px solid var(--brand);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.65;
}
.pay-note svg { flex: none; margin-top: 2px; color: var(--brand); }

/* 「按产品」统计行可点开逐笔回款（v0.13.45）。
   光标 + 右侧 `逐笔 ›` 两个信号一起给：只改光标的话，在触屏上没有 hover，
   看起来和别的行一模一样；只加文字的话，鼠标扫过时又不知道整行可点。
   hover 底色沿用表格行已有的 --row-hover，不另造颜色。 */
.pay-drill { cursor: pointer; }
.pay-drill:hover td { background: var(--row-hover); }
.pay-drill-hint { color: var(--brand); font-size: 11.5px; white-space: nowrap; }
.pay-drill:hover .pay-drill-hint { text-decoration: underline; }
@media (max-width: 560px) {
  /* 手机上表格本来就要横向滚动，再来个「逐笔 ›」只是加噪 ——
     点整行照样能打开，提示文字在这个尺寸下收掉。 */
  .pay-drill-hint { display: none; }
}

/* ---------- 批量导入页 ---------- */
.imp-desc { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.imp-cols { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.imp-col {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--tag-bg); color: var(--ink-2);
  font-size: 12.5px;
}
.imp-col.req { background: rgba(13, 142, 229, .12); color: var(--accent-ink); }
.imp-col i {
  font-style: normal; font-size: 11px;
  padding: 0 5px; border-radius: 999px;
  background: var(--brand); color: #fff;
}
.imp-tips {
  display: flex; flex-direction: column; gap: 7px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.7;
}
.imp-tips code {
  padding: 1px 5px; border-radius: 4px;
  background: var(--tag-bg); color: var(--accent-ink);
  font-size: 12px;
}

/* ============================================================
   移动端适配（v0.13.38）
   ------------------------------------------------------------
   这一整段是**追加层**，放在文件最末尾，理由：本文件前面的响应式规则
   被后面"视觉打磨"段覆盖过（.sidebar / .topbar 都重声明过），
   只有在末尾追加才能确定生效顺序，避免"改了没反应"。

   分四块：
     ① 动态视口高度（dvh）—— 地址栏收起时 100vh 会算错
     ② 安全区（safe-area）—— 刘海与 iPhone Home Indicator
     ③ 触控尺寸 —— 手机上按钮要够大
     ④ 卡片列表 + 底部导航 —— 表格在窄屏换形态
   ============================================================ */

/* ---- ① 动态视口高度 ----
   `100vh` 在移动浏览器上按**最大视口**计算（地址栏收起时的高度），
   于是页面永远比可视区高出一截：底部要么滚不到，要么被浏览器工具栏压住。
   `dvh` 跟着实际可视高度变。用 @supports 渐进增强，
   不支持的浏览器继续用原来的 100vh，不会因此变形。 */
@supports (height: 100dvh) {
  .login-page, .app, .main { min-height: 100dvh; }
  .modal-box { max-height: calc(100dvh - 40px); }
  @media (max-width: 900px) {
    .modal-box { max-height: 92dvh; }
  }
}

/* ---- ② 安全区 ----
   index.html 的 viewport 带 `viewport-fit=cover`，意思是**允许内容延伸到
   刘海/圆角区域**。既然如此就必须自己把内容顶回来，否则：
     · 顶部 .topbar 会被状态栏压住（标题看不清）；
     · 底部抽屉的最下面一排按钮正好落在 Home Indicator 上 —— 点不动，
       而且用户会以为是按钮坏了。 */
@media (max-width: 900px) {
  .topbar { padding-top: max(0px, env(safe-area-inset-top)); }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
  .sidebar-nav { overscroll-behavior: contain; }
  .modal-box { padding-bottom: env(safe-area-inset-bottom); }
  .modal-body { overscroll-behavior: contain; }
}

/* ---- ③ 触控尺寸 ----
   .icon-btn 原为 34×34，低于 iOS HIG 的 44×44。手机上"点不准"比"看起来大"
   更影响效率，所以窄屏下统一放到 42（顶栏还要留出标题空间，44 会把面包屑挤没）。 */
@media (max-width: 900px) {
  .icon-btn { min-width: 42px; min-height: 42px; justify-content: center; }
  .linkbtn { padding: 7px 4px; }
  .pgbtn { min-width: 36px; height: 36px; }
  table.tbl th, table.tbl td { padding-top: 10px; padding-bottom: 10px; }
}

/* ---- ④ 卡片列表 ----
   由 ui.js 的 paintCards() 在 ≤560px 时渲染（渲染器里判断，这里只管长相）。
   字段用「标签 / 值」两列网格：手机上纵向滚比横向拖直观得多，
   而且行动作就在卡片底部，不用把表格拖到最右。 */
.rowcards { display: flex; flex-direction: column; gap: 10px; }
.rowcard {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  padding: 12px 13px 10px;
}
.rc-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.rc-title { font-size: 14.5px; font-weight: 600; color: var(--ink);
  line-height: 1.45; word-break: break-word; }
.rc-fields { display: grid; grid-template-columns: 1fr; gap: 5px; }
.rc-extra { margin-top: 5px; }
.rc-extra[hidden] { display: none; }
.rc-field { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; min-width: 0; }
.rc-k { flex: none; color: var(--ink-3); }
.rc-v { flex: 1; min-width: 0; color: var(--ink-2); word-break: break-word; }
.rc-field.num .rc-v { font-variant-numeric: tabular-nums; }
.rc-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.rc-more { border: 0; background: transparent; color: var(--brand-dark);
  font-size: 12.5px; padding: 6px 2px; cursor: pointer; }
.rc-acts { display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: flex-end; }

/* 屏幕够宽就两列排字段（560px 断点内，容器约 530px，两列各 ~250px 读起来正好） */
@media (min-width: 480px) {
  .rc-fields { grid-template-columns: 1fr 1fr; gap: 5px 14px; }
}

/* ---- ⑤ 底部导航 ----
   侧边栏在窄屏是抽屉，但抽屉要"点汉堡 → 找菜单 → 点"，两跳。
   常用的 4 个入口放到拇指够得着的底部，抽屉留给不常用的页面。
   注意：这是**展示取舍，不是权限收缩** —— 直链仍可访问，后端权限位不变。 */
.mtabs { display: none; }
.mtabs[hidden] { display: none; }
@media (max-width: 900px) {
  .mtabs {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 38;
    /* `max-width: 100vw` 是这一块的**关键一行**（v0.13.40）。
       left/right 同时给值时，宽度由**包含块**决定；而页面一旦出现横向溢出，
       企微（X5）里这个包含块会按"整份文档的宽度"算 —— 于是 4 个 tab 被摊到
       一个比屏幕还宽的条上，最右那个直接跑到屏幕外，看起来就是"图标显示不全"。
       把上界钉死在一屏宽，无论包含块多宽，条子都不会比屏幕宽。 */
    max-width: 100vw;
    background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -3px 12px -8px rgba(16, 24, 40, .35);
  }
  .mtab {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 0 5px; font-size: 11px; line-height: 1.3;
    color: var(--ink-3); text-decoration: none;
    /* 1fr 的隐含下界是 min-content：四个 tab 各按自己的文字宽度抢地方时，
       一旦空间不够就整体溢出。给 0 让它按 1fr 均分，文字再长也只截自己。 */
    min-width: 0; overflow: hidden;
  }
  .mtab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mtab.active { color: var(--brand); }
  .mtab svg { font-size: 20px; }
  /* 卡头两段（标题 / 右侧工具组）都要能被压窄，否则长文案照样把卡片顶宽 */
  .card-head > * { min-width: 0; }
  /* 给底部导航让出空间，否则最后一行内容会被盖住 */
  .content { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ---- ⑥ 横向溢出的最后一道兜底 ----
   上面已经把工作台上两处"撑宽源"修掉了，但窄屏的排版是"任何一个长字符串都能
   把整页顶宽"的形态（新加一段文案、标题里塞个长英文单词都够）。而**页面一旦
   横向溢出，代价不只是多一条横向滚动条**：底部导航、Toast、弹窗遮罩这些
   `position: fixed` 的东西会跟着跑偏，且这种偏移在桌面浏览器上根本复现不出来。
   所以窄屏给内容区兜一层裁切。
   用 `clip` 而不是 `hidden`，两个理由：
     · `hidden` 会创建滚动容器，`.topbar` 的 sticky 就挂不住了（滚下去不吸顶）；
     · `hidden` 的滚动容器还能被横向拖动，`clip` 是真裁掉，不会"拖出一条空白"。
   `overflow-x: clip` 与 `overflow-y: visible` 可以共存，所以卡片里的下拉面板
   往下弹不会被裁。不支持 clip 的老内核直接忽略这条，行为与改动前一致。 */
@supports (overflow-x: clip) {
  @media (max-width: 900px) {
    .content { overflow-x: clip; }
  }
}

/* ============================================================
   v0.13.43 · 移动端形态层（第二批）
   ------------------------------------------------------------
   需求原文：「整个移动端的适配性要进行优化，更符合移动端的操作习惯和审美，
             可以考虑 PC 端和移动端分离（你综合评估后再定）」

   结论：**不分离代码库**，做"同一套 ESM + 移动端形态层"。理由写在
   docs/合同与回款合并-移动端适配-v0.13.43.md 里，这里只记落地点：
     · 26 个页面共享 ui.js 的表格 / 表单 / 弹窗 / 下拉渲染器，
       一处改造全部页面受益；分成两套页面集等于每个业务改动写两遍，
       而两套之间必然漂移（v0.13.41 就是因为"移动端少显示几个菜单"
       被当成权限不一致投诉过一次）。
     · 移动端真正的差异是**形态**（表格→卡片、弹窗→底部抽屉、
       多列表单→单列、操作→吸底），不是内容。形态层能覆盖 95%。
     · 只有"一天要翻几十遍"的页面（客户跟进）值得单独做手机版式，
       那用 createListPage 的 cardRender 钩子，仍然共用取数/分页/权限。

   本段只补 v0.13.38 没覆盖到的部分（底抽屉、单列表单、触控尺寸当时已做）。
   ============================================================ */

/* ---- ① 筛选栏：手机上收成一行 ----
   6 个筛选框在 390px 上会铺满整整一屏（每个都 100% 宽），
   而绝大多数时候使用者只是来看列表的。收起后：一行「筛选条件 ③」。 */
.filters-toggle { display: none; }
@media (max-width: 560px) {
  .filters-card { padding: 0; }
  .filters-toggle {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 12px 14px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--ink-2); font-size: 13.5px; font-family: inherit;
    text-align: left;
  }
  .filters-toggle svg { font-size: 16px; flex: none; }
  .filters-toggle .filters-chev { margin-left: auto; transition: transform .16s var(--ease); }
  .filters-card.open .filters-toggle .filters-chev { transform: rotate(180deg); }
  .filters-badge {
    font-style: normal; font-size: 11px; line-height: 1;
    min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; background: var(--brand); color: #fff;
  }
  .filters-badge[hidden] { display: none; }
  /* 默认收起：手机上一进页面就该看到数据，而不是一屏筛选框 */
  .filters-card .card-body { display: none; }
  .filters-card.open .card-body { display: block; }
  .filters-card .toolbar { gap: 10px; }
  .filters-card .toolbar .fitem > label { font-size: 12px; }
}

/* ---- ② 弹窗底部按钮：手机上要能一只手按到 ----
   底抽屉（≤560 已在 v0.13.38 实现）之后，最容易出事的是底部按钮：
   两个按钮挤在右下角、高度 32px，在大屏手机上正好落在拇指最难够的位置。 */
@media (max-width: 560px) {
  .modal-head { position: sticky; top: 0; z-index: 2; }
  .modal-foot {
    position: sticky; bottom: 0; z-index: 2;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .modal-foot .btn { flex: 1; min-height: 42px; justify-content: center; }
  .modal-box { max-height: 92dvh; }
  .modal-body { padding: 14px; }
  /* 弹窗里的宽表（导入报告、明细）必须有横向滚动，
     否则它会把 `.modal-box` 顶宽，整个抽屉跟着偏 */
  .modal-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---- ③ 触控尺寸：纸上按钮 32px，手指 44px ----
   iOS HIG 44×44、Material 48×48。这里取 40（列表页一屏要塞 8~10 行，
   全部 44 会让"一行一个按钮"变成"一屏四个"）。 */
@media (max-width: 560px) {
  .btn { min-height: 40px; }
  .btn-sm, .iconbtn { min-height: 38px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-desc {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ---- ④ 模块页签：手机上允许横向滚动，不换行 ----
   换行会把「批量导入」挤到第二行，而第二行在视觉上像另一组功能。 */
@media (max-width: 560px) {
  .hub-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto;
    max-width: 100%; margin-bottom: 12px;
    scrollbar-width: none;
  }
  .hub-tabs::-webkit-scrollbar { display: none; }
  .hub-tab { flex: 0 0 auto; padding: 8px 13px; }
}

/* ---- ⑤ 回款明细编辑器：金额那列在手机上太宽 ----
   132px 的金额框在 390px 屏上占掉三分之一，产品下拉就没法显示完整名称。 */
@media (max-width: 560px) {
  .pay-item { grid-template-columns: minmax(0, 1fr) 96px 34px; gap: 6px; }
  .pay-item select, .pay-item input { height: 40px; }
  .pay-item .pi-del { min-width: 34px; }
}

/* ---- ⑥ 客户跟进专用卡片（v0.13.43，参考培训材料的"我的客户"列表） ----
   信息层次固定为四行，与 PC 表格的颜色/标签体系保持一致：
     第 1 行 姓名 + 状态标签 + 意向等级
     第 2 行 电话（可点呼叫）+ 归属
     第 3 行 上次跟进（时间 + 方式 + 摘要一行）
     第 4 行 快捷动作（跟进 / 编辑）
   用固定层次而不是"把列摊成标签值"，是因为这个列表一天要翻几十遍：
   扫读靠的是**位置记忆**（姓名永远在第一行左边），不是每行都读标签。 */
.ccard { padding: 13px 14px 11px; }
.ccard:active { background: var(--panel-2); }
.cc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-name {
  font-size: 15.5px; font-weight: 650; color: var(--ink);
  line-height: 1.35; letter-spacing: -.1px;
}
.cc-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.cc-phone {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; text-decoration: none;
}
.cc-phone svg { font-size: 15px; color: var(--brand); }
.cc-sub { font-size: 12.5px; color: var(--ink-3); }
.cc-follow {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line-2);
  font-size: 12.5px; color: var(--ink-2); line-height: 1.55;
}
.cc-follow b { color: var(--ink); font-weight: 600; }
.cc-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 9px;
}
.cc-foot .btn { flex: 1; min-height: 36px; justify-content: center; font-size: 13px; }

/* ---- ⑦ 客户跟进的悬浮新增按钮 ----
   培训材料里每一屏列表右下角都有一个橙色的「+」。
   这里用右下角悬浮而不是放到顶部工具栏：单手握住手机时，拇指能到的
   最高点是屏幕中线偏下，而"新增"是这个页面最频繁的动作。 */
.fab {
  position: fixed; right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom) + 14px);
  z-index: 39;
  width: 52px; height: 52px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  background: var(--grad-brand, var(--brand)); color: #fff;
  box-shadow: 0 8px 20px -6px rgba(13, 142, 229, .65);
}
.fab svg { font-size: 24px; stroke-width: 2.2; }
.fab:active { transform: scale(.96); }
@media (max-width: 560px) {
  .fab { display: flex; }
}
/* 弹窗打开时把 FAB 藏起来：它固定定位、层级又高，
   会浮在遮罩上面，看起来像一个点不动的按钮。 */
body:has(.modal-root:not([hidden])) .fab { display: none; }

/* ---- ⑧ 移动端跟进时间线 ----
   培训材料的详情页是"圆点 + 竖线 + 内容卡"，比表格更适合读时间顺序。 */
.tl { position: relative; padding-left: 20px; }
.tl::before {
  content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 1px; background: var(--line);
}
.tl-item { position: relative; padding: 0 0 14px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--brand);
}
.tl-item.muted::before { border-color: var(--line); }
.tl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-when { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-body { font-size: 13px; color: var(--ink-2); line-height: 1.65; margin-top: 3px;
  white-space: pre-wrap; word-break: break-word; }
/* 时间线右上角的「修改 / 删除」。用 margin-left:auto 顶到最右，
   是因为 `.tl-head` 是 flex；表格形态里它是行内元素，auto 不生效也不影响。 */
.cc-act { margin-left: auto; display: inline-flex; gap: 10px; }
@media (max-width: 560px) {
  /* 手指点 12px 的字很容易点到旁边那个按钮上（修改 vs 删除挨着），
     所以文本按钮在手机上把可点区域撑到 32px 高。 */
  .cc-act .linkbtn { min-height: 32px; padding: 5px 8px; font-size: 12.5px; }
  .cc-act { gap: 4px; }
  .tl-item { padding-bottom: 16px; }
}

/* ---- ⑨ 标签式单选（跟进方式 / 意向等级） ----
   培训材料里这两项都是"一排标签点一下"，理由是它们取值只有三四个、
   而选错跟进方式是这个模块最常返工的一件事（材料原文用红字标了
   「跟进方式要正确选择」）。下拉要多点一次才能看见选项，
   标签是一眼全见 —— 选错的概率因此低一截。 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-2); font-size: 13px; font-family: inherit;
  line-height: 1.3; transition: all .13s var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.active {
  background: rgba(13, 142, 229, .12);
  border-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 600;
}
.chip:disabled { opacity: .55; cursor: not-allowed; }
html[data-theme="dark"] .chip.active { color: var(--accent-ink); }
@media (max-width: 560px) {
  .chip { padding: 9px 16px; min-height: 38px; }
}

/* ---- ⑨-b 等宽类 `.mono`（补齐，v0.13.44） ----
   全站 66 处 `<span class="mono">` 一直在用，但 app.css 里只有 `.tag.mono`，
   裸 `.mono` 从来没有规则 —— 于是 userid、版本号、时间戳、幂等键这些
   "必须按字符比对"的文本一直按比例字体渲染（1 和 l、0 和 O 看着一样）。
   这里只补字体族，不动字号/颜色：字号由各处内联或父级决定，
   全局改字号会连带把已有表格的行高顶开。 */
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---- ⑩ 消息正文（消息提醒排障台） ----
   企微消息是纯文本，`\n` 换行。这里必须 pre-wrap 而不是 pre：
   pre 会把一行长文本顶出弹窗外（不折行），而提醒正文里最长的一行
   是「客户名 + 项目 + 逾期天数」，窄屏下一定超宽。
   max-height 给个上限：正文最多 5 条客户，超出滚动而不是把弹窗拉满屏。 */
.msg-pre {
  margin: 0; padding: 12px 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.7; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  max-height: 46vh; overflow: auto;
}
@media (max-width: 560px) {
  .msg-pre { font-size: 12.5px; padding: 10px 12px; max-height: 52vh; }
}
