/* ═══════════════════════════════════════════════════════════════
   Linear / shadcn 风格主题层
   加载顺序：style.css → workspace.css → date-select.css → compact.css → theme.css
   只覆盖视觉（颜色/边框/圆角/阴影/字体/间距微调），不改变布局结构。
   ═══════════════════════════════════════════════════════════════ */
:root{
  --bg:#fafafa;
  --surface:#ffffff;
  --surface-2:#f4f4f5;
  --surface-3:#fafafa;
  --ink:#18181b;
  --ink-2:#3f3f46;
  --muted:#71717a;
  --muted-2:#a1a1aa;
  --line:#e4e4e7;
  --line-strong:#d4d4d8;
  --accent:#5e6ad2;
  --accent-hover:#4f5ac2;
  --accent-weak:#eef0fb;
  --green:#16a34a;
  --green-weak:#ecfdf3;
  --orange:#d97706;
  --orange-weak:#fff7ed;
  --red:#dc2626;
  --red-weak:#fef2f2;
  --radius:6px;
  --radius-lg:10px;
  --shadow-sm:0 1px 2px rgba(24,24,27,.05);
  --shadow-md:0 4px 16px rgba(24,24,27,.08);
  --shadow-lg:0 24px 64px rgba(24,24,27,.22);
  /* 侧栏：中性浅灰底与深灰文字，绿色仅保留在品牌 LOGO */
  --nav-bg:#fafafa;
  --nav-ink:#525252;
  --nav-ink-strong:#171717;
  --nav-hover:rgba(0,0,0,.04);
  --nav-active:rgba(0,0,0,.08);
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
}
:root{background:var(--bg)}
html{font-family:var(--font);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;background:var(--bg)}
body{background:var(--bg);color:var(--ink);font-family:var(--font)}
::selection{background:var(--accent-weak);color:var(--ink)}
h1,h2,h3{letter-spacing:-.015em;color:var(--ink)}
a{color:var(--accent)}
.muted,small,.subtitle,.trend{color:var(--muted)}

/* ── 侧栏导航 ── */
.workspace-nav{background:var(--nav-bg);color:var(--nav-ink);border-right:1px solid #e5e5e5;padding-top:18px}
.workspace-nav a{color:var(--nav-ink);border-radius:var(--radius);transition:background .12s ease,color .12s ease;font-weight:500}
.workspace-nav a:hover{background:var(--nav-hover);color:var(--nav-ink-strong)}
.workspace-nav a.selected{background:var(--nav-active);color:var(--nav-ink-strong)}
.workspace-nav h2{color:#737373;font-size:10.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;margin:18px 12px 6px}
.workspace-nav .workspace-brand{color:var(--nav-ink-strong);font-weight:700;letter-spacing:-.02em}
.workspace-brand small{color:#737373;font-size:11px;letter-spacing:0}
.workspace-flow{color:#737373;border-top-color:#e5e5e5;font-size:11px}

/* ── 页头与内容 ── */
#app>header,.unified-workspace #app>header{background:var(--surface);border-bottom:1px solid var(--line);padding:18px 30px}
header h1{font-size:19px;font-weight:650}
header p{color:var(--muted);font-size:12px;margin-top:3px}
main{margin-top:20px}
.unified-workspace .main{padding:26px 30px}
.unified-workspace .title{font-size:22px;font-weight:650}

/* ── 按钮组件层 ──────────────────────────────────────────────
   基类：button / .btn（同一外观）
   变体：.primary  .secondary  .ghost  .danger  .link-button
   尺寸：.btn-sm  .btn-xs  .icon-btn
   页面只套类名，不再单独写按钮样式。 */
button,.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-height:30px;height:auto;padding:0 12px;border:1px solid var(--line);border-radius:var(--radius);
  background:var(--surface);color:var(--ink);font-size:13px;font-weight:500;line-height:1;
  cursor:pointer;white-space:nowrap;box-shadow:none;
  transition:background .12s ease,border-color .12s ease,color .12s ease;
}
button:hover,.btn:hover{background:var(--surface-2);border-color:var(--line-strong)}
button:disabled,.btn:disabled,.btn[disabled]{opacity:.45;cursor:not-allowed;background:var(--surface)}

/* 主按钮 */
button.primary,.btn.primary,.primary{background:var(--ink);border-color:var(--ink);color:#fff}
button.primary:hover,.btn.primary:hover,.primary:hover{background:#27272a;border-color:#27272a}
/* workspace.css 的同名规则优先级更高，这里显式覆盖 */
.unified-workspace .btn.primary{background:var(--ink);border-color:var(--ink);color:#fff}
.unified-workspace .btn.primary:hover{background:#27272a;border-color:#27272a}
/* 工具栏按钮统一 30px */
.toolbar button,.toolbar .btn,.filters button,.filters .btn{height:30px}
/* 次按钮（描边） */
button.secondary,.btn.secondary,.secondary{background:var(--surface);border-color:var(--line-strong);color:var(--ink)}
button.secondary:hover,.btn.secondary:hover,.secondary:hover{background:var(--surface-2);border-color:var(--muted-2)}
/* 幽灵按钮 */
button.ghost,.btn.ghost,.ghost{background:transparent;border-color:transparent;color:var(--muted)}
button.ghost:hover,.btn.ghost:hover,.ghost:hover{background:var(--surface-2);color:var(--ink)}
/* 危险按钮 */
button.danger,.btn.danger,.danger{background:var(--surface);border-color:var(--line);color:var(--red)}
button.danger:hover,.btn.danger:hover,.danger:hover{background:var(--red-weak);border-color:#fecaca}
/* 标签页激活态沿用主按钮外观 */
.tabs button.active,.subtabs button.active,.approval-tabs .link-button.active{background:var(--ink);color:#fff;border-color:var(--ink);box-shadow:none}

/* 尺寸 */
.btn-sm{height:26px;padding:0 10px;font-size:12px}
.btn-xs{height:24px;padding:0 8px;font-size:12px}
.icon-btn{width:30px;height:30px;padding:0}
button.close{width:30px;height:30px;padding:0;font-size:16px;color:var(--muted);background:transparent;border-color:transparent}

/* 表格内按钮保持紧凑，避免撑高行 */
.card table td button,.table td .btn,.table td button{height:24px;min-height:24px}

/* 链接按钮 */
.link-button{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;height:auto;padding:0;color:var(--accent);font-weight:500;box-shadow:none}
.link-button:hover{color:var(--accent-hover);text-decoration:underline;text-underline-offset:2px;background:transparent}
.crm-link{color:var(--accent)}
.crm-link:hover{color:var(--accent-hover)}

/* ── 表单控件 ── */
input,select,textarea,.input,.select{
  border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);color:var(--ink);
}
input::placeholder,textarea::placeholder{color:var(--muted-2)}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(94,106,210,.15);
}
input[readonly]{background:var(--surface-2);color:var(--muted)}
label{color:var(--ink-2);font-weight:500}

/* ── 卡片与表格 ── */
.card,.panel{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm);
}
table{color:var(--ink)}
th{
  background:var(--surface-3)!important;color:var(--muted);font-size:12px;font-weight:550;
  border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1;
}
td{border-bottom:1px solid var(--line);font-size:13px}
tbody tr:hover td{background:#fcfcfd}
tbody tr:last-child td{border-bottom:0}
td.company{color:var(--ink);font-weight:600}
.card table th{background:var(--surface-3)!important}

/* ── 统计 / 标签 / 状态 ── */
.stats{color:var(--muted)}
.stats b{color:var(--ink);font-weight:650}
.pill{border-radius:999px;background:var(--surface-2);color:var(--ink-2);font-size:12px;padding:3px 9px}
.pill.done,.done{background:var(--green-weak);color:var(--green)}
.tag{border-radius:999px;background:var(--surface-2);color:var(--ink-2);font-weight:500}
.tag.green{background:var(--green-weak);color:var(--green)}
.tag.orange{background:var(--orange-weak);color:var(--orange)}
.status.following:before{background:var(--green)}
.status.new:before{background:var(--accent)}
.status.public:before{background:var(--orange)}
.status.won:before{background:#22c55e}
.permission-yes{background:var(--green-weak);color:var(--green);border-radius:var(--radius)}
.permission-no{background:var(--red-weak);color:var(--red);border-radius:var(--radius)}

/* ── 弹窗 ── */
dialog{
  border:1px solid var(--line);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);
  background:var(--surface);
}
dialog::backdrop{background:rgba(9,9,11,.5);backdrop-filter:blur(2px)}
dialog header{border-bottom:1px solid var(--line)}
dialog h2{font-size:17px;font-weight:600}
dialog .buttons,.fixed-action-footer{background:var(--surface);border-top:1px solid var(--line)}
.fixed-action-panel>.fixed-action-footer{box-shadow:none}
dialog form,dialog .content{color:var(--ink)}

/* ── 横幅 / 提示 / 空态 ── */
.customer-banner,.linked-orders{border:1px solid var(--line);background:var(--surface-2);border-radius:var(--radius-lg);color:var(--ink-2)}
.customer-banner a,.linked-orders a{color:var(--accent)}
#toast{background:var(--ink);color:#fafafa;border-radius:var(--radius);box-shadow:var(--shadow-md);font-weight:500}
.empty{color:var(--muted-2)}

/* 登录页：不显示侧栏，卡片居中 */
body.login-mode.unified-workspace{padding-left:0}
body.login-mode .workspace-nav{display:none}
/* ── 登录页 ── */
.login{background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-sm);padding:32px}
.login h1{font-size:20px;font-weight:650}
.login button{width:100%}

/* ── 其它组件 ── */
.field-row,.permission-option,.service-customer-results{
  border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);
}
.field-row:hover,.permission-option:hover{border-color:var(--line-strong)}
.subtabs button,.approval-tabs .link-button{border-color:var(--line);background:var(--surface);color:var(--muted)}
.subtabs button.active,.approval-tabs .link-button.active{background:var(--ink);border-color:var(--ink);color:#fff}
.proxy-form-group{border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface)}
.proxy-form-group>summary{color:var(--ink);font-weight:600}
.dropdown-kinds button{border-radius:var(--radius)}
.pagebar{border-top:1px solid var(--line)}
.fixed-action-scroll{background:var(--surface)}
.card td.field-cell .cell-ellipsis{color:var(--ink-2)}
th.row-number{background:var(--surface-3)!important;color:var(--muted)}
td.row-number{background:var(--surface);color:var(--muted-2);font-variant-numeric:tabular-nums}

/* ── CRM 页面 ── */
.side{background:var(--nav-bg);color:var(--nav-ink);border-right:1px solid #e5e5e5}
.logo{color:var(--nav-ink-strong);font-weight:700;letter-spacing:-.02em}
.logo i{background:var(--accent);border-radius:4px}
.workspace{background:#ffffff;border:1px solid #e5e5e5;border-radius:var(--radius-lg)}
.workspace small{color:#737373}
.workspace b{color:var(--nav-ink-strong)}
.nav button{color:var(--nav-ink);border-radius:var(--radius);font-weight:500;transition:background .12s ease,color .12s ease}
.nav button.active,.nav button:hover{background:var(--nav-hover);color:var(--nav-ink-strong)}
.nav span{color:var(--accent)}
.side-foot{border-top-color:#e5e5e5;color:#737373}
.avatar{background:var(--accent);font-weight:600}
.main{color:var(--ink)}
.eyebrow{color:var(--accent);font-size:11px;font-weight:600;letter-spacing:.09em}
.title{font-size:24px;font-weight:650;letter-spacing:-.02em}
.cards .card,.metric{border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm)}
.metric-value{font-size:24px;font-weight:650;letter-spacing:-.02em;color:var(--ink);font-variant-numeric:tabular-nums}
.metric-label{color:var(--muted);font-size:12px;font-weight:500}
.metric-icon{color:var(--muted-2)}
.panel-head,.panel-title{border-color:var(--line);color:var(--ink)}
.crm-layout-settings{border-color:var(--line)}
.filters .search,.filters .select{border-color:var(--line);background:var(--surface)}
.tab{color:var(--muted);border-color:var(--line)}
.tab.active{color:var(--ink);border-color:var(--ink)}
.customer-name{color:var(--ink);font-weight:600}
.customer-name:hover{color:var(--accent)}
.face{background:var(--surface-2);color:var(--ink-2)}
.activity-row,.timeline-item{border-color:var(--line)}
.public-banner{background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius-lg);color:var(--ink-2)}
.modal{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg)}
.modal-back{background:rgba(9,9,11,.5);backdrop-filter:blur(2px)}
.modal-head,.modal-foot{border-color:var(--line)}
.modal-foot{background:var(--surface)}
.form-grid .field input,.form-grid .field select,.form-grid .field textarea{border-color:var(--line)}
.conversion-kinds button{border-color:var(--line)}
.detail-grid,.field{border-color:var(--line)}

/* ── 滚动条与焦点 ── */
*{scrollbar-width:thin;scrollbar-color:#d4d4d8 transparent}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#d4d4d8;border-radius:999px;border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:#a1a1aa;background-clip:content-box}
::-webkit-scrollbar-track{background:transparent}
.workspace-nav::-webkit-scrollbar-thumb,.side::-webkit-scrollbar-thumb{background:rgba(5,87,85,.18);background-clip:content-box}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline:none}

/* ══════════ 右侧内容区细化 ══════════ */
/* 统计：三张指标卡（数字在上、标签在下） */
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:10px 0 6px;color:var(--muted);font-size:12px}
.stats span{display:flex;flex-direction:column;gap:3px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);padding:12px 16px;box-shadow:var(--shadow-sm)}
.stats b{display:block;font-size:22px;font-weight:650;color:var(--ink);margin:0;font-variant-numeric:tabular-nums;letter-spacing:-.02em;line-height:1.2}
@media(max-width:760px){.stats{grid-template-columns:1fr}}

/* 工具栏：统一 32px 控件高度与间距 */
.toolbar{gap:8px;margin:12px 0 10px;align-items:center}
.toolbar input{max-width:340px;flex:1 1 260px}
.toolbar select,.toolbar input{min-height:32px}
.toolbar button,.toolbar .btn{height:32px;padding-top:0;padding-bottom:0}
.toolbar .primary{margin-left:auto}

/* 表格：48px 行高、表头小字、行悬停、隐藏列宽拖拽斜纹 */
.card table td,.card table th{height:48px;padding:6px 12px}
.card table th{font-size:12px;font-weight:500;color:var(--muted);resize:none;cursor:default}
.card table td{font-size:13px;color:var(--ink-2)}
.card table tbody tr:hover td{background:#f7f7f8}
.card table th::-webkit-resizer{background:transparent}
.card table th:first-child,.card table td:first-child{padding-left:8px;padding-right:8px}
.card table th.row-number,.card table td.row-number{padding-left:8px;padding-right:8px}

/* 表格导航条与分页条 */
.table-navigation{display:flex;justify-content:space-between;align-items:center;gap:10px;color:var(--muted);font-size:12px;margin:6px 0 10px;flex-wrap:wrap}
.pagebar{display:flex;justify-content:flex-end;align-items:center;gap:8px;border-top:1px solid var(--line);padding:10px 14px;color:var(--muted);font-size:12px}
.pagebar button{height:28px;padding:0 12px;font-size:12px;min-height:28px}

/* CRM 表格（.table 不在 .card 内）：表头、行悬停、去掉无效果的 resize 斜纹、操作按钮紧凑 */
.table th{font-size:12px;font-weight:500;color:var(--muted);background:var(--surface-3);border-bottom:1px solid var(--line);resize:none;cursor:default}
.table td{border-bottom:1px solid var(--line);font-size:13px;color:var(--ink-2)}
.table tbody tr:hover td{background:#f7f7f8}
.table td .btn{min-height:24px!important;padding:2px 8px!important;font-size:12px;border-radius:5px}
.table td .btn.ghost{padding:2px 6px!important}


/* ══════════ 全局一致性：工具栏 / 表格 / 目录 / 分段标签 ══════════ */
/* 工具栏：左侧筛选、右侧操作，统一 30px 控件 */
.toolbar,.filters{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:16px 0 12px}
.filters-left,.filters-right{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.filters-left{flex:1 1 auto;min-width:0}
.filters-right{margin-left:auto}
.toolbar input,.toolbar select,.filters input,.filters select{min-height:30px}
.toolbar input,.filters .search{max-width:300px;flex:1 1 210px}
.toolbar button,.toolbar .btn,.filters button,.filters .btn{min-height:30px;padding:4px 12px}
.toolbar .primary{margin-left:0}
.page-size{color:var(--muted);font-size:12px;display:inline-flex;align-items:center;gap:4px}
.page-size select{min-height:28px}

/* 表格统一：40px 行高、12px 表头、13px 内容、行悬停 */
.card table td,.card table th,.table td,.table th{height:40px;padding:5px 10px;font-size:13px}
.card table th,.table th{font-size:12px;font-weight:500;color:var(--muted);background:var(--surface-3);border-bottom:1px solid var(--line)}
.card table td,.table td{border-bottom:1px solid var(--line);color:var(--ink-2)}
.card table tbody tr:hover td,.table tbody tr:hover td{background:#f7f7f8}
.card table th:first-child,.card table td:first-child{padding-left:8px;padding-right:6px;overflow:visible;text-overflow:clip}
.table th:first-child,.table td:first-child{padding-left:12px}
.table th:last-child,.table td:last-child{padding-right:12px}

/* 产品目录：一个卡片容器 + 分隔线行，而非每行一张卡 */
.catalog-list{max-height:62vh;overflow:auto;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm)}
.catalog-row{padding:10px 14px;margin:0;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;display:flex;align-items:center;justify-content:space-between;gap:12px}
.catalog-row:last-child{border-bottom:0}
.catalog-row:hover{background:#fafafa}
.catalog-row b{font-size:13px;font-weight:600}
.catalog-row small{display:block;color:var(--muted);font-size:12px;margin-top:2px}
.catalog-row .btn{min-height:26px;padding:2px 10px;font-size:12px}

/* 设置页：业务类型改为分段控件 */
.dropdown-kinds{display:inline-flex;gap:2px;background:var(--surface-2);padding:3px;border-radius:8px;flex-wrap:wrap;border:0}
.dropdown-kinds button{border:0;background:transparent;box-shadow:none;border-radius:6px;padding:4px 12px;min-height:28px;color:var(--muted);font-weight:500}
.dropdown-kinds button:hover{background:rgba(0,0,0,.05);color:var(--ink)}
.dropdown-kinds button.primary{background:var(--surface);color:var(--ink);box-shadow:var(--shadow-sm)}

/* CRM 操作列：单行紧凑排布，行高与订单表一致 */
.table td:last-child{white-space:nowrap}
.table td:last-child .btn{margin:0 4px 0 0}
.table td .btn{padding:1px 7px!important;min-height:22px!important;font-size:12px;line-height:20px}

/* 账号权限矩阵：收紧单元格与按钮，避免横向溢出 */
.card .permission-matrix{width:100%}
.card .permission-matrix th:nth-child(n+2):nth-child(-n+8){width:110px}
.card .permission-matrix th:last-child{width:250px}
.card .permission-matrix td:last-child{white-space:nowrap}
.card .permission-matrix th,.card .permission-matrix td{padding:4px 6px}
.card .permission-matrix .permission-cell{padding:4px 2px;white-space:nowrap}
.permission-yes,.permission-no{padding:2px 8px;font-size:12px}
.permission-matrix td:last-child .btn{min-height:26px;padding:2px 6px;font-size:12px}
.permission-matrix th:first-child,.permission-matrix td:first-child{padding-left:12px}

/* 面板头：标题靠左，其余操作统一靠右（避免按钮被 space-between 挤到中间） */
.panel-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.panel-head .panel-title{flex:1 1 auto;min-width:0}
.panel-head .page-size{margin-left:auto}

/* 跟进记录/动态：压缩行高与间距 */
.activity-row{padding:10px 0}
.activity-row p{margin:2px 0 4px}

/* 弹窗内的配置列表：统一为「单容器 + 分行」，去掉逐项圆角卡片造成的双层嵌套 */
.dropdown-cards{display:block;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);max-height:56vh;overflow:auto;box-shadow:var(--shadow-sm);padding:0}
.dropdown-card{display:block;position:relative;width:100%;text-align:left;padding:9px 120px 9px 14px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;min-height:0;box-shadow:none}
.dropdown-card:last-child{border-bottom:0}
.dropdown-card:hover{background:#fafafa}
.dropdown-card strong{display:inline;font-size:13px;font-weight:600;margin-right:8px}
.dropdown-card small{display:inline;font-size:12px;color:var(--muted)}
.dropdown-card span{display:block;font-size:12px;color:var(--muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dropdown-card b{position:absolute;right:14px;top:50%;transform:translateY(-50%);font-size:12px;font-weight:500;color:var(--accent)}

/* 字段显示与排序列表：同样改为单容器 + 分隔行 */
.field-checks{display:block;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);overflow:hidden;gap:0;margin:10px 0}
.field-row{border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;padding:7px 12px}
.field-row:last-child{border-bottom:0}
.field-row:hover{background:#fafafa}

/* 表格滚动容器只负责滚动；面板本身是唯一外框，避免“面板套卡片”的双层圆角 */
.table-wrap{background:transparent;border:0;border-radius:0;box-shadow:none}

/* ══════════ 弹窗层统一 ══════════ */
/* 关联客户线索：列表行 + 次级按钮 */
#registrationCustomerResults{margin-top:10px;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);max-height:46vh;overflow:auto}
.pick-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;border-bottom:1px solid var(--line)}
.pick-row:last-child{border-bottom:0}
.pick-row:hover{background:#fafafa}
.pick-main{min-width:0}
.pick-main b{display:block;font-size:13px;font-weight:600;color:var(--ink)}
.pick-main small{display:block;font-size:12px;color:var(--muted);margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pick-row button{min-height:26px;padding:2px 10px;font-size:12px;flex-shrink:0}
.pick-empty{padding:14px;color:var(--muted);font-size:13px}

/* 小表单弹窗收敛宽度，避免 96vw 空旷 */
dialog:has(#export),dialog:has(#roleBasedUser),dialog:has(#delete){width:min(640px,92vw)}
dialog:has(#role),dialog:has(#roleTemplate),dialog:has(#permissions){width:min(680px,92vw)}
dialog:has(#export) form,dialog:has(#roleBasedUser) form,dialog:has(#delete) form{padding:18px 20px}

/* 弹窗内的 .card 不再形成第二层外框 */
dialog .card{border:0;box-shadow:none;border-radius:0;background:transparent}

/* 产品字段勾选：紧凑网格 chips */
.product-field-checks{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px 8px;max-height:46vh;overflow:auto;padding:12px;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface-2)}
.product-field-checks label{display:flex;flex-direction:row;align-items:center;gap:8px;padding:5px 8px;border-radius:6px;background:var(--surface);border:1px solid transparent;font-size:13px;color:var(--ink-2);cursor:pointer;line-height:1.3}
.product-field-checks label:hover{border-color:var(--line-strong)}
.product-field-checks input{width:15px;height:15px;accent-color:var(--accent);margin:0}

/* CRM 客户详情：收敛宽度、字段盒更紧凑 */
.modal{width:min(1080px,96vw)}
.modal .field{padding:8px 10px;border-radius:8px}
.modal .detail-grid{gap:10px}

/* 回收站表格弹窗与产品编辑弹窗宽度 */
dialog:has(.table-dialog){width:min(980px,96vw)}
dialog:has(#productEditor){width:min(1180px,96vw)}
#productEditor .fixed-action-scroll>label{flex-direction:row;align-items:center;gap:8px;font-weight:500;max-width:none}

/* 回收站弹窗：列宽自适应，避免时间列被挤断 */
dialog:has(.table-dialog) table{table-layout:auto}
dialog:has(.table-dialog) th:nth-child(3),dialog:has(.table-dialog) td:nth-child(3){width:190px}

/* 订单编辑：顶部关联横幅紧凑；关联客户内部 ID 不再暴露（由横幅展示客户信息） */
.customer-banner,.linked-orders{padding:10px 14px;margin:0 0 12px;border-radius:var(--radius-lg)}
.customer-banner p,.linked-orders p{margin:2px 0 6px}
dialog label:has(input[name="关联客户"]){display:none}

/* 订单编辑弹窗：区块/产品行扁平化，弹窗本身作为唯一外框 */
dialog .proxy-form-group{border:0;border-top:1px solid var(--line);border-radius:0;padding:14px 0 0;margin:14px 0 0;background:transparent}
dialog .proxy-form-group>summary{padding:0 0 10px;font-size:14px}
dialog .product-item{border:1px solid var(--line);border-radius:8px;margin:8px 0;padding:10px 12px;background:var(--surface-2)}
dialog .product-item>summary{color:var(--ink);font-weight:600}

/* ══════════ 间距规范 ══════════ */
/* 设计 token：4/8/12/16/20/24，按钮组统一 8px */
:root{--sp-1:4px;--sp-2:8px;--sp-3:12px;--sp-4:16px;--sp-5:20px;--sp-6:24px}
/* 页头右侧操作组 */
#app>header>div:last-child{display:flex;align-items:center;gap:var(--sp-2);flex-wrap:wrap}
/* 表格导航（字段顺序 / 左右查看） */
.table-navigation>span{display:inline-flex;align-items:center;gap:var(--sp-2);flex-wrap:wrap}
/* 产品目录行操作组 */
.catalog-row>span:last-child{display:inline-flex;align-items:center;gap:var(--sp-2)}
/* 弹窗底部按钮组 */
.buttons{display:flex;align-items:center;gap:10px;justify-content:flex-end;flex-wrap:wrap}
/* 表格内操作按钮统一 6px 间距 */
.card table td button,.table td .btn,.table td button{margin:0 6px 0 0}
.card table td button:last-child,.table td .btn:last-child{margin-right:0}
.permission-matrix td:last-child .btn{margin-right:6px}
/* CRM 布局设置里的上下移动按钮 */
.layout-field>span{display:inline-flex;align-items:center;gap:6px}

/* 下拉选项行内按钮、客户详情头部按钮组 */
.dropdown-option>span{display:inline-flex;align-items:center;gap:6px}
.modal-head>div:last-child{display:flex;align-items:center;gap:8px}

/* ══════════ 加载反馈 ══════════ */
.loading-bar{position:fixed;top:0;left:0;height:2px;width:100%;z-index:9999;pointer-events:none;opacity:0;transition:opacity .2s ease;background:linear-gradient(90deg,transparent 0,var(--accent) 45%,#a5b4fc 55%,transparent 100%);transform:translateX(-100%)}
.loading-bar.active{opacity:1;animation:loading-sweep 1.1s linear infinite}
@keyframes loading-sweep{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}
.spinner{display:inline-block;width:13px;height:13px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .7s linear infinite;vertical-align:-1px;flex:none}
@keyframes spin{to{transform:rotate(360deg)}}
button.is-loading{pointer-events:none;opacity:.75}
button.is-loading .spinner{margin-right:6px}
.app-boot{display:flex;align-items:center;justify-content:center;gap:10px;min-height:100vh;color:var(--muted);font-size:13px}
@media (prefers-reduced-motion:reduce){.loading-bar.active,.spinner{animation-duration:2.4s}.loading-bar.active{animation:none;opacity:.9}}

/* 首屏遮罩加载 */
.boot-overlay{position:fixed;inset:0;z-index:9998;background:var(--bg);display:flex;align-items:center;justify-content:center;gap:10px;color:var(--muted);font-size:13px}

/* ══════════ CRM 设置页（与账号与权限页同一套语言） ══════════ */
.main .top{padding-bottom:14px;margin-bottom:18px;border-bottom:1px solid var(--line)}
.main .top .title{font-size:22px;font-weight:700}
.main .top .subtitle{font-size:13px;color:var(--muted);margin-top:4px}

#settings .settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}
#settings .settings-team,#settings .settings-layout,#settings .settings-db{grid-column:1/-1}
#settings .panel{border-radius:var(--radius-lg);box-shadow:none;background:var(--surface)}
#settings .panel-head{padding:14px 16px;align-items:flex-start;border-bottom:1px solid var(--line)}
#settings .panel-title{font-size:14px;font-weight:600;color:var(--ink)}
#settings .panel-head .subtitle{font-size:12px;line-height:1.5;margin-top:3px}
#settings .settings-form{display:flex;gap:8px;padding:10px 16px;margin:0;border-bottom:1px solid var(--line)}
#settings .settings-form .input{flex:1;min-width:0}
#settings .activity{padding:6px}
#settings .activity-row{display:flex;align-items:center;gap:10px;padding:8px;border-radius:8px;border:0;background:transparent}
#settings .activity-row:hover{background:var(--surface-2)}
#settings .activity-row>div:nth-child(2){flex:1;min-width:0}
#settings .activity-row b{font-size:13px;font-weight:600}
#settings .activity-row p{font-size:12px;color:var(--muted);margin:2px 0 0;line-height:1.4}
#settings .activity-row .btn{min-height:24px;padding:0 8px;font-size:12px}
#settings .settings-list .activity{max-height:340px;overflow:auto}
#settings .org-row{flex-wrap:wrap}
#settings .org-row .manager-select{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);flex:none;max-width:none}
#settings .org-row .manager-select select{height:26px;min-height:26px;padding:0 24px 0 8px;font-size:12px;width:auto;max-width:150px}
#settings .crm-layout-settings{padding:10px 12px 12px;display:grid;gap:8px}
#settings .crm-layout-settings details{border:1px solid var(--line);border-radius:8px;padding:8px 10px;background:var(--surface)}
#settings .crm-layout-settings summary{cursor:pointer;font-size:13px;font-weight:600;color:var(--ink)}
#settings .crm-layout-settings summary small{color:var(--muted);font-weight:400;margin-left:4px}
#settings .crm-layout-settings .layout-fields{margin-top:8px;gap:2px}
#settings .layout-field{padding:5px 6px;background:transparent;border-radius:0;border-bottom:1px solid var(--line)}
#settings .layout-field:last-child{border-bottom:0}
#settings .layout-field label{max-width:none;flex:1;font-size:12px}
#settings .layout-field .btn{min-height:22px;padding:0 6px;font-size:12px}
#settings .settings-db .activity{padding:12px 16px}
@media(max-width:1100px){#settings .settings-grid{grid-template-columns:1fr}}

/* CRM 设置页细节 */
#settings .activity-row{border-radius:0;border-bottom:1px solid var(--line)}
#settings .activity-row:last-child{border-bottom:0}
#settings .settings-layout{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);overflow:hidden}
#settings .settings-layout>.panel-head{padding:14px 16px;border-bottom:1px solid var(--line)}
#settings .settings-layout>.buttons{padding:10px 16px;border-top:1px solid var(--line);margin:0;justify-content:flex-end}
#settings .settings-layout>.crm-layout-settings{padding:10px 14px}

/* 布局面板：外层只做栅格占位，视觉卡片由内部 .panel 承担（避免双层边框） */
#settings .settings-layout{background:transparent;border:0;border-radius:0;overflow:visible}
#settings .settings-layout .crm-layout-settings{padding:10px 14px}
#settings .settings-layout .panel>.buttons{margin:0;padding:10px 16px;justify-content:flex-end;border-top:1px solid var(--line)}
/* 来源/状态完整展示，不在卡片内滚动 */
#settings .settings-list .activity{max-height:none;overflow:visible}

/* ══════════ 订单页（与账号与权限页同语言） ══════════ */
#app>header{padding-bottom:16px;margin-bottom:0;border-bottom:1px solid var(--line)}
#app>header h1{font-size:22px;font-weight:700}
#app>header .muted{font-size:13px;margin-top:4px}
/* 统计摘要：一条容器、三分栏，替代三张独立卡片 */
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);overflow:hidden;margin:16px 0 14px}
.stats>span{display:flex;flex-direction:column;gap:2px;padding:12px 16px;border-right:1px solid var(--line);font-size:12px;color:var(--muted)}
.stats>span:last-child{border-right:0}
.stats b{font-size:20px;font-weight:650;color:var(--ink);line-height:1.25}
/* 订单卡片：工具栏/说明/表格/分页同一容器 */
.order-list-card{overflow:hidden}
.order-list-card .toolbar{padding:12px 16px;margin:0;border-bottom:1px solid var(--line);display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
.order-list-card .table-navigation{padding:8px 16px;margin:0;border-bottom:1px solid var(--line)}
.order-list-card .pagebar{padding:10px 16px;margin:0;border-top:1px solid var(--line);justify-content:flex-end}
.order-list-card thead th{background:var(--surface-2)}
.order-list-card .order-table-scroll{padding:0}
/* 订单表格改为整页滚动（与账号/CRM 页一致），避免内部滚动切半行 */
.order-list-card .order-table-scroll{max-height:none;overflow-y:visible}
#app>main{padding:0 30px}
/* 统计卡内部不再单独画卡片（只保留分栏线） */
.stats>span{border:0;border-right:1px solid var(--line);border-radius:0;box-shadow:none;background:transparent}
.stats>span:last-child{border-right:0}
/* 业务类型/分栏切换：改为分段控件 */
.tabs,.subtabs{display:inline-flex;gap:2px;padding:3px;border:1px solid var(--line);border-radius:8px;background:var(--surface-2);margin:0 0 10px}
.tabs button,.subtabs button{min-height:26px;height:26px;padding:0 10px;border:0;border-radius:6px;background:transparent;color:var(--muted);font-size:12px;box-shadow:none}
.tabs button:hover,.subtabs button:hover{background:rgba(24,24,27,.04);color:var(--ink)}
.tabs button.active,.subtabs button.active{background:var(--surface);color:var(--ink);border:1px solid var(--line);box-shadow:0 1px 2px rgba(24,24,27,.06)}

/* CRM 客户业务页：面板头部操作组 */
.panel-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}


/* 清风工作台：轻量导航、蓝色交互与有呼吸感的业务表单 */
:root{--accent:#4167d5;--accent-hover:#3154bc;--accent-weak:#edf2ff;--bg:#f8f8f7;--line:#e7e5e4;--ink:#202020;--muted:#737373}
.workspace-nav{background:#fff;border-right:0;padding:22px 16px;box-shadow:4px 0 24px #24324a04}
.workspace-nav section{border:0;background:transparent;box-shadow:none;margin-bottom:26px}
.workspace-nav section a{border:0;box-shadow:none;padding:10px 15px;margin:3px 0;border-radius:9px;color:#525252;font-weight:500}
.workspace-nav section a:hover{background:#f3f6ff;color:#4167d5}
.workspace-nav section a.selected{background:#edf2ff;color:#3158c4;font-weight:650;box-shadow:none}
.workspace-nav h2{color:#171717;font-size:17px;font-weight:800;line-height:1.4;letter-spacing:0;margin:22px 15px 10px}
.workspace-flow{border:0;color:#a0a9b8;font-size:10px;line-height:1.8;padding-top:8px}
.workspace-brand small{color:#929db0}.workspace-nav .workspace-brand{border:0;box-shadow:none}
.workspace-nav::-webkit-scrollbar-thumb{background:#d5dbea}
button.primary,.btn.primary,.primary,.unified-workspace .btn.primary{background:#4167d5;border-color:#4167d5;color:#fff;box-shadow:0 3px 8px #4167d51a}
button.primary:hover,.btn.primary:hover,.unified-workspace .btn.primary:hover{background:#3154bc;border-color:#3154bc}
.tabs,.subtabs,.dropdown-kinds,.approval-tabs{background:transparent;border:0;box-shadow:none;border-radius:0;padding:0;gap:8px}
.tabs button,.subtabs button,.dropdown-kinds button,.approval-tabs button{background:transparent;border:0;box-shadow:none;border-radius:7px;color:#7a879c;padding:8px 14px;min-height:35px}
.tabs button.active,.subtabs button.active,.dropdown-kinds button.primary,.approval-tabs button.active{background:#edf2ff;color:#3158c4;border:0;box-shadow:none;font-weight:650}
.tabs:has(+.subtabs){display:none}
.subtabs{margin:0 0 20px;display:flex;flex-wrap:wrap}
.stats{gap:16px;margin:12px 0 22px}
.stats span{border:0;background:#fff;box-shadow:none;border-radius:12px;padding:18px 22px;color:#7a879c}
.stats span:nth-child(2){background:#fff}
.stats span:nth-child(3){background:#fff}
.stats b{color:#202020;font-size:26px;margin-bottom:5px}
.card,.panel{border-color:transparent;box-shadow:0 4px 24px #33456505;border-radius:12px}
.dropdown-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 28px;background:transparent;border:0;border-radius:0;box-shadow:none;padding:4px 0}
.dropdown-card{padding:20px 72px 20px 12px;border:0;border-bottom:1px solid #edf0f7;border-radius:0;background:transparent;min-height:96px}
.dropdown-card:hover{background:#f5f8ff}.dropdown-card strong{display:block;font-size:14px;color:#344561;margin-bottom:6px}
.dropdown-card small{font-size:11px;color:#8a96aa}.dropdown-card span{color:#8090a8;font-size:12px;margin-top:7px}.dropdown-card b{color:#4167d5}
dialog:has(#record){width:min(1280px,96vw);border:0;border-radius:16px;box-shadow:0 24px 90px #263c6133}
dialog::backdrop{background:#162b4940;backdrop-filter:blur(3px)}
dialog:has(#record)>header{padding:20px 26px;border:0;background:#fff}
#record .fixed-action-scroll{background:#fff;padding:20px 26px}
#record .proxy-form-group{border:0;box-shadow:none;padding:0;margin:0 0 26px;background:transparent}
#record .proxy-form-group>summary{color:#202020;font-weight:650;font-size:15px;padding:10px 0 16px;border:0}
#record .product-item{border:0;background:#fff;border-radius:12px;padding:20px;margin:14px 0 24px;box-shadow:none}
#record .product-amount-row{gap:16px;padding:2px 0 16px;align-items:end}
#record .product-amount-row strong{font-size:15px;color:#262626;font-weight:650}
#record .product-amount-row small{font-size:11px;color:#737373}
#record .product-extra-fields{border:0;padding-top:0;margin-top:6px}
#record .product-extra-fields>summary{padding:10px 0 16px;color:#4167d5;font-size:12px}
#record .product-field-group{background:transparent;border:0;border-radius:0;margin:8px 0 24px;padding:0}
#record .product-field-group>summary{border:0;border-radius:0;padding:12px 0;color:#202020;font-size:16px;font-weight:750;list-style:none;display:flex;align-items:center;gap:9px}
#record .product-field-group>summary::-webkit-details-marker{display:none}
#record .product-field-group>summary::before{content:'›';color:#5c7ad0;font-size:20px;line-height:1;transform:rotate(0deg);transition:transform .15s}
#record .product-field-group[open]>summary::before{transform:rotate(90deg)}
#record .product-field-group>.grid{padding:10px 0;gap:20px 28px}
#record .product-field-group .grid>label{display:flex;flex-direction:column;align-items:stretch;gap:8px;font-size:12px;min-width:0}
#record .product-field-group .product-field-label{color:#525252;font-size:13px}
#record .product-field-group input:not([type=checkbox]),#record .product-field-group select{height:38px;min-height:38px;border:1px solid #dedede;border-radius:7px;background:#fff;padding:8px 11px;font-size:13px;color:#262626}
#record .product-field-group textarea{min-height:76px;border:1px solid #dedede;border-radius:7px;background:#fff;padding:10px 12px;font-size:13px}
#record .product-field-group input:focus,#record .product-field-group select:focus,#record .product-field-group textarea:focus{border-color:#7898eb;box-shadow:0 0 0 3px #4167d510}
#record .product-field-group label>small{color:#858585;font-size:11px;line-height:1.4}
#record .fixed-action-footer{border:0;box-shadow:0 -4px 20px #29436b06;padding:16px 26px;background:#fff}
@media(max-width:760px){.dropdown-cards{grid-template-columns:1fr}.subtabs{gap:3px}.subtabs button{padding:8px 10px}#record .fixed-action-scroll{padding:16px}#record .product-item{padding:14px}#record .product-field-group>.grid{grid-template-columns:1fr}}

/* 日期和只读字段与表单统一，避免蓝灰色蒙层 */
#record .product-field-group .date-display{min-height:38px;height:38px;border:1px solid #dedede;border-radius:7px;background:#fff;color:#404040;font-size:13px;padding:8px 11px}
#record .product-field-group .date-display:disabled,#record .product-field-group input:disabled,#record .product-field-group select:disabled,#record .product-field-group textarea:disabled{background:#fafaf9;color:#525252;opacity:1}
#record .product-field-group+.product-field-group{margin-top:30px}
#record .product-amount-row{background:#f8f8f6;border-radius:10px;padding:16px}
.workspace-nav section a{font-size:14px}
@media(max-width:800px){.workspace-nav h2{display:block;font-size:16px;margin:12px 10px 6px}.workspace-nav section{display:block;margin-bottom:8px}}

/* 页面和详情窗口统一品牌，侧栏品牌保持透明 */
.workspace-nav .workspace-brand,
.workspace-nav .workspace-brand:hover,
.workspace-nav .workspace-brand:active{background:transparent;box-shadow:none}
.page-brand-logo{display:block;width:132px;height:auto;max-width:100%;object-fit:contain;margin:0 0 10px}
#dialog>header .page-brand-heading{display:block;min-width:0}
#dialog>header .page-brand-heading h2{margin:0}
.modal-head .page-brand-logo{width:120px;margin-bottom:8px}
@media(max-width:600px){.page-brand-logo{width:112px;margin-bottom:8px}}
