/* =============================================================================
 * theme-override.css · 昊翔管家全局企业设计语言（Design System）覆盖层
 * -----------------------------------------------------------------------------
 * 由 src/middleware/static.js 在服务端统一注入：门户 + 五大子系统
 * （base / fina / che2 / kehu / yygj）的每个 HTML <head> 末尾自动挂接，
 * 子系统业务源码零改动。
 *
 * 设计基调：现代 B2B 商业 SaaS —— 中性灰白底、纯白卡片、商务蓝主色，
 *           细边框、弱投影、小圆角；彻底消除浅粉/玫红「玩具感」。
 *
 * 两层覆盖策略：
 *   ① 令牌层（:root）：各系统「颜色/圆角/阴影一律走 CSS 变量」，重定义同名变量即可
 *      整体换肤；:root 与子系统根块同特异性，本文件在 head 末尾加载故胜出。
 *      夜间主题（html[data-theme=night]）特异性更高，独立打开时仍可切换，不受影响。
 *   ② 组件层：少数硬编码粉色（类规则 / 内联 style / SVG 图表属性）用定向选择器收口。
 * ========================================================================== */

:root{
  /* ---- 字体：统一现代无衬线中西文系统字体栈 ---- */
  --ff-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
             "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --ff-serif: var(--ff-sans);   /* 标题不再走宋体衬线，全部无衬线 */
  --ff-num: var(--ff-sans);     /* 大数字同栈，tabular-nums 对齐 */
  --hx-font: var(--ff-sans);    /* 共享导航 hx-nav 字体 */

  /* ---- 底色与容器：去粉底，统一中性灰白 ---- */
  --bg: #f5f7fa; --bg2: #eef2f7;
  --panel: #ffffff; --panel2: #f8fafc;
  --card: #ffffff; --card2: #f8fafc;
  --soft: #f1f5f9;

  /* ---- 边框：浅灰细边 ---- */
  --line: #e2e8f0; --line2: #e2e8f0;
  --accent-line: #cbd5e1;
  --brandLine: rgba(22,119,255,.35);

  /* ---- 文字：标题 / 正文 / 辅助 三级 ---- */
  --txt: #1e293b; --sub: #334155; --dim: #64748b;
  --text: #1e293b; --muted: #64748b; --txt2: #64748b;
  --ink: #1e293b; --ink-2: #334155;

  /* ---- 品牌主色：商务蓝 ---- */
  --accent: #1677ff; --accent2: #0958d9; --accent-d: #0958d9;
  --accent-soft: #e6f4ff; --accent-l: #e6f4ff;
  --gold: #1677ff; --gold2: #0958d9;       /* che2/yygj/工具页的「主品牌」历史名 */
  --brand: #1677ff; --brand2: #0958d9;
  --brandSoft: rgba(22,119,255,.10);
  --pri: #1677ff;
  --cyan: #08979c;                         /* 原 #f06595 粉色别名归位为青色（图表分类色） */

  /* ---- 主按钮：蓝底白字 ---- */
  --grad-pri: #1677ff; --grad-pri-txt: #ffffff;

  /* ---- 品牌别名（部分渲染器使用） ---- */
  --brand-a: #1677ff; --brand-b: #64748b; --brand-on: #ffffff;

  /* ---- 侧栏选中态（独立打开时） ---- */
  --nav-on: #e6f4ff; --nav-on-fg: #0958d9; --nav-hover: #f1f5f9;

  /* ---- 阴影：卡片弱投影；弹层中性投影 ---- */
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.08);
  --sh: var(--shadow); --sh-card: var(--shadow);
  --sh-pop: 0 12px 32px rgba(16,24,40,.16);
  --sh-btn: 0 1px 2px rgba(22,119,255,.20);
  --sh-modal: 0 12px 40px rgba(16,24,40,.18);
  --sh-drawer: -8px 0 30px rgba(16,24,40,.14);
  --sh-gb: 0 16px 48px rgba(16,24,40,.22);

  /* ---- 圆角：卡片 8 / 控件 6 ---- */
  --r: 8px; --r-ctl: 6px;

  /* ---- 语义状态色：成功 / 警告 / 危险（保留语义，统一标准值） ---- */
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --info: #1677ff;
  --ok-soft: rgba(22,163,74,.12);
  --warn-soft: rgba(217,119,6,.14);
  --bad-soft: rgba(220,38,38,.12);
  --info-soft: rgba(22,119,255,.12);
  --ok-bg: #e9f7ef; --ok-line: #b9e3c9;
  --warn-bg: #fdf1e3; --warn-line: #f5d7ad;
  --bad-bg: #fdeaea; --bad-line: #f3bcbc;

  /* ---- 共享导航 hx-nav 令牌 ---- */
  --hx-pink-bg: #f5f7fa; --hx-pink-soft: #eef2f7;
  --hx-rose: #1677ff; --hx-rose-dk: #0958d9; --hx-rose-lite: #91caff;
  --hx-ink: #1e293b; --hx-ink-2: #334155; --hx-ink-3: #64748b;
  --hx-line: #e2e8f0; --hx-line-2: #e2e8f0; --hx-white: #ffffff;

  /* ---- 分享页历史令牌 ---- */
  --pink-bg: #f5f7fa; --rose-soft: #e6f4ff;
}

/* 工具页（roi/profit/contract/entrust）以 html[data-theme=light] 声明令牌，
   特异性高于 :root；给一份同特异性、加载更晚的同值块收口。 */
html[data-theme="light"]{
  --bg: #f5f7fa; --bg2: #eef2f7;
  --panel: #ffffff; --panel2: #f8fafc;
  --soft: #f1f5f9;
  --line: #e2e8f0;
  --txt: #1e293b; --sub: #334155; --dim: #64748b;
  --gold: #1677ff; --gold2: #0958d9;
  --brand: #1677ff;
  --sh: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.08);
}

/* =============================================================================
 * 一、字体强制（规范明确要求 !important）
 * ========================================================================== */
*, *::before, *::after{
  font-family: var(--ff-sans) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1,h2,h3,h4,h5,h6{ font-weight: 600; }
.num{ font-variant-numeric: tabular-nums; }

/* =============================================================================
 * 二、全局底色：body / 常见布局容器
 * ========================================================================== */
body{
  background: var(--bg) !important;
  color: var(--txt);
}
::selection{ background: rgba(22,119,255,.18); color: inherit; }

/* =============================================================================
 * 三、主操作按钮：所有「新建 / 登记 / 保存 / 提交」类统一蓝底白字
 * ========================================================================== */
.btn.pri, .btn.primary, .btn-primary,
button.primary, .ht-btn.primary,
.btn.g, .hxcolmenu .btn{
  background: #1677ff !important;
  border-color: #1677ff !important;
  color: #ffffff !important;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(22,119,255,.25);
  transition: background .15s, border-color .15s;
}
.btn.pri:hover, .btn.primary:hover, .btn-primary:hover,
button.primary:hover, .ht-btn.primary:hover,
.btn.g:hover{
  background: #4096ff !important;
  border-color: #4096ff !important;
}
.btn.pri:disabled, .btn.primary:disabled, .btn-primary:disabled{
  background: #91caff !important;
  border-color: #91caff !important;
  cursor: not-allowed;
  box-shadow: none;
}
/* 次按钮统一中性细边 */
.btn{ border-radius: 6px; }

/* =============================================================================
 * 四、卡片 / 容器：白底 + 浅灰细边 + 8px 圆角 + 弱投影
 * ========================================================================== */
.card, .panel, .bsys, .sfield, .lcard{
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.08);
}

/* =============================================================================
 * 五、表单控件：聚焦时蓝色描边 + 柔和蓝色光环
 * ========================================================================== */
input, select, textarea{ border-radius: var(--r-ctl); }
input:focus, select:focus, textarea:focus{
  border-color: #1677ff !important;
  box-shadow: 0 0 0 3px rgba(22,119,255,.12) !important;
  outline: none;
}
/* 复选/单选/范围滑块蓝色 */
input[type="checkbox"], input[type="radio"]{ accent-color: #1677ff; }
input[type="range"]{ accent-color: #1677ff; }

/* =============================================================================
 * 六、表格：表头中性浅灰底
 * ========================================================================== */
table th, .gtable th, .ht-tb thead th{
  background: #f8fafc !important;
  color: #334155;
  font-weight: 600;
}

/* =============================================================================
 * 七、标签 / 徽章：语义色保留，中性标签收敛为浅蓝；去「.pink」粉标签
 * ========================================================================== */
.tag{
  display: inline-flex; align-items: center;
  border-radius: 4px; padding: 1px 8px;
  font-size: 12px; line-height: 1.7;
  border: 1px solid #91caff;
  background: #e6f4ff; color: #1677ff;
}
.tag.ok{ background: #e9f7ef; color: #15803d; border-color: #b9e3c9; }
.tag.warn{ background: #fdf1e3; color: #b45309; border-color: #f5d7ad; }
.tag.bad{ background: #fdeaea; color: #b91c1c; border-color: #f3bcbc; }
.tag.info{ background: #e6f4ff; color: #1677ff; border-color: #91caff; }
.tag.pink{ background: #e6f4ff !important; color: #1677ff !important; border-color: #91caff !important; }

/* =============================================================================
 * 八、标题装饰小竖条：统一品牌蓝（变量已换色，此处直接兜底）
 * ========================================================================== */
.sec-title::before, .ghead .gt::before,
.box h3::before, .card h3::before, .sect-t::before,
.dlg h3::before, .mcard h4::before,
.ord-grid .ord-sec::before, .rgrp>h3::before,
.card .ct::before, .grp-t::before{
  background: #1677ff !important;
}
.tl::before{ background: #1677ff !important; }
.tl .ev::before{ background: #1677ff !important; }

/* =============================================================================
 * 九、图表去粉
 * -----------------------------------------------------------------------------
 * SVG 表现属性（fill/stroke）优先级最低，任何匹配的 CSS 规则都能覆盖，
 * 无需改生成图表的业务 JS。玫红/粉色系列 → 蓝色系。
 * ========================================================================== */
svg [fill="#d6336c"], svg [stroke="#d6336c"]{ fill: #1677ff; stroke: #1677ff; }
svg [fill="#f06595"]{ fill: #4096ff; }
svg [fill="#faa2c1"]{ fill: #69b1ff; }
svg [fill="#ffc9d8"]{ fill: #91caff; }
/* 单独出现时不要误改 stroke：上面 d6336c 的合并规则对仅描边元素也无害 */

/* JS 生成的内联 style（图例文字 / 进度条等）：内联样式需 !important 压制 */
a[style*="#d6336c"], span[style*="#d6336c"],
div[style*="color:#d6336c"]{ color: #1677ff !important; }
div[style*="background:#d6336c"]{ background: #1677ff !important; }
div[style*="#f4e4ea"]{ background: #e2e8f0 !important; }

/* =============================================================================
 * 十、零星硬编码粉色（变量管不到的）
 * ========================================================================== */
/* base 登录身份切换条 */
.lg-tabs{ background: #f1f5f9 !important; }

/* setpw.html：body 底色已由全局 body 规则统一；.who 信息条硬编码粉底在此收敛 */
.who{ background: #f8fafc !important; border:1px solid #e2e8f0; }

/* bill.html / payslip.html：打印按钮 .btn.g 已在主按钮规则内收敛；
   其本页 .tag 硬编码粉底由第七节 .tag 通用规则覆盖。 */

/* 分享页 share.html（独立窗口打开的对外页）：变量 --rose 在别处是语义红，
   故按该页自己的选择器定向收敛为蓝。 */
.hd b{ color: #1677ff !important; }
a.btn{ border-color: #1677ff; color: #1677ff; border-radius: 6px; }
a.btn:hover{ background: #e6f4ff; }
a.btn.solid{ background: #1677ff; border-color: #1677ff; color: #ffffff; }
a.btn.solid:hover{ background: #4096ff; border-color: #4096ff; }
#box button{
  background: #1677ff !important; border: 1px solid #1677ff !important;
  color: #ffffff !important; border-radius: 6px;
}
#box button:hover{ background: #4096ff !important; border-color: #4096ff !important; }

/* =============================================================================
 * 十一、表格行染色封杀：待办/预警类行严禁整行刷粉红底
 * -----------------------------------------------------------------------------
 * 成熟企业级 SaaS 的行级强调只允许两种形态：
 *   ① 整行底色 = 纯白或柔和中性浅灰（#f8fafc），悬停 #f1f5f9；
 *   ② 强调集中在数字本身（红底白字小胶囊徽章，见各页 .nbadge / .cnt-badge）。
 * 任何历史代码用 warn/alert/pending/danger 类名或 .bg-pink 给整行刷粉（#fff1f2 /
 * #fee2e2 / rgba(255,0,0,*) 一族）都在此被强制拦下，杜绝再次冒头。
 * ========================================================================== */
tr[class*="warn"], tr[class*="alert"], tr[class*="pending"], tr[class*="danger"],
.table-row-warn, .table-row-alert, .has-todo, .bg-pink {
  background-color: #f8fafc !important;
}
tr[class*="warn"]:hover, tr[class*="alert"]:hover,
tr[class*="pending"]:hover, tr[class*="danger"]:hover,
.table-row-warn:hover, .table-row-alert:hover, .has-todo:hover, .bg-pink:hover {
  background-color: #f1f5f9 !important;
}
/* 悬停也禁止粉色系：一律收敛到中性浅灰蓝 */
tr:hover td{ background: #f7f9fc !important; }
