/*
 * miniCRM 样式。
 * 版式：仿 Ant Design Pro（白色顶栏 + 左侧固定导航 + 灰底内容区 + 面包屑），2026-12-01 用户定。
 * 组件：一律按《智慧园区 WEB 端设计规范 V2.0.0》（2021-09-09，以下简称「规范」），逐个对照：
 *   色彩 / 字体 / 图标 / 圆角 / 左侧菜单栏 / 分页器 / 标签页 / 按钮 / 栅格与布局 / 标题卡片 /
 *   输入框 / 搜索框 / 选择器 / 单选 / 复选 / 树 / 表单 / 表格 / 筛选 / 气泡 / 标签 / 提示 / 弹框 / 结果。
 * 和规范不同的一处（有意的）：规范的「说明性文本 #999」在白底上对比度只有 2.8，
 *   这里正文性质的说明文字一律用「次要文本 #666」（5.7:1）；#999 只用于占位提示和系统图标。
 * 不只靠颜色传达信息：方向有「← 客户来信 / → 我方发出」，提示条和结果有 ✓ ✕ ! i 不同记号，项目状态有不同符号。
 */
:root {
  /* 规范·风格色 */
  --primary: #1A77F0;          /* normal */
  --primary-active: #1253A8;   /* 主色叠加纯黑 30% */
  --primary-hover: #5FA0F4;    /* 主色叠加纯白 30% */
  --primary-disable: #F7FAFE;  /* 主色叠加纯白 97% */
  --primary-bg: #E8F1FD;       /* 选中浅底（规范「提示·常规」底色） */
  --row-hover: #F3F8FE;

  /* 规范·功能色 */
  --success: #52C41A;
  --warning: #FAAD14;
  --error: #FF4D4F;

  /* 规范·字体颜色 */
  --text: #333333;             /* 标题 / 主要文本 */
  --text-2: #666666;           /* 次要文本 */
  --text-3: #999999;           /* 说明性 / 标签文本（只用于占位、图标） */
  --text-disable: #CCCCCC;

  /* 规范·辅助色 */
  --icon: #999999;             /* 系统图标 */
  --border: #D9D9D9;           /* 可操作线框 */
  --divider: #E8E8E8;          /* 分割线 */
  --disable-bg: #F5F5F5;       /* 不可点击 */
  --bg: #F2F2F2;               /* 背景色 */
  --placeholder-bg: #F8F8F8;
  --notice-bg: #FDFCEC;
  --table-head: #F7F7F7;       /* 量自规范表格页 */

  /* 来信 / 发出（本系统自有：深青、深蓝，配文字箭头） */
  --in-ink: #0A6E66;  --in-bg: #E6FAF7;  --in-line: #87D6CC;
  --out-ink: #1E4FB8; --out-bg: #E8F1FD; --out-line: #9DC0F2;

  --brand-gradient: linear-gradient(90deg, #03F9E1 0%, #3C8CF0 55%, #1A66D4 100%);
  --r: 2px;                    /* 规范·圆角1：按钮、单行输入框 */
  --r-2: 4px;                  /* 规范·圆角2：多行输入框 */
  --shadow-pop: 0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05);
  --hd-h: 56px;
  --sider-w: 240px;            /* 规范·左侧菜单栏宽 240，收起 48 */
  --sider-w-min: 48px;
  --gap: 16px;                 /* 规范·栅格水槽 16 */
  --colon: ":";                /* 表单标签后的冒号：中文用全角 */
}
:root:lang(zh) { --colon: "："; }

* { box-sizing: border-box; }
html { font-size: 14px; }
/* 规范·字体：中文 PingFang SC、英文 SF UI Text、数字 Helvetica Neue；字重只用 400 / 500；字高 = 字号 × 1.5 */
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-weight: 400; line-height: 1.5; font-size: 14px;
}
b, strong, th { font-weight: 500; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
a:active { color: var(--primary-active); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 规范·字号：20 内容大标题 / 18 单页面标题 / 16 导航、小标题 / 14 正文 / 12 说明 */
h1 { font-size: 18px; font-weight: 500; margin: 0 0 var(--gap); line-height: 1.5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 16px; font-weight: 500; margin: 24px 0 8px; line-height: 1.5; }
h3 { font-size: 14px; font-weight: 500; margin: 16px 0 8px; }
p { margin: 8px 0 16px; }
code, pre { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }

/* 规范·图标：16×16，线宽 1.5 */
.ic { width: 16px; height: 16px; vertical-align: -3px; flex: none;
      fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ic-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ================= 外框：顶栏 + 左侧菜单栏 + 内容区（Ant Design Pro 版式） ================= */
.hd { position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--hd-h);
      display: flex; align-items: center; gap: 16px; padding: 0 24px 0 16px;
      background: #fff; border-bottom: 1px solid var(--divider); }
.hd::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--brand-gradient); }
.hd > .brand { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: calc(var(--sider-w) - 16px); }
.hd > .brand:hover { color: var(--text); }
.hd > .brand img { height: 28px; width: auto; display: block; }
.hd > .brand .product { font-weight: 500; font-size: 16px; padding-left: 12px; border-left: 1px solid var(--divider); line-height: 1.2; white-space: nowrap; }
.hd-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.who .name { font-weight: 400; }
.who .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 14px; font-weight: 500;
               display: inline-flex; align-items: center; justify-content: center; }

/* 规范·左侧菜单栏：宽 240；菜单项高 48；选中 = 浅蓝底 + 主色字 + 左侧主色竖条；底部「收起」，收起后宽 48 只留图标 */
.sider { position: fixed; top: var(--hd-h); left: 0; bottom: 0; width: var(--sider-w); z-index: 90;
         display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--divider);
         box-shadow: 2px 0 6px rgba(0, 0, 0, .04); overflow: hidden; }
.sider > a, .sider summary { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; flex: none;
         color: var(--text); font-size: 14px; white-space: nowrap; position: relative; }
.sider > a:hover, .sider summary:hover, details.navgroup > a:hover { color: var(--primary); }
.sider a.on { background: var(--primary-bg); color: var(--primary); }
.sider a.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.sider .ic { width: 16px; height: 16px; color: inherit; }
details.navgroup, details.navgroup[open] { margin: 0; padding: 0; background: none; border: 0; border-radius: 0; flex: none; }
details.navgroup > summary { list-style: none; cursor: pointer; }
details.navgroup > summary::-webkit-details-marker { display: none; }
/* 一级菜单右侧箭头：收起 ›，展开 ⌄ */
details.navgroup > summary .caret { margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
         transform: rotate(-45deg); transition: transform .2s; }
details.navgroup[open] > summary .caret { transform: rotate(45deg) translate(-2px, -2px); }
details.navgroup.on > summary { color: var(--primary); }
details.navgroup > a { display: flex; align-items: center; height: 48px; padding: 0 16px 0 42px; color: var(--text); white-space: nowrap; position: relative; }
.sider-toggle { margin-top: auto; flex: none; height: 40px; width: 100%; border: 0; border-top: 1px solid var(--divider); border-radius: 0;
         background: #fff; color: var(--text-2); font-size: 12px; box-shadow: none; gap: 6px; }
.sider-toggle:hover, .sider-toggle:active { background: #fff; color: var(--primary); border-color: var(--divider); }
.sider-toggle .ic { transition: transform .2s; }
/* 收起状态 */
.sider-collapsed .sider { width: var(--sider-w-min); }
.sider-collapsed .sider > a span, .sider-collapsed .sider summary span:not(.caret), .sider-collapsed .sider summary .caret,
.sider-collapsed .sider-toggle span { display: none; }
.sider-collapsed .sider > a, .sider-collapsed .sider summary { padding: 0; justify-content: center; }
.sider-collapsed details.navgroup > a { display: none; }
.sider-collapsed .sider-toggle .ic { transform: rotate(180deg); }
.sider-collapsed .topbar ~ main { margin-left: var(--sider-w-min); }

/* 内容区 */
.topbar ~ main { margin-left: var(--sider-w); padding: calc(var(--hd-h) + 16px) 16px 32px; max-width: none; transition: margin-left .2s; }
main { padding: 16px; }
.narrow { max-width: 800px; }
/* 登录后的页面一律铺满右侧（不再限宽） */
.topbar ~ main.narrow { max-width: none; }

/* 面包屑（保留 Ant Pro 的位置）：14px 次要色，分隔用 / ，当前页主要文本色 */
.crumbs { font-size: 14px; margin: 0 0 8px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--primary); }
.crumbs > span:last-child { color: var(--text); }
.crumbs .sep { font-size: 0; }
.crumbs .sep::after { content: "/"; font-size: 14px; color: var(--text-3); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: var(--gap); }
.page-head h1 { margin: 0; }
.subtitle { color: var(--text-2); margin: -8px 0 16px; }

/* ================= 规范·气泡提示 / 下拉菜单：白底、阴影、项高 32 ================= */
details.menu { position: relative; background: none; border: 0; padding: 0; border-radius: 0; }
details.menu[open] { background: none; border: 0; padding: 0; }
details.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; height: 40px;
                         padding: 0 8px; color: var(--text); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover, details.menu[open] > summary { color: var(--primary); }
details.menu .caret { font-size: 12px; color: var(--icon); }
.menu-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 150; min-width: 120px; background: #fff;
            border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 4px 0; }
.menu-pop::before { content: ""; position: absolute; top: -4px; right: 20px; width: 8px; height: 8px; background: #fff; transform: rotate(45deg); box-shadow: -2px -2px 4px rgba(0, 0, 0, .04); }
.menu-pop.right { left: auto; right: 0; }
.menu-pop a, .menu-pop .menu-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 16px; min-width: 0;
            border-radius: 0; color: var(--text); background: none; border: 0; font-weight: 400; justify-content: flex-start; box-shadow: none; letter-spacing: 0; text-indent: 0; }
.menu-pop a:hover, .menu-pop .menu-item:hover, .menu-pop .menu-item:active { background: var(--row-hover); color: var(--primary); border: 0; }
.menu-pop form { margin: 0; }

/* 规范·单选框·胶囊选择：语言切换。选中 = 主色边框 + 主色字 */
.langswitch { display: inline-flex; align-items: stretch; }
.langswitch a { color: var(--text); padding: 0 10px; height: 28px; display: inline-flex; align-items: center; font-size: 12px;
                border: 1px solid var(--border); margin-left: -1px; background: #fff; position: relative; }
.langswitch a:first-of-type { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.langswitch a:last-of-type { border-radius: 0 var(--r) var(--r) 0; }
.langswitch a:hover { color: var(--primary); }
.langswitch a.on { color: var(--primary); border-color: var(--primary); z-index: 1; pointer-events: none; }
.login-box .langswitch { display: flex; width: max-content; margin: 0 auto 16px; }

/* ================= 规范·提示（页面提示）：彩色细边 + 浅底 + 圆形图标（✓ ! i ✕ 形状不同） ================= */
.flash { display: flex; align-items: flex-start; gap: 8px; padding: 9px 16px; border-radius: var(--r); margin: 0 0 var(--gap);
         border: 1px solid; color: var(--text); line-height: 20px; flex-wrap: wrap; }
.flash::before { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
                 display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.flash.ok   { background: #F6FFED; border-color: #B7EB8F; }
.flash.ok::before   { content: "✓"; background: var(--success); }
.flash.warn { background: #FFFBE6; border-color: #FFE58F; }
.flash.warn::before { content: "!"; background: var(--warning); }
.flash.info { background: var(--primary-bg); border-color: #A3C8F7; }
.flash.info::before { content: "i"; background: var(--primary); font-family: Georgia, serif; font-style: italic; }
.flash.err  { background: #FFF1F0; border-color: #FFA39E; }
.flash.err::before  { content: "✕"; background: var(--error); }

/* ================= 规范·标题卡片：白底；标题栏高 48、14px 中粗、下面一条分割线；卡片间距 16 ================= */
.card, .panel { background: #fff; border-radius: var(--r); margin-bottom: var(--gap); }
.card-h { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 8px 16px; min-height: 48px;
          border-bottom: 1px solid var(--divider); }
.card-h h2, .card-h h3 { margin: 0; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 4px; margin-right: auto; }
.card-h .count { color: var(--text-2); font-weight: 400; margin-left: 4px; }
.card-h form { margin: 0; }
.card-h .small.muted { font-size: 12px; }
.card-desc { flex-basis: 100%; margin: -4px 0 0; font-size: 12px; color: var(--text-2); }
.card-b { padding: 16px; }
.card-f { padding: 12px 16px; border-top: 1px solid var(--divider); }
.card > .table-wrap, .card > table { border: 0; border-radius: 0; margin: 0; }
/* 规范·其他标题：蓝点 + 文字（分类模块） */
.dot-title { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.dot-title::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

/* 面板：第一个 h2/h3 自动成为标题栏 */
.panel { padding: 16px; }
.panel > h2:first-child, .panel > h3:first-child, form.panel > h2, form.panel > h3, .panel > .panel-head:first-child {
  margin: -16px -16px 16px; padding: 0 16px; min-height: 48px; display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--divider); font-size: 14px; font-weight: 500; }
.panel > .panel-head:first-child h2, .panel > .panel-head:first-child h3 { font-size: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h2, .panel-head h3 { margin: 0; }
h1 .ic, h2 .ic, h3 .ic { color: var(--primary); }
details.panel > summary { color: var(--text); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--icon); border-bottom: 1.5px solid var(--icon); transform: rotate(-45deg); }
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel[open] { background: #fff; border: 0; padding: 16px; }

/* ================= 规范·输入框 / 搜索框 / 选择器：高 32，圆角 2（多行 4），边框 #D9D9D9；悬停、聚焦主色边；错误红边；不可用灰底 ================= */
label { display: block; color: var(--text); font-weight: 400; margin: 16px 0 8px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 8px 24px 8px 0; cursor: pointer; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: #fff; width: 100%; height: 32px;
  padding: 0 11px; border: 1px solid var(--border); border-radius: var(--r); transition: border-color .2s;
}
textarea { height: auto; min-height: 88px; padding: 6px 11px; border-radius: var(--r-2); resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled { background: var(--disable-bg); color: var(--text-disable); border-color: var(--border); cursor: not-allowed; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--error); }
/* 选择器：右侧下箭头 */
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
         background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23999' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right 12px center; }
/* 搜索框：左侧放大镜 */
input[type=search] { padding-left: 32px; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.hd input[type=search] { width: 240px; }
.hd form.search { margin: 0; display: flex; }
.hd form.search > .ic { display: none; }
/* 规范·复选框 / 单选框：16px，选中主色 */
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; vertical-align: -3px; }
.hint { font-size: 12px; color: var(--text-2); margin: 4px 0 0; }
.field-row { margin-bottom: 8px; }
.field-row .lock { font-weight: 400; margin: 0 0 0 8px; gap: 2px; color: var(--text-2); }
.field-label { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 16px; }
.field-label label { margin: 0; }

/* 规范·表单：标签在左、右对齐、带冒号，标签和输入框间距 10 */
.row, .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.row > div { display: grid; grid-template-columns: 10em minmax(0, 1fr); column-gap: 10px; align-items: start; margin: 16px 0 0; }
.row > div > label { margin: 0; padding-top: 5px; text-align: right; justify-self: end; }
/* 整页表单（系统设置、AI 设置、我的邮箱、改密码……）：标签在左，其余在右 */
main > form.panel:has(> label:not(.inline)) { display: grid; grid-template-columns: 10em minmax(0, 1fr); column-gap: 10px; align-items: start; }
main > form.panel:has(> label:not(.inline)) > * { grid-column: 2; }
main > form.panel:has(> label:not(.inline)) > :is(h2, h3, .panel-head, .flash, .row) { grid-column: 1 / -1; }
main > form.panel:has(> label:not(.inline)) > label:not(.inline) { grid-column: 1; margin: 16px 0 0; padding-top: 5px; text-align: right; }
main > form.panel:has(> label:not(.inline)) > label:not(.inline)::after { content: var(--colon); }
main > form.panel:has(> label:not(.inline)) > label:not(.inline) + * { margin-top: 16px; }
main > form.panel:has(> label:not(.inline)) > label:not(.inline) + input[type=checkbox] { justify-self: start; margin-top: 21px; }
.row > div > label::after { content: var(--colon); }
.row > div > :not(label) { grid-column: 2; }
.row > div > .hint { margin-top: 4px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .field-row { margin-bottom: 4px; }

/* ================= 规范·按钮：小 28 / 中 32（默认）/ 大 40；最小宽 49 / 65 / 70；圆角 2；
   主按钮主色底，hover 浅、active 深；次按钮白底灰边，hover 主色边字；警示按钮红边红字；两个汉字中间空一格 ================= */
button, .btn {
  font: inherit; font-size: 14px; font-weight: 400; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-width: 65px; padding: 0 15px; border-radius: var(--r); border: 1px solid var(--primary); white-space: nowrap;
  background: var(--primary); color: #fff; line-height: 1; transition: background-color .2s, border-color .2s, color .2s;
}
button:hover, .btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
button:active, .btn:active { background: var(--primary-active); border-color: var(--primary-active); color: #fff; }
button.secondary, .btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
button.secondary:hover, .btn.secondary:hover { background: #fff; color: var(--primary); border-color: var(--primary); }
button.secondary:active, .btn.secondary:active { background: var(--disable-bg); color: var(--primary-active); border-color: var(--primary-active); }
button.danger { background: #fff; color: var(--error); border-color: var(--error); }
button.danger:hover, button.danger:active { background: #FFF1F0; color: var(--error); border-color: var(--error); }
button.small, .btn.small { height: 28px; min-width: 49px; padding: 0 8px; font-size: 12px; }
button.large, .btn.large { height: 40px; min-width: 70px; padding: 0 16px; }
.two-cn { letter-spacing: .5em; text-indent: .5em; }
.two-cn .ic { margin-left: -.5em; }
/* 不可点：灰底、灰字；旁边另有文字写原因 */
button[disabled], button[disabled]:hover, button[disabled]:active { background: var(--disable-bg); color: var(--text-disable); border: 1px solid var(--border); cursor: not-allowed; }
/* 并列按钮间距：中按钮 16，小按钮 8 */
.actions { display: flex; gap: 16px; margin-top: 24px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.actions form.actions { margin: 0; flex-wrap: nowrap; gap: 8px; }

/* ================= 规范·筛选：标题卡片里，标签右对齐、和输入框间距 10；右侧「搜索」主按钮 + 「重置」次按钮 ================= */
.card.query form.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; padding: 16px; margin: 0; }
.filter .f-item { display: flex; align-items: center; gap: 10px; flex: 0 1 380px; }
.filter .f-item label { margin: 0; white-space: nowrap; min-width: 4em; text-align: right; }
.filter .f-item input, .filter .f-item select { flex: 1; min-width: 0; }
.filter .f-btns { display: flex; gap: 16px; margin-left: auto; }

/* ================= 统计（首页数据概览）：规范·数字字体（Helvetica Neue） ================= */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.stat { background: #fff; border-radius: var(--r); padding: 16px 24px; display: flex; flex-direction: column-reverse; }
.stat .num { font-family: "Helvetica Neue", Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.4; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--text-2); }

.statbar { display: flex; flex-wrap: wrap; background: #fff; border-radius: var(--r); margin: 0 0 var(--gap); }
.statbar > div { padding: 16px 24px; border-right: 1px solid var(--divider); display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.statbar > div:last-child { border-right: 0; }
.statbar .v { font-family: "Helvetica Neue", Arial, sans-serif; font-size: 24px; font-weight: 500; line-height: 1.4; font-variant-numeric: tabular-nums; }
.statbar .l { color: var(--text-2); }
.statbar .in .v { color: var(--in-ink); }
.statbar .out .v { color: var(--out-ink); }
.statbar .txt { display: block; align-self: center; color: var(--text); line-height: 1.8; }

.traffic b { font-weight: 500; }
.traffic .t-in { color: var(--in-ink); }
.traffic .t-out { color: var(--out-ink); }

/* ================= 规范·表格：行高 48；表头浅灰 #F7F7F7、中粗；内容距边框 24、字段之间 48；金额 / 数字右对齐；蓝字可点 ================= */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--r); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
th, td { text-align: left; padding: 13px 24px; border-bottom: 1px solid var(--divider); vertical-align: top; line-height: 21px; }
th { background: var(--table-head); font-weight: 500; color: var(--text); white-space: nowrap; border-bottom: 0; }
tbody tr:hover > td { background: var(--row-hover); }
td.num, th.num { text-align: right; white-space: nowrap; font-family: "Helvetica Neue", Arial, sans-serif; font-variant-numeric: tabular-nums; }
table.tbl th, table.tbl td { white-space: nowrap; vertical-align: middle; }
table.tbl td.wrap, table.tbl td.subj { white-space: normal; }
table.tbl td.subj { min-width: 22rem; }
table.tbl tr.sel td { background: var(--primary-bg); }
table.tbl tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
table.tbl .sub { color: var(--text-2); font-size: 12px; }
table.tbl .snippet { color: var(--text-2); font-size: 12px; max-width: 40rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tbl .empty { color: var(--text-2); text-align: center; padding: 40px 16px; }
/* 公司行 + 下面的人：公司行浅灰底，人缩进 */
table.tbl tr.co-row td { background: #FAFAFA; }
table.tbl tr.co-row:hover td { background: var(--row-hover); }
table.tbl tr.co-row td:first-child a { font-weight: 500; }
table.tbl tr.p-row td:first-child { padding-left: 48px; }
table.tbl tr.more-row td { padding-left: 48px; font-size: 12px; }
/* 键值表（客户资料） */
table.kv th { width: 15rem; background: var(--table-head); color: var(--text-2); font-weight: 400; white-space: normal; vertical-align: top; border-bottom: 1px solid var(--divider); }
table.kv td { white-space: pre-wrap; word-break: break-word; }

/* 长表格：最高约一屏，自己滚，表头吸顶 */
.table-wrap.tall { max-height: calc(100vh - 250px); overflow: auto; }
.table-wrap.tall thead th { position: sticky; top: 0; z-index: 2; }

/* 滚动条一直看得见（Mac 默认会藏） */
.table-wrap, .orgtree > .card-b { scrollbar-width: thin; scrollbar-color: #C1C1C1 transparent; }
.table-wrap::-webkit-scrollbar, .orgtree > .card-b::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
.table-wrap::-webkit-scrollbar-thumb, .orgtree > .card-b::-webkit-scrollbar-thumb { background: #C1C1C1; border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb:hover, .orgtree > .card-b::-webkit-scrollbar-thumb:hover { background: #999; }

/* ================= 规范·标签：细边框 + 浅底 + 同色字，圆角 2；小标签高 20 ================= */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 0 7px; border: 1px solid var(--border); border-radius: var(--r);
       background: #fff; color: var(--text); white-space: nowrap; line-height: 18px; font-weight: 400; }
.tag.brand { background: var(--primary-bg); color: var(--primary-active); border-color: var(--primary); }
.tag.lock { background: #FFFBE6; color: #8C5A00; border-color: #FFD666; }
.tag.ok { background: #F6FFED; color: #237804; border-color: #95DE64; }
.tag.err { background: #FFF1F0; color: #A8071A; border-color: #FFA39E; }
/* 项目状态：记号 + 文字，记号形状不同（不只靠颜色） */
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--text); }
.status::before { content: "●"; font-size: 8px; }
.status.s-follow::before { color: var(--primary); }
.status.s-success::before { content: "✓"; font-size: 13px; font-weight: 700; color: var(--success); }
.status.s-hold::before { content: "‖"; font-size: 13px; font-weight: 700; color: var(--warning); }
.status.s-lost::before, .status.s-cancel::before { content: "✕"; font-size: 12px; font-weight: 700; color: var(--error); }
.status.s-none::before { content: "○"; color: var(--icon); }

/* ================= 规范·分页器：28 高、灰边方块 ================= */
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.pager a { border: 1px solid var(--border); border-radius: var(--r); padding: 0 10px; height: 28px; display: inline-flex; align-items: center; background: #fff; color: var(--text); font-size: 12px; }
.pager a:hover { border-color: var(--primary); color: var(--primary); }

/* ================= 规范·标签页·基础样式：选中项主要文本色 + 2px 主色下划线 ================= */
.tabs { display: flex; gap: 32px; margin: 0 0 var(--gap); border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.tabs a { color: var(--text-2); padding: 12px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--primary); }
.tabs a.on { border-bottom-color: var(--primary); color: var(--text); font-weight: 500; }
/* 卡片标题栏里的页签（规范·标题「tab 卡片」） */
.card-h .tabs.in-card { margin: -8px auto -9px 0; border-bottom: 0; align-self: stretch; gap: 24px; }
.card-h .tabs.in-card a { padding: 0 4px; height: 48px; margin-bottom: 0; }

/* 方向标签（规范·小标签样式） */
.dir { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: var(--r); border: 1px solid; white-space: nowrap; line-height: 18px; }
.dir.in { background: var(--in-bg); color: var(--in-ink); border-color: var(--in-line); }
.dir.out { background: var(--out-bg); color: var(--out-ink); border-color: var(--out-line); }

/* ================= 公司页 ================= */
.two-col { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.main-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { padding: 10px 8px; border-bottom: 1px solid var(--divider); }
.contact-list li:last-child { border-bottom: 0; }
.contact-list li.on { background: var(--primary-bg); box-shadow: inset 3px 0 0 var(--primary); }
.contact-list .c-line { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; word-break: break-all; color: var(--text-2); }
.contact-list .c-line .ic { margin-top: 2px; color: var(--icon); }

/* AI 分析：按钮横排，每个按钮下写不能点的原因 */
.ai-bar { position: relative; overflow: hidden; }
.ai-bar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, #03F9E1, #3C8CF0 55%, #1A66D4); }
.ai-buttons { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--gap); }
.ai-buttons li { margin: 0; }
.ai-buttons form { display: flex; flex-direction: column; align-items: stretch; gap: 6px; height: 100%; }
.ai-buttons .why { font-size: 12px; color: var(--text-2); display: flex; gap: 4px; align-items: flex-start; }
details.jobs { margin-top: 16px; }
details.jobs > summary { cursor: pointer; color: var(--primary); }
details.jobs[open] > summary { margin-bottom: 8px; }

dl.kv { display: grid; grid-template-columns: 14rem 1fr; gap: 8px 16px; margin: 8px 0; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; }
.sources { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; color: var(--text-2); }

/* 项目页右侧列表（跟进记录、出处）：规范·时间轴 */
.people { list-style: none; margin: 0; padding: 0 0 0 4px; }
.people li { position: relative; padding: 0 0 16px 20px; border-left: 1px solid var(--divider); }
.people li:last-child { border-left-color: transparent; }
.people li::before { content: ""; position: absolute; left: -5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--border); background: #fff; box-sizing: border-box; }
.people li:first-child::before { border-color: var(--primary); }

/* ================= 规范·树选择：客户页左侧组织架构 ================= */
.cust-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.orgtree { position: sticky; top: calc(var(--hd-h) + 16px); height: calc(100vh - var(--hd-h) - 90px); min-height: 320px; display: flex; flex-direction: column; overflow: hidden; }
.orgtree > .card-b { flex: 1; min-height: 0; overflow: auto; padding: 8px; }
.orgtree li, .orgtree a { white-space: nowrap; }
.orgtree ul { list-style: none; margin: 0; padding-left: 16px; }
.orgtree .card-b > ul { padding-left: 0; }
.orgtree li { margin: 0; }
.orgtree a { display: flex; align-items: center; gap: 6px; padding: 0 8px; height: 32px; color: var(--text); }
.orgtree a .ic { color: var(--icon); }
.orgtree a:hover { background: var(--row-hover); color: var(--text); }
.orgtree a.on { background: var(--primary-bg); color: var(--primary); box-shadow: inset -2px 0 0 var(--primary); }
.orgtree a.on .ic { color: var(--primary); }
.orgtree .unit-link { font-weight: 500; }
.orgtree .hint { padding: 8px; }

/* ================= 单封信 ================= */
.mail-head dl { display: grid; grid-template-columns: 6rem 1fr; gap: 8px 16px; margin: 0; }
.mail-head dt { color: var(--text-2); }
.mail-head dd { margin: 0; word-break: break-word; }
.mail-body-text { white-space: pre-wrap; word-break: break-word; background: #fff; border-radius: var(--r); padding: 16px 24px; }
iframe.mail-body { width: 100%; min-height: 560px; border: 0; border-radius: var(--r); background: #fff; }

/* ================= 后台：组织架构树 ================= */
.tree, .tree ul { list-style: none; margin: 0; padding-left: 24px; }
.tree { padding-left: 0; }
.tree li { margin: 8px 0; }
.tree .unit { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 16px; background: #fff; border-radius: var(--r); }
.tree .unit .name { font-weight: 500; }
.tree ul { border-left: 1px solid var(--border); margin-left: 8px; }
.tree .tag { margin-left: 4px; }
details summary { cursor: pointer; color: var(--primary); }
details[open] { background: var(--placeholder-bg); padding: 4px 8px 12px; border-radius: var(--r); border: 1px dashed var(--border); }
details form { margin-top: 8px; }
.icon-link { color: var(--icon); margin-left: 6px; display: inline-flex; vertical-align: middle; }
.icon-link:hover { color: var(--primary); }

/* ================= 规范·弹框·通知提示窗：最小宽 480，居中；左侧警告图标；右下「取 消」「确 定」 ================= */
.modal-mask { position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; }
.modal { min-width: 480px; max-width: min(1118px, 92vw); background: #fff; border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 32px 32px 24px; }
.modal-b { display: flex; gap: 16px; align-items: flex-start; }
.modal-b p { margin: 0; font-size: 16px; font-weight: 500; line-height: 24px; }
.modal-ic { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--warning); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.modal-f { display: flex; justify-content: flex-end; gap: 16px; margin-top: 32px; }

/* ================= 规范·结果：错误页大图标 ================= */
.result-ic { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 34px; font-weight: 700; margin: 24px 0 16px; }
.result-ic.err { background: var(--error); }
.result-ic.warn { background: var(--warning); }

/* ================= 登录 / 初始化 ================= */
body:not(:has(.topbar)) { background: var(--bg); min-height: 100vh; }
.login-box { max-width: 420px; margin: 0 auto; padding-top: 10vh; }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand img { height: 52px; width: auto; }
.login-box h1 { justify-content: center; font-size: 20px; }
.login-box .panel { position: relative; overflow: hidden; padding: 32px; }
.login-box .panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand-gradient); }
.login-box label { margin: 16px 0 8px; }
.login-box button[type=submit] { width: 100%; height: 40px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 1100px) {
  .main-side, .form-grid, .row { grid-template-columns: minmax(0, 1fr); }
  .hd > .brand .product { display: none; }
  .hd > .brand { min-width: 0; }
  .hd input[type=search] { width: 160px; }
}
/* 窄窗口：侧栏改成顶栏下的一行，不撑破页面（不为手机设计） */
@media (max-width: 900px) {
  .sider { position: static; width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--divider); margin-top: var(--hd-h); box-shadow: none; }
  .sider-toggle { display: none; }
  details.navgroup { display: contents; }
  .topbar ~ main, .sider-collapsed .topbar ~ main { margin-left: 0; padding-top: 16px; }
  .two-col, .cust-layout, .stats, dl.kv { grid-template-columns: minmax(0, 1fr); }
  .orgtree { position: static; height: auto; max-height: 60vh; }
  .modal { min-width: 0; width: 92vw; }
}

/* ================= 组织架构与人员页：左树右表 ================= */
.org-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.org-admin { position: sticky; top: calc(var(--hd-h) + 16px); height: calc(100vh - var(--hd-h) - 32px); }
.org-admin > .card-b { padding: 4px 8px 8px; }
.icon-btn { min-width: 0; width: 28px; height: 28px; padding: 0; background: #fff; color: var(--text-2); border-color: var(--border); }
.icon-btn:hover { background: #fff; color: var(--primary); border-color: var(--primary); }
.tree-tools { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px 16px; flex-wrap: wrap; }
.tree-tools .tree-filter { flex: 1 1 100%; height: 28px; }
/* 文字按钮（规范·文字链接按钮） */
button.lnk { background: none; border: 0; color: var(--primary); min-width: 0; height: auto; padding: 0; font-size: inherit; box-shadow: none; letter-spacing: 0; text-indent: 0; }
button.lnk:hover { background: none; color: var(--primary-hover); border: 0; }
button.lnk:active { background: none; color: var(--primary-active); }
button.lnk.del { color: var(--error); }
.tree-tools .lnk { font-size: 12px; }
/* 树：一行 = 展开箭头 + 名字（人数）+ 悬停浮出的 + − */
.otree, .otree ul { list-style: none; margin: 0; padding: 0; }
.otree ul { padding-left: 18px; }
.otree li.collapsed > ul { display: none; }
.otree li.hide { display: none; }
.node-row { display: flex; align-items: center; height: 36px; border-radius: var(--r); position: relative; }
.node-row:hover { background: var(--row-hover); }
.node-row.on { background: var(--primary-bg); box-shadow: inset -2px 0 0 var(--primary); }
.node-row.on .node { color: var(--primary); }
.tw, .tw-sp { flex: none; width: 18px; height: 18px; }
.tw { min-width: 0; padding: 0; border: 0; background: none; color: var(--icon); position: relative; }
.tw::before { content: ""; position: absolute; left: 7px; top: 6px; border: 4px solid transparent; border-top-color: currentColor; transition: transform .15s; }
.collapsed > .node-row .tw::before { transform: rotate(-90deg) translateX(1px); }
.tw:hover { background: none; color: var(--text); }
.node { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 100%; padding-right: 8px; color: var(--text); }
.node:hover { color: var(--text); }
.node .ic { color: var(--icon); }
.node .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .cnt { margin-left: auto; font-size: 12px; color: var(--text-2); font-family: "Helvetica Neue", Arial, sans-serif; }
.node-ops { display: none; align-items: center; gap: 4px; padding-right: 6px; }
.node-ops form { margin: 0; display: inline-flex; }
.node-row:hover .node-ops, .node-row:focus-within .node-ops { display: inline-flex; }
.node-row:hover .cnt, .node-row:focus-within .cnt { display: none; }
.nb { min-width: 0; width: 20px; height: 20px; padding: 0; font-size: 15px; line-height: 1; border-radius: var(--r);
      background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.nb:hover { background: var(--primary); color: #fff; }
.nb.del { color: var(--error); border-color: var(--error); }
.nb.del:hover { background: var(--error); color: #fff; border-color: var(--error); }
.otree li.pin .node { font-weight: 500; }
/* 右侧部门卡片 */
.dept-card dl.kv { grid-template-columns: 7em 1fr; margin: 0; }
.dept-card dl.kv dd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag.chip { color: var(--text); }
.tag.chip:hover { color: var(--primary); border-color: var(--primary); }
.card-h form.auto-submit label.inline { margin: 0; font-size: 12px; color: var(--text-2); }
.card-h .people-filter { width: 200px; height: 28px; }
/* 人员表格 */
.people-table th.ck, .people-table td.ck { width: 48px; padding-right: 0; }
.people-table tr.off td { color: var(--text-2); }
a.plain { color: var(--text); }
a.plain:hover { color: var(--primary); }
.card-f.batch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.card-f.batch label { margin: 0; }
.card-f.batch select { width: 260px; }

/* ================= 规范·弹框·基本对话框：标题栏 + 关闭 ×、内容、底部按钮栏（取 消 / 确 定） ================= */
dialog.dlg { padding: 0; border: 0; border-radius: var(--r); box-shadow: var(--shadow-pop); min-width: 480px; max-width: min(1118px, 92vw); color: var(--text); background: #fff; }
dialog.dlg[open] { padding: 0; border: 0; background: #fff; }
dialog.dlg::backdrop { background: rgba(0, 0, 0, .4); }
dialog.dlg form { margin: 0; }
.dlg-h { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 16px 0 24px; border-bottom: 1px solid var(--divider); }
.dlg-h h3 { margin: 0; font-size: 16px; font-weight: 500; }
.dlg-x { min-width: 0; width: 32px; height: 32px; padding: 0; background: none; border: 0; color: var(--icon); font-size: 20px; }
.dlg-x:hover { background: none; color: var(--text); border: 0; }
.dlg-b { padding: 24px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 16px; padding: 12px 24px; border-top: 1px solid var(--divider); }
/* 弹框里的表单：标签在左、右对齐、带冒号 */
.form-h { display: grid; grid-template-columns: 8em minmax(0, 1fr); gap: 16px 10px; align-items: start; }
.form-h > label:not(.inline) { margin: 0; padding-top: 5px; text-align: right; }
.form-h > label:not(.inline)::after { content: var(--colon); }
.form-h > label.req::before { content: "* "; color: var(--error); }
.form-h .checks { display: flex; flex-direction: column; gap: 4px; }
.form-h .checks label.inline { margin: 0; }
.dlg .form-h { min-width: 520px; }
@media (max-width: 1100px) { .org-layout { grid-template-columns: minmax(0, 1fr); } .org-admin { position: static; height: auto; max-height: 60vh; } }

/* 表格操作列（规范：文字链接，最多 4 个） */
td.ops { white-space: nowrap; }
td.ops form { display: inline-flex; margin: 0; }
td.ops > * + *, td.ops > form + form, td.ops > a + form, td.ops > button + form { margin-left: 16px; }
button.lnk[disabled], button.lnk[disabled]:hover { background: none; border: 0; color: var(--text-disable); cursor: not-allowed; }
.lnk-off { color: var(--text-disable); cursor: not-allowed; }
tr.off td { color: var(--text-2); }

/* 规范·表格说明三：内容超过一屏时横向滚动，操作列固定在右边 */
.people-table th:last-child, .people-table td.ops { position: sticky; right: 0; z-index: 1; background: #fff; box-shadow: -6px 0 6px -6px rgba(0, 0, 0, .18); }
.people-table th:last-child { background: var(--table-head); }
.people-table tbody tr:hover td.ops { background: var(--row-hover); }
.people-table th, .people-table td { padding-left: 16px; padding-right: 16px; }
.people-table th.ck, .people-table td.ck { padding-left: 24px; }

/* 标题栏里同时有页签和说明：页签下沿不压到说明文字 */
.card-h:has(.card-desc) .tabs.in-card { margin-bottom: 0; }
.card-h:has(.card-desc) .tabs.in-card a { height: 40px; }
.card-h:has(.card-desc) .card-desc { margin-top: 0; padding-bottom: 4px; }
.tabs a .cnt { font-size: 12px; color: var(--text-2); font-weight: 400; margin-left: 2px; }

/* ================= AI 按钮：分析中转圈（规范·加载）、间隔中倒计时 ================= */
.ai-form button { position: relative; }
.ai-form .spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: ai-spin .8s linear infinite; }
.ai-form button.is-busy .spin { display: inline-block; }
.ai-form button.is-busy .ic { display: none; }
.ai-form .timer { font-family: "Helvetica Neue", Arial, sans-serif; font-variant-numeric: tabular-nums; }
.ai-form .timer:empty { display: none; }
/* 分析中：主色浅底 + 主色字 + 转圈（不是灰色「不可点」，让人知道在工作） */
.ai-form button.is-busy, .ai-form button.is-busy:hover { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary); cursor: progress; }
.ai-form button.is-busy::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 40%; background: var(--primary); animation: ai-bar 1.4s ease-in-out infinite; }
/* 间隔中：灰底 + 倒计时 */
.ai-form button.is-cooling .lbl { display: none; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-bar { 0% { left: 0; width: 10%; } 50% { left: 30%; width: 40%; } 100% { left: 90%; width: 10%; } }
@media (prefers-reduced-motion: reduce) { .ai-form .spin, .ai-form button.is-busy::after { animation: none; } }
.ai-form button.is-cooling, .ai-form button.is-cooling:hover { color: var(--text-2); background: var(--disable-bg); border: 1px solid var(--border); cursor: not-allowed; }

/* ================= 规范·表单间距（量自规范「表单」页）：输入框高 32、上下两行间隔 24、
   标签在左右对齐带冒号、标签和输入框间隔 10、多行输入框高 88、按钮离最后一行 32；卡片内边距 24 ================= */
.panel { padding: 24px; }
.panel > h2:first-child, .panel > h3:first-child, form.panel > h2, form.panel > h3, .panel > .panel-head:first-child { margin: -24px -24px 24px; padding: 0 24px; }
.card-b { padding: 24px; }
textarea { min-height: 88px; }
.hint { margin-top: 6px; line-height: 1.5; }
.actions { margin-top: 32px; }
.f-actions { padding-left: calc(var(--f-lbl, 10em) + 10px); }
/* 一行字段：标签 | 输入（+说明）| 右侧附加（人工填 / 锁定） */
.f-row { display: grid; grid-template-columns: var(--f-lbl, 10em) minmax(0, 1fr) auto; column-gap: 10px; align-items: start; margin: 0 0 24px; }
.f-row > .f-lbl { margin: 0; padding-top: 5px; line-height: 22px; text-align: right; color: var(--text); }
.f-row > .f-lbl::after { content: var(--colon); }
.f-row .f-ctl { min-width: 0; }
.f-row .f-ctl .hint { margin-top: 6px; }
.f-row .f-sfx { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.f-row .f-sfx:empty { display: none; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; }
.form-2col > .f-row.wide { grid-column: 1 / -1; }
.form-1col { max-width: 1100px; }
.proj-layout { grid-template-columns: minmax(0, 1fr) 380px; margin-top: 16px; }
/* 锁定开关：勾选框 + 锁图标 + 文字（不只靠图标） */
.lock-tg { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.lock-tg .ic { width: 14px; height: 14px; }
.lock-tg:has(input:checked) { color: var(--primary); }
/* 其他表单统一行距 24 */
.row > div { margin: 0 0 24px; }
.row { margin-top: 0; }
main > form.panel:has(> label:not(.inline)) { row-gap: 0; }
main > form.panel:has(> label:not(.inline)) > label:not(.inline) { margin: 24px 0 0; }
main > form.panel:has(> label:not(.inline)) > label:not(.inline) + * { margin-top: 24px; }
main > form.panel:has(> label:not(.inline)) > :is(h2, h3) + label:not(.inline),
main > form.panel:has(> label:not(.inline)) > :is(h2, h3) + label:not(.inline) + * { margin-top: 0; }
.form-h { row-gap: 24px; }
.dlg-b { padding: 32px 32px 8px; }
.dlg-b.form-h { padding-bottom: 24px; }
.login-box label { margin: 24px 0 8px; }
@media (max-width: 1100px) { .form-2col { grid-template-columns: minmax(0, 1fr); } .proj-layout { grid-template-columns: minmax(0, 1fr); } }

/* ================= 规范·全局间距（8px 网格）：卡片间 16；卡片标题栏左右 24、内容区 24；表格内容距边 24；
   页面标题下 16；面包屑下 8；并列按钮 16（小按钮 8）；标签之间 8 ================= */
.card-h { padding: 8px 24px; }
.card-f { padding: 16px 24px; }
.card-desc { margin-top: 0; }
.card.query form.filter { padding: 24px; gap: 24px 32px; }
.orgtree > .card-h, .org-admin > .card-h { padding: 8px 16px 8px 24px; }
.tree-tools { padding: 16px 16px 8px 24px; }
.org-admin > .card-b { padding: 8px 16px 16px; }
.statbar > div { padding: 16px 24px; }
.stat { padding: 24px; }
dl.kv { gap: 12px 24px; }
.dept-card dl.kv { padding: 24px; }
.mail-head dl { gap: 12px 24px; }
.contact-list li { padding: 12px 16px; }
details.jobs { margin-top: 24px; }
.ai-buttons { gap: 16px 24px; margin-top: 0; }
.people li { padding-bottom: 24px; }
.flash { margin-bottom: 16px; }
.subtitle { margin: -8px 0 16px; }
h1 + .flash, .crumbs + h1 { margin-top: 0; }
.tag + .tag { margin-left: 4px; }
.sources { margin-top: 16px; gap: 8px 24px; }
.tree li { margin: 8px 0; }
.tree .unit { padding: 12px 24px; }
table.kv th, table.kv td { padding: 13px 24px; }
.main-side, .two-col, .cust-layout, .org-layout { gap: 16px; }
.mail-body-text { padding: 24px; }
.form-2col { --f-lbl: 13em; }
.form-1col { --f-lbl: 15em; max-width: none; }
.form-2col ~ .f-actions { --f-lbl: 13em; }
.form-1col ~ .f-actions { --f-lbl: 15em; }
.panel > p.hint + .form-2col, .panel > p.hint + .form-1col { margin-top: 24px; }
/* 窄侧栏里的表单（联系人资料、公司名称和备注、跟进记录）：标签在上，行距 24，锁定开关在标签右侧 */
.v-lbl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 24px 0 8px; }
.v-lbl label { margin: 0; }
aside .panel label:not(.inline):not(.lock-tg):not(.f-lbl), .two-col > .panel > label:not(.inline), .main-side .panel > label:not(.inline) { margin: 24px 0 8px; }
.v-lbl label { margin: 0 !important; }
aside .panel > h3 + p, .panel > h3 + p.hint { margin-top: 0; }
.panel > h3 + .v-lbl, .panel > h3 + label { margin-top: 0; }
/* 整页表单第一项不要多出上边距 */
main > form.panel:has(> label:not(.inline)) > label:first-child,
main > form.panel:has(> label:not(.inline)) > label:first-child + * { margin-top: 0; }

/* 项目信息：右边有跟进记录栏，默认一列；屏幕够宽才两列 */
.form-2col { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1900px) { .form-2col { grid-template-columns: 1fr 1fr; } }

/* 整页表单：第一个字段不留上边距（前面可能有隐藏的 _csrf 字段，所以按类型算第一个） */
main > form.panel:has(> label:not(.inline)) > label:not(.inline):first-of-type,
main > form.panel:has(> label:not(.inline)) > label:not(.inline):first-of-type + * { margin-top: 0; }

/* 邮件正文：高度由脚本按内容撑开（没脚本时至少一屏） */
iframe.mail-body { display: block; min-height: calc(100vh - 360px); }
.mail-body-text { min-height: calc(100vh - 360px); }

/* ================= 规范·分页器（常规）：28 高方块，当前页主色底；跳至 [ ] 页 ================= */
.pg { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.pg-total { margin-right: 8px; color: var(--text-2); }
.pg-btn { min-width: 28px; height: 28px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
          border: 1px solid var(--border); border-radius: var(--r); background: #fff; color: var(--text); font-family: "Helvetica Neue", Arial, sans-serif; }
a.pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pg-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; pointer-events: none; }
.pg-btn.off { color: var(--text-disable); cursor: not-allowed; }
.pg-gap { color: var(--text-3); letter-spacing: 1px; }
.pg-jump { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 8px; color: var(--text-2); }
.pg-jump label { margin: 0; }
.pg-jump input { width: 56px; height: 28px; padding: 0 6px; text-align: center; }

/* 客户列表：公司行前的展开箭头（▸ 收起 / ▾ 展开），点开懒加载这家的人 */
.co-tg, .co-tg-sp { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.co-tg { min-width: 0; padding: 0; border: 0; background: none; color: var(--icon); position: relative; cursor: pointer; }
.co-tg::before { content: ""; position: absolute; left: 6px; top: 5px; border: 4px solid transparent; border-left-color: currentColor; border-left-width: 5px; transition: transform .15s; transform-origin: 2px 4px; }
.co-tg[aria-expanded=true]::before { transform: rotate(90deg); }
.co-tg:hover, .co-tg:active { background: none; color: var(--primary); border: 0; }
tbody.co.loading .co-tg::before { border-left-color: var(--primary); }

/* ================= 规范·标签页（卡片样式）：卡片顶部一条灰底，每个页签一个格子；选中 = 白底 + 主色字 + 顶部 2px 主色线，和下面内容连成一体 ================= */
.card-tabs { display: flex; align-items: stretch; background: var(--table-head); border-bottom: 1px solid var(--divider); border-radius: var(--r) var(--r) 0 0; }
.card-tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 28px; margin-bottom: -1px;
               font-size: 15px; color: var(--text); border-right: 1px solid var(--divider); border-bottom: 1px solid transparent; }
.card-tabs a:hover { color: var(--primary); background: #fff; }
.card-tabs a.on { background: #fff; color: var(--primary); font-weight: 500; border-bottom-color: #fff; }
.card-tabs a.on::before { content: ""; position: absolute; left: -1px; right: 0; top: 0; height: 2px; background: var(--primary); }
.card-tabs .cnt { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: #E9EBEF; color: var(--text-2);
                  font-size: 12px; font-weight: 400; display: inline-flex; align-items: center; justify-content: center; font-family: "Helvetica Neue", Arial, sans-serif; }
.card-tabs a.on .cnt { background: var(--primary-bg); color: var(--primary); }
.card-h.sub-h { min-height: 0; padding: 12px 24px; }
.card-h.sub-h .card-desc { flex-basis: auto; flex: 1; margin: 0; order: -1; }

/* 单封信：附件列表，名字在左、「下载」按钮在右 */
.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att-list li { display: flex; align-items: center; gap: 16px; }
.att-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.att-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40rem; }
.att-name .ic { color: var(--icon); }
.att-dl.is-loading { pointer-events: none; color: var(--primary); border-color: var(--primary); }
