@import url("tokens.css?v=2");
@import url("components.css?v=2");

/* ============================================================
 * AI 销售增长系统 · 移动端 H5 公共样式
 * 设计基准：iPhone 375px 宽，浅色卡片式风格
 * ============================================================ */

/* 页面级语义令牌（**唯一权威定义处**）。
 * 调色板 / 字号 / 间距 / 圆角 / 阴影 / 动效阶梯以 tokens.css 为来源；
 * 本层只声明移动端页面实际使用的语义别名，取值即生效值。
 * 历史遗留说明：本文件曾同时存在两处 :root（后者覆盖前者），现已合并到此处，
 * 修改页面配色请只改这里，不要再新增第二个 :root。 */
:root {
  /* 品牌：与 tokens.css --brand-500 同源，避免同一界面出现多套蓝 */
  --primary: var(--brand-500);      /* 主色：企业靛蓝 #2b4ae0 */
  --primary-light: var(--brand-100);/* 主色浅底 */
  --accent: #e9783f;                /* 强调橙 */
  --danger: #e0403f;                /* 危险红 */
  --bg: #eef1f7;                    /* 页面背景：冷调浅灰蓝，衬托白卡 */
  --card: var(--neutral-0);         /* 卡片底 */
  --text: #0f1c2e;                  /* 主文字：海军蓝墨色 */
  --text-2: #5a6b82;                /* 次要文字 */
  --text-3: #93a1b5;                /* 弱提示文字 */
  --line: #e4e9f2;                  /* 分隔线 */
  --green: #17835c;                 /* 成功绿 */
  --radius: 16px;                   /* 卡片圆角 */
  --radius-btn: 12px;               /* 按钮圆角 */
  --shadow: var(--shadow-card);     /* 卡片投影（双层） */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Source Han Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.55;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 科技风背景：极淡网格 + 顶部品牌光晕，纯色背景不再发平 */
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 380px at 50% -12%, rgba(43, 74, 224, .10), rgba(43, 74, 224, 0) 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 100%, 22px 22px, 22px 22px;
  background-attachment: fixed, fixed, fixed;
}

/* 页面容器：移动端全宽，桌面预览时限宽居中 */
.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(76px + var(--safe-bottom)); /* 给底部 Tab 留位 */
}
.page.no-tab { padding-bottom: calc(24px + var(--safe-bottom)); }

/* ---------- 顶部标题栏 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar .nav-title { font-size: 1.0625rem; font-weight: 600; flex: 1; }
.navbar .nav-back {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.navbar .nav-back:active { background: var(--bg); }
.navbar .nav-action {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 16px 0;
}
.card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  outline: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 11px 18px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-plain { background: var(--primary-light); color: var(--primary); }
.btn-danger-plain { background: #fff1f0; color: var(--danger); }
.btn-ghost { background: #f2f4f8; color: var(--text-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.8125rem; border-radius: 8px; }

/* 菊花加载动画 */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner.dark { border-color: rgba(47, 107, 255, 0.2); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* AI 生成按钮的提示副文案 */
.ai-loading-tip {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 8px;
}

/* ---------- 徽标 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-green { background: #e8f7ef; color: var(--green); }
.badge-gray { background: #f2f4f8; color: var(--text-3); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-orange { background: #fff3ea; color: var(--accent); }
.badge-red { background: #fff1f0; color: var(--danger); }

/* 数字角标 */
.count-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---------- 待办胶囊：状态 + 优先级（待办中心 / 拜访详情共用） ---------- */
.todo-status,
.todo-prio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .625rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.todo-prio { background: var(--track); color: var(--text-2); }
.todo-prio::before {
  content: '';
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}
.todo-prio.p-high { background: var(--danger-bg); color: var(--danger); }
.todo-prio.p-mid { background: var(--accent-bg); color: var(--accent); }
.todo-prio.p-low { background: var(--primary-light); color: var(--primary); }

.todo-status.st-pending { background: var(--accent-bg); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(233, 120, 63, .18); }
.todo-status.st-confirmed { background: var(--primary-light); color: var(--primary); box-shadow: inset 0 0 0 1px var(--brand-line); }
.todo-status.st-overdue { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }
.todo-status.st-done { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px rgba(28, 154, 103, .16); }
.todo-status.st-rejected { background: var(--track); color: var(--text-3); box-shadow: inset 0 0 0 1px rgba(154, 166, 181, .2); }

/* ---------- Toast ---------- */
#toast-wrap {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 82vw;
}
.toast {
  background: rgba(31, 39, 51, 0.88);
  color: #fff;
  font-size: 0.8125rem;
  padding: 10px 16px;
  border-radius: 10px;
  max-width: 82vw;
  text-align: center;
  animation: toast-in 0.2s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 空态 ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-3);
}
.empty .empty-icon { font-size: 2.4rem; margin-bottom: 10px; }
.empty .empty-text { font-size: 0.875rem; }

/* ---------- 骨架/加载块 ---------- */
.block-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 0;
  color: var(--text-3);
  font-size: 0.8125rem;
}

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 50;
}
.tabbar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  color: var(--text-3);
  font-size: 0.625rem;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.tabbar .tab-item .tab-icon { font-size: 1.25rem; line-height: 1.2; }
.tabbar .tab-item.active { color: var(--primary); font-weight: 600; }
.tabbar .tab-item .count-badge { position: absolute; top: 4px; left: calc(50% + 6px); }

/* ---------- 弹层（底部上滑） ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 28, 0.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(18px + var(--safe-bottom));
  animation: slide-up 0.22s ease;
  max-height: 82vh;
  overflow-y: auto;
}
@keyframes slide-up { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 1rem; font-weight: 600; margin-bottom: 14px; text-align: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fafbfd;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--primary); background: #fff; }
.form-textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.form-row { display: flex; gap: 10px; }
.form-row .form-item { flex: 1; }

/* 输入联想下拉（如手动新增待办的「关联客户」搜索） */
.form-suggest {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: 176px;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.form-suggest-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 9px 12px;
  font-size: .8125rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--duration-fast) ease;
}
.form-suggest-item:last-child { border-bottom: 0; }
.form-suggest-item .sug-name { flex: 1; min-width: 0; }
.form-suggest-item .sug-meta { font-size: .6875rem; color: var(--text-3); flex: 0 0 auto; }
.form-suggest-empty { padding: 10px 12px; font-size: .75rem; color: var(--text-3); }

/* ---------- 周报长页（report-view.js 渲染） ---------- */
.rv-header { text-align: center; padding: 24px 16px 4px; }
.rv-title { font-size: 1.25rem; font-weight: 700; }
.rv-period { color: var(--text-2); font-size: 0.8125rem; margin-top: 4px; }
.rv-time { color: var(--text-3); font-size: 0.6875rem; margin-top: 2px; }

.rv-summary-card {
  margin: 12px 16px 0;
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(135deg, #2f6bff 0%, #6a9bff 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 107, 255, 0.25);
}
.rv-summary-tag { font-size: 0.75rem; opacity: 0.9; font-weight: 600; }
.rv-summary-text { margin-top: 8px; font-size: 0.9375rem; line-height: 1.7; }

/* 周报数据卡已改用共享的「指标磁贴体系」（见文件末尾 .stat-row / .stat-tile） */

.rv-card { padding-bottom: 18px; }
.rv-chart { width: 100%; height: 200px; }

.rv-section { margin-top: 14px; }
.rv-section:first-of-type { margin-top: 4px; }
.rv-section-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; }
.rv-section-list { padding-left: 18px; }
.rv-section-list li { font-size: 0.875rem; color: var(--text); margin-bottom: 6px; line-height: 1.6; }
.rv-section-empty { font-size: 0.8125rem; color: var(--text-3); }

.rv-top5-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.rv-top5-rank {
  width: 20px; height: 20px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rv-top5-row:nth-child(2) .rv-top5-rank { background: #2f6bff; color: #fff; }
.rv-top5-main { flex: 1; min-width: 0; }
.rv-top5-name { font-size: 0.8125rem; margin-bottom: 4px; }
.rv-top5-sub { font-size: 0.6875rem; color: var(--text-3); margin-top: -2px; margin-bottom: 4px; }
.rv-top5-bar { height: 6px; border-radius: 3px; background: #f0f2f6; overflow: hidden; }
.rv-top5-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #2f6bff, #6a9bff); }
.rv-top5-count { font-size: 0.75rem; color: var(--text-2); flex-shrink: 0; }

.rv-actions { margin: 18px 16px 0; }

/* ---------- 工具类 ---------- */
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.bold { font-weight: 600; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap8 { gap: 8px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- 移动端视觉体系：紧凑的小程序式布局 ---------- */
/* 说明：此处此前是第二处 :root（用于覆盖文件开头的历史取值），已合并到文件顶部，
 * 页面配色只改顶部那一处即可。以下为组件级的视觉契约。 */

body {
  /* 只设底色：若用 background 简写会把文件开头定义的科技风网格图层重置为 none */
  background-color: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

.page {
  width: 100%;
  max-width: 480px;
  padding-bottom: calc(82px + var(--safe-bottom));
}
.page.no-tab { padding-bottom: calc(24px + var(--safe-bottom)); }

.navbar {
  position: relative;
  min-height: 56px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--hairline-color);
  box-shadow: 0 1px 8px rgba(15, 28, 46, .03);
}
/* 顶部栏底部的品牌渐变发丝线：科技感的关键细节 */
.navbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-glow), transparent);
  pointer-events: none;
}
.navbar .nav-title { font-size: 1rem; font-weight: 600; letter-spacing: .01em; }
.navbar .nav-back { width: 34px; height: 34px; font-size: 1.35rem; }
.navbar .nav-action { font-size: .8125rem; }

.card,
.record-card,
.todo-card,
.role-card,
.tip-card {
  border: 1px solid var(--hairline-color);
  box-shadow: var(--shadow);
}
.card { margin: 14px 16px 0; padding: 16px; border-radius: 16px; }
.card-title { color: var(--text-2); font-size: .75rem; letter-spacing: .02em; font-weight: 600; }

.btn { min-height: 42px; border-radius: var(--radius-btn); padding: 10px 16px; font-size: .875rem; font-weight: 600; }
/* 主导按钮：渐变 + 顶部内高光 + 品牌投影，避免大色块发闷
 * 注意：此处负责 background-image（sheen 叠在渐变上），
 * 后续 .btn-primary 规则不要再声明 background 简写，否则会把高光重置掉。 */
.btn-primary {
  background: var(--brand-gradient);          /* 兜底（--sheen 缺失时不留白） */
  background-image: var(--sheen), var(--brand-gradient);
  box-shadow: 0 5px 12px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-plain { background: var(--primary-light); color: var(--primary); }
.btn-ghost { background: var(--track); color: var(--text-2); }
.btn-danger-plain { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }

.tabbar {
  max-width: 480px;
  min-height: 64px;
  padding-top: 4px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(1.8) blur(14px);
  backdrop-filter: saturate(1.8) blur(14px);
  border-top: 1px solid var(--hairline-color);
  box-shadow: var(--shadow-nav);
}
.tabbar .tab-item { min-height: 58px; padding: 7px 0 5px; font-size: .625rem; }
.tabbar .tab-item .tab-icon { font-size: 1.15rem; filter: saturate(.8); }

.week-chips,
.sub-filters { padding: 14px 16px 4px; gap: 8px; }
.week-chip,
.sub-chip {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 7px 13px;
}
.week-chip.active,
.sub-chip.active { background: var(--primary-light); border-color: var(--border-brand-soft); color: var(--primary); font-weight: 600; }

.search-bar { padding: 14px 16px 2px; }
.search-box { height: 42px; background: #fff; border: 1px solid var(--line); box-shadow: none; border-radius: 11px; }
.search-box input { height: 40px; }
.record-card,
.todo-card { margin: 12px 16px 0; border-radius: 16px; padding: 15px 16px; }
.record-card:active,
.todo-card:active { transform: scale(.985); }

.greeting { padding: 24px 16px 8px; }
.greeting-text { font-size: 1.3rem; letter-spacing: -.01em; }
.greeting-date { margin-top: 5px; }
.tip-card { margin: 12px 16px 0; border-radius: 16px; padding: 15px 16px; background: var(--brand-gradient); box-shadow: 0 8px 20px var(--brand-glow); }

.role-card { margin-top: 12px; border-radius: 16px; }
.role-head { min-height: 72px; padding: 14px 16px; }
.role-icon { width: 42px; height: 42px; border-radius: 12px; }
.identity-list { background: #fbfcfe; }

.info-grid { gap: 14px 12px; }
.voice-box { color: var(--text-2); }
.sum-group { border: 1px solid #edf1f5; background: #f8fafc; }
.todo-row { padding: 13px 0; }

.rv-header { padding: 26px 16px 8px; }
.rv-title { font-size: 1.2rem; }
.rv-summary-card { margin: 12px 16px 0; border-radius: 16px; padding: 17px; background: var(--brand-gradient); box-shadow: 0 8px 20px var(--brand-glow); }
.rv-card { padding-bottom: 17px; }
.rv-chart { height: 184px; }
.rv-section-title { font-size: .8125rem; }
.rv-top5-row { padding: 10px 0; }
.rv-top5-bar { background: #e9eef6; }
.rv-top5-bar i { background: var(--brand-gradient); }
.rv-actions { margin: 20px 16px 0; }

.empty { padding: 56px 20px; }
.block-loading { padding: 42px 0; }

/* Private page styles load after common.css; keep the shared visual contract explicit. */
body .week-chip,
body .sub-chip { border: 1px solid var(--line); box-shadow: none; }
body .week-chip.active,
body .sub-chip.active { background: var(--primary-light); border-color: var(--border-brand-soft); color: var(--primary); }
body .record-card,
body .todo-card { border: 1px solid var(--hairline-color); box-shadow: var(--shadow); border-radius: 16px; }
body .search-box { border: 1px solid var(--line); box-shadow: none; }
body .top-tab { border-color: transparent; box-shadow: none; }
body .top-tab.active { background: var(--primary-light); border-color: var(--border-brand-soft); }
body .tip-card,
body .rv-summary-card { border-radius: 16px; }
body .role-card { border: 1px solid var(--hairline-color); box-shadow: var(--shadow); border-radius: 16px; }

@media (max-width: 375px) {
  .page { padding-bottom: calc(78px + var(--safe-bottom)); }
  .navbar { padding-left: 14px; padding-right: 14px; }
  .card, .record-card, .todo-card { margin-left: 14px; margin-right: 14px; }
  .greeting, .search-bar, .week-chips, .sub-filters { padding-left: 14px; padding-right: 14px; }
  .top-tabs { padding-left: 14px; padding-right: 14px; gap: 8px; }
}

/* ============================================================
 * 视觉精修：质感与层次
 * 统一在此收敛，避免改动上面的结构规则；选择器与上方同权重时按顺序生效。
 * ============================================================ */

/* ---------- 页面进场 ----------
 * 注：页面底色（冷调底 + 科技风网格 + 顶部品牌光晕）已在文件开头的 body 规则中定义，
 * 此处不再重复声明 background，避免后置规则把网格层覆盖掉。 */
.page { animation: page-enter var(--duration-slow) var(--ease-standard) both; }
@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 数字对齐（指标数字另见 .stat-hero-value / .stat-tile-value） ---------- */
.count-badge,
.rv-top5-count,
.todo-meta,
.identity-avatar { font-variant-numeric: tabular-nums; }

/* ---------- 导航栏（玻璃底与品牌渐变发丝线见上方基座规则，此处只补交互） ---------- */
.navbar .nav-back:active { background: var(--surface-pressed); }

/* ---------- 卡片：发丝描边 + 双层投影 + 更柔和的圆角 ---------- */
.card,
.record-card,
.todo-card,
.role-card,
.rv-summary-card {
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
}
.card { border-radius: 16px; }
.card-interactive:active,
.record-card:active,
.todo-card:active { box-shadow: var(--shadow-card-hover); }
/* 卡片小标题：前置一枚品牌色短竖条，建立视觉节奏 */
.card-title { display: flex; align-items: center; justify-content: flex-start; }
.card-title::before {
  content: '';
  width: 3px;
  height: 12px;
  border-radius: 2px;
  margin-right: 7px;
  background: var(--brand-gradient-soft-h);
  flex: 0 0 auto;
}
/* 末尾元素（如「全部 ›」）固定靠右，避免 space-between 把中间文字拉散 */
.card-title > :last-child { margin-left: auto; }

/* ---------- 按钮 ---------- */
.btn { border-radius: var(--radius-btn); transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease, background var(--duration-fast) ease; }
.btn-primary {
  box-shadow: 0 5px 14px var(--brand-ring), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:active { box-shadow: 0 2px 8px var(--brand-ring); }
.btn-plain { box-shadow: inset 0 0 0 1px var(--brand-veil); }
.btn-ghost:active { background: var(--track); }

/* ---------- 底部 Tab：激活指示条（玻璃底与投影见上方基座规则） ---------- */
.tabbar .tab-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 22px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--brand-gradient-soft-h);
  transform: translateX(-50%);
}
.tabbar .tab-item.active .tab-icon { transform: translateY(-1px); }
.tabbar .tab-item .tab-icon { transition: transform var(--duration-normal) var(--ease-standard); }

/* ---------- 徽标：加一圈同色描边，浅底上更清晰 ---------- */
.badge { box-shadow: inset 0 0 0 1px currentColor; }
.badge-blue { box-shadow: inset 0 0 0 1px var(--brand-line); }
.badge-green { box-shadow: inset 0 0 0 1px rgba(28, 154, 103, .16); }
.badge-orange { box-shadow: inset 0 0 0 1px rgba(233, 120, 63, .18); }
.badge-red { box-shadow: inset 0 0 0 1px var(--danger-line); }
.badge-gray { box-shadow: inset 0 0 0 1px rgba(154, 166, 181, .2); }

/* ---------- 分段 / 筛选胶囊 ---------- */
.week-chip,
.sub-chip,
.top-tab {
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease,
    border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.week-chip.active,
.sub-chip.active,
.top-tab.active { box-shadow: 0 2px 8px var(--brand-glow); }

/* ---------- 列表条目 ---------- */
.todo-item { transition: background var(--duration-fast) ease; }
.todo-item:active { background: var(--surface-pressed); }
.todo-check { box-shadow: inset 0 0 0 1px rgba(201, 210, 224, .35); }
.todo-check.checked { box-shadow: none; }

/* ---------- AI 提示卡 / 周报概览卡：加一层内高光，避免大色块发闷 ---------- */
.tip-card,
.rv-summary-card {
  position: relative;
  overflow: hidden;
}
.tip-card::after,
.rv-summary-card::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), transparent);
  pointer-events: none;
}

/* ---------- 空态：图标加一枚柔光圆底 ---------- */
.empty .empty-icon,
.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-50);
  margin-bottom: 12px;
}

/* ---------- 进度条统一圆角与过渡 ---------- */
.rv-top5-bar,
.member-bar,
.ec-progress { border-radius: var(--radius-pill); overflow: hidden; }

/* ---------- 焦点可见性（键盘/无障碍） ---------- */
:where(a, button, .tab-item, .identity-item, .role-head, .todo-item):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ============================================================
 * 指标磁贴体系（首页 / 部门看板 / 周报共用）
 * 设计依据：
 * - 一个页面只突出「一个主指标」，次级指标降一档（字号 22px → 30px 的层级差）
 * - 数字必须带上下文（单位 / 含逾期数 / 本周完成数），避免「一串裸数字」
 * - 图标统一用内联 SVG（见 ui.js statIcon），不依赖 emoji
 * ============================================================ */

/* ---------- 主指标：整宽磁贴 ---------- */
.stat-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 16px 0;
  padding: 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) ease;
}
.stat-hero:active { transform: scale(.985); box-shadow: var(--shadow-card-hover); }
.stat-hero-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 6px 14px var(--brand-ring), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform var(--duration-normal) var(--ease-standard),
    box-shadow var(--duration-normal) ease;
}
.stat-hero-icon svg { transition: transform var(--duration-normal) var(--ease-standard); }
.stat-hero-main { flex: 1; min-width: 0; }
.stat-hero-label { font-size: .75rem; color: var(--text-2); letter-spacing: .02em; }
.stat-hero-value { display: flex; align-items: baseline; gap: 4px; margin-top: 3px; }
.stat-hero-value b { font-size: 1.875rem; font-weight: 700; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-hero-unit { font-size: .75rem; color: var(--text-3); }
.stat-hero-extra { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.stat-chevron { color: var(--text-3); font-size: .8125rem; }

/* 上下文徽标（如「含 2 条逾期」） */
.stat-chip {
  display: inline-flex;
  align-items: center;
  font-size: .625rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger-line);
  white-space: nowrap;
}

/* ---------- 次级指标：三列磁贴 ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 16px 0;
}
/* 两列变体：指标较少时用更大磁贴，避免 4 列挤成「一堵数字墙」 */
.stat-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tile {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 13px 12px 12px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) ease;
}
.stat-tile:active { transform: scale(.98); box-shadow: var(--shadow-card-hover); }
.stat-tile-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 9px;
  transition: transform var(--duration-normal) var(--ease-standard),
    background-color var(--duration-normal) ease, color var(--duration-normal) ease,
    box-shadow var(--duration-normal) ease;
}
.stat-tile-icon svg { transition: transform var(--duration-normal) var(--ease-standard); }
.stat-tile-value { display: flex; align-items: baseline; gap: 3px; }
.stat-tile-value b { font-size: 1.375rem; font-weight: 700; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-tile-unit { font-size: .6875rem; color: var(--text-3); }
.stat-tile-label { font-size: .6875rem; color: var(--text-2); margin-top: 3px; }
.stat-tile-sub { font-size: .625rem; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.stat-tile.danger .stat-tile-icon { background: var(--danger-bg); color: var(--danger); }
.stat-tile.danger .stat-tile-value b { color: var(--danger); }

/* ---------- 分组小标题 ---------- */
.section-label {
  margin: 18px 16px 0;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .04em;
}

/* ---------- 窄屏收敛 ---------- */
@media (max-width: 375px) {
  .stat-hero { margin-left: 14px; margin-right: 14px; padding: 14px; gap: 12px; }
  .stat-hero-icon { width: 42px; height: 42px; border-radius: 13px; }
  .stat-hero-value b { font-size: 1.75rem; }
  .stat-row { margin-left: 14px; margin-right: 14px; gap: 6px; }
  .stat-tile { padding: 12px 10px 11px; }
  .stat-tile-value b { font-size: 1.25rem; }
  .stat-tile-sub { font-size: .5625rem; }
  .section-label { margin-left: 14px; margin-right: 14px; }
}

/* ============================================================
 * 交互反馈（hover / press）
 * - 整段包在 (hover: hover) and (pointer: fine) 内：触屏点按后不会残留 hover 态
 * - 规则顺序为先 :hover 后 :active，保证按下时按压反馈优先于悬停态
 * - 只给「真的可点」的元素加上浮/变色，避免误导（如 .todo-card 本身不可点）
 * ============================================================ */

/* 过渡属性放在媒体查询外，保证触屏/低动效环境下也有一致的基础过渡 */
.stat-chevron { transition: transform var(--duration-normal) var(--ease-standard), color var(--duration-normal) ease; }

@media (hover: hover) and (pointer: fine) {
  /* ---------- 可点卡片：上浮 + 加深投影 ---------- */
  .card-interactive:hover,
  .record-card:hover,
  .role-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
  }

  /* ---------- 指标磁贴 ---------- */
  .stat-hero:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
  .stat-hero:hover .stat-hero-icon {
    transform: scale(1.06);
    box-shadow: 0 10px 24px var(--brand-ring), inset 0 1px 0 rgba(255, 255, 255, .3);
  }
  .stat-hero:hover .stat-hero-icon svg { transform: scale(1.05); }
  .stat-hero:hover .stat-chevron { color: var(--primary); transform: translateX(3px); }
  .stat-hero:active { transform: translateY(0) scale(.985); }

  .stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
  .stat-tile:hover .stat-tile-icon {
    transform: scale(1.09);
    background: var(--brand-200);
    color: var(--brand-600);
    box-shadow: 0 4px 10px var(--brand-ring);
  }
  /* 图标本身也轻微转动，让「图标」而不是整块磁贴在响应指针 */
  .stat-tile:hover .stat-tile-icon svg { transform: rotate(-5deg) scale(1.03); }
  .stat-tile.danger:hover .stat-tile-icon {
    background: var(--danger-bg-strong);
    color: var(--danger);
    box-shadow: 0 4px 10px var(--danger-line);
  }
  .stat-tile:active { transform: translateY(0) scale(.98); }
  .stat-tile:active .stat-tile-icon { transform: scale(.96); }

  /* ---------- 导航 / 底部标签栏 ---------- */
  .navbar .nav-back:hover { background: var(--surface-pressed); color: var(--primary); }
  .tabbar .tab-item:hover { color: var(--primary); }
  .tabbar .tab-item:hover .tab-icon { transform: translateY(-2px) scale(1.06); }

  /* ---------- 胶囊：周选择 / 子筛选 / 快捷指令 ---------- */
  .week-chip:hover,
  .sub-chip:hover,
  .top-tab:hover,
  .ec-chip:hover {
    border-color: var(--border-brand-soft);
    color: var(--primary);
    background: var(--primary-light);
  }

  /* ---------- 角色页 ---------- */
  .identity-item:hover { background: var(--surface-pressed); }
  .identity-item:hover .identity-go { color: var(--primary); transform: translateX(2px); }
  .identity-go { transition: transform var(--duration-normal) var(--ease-standard), color var(--duration-normal) ease; }
  .role-head:hover .role-name { color: var(--primary); }
  .role-name { transition: color var(--duration-normal) ease; }
  .role-head:hover .role-arrow { color: var(--primary); }

  /* ---------- 待办 ---------- */
  .todo-item:hover { background: var(--surface-pressed); }
  .todo-card .todo-check:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--brand-ring);
  }

  /* ---------- 表单联想 ---------- */
  .form-suggest-item:hover { background: var(--primary-light); }

  /* ---------- P11 对话页 ---------- */
  .ec-summary-head:hover .ec-summary-title { color: var(--primary); }
  .ec-summary-title { transition: color var(--duration-normal) ease; }
  .ec-bubble.ai:hover { box-shadow: var(--shadow-card-hover); }
  .ec-file:hover {
    border-color: var(--border-brand-soft);
    box-shadow: var(--shadow-sm);
  }
  .ec-file:hover .ec-file-icon { transform: scale(1.08); }
  .ec-file-actions .btn:hover { transform: translateY(-1px); }
}

/* 低动效偏好下关闭位移类反馈 */
@media (prefers-reduced-motion: reduce) {
  .stat-hero:hover, .stat-tile:hover, .card-interactive:hover,
  .record-card:hover, .role-card:hover { transform: none; }
  .stat-tile:hover .stat-tile-icon, .stat-hero:hover .stat-hero-icon { transform: none; }
  .stat-tile:hover .stat-tile-icon svg, .stat-hero:hover .stat-hero-icon svg { transform: none; }
}


