:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --border: #e6e8f0;
  --text: #1f2330;
  --muted: #5f6679;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --prio-high: #c62b21;
  --prio-normal: #8a5a12;
  --prio-low: #157a4a;
  --danger: #c62b21;
  --shadow: 0 1px 3px rgba(20, 24, 40, .06), 0 6px 18px rgba(20, 24, 40, .06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }
a { color: var(--primary); }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 按钮 ---------- */
.primary { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 600; transition: background .15s; }
.primary:hover { background: var(--primary-d); }
.primary.block { width: 100%; padding: 12px; }
.ghost { background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; color: var(--text); }
.ghost:hover { background: #f0f1f8; }
.ghost.block { width: 100%; }
.link { background: none; border: none; color: var(--primary); padding: 4px 8px; font-size: 13px; }
.link.danger { color: var(--danger); }
.sm { padding: 6px 12px; font-size: 13px; }
.chip-btn { background: #eef0fb; border: none; color: var(--primary-d); border-radius: 20px; padding: 6px 12px; font-size: 13px; }
.chip-btn:hover { background: #e2e5f7; }

/* ---------- 登录页 ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #5b54e6, #7c3aed); padding: 20px; }
.login-card { background: var(--surface); width: 100%; max-width: 360px; border-radius: 18px; padding: 36px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 22px; }
.login-card label { display: flex; flex-direction: column; text-align: left; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.login-err { color: var(--danger); font-size: 13px; margin: 0; }
.login-card label:focus-within { color: var(--primary); }
/* r62：掉登录诊断面板（仅在有 401/探针现场时出现，登录成功即清除） */
.login-page { flex-wrap: wrap; gap: 16px; }
.login-diag { width: 100%; max-width: 560px; background: var(--surface); border-radius: 14px; padding: 16px 18px; box-shadow: 0 16px 48px rgba(0,0,0,.22); text-align: left; font-size: 12px; color: var(--text); }
.login-diag-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.login-diag-item { border-top: 1px dashed var(--border); padding: 8px 0; }
.login-diag-item:first-of-type { border-top: none; }
.login-diag-line { margin: 2px 0; word-break: break-all; }
.login-diag-line.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); }
.login-diag-body { color: var(--danger); font-weight: 600; }
.login-diag-foot { margin-top: 8px; font-size: 11px; }
.login-diag .ghost.small { padding: 4px 10px; font-size: 12px; }
/* r66：登录失败条目单独描红区分——面板混排时它才是病因，其余多为连带结果 */
.login-diag-item.is-login-fail { border-left: 3px solid var(--danger); padding-left: 8px; background: rgba(255, 82, 82, .06); border-radius: 0 6px 6px 0; }
.login-diag-line.warn { color: var(--danger); font-weight: 600; word-break: break-word; }

/* ---------- 应用框架 ---------- */
#app { height: 100vh; }
.app-shell, body > #app { display: flex; }
.sidebar { width: 230px; background: #1e2030; color: #c9ccdb; display: flex; flex-direction: column; padding: 18px 12px; flex-shrink: 0; transition: width .18s ease; }
/* 折叠态：仅留图标条 */
.sidebar.collapsed { width: 64px; padding-left: 8px; padding-right: 8px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand .ver,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-line,
.sidebar.collapsed .side-foot .ghost { display: none; }
.sidebar.collapsed .brand { justify-content: center; padding: 6px 0 18px; gap: 0; }
.sidebar.collapsed .brand .logo { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; }
.sidebar.collapsed .side-foot { display: flex; justify-content: center; }
.side-collapse { background: transparent; border: none; color: #8a8fa6; font-size: 15px; cursor: pointer; padding: 4px 6px; border-radius: 8px; line-height: 1; }
.side-collapse:hover { background: rgba(255,255,255,.08); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; padding: 6px 8px 18px; min-width: 0; }
.brand .logo { font-size: 26px; flex: none; }
.brand .logo svg { width: 26px; height: 26px; }
/* 版本号放在「提醒平台」文字正下方（竖排两行） */
.brand-col { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 700; color: #fff; white-space: nowrap; flex: none; }
.brand .ver { margin-left: 0; align-self: flex-start; font-size: 11px; font-weight: 600; color: #c8d4f0; background: rgba(255,255,255,.12); padding: 2px 8px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.brand .side-collapse { flex: none; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; background: transparent; border: none; color: #c9ccdb; padding: 11px 12px; border-radius: 10px; font-size: 14px; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.side-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.user-line { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 10px; }
.user-line small { color: #8a8fa6; }
.side-foot .ghost { color: #c9ccdb; border-color: rgba(255,255,255,.15); }
.side-foot .ghost:hover { background: rgba(255,255,255,.07); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 18px; flex: 1; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--text); }
.top-actions { display: flex; gap: 8px; }
.top-actions .ghost.on { background: #e8f7ef; border-color: #b6e6cd; }
/* r170：position:relative 收编本容器内 absolute 后代（如设置页「个人设置」面板里的 .sr-only
   视觉隐藏 label）的包含块，使其受 overflow-y:auto 裁剪。若不设，这些 absolute 元素以视口为
   包含块、随内容流落到页面底部，把 <html> 撑高（实测 760→1536px），从而在「个人设置」tab
   多出一条文档级滚动条；集成与同步 / 排班与核查 / 系统日志三个 tab 无此类元素故正常。 */
.view { padding: 24px; overflow-y: auto; flex: 1; position: relative; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h2 { font-size: 16px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* ---------- 仪表盘 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--primary); }
.stat-card b { font-size: 28px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.c-pending { border-left-color: #6366f1; }
.c-today { border-left-color: #0ea5e9; }
.c-overdue { border-left-color: var(--prio-high); }
.c-done { border-left-color: var(--prio-low); }
.c-canceled { border-left-color: #9ca3af; }
.c-total { border-left-color: #8b5cf6; }
/* r122：工单卡（CRM 同步的系统池）—— 与「我的待提醒」并列，用色区分开 */
.c-ticket { border-left-color: #f59e0b; }
/* 卡片可作链接（工单卡 → 收件箱）：保持统计卡的观感，不要被浏览器默认链接样式破坏 */
a.stat-card { text-decoration: none; color: inherit; }
a.stat-card:hover { border-color: var(--primary); }
.dash-note { margin: -8px 0 18px; font-size: 13px; }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 60%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; background: #f1f2f9; border-radius: 6px; overflow: hidden; }
.bar { width: 100%; }
.bar.done { background: var(--prio-low); }
.bar.pending { background: #6366f1; }
.bar-val { font-size: 12px; font-weight: 600; }
.bar-date { font-size: 11px; color: var(--muted); }
.chart-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.dot.done { background: var(--prio-low); } .dot.pending { background: #6366f1; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select, .filter, .search, .sort {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; width: 100%;
}
.field textarea { resize: vertical; }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }
details.channels, details.wb { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; }
details.channels summary, details.wb summary { cursor: pointer; color: var(--muted); font-size: 13px; }
/* r148：新建提醒改为原生 <details> 默认收起。summary 替代原 h2 当标题，
   折叠时不留 14px 底距（否则收起态卡片空一截），展开后才把表单推开。
   ::before 的 +/− 是纯装饰，语义由原生 details 的 open 状态承担（自带 aria-expanded）。 */
details.composer > summary.composer-summary {
  list-style: none; cursor: pointer; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; min-height: 44px;
}
details.composer > summary.composer-summary::-webkit-details-marker { display: none; }
details.composer > summary.composer-summary::before {
  content: '+'; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: none; border-radius: 7px;
  background: var(--primary); color: #fff; font-size: 17px; font-weight: 700; line-height: 1;
}
details.composer[open] > summary.composer-summary::before { content: '\2212'; }
details.composer[open] > summary.composer-summary { margin-bottom: 14px; }
details.composer > summary.composer-summary:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.chip { background: #eef0fb; border: 1px solid transparent; border-radius: 20px; padding: 6px 14px; font-size: 13px; color: var(--primary-d); }
.chip[aria-checked="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip:disabled { opacity: .55; cursor: not-allowed; }
/* r147 / B1：通知范围提示（人数预估 + 无班次部门提示）。
   [hidden] 显式兜底：[hidden] 是浏览器默认行为，但 flex/grid 祖先可能覆盖 display，写死更稳。 */
.scope-hint { padding: 0 0 8px; line-height: 1.6; font-size: 12px; }
.scope-hint[hidden] { display: none; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- 列表 / 提醒项 ---------- */
.list-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.list-head h2 { font-size: 16px; }
.list-tools { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.list-tools .filter, .list-tools .sort { width: auto; flex: 0 0 auto; }
.list-tools .search { flex: 1; min-width: 160px; }
.stats { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.stat { font-size: 13px; color: var(--muted); }
.stat b { color: var(--text); font-size: 15px; margin-right: 3px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: flex-start; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.item.overdue { border-color: #f3c0c0; }
.item.done { opacity: .65; }
.check { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 16px; flex-shrink: 0; color: var(--muted); }
.check:hover { border-color: var(--prio-low); color: var(--prio-low); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; word-break: break-word; }
.item .note { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-word; }
.wb-link { display: inline-block; margin-top: 6px; font-size: 13px; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge { font-size: 12px; background: #f1f2f9; color: var(--muted); padding: 3px 9px; border-radius: 20px; }
.badge.prio[data-prio="high"] { background: #fdeaea; color: var(--prio-high); }
.badge.prio[data-prio="normal"] { background: #fdf6e3; color: #8a5a12; }
.badge.prio[data-prio="low"] { background: #e8f7ef; color: var(--prio-low); }
.badge.done { background: #e8f7ef; color: var(--prio-low); }
/* r148：确认人 / 确认时间（与「已处理」区分开，别让人误以为是两个状态） */
.badge.acked { background: #f3eafd; color: #7c3aed; }
.badge.pending { background: #eef0fb; color: var(--primary-d); }
.badge.overdue { background: #fdeaea; color: var(--prio-high); }
/* r184：零送达未送达标记——比普通 overdue 更醒目，加粗边框，避免被误读为已处理 */
.badge.undelivered { background: #fdeaea; color: #b3261e; font-weight: 600; border: 1px solid #e6a19c; }
.badge.canceled { background: #f1f2f9; color: var(--muted); }
.badge.ok  { background: #dcfce7; color: #166534; }
.badge.off { background: #fee2e2; color: #991b1b; }
/* v15 接收时段：静默中（黄）与不限（灰）。ok/off 复用上面两条，语义对得上 */
.badge.warn   { background: #fef3c7; color: #92400e; }
.badge.muted  { background: #f1f2f9; color: var(--muted); }

/* v15 用户管理页「接收时段」列：下拉 + 内联勾选 */
.shift-cell { white-space: nowrap; }
.shift-cell .shift-sel { min-width: 110px; padding: 4px 6px; font-size: 13px; }
/* 2026-10-24 问题1：跟随轮转时的「起点」下拉，与班次下拉并排显示 */
.shift-cell .rot-phase { min-width: 130px; padding: 4px 6px; font-size: 13px; margin-left: 6px; }
.chk-inline {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 8px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.chk-inline input { margin: 0; }

/* 单独授权弹窗里的「高风险权限点」标记（r53 / N3）
 * config.integration.edit 能读到渠道密钥，与其它候选点性质不同：
 * 不是加个星号就够，得让人一眼看出「勾了这个等于把密钥交出去」。 */
.chk-inline.chk-risk { align-items: flex-start; }
.perm-risk {
  margin-top: 4px; padding: 5px 8px; border-radius: 6px;
  background: rgba(220, 38, 38, .08); border-left: 3px solid #dc2626;
  color: #b91c1c; font-size: 12px; line-height: 1.55;
}
.item menu { display: flex; gap: 4px; margin: 0; padding: 0; flex-shrink: 0; }
.icon-btn { background: #f6f7fb; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; font-size: 15px; }
.icon-btn:hover { background: #eceef7; }
.icon-btn.danger:hover { background: #fdeaea; border-color: #f3c0c0; }
.empty { text-align: center; padding: 40px 0; color: var(--muted); }
.empty span { font-size: 40px; display: block; margin-bottom: 8px; }
.empty-inline { list-style: none; color: var(--muted); text-align: center; padding: 20px; }
.placeholder { padding: 40px; text-align: center; color: var(--muted); }
.placeholder.err { color: var(--danger); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 600; background: #fafbff; }
.data-table tbody tr:hover { background: #fafbff; }
.rec-title { white-space: normal; max-width: 320px; min-width: 160px; font-weight: 500;
  word-break: break-word; overflow-wrap: anywhere; }
/* 修复标题文字重叠：记录表内容列禁止压缩到内容以下，且换行时保持正常行高 */
/* 记录标题换行：.data-table td 的 white-space:nowrap 特异性 (0,1,1) 高于单类 .rec-title (0,1,0)，
   必须用 .rec-table td.rec-title (0,2,1) 才能真正覆盖，否则长标题不换行、压进「触发时间」列 */
.rec-table td.rec-title { white-space: normal; line-height: 1.5; }
/* 触发时间列跟随标题换行收紧：日期分组行内也保持统一 */
.rec-table td.rec-time { white-space: nowrap; }
/* ⚠️ anywhere 会让「最小内容宽度」变成 1 个字符：表格自动布局时，
   「投递」这类允许换行的列会被不换行列挤压成一字一行竖排（2026.10.16 修复）。
   改用 break-word（只在真正放不下时才断），并用 min-width 保住关键列。 */
.rec-table td, .rec-table th { overflow-wrap: break-word; }
/* 徽标是一个语义单元（成功/部分失败/已提醒…），永远不内部断行 */
.rec-table .badge, .rec-table .act-item { white-space: nowrap; }

/* 记录页：序号列 + 日期分组行（需求5） */
.rec-table td.col-idx, .rec-table th.col-idx { text-align: center; width: 52px; color: var(--muted); }
tr.rec-date-row td {
  background: #f4f6fd; font-weight: 600; color: var(--primary-d);
  padding: 7px 12px; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.rec-date-row .rec-date-count { margin-left: 10px; font-weight: 400; font-size: 12px; color: var(--muted); }
/* 「待提醒」页签 = 跳转链接（需求3）：去掉按钮态配色，呈链接语义 */
.rf.rf-jump { background: #fff; border: 1px dashed var(--primary); color: var(--primary); text-decoration: none; display: inline-block; }
.rf.rf-jump:hover { background: #eef0fb; }
.rec-count { font-size: 12px; margin-left: auto; margin-right: 12px; }
/* 「显示更多」区（提醒记录默认 25 条）：居中、与表格留一点间距 */
.rec-more { text-align: center; padding: 10px 0 2px; font-size: 12px; color: var(--muted); }

/* 设置页顶部选项卡（r70：设置配置按类型分成 Tab） */
.set-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.set-tab { background: #eef0fb; border: none; border-radius: 20px; padding: 7px 16px;
  font-size: 13px; color: var(--primary-d, #4338ca); cursor: pointer; white-space: nowrap; }
.set-tab.active { background: var(--primary, #4f46e5); color: #fff; }
.set-panel[hidden] { display: none; }   /* 显式兜底，防其它 display 规则覆盖 hidden */

/* r150：设置页「系统日志」二级子 tab（配置变更 / 权限记录 / CRM 同步 / 运行自检） */
.set-subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border, #e5e7eb); }
.set-subtab { background: transparent; border: 1px solid var(--border, #e5e7eb);
  border-radius: 18px; padding: 8px 14px; min-height: 40px; font-size: 13px;
  color: var(--muted, #6b7280); cursor: pointer; white-space: nowrap; }
.set-subtab:hover { border-color: var(--primary, #4f46e5); color: var(--primary, #4f46e5); }
.set-subtab.active { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: #fff; }
/* 键盘可达：主 / 子 tab 都给可见焦点态（不改变默认视觉） */
.set-tab:focus-visible, .set-subtab:focus-visible { outline: 2px solid var(--primary, #4f46e5); outline-offset: 2px; }
.set-subpanel[hidden] { display: none; }   /* 与主面板同口径，防其它 display 规则覆盖 hidden */
/* 配置变更：diff 用等宽小字，长文本在单元格内折行，不撑破表格 */
.data-table .ca-diff { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; color: var(--text); max-width: 340px;
  white-space: normal; word-break: break-word; }

/* 用户筛选下拉（记录页）：第一行全选，下面复选框+用户名 */
.uf-drop { position: relative; display: inline-block; }
.uf-drop-btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface, #fff); font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.uf-drop-btn:hover { border-color: var(--primary); }
.uf-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 180px;
  max-height: 260px; overflow: auto; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow, 0 6px 18px rgba(0,0,0,.08)); padding: 6px; }
.uf-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px;
  font-size: 13px; cursor: pointer; white-space: nowrap; user-select: none; }
.uf-row:hover { background: #f0f2fd; }
.uf-row.uf-all { font-weight: 600; border-bottom: 1px solid var(--border); border-radius: 0;
  margin-bottom: 4px; padding-bottom: 8px; }
.uf-row input[type="checkbox"] { accent-color: var(--primary, #4f46e5); flex: none; }
.rec-time { white-space: nowrap; }
/* 操作时间列：多次操作分行列出（先「稍后」再「知道了」→ 两行），不折行挤压相邻列 */
.rec-table td.rec-act { white-space: nowrap; line-height: 1.7; font-size: 12px; }
.rec-table td.rec-act .act-item { display: inline-block; padding: 0 6px; border-radius: 6px;
  background: #f0f2fd; color: var(--muted); border: 1px solid transparent; }
.rec-table td.rec-act .act-ack,
.rec-table td.rec-act .act-done { background: #e8f6ee; color: #1e7a45; }
.rec-table td.rec-act .act-snooze { background: #fdf3e3; color: #8a5a12; }
.rec-table td.rec-act .act-optout { background: #f2f3f7; color: #5f6679; }
/* 投递列：徽标 + 失败原因。min-width 防止被其它列挤成竖排；
   失败原因独占一行更易读（徽标在第一行，小字说明在第二行）。 */
.rec-table td.rec-push { white-space: normal; min-width: 120px; max-width: 300px; }
.rec-table .push-why { display: block; margin: 4px 0 0; font-size: 11px;
  color: #b3564d; line-height: 1.5; max-width: 260px;
  overflow-wrap: break-word; }
/* r183：当前状态列 —— 徽标 + 点开原地展开的账本浮层。
   用原生 details/summary，浮层绝对定位不撑表格行高；z-index 高于相邻单元格。 */
.rec-table td.rec-current-cell { position: relative; min-width: 150px; max-width: 260px; white-space: normal; }
.cur-details { position: relative; display: inline-block; }
.cur-sum { list-style: none; cursor: pointer; white-space: nowrap; }
.cur-sum::-webkit-details-marker { display: none; }
.cur-sum .badge { cursor: pointer; }
.cur-caret { margin-left: 3px; font-size: 10px; color: var(--muted); }
.cur-details[open] .cur-caret { display: inline-block; transform: rotate(180deg); }
.cur-body {
  position: absolute; right: 0; top: 100%; z-index: 20;
  min-width: 240px; max-width: 320px; padding: 8px 10px; margin-top: 4px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e3e6ee);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(20,28,50,.16);
  font-size: 12px; line-height: 1.6;
}
.cur-person { display: flex; gap: 8px; padding: 2px 0; border-bottom: 1px dashed var(--border, #eee); }
.cur-person:last-child { border-bottom: none; }
.cur-name { flex: 0 0 auto; min-width: 44px; font-weight: 600; }
.cur-chans { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cur-ch { white-space: nowrap; }
.cur-ch.done { color: #1e7a45; }
.cur-ch.overdue { color: #b3564d; }
.cur-ch.snoozed { color: #8a5a12; }
.cur-ch.canceled { color: #5f6679; }
.cur-ch.muted { color: var(--muted); }
.cur-empty { color: var(--muted); }
.badge.running { background: #e7f0ff; color: #1d4ed8; }
/* 提醒记录：内容列换行 + 表格自适应，避免与触发时间列重叠 */
.rec-table { table-layout: auto; }
.rec-table th, .rec-table td { vertical-align: top; }
/* 自适应：给表格一个合理下限，窄屏时在 .table-wrap 里横向滚动，
   而不是把允许换行的列压成一字一行（min-width 同时锁住自动布局的分配）。
   r183：新增「当前状态」列，下限 920 → 1020。 */
.rec-table { min-width: 1020px; }

/* 窄屏自适应：收窄内边距与字号，尽量在滚动前多显示内容 */
@media (max-width: 1000px) {
  .rec-table th, .rec-table td { padding: 8px 8px; }
  .rec-table { font-size: 12.5px; }
  .rec-title { max-width: 220px; }
}
@media (max-width: 640px) {
  .rec-table th, .rec-table td { padding: 6px 6px; }
  .rec-table { font-size: 12px; min-width: 840px; }
  .rec-title { max-width: 150px; }
  /* 小屏隐藏序号列（信息价值最低），日期分组行保留 */
  .rec-table td.col-idx, .rec-table th.col-idx { display: none; }
}
/* 「操作」列前置并吸附在左侧，任何分辨率下都不用横向滚动即可点到 */
.rec-table .col-op { position: sticky; left: 0; z-index: 2; width: 56px; text-align: center; background: var(--surface, #fff); }
.rec-table thead .col-op { background: #fafbff; z-index: 3; }
.rec-table tbody tr:hover .col-op { background: #fafbff; }
/* 提醒记录工具条：排序 / 优先级 / 状态筛选 */
.rec-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 12px; }
.rec-toolbar .rt-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.rec-toolbar select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text); background: var(--surface, #fff); }
.rec-toolbar #rec-count { margin-left: auto; font-size: 12px; }

/* ===== 条件核查 · 矩阵式编辑器（行=条件名称，列组=比对项目|条件|内容） ===== */
/* r173/B：矩阵在自身框内滚动（封顶高度），横向滚动条紧贴框底、不再随行数增多沉到页底；
   配合下方 sticky 表头，纵向滚动时始终看得见列名。弹窗 body 只承担少量外壳滚动。 */
.cl-grid-wrap { overflow: auto; max-height: min(52vh, 440px); border: 1px solid var(--border); border-radius: 10px; }
/* r175：表头两行都吸顶——第二行的 top 引用 --cl-head-h，不再硬编码 29px。
   --cl-head-h 由 audit.js draw() 在矩阵重建后用 JS 实测第一行表头真实高度写入，
   因此字体/内边距/列删除按钮变化导致第一行高度改变时，第二行自动贴合、两行始终严丝合缝。
   默认值 29px 仅作 JS 未运行时的兜底。背景不透明以遮住下方滚动内容。 */
.cl-grid { --cl-head-h: 29px; }
.cl-grid thead tr:nth-child(1) th { position: sticky; top: 0; z-index: 4; }
.cl-grid thead tr:nth-child(2) th { position: sticky; top: var(--cl-head-h); z-index: 3; box-shadow: 0 1px 0 var(--border); }
.cl-grid { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.cl-grid th, .cl-grid td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; vertical-align: middle; }
/* 第一行表头：条件一/二/三…（跨三列，居中，带分组底色）+ 列删除按钮 */
.cl-grid thead .cl-colhead { background: #eef0fb; font-weight: 600; text-align: center; color: var(--text); white-space: nowrap; }
.cl-grid thead .cl-colhead-t { margin-right: 4px; }
.cl-grid .cl-cdel {
  border: none; background: transparent; color: #b3564d; cursor: pointer;
  font-size: 11px; padding: 1px 4px; border-radius: 5px; line-height: 1;
}
.cl-grid .cl-cdel:hover { background: #fdeceb; }
/* 第二行表头：比对项目 / 条件 / 内容 */
.cl-grid thead .cl-subhead { background: #f6f7fb; font-weight: 600; font-size: 12px; color: var(--muted, #667); white-space: nowrap; }
/* 列宽：table-layout:fixed 下必须用 <colgroup> 指定；min-width 在 fixed 布局里不生效。
   行头固定窄列；「比对项目」「条件」收敛；「内容」给足宽度承载候选值标签 + 手输框。 */
.cl-grid col.c-rowhead { width: 116px; }
.cl-grid col.c-field    { width: 152px; }
.cl-grid col.c-op       { width: 104px; }
.cl-grid col.c-val      { width: 224px; }
.cl-grid col.c-opcol    { width: 34px; }
/* 弹窗内的矩阵要给足横向空间，否则多列时会被压扁 */
#rule-params .cl-grid-wrap { width: 100%; }
.cl-grid .cl-rowhead { background: #fafbff; font-weight: 600; }
.cl-grid thead .cl-rowhead { background: #f6f7fb; font-size: 12px; color: var(--muted, #667); }
.cl-grid .cl-opcol { background: #fafbff; text-align: center; }
.cl-grid .cl-rowname { width: 100%; font-weight: 600; }
.cl-grid select, .cl-grid input {
  border: 1px solid transparent; background: transparent; color: var(--text);
  font-size: 13px; padding: 3px 4px; border-radius: 6px; width: 100%; box-sizing: border-box;
}
.cl-grid select:hover, .cl-grid input:hover { border-color: var(--border); }
.cl-grid select:focus, .cl-grid input:focus { border-color: var(--primary, #4f46e5); background: var(--surface, #fff); outline: none; }
.cl-grid select { cursor: pointer; appearance: auto; }
.cl-grid input[type="checkbox"] { width: auto; cursor: pointer; }
.cl-grid .cl-cell { min-width: 96px; }
.cl-grid tbody tr:hover td { background: rgba(79, 70, 229, .035); }
.cl-grid tbody tr:hover .cl-rowhead { background: #f0f2fd; }
.cl-grid .cl-rdel { border: none; background: transparent; color: #b3564d; cursor: pointer; font-size: 13px; padding: 2px 4px; }
.cl-grid .cl-rdel:hover { background: #fdeceb; border-radius: 6px; }
.cl-grid .g-up-wrap { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted, #667); white-space: nowrap; margin-top: 2px; }
/* r149 P3：行间组合下拉（条件设置 tab 顶部）—— 或=任一行命中即合规；且=所有行都需命中 */
.cl-logic-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.cl-logic-bar .cl-rowlogic-global { padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface, #fff); color: var(--text); }
/* r149 P3：行内组合下拉（行头，≥2 个条件时才出现）—— 且=全部满足；或=任一满足即命中该行 */
.cl-grid .cl-rowlogic { width: 100%; margin-top: 4px; font-size: 12px; padding: 2px 4px; }
/* r149 P3：规则编辑弹窗的 tab 面板（基础设置 / 条件设置），hidden 兜底防被 flex 规则覆盖 */
.rule-pane[hidden] { display: none; }
.cl-grid .g-prefix, .cl-grid .g-val, .cl-grid .g-kw { min-width: 0; }
/* 选择类字段：候选值标签（点选即加入/移出）+ 自由输入框 */
.cl-grid .g-picker { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cl-grid .g-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.cl-grid .g-chip {
  border: 1px solid var(--border); background: var(--surface, #fff); color: var(--muted, #556);
  font-size: 11px; line-height: 1.5; padding: 1px 7px; border-radius: 999px; cursor: pointer;
  white-space: nowrap; transition: all .12s;
}
.cl-grid .g-chip:hover { border-color: var(--primary, #4f46e5); color: var(--primary, #4f46e5); }
.cl-grid .g-chip.on { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: #fff; }
.cl-grid .g-chip.free { border-style: dashed; }
.cl-grid .g-chip.free.on { border-style: solid; }
/* r50：实测新值（线上真实出现、人工候选清单里没有的）——用暖色底提示「这是现场数据带来的」，
   与「脏数据残留」区分开：前者应该被采纳，后者应该被清掉。 */
.cl-grid .g-chip.fresh { border-color: #d97706; background: #fffbeb; color: #92400e; }
.cl-grid .g-chip.fresh.on { background: #d97706; border-color: #d97706; color: #fff; }
.cl-grid .g-val-free { font-size: 12px; }
/* 表头内嵌排序下拉：不换行、字号收小，避免撑高表头 */
.rec-table th.th-sort { white-space: nowrap; }
.rec-table th .th-select {
  display: inline-block; margin-left: 6px; padding: 2px 4px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-weight: 400; color: var(--text);
  background: var(--surface, #fff); max-width: 190px; vertical-align: 1px; cursor: pointer;
}
/* 新增状态徽章配色 */
.badge.notified { background: #e8f1ff; color: #2b5fd9; }
.badge.snoozed { background: #fff4e0; color: #8a5a12; }
.ops { display: flex; gap: 4px; }
.admin-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-toolbar input, .admin-toolbar select, .inline-form input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rec-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.rf { background: #eef0fb; border: none; border-radius: 20px; padding: 6px 14px; font-size: 13px; color: var(--primary-d); }
.rf.active { background: var(--primary); color: #fff; }
.search.wide { margin: 12px 0; }

/* ---------- 弹窗 / 编辑 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,24,40,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.edit-card { background: var(--surface); border-radius: 16px; padding: 22px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.admin-head h2 { font-size: 17px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- 通用确认弹窗（r80，替代原生 confirm，修复删除按钮静默失效） ---------- */
.confirm-card { background: var(--surface); border-radius: 14px; padding: 20px 22px; width: 100%; max-width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.confirm-msg { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--text); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* 视觉隐藏但对屏幕阅读器/可访问性可见的标签（r80，给筛选/搜索/排序等无文本标签的控件用） */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- 提醒弹窗 ---------- */
#alarm-layer { position: fixed; inset: 0; background: rgba(20,24,40,.5); display: flex; align-items: center; justify-content: center; z-index: 60; }
.alarm { background: #fff; border-radius: 18px; padding: 28px; width: 340px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.alarm .bell { font-size: 46px; }
.alarm h3 { font-size: 18px; margin: 10px 0 6px; }
.alarm p { color: var(--muted); margin: 0 0 14px; }
.alarm-link { display: inline-block; margin-bottom: 14px; }
.alarm .btns { display: flex; gap: 10px; }
.alarm .btns button { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.alarm .btns .ok { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 右下角提醒浮层（2026-10-24 问题4，alarm.js 的 toast 形态） ----------
 * 与居中模态的区别：不盖遮罩、不打断当前操作，可同屏堆多张。
 * 窄屏（<520px）退化为底部通栏，避免卡片被挤出屏幕。 */
#alarm-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: 320px; display: flex; flex-direction: column; gap: 10px; }
.alarm-toasts-list { display: flex; flex-direction: column; gap: 10px; }
/* r129：批量条 —— ≥2 张卡时出现「全部知道了」；sticky 置顶，窄屏滚动时始终可见 */
.alarm-toasts-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; background: rgba(245,247,250,.94); border-radius: 8px; }
.alarm-toasts-head .cnt { font-size: 12px; color: var(--muted); }
.alarm-toasts-head .batch-ack { font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--primary); background: #fff; color: var(--primary); cursor: pointer; }
.alarm-toasts-head .batch-ack:hover { background: var(--primary); color: #fff; }
.alarm-toast { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.22); animation: alarm-toast-in .18s ease-out; }
/* r129：按紧急度（priority）左边框着色，一眼区分高/中/低 */
.alarm-toast[data-prio="high"] { border-left-color: var(--prio-high); }
.alarm-toast[data-prio="normal"] { border-left-color: var(--prio-normal); }
.alarm-toast[data-prio="low"] { border-left-color: var(--prio-low); }
.alarm-toast-head-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.alarm-toast .badge.prio { font-size: 11px; padding: 1px 7px; border-radius: 999px; flex: none; }
@keyframes alarm-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.alarm-toast-title { font-size: 15px; font-weight: 600; }
.alarm-toast-note { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.alarm-toast .btns { display: flex; gap: 8px; }
.alarm-toast .btns button { flex: 1; padding: 8px; border-radius: 9px; border: 1px solid var(--border); background: #fff; font-size: 13px; }
.alarm-toast .btns .ok { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (max-width: 520px) {
  /* r129：窄屏改为底部通栏并限制最大高度，列表可滚动，避免多张卡占满屏幕遮挡底部操作区 */
  #alarm-toasts { left: 12px; right: 12px; width: auto; bottom: 12px; max-height: 62vh; overflow-y: auto; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #1e2030; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  /* 抽屉遮罩：点击空白收起（配合 router 的 setDrawer） */
  .drawer-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .drawer-mask.show { display: block; }
  .menu-toggle { display: block; }
  .view { padding: 16px; }
  .row { flex-direction: column; gap: 0; }
}

/* ---------- 提醒指派：接收人/归属徽标 + 管理员查看全部开关 ---------- */
.badge.asg { background: #eef4ff; color: #2b5fd9; }
.badge.own { background: #f3eafd; color: #7c3aed; }
.rec-who { white-space: normal; line-height: 1.8; }
.rec-who .asg-list { margin-left: 4px; }
.list-tools .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.list-tools .chk input { accent-color: var(--primary); cursor: pointer; }
/* r152 收件箱二级「报事类型」下拉：紧跟一级「报事来源」之后，**始终显示**
   （r151 是仅「全部工单」下显示）。.list-tools 是 flex 容器，用 inline-flex 保持
   label + select 同行；[hidden] 兜底保留为防御（r152 起不再依赖它切换显隐，
   但作者样式 display:inline-flex 会盖过 UA 的 [hidden]{display:none}，留着更安全）。 */
.list-tools .rt-wrap { display: inline-flex; align-items: center; gap: 6px; }
.list-tools .rt-wrap[hidden] { display: none; }
.list-tools .rt-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
/* 管理员「查看全部用户」开关：醒目样式，避免被忽略（通用类，定时提醒与提醒记录均可复用） */
.admin-scope {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--primary); border-radius: 999px;
  background: #eef4ff; color: var(--primary); font-weight: 600; font-size: 13px;
  cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgba(43,95,217,.12);
}
.admin-scope input { accent-color: var(--primary); cursor: pointer; }

/* ---------- 仪表盘：管理员范围徽标 + 按用户筛选 ---------- */
.badge.scope { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: #eef4ff; color: var(--primary); font-weight: 600; font-size: 13px; }
.dash-scope .card-head { display: flex; align-items: center; justify-content: space-between; }
.user-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.uf-label { font-size: 13px; color: var(--muted); }
.user-filter .chips { padding: 0; }

/* ---------- CRM 收件箱 ---------- */
.inbox-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.inbox-stat-card {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .1s;
  border-left: 4px solid var(--primary); user-select: none;
}
.inbox-stat-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.inbox-stat-card.isc-ticket { border-left-color: #0ea5e9; }
.inbox-stat-card.isc-wechat { border-left-color: #16a34a; }
.inbox-stat-card.isc-verbal { border-left-color: #7c3aed; }
.inbox-stat-card.isc-system { border-left-color: #f59e0b; }
.inbox-stat-card .isc-icon { font-size: 26px; }
.inbox-stat-card .isc-body { flex: 1; display: flex; flex-direction: column; }
.inbox-stat-card .isc-body b { font-size: 24px; line-height: 1.1; }
.inbox-stat-card .isc-body span { color: var(--muted); font-size: 13px; }
.inbox-stat-card .isc-sub { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.4; }

.inbox-list { gap: 8px; }
.inbox-item { padding: 12px 14px; align-items: stretch; }
.inbox-item .ii-flag { width: 4px; border-radius: 3px; background: var(--border); flex-shrink: 0; }
.inbox-item.overdue .ii-flag { background: var(--prio-high); }
.inbox-item:not(.overdue):not(.done) .ii-flag { background: var(--primary); }
.inbox-item.done .ii-flag { background: var(--prio-low); }
.inbox-item .ii-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.inbox-item .ii-src { font-size: 12px; font-weight: 600; color: var(--primary-d); background: #eef0fb; padding: 2px 9px; border-radius: 20px; }
.inbox-item .ii-num { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.inbox-item .title { font-weight: 600; }
.inbox-item .ii-content { margin-top: 3px; }
.inbox-item .ii-info { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.inbox-item .badge.proj { background: #eef4ff; color: #2b5fd9; }
.inbox-item .badge.person { background: #f3eafd; color: #7c3aed; }
.inbox-item .badge.tel { background: #e8f7ef; color: #15803d; text-decoration: none; }
.inbox-item .badge.tel:hover { background: #d5f0e2; }
.inbox-item .badge.overdue-flag { background: #fdeaea; color: var(--prio-high); font-weight: 600; }
.inbox-item menu { align-items: center; }

/* ---- CRM 同步服务卡片（设置页） ---- */
.crm-actions { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.crm-cfg { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border, #e3e6ef); }
.crm-cfg > label { font-size: 13px; color: var(--muted, #6b7280); display: block; }
.crm-cfg input[type="text"], .crm-cfg input[type="number"] { width: 100%; }
.crm-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.crm-row label { flex: 1; min-width: 160px; }
.crm-checks { display: flex; gap: 14px; flex-wrap: wrap; padding: 4px 0; }
/* r149 P2（优化项 6）：抓取日期范围（前/后 N 月三行） */
.crm-dates { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.crm-date-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.crm-date-name { min-width: 150px; color: var(--text, #1f2430); }
.crm-month { width: 56px !important; }
/* r94：工单池优先级分级行内的下拉（首次/升级档） */
.crm-prio { width: 72px !important; }
.crm-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.crm-log-card { width: min(860px, 94vw); }
.crm-log-pre { max-height: 60vh; overflow: auto; background: #0f172a; color: #d7e0f0; padding: 12px; border-radius: 8px; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
.crm-log-lines input { width: 70px; margin-left: 4px; }
.inbox-hb { padding: 6px 12px; font-size: 12.5px; border-left: 3px solid #22c55e; background: rgba(34,197,94,.06); border-radius: 0 6px 6px 0; }
.inbox-hb.hb-bad { border-left-color: #f59e0b; background: rgba(245,158,11,.08); }
.badge.synced { color: var(--muted, #6b7280); font-weight: normal; }

/* ---------- 通用弹窗（遮罩 + 面板）----------
 * 说明：.modal-mask / .modal 是通用类，此前遗漏定义，导致弹窗被当作普通 div 内嵌在页面流中。
 * 这里补齐，所有使用 <div class="modal-mask"><div class="modal"> 的地方都会成为真正的浮层。 */
.modal-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(20, 22, 32, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: maskIn .14s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface, #fff); border-radius: 16px; padding: 20px;
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: modalIn .16s ease;
}
@keyframes modalIn { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal .modal-head h3 { font-size: 16px; margin: 0; }
.modal .modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal .modal-body > label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.modal .modal-body > label > input,
.modal .modal-body > label > select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal .modal-body fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0; }
.modal .modal-body legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.modal .modal-body textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- 公告栏（仪表盘卡片 + 弹窗） ---------- */
.ann-card .card-head { display: flex; justify-content: space-between; align-items: center; }
.ann-card .card-head span { display: flex; gap: 12px; align-items: center; }
.ann-list { list-style: none; margin: 0; padding: 0; }
.ann-item { display: flex; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; }
.ann-item:last-child { border-bottom: none; }
.ann-item:hover { background: rgba(79,70,229,.05); }
.ann-icon { font-size: 18px; line-height: 1.4; }
.ann-body { flex: 1; min-width: 0; }
.ann-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ann-item.read .ann-title { font-weight: 400; color: var(--muted); }
.ann-item.unread .ann-title::before { content: '●'; color: var(--danger); font-size: 10px; margin-right: 6px; vertical-align: 2px; }
.ann-body-text { margin-top: 6px; font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.ann-meta { margin-top: 3px; font-size: 12px; color: var(--muted); }
.ann-modal { background: var(--surface); border-radius: 16px; padding: 20px; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ann-modal .modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ann-modal .modal-head h3 { font-size: 16px; margin: 0; }
.ann-m-form { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.ann-m-list { list-style: none; margin: 0; padding: 0; }
.ann-m-list > li { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.ann-m-list > li:last-child { border-bottom: none; }
.ann-m-ops { display: flex; gap: 8px; white-space: nowrap; }
.ann-list.full { max-height: 60vh; }

/* 公告已读明细（r53/G4）：未读在左、已读在右，顶部一条进度 */
.ann-modal .ar-sum { margin: 0 0 8px; font-size: 13px; }
.ar-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin-bottom: 14px; }
.ar-bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width .25s ease; }
.ar-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .ar-cols { grid-template-columns: 1fr; } }
.ar-col h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ar-list { list-style: none; margin: 0; padding: 0; max-height: 42vh; overflow-y: auto; }
.ar-list > li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 2px; font-size: 13px; border-bottom: 1px dashed var(--border); }
.ar-list > li:last-child { border-bottom: none; }
.ar-list > li.muted { justify-content: flex-start; font-size: 12px; border-bottom: none; }
.ar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-at { flex: 0 0 auto; font-size: 12px; }

/* 完成方式 / 退出徽标 */
.badge.cm { background: rgba(79,70,229,.1); color: var(--primary); }
.badge.optouted { background: rgba(120,120,130,.12); color: var(--muted); }
.alarm .btns.sub { margin-top: 8px; }
.alarm .btns.sub button { padding: 7px; font-size: 13px; color: var(--muted); }

/* ================= 报事核查 ================= */
.audit-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.audit-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.audit-filters select, .audit-filters input { padding: 6px 8px; border: 1px solid var(--border, #ddd); border-radius: 6px; }
.audit-detail { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 720px) { .audit-detail { grid-template-columns: 1fr; } }
.audit-fields .af-row { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border, #eee); }
.audit-fields .af-row label { width: 84px; flex: none; color: #888; font-size: 12px; padding-top: 2px; }
/* A-7（r172）：长文本按词换行、尽量不在路径中段硬拆；保留偶数行缩进便于阅读长路径 */
.audit-fields .af-row span { overflow-wrap: anywhere; word-break: normal; text-indent: -0.5em; padding-left: 0.5em; }
.audit-side h4 { margin: 0 0 6px; }
/* A-1（r172）：详情内「结论 vs 核查状态」维度说明，弱化为小字提示 */
.audit-dim-note { font-size: 12px; line-height: 1.55; margin: 6px 0; padding: 6px 8px; background: var(--muted-bg, rgba(127,127,127,.08)); border-radius: 6px; }
/* A-4（r172）：确认通过的「待二次确认」态，琥珀色警示但保持可点 */
.audit-pass.armed { background: #b8860b; border-color: #b8860b; color: #fff; }
.audit-results { margin: 0; padding-left: 4px; list-style: none; max-height: 260px; overflow: auto; }
.audit-results li { padding: 3px 0; font-size: 13px; }
.audit-results li.bad { color: #c0392b; }
.audit-results li.warn { color: #b8860b; }
.audit-results li.ok { color: #2e7d32; }
.audit-actions { display: flex; gap: 8px; align-items: center; }
/* r51：无 audit.check 权限时，详情底栏只留一行只读说明，不再摆灰按钮 */
.audit-actions .audit-readonly { flex: 1; font-size: 13px; line-height: 1.6; }
.audit-actions input { flex: 1; padding: 6px 8px; border: 1px solid var(--border, #ddd); border-radius: 6px; }
.audit-modal { width: min(860px, 94vw); max-height: 88vh; overflow: auto; }
/* r92：规则编辑窗口同网页大小 —— 条件核查单是矩阵（每列 比对项目|条件|内容 三小列），
   旧 920px 宽度下「内容」列被挤瘪，候选值下拉与手输框展不开。modal-mask 自带 24px
   padding，width/height:100% 即「占满可视区、四边留 24px 透气」；窗口改 flex 列向：
   头部与底部保存栏固定，中间 modal-body 内部滚动，长矩阵不再把保存按钮顶出屏幕。 */
.modal.rule-editor { width: 100%; height: 100%; max-width: none; max-height: none; display: flex; flex-direction: column; }
.modal.rule-editor .modal-body { flex: 1; min-height: 0; overflow: auto; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0; }
.cal-wd { text-align: center; font-size: 12px; color: #888; padding: 2px 0; }
.cal-cell { position: relative; text-align: center; padding: 10px 0; border-radius: 6px; background: var(--card-bg, #f7f7f7); font-size: 13px; }
.cal-cell.ok { background: #e6f4ea; color: #2e7d32; }
.cal-cell.bad { background: #fdecea; color: #c0392b; font-weight: 600; }
.cal-cell.empty { background: transparent; }
/* 未到点（未来日期，只有按已有单据的预演结论）：不给红也不给绿，避免「提前报欠账」 */
.cal-cell.pending { background: #f2f2f2; color: #9aa0a6; }
.cal-mark { position: absolute; top: 2px; right: 4px; font-size: 11px; color: #c0392b; }
/* 同步角标：左上角小圆点，表示当天同步情况（与日历主色「日报是否完整」互不干扰）。
   灰 = 当天一次都没真正跑（全是跳过）；红 = 当天同步报错；有正常同步则不加点，避免视觉噪声。 */
.cal-sync { position: absolute; top: 4px; left: 5px; width: 6px; height: 6px; border-radius: 50%; }
.cal-sync.none { background: #bdbdbd; }
.cal-sync.err { background: #c0392b; }
/* A-8（r171）：有数据的日期格子可下钻到单据核查；hover/焦点给出明确可点反馈 */
.cal-cell.cal-drill { cursor: pointer; transition: box-shadow .12s, filter .12s; }
.cal-cell.cal-drill:hover { filter: brightness(.97); box-shadow: inset 0 0 0 1px currentColor; }
.cal-cell.cal-drill:focus-visible { outline: 2px solid var(--accent, #3b6fd4); outline-offset: 1px; }
/* 当月同步汇总条 */
.audit-sync-sum { margin: 6px 0 8px; font-size: 13px; }
.audit-sync-sum b { color: var(--text, #222); }


/* ===== 核查列表 / 规则配置：状态与操作列前置并吸附左侧 =====
 * 需求：单据核查和规则配置里「状态」「操作」放左边方便操作。
 * 只把列挪到最左还不够——表格横向滚动时它们会滚出视口，
 * 所以再 sticky 固定在左侧（与「提醒记录」页 .col-op 同一套做法）。
 *
 * 为什么用两个 CSS 变量算 left：第一列宽度不固定（状态徽章 / 复选框宽度随内容变），
 * 第二列必须紧贴第一列右侧，硬编码像素会在不同分辨率下错位。
 */
.audit-tickets-table, .audit-rules-table { min-width: 980px; }
.audit-tickets-table .col-sticky-ops, .audit-rules-table .col-sticky-ops {
  position: sticky; z-index: 2; background: var(--surface, #fff);
}
.audit-tickets-table thead .col-sticky-ops, .audit-rules-table thead .col-sticky-ops {
  z-index: 3; background: #fafbff;
}
.audit-tickets-table tbody tr:hover .col-sticky-ops, .audit-rules-table tbody tr:hover .col-sticky-ops {
  background: #fafbff;
}
/* 第一列固定 left:0；第二列 left 取第一列实测宽度（见 JS 写入的 --col1-w），
   未测量时退回一个足够容纳「待核查」「已确认」徽章的安全值。 */
.audit-tickets-table th:nth-child(1), .audit-tickets-table td:nth-child(1),
.audit-rules-table th:nth-child(1), .audit-rules-table td:nth-child(1) { left: 0; }
.audit-tickets-table th:nth-child(2), .audit-tickets-table td:nth-child(2),
.audit-rules-table th:nth-child(2), .audit-rules-table td:nth-child(2) { left: var(--col1-w, 92px); }
/* 操作列与后面内容之间加一道分隔阴影，滚动时能看出哪里是固定区 */
.audit-tickets-table th:nth-child(2), .audit-tickets-table td:nth-child(2),
.audit-rules-table th:nth-child(2), .audit-rules-table td:nth-child(2) {
  box-shadow: 6px 0 6px -6px rgba(0, 0, 0, .18);
}
.audit-rules-table .col-sticky-ops:first-child { text-align: center; width: 44px; }
.audit-rules-table .ops { white-space: nowrap; }
/* A-2（r171）：报事时间表头可点击排序，键盘可达 + 可见焦点态 */
th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-sort:hover { color: var(--accent, #3b6fd4); }
th.th-sort:focus-visible { outline: 2px solid var(--accent, #3b6fd4); outline-offset: -2px; }
th.th-sort .sort-ind { display: inline-block; margin-left: 3px; font-size: 12px; opacity: .7; }

.audit-daily-list { list-style: none; margin: 0; padding: 0; }
.audit-daily-list li { padding: 4px 0; border-bottom: 1px dashed var(--border, #eee); font-size: 13px; }
.audit-daily-list li.ok { color: #2e7d32; }
.audit-daily-list li.bad { color: #c0392b; }
.audit-daily-list li.pending { color: #9aa0a6; }

/* ---------------- 提示音设置卡片（r27） ---------------- */
.snd-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted, #6b7280); cursor: pointer; }
.snd-range { flex: 1; min-width: 140px; max-width: 320px; vertical-align: middle; accent-color: #4f46e5; cursor: pointer; }
.snd-range:disabled { opacity: .45; cursor: not-allowed; }
#snd-vol-v { min-width: 42px; display: inline-block; font-variant-numeric: tabular-nums; }
.crm-row select:disabled, .crm-row input:disabled { opacity: .5; }
#snd-note:not(:empty) { color: #8a5a12; }

/* ============================================================================
 * 移动端适配（2026.10.16 · Android 原生壳立项）
 * —— 追加于文件末尾，利用后置规则覆盖前面的桌面优先声明。
 *    Capacitor 壳内 WebView 与移动浏览器共用这部分规则。
 * ========================================================================== */

/* ---- 1. 刘海屏 / 手势条安全区 ----
 * index.html 已声明 viewport-fit=cover，故 env() 在原生壳内会取到真实值；
 * 浏览器（无刘海）下 env() 退化为 0，规则无副作用。 */
@supports (padding: max(0px)) {
  .topbar {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
  .sidebar {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .view { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  /* 抽屉展开时左侧让开刘海 */
  @media (max-width: 760px) {
    .sidebar { padding-left: max(12px, env(safe-area-inset-left)); }
  }
}

/* ---- 2. 触摸交互微调 ----
 * -webkit-tap-highlight-color：去掉安卓/ iOS 点击时那层灰色闪块；
 * touch-action: manipulation：消除双击缩放的 300ms 延迟，点按更跟手。 */
a, button, .nav-item, .chip, .badge, label, .tab, .icon-btn, select {
  -webkit-tap-highlight-color: transparent;
}
button, .nav-item, .chip, .icon-btn, .tab, .menu-toggle, .side-collapse, select {
  touch-action: manipulation;
}

/* ---- 3. 防移动端聚焦自动放大 ----
 * 移动浏览器在输入框 font-size < 16px 时会在聚焦瞬间放大页面，体验突兀。
 *
 * ⚠️ 必须带上父级类名 + !important 才能真正生效：文件前面有
 *   `.login-card input`（L46）、`.admin-toolbar input`（L340）等
 *   「类+元素」选择器，特异性高于单纯的 `input`，光靠后置覆盖不了。
 * 这里保留 !important 是刻意的——16px 是移动端可用性硬要求，不该被局部样式覆盖。 */
@media (max-width: 760px) {
  input, select, textarea,
  .login-card input,
  .admin-toolbar input, .admin-toolbar select,
  .inline-form input,
  .rec-toolbar select,
  .modal input, .modal select, .modal textarea,
  .row input, .row select, .row textarea {
    font-size: 16px !important;
  }
}

/* ---- 4. 小屏表格：改为横向滚动而非压扁列 ----
 * 桌面端 .rec-table 设了 min-width: 920px（保证列宽可读）。
 * 手机上若强行撑到 920px 会整页横向溢出，故：表格保持自身 min-width
 * 由 .table-wrap 承担滚动；此处确保容器不撑破视口、列内文本正常换行。 */
@media (max-width: 760px) {
  .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
  .rec-table td, .rec-table th { padding: 8px 8px; }
  .rec-title { max-width: 200px; }
  /* 移动端提醒记录：隐藏次要列（序号/来源/操作时间），从 9 列减到 6 列，
     减少横向滚动。colspan 的日期分隔行会自动 clamp 到实际列数，无需改 JS。 */
  .rec-table .rec-opt { display: none; }
}

/* ---- 5. 小屏表单与卡片：更紧凑的间距 ---- */
@media (max-width: 760px) {
  .topbar { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar h1 { font-size: 16px; }
  .view { padding: 12px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .card { padding: 12px; }
  /* 抽屉打开时给一层遮罩感（原生壳内点击空白收起，见 router 的 #menu-toggle） */
  .sidebar.open { box-shadow: 6px 0 24px rgba(0, 0, 0, .35); }
  /* 定时提醒卡片：窄屏下操作按钮换到下一行，避免挤压标题/备注 */
  .item { flex-wrap: wrap; }
  .item menu { width: 100%; justify-content: flex-end; margin-top: 4px; }
}

/* ---- 6. 触控目标尺寸：关键可点元素至少 40px 高（WCAG 建议 44px） ---- */
@media (max-width: 760px) {
  .nav-item { padding: 12px 12px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .menu-toggle { min-width: 40px; min-height: 40px; }
}

/* ==================== v16 轮转排班 ==================== */

/* 未来 7 天预告（我的接收时段）与未来 4 周预览（管理员）共用格子样式 */
.shift-forecast, .rot-preview {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}
.shift-day, .rot-pv {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 4px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); font-size: 12px; line-height: 1.25;
}
.shift-day .sd-date, .rot-pv .sd-date { font-weight: 600; color: var(--text); }
.shift-day .sd-wd, .rot-pv .sd-wd { color: var(--muted); font-size: 11px; }
.shift-day .sd-code, .rot-pv .sd-code { color: var(--primary-d); font-size: 12px; text-align: center; }
/* 今天：描边加重，一眼能定位 */
.shift-day.is-today, .rot-pv.is-today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, .12); }
/* 临时调整（请假/换班）：黄底 + 「·改」标记，与轮转推算区分开 */
.shift-day.is-override { background: #fffbeb; border-color: #fde68a; }
.shift-day.is-override .sd-code { color: #92400e; }
.shift-day.is-override .sd-code i { font-style: normal; font-size: 10px; margin-left: 2px; opacity: .8; }
/* 不限：整格压灰，避免看起来「排了班」 */
.shift-day.is-none .sd-code { color: var(--muted); }

/* 自助临时调整一行 */
.shift-selfops {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 0 2px; border-top: 1px dashed var(--border); margin-top: 6px;
}
.shift-selfops label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.shift-selfops select { padding: 5px 8px; font-size: 13px; }

/* 管理员：周期逐格编辑器 */
.rot-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px; margin: 10px 0;
}
.rot-cell {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: #fbfbfe;
}
.rot-cell .rot-idx { font-size: 11px; color: var(--muted); }
.rot-cell select { width: 100%; padding: 4px; font-size: 12px; }
/* 周次标签跨整行，用来对照「第几周周几」，不占一格宽度 */
.rot-week {
  grid-column: 1 / -1; font-size: 11px; color: var(--muted);
  margin-top: 4px; border-left: 3px solid var(--primary); padding-left: 6px;
}
.rot-week:first-child { margin-top: 0; }

/* 小屏：7 列会挤，降到 4 列并允许横向压缩 */
@media (max-width: 760px) {
  .shift-forecast, .rot-preview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rot-cell { padding: 5px 4px; }
  .rot-cell select { font-size: 11px; }
}

/* ============ Step 6b：工单提醒规则编辑器 ============ */
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
.page-head h2 { margin:0 0 4px; }
.page-head .page-actions { display:flex; gap:8px; align-items:center; }
.tiny { font-size:12px; }
.xs { padding:3px 8px; font-size:12px; }
.row-actions { display:flex; gap:6px; }
.crm-rules-table { width:100%; border-collapse:collapse; }
.crm-rules-table th, .crm-rules-table td { padding:8px 10px; text-align:left; border-bottom:1px solid var(--border,#eee); vertical-align:top; }
.crm-rules-table th { font-size:13px; color:#666; }
.badge { display:inline-block; padding:1px 8px; border-radius:10px; font-size:12px; background:#eef; color:#335; }
.badge.on { background:#e6f7ec; color:#1a7f44; }
.badge.off { background:#f1f1f1; color:#888; }
.prio-high { background:#fdecec; color:#c0392b; }
.prio-normal { background:#eef2ff; color:#3b54d6; }
.prio-low { background:#f3f3f3; color:#777; }

/* 编辑器 */
.crm-rule-editor { max-width:760px; width:92vw; }
.crm-rule-editor fieldset { border:1px solid var(--border,#e3e3e8); border-radius:10px; margin:0 0 14px; padding:12px 14px; }
.crm-rule-editor legend { padding:0 6px; font-weight:600; color:#444; }
.crm-rule-editor label { display:block; margin:6px 0; font-size:13px; }
.crm-rule-editor label.check { display:inline-flex; align-items:center; gap:6px; }
.crm-rule-editor label.full { grid-column:1 / -1; }
.crm-rule-editor input, .crm-rule-editor select { width:100%; padding:6px 8px; border:1px solid #ccc; border-radius:7px; font-size:13px; box-sizing:border-box; }
.crm-rule-editor input[type=number], .crm-rule-editor input[type=checkbox] { width:auto; }
.crm-rule-editor .modal-body { display:block; }

.matrix-row { border:1px solid #e3e3e8; border-radius:8px; padding:8px 10px; margin:8px 0; background:#fafbff; }
.matrix-row-head { display:flex; gap:10px; align-items:center; margin-bottom:6px; }
.matrix-row-head .row-name { flex:1; }
.conds { display:flex; flex-direction:column; gap:6px; margin-bottom:6px; }
.cond-row { display:flex; gap:6px; align-items:center; }
.cond-row .cond-field { flex:2; }
.cond-row .cond-op { flex:2; }
.cond-row .cond-val { flex:3; }
.matrix-row-head select, .cond-row select { width:auto; }

/* ==========================================================================
 * r123：P1 界面优化
 * ========================================================================== */

/* ---- 1. 键盘焦点可见（此前全站没有一条 focus 规则，Tab 时焦点无处可寻）----
 * 只在键盘导航时出现，鼠标点击不显示（:focus-visible），不影响原有观感。
 * 侧边栏是深色底，单独给白色描边，否则深蓝描边在 #1e2030 上几乎看不见。 */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}
.sidebar :focus-visible,
.sidebar button:focus-visible,
.sidebar .nav-item:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}
/* 少数元素自带 border-radius，统一让 outline 跟随圆角，避免方形描边套圆角按钮 */
.primary:focus-visible, .ghost:focus-visible, .chip-btn:focus-visible,
.chip:focus-visible, .fab-new:focus-visible {
  border-radius: 10px;
}

/* ---- 2. 彩色 SVG 图标（duotone）----
 * 双色调：主色描边 + 同色淡填充。填充走 currentColor，所以整枚图标换色
 * 只需改 svg 上的 color —— 图标自带语义色写在 icons.js 的 style 里。 */
svg .fl { fill: currentColor; fill-opacity: .18; }

/* 图标与中文混排时默认基线会偏低，用 vertical-align 微调到视觉中线 */
svg { vertical-align: -0.15em; }
.nav-item svg { flex-shrink: 0; }
.sidebar.collapsed .nav-item svg { margin: 0 auto; }
.ann-icon svg, .badge svg { vertical-align: -0.18em; margin-right: 3px; }
h2 svg, h3 svg { margin-right: 6px; vertical-align: -0.2em; }
.empty-icon svg { opacity: .72; }   /* 空态降一档存在感，但彩色图标不能压太狠，否则发灰 */
.empty-icon { font-size: 0; }       /* 图标位原本靠 emoji 字号撑，改 SVG 后清掉行高差 */
.logo svg { display: block; }

/* 侧边栏是深色底（#1e2030），500 级彩色在上面偏闷，统一提一档亮度和饱和。
 * 卡片是浅底，同一枚图标在那里正好，所以只针对侧栏做，不动全局。 */
.sidebar .nav-item svg,
.sidebar .brand .logo svg { filter: brightness(1.22) saturate(1.06); }
/* 激活项背景是主色靛蓝（#4f46e5），彩色图标糊在上面会分不清（尤其靛蓝、紫）。
 * 激活态统一转白色：仍是 duotone（保留淡填充），只是换色，识别度最高。 */
/* svg 的语义色是内联 style，普通规则压不过，必须 !important */
.sidebar .nav-item.active svg { color: #fff !important; filter: none; }
.sidebar .nav-item.active svg .fl { fill-opacity: .24; }

/* ---- 3. 移动端「定时提醒」：高频列表排到低频表单之前 ---- */
.rem-page { display: flex; flex-direction: column; gap: 16px; }
.fab-new { display: none; }
@media (max-width: 760px) {
  .rem-page .list-wrap { order: 1; }
  .rem-page .composer  { order: 2; }
  /* 右下角悬浮新建按钮：列表已在首屏，新建不必再占一屏 */
  .fab-new {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 56px; height: 56px; border: none; border-radius: 50%;
    background: var(--primary); color: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, .38);
    z-index: 35;                 /* 低于侧边抽屉(40)，高于内容 */
  }
  .fab-new:active { transform: scale(.94); }
  /* 抽屉打开时收起，避免悬浮按钮压在抽屉上 */
  .sidebar.open ~ .main .fab-new { opacity: 0; pointer-events: none; }
}

/* ---- 4. 尊重「减少动态效果」系统偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== r176 / WBS 4：通知渠道 3×4 勾选矩阵（个人设置） ===== */
.np-matrix-wrap { overflow-x: auto; }
.np-matrix { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.np-matrix th, .np-matrix td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.np-matrix th { color: var(--muted); font-weight: 600; background: #fafbff; white-space: nowrap; }
.np-matrix tbody tr:hover { background: #fafbff; }
.np-matrix .np-kind { white-space: nowrap; }
.np-matrix .np-cell { min-width: 104px; }
.np-check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.np-check input { cursor: pointer; }
.np-cell-meta { margin-top: 5px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.np-state { display: inline-block; font-size: 11px; line-height: 1.4; padding: 1px 7px; border-radius: 10px; }
.np-state.np-ok { color: #0e9f6e; background: #e9f8f1; }
.np-state.np-off { color: #8a5a12; background: #fff5e6; }
.np-cfg { font-size: 11.5px; padding: 0; }
.np-form .field { margin-bottom: 10px; }
.np-form .field label { font-size: 12.5px; }
/* r179：自定义请求头键值对列表 */
.np-kvlist { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.np-kvrow { display: flex; align-items: center; gap: 6px; }
.np-kvrow input { flex: 1; min-width: 0; }
.np-kvrow .np-kv-del { flex: 0 0 auto; padding: 0 8px; line-height: 1.6; }
.np-kv-add { margin-top: 4px; }
#np-test-result { margin: 6px 0; }
@media (max-width: 760px) {
  .np-matrix { font-size: 12px; }
  .np-matrix th, .np-matrix td { padding: 8px 6px; }
}
