/* ============================================================
   天御安全 · 电脑端管理后台  样式
   ------------------------------------------------------------
   设计令牌与小程序同源（miniprogram/app.wxss），只是把 rpx 换成 px。
   品牌色、语义色、中性色阶都从这里取，不要在页面里写死颜色。

   ★ 后台是电脑端：不做响应式手机适配，最小宽度 1024px。
     窄屏时会横向滚动，而不是把表格压变形 —— 管理后台的表格
     一旦被压窄就没法看了。
   ============================================================ */

:root {
  /* 品牌色阶
     ★ 与小程序 miniprogram/app.wxss 保持同一组值。
       以前这里只到 --brand-700，页面需要更深一档时就直接写死
       #0B5478、#0A4F72 之类的值，两边色阶对不上。 */
  --brand-50: #F0F8FC;
  --brand-100: #DCF0FA;
  --brand-200: #BCE1F4;
  --brand-300: #8CCBEB;
  --brand-400: #4FAEDD;
  --brand-500: #1B8FC6;
  --brand-600: #0A7EB8;
  --brand-700: #086490;
  --brand-800: #0A4F72;
  --brand-900: #0C3F5A;

  /* 语义色 */
  --ok: #0E9E76;      --ok-bg: #E2F6EF;   --ok-line: #BEE6D9;   --ok-ink: #0A7A5B;
  --warn: #E08A00;    --warn-bg: #FDF2DF; --warn-line: #F5E3C0; --warn-ink: #A56600;
  --danger: #E5484D;  --danger-bg: #FDECEC; --danger-line: #F5CFCF; --danger-ink: #B33438;

  /* 中性色阶 */
  --n50: #F7FAFC;
  --n100: #EFF4F8;
  --n200: #E1E9F0;
  --n300: #C9D6E1;
  --n400: #9FB2C2;
  --n500: #778DA0;
  --n600: #576B7C;
  --n700: #3E505D;
  --n800: #283843;
  --n900: #16242E;

  --ink: var(--n900);
  --ink2: var(--n600);
  --ink3: var(--n500);
  --ink4: var(--n400);
  --line: var(--n200);
  --bg: #F4F7FA;
  --card: #FFFFFF;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  --sh1: 0 1px 2px rgba(16, 42, 60, .04), 0 2px 8px rgba(16, 42, 60, .04);
  --sh2: 0 2px 6px rgba(16, 42, 60, .06), 0 8px 24px rgba(16, 42, 60, .08);
  --sh3: 0 12px 40px rgba(16, 42, 60, .18);

  --sidebar-w: 232px;
  --topbar-h: 56px;

  /* ---------- 字号刻度 ----------
     ★ 收敛前 app.css 里出现过 11 / 11.5 / 12 / 12.5 / 13 / 13.5 / 14 /
       14.5 / 15 / 17 / 18 / 20 / 26 共 **13 种**字号，视图里还内联了
       10 / 12.5 / 13 / 13.5 / 14 / 14.5 / 20 / 22 另外 8 种 —— 同一个
       表格里两个单元格能差 0.5px，改一次全站要 grep 二十处。
     ★ 现在收敛成 7 档。新代码一律用 var(--fs-*)，不要再写裸数值。 */
  --fs-xs: 11px;     /* 徽章 / 极小标签 */
  --fs-sm: 12px;     /* 表格辅助文字、图例 */
  --fs-base: 13px;   /* 次要正文 */
  --fs-body: 14px;   /* 正文（body 默认字号） */
  --fs-lg: 17px;     /* 小节标题 */
  --fs-xl: 20px;     /* 页面标题 */
  --fs-2xl: 26px;    /* 大数字 / 空状态图标 */
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-body)/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--n300); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--n400); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   1. 骨架
   ============================================================ */
.app { min-height: 100%; min-width: 1024px; }

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 30;
}

.sidebar > .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; height: var(--topbar-h); border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; font-size: var(--fs-base); font-weight: 700; letter-spacing: -.02em;
  display: flex; align-items: center; justify-content: center;
}
.brand-text { min-width: 0; }
.brand-name { font-size: var(--fs-body); font-weight: 600; line-height: 1.2; }
.brand-sub { font-size: var(--fs-xs); color: var(--ink3); line-height: 1.3; }

.nav { padding: 10px 10px 20px; overflow-y: auto; flex: 1 1 auto; }
.nav-group {
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink4); letter-spacing: .08em;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px; border-radius: var(--r-md);
  color: var(--ink2); cursor: pointer; user-select: none; position: relative;
  font-size: var(--fs-body);
}
.nav-item:hover { background: var(--n50); color: var(--ink); }
.nav-item.on { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-item.on::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-600);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; }
.nav-item .badge {
  margin-left: auto; font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  padding: 4px 7px; border-radius: var(--r-full);
  background: var(--danger-bg); color: var(--danger-ink);
}
.nav-item.on .badge { background: var(--danger); color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); flex: 0 0 auto;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.6) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
}
.crumb { font-size: var(--fs-base); color: var(--ink3); display: flex; align-items: center; gap: 7px; }
.crumb b { color: var(--ink); font-weight: 600; font-size: var(--fs-body); }
.crumb .sep { color: var(--n300); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--r-full); }
.who:hover { background: var(--n50); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--r-full); flex: 0 0 auto;
  background: var(--brand-100); color: var(--brand-700);
  font-size: var(--fs-base); font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.who-name { font-size: var(--fs-base); font-weight: 500; line-height: 1.25; }
.who-role { font-size: var(--fs-xs); color: var(--ink3); line-height: 1.25; }

.view { padding: 22px 24px 56px; flex: 1 1 auto; max-width: 1560px; }

/* ============================================================
   2. 页头 / 区块
   ============================================================ */
/* ★ 页头必须允许换行。
   项目详情这类页面右侧有十几个操作按钮（现场定位记录 / 导出当前节点 / 立项流程核对 /
   项目进度时间轴 …），一行绝对排不下。原来 .page-head 不换行 + .acts 是 flex:0 0 auto，
   结果两边互相挤压：标题块被压到 min-content，变成「每行一个汉字」的竖条，
   按钮行则整排冲出版心（实测宽 1999px，视口只有 1418px）。
   现在：空间不够就让 .acts 整体折到下一行，行内再自己折行。 */
.page-head {
  display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.page-head h1 { font-size: var(--fs-xl); margin: 0 0 4px; letter-spacing: -.01em; }
.page-head .desc { margin: 0; font-size: var(--fs-base); color: var(--ink3); }
.page-head .acts {
  margin-left: auto; display: flex; gap: 8px;
  flex: 0 1 auto; max-width: 100%; flex-wrap: wrap; justify-content: flex-end;
}

.section { margin-bottom: 22px; }
.section > h2 {
  font-size: var(--fs-body); margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.section > h2 .hint { font-weight: 400; font-size: var(--fs-base); color: var(--ink3); }
.section > h2 .right { margin-left: auto; font-weight: 400; font-size: var(--fs-base); color: var(--ink3); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh1);
}
.card.pad { padding: 18px 20px; }

/* ============================================================
   ★ 卡片内「裸内容」的横向内距
   ------------------------------------------------------------
   .card 自身没有内边距（只有 .card.pad 有），靠子元素各自撑开：
     .filters / .card-head / .pager   头尾栏，自己带 18px，设计上通栏
     .note                            自带背景与内边距的盒子，设计上通栏
     table                            靠单元格 padding
     .state                           U.empty 的空状态块，自带 46px 20px 且居中
   但不少视图把裸 <h3> / <p> / .kv / .btn-row / <button> 直接塞进 .card，
   这些元素自己不撑开，文字和边框就贴在卡片边框上 —— 实测 16 个页面、
   距卡片边框 0px，既不溢出也不挤压，所有几何检测都抓不到，但一眼就是没排版。
   这里统一补 18px，与 .filters / .pager / .card-head 的横向内距对齐。

   为什么用 margin 而不是 padding：
     <button> / <select> / <input> 自带 padding，改 padding 会把控件内部
     的文字挤偏（.btn 是 padding:0 14px，被覆盖后按钮会变宽且文字不居中）。
     margin 只挪位置，不碰控件内部。

   为什么排除 .card.pad：
     它已经给了 20px，再补 18px 就变成 38px，反而错位。
   ============================================================ */
.card:not(.pad) > h1,
.card:not(.pad) > h2,
.card:not(.pad) > h3,
.card:not(.pad) > h4,
.card:not(.pad) > p:not(.note),
.card:not(.pad) > .muted,
.card:not(.pad) > .kv,
.card:not(.pad) > .legend,
.card:not(.pad) > .btn-row,
.card:not(.pad) > .stat-chips,
.card:not(.pad) > .stat-strip,
.card:not(.pad) > .timeline-entry,
.card:not(.pad) > .favorite-row,
.card:not(.pad) > button,
.card:not(.pad) > select,
.card:not(.pad) > input {
  margin-left: 18px;
  margin-right: 18px;
}

/* 时间轴条目：原来只有 .rectification-list 作用域下有样式，项目进度时间轴
   页的条目既没有左右内边距（文字贴卡片边框），也没有任何分隔，几条挤成一片。
   横向内距已由上面 .card:not(.pad) 那条统一给，这里只补「条目之间」的分隔线：
   用 + 相邻兄弟选择器，第一条上面不画线（它上面是小节标题）。 */
.card > .timeline-entry { padding: 12px 0; }
.card > .timeline-entry + .timeline-entry { border-top: 1px solid var(--line); }
.rectification-list .timeline-entry { padding: 16px 0; border-top: 1px solid var(--line); }
.rectification-list .timeline-entry p { margin: 8px 0; overflow-wrap: anywhere; }
.rectification-list .filters { padding: 0; margin-bottom: 16px; }
.material-card { padding: 18px 20px; margin-bottom: 16px; }
.material-card .filters { padding: 0 0 12px; background: transparent; }
.material-card p { white-space: pre-wrap; line-height: 1.7; }
.material-card .btn { margin-right: 8px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: var(--fs-body); margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }

/* ============================================================
   3. 统计卡
   ============================================================ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats.c3 { grid-template-columns: repeat(3, 1fr); }
.stats.c5 { grid-template-columns: repeat(5, 1fr); }
.stats.c6 { grid-template-columns: repeat(6, 1fr); }

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 15px 17px; box-shadow: var(--sh1); min-width: 0;
}
.stat.clickable { cursor: pointer; transition: border-color .14s, box-shadow .14s; }
.stat.clickable:hover { border-color: var(--brand-200); box-shadow: var(--sh2); }
.stat.on { border-color: var(--brand-600); box-shadow: 0 0 0 1px var(--brand-600); }
.stat .k { font-size: var(--fs-base); color: var(--ink3); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.15; margin-top: 5px; letter-spacing: -.02em; }
.stat .v small { font-size: var(--fs-base); font-weight: 600; margin-left: 2px; color: var(--ink3); }
.stat .f { font-size: var(--fs-sm); color: var(--ink3); margin-top: 3px; }
.stat.danger .v { color: var(--danger); }
.stat.warn .v { color: var(--warn); }
.stat.ok .v { color: var(--ok); }
.stat.mute .v { color: var(--ink4); }

/* ============================================================
   4. 按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: var(--fs-body); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s;
}
.btn:hover { background: var(--n50); border-color: var(--n300); }
.btn:active { background: var(--n100); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn.primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn.danger { color: var(--danger-ink); border-color: var(--danger-line); background: var(--danger-bg); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger-line); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--n100); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-base); border-radius: var(--r-sm); }
.btn.link { border: none; background: none; padding: 0 2px; height: auto; color: var(--brand-600); }
.btn.link:hover { background: none; text-decoration: underline; }
.btn.link.danger { color: var(--danger-ink); background: none; }

.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-row .spacer { flex: 1 1 auto; }

/* 分段统计 chip：上面一行是名称，下面一行是「金额 · 项数」。
   ★ 不能拿 .btn 加 <br> 硬凑两行：.btn 是固定 height:34px，两行内容会溢出边框
     （实测账龄分段 chip scrollHeight 38 > clientHeight 32，文字压在按钮边上），
     而且同排里「全部账龄」是单行、其余是双行，标签基线对不齐，看着就是没排好。 */
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chip {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 1px;
  min-height: 48px; padding: 6px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: var(--fs-base); font-weight: 500; line-height: 1.4;
  cursor: pointer; transition: background .14s, border-color .14s, color .14s;
}
.stat-chip:hover { background: var(--n50); border-color: var(--n300); }
.stat-chip.on { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.stat-chip .n { font-size: var(--fs-sm); font-weight: 400; color: var(--ink3); }
.stat-chip.on .n { color: rgba(255, 255, 255, .88); }

/* 指标条：一排「名称 数值」小胶囊。
   ★ 在途项目总览原来拿 .btn-row 排纯文本（<b>/<span>），既语义不对，
     也没有任何分隔 —— 十个数字连成一句
     「在途 10 未开始 1 项目超期 2 当前节点超期 2 …」，扫读不了。 */
.stat-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stat-strip > * {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--n100); color: var(--ink2); font-size: var(--fs-base);
}
.stat-strip > b { background: var(--brand-100); color: var(--brand-800); font-weight: 600; font-size: var(--fs-body); }
.stat-strip > .hot { background: var(--danger-bg); color: var(--danger-ink); }
.stat-strip > .warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ============================================================
   5. 表格
   ============================================================ */
.table-wrap { overflow-x: auto; }
.clients-list-card table.tb { min-width: 960px; }
.renewals-card table.tb { min-width: 1040px; }
table.tb { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-body); }
table.tb th {
  text-align: left; font-weight: 600; color: var(--ink2); font-size: var(--fs-base);
  background: var(--n50); padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tb td {
  padding: 11px 14px; border-bottom: 1px solid var(--n100); color: var(--ink2);
  vertical-align: middle;
}
table.tb tbody tr:last-child td { border-bottom: none; }
table.tb tbody tr:hover td { background: var(--n50); }
table.tb tr.clickable { cursor: pointer; }
table.tb td.strong { color: var(--ink); font-weight: 500; }
table.tb td.nowrap { white-space: nowrap; }
table.tb td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb th.num { text-align: right; }
table.tb td.acts { text-align: right; white-space: nowrap; }
table.tb .sub { display: block; font-size: var(--fs-sm); color: var(--ink3); margin-top: 1px; }
table.tb .row-acts { opacity: 0; transition: opacity .12s; }
table.tb tbody tr:hover .row-acts { opacity: 1; }

.cell-main { color: var(--ink); font-weight: 500; }
.cell-sub { font-size: var(--fs-sm); color: var(--ink3); margin-top: 1px; }
/* 横向滚动容器里的表头按正常文档流排列，避免偏移后遮挡数据。 */
table.tb .cell-main, table.tb .cell-sub { display: block; }
table.tb .cell-main { overflow-wrap: anywhere; }
table.tb .cell-sub { line-height: 1.5; }
/* ★ 主/副文本列不许被压成竖条。
   overflow-wrap:anywhere 让中文可以在任意两字之间断开，好处是长企业名不会撑破表格，
   坏处是一旦列宽被挤到 20~30px，「超级管理员」就变成每行一个字的竖条 ——
   这种既不会横向溢出，也不会 scrollWidth 超限，肉眼却一眼看出坏了
   （实测：系统设置的权限等级表列宽 26px，工作台今日待办卡片列宽 31px）。
   给一个下限，装不下就让 .table-wrap 横向滚动 —— 它本来就是 overflow-x:auto。 */
table.tb .cell-main, table.tb .cell-sub { min-width: 104px; }

/* ============================================================
   6. 标签 / 徽章 / 进度
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); font-weight: 600;
  padding: 2px 9px; border-radius: var(--r-full); line-height: 1.55; white-space: nowrap;
  background: var(--n100); color: var(--ink2); border: 1px solid transparent;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok      { background: var(--ok-bg);     color: var(--ok-ink);     border-color: var(--ok-line); }
.pill.warn    { background: var(--warn-bg);   color: var(--warn-ink);   border-color: var(--warn-line); }
.pill.danger  { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.pill.brand   { background: var(--brand-50);  color: var(--brand-700);  border-color: var(--brand-200); }
.pill.mute    { background: var(--n100);      color: var(--ink3); }
.pill.plain   { background: transparent; border-color: var(--line); color: var(--ink2); }

.tag-kv { font-size: var(--fs-sm); color: var(--ink3); }

.prog { display: flex; align-items: center; gap: 8px; min-width: 132px; }
.prog-bar { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--n100); overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; background: var(--brand-600); }
.prog-fill.ok { background: var(--ok); }
.prog-fill.danger { background: var(--danger); }
.prog-txt { font-size: var(--fs-sm); color: var(--ink3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   7. 筛选栏
   ============================================================ */
.filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--n50);
}
.filters .spacer { flex: 1 1 auto; }
.filters label { font-size: var(--fs-base); color: var(--ink3); }

.field {
  height: 32px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--card); padding: 0 10px; font-size: var(--fs-base); color: var(--ink);
  outline: none; transition: border-color .14s, box-shadow .14s; min-width: 0;
}
.field:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.field::placeholder { color: var(--ink4); }
select.field { padding-right: 26px; cursor: pointer; }
.field.search { width: 220px; }

.seg { display: inline-flex; background: var(--n100); border-radius: var(--r-md); padding: 2px; }
.seg button {
  border: none; background: transparent; height: 26px; padding: 0 11px; border-radius: 7px;
  font-size: var(--fs-base); color: var(--ink2); cursor: pointer; font-weight: 500;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--brand-700); box-shadow: var(--sh1); font-weight: 600; }

/* ============================================================
   8. 页签
   ============================================================ */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 18px; overflow-x: auto;
}
.tabs button {
  border: none; background: none; cursor: pointer; padding: 10px 14px 11px;
  font-size: var(--fs-body); color: var(--ink3); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand-700); border-bottom-color: var(--brand-600); font-weight: 600; }
.tabs .spacer { flex: 1 1 auto; }

/* ============================================================
   9. 键值详情
   ============================================================ */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.kv.c1 { grid-template-columns: 1fr; }
.kv.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv .row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--n100); min-width: 0; }
.kv .row:last-child { border-bottom: none; }
.kv .k { flex: 0 0 96px; font-size: var(--fs-base); color: var(--ink3); }
.kv .v { flex: 1 1 auto; font-size: var(--fs-body); color: var(--ink); min-width: 0; word-break: break-all; }
.kv .v.empty { color: var(--ink4); }
.kv.wide .k { flex: 0 0 120px; }

/* ============================================================
   10. 时间轴（节点进度）
   ============================================================ */
.tl { padding: 4px 0 4px 4px; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 2px; }
.tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 11px; top: 24px; bottom: -2px;
  width: 2px; background: var(--n200);
}
.tl-item.done:not(:last-child)::before { background: var(--ok-line); }
.tl-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; margin-top: 8px;
  background: var(--card); border: 2px solid var(--n300); color: var(--ink4);
  font-size: var(--fs-xs); font-weight: 600; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; font-variant-numeric: tabular-nums;
}
.tl-item.done .tl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-item.doing .tl-dot { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 0 0 4px var(--brand-50); }
.tl-item.overdue .tl-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.tl-body { flex: 1 1 auto; min-width: 0; padding: 8px 0 16px; }
.tl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-name { font-size: var(--fs-body); font-weight: 500; color: var(--ink); }
.tl-item.todo .tl-name { color: var(--ink3); font-weight: 400; }
.tl-meta { font-size: var(--fs-sm); color: var(--ink3); margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.tl-note {
  margin-top: 7px; font-size: var(--fs-base); color: var(--ink2); background: var(--n50);
  border-left: 2px solid var(--n200); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 7px 11px;
}
.tl-inner { font-size: var(--fs-xs); }

/* ============================================================
   11. 照片墙
   ============================================================ */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo {
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--card);
  position: relative;
}
.photo .thumb {
  height: 118px; background: var(--n100) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--ink4); font-size: var(--fs-sm);
}
.photo .meta { padding: 8px 10px; font-size: var(--fs-sm); color: var(--ink3); }
.photo .meta .t { color: var(--ink); font-weight: 500; font-size: var(--fs-base); }
.photo .flags { position: absolute; top: 7px; left: 7px; display: flex; gap: 5px; flex-wrap: wrap; max-width: calc(100% - 14px); }
.photo .acts { position: absolute; top: 7px; right: 7px; display: flex; gap: 5px; }
.photo .acts .btn { height: 24px; padding: 0 8px; font-size: var(--fs-xs); }
.photo.off .thumb { filter: grayscale(1); opacity: .55; }

/* ============================================================
   12. 状态块（空 / 载入 / 出错）
   ============================================================ */
.state { padding: 46px 20px; text-align: center; color: var(--ink3); font-size: var(--fs-body); }
.state .ico {
  width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--n100); color: var(--n400);
  display: flex; align-items: center; justify-content: center;
}
.state .ico svg { width: 22px; height: 22px; }
.state .t { color: var(--ink); font-weight: 500; margin-bottom: 4px; font-size: var(--fs-body); }
.state .d { max-width: 420px; margin: 0 auto; line-height: 1.7; }
.state .acts { margin-top: 14px; display: flex; gap: 8px; justify-content: center; }
.state.error .ico { background: var(--danger-bg); color: var(--danger); }

.skeleton { padding: 18px; }
.sk-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--n100), var(--n50), var(--n100)); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; margin-bottom: 10px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   13. 弹窗
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 36, 46, .42); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px 40px; overflow-y: auto;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh3);
  width: 100%; max-width: 560px; animation: pop .16s ease-out;
}
.modal.wide { max-width: 780px; }
.modal.narrow { max-width: 420px; }
@keyframes pop { from { transform: translateY(-8px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: var(--fs-body); margin: 0; }
.modal-head .x {
  margin-left: auto; width: 28px; height: 28px; border-radius: var(--r-sm);
  border: none; background: none; color: var(--ink3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: var(--fs-lg); line-height: 1;
}
.modal-head .x:hover { background: var(--n100); color: var(--ink); }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line); background: var(--n50);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.modal-foot .spacer { flex: 1 1 auto; }

/* ============================================================
   14. 表单
   ============================================================ */
.form { display: grid; gap: 14px; }
.form.c2 { grid-template-columns: 1fr 1fr; }
.form .span2 { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label { font-size: var(--fs-base); color: var(--ink2); font-weight: 500; }
.fld > label .req { color: var(--danger); margin-left: 2px; }
.fld .hint { font-size: var(--fs-sm); color: var(--ink3); }
.fld .err { font-size: var(--fs-sm); color: var(--danger-ink); }
.fld input, .fld select, .fld textarea {
  height: 36px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--card); padding: 0 11px; font-size: var(--fs-body); outline: none;
  transition: border-color .14s, box-shadow .14s; width: 100%;
}
.fld textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50);
}
.fld input:disabled, .fld select:disabled, .fld textarea:disabled {
  background: var(--n50); color: var(--ink3); cursor: not-allowed;
}
.fld.bad input, .fld.bad select, .fld.bad textarea { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--brand-600); cursor: pointer; }
.check .ct { font-size: var(--fs-base); color: var(--ink); }
.check .cd { font-size: var(--fs-sm); color: var(--ink3); margin-top: 1px; }
.form-sep {
  grid-column: 1 / -1; font-size: var(--fs-sm); font-weight: 600; color: var(--ink3);
  letter-spacing: .05em; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px;
}

/* ============================================================
   15. 提示条
   ============================================================ */
.note {
  border-radius: var(--r-md); padding: 12px 15px; font-size: var(--fs-base);
  background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800);
  line-height: 1.7;
}
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.note.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.note.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.note .ttl { display: block; font-weight: 600; margin-bottom: 3px; }
.note + .note { margin-top: 10px; }

/* ============================================================
   16. 浮动提示
   ============================================================ */
.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--brand-600);
  border-radius: var(--r-md); box-shadow: var(--sh2); padding: 11px 15px;
  font-size: var(--fs-body); color: var(--ink); max-width: 380px;
  animation: slide .16s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .tt { font-weight: 600; margin-bottom: 2px; }
.toast .td { font-size: var(--fs-base); color: var(--ink3); }
@keyframes slide { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================
   17. 登录页
   ============================================================ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 520px at 12% -8%, var(--brand-50), transparent 62%),
    radial-gradient(760px 420px at 96% 108%, var(--ok-bg), transparent 58%),
    var(--bg);
  padding: 40px 20px;
}
.login-box { width: 100%; max-width: 396px; }
.login-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 20px; }
.login-brand .brand-mark { width: 38px; height: 38px; border-radius: 10px; font-size: var(--fs-body); }
.login-brand .n { font-size: var(--fs-lg); font-weight: 600; }
.login-brand .s { font-size: var(--fs-base); color: var(--ink3); }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh2); padding: 26px; }
.login-card h1 { font-size: var(--fs-lg); margin: 0 0 4px; }
.login-card .lead { font-size: var(--fs-base); color: var(--ink3); margin: 0 0 20px; }
.login-card .form { gap: 13px; }
.login-card .btn.primary { height: 40px; width: 100%; margin-top: 4px; }
.demo-roles { display: grid; gap: 7px; margin-bottom: 6px; }
.demo-role {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 1px solid var(--line); background: var(--card); border-radius: var(--r-md);
  padding: 10px 13px; cursor: pointer; transition: border-color .14s, background .14s;
}
.demo-role:hover { border-color: var(--brand-400); background: var(--brand-50); }
.demo-role .avatar { width: 30px; height: 30px; }
.demo-role .rn { font-size: var(--fs-body); font-weight: 500; }
.demo-role .rr { font-size: var(--fs-sm); color: var(--ink3); }

/* ============================================================
   18. 杂项
   ============================================================ */
.muted { color: var(--ink3); }
.small { font-size: var(--fs-base); }
.mono { font-family: Consolas, Monaco, "Courier New", monospace; font-size: var(--fs-base); }

/* 字号刻度工具类 —— 视图里不要再写 style="font-size:13.5px" 这类内联值 */
.fs-xs   { font-size: var(--fs-xs); }
.fs-sm   { font-size: var(--fs-sm); }
.fs-base { font-size: var(--fs-base); }
.fs-body { font-size: var(--fs-body); }
.fs-lg   { font-size: var(--fs-lg); }
.fs-xl   { font-size: var(--fs-xl); }
.fs-2xl  { font-size: var(--fs-2xl); }

/* 保留换行的长文本（现场记录 / 复盘 / 沟通内容 / 导入回执…）。
   ★ 视图里原本有 16 处内联 style="white-space:pre-wrap"，
     .retro-text / .knowledge-body / .business-contact-text 又各写一份。
     overflow-wrap:anywhere 必须一起写 —— 只给 pre-wrap 时，长串
     （HTTPS 链接、样品编号）会把容器顶破，撑出横向滚动条。 */
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* 语义色 / 字重工具类。视图里不要再写
   style="color:var(--danger-ink);font-weight:600" 这种内联组合。 */
.ink-2      { color: var(--ink2); }
.ink-3      { color: var(--ink3); }
.ink-ok     { color: var(--ok); }
.ink-warn   { color: var(--warn-ink); }
.ink-danger { color: var(--danger-ink); }
.fw6 { font-weight: 600; }
.fw7 { font-weight: 700; }

/* 卡片内的次级小节标题（视图里是裸 <h2>，靠内联样式压住浏览器默认字号）。
   ★ app.css 没有全局 h2 规则，裸 <h2> 会拿到浏览器默认的 1.5em/21px
     和大边距，跟设计体系完全对不上，所以必须显式指定。 */
.sub-h { font-size: var(--fs-body); font-weight: 600; margin: 22px 0 10px; color: var(--ink); }

.nowrap { white-space: nowrap; }
.tr { text-align: right; }
.tc { text-align: center; }
.mt0 { margin-top: 0; }
.mt6 { margin-top: 6px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.mb12 { margin-bottom: 12px; }
.mb18 { margin-bottom: 18px; }
.hide { display: none !important; }
.flex { display: flex; }
.flex1 { flex: 1 1 auto; min-width: 0; }
.aic { align-items: center; }
.gap6 { gap: 6px; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.col2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.col3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.col-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.pager .info { font-size: var(--fs-base); color: var(--ink3); }
.pager .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink3); }
.legend .li { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 9px; height: 9px; border-radius: 2px; }

/* ============================================================
   响应式断点
   ------------------------------------------------------------
   ★ 后台本来是纯桌面版式（固定 256px 侧边栏），没有任何断点。
     1280×800 是很常见的笔记本分辨率，实测在这个宽度下：
       - 工作台「今日待办」三列卡片每张只剩 234px，表格里的企业名被挤成竖条；
       - 页头操作按钮行整排冲出版心。
     所以补两个断点：三列栅格在窄屏退成两列/一列，而不是硬挤。
   ============================================================ */
@media (max-width: 1400px) {
  .col3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .col3 { grid-template-columns: minmax(0, 1fr); }
  .col-2-1 { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .sidebar, .topbar, .page-head .acts, .filters, .pager, .row-acts { display: none !important; }
  .main { margin-left: 0; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; }
}
.task-counts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.task-board { display: grid; grid-template-columns: repeat(4,minmax(220px,1fr)); gap: 12px; padding: 16px; overflow: auto; }
.task-column { background: var(--bg); border-radius: 10px; padding: 12px; min-height: 180px; }
.task-tile { display: flex; flex-direction: column; text-align: left; width: 100%; gap: 8px; margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; }
.task-tile span { font-size: var(--fs-sm); color: var(--ink2); }

/* 项目沟通回复框 */
textarea[data-question-reply]{display:block;box-sizing:border-box;width:100%;min-height:128px;padding:12px;line-height:1.6;margin-bottom:12px;resize:vertical}

.visit-history{max-height:min(45vh,420px);overflow-y:auto;padding-right:6px;overscroll-behavior:contain}

.retro-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.8}.retro-row{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line);flex-wrap:wrap}.retro-history{max-height:60vh;overflow-y:auto;padding-right:8px}

.retro-card{padding:24px}.retro-card h2:first-child{margin-top:0}

.favorite-card{padding:24px}.favorite-card h2:first-child{margin-top:0}.favorite-row{display:flex;gap:16px;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding:16px 0;flex-wrap:wrap}.favorite-row>div{min-width:0;flex:1;overflow-wrap:anywhere}.favorite-row .muted{margin-top:8px}

.business-contact-card{padding:24px}.business-contact-text{white-space:pre-wrap;overflow-wrap:anywhere;user-select:text;line-height:1.8}

.business-contact-card h2:first-child{margin-top:0}

.knowledge-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.8;margin:12px 0}

.fld[data-fld="body"] textarea{min-height:260px}

.company-profile-data .kv .k{flex-basis:160px}.company-profile-data .kv .v{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:700px){.company-profile-data .kv .k{flex-basis:130px}}
.certificate-row{padding:16px;border-bottom:1px solid var(--n100);overflow-wrap:anywhere}.certificate-row details{white-space:normal}.certificate-row .kv .v{white-space:pre-wrap}

/* 企业导入预览容纳全部字段，长文件只滚动正文。 */
.modal.client-import-modal { max-width: 1080px; min-width: 0; }
.client-import-modal .modal-body { max-height: 72vh; overflow-y: auto; }
.client-import-modal [data-client-csv], .client-import-modal [data-cycle-csv], .client-import-modal [data-project-csv] { display: block; width: 100%; height: 132px; min-height: 100px; margin: 12px 0; resize: vertical; }
.client-import-modal [data-client-file], .client-import-modal [data-cycle-file], .client-import-modal [data-project-file] { max-width: 100%; margin-left: 10px; }
.client-import-modal table { min-width: 960px; }
.client-import-modal td { vertical-align: top; overflow-wrap: anywhere; }
.client-import-modal .modal-foot { flex-wrap: wrap; }
