/* ==========================================================================
   乐火传媒 CRM · 视觉主题（theme.css）
   加载顺序：bootstrap → style.css → ui.css → theme.css（本文件最后）
   职责：① 重定义设计 token（顺带覆盖 ui.css 的 --ui-* 变量，抽屉/提示/面板自动跟随）
        ② 重画外壳：侧栏 / 顶栏 / 内容区
        ③ 统一 Bootstrap 组件外观：卡片、表格、按钮、表单、弹窗、页签、进度条
   原则：只在「页面标题」处使用品牌强调色，其余靠留白与层次；圆角与大留白是主要性格。
   ========================================================================== */

/* ---------- 1. token ---------- */
:root {
  /* 墨色三级 + 纸面（暖调深咖墨，与纸面/侧栏同族） */
  --ink:        #241B13;
  --ink-2:      #57504A;
  --ink-3:      #94897D;
  /* 灰阶别名：dashboard 等页面历史代码引用 --ink-900/500/400，统一到主令牌 */
  --ink-900:    #241B13;
  --ink-500:    #57504A;
  --ink-400:    #94897D;
  --paper:      #F4F2EC;
  --paper-2:    #FBFAF6;
  --card:       #FFFFFF;
  --line:       #E7E3D8;
  --line-2:     #F1EEE6;

  /* 功能主色：陶土橙全族（按钮、链接、进度、徽章、表格交互统一走这里） */
  --jade:       #C0552F;
  --jade-700:   #A8431F;
  --jade-300:   #D4704A;
  --jade-soft:  #F7E8DF;

  /* 强调：陶土橙，只用于品牌标记与标题细线 */
  --ember:      #C0552F;
  --ember-soft: #FBEDE6;

  /* 语义色（去松绿统一暖调：正向用深陶土、警示用红） */
  --ok:         #A8431F;
  --ok-soft:    #F7E8DF;
  --danger:     #C4402C;
  --danger-soft:#FBEAE7;
  --warn:       #A26F14;
  --warn-soft:  #FBF1DC;
  --info:       #2C6377;
  --info-soft:  #E8F1F4;

  /* 圆角 */
  --r-xs: 8px;  --r-sm: 10px; --r: 12px;
  --r-lg: 16px; --r-xl: 20px; --r-2xl: 24px; --pill: 999px;

  /* 阴影：暖调、低对比，靠层次不靠描边 */
  --sh-1: 0 1px 2px rgba(30, 22, 16, .04), 0 4px 14px -8px rgba(30, 22, 16, .10);
  --sh-2: 0 2px 4px rgba(30, 22, 16, .04), 0 14px 32px -16px rgba(30, 22, 16, .16);
  --sh-3: 0 8px 18px rgba(30, 22, 16, .06), 0 32px 64px -24px rgba(30, 22, 16, .28);

  /* 节奏 */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t: 180ms var(--ease);
  --sidebar-w: 228px;

  /* —— 让 ui.css 的交互组件（抽屉/提示/面板/页签）自动换肤 —— */
  --ui-ink: var(--ink);
  --ui-ink2: var(--ink-2);
  --ui-ink3: var(--ink-3);
  --ui-line: var(--line);
  --ui-line2: var(--line-2);
  --ui-bg: var(--paper);
  --ui-card: var(--card);
  --ui-primary: var(--jade);
  --ui-primary-soft: var(--jade-soft);
  --ui-success: var(--ok);
  --ui-success-soft: var(--ok-soft);
  --ui-warn: var(--warn);
  --ui-warn-soft: var(--warn-soft);
  --ui-danger: var(--danger);
  --ui-danger-soft: var(--danger-soft);
  --ui-shadow-1: var(--sh-1);
  --ui-shadow-2: var(--sh-2);
  --ui-shadow-3: var(--sh-3);
  --ui-r: var(--r);
  --ui-ease: var(--ease);

  /* Bootstrap 变量对齐：避免默认蓝混进来 */
  --bs-primary: #C0552F;
  --bs-primary-rgb: 192, 85, 47;
  --bs-body-color: #241B13;
  --bs-body-bg: #F4F2EC;
  --bs-border-color: #E7E3D8;
  --bs-border-radius: 12px;
  --bs-border-radius-sm: 10px;
  --bs-border-radius-lg: 16px;
  --bs-link-color: #C0552F;
  --bs-link-hover-color: #A8431F;

  /* dashboard 历史变量别名（原 --radius/--brand 未定义导致样式静默失效） */
  --radius: var(--r-xl);
  --brand: var(--jade);
}

/* ---------- 2. 基础 ---------- */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 100% -8%, rgba(192, 85, 47, .07), transparent 62%),
    radial-gradient(760px 420px at -6% 102%, rgba(192, 85, 47, .05), transparent 58%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--jade); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--jade-700); }

h1, h2, h3, h4, h5, h6 { color: var(--ink); letter-spacing: -.012em; }
h5, h6 { font-weight: 650; }
strong, b { font-weight: 650; }
small { font-size: 12px; }
hr { border-color: var(--line); opacity: 1; }

::selection { background: rgba(192, 85, 47, .16); }

:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: #D6D1C4 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #D6D1C4; border-radius: var(--pill);
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #C2BBA9; background-clip: content-box; }

/* ---------- 3. 外壳：侧栏 ---------- */
body .layout { display: flex; align-items: stretch; min-height: 100vh; }

body .sidebar {
  position: fixed;
  left: 12px; top: 12px; bottom: 12px;
  width: var(--sidebar-w);
  z-index: 1040;
  display: flex; flex-direction: column;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: var(--r-2xl);
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(192, 85, 47, .20) 0%, rgba(58, 30, 16, 0) 58%),
    linear-gradient(180deg, #2C211A 0%, #1F1610 100%);
  box-shadow: 0 18px 40px -22px rgba(46, 26, 12, .55), 0 2px 6px rgba(46, 26, 12, .28);
  overflow: hidden;
  transition: transform 260ms var(--ease);
}

body .sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
body .sidebar .brand .logo {
  flex: none; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, #D4704A 0%, #A8431F 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 14px -8px rgba(0, 0, 0, .8);
}
body .sidebar .brand .t {
  font-size: 13.5px; font-weight: 650; color: #F6EFE6; line-height: 1.35; letter-spacing: .01em;
}
body .sidebar .brand .t small {
  display: block; font-size: 10.5px; font-weight: 400;
  color: rgba(240, 228, 212, .5); letter-spacing: .04em; margin-top: 2px;
}

body .sidebar .nav-wrap {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px 10px 16px;
  scrollbar-width: none;
}
/* 只有真的滚不动还有内容时，才在底部做淡出（否则最后一项永远像被切了一半） */
body .sidebar .nav-wrap.is-scroll:not(.at-end) {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%);
}
body .sidebar .nav-wrap::-webkit-scrollbar { width: 0; }

body .sidebar .nav-group { margin-bottom: 4px; }
body .sidebar .nav-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  color: rgba(236, 222, 202, .36);
  padding: 11px 12px 5px;
  text-transform: none;
}

body .sidebar .nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 11px;
  margin-bottom: 1px;
  border-radius: 11px;
  font-size: 13px; font-weight: 500;
  color: rgba(242, 232, 218, .84);
  letter-spacing: .01em;
  transition: background var(--t), color var(--t), transform var(--t);
}
body .sidebar .nav-link i { font-size: 15px; width: 17px; text-align: center; opacity: .9; transition: opacity var(--t); }
body .sidebar .nav-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body .sidebar .nav-link:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}
body .sidebar .nav-link:hover i { opacity: 1; }
body .sidebar .nav-link:active { transform: scale(.985); }

body .sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(192, 85, 47, .55) 0%, rgba(255, 255, 255, .10) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 8px 18px -14px #000;
}
body .sidebar .nav-link.active i { opacity: 1; }
body .sidebar .nav-link.active::before {
  content: ""; position: absolute; left: 3px; top: 50%;
  width: 3px; height: 16px; margin-top: -8px;
  border-radius: var(--pill); background: var(--ember);
}
body .sidebar .nav-link .badge {
  margin-left: auto; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: var(--pill);
  background: var(--ember) !important; color: #fff;
}

body .sidebar .sidebar-foot {
  padding: 11px 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: rgba(238, 226, 210, .48);
  font-size: 11px; line-height: 1.7;
}
body .sidebar .sidebar-foot .sf-title {
  display: flex; align-items: center; gap: 6px;
  color: rgba(246, 238, 226, .88); font-size: 11.5px; font-weight: 600;
  margin-bottom: 4px;
}
body .sidebar .sidebar-foot .sf-title i { color: #D98F6A; font-size: 12px; }
body .sidebar .sidebar-foot .sf-sub { color: rgba(238, 226, 210, .44); }
body .sidebar .sidebar-foot .sf-sub strong { color: rgba(248, 240, 228, .92) !important; font-weight: 600; }

body .sidebar-mask {
  position: fixed; inset: 0; z-index: 1035;
  background: rgba(14, 24, 20, .42);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}
body .sidebar-mask.show { opacity: 1; visibility: visible; }

/* ---------- 4. 外壳：主区 + 顶栏 ---------- */
body .main {
  flex: 1; min-width: 0;
  margin-left: calc(var(--sidebar-w) + 24px);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

body .topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 62px; padding: 0 26px;
  background: rgba(244, 242, 236, .82);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(231, 227, 216, .9);
}

body .topbar .crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-3); min-width: 0;
}
body .topbar .crumb > span { white-space: nowrap; }
body .topbar .crumb strong {
  color: var(--ink-2); font-weight: 600;
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  padding: 2px 9px; border-radius: var(--pill);
  font-size: 11.5px;
}
body .topbar .crumb .ui-crumb-now {
  color: var(--ink); font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body .topbar .menu-toggle {
  display: none;
  width: 34px; height: 34px; border: 1px solid var(--line);
  background: #fff; border-radius: var(--r-sm);
  color: var(--ink-2); place-items: center; font-size: 16px;
}

body .topbar .who { display: flex; align-items: center; gap: 10px; }
body .topbar .who > a {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  color: var(--ink-3); font-size: 15px;
  transition: background var(--t), color var(--t);
}
body .topbar .who > a:hover { background: rgba(255, 255, 255, .9); color: var(--ink); }

body .topsearch {
  position: relative;
  display: flex; align-items: center;
  width: 258px; height: 36px;
  padding: 0 10px 0 32px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  transition: border-color var(--t), box-shadow var(--t), background var(--t), width var(--t);
}
body .topsearch:focus-within {
  width: 300px;
  background: #fff;
  border-color: rgba(192, 85, 47, .45);
  box-shadow: 0 0 0 3px rgba(192, 85, 47, .10);
}
body .topsearch > i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--ink-3); pointer-events: none;
}
body .topsearch input {
  width: 100%; height: 100%;
  border: 0; background: none; outline: none;
  font-size: 12.5px; color: var(--ink); padding: 0 !important;
}
body .topsearch input::placeholder { color: #A9B2AC; }
body .topsearch .ui-kbd {
  position: static; transform: none;
  margin-left: 6px;
  font-size: 10px; letter-spacing: .04em;
  color: var(--ink-3); background: #F5F3EC;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 5px; line-height: 1.5;
}
body .topsearch .ui-search-clear { position: absolute; right: 9px; }
body .topsearch .ui-search-count { position: absolute; right: 34px; background: #F1EEE6; }

body .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 11px 3px 3px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  border-radius: var(--pill);
}
body .user-chip .avatar {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; color: #fff;
  background: linear-gradient(145deg, #D4704A, #A8431F);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
body .user-chip .uc-name {
  display: flex; flex-direction: column; line-height: 1.2;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
body .user-chip .uc-name small { font-size: 10.5px; font-weight: 400; color: var(--ink-3); }

/* ---------- 5. 内容区 ---------- */
body .content {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 26px 56px;
  transition: opacity 160ms linear;
}
body .content.ui-loading { opacity: .45; pointer-events: none; }

/* 局部刷新换页时，正文轻轻上浮入场（一次性，不重复打扰） */
@keyframes ui-page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
body .content.ui-enter > * { animation: ui-page-in 240ms var(--ease) both; }
body .content.ui-enter > *:nth-child(2) { animation-delay: 24ms; }
body .content.ui-enter > *:nth-child(3) { animation-delay: 48ms; }
body .content.ui-enter > *:nth-child(n+4) { animation-delay: 60ms; }

body .footer-note {
  margin-top: 26px; padding-top: 16px;
  border-top: 1px solid var(--line-2);
  font-size: 11px; color: var(--ink-3); text-align: center; letter-spacing: .02em;
}

/* 页面标题：全站唯一使用品牌强调色的地方 */
body .page-title {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  margin: 2px 0 18px;
  font-size: 19px; font-weight: 650; letter-spacing: -.015em;
  color: var(--ink);
}
body .page-title > span:first-child,
body .page-title > *:first-child {
  position: relative; padding-bottom: 7px;
}
body .page-title > span:first-child::after,
body .page-title > *:first-child::after {
  content: ""; position: absolute; left: 1px; bottom: 0;
  width: 26px; height: 2px; border-radius: var(--pill);
  background: var(--ember);
}
body .page-title .btn { font-weight: 500; }

/* 桌面宽屏下隐藏顶栏「当前页面名」：每个页面本身有大标题，面包屑页名纯属重复；
   「当前岗位」保留，移动端侧栏收起、页名不可见时仍显示。 */
@media (min-width: 992px) {
  body .topbar .crumb .ui-crumb-now { display: none; }
}

/* 详情页头部：左对齐专业排版——名称 22px 加粗 + 状态徽章同行，
   meta 行「标签：值」以弱化标签 + 加粗值呈现，标签间留均匀间距 */
body .dtl-head { flex: 1 1 auto; min-width: 0; }
body .dtl-name { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
body .dtl-meta { font-size: 12.5px; color: var(--ink-3); line-height: 2; margin-top: 6px; }
body .dtl-meta b { font-weight: 600; color: var(--ink); }
body .dtl-meta .mi { display: inline-block; margin-right: 22px; white-space: nowrap; }
body .dtl-meta .mi:last-child { margin-right: 0; }

/* 详情页（客户详情、商机详情）会同时渲染「模块标题 + 详情标题」，
   两个同字号标题各带一条强调线，层级直接被压平、还白占一行高度。
   命中「后面还有 .page-title」时把前一个降级成眉题，详情标题才是页面主角。 */
body .content > .page-title:has(~ .page-title) {
  margin: 0 0 6px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .04em;
  color: var(--ink-3);
}
body .content > .page-title:has(~ .page-title) > span:first-child,
body .content > .page-title:has(~ .page-title) > *:first-child { padding-bottom: 0; }
body .content > .page-title:has(~ .page-title) > span:first-child::after,
body .content > .page-title:has(~ .page-title) > *:first-child::after { display: none; }
body .content > .page-title:has(~ .page-title) .btn {
  font-size: 12px; padding: 3px 10px; border-radius: var(--pill);
}

/* 标题直接写文字（没有子元素）时，用背景画出同一条强调线 */
body .page-title:not(:has(*)) {
  display: block;
  padding-bottom: 8px;
  background: linear-gradient(var(--ember), var(--ember)) 1px 100% / 26px 2px no-repeat;
}

/* ---------- 6. 卡片与面板 ---------- */
body .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: box-shadow var(--t), transform var(--t);
}
body .card.mb-3 { margin-bottom: 16px !important; }
body .card-body { padding: 18px 20px; }
body .card-header {
  background: transparent; border-bottom: 1px solid var(--line-2);
  padding: 14px 20px; font-weight: 600; font-size: 13.5px;
}
body .card-footer {
  background: var(--paper-2); border-top: 1px solid var(--line-2);
  padding: 12px 20px;
}

body .detail-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  padding: 18px 20px;
  margin-bottom: 16px;
  overflow: hidden;
}
body .detail-block > h6 {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 650; margin: 0 0 12px;
  padding-bottom: 11px; border-bottom: 1px solid var(--line-2);
  color: var(--ink);
}
body .detail-block > h6::before {
  content: ""; width: 6px; height: 6px; border-radius: 2px;
  background: var(--jade-300); flex: none;
}

/* 指标卡（dashboard / 交付看板 / 财务 / 报表）。
   图标由 style.css 的 .stat-card::before 提供（左侧彩色图标块，蓝/绿/橙/紫按位置循环），
   这里的布局必须给它留出左侧空间（padding-left ≥ 图标右缘），否则图标会压住数字。 */
body .stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--sh-1);
  padding: 12px 16px 12px 72px;
  min-height: 68px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
  height: 100%;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
body .stat-card:hover { transform: translateY(-1px); box-shadow: var(--sh-2); border-color: #DFDACC; }
body .stat-card .num {
  font-size: 21px; font-weight: 680; line-height: 1.2;
  letter-spacing: -.02em; color: var(--ink);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  position: relative; z-index: 1;
}
body .stat-card .lbl {
  font-size: 11.5px; color: var(--ink-3); margin-top: 3px; letter-spacing: .01em;
  position: relative; z-index: 1;
}
/* 图标块在 style.css 里定位（left:18px / 42×42），窄屏整体缩小一档，避免挤压数字 */
@media (max-width: 575.98px) {
  body .stat-card { padding: 10px 12px 10px 56px; min-height: 60px; }
  body .stat-card::before { left: 12px !important; width: 34px !important; height: 34px !important; font-size: 16px !important; border-radius: 10px !important; }
  body .stat-card .num { font-size: 18px; }
}
body .stat-card .num.text-primary { color: var(--jade) !important; }
body .stat-card .num.text-danger  { color: var(--danger) !important; }
body .stat-card .num.text-success { color: var(--ok) !important; }
body .stat-card .num.text-warning { color: var(--warn) !important; }

body .db-card { border-radius: var(--r-xl); }
body .db-card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 650; margin-bottom: 10px; color: var(--ink);
}
body .db-muted { color: var(--ink-3); font-size: 12px; }
body .db-kpi-mom { font-size: 11.5px; font-weight: 600; }
body .db-kpi-mom.up { color: var(--danger); }     /* 涨=红 */
body .db-kpi-mom.down { color: var(--ok); }       /* 跌=绿 */
body .db-tablewrap { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line-2); }
body .db-chart { border-radius: var(--r-lg); overflow: hidden; }
body .db-av {
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 650; color: #fff;
  background: linear-gradient(145deg, #D4704A, #A8431F);
}
body .db-empty {
  padding: 34px 16px; text-align: center;
  color: var(--ink-3); font-size: 12.5px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--paper-2);
}

/* 键值列表（详情页 kv）：干净行式，不再用色块拼格子 */
body .kv {
  display: flex; align-items: baseline; gap: 12px;
  background: none; border-radius: 0; overflow: visible;
  padding: 8px 0; border-bottom: 1px dashed var(--line-2);
}
body .kv:last-child { border-bottom: 0; }
body .kv > * { background: transparent; padding: 0; }
body .kv .k { flex: 0 0 92px; font-size: 11.5px; color: var(--ink-3); }
body .kv .t {
  font-size: 13px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* 筛选条 */
body .filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 14px; margin-bottom: 14px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

/* ---------- 7. 表格 ---------- */
body .table { margin: 0; color: var(--ink); --bs-table-bg: transparent; }
body .table > :not(caption) > * > * { padding: 11px 14px; }
body .table-sm > :not(caption) > * > * { padding: 8px 12px; }

body .table > thead th {
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  color: var(--ink-3);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}
body .table > tbody > tr > td {
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
body .table > tbody > tr:last-child > td { border-bottom: 0; }
body .table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: transparent;
  background: #FAF8F2;
}
body .table > tbody > tr.ui-rowlink { cursor: pointer; }
body .table td .btn { vertical-align: middle; }
body .table .text-muted, body .table small { color: var(--ink-3) !important; }

body .table-responsive { border-radius: inherit; }

/* 数字列用等宽数字 */
body .table td.num, body .table td .num, body .ui-num,
body .table td .money, body .stat-card .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* 粘性表头（ui.js 会加这个类） */
body .table-responsive.ui-sticky-head,
body .ui-sticky-head .table-responsive { max-height: 68vh; overflow: auto; }
body .ui-sticky-head thead th,
body .table-responsive.ui-sticky-head thead th {
  position: sticky; top: 0; z-index: 2;
  background: #F7F5EE;
  box-shadow: inset 0 -1px 0 var(--line);
}

/* ---------- 8. 按钮 ---------- */
body .btn {
  --bs-btn-border-radius: var(--pill);
  border-radius: var(--pill);
  font-size: 13px; font-weight: 500; line-height: 1.5;
  padding: 6px 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t), transform var(--t);
  box-shadow: none;
}
body .btn:active { transform: translateY(.5px); }
body .btn-sm { font-size: 12px; padding: 4px 11px; }
body .btn-lg { font-size: 14px; padding: 9px 20px; }
body .btn i { font-size: .95em; line-height: 1; }

body .btn-primary {
  --bs-btn-bg: var(--jade);
  --bs-btn-border-color: var(--jade);
  --bs-btn-hover-bg: var(--jade-700);
  --bs-btn-hover-border-color: var(--jade-700);
  --bs-btn-active-bg: var(--jade-700);
  --bs-btn-active-border-color: var(--jade-700);
  --bs-btn-disabled-bg: #D9A088;
  --bs-btn-disabled-border-color: #D9A088;
  color: #fff;
  box-shadow: 0 1px 2px rgba(168, 67, 31, .18), inset 0 1px 0 rgba(255, 255, 255, .12);
}
body .btn-primary:hover { box-shadow: 0 4px 12px -6px rgba(168, 67, 31, .55), inset 0 1px 0 rgba(255, 255, 255, .12); }

body .btn-outline-primary {
  --bs-btn-color: var(--jade);
  --bs-btn-border-color: #CBDDD8;
  --bs-btn-hover-bg: var(--jade-soft);
  --bs-btn-hover-color: var(--jade-700);
  --bs-btn-hover-border-color: #D9A088;
  --bs-btn-active-bg: var(--jade-soft);
  --bs-btn-active-color: var(--jade-700);
  --bs-btn-active-border-color: #D9A088;
  background: #fff;
}

body .btn-outline-secondary {
  --bs-btn-color: var(--ink-2);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: #F7F5EE;
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: #DCD6C7;
  --bs-btn-active-bg: #F1EEE5;
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-border-color: #DCD6C7;
  background: #fff;
}

body .btn-secondary {
  --bs-btn-bg: #EDEAE1; --bs-btn-border-color: #EDEAE1;
  --bs-btn-hover-bg: #E4E0D5; --bs-btn-hover-border-color: #E4E0D5;
  color: var(--ink-2);
}

body .btn-success {
  --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok);
  --bs-btn-hover-bg: #8E3418; --bs-btn-hover-border-color: #8E3418;
  --bs-btn-active-bg: #8E3418; --bs-btn-active-border-color: #8E3418;
}
body .btn-danger {
  --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger);
  --bs-btn-hover-bg: #A83624; --bs-btn-hover-border-color: #A83624;
  --bs-btn-active-bg: #A83624; --bs-btn-active-border-color: #A83624;
}
body .btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-border-color: #EFCDC6;
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-color: #A83624;
  --bs-btn-hover-border-color: #E3B3A9;
  background: #fff;
}
body .btn-warning {
  --bs-btn-bg: var(--warn); --bs-btn-border-color: var(--warn);
  --bs-btn-hover-bg: #8C5F0F; --bs-btn-hover-border-color: #8C5F0F;
  color: #fff;
}
body .btn-light {
  --bs-btn-bg: #fff; --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: #F7F5EE; --bs-btn-hover-border-color: #DCD6C7;
  color: var(--ink-2);
}
body .btn-link { color: var(--jade); text-decoration: none; padding: 0 2px; }
body .btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }

body .btn-close {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background-size: 12px; opacity: .45;
  transition: opacity var(--t), background-color var(--t);
}
body .btn-close:hover { opacity: .8; background-color: #F3F0E8; }

/* ---------- 9. 表单 ---------- */
body .form-label {
  font-size: 12px; font-weight: 550; color: var(--ink-2);
  margin-bottom: 5px; letter-spacing: .01em;
}
body .form-control, body .form-select {
  font-size: 13px; color: var(--ink);
  min-height: 38px; padding: 7px 12px;
  background-color: #FDFCF9;
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
body .form-control-sm, body .form-select-sm {
  min-height: 32px; padding: 4px 10px; font-size: 12.5px; border-radius: var(--r-sm);
}
body .form-control::placeholder { color: #AFB7B1; }
body .form-control:focus, body .form-select:focus {
  background-color: #fff;
  border-color: rgba(192, 85, 47, .55);
  box-shadow: 0 0 0 3px rgba(192, 85, 47, .10);
  color: var(--ink);
}
body .form-control:disabled, body .form-select:disabled { background: #F4F2EC; color: var(--ink-3); }
body textarea.form-control { min-height: 84px; line-height: 1.6; }
body .form-check-input { border-color: #D8D3C5; border-radius: 6px; }
body .form-check-input:checked { background-color: var(--jade); border-color: var(--jade); }
body .form-check-input:focus { box-shadow: 0 0 0 3px rgba(192, 85, 47, .12); border-color: rgba(192, 85, 47, .5); }
body .form-check-label { font-size: 13px; }
body .input-group { border-radius: var(--r); }
body .input-group-text {
  background: #F7F5EE; border-color: var(--line); color: var(--ink-3);
  font-size: 12.5px; border-radius: var(--r);
  padding: 0 11px; display: flex; align-items: center;
}
/* 输入组拼成一个整体：只在最外侧保留圆角与边框，中间不留接缝 */
body .input-group > .input-group-text:first-child {
  border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0;
}
body .input-group > .input-group-text:last-child {
  border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0;
}
body .input-group > .form-control:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
body .input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
body .input-group > .form-control:first-child { border-top-left-radius: var(--r); border-bottom-left-radius: var(--r); }
body .input-group > .form-control:last-child,
body .input-group > .form-select:last-child { border-top-right-radius: var(--r); border-bottom-right-radius: var(--r); }
body .input-group > .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
body .form-text { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 10. 徽标 / 进度 / 提示 ---------- */
body .badge {
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  padding: 3px 8px; border-radius: var(--pill);
  vertical-align: middle;
}
body .text-bg-primary { background: var(--jade-soft) !important; color: var(--jade-700) !important; }
body .text-bg-secondary { background: #EFECE3 !important; color: var(--ink-2) !important; }
body .text-bg-success { background: var(--ok-soft) !important; color: var(--ok) !important; }
body .text-bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
body .text-bg-warning { background: var(--warn-soft) !important; color: var(--warn) !important; }
body .text-bg-info { background: var(--info-soft) !important; color: var(--info) !important; }
body .badge.bg-success { background: var(--ok-soft) !important; color: var(--ok) !important; }
body .badge.bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
body .badge.bg-warning { background: var(--warn-soft) !important; color: var(--warn) !important; }

body .progress {
  height: 7px; border-radius: var(--pill);
  background: #EFECE3; overflow: hidden;
}
body .progress-bar { border-radius: var(--pill); font-size: 0; transition: width 400ms var(--ease); }
body .progress-bar.bg-success { background: var(--ok) !important; }
body .progress-bar.bg-danger { background: var(--danger) !important; }
body .progress-bar.bg-warning { background: var(--warn) !important; }
body .progress-bar.bg-primary { background: var(--jade) !important; }

body .alert {
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  font-size: 13px; padding: 12px 15px;
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--ink);
}
body .alert-danger { background: var(--danger-soft); border-color: #F2D3CC; color: #8E2E1F; }
body .alert-warning { background: var(--warn-soft); border-color: #EFDFBC; color: #7C5510; }
body .alert-success { background: var(--ok-soft); border-color: #EED3C2; color: #8E3418; }
body .alert-info { background: var(--info-soft); border-color: #CFE1E8; color: #235263; }

/* 语义文字色 */
body .text-primary { color: var(--jade) !important; }
body .text-success { color: var(--ok) !important; }
body .text-danger { color: var(--danger) !important; }
body .text-warning { color: var(--warn) !important; }
body .text-muted { color: var(--ink-3) !important; }

/* ---------- 11. 弹窗 / 页签 ---------- */
/* 默认弹窗贴顶 28px，大屏上像「掉」在页面顶部；统一改成垂直居中（内容超高时自动可滚） */
body .modal .modal-dialog {
  display: flex; align-items: center;
  min-height: calc(100% - 4rem);
  margin: 2rem auto;
}
body .modal .modal-content { max-height: calc(100vh - 5rem); }
body .modal .modal-body { overflow: auto; }
body .modal-content {
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
  overflow: hidden;
}
body .modal-header { border-bottom: 1px solid var(--line-2); padding: 15px 20px; }
body .modal-title { font-size: 14.5px; font-weight: 650; }
body .modal-body { padding: 18px 20px; }
body .modal-footer { border-top: 1px solid var(--line-2); padding: 12px 20px; gap: 8px; }
body .modal-backdrop.show { opacity: .32; background: #0E1814; backdrop-filter: blur(2px); }

body .nav-tabs { border-bottom: 1px solid var(--line); gap: 4px; }
body .nav-tabs .nav-link {
  border: 0; border-radius: 10px 10px 0 0;
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  padding: 8px 14px; margin-bottom: -1px;
  transition: color var(--t), background var(--t);
}
body .nav-tabs .nav-link:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
body .nav-tabs .nav-link.active {
  color: var(--jade); background: #fff; font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--jade);
}
body .tab-content { padding-top: 14px; }

/* ---------- 12. 抽屉 / 提示 / 命令面板（跟随新 token 的微调） ---------- */
body .ui-drawer {
  border-radius: var(--r-2xl) 0 0 var(--r-2xl);
  box-shadow: -24px 0 60px -30px rgba(9, 18, 14, .45);
}
body .ui-drawer-head { padding: 17px 20px; border-bottom: 1px solid var(--line-2); }
body .ui-drawer-head h6 { font-size: 14.5px; font-weight: 650; }
body .ui-drawer-body { padding: 18px 20px; }
body .ui-drawer-foot {
  padding: 13px 20px; border-top: 1px solid var(--line-2);
  background: var(--paper-2);
  display: flex; justify-content: flex-end; gap: 8px;
}
body .ui-drawer-foot .btn { min-width: 84px; }
body .ui-drawer-x { background: #F5F2EA; border-radius: var(--r-sm); }
body .ui-drawer-x:hover { background: #EDE9DE; }

body .ui-toast { border-radius: var(--r-lg); box-shadow: var(--sh-2); }

/* 抽屉打开时，提示条移到左下角：不遮挡抽屉底部的「保存」按钮 */
@media (min-width: 992px) {
  body.ui-drawer-open .ui-toasts {
    right: auto; left: 20px;
    align-items: flex-start;
  }
  body.ui-drawer-open .ui-toast { animation-name: ui-toast-in-left; }
  @keyframes ui-toast-in-left {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
  }
}
body .ui-palette-box { border-radius: var(--r-2xl); box-shadow: var(--sh-3); }
body .ui-palette-input input:focus { box-shadow: none; }

/* 页签式分段控件（ui.js 渲染的项目工作台） */
body .ui-tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  margin-bottom: 16px;
}
body .ui-tab {
  border: 0; background: none;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  padding: 6px 14px; border-radius: var(--pill);
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
body .ui-tab:hover { color: var(--ink); background: rgba(192, 85, 47, .06); }
body .ui-tab.on {
  background: var(--jade); color: #fff;
  box-shadow: 0 2px 8px -4px rgba(168, 67, 31, .7);
}

/* 行内编辑态 */
body .ui-inline {
  border: 1px dashed transparent; border-radius: var(--r-sm);
  padding: 2px 6px; cursor: text; transition: background var(--t), border-color var(--t);
}
body .ui-inline:hover { background: var(--jade-soft); border-color: rgba(192, 85, 47, .25); }
body .ui-inline.saved { background: var(--ok-soft); border-color: #EED3C2; }

/* ---------- 13. 登录页 ---------- */
body .login-bg {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(760px 520px at 12% 8%, rgba(192, 85, 47, .13), transparent 60%),
    radial-gradient(620px 420px at 92% 92%, rgba(192, 85, 47, .10), transparent 58%),
    var(--paper);
}
body .login-card {
  width: 100%; max-width: 392px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--sh-3);
  padding: 34px 32px 30px;
}
body .login-card .logo-lg {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, #D4704A, #A8431F);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24), 0 12px 26px -14px rgba(140, 58, 26, .9);
}
body .login-card h5 { font-size: 18px; letter-spacing: -.01em; }
body .login-card .input-group .form-control { height: 42px; }
body .login-card .btn-primary { height: 42px; font-size: 14px; letter-spacing: .12em; margin-top: 2px; }

/* ---------- 14. 响应式 ---------- */
@media (max-width: 1199.98px) {
  body .content { padding: 18px 20px 48px; }
}

@media (max-width: 991.98px) {
  body .main { margin-left: 0; }
  body .sidebar {
    left: 10px; top: 10px; bottom: 10px;
    width: 268px; max-width: calc(100vw - 34px);
    transform: translateX(calc(-100% - 14px));
  }
  body .sidebar.open { transform: none; }
  body .topbar { padding: 0 16px; height: 58px; }
  body .topbar .menu-toggle { display: grid; }
  body .topbar .crumb .ui-crumb-sep,
  body .topbar .crumb > span:not(.ui-crumb-now),
  body .topbar .crumb > strong { display: none; }
  /* 窄屏只留「当前页面」，且用省略号，不要折成两行 */
  body .topbar .crumb .ui-crumb-now {
    max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  body .topsearch { width: 190px; }
  body .topsearch:focus-within { width: 210px; }
  body .user-chip .uc-name { display: none; }
  body .content { padding: 16px 14px 44px; }
  body .page-title { font-size: 17px; margin-bottom: 14px; }
  body .card, body .detail-block, body .stat-card { border-radius: var(--r-lg); }
  body .table > :not(caption) > * > * { padding: 9px 11px; }
}

@media (max-width: 767.98px) {
  /* 全局防横向溢出：任何意外超宽元素都不再撑出横向滚动 */
  html, body { overflow-x: hidden; }
  /* 卡片内的宽表格改为卡片内横向滚动，不撑破页面 */
  body .db-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body .table .hide-xs,
  body .hide-xs { display: none !important; }
  body .table > thead th { white-space: nowrap; }
  /* 不强制定宽、也不许逐字断行：内容撑不下时横向滚，别把「李统筹」竖着排 */
  body .table > tbody > tr > td { white-space: nowrap; word-break: keep-all; }
  body .table > tbody > tr > td:first-child { white-space: normal; min-width: 128px; }
  /* 行操作列钉在右侧：横滑也不会把「工作台 / 详情」滑丢 */
  body .table-responsive { position: relative; }
  body .table > thead > tr > th:last-child:has(a, button),
  body .table > tbody > tr > td:last-child:has(a.btn, button.btn) {
    position: sticky; right: 0; z-index: 3;
    background: #fff;
    box-shadow: -8px 0 12px -10px rgba(24, 36, 32, .45);
  }
  body .table > thead > tr > th:last-child { background: #FBFAF5; }
  body .table > tbody > tr:hover > td:last-child:has(a.btn, button.btn) { background: #FBF9F4; }
}

@media (max-width: 575.98px) {
  body .topsearch { width: 36px; padding-left: 32px; }
  body .topsearch input { opacity: 0; }
  body .topsearch:focus-within { width: 100%; max-width: 260px; }
  body .topsearch:focus-within input { opacity: 1; }
  body .topsearch .ui-kbd { display: none; }
  body .content { padding: 14px 11px 40px; }
  /* 手机端 KPI 数字维持紧凑档（删除旧 22px 放大规则，避免与紧凑模式冲突） */
  body .btn { padding: 5px 12px; }
  /* 手机上不再强制 560 宽：次要列已隐藏，硬撑宽会让「工作台」按钮藏到屏幕外 */
  body .table-responsive > .table { min-width: 0; }
}

/* ---------- 16. 手机端紧凑模式：看板卡片 / 日历 / KPI 全面收紧，缩短页面长度 ---------- */
@media (max-width: 767.98px) {
  body .card > .card-body { padding: 12px 13px; }
  body .detail-block { padding: 12px 13px; }
  body .detail-block h6, body .card h6 { font-size: 13px; }
  body .stat-card { padding: 8px 10px 8px 50px; min-height: 52px; }
  body .stat-card::before { left: 10px !important; width: 30px !important; height: 30px !important; font-size: 14px !important; border-radius: 9px !important; }
  body .stat-card .num { font-size: 16px; }
  body .stat-card .lbl { font-size: 11px; }
  /* KPI 大数字卡（客户概览等） */
  body .ui-kpis { gap: 8px; }
  body .ui-kpi { padding: 9px 11px; border-radius: var(--r-lg); }
  body .ui-kpi .k { font-size: 11px; }
  body .ui-kpi .v { font-size: 17px; margin-top: 2px; }
  body .ui-kpi .f { font-size: 10.5px; margin-top: 2px; }
  /* 日历：整体等比缩放适配屏幕（560px 固定布局按比例缩小，无需右滑，字段完整不截断） */
  body .ui-cal { overflow: hidden; }
  body .ui-cal-fit { width: 560px; transform-origin: top left; }
  body .ui-cal-cell { min-height: 96px; padding: 3px; }
  body .ui-cal-d { font-size: 10px; padding: 0 2px 2px; }
  body .ui-cal-ev {
    font-size: 9.5px; padding: 2px 4px; display: block;
    white-space: normal; overflow: visible; text-overflow: clip;
    line-height: 1.4; border-radius: 5px; margin-bottom: 3px;
    border-left-width: 2px; border-left-style: solid;
  }
  body .ui-cal-ev i { font-style: normal; display: block; }
  body .ui-cal-ev .ui-cal-t { font-weight: 700; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  body .ui-cal-ev .ui-cal-row { display: flex; align-items: baseline; gap: 3px; min-width: 0; }
  body .ui-cal-ev .ui-cal-row b { flex: 0 0 auto; font-weight: 400; opacity: .6; font-size: .9em; }
  body .ui-cal-ev .ui-cal-row em { font-style: normal; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 表单区块 */
  body .ui-form-sec { padding: 10px 12px; }
  body .ui-form-sec h6 { font-size: 12.5px; }
  /* 消息 / 待办式行 */
  body .kv { padding: 6px 0; font-size: 12.5px; }
  /* 月份切换器等工具行可换行 */
  body .page-toolbar, body .d-flex.flex-wrap { row-gap: 6px; }
  /* 达运选人列表：换行不溢出 */
  body .tl-pick-row { flex-wrap: wrap; padding: 8px 2px; row-gap: 2px; }
  body .tl-pick-name { min-width: 0 !important; font-weight: 600; }
  body .tl-pick-meta { font-size: 11px; width: 100%; padding-left: 22px; }
  /* APP 级触控与排版 */
  body .page-title { font-size: 15px; padding: 10px 0 10px; gap: 8px; }
  body .btn { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
  body .btn-sm { min-height: 30px; }
  body .form-control, body .form-select { min-height: 36px; font-size: 13px; }
  body .form-control-sm, body .form-select-sm { min-height: 32px; font-size: 12.5px; }
  body .card { border-radius: 10px; margin-bottom: 10px; }
  body .table > :not(caption) > * > * { padding: 6px 8px; font-size: 12.5px; }
  /* 页头 / 侧边栏间距收紧 */
  body .content > .page-title:first-child { margin-top: 0; }
  body h6, body .h6 { font-size: 12.5px; }
  /* 长文本块不撑破屏幕 */
  body .ui-sub, body .small, body small { word-break: break-word; }
  /* 描述列表/键值对行 */
  body .kv { gap: 6px; }
  /* 图表容器不横向溢出 */
  body .chart-box, body [id^="chart"], body .dbp-chart { max-width: 100%; }
}

/* ---------- 17. 全站一致性修订 ---------- */
/* 17.1 stat 卡图标：主题语义色循环（品牌橙打头） */
body .stat-card::before { color: var(--ember); background: var(--ember-soft); }
body .row > div:nth-child(4n+2) .stat-card::before { color: var(--jade); background: var(--jade-soft); }
body .row > div:nth-child(4n+3) .stat-card::before { color: var(--warn); background: var(--warn-soft); }
body .row > div:nth-child(4n+4) .stat-card::before { color: var(--ok); background: var(--ok-soft); }
/* 17.2 页标题：移除 style.css 遗留蓝色竖条（主题已用 ember 下划线） */
body .page-title::before { content: none; }
/* 17.3 排名圆点：主题色阶（第一名品牌橙） */
body .rank-dot { background: #C9C2B2; }
body .rank-row:nth-child(1) .rank-dot { background: linear-gradient(135deg, #D4704A, var(--ember)); }
body .rank-row:nth-child(2) .rank-dot { background: linear-gradient(135deg, #D9A088, var(--jade)); }
body .rank-row:nth-child(3) .rank-dot { background: linear-gradient(135deg, #D9A088, var(--ok)); }
body .rank-row:nth-child(4) .rank-dot { background: linear-gradient(135deg, #D9A648, var(--warn)); }
body .rank-row:nth-child(5) .rank-dot { background: linear-gradient(135deg, #D96A5A, var(--danger)); }
/* 17.4 状态色语言表：Bootstrap 徽章全面接入主题语义色 */
body .text-bg-primary { background: var(--jade) !important; color: #fff !important; }
body .text-bg-success { background: var(--ok) !important; color: #fff !important; }
body .text-bg-warning { background: var(--warn) !important; color: #fff !important; }
body .text-bg-danger { background: var(--danger) !important; color: #fff !important; }
body .text-bg-info { background: var(--info) !important; color: #fff !important; }
body .text-bg-secondary { background: #A39B8B !important; color: #fff !important; }
body .text-bg-dark { background: var(--ink) !important; color: #fff !important; }
body .text-bg-light { background: var(--paper-2) !important; color: var(--ink-2) !important; box-shadow: inset 0 0 0 1px var(--line); }
/* 17.5 表单分区语义色板：替代散落的内联底色 */
body .ui-sec { background: var(--paper-2); border-radius: var(--r); }
body .ui-sec-brand { background: var(--jade-soft); border-radius: var(--r); }
body .ui-sec-ok { background: var(--ok-soft); border-radius: var(--r); }
body .ui-sec-warn { background: var(--warn-soft); border-radius: var(--r); }
body .ui-sec-ember { background: var(--ember-soft); border-radius: var(--r); }
/* 17.6 空状态统一 */
body .ui-empty { background: var(--paper-2); border: 1px dashed var(--line); border-radius: var(--r-lg); }
/* 17.7 品牌强调色统一：陶土橙贯穿侧栏与头像（功能主色仍为松绿） */
body .sidebar .brand .logo {
  background: linear-gradient(150deg, #D4704A 0%, #A8431F 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 14px -8px rgba(0, 0, 0, .8);
}
body .sidebar .nav-link.active {
  background: linear-gradient(100deg, rgba(192, 85, 47, .78) 0%, rgba(255, 255, 255, .08) 100%);
}
body .user-chip .avatar {
  background: linear-gradient(145deg, #D4704A, #A8431F);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
body .db-av {
  background: linear-gradient(145deg, #D4704A, #A8431F);
}

/* ---------- 拜访填报：仅手机端可填报，电脑端显示引导提示 ---------- */
.visit-pc-hint { display: none; }
@media (min-width: 768px) {
  .visit-form-card { display: none !important; }
  .visit-pc-hint { display: block; }
  .visit-records-col { flex: 0 0 100%; max-width: 100%; }
}
/* 拜访填报入口按钮：仅手机端可见 */
.visit-mobile-only { display: none !important; }
@media (max-width: 767.98px) {
  .visit-mobile-only { display: inline-flex !important; }
}

/* ---------- 18. 手机端表格卡片化（tbl-cards）：整行一张卡，字段 label 化，不藏列不横滑 ---------- */
@media (max-width: 767.98px) {
  body .table.tbl-cards > thead { display: none; }
  body .table.tbl-cards > tbody,
  body .table.tbl-cards > tbody > tr,
  body .table.tbl-cards > tbody > tr > td { display: block; width: 100%; }
  body .table.tbl-cards > tbody > tr {
    border: 1px solid var(--line); border-radius: var(--r-lg);
    margin-bottom: 10px; background: var(--card); box-shadow: var(--sh-1);
    padding: 8px 14px;
  }
  body .table.tbl-cards > tbody > tr > td {
    border: 0; padding: 7px 0; display: flex; align-items: baseline;
    justify-content: space-between; gap: 14px; white-space: normal; min-width: 0;
    position: static; box-shadow: none; background: transparent !important;
  }
  body .table.tbl-cards > tbody > tr > td::before {
    content: attr(data-label); flex: none;
    font-size: 12px; color: var(--ink-3); font-weight: 500;
  }
  body .table.tbl-cards > tbody > tr > td:empty { display: none; }
  /* 卡片模式下恢复被 hide-xs 隐藏的列（信息不再丢失） */
  body .table.tbl-cards > tbody > tr > td.hide-xs { display: flex !important; }
  body .table.tbl-cards > tbody > tr > td > .small { white-space: normal; }
}

/* ---------- 19. 手机端页标题吸顶工具条（标题+按钮常在手边） ---------- */
@media (max-width: 767.98px) {
  body .content > .page-title:first-child {
    position: sticky; top: 57px; z-index: 60;
    background: rgba(244, 242, 236, .92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    margin: -4px -4px 12px; padding: 8px 4px;
  }
}

/* ---------- 20. 消息 / 待办列表行：未读强调 + 手机触控行高 ---------- */
body .todo-item { transition: background var(--t); }
body .todo-item:hover { background: var(--paper-2); }
body .msg-unread { box-shadow: inset 3px 0 0 var(--ember); }
body .msg-unread > div:first-child { font-weight: 600; }
body .table tbody td[colspan].text-muted { padding: 26px 12px !important; font-size: 13px; }
@media (max-width: 767.98px) {
  body .todo-item { padding: 14px 12px; }
  body .todo-item .btn { min-height: 34px; }
}

/* ---------- 15. 动效与无障碍 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: #fff; }
  body .sidebar, body .topbar, body .ui-toasts, body .footer-note { display: none !important; }
  body .main { margin-left: 0; }
  body .card, body .detail-block { box-shadow: none; border-color: #ddd; }
}

/* 筛选条标签不折行：避免「合同到期（天内）」被拆成两行 */
body .filter-bar .form-label { white-space: nowrap; }

/* 抽屉里的「保存 / 取消」常驻底部：表单再长也不用滚到底才找得到 */
/* 内容比抽屉矮时（新建商机这类短表单），操作栏原来悬在半空、下面一大片空；
   让抽屉正文变成纵向弹性容器、操作栏 margin-top:auto，短表单贴底、长表单照旧吸底。
   注意抽屉正文里多包了一层 .ui-drawer-src（源节点被搬进来），弹性链要一层层传下去。 */
body .ui-drawer-body { display: flex; flex-direction: column; }
/* ui.css 里 `html.ui-js .ui-drawer-body .ui-drawer-src{display:block!important}` 权重更高，
   重复一次类名把特异性抬上去，否则这里的 flex 会被压回 block。 */
body .ui-drawer-body > .ui-drawer-src.ui-drawer-src,
body .ui-drawer-body > form {
  display: flex !important; flex-direction: column;
  flex: 1 0 auto; min-height: 0;
}
body .ui-drawer-body > .ui-drawer-src > form {
  display: flex; flex-direction: column;
  flex: 1 0 auto; min-height: 0;
}
body .ui-drawer-body .ui-form-actions {
  position: sticky; bottom: -18px; z-index: 5;
  margin: auto -18px -18px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 16px -12px rgba(24, 36, 32, .35);
}
@media (max-width: 575.98px) {
  body .ui-drawer-body .ui-form-actions { bottom: -14px; margin: auto -14px -14px; padding: 10px 14px; }
  /* 手机窄屏下「保存后自动记录审计日志」这类说明会把按钮挤到左边，直接收起 */
  body .ui-drawer-foot .ui-drawer-hint,
  body .ui-form-actions .ui-lock-hint,
  body .ui-form-actions .ui-drawer-hint { display: none; }
}
