/* 欣华科技订单管理系统 · 主题
   默认深色（黑底）；切到浅色只需给 <html> 加 data-theme="light"（见 [data-theme="light"] 覆盖块）。
   color-scheme 让下拉框、日期选择器、滚动条等原生控件一起跟随当前主题。
   所有状态徽标都用 --tone-* 变量，换主题不用改具体类。 */

:root {
  color-scheme: dark;
  /* ---- 基础面 ---- */
  --bg: #0b0b0d;          /* 页面底色（黑） */
  --panel: #16161a;       /* 卡片 / 侧边栏 / 弹窗 */
  --panel-2: #1d1d22;     /* 表头、次级容器 */
  --hover: #1f2430;       /* 表格行悬停 */
  --line: #2b2b32;
  --text: #e9e9ee;
  --muted: #9a9aa6;
  /* ---- 主色与强调色 ---- */
  --primary: #5b86ff;
  --primary-hover: #7a9dff;
  --danger-hover: #ff7075;
  --primary-soft: #2c3c6b;
  --primary-bg: #1a2237;
  --green: #35c26b;
  --orange: #fb923c;
  --red: #f2555a;
  --yellow: #fbbf24;
  --teal: #2dd4bf;
  --green2: #4ade80;
  --gray-line: #94a3b8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .55), 0 4px 16px rgba(0, 0, 0, .4);
  /* ---- 其它面 ---- */
  --login-bg: linear-gradient(135deg, #10162a 0%, #0b0b0d 55%, #0d1a17 100%);
  --overlay: rgba(0, 0, 0, .62);
  --toast-bg: #26262d;
  --scrollbar: #3a3a44;
  --scrollbar-hover: #4d4d5a;
  --tip-fg: #a8c6ff;
  --empty-fg: #4c4c57;
  /* ---- 状态色（徽标 / 流程节点）：底色 + 文字 + 描边 ---- */
  --tone-green-bg: #14361f;  --tone-green-fg: #7ee2a8;  --tone-green-line: #1e5330;
  --tone-amber-bg: #3a2a12;  --tone-amber-fg: #ffd08a;  --tone-amber-line: #5a3f18;
  --tone-red-bg: #3a1d20;    --tone-red-fg: #ff9aa0;    --tone-red-line: #55262b;
  --tone-blue-bg: #1a2942;   --tone-blue-fg: #a8c6ff;   --tone-blue-line: #23406b;
  --tone-indigo-bg: #23234a; --tone-indigo-fg: #bcc0ff; --tone-indigo-line: #33336a;
  --tone-cyan-bg: #12333a;   --tone-cyan-fg: #8ee6f0;   --tone-cyan-line: #174a54;
  --tone-purple-bg: #2a2246; --tone-purple-fg: #c9b6ff; --tone-purple-line: #3b3068;
  --tone-teal-bg: #12342f;   --tone-teal-fg: #86e5d6;   --tone-teal-line: #174a43;
  --tone-orange-bg: #3a2413; --tone-orange-fg: #ffc294; --tone-orange-line: #57351b;
  --tone-gray-bg: #26262c;   --tone-gray-fg: #b6b6c0;   --tone-gray-line: #33333b;
  --tone-yellow-bg: #3a2f12; --tone-yellow-fg: #ffe08a; --tone-yellow-line: #5a4718;
  /* ---- 提醒条目底色 ---- */
  --tint-blue: #141b2c; --tint-red: #251417; --tint-pink: #251419;
  --tint-orange: #251c12; --tint-yellow: #241f12;
  /* ---- 单位下拉箭头（数据 URI，随主题换色） ---- */
  --unit-arrow: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b6b6c0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --arrow-green: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237ee2a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --arrow-amber: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ffd08a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --arrow-blue: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a8c6ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- 浅色主题（侧边栏底部按钮切换） ---------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --hover: #f8faff;
  --line: #e6eaf1;
  --text: #1f2733;
  --muted: #7a8699;
  --primary: #2f6bff;
  --primary-hover: #2358e0;
  --danger-hover: #d0383d;
  --primary-soft: #9db9ff;
  --primary-bg: #eef3ff;
  --green: #16a34a;
  --orange: #c2410c;
  --red: #e5484d;
  --yellow: #f59e0b;
  --teal: #0d9488;
  --green2: #16a34a;
  --gray-line: #7a8699;
  --shadow: 0 1px 3px rgba(31, 39, 51, .06), 0 4px 16px rgba(31, 39, 51, .05);
  --login-bg: linear-gradient(135deg, #eaf0ff 0%, #f6f8fc 55%, #eef7f4 100%);
  --overlay: rgba(15, 23, 42, .45);
  --toast-bg: #1f2733;
  --scrollbar: #c3cad6;
  --scrollbar-hover: #a8b3c4;
  --tip-fg: #3b5bb5;
  --empty-fg: #c3cbd8;
  --tone-green-bg: #dcfce7;  --tone-green-fg: #15803d;  --tone-green-line: #bbf7d0;
  --tone-amber-bg: #fef3c7;  --tone-amber-fg: #b45309;  --tone-amber-line: #fde68a;
  --tone-red-bg: #fee2e2;    --tone-red-fg: #b91c1c;    --tone-red-line: #fecaca;
  --tone-blue-bg: #dbeafe;   --tone-blue-fg: #1d4ed8;   --tone-blue-line: #bfdbfe;
  --tone-indigo-bg: #e0e7ff; --tone-indigo-fg: #3730a3; --tone-indigo-line: #c7d2fe;
  --tone-cyan-bg: #cffafe;   --tone-cyan-fg: #0e7490;   --tone-cyan-line: #a5f3fc;
  --tone-purple-bg: #ddd6fe; --tone-purple-fg: #5b21b6; --tone-purple-line: #c4b5fd;
  --tone-teal-bg: #ccfbf1;   --tone-teal-fg: #0f766e;   --tone-teal-line: #99f6e4;
  --tone-orange-bg: #fff7ed; --tone-orange-fg: #c2410c; --tone-orange-line: #fed7aa;
  --tone-gray-bg: #f1f5f9;   --tone-gray-fg: #64748b;   --tone-gray-line: #e2e8f0;
  --tone-yellow-bg: #fef3c7; --tone-yellow-fg: #b45309; --tone-yellow-line: #fde68a;
  --tint-blue: #f5f8ff; --tint-red: #fff7f7; --tint-pink: #fff5f7;
  --tint-orange: #fffaf4; --tint-yellow: #fffdf4;
  --unit-arrow: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23475569' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --arrow-green: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2315803d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --arrow-amber: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b45309' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --arrow-blue: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231d4ed8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* 全局字号基准：所有 font-size 都用 rem 表达，改这一行即可整体缩放全站文字。
   16px = 原始字号；14px = 缩至 87.5%（当前）；15px 略大，13px 更小。 */
html { font-size: 14px; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 0.875rem; line-height: 1.5;
}
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; font-family: "SF Mono", Consolas, monospace; font-size: 0.8125rem; }
.muted { color: var(--muted); }
.small { font-size: 0.75rem; }
.c-green { color: var(--green); }
.c-orange { color: var(--orange); }
.c-red { color: var(--red); }
.link { color: var(--primary); text-decoration: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 0 !important; }
.warn-text { color: var(--orange); font-size: 0.75rem; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--login-bg); padding: 20px;
}
.login-card {
  width: 400px; max-width: 100%; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
  padding: 36px 32px;
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .logo { font-size: 2.5rem; }
.login-brand .logo img { height: 52px; display: inline-block; }
.login-brand h1 { font-size: 1.25rem; margin: 8px 0 4px; }
.login-hint { font-size: 0.75rem; margin-top: 14px; text-align: center; }
.build-tag { margin: 16px 0 0; text-align: center; font-size: 0.75rem; color: var(--muted); line-height: 1.6; opacity: .85; }
.field-note { display: block; margin-top: 6px; font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
.field-note-master { color: var(--primary); font-weight: 600; }
.check-row {
  display: flex; align-items: center; gap: 8px; margin: -2px 0 14px;
  font-size: 0.75rem; color: var(--muted); cursor: pointer; user-select: none;
}
.check-row input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.login-tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.login-tab {
  flex: 1; border: none; background: transparent; padding: 8px 10px; border-radius: 8px;
  font-size: 0.8125rem; color: var(--muted); cursor: pointer; font-family: inherit;
}
.login-tab.active { background: var(--panel); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.login-links { display: flex; justify-content: space-between; margin-top: 12px; }
.btn-link {
  background: none; border: none; color: var(--primary); font-size: 0.75rem; cursor: pointer;
  padding: 0; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.owner-tag, .sub-tag { font-size: 0.75rem; padding: 1px 5px; border-radius: 4px; }
.owner-tag { background: var(--primary-bg); color: var(--primary); }
.sub-tag { background: var(--bg); color: var(--muted); }
.sidebar-acts { display: flex; flex-direction: column; gap: 6px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9375rem; padding: 18px 14px 14px; white-space: nowrap; }
.brand-logo { font-size: 1.25rem; flex: none; display: flex; }
.brand-logo img { width: 22px; height: 22px; border-radius: 5px; display: block; }
.nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; }

/* ---------- 侧边栏父子级菜单（订单管理 / 财务管理） ---------- */
.nav-group { margin-bottom: 2px; }
.nav-parent { cursor: pointer; user-select: none; }
.nav-parent-label { flex: 1; min-width: 0; }
.nav-parent.has-active { color: var(--primary); }
.nav-parent.has-active .nav-parent-label { font-weight: 600; }
.nav-caret {
  flex: none; width: 22px; height: 22px; padding: 0; border: none; background: none; cursor: pointer;
  color: var(--muted); border-radius: 6px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
/* 用 CSS 三角代替 ▾ 字符：中文字体下 ▾ 渲染得过小 */
.nav-caret::before {
  content: ''; display: block; width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s;
}
.nav-group.open .nav-caret::before { transform: rotate(90deg); }
.nav-caret:hover { background: var(--panel-2); color: var(--text); }
.nav-parent:hover .nav-caret { color: var(--text); }
.nav-sub { display: none; margin: 2px 0 4px 6px; padding-left: 8px; border-left: 1px solid var(--line); }
.nav-group.open .nav-sub { display: block; }
.nav-sub-item { padding: 7px 10px; font-size: 0.8125rem; border-radius: 8px; }
.nav-sub-item .nav-icon { width: 18px; font-size: 0.875rem; }

/* 列表上方的说明条（当前筛选 + 清除按钮） */
.list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 14px 2px 8px; color: var(--muted); font-size: 0.8125rem;
}
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-bg); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.me-info { display: flex; flex-direction: column; line-height: 1.3; }
.main { flex: 1; min-width: 0; }
.page { padding: 22px 26px 40px; max-width: 1280px; margin: 0 auto; }

/* ---------- 页头（滚动时吸顶固定） ---------- */
.page-head {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  margin: -22px -26px 16px; padding: 14px 26px 12px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.page-head h2 { margin: 0 0 2px; font-size: 1.25rem; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; width: 220px; background: var(--panel);
  font-size: 0.8125rem; outline: none;
}
.search:focus { border-color: var(--primary); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px;
  padding: 8px 14px; font-size: 0.8125rem; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }
.btn-outline { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-text { border: none; background: none; padding: 4px 6px; color: var(--primary); }
.btn-text:hover { text-decoration: underline; }
.btn-text.danger { color: var(--red); }

/* 生产页「撤销」：灰色次要样式，不抢「推进」的视觉焦点，悬浮变红提示是回退 */
.tbl-production .th-ops { width: 210px; }
.tbl-production .th-ops .btn-text { padding: 2px 6px; }
.btn-text.undo-btn { color: var(--muted); }
.btn-text.undo-btn:hover { color: var(--red); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.ops { white-space: nowrap; }
.th-ops { width: 180px; }
.th-num { text-align: right; }
td.th-num { text-align: right; }

/* ---------- 卡片与统计 ---------- */
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 0.9375rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-grid.grid-5 { grid-template-columns: repeat(5, 1fr); }
.stat-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1180px) { .stat-grid.grid-5 { grid-template-columns: repeat(3, 1fr); } }
.stat-card {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
  border-left: 4px solid var(--line);
}
.stat-card.clickable { cursor: pointer; transition: .15s; }
.stat-card.clickable:hover { transform: translateY(-2px); }
.stat-card.active { outline: 2px solid var(--primary); }
/* 统计卡筛选状态条（前期欠款页） */
.scope-bar { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
.scope-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 10px;
  border-radius: 999px; background: var(--panel-2, var(--panel)); border: 1px solid var(--primary);
  color: var(--primary); font-size: 0.75rem;
}
.scope-x {
  border: 0; background: transparent; color: inherit; cursor: pointer; line-height: 1;
  font-size: 0.8125rem; padding: 2px 4px; border-radius: 999px;
}
.scope-x:hover { background: var(--line); }

/* 点击模块卡片后的筛选提示条 */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stat-label { color: var(--muted); font-size: 0.75rem; margin-bottom: 6px; }
.stat-value { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 0.75rem; margin-top: 4px; }
/* ---------- 看板模块：可展开 / 收起 ---------- */
.module { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.module-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer;
  user-select: none; border-bottom: 1px solid var(--line);
}
.module-head:hover { background: var(--hover); }
.mod-arrow { display: inline-block; width: 16px; text-align: center; color: var(--muted); transition: .15s; font-size: 0.8125rem; }
.mod-title { font-size: 0.9375rem; font-weight: 700; }
.mod-badge {
  background: var(--primary-soft); color: var(--primary); border-radius: 999px;
  padding: 1px 9px; font-size: 0.75rem; font-weight: 600;
}
.mod-hint { margin-left: auto; color: var(--muted); font-size: 0.75rem; opacity: .8; }
.module-body { padding: 16px; }
.module-body.collapsed { display: none; }
.mod-foot { margin-top: 12px; }
@media (max-width: 980px) { .mod-hint { display: none; } }

.c-blue { border-left-color: var(--primary); }
.c-green { border-left-color: var(--green); }
.c-green2 { border-left-color: var(--green2); }
.c-teal { border-left-color: var(--teal); }
.c-orange { border-left-color: var(--orange); }
.c-red { border-left-color: var(--red); }
.c-yellow { border-left-color: var(--yellow); }
.c-gray { border-left-color: var(--gray-line); }

/* ---------- 表格 ---------- */
/* 表格容器：自身成为纵向滚动视口（限高到页头下方），表头在容器内吸顶。
   注意：不能只用 overflow-x:auto —— 那会把 sticky 表头的滚动视口变成这个不纵向滚动的
   容器，Chrome 会把表头向下推出 top 偏移、悬停在表体中间盖住数据行 */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - var(--thead-top, 79px) - 30px);
}
/* 加宽滚动条，横向滚动更好抓取 */
.table-wrap::-webkit-scrollbar { height: 12px; width: 12px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 6px; border: 3px solid var(--panel); }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.75rem; white-space: nowrap; background: var(--panel-2); }
.table-wrap th { position: sticky; top: 0; z-index: 2; }
tbody tr:hover { background: var(--hover); }
.row-click { cursor: pointer; }
td.ops .btn-text { padding: 2px 4px; }

/* ---------- 订单 / 交货 主表（列多，整体加宽 + 多产品按行展开） ---------- */
.tbl-wide { min-width: 100%; width: auto; table-layout: auto; }
.tbl-wide th, .tbl-wide td { padding: 8px 14px; white-space: nowrap; vertical-align: middle; }
.tbl-wide th { position: sticky; top: 0; z-index: 2; }

/* ---------- 冻结左侧列（fx1..fx4：订单号/客户名称/下单日期/生产周期） ----------
   left 偏移由 U.freezeTable() 量宽后写入 --fx1..4；th 同时吸顶所以 z-index 更高 */
.tbl-wide .fx1, .tbl-wide .fx2, .tbl-wide .fx3, .tbl-wide .fx4 {
  position: sticky; background: var(--panel);
}
.tbl-wide .fx1 { left: var(--fx1, 0px); }
.tbl-wide .fx2 { left: var(--fx2, 0px); }
.tbl-wide .fx3 { left: var(--fx3, 0px); }
.tbl-wide .fx4 { left: var(--fx4, 0px); box-shadow: inset -1px 0 0 var(--line); }
.tbl-wide th.fx1, .tbl-wide th.fx2, .tbl-wide th.fx3, .tbl-wide th.fx4 { z-index: 5; }
.tbl-wide td.fx1, .tbl-wide td.fx2, .tbl-wide td.fx3, .tbl-wide td.fx4 { z-index: 3; }
.tbl-wide tbody tr:hover .fx1, .tbl-wide tbody tr:hover .fx2,
.tbl-wide tbody tr:hover .fx3, .tbl-wide tbody tr:hover .fx4 { background: var(--hover); }
.tbl-wide td.c-spec { white-space: normal; word-break: break-word; min-width: 12em; max-width: 18em; }
.tbl-wide td.c-name { min-width: 8em; }
.tbl-wide td.c-code { min-width: 7em; }
.tbl-wide td.c-unit { text-align: center; }
.tbl-wide th.th-tabcol, .tbl-wide td.th-tabcol { min-width: 7em; }
.tbl-wide .cell-group { vertical-align: middle; }
/* 同一订单的多行明细：行间虚线分隔，订单末行加实线收尾 */
/* 注意：类名必须是 detail-row，不能叫 item-row —— 那是订单表单明细编辑器( div, display:grid )的类名，同名会把表格行变成 grid 导致整表错乱 */
.tbl-wide tr.detail-row + tr.detail-row td { border-top: 1px dashed var(--line); }
.tbl-wide tr.detail-row.r-last td { border-bottom: 2px solid var(--line); }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px;
  font-size: 0.75rem; white-space: nowrap;
}
.badge-done { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.badge-pending { background: var(--tone-gray-bg); color: var(--tone-gray-fg); }
.badge-coming { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.badge-new { background: var(--primary-bg); color: var(--primary); }
.badge-overdue { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.badge-cat-finished { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.badge-cat-semi { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.badge-cat-raw { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.badge-tax-yes { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.badge-tax-no { background: var(--tone-orange-bg); color: var(--tone-orange-fg); }
/* 未税订单：不进入开票环节 */
.badge-na { background: var(--tone-gray-bg); color: var(--tone-gray-fg); }
/* 账期（结算方式）：现金 / 月结 */
.badge-cash { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.badge-monthly { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
/* 未收款管理：账期徽标由复用类承担，这里补收款相关的强调色 */
.tbl-receivable .c-red { color: var(--tone-red-fg); }
/* 应收表列多（12 列），左右内边距收窄一点，保证「操作」列不用横滚也能看到 */
.tbl-receivable th, .tbl-receivable td { padding: 8px 10px; }
.remind-item.receivable_due { border-left-color: var(--orange); background: var(--tint-yellow); }
.inv-btn { padding: 0; }

/* 商品类别：列表内可直接点选切换（外观同标签） */
.cat-sel {
  -webkit-appearance: none; appearance: none;
  border: 0; border-radius: 20px;
  padding: 2px 20px 2px 9px;
  font-size: 0.75rem; line-height: 1.6; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px 5px;
}
.cat-sel.cat-finished {
  background-color: var(--tone-green-bg); color: var(--tone-green-fg);
  background-image: var(--arrow-green);
}
.cat-sel.cat-semi {
  background-color: var(--tone-amber-bg); color: var(--tone-amber-fg);
  background-image: var(--arrow-amber);
}
.cat-sel.cat-raw {
  background-color: var(--tone-blue-bg); color: var(--tone-blue-fg);
  background-image: var(--arrow-blue);
}
.cat-sel:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.35); outline-offset: 1px; }
.cat-sel:disabled { opacity: 0.5; cursor: default; }

/* ---------- 列表内直接切换单位（外观为灰色胶囊，点击展开） ---------- */
.unit-sel {
  -webkit-appearance: none; appearance: none;
  border: 0; border-radius: 20px;
  padding: 2px 20px 2px 9px;
  font-size: 0.75rem; line-height: 1.6; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  background-color: var(--tone-gray-bg); color: var(--tone-gray-fg);
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px 5px;
  background-image: var(--unit-arrow);
}
.unit-sel:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.35); outline-offset: 1px; }
.unit-sel:disabled { opacity: 0.5; cursor: default; }

/* ---------- 标签页 ---------- */
.tab-bar { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 6px 14px;
  cursor: pointer; font-size: 0.8125rem; display: inline-flex; align-items: center; gap: 6px;
}
.tab i { font-style: normal; background: var(--bg); border-radius: 10px; padding: 0 7px; font-size: 0.75rem; color: var(--muted); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab.active i { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.field > span { font-size: 0.75rem; color: var(--muted); }
.field > span.req::after { content: " *"; color: var(--red); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 0.875rem; outline: none;
  background: var(--panel); color: var(--text); width: 100%;
}
.field textarea { resize: vertical; font-family: inherit; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-error { color: var(--red); font-size: 0.75rem; min-height: 18px; margin: 6px 0; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.delivery-live .delivery-value {
  border: 1px dashed var(--primary); background: var(--primary-bg); color: var(--primary);
  border-radius: 8px; padding: 9px 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.inline-select { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.confirm-text { margin: 4px 0; }

/* ---------- 可搜索下拉 ---------- */
.ss { position: relative; }
.ss-input {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 30px 9px 11px; font-size: 0.875rem;
  outline: none; background: var(--panel); color: var(--text); width: 100%;
}
.ss-input::placeholder { color: var(--muted); }
.ss-input:focus { border-color: var(--primary); }
.ss-caret { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.75rem; pointer-events: none; }
.ss-list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5); max-height: 230px; overflow-y: auto; padding: 4px;
}
.ss.open .ss-list { display: block; }
.ss-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 6px; font-size: 0.8125rem; cursor: pointer;
}
.ss-item:hover, .ss-item.active { background: var(--primary-bg); color: var(--primary); }
.ss-item.active .ss-sub, .ss-item:hover .ss-sub { color: var(--primary); opacity: .75; }
.ss-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-sub { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.ss-empty { padding: 12px 10px; color: var(--muted); font-size: 0.8125rem; text-align: center; }
/* 下拉底部的「新建」动作行 */
.ss-action {
  margin-top: 4px; padding: 9px 10px; border-radius: 6px; font-size: 0.8125rem; font-weight: 600;
  color: var(--primary); border-top: 1px dashed var(--line); cursor: pointer;
}
.ss-action:hover { background: var(--primary-bg); }
.code-row .ss { flex: 1; }

/* ---------- 订单产品明细编辑器 ---------- */
/* 注意：不能加 overflow:hidden —— 产品搜索下拉(.ss-list)是绝对定位，会被裁剪导致「无法搜索」 */
.items-editor { border: 1px solid var(--line); border-radius: 10px; }
.items-head { border-radius: 9px 9px 0 0; }
.item-row:last-child { border-radius: 0 0 9px 9px; }
.items-head, .item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 92px 108px 104px 32px;
  gap: 8px; align-items: center; padding: 8px 10px;
}
.items-head { background: var(--panel-2); font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.items-head .ta-r, .item-row .ta-r { text-align: right; }
.item-row + .item-row { border-top: 1px dashed var(--line); }
.item-row .ic-qty, .item-row .ic-price {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; font-size: 0.8125rem;
  background: var(--panel); color: var(--text); outline: none; width: 100%;
}
.item-row .ic-qty:focus, .item-row .ic-price:focus { border-color: var(--primary); }
.item-row .ic-amt { font-size: 0.8125rem; text-align: right; white-space: nowrap; }
.item-row .ic-del { padding: 2px 4px; font-size: 0.875rem; line-height: 1; }
.item-row .ss-input { padding: 8px 26px 8px 10px; font-size: 0.8125rem; }
.items-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.items-sum { color: var(--muted); font-size: 0.8125rem; }
.btn-sm { padding: 5px 11px; font-size: 0.75rem; }
.item-line { margin-bottom: 2px; }
.badge-multi { background: var(--primary-bg); color: var(--primary); margin-right: 4px; font-size: 0.75rem; padding: 1px 6px; }

/* ---------- 客户列：横向单行显示（禁止逐字竖排），超 8 字由 JS 截断 + title 悬停全称 ---------- */
.cust-cell { white-space: nowrap; word-break: keep-all; min-width: 7em; }

/* ---------- 表格复选框列（批量删除用） ---------- */
.th-ck { width: 36px; text-align: center; padding-right: 0 !important; }
.th-ck input { vertical-align: middle; cursor: pointer; }

/* ---------- 客户对接人：每行固定 3 个字符，超过自动换行 ---------- */
/* 换行由 JS 每 3 字插入 <br> 实现（views-customers.js 的 seg3）；此处 nowrap 保证组内不被二次折断
   （中文默认任意两字可断行，列窄时会折成 2+2），min-width 保证 3 字一行放得下 */
.contact-cell {
  white-space: nowrap;
  min-width: 3.2em;
}
.contact-cell .contact-name {
  line-height: 1.35;
  vertical-align: top;
}

/* ---------- 收款列：超宽自动截断省略，悬停 title 显示全部内容 ---------- */
.pay-cell .clip {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 表格里的长文本列（问题描述等）：截断 + 悬停 title 看全文 */
td.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 列表内嵌「产品明细」迷你表格 ---------- */
.mini-wrap .mini-toggle {
  border: none; background: none; padding: 0; font: inherit; font-size: 0.7812rem; color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px; text-align: left;
}
.mini-wrap .mini-toggle:hover { color: var(--primary); }
.mini-toggle b { font-weight: 600; }
.mini-caret { color: var(--muted); font-style: normal; font-size: 0.75rem; display: inline-block; transition: transform .15s; }
.mini-wrap.open .mini-caret { transform: rotate(180deg); }
.mini-wrap .mini-body { display: none; margin-top: 6px; }
.mini-wrap.open .mini-body { display: block; }
.mini-items { width: 100%; border-collapse: collapse; font-size: 0.7812rem; min-width: 300px; background: transparent; }
.mini-items th {
  text-align: left; font-weight: 600; color: var(--muted); background: transparent;
  padding: 0 10px 4px 0; border-bottom: 1px solid var(--line); font-size: 0.75rem; white-space: nowrap;
}
.mini-items td { padding: 4px 10px 4px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.mini-items tr:last-child td { border-bottom: none; }
.mini-items tbody tr:hover { background: transparent; }
.mini-items .mi-code { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.mini-items .mi-name { font-weight: 600; white-space: nowrap; }
.mini-items .mi-spec { color: var(--muted); word-break: break-all; }
.mini-items .mi-qty, .mini-items th.ta-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pay-info { display: flex; flex-direction: column; gap: 4px; background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start;
  justify-content: center; padding: 60px 16px 30px; z-index: 100; opacity: 0; transition: opacity .18s;
  overflow-y: auto;
}
.modal-overlay.show { opacity: 1; }
.modal { background: var(--panel); border-radius: 14px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.modal-head h3 { margin: 0; font-size: 1rem; }
.modal-x { border: none; background: none; font-size: 1.375rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 8px 20px 16px; }
.modal-foot { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }

/* ---------- 提示 ---------- */
#toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--toast-bg); color: #fff; border-radius: 8px; padding: 9px 16px; font-size: 0.8125rem;
  opacity: 0; transform: translateY(-8px); transition: .25s; box-shadow: var(--shadow); max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ---------- 导入 ---------- */
.import-tip { background: var(--primary-bg); color: var(--tip-fg); border-radius: 8px; padding: 10px 12px; font-size: 0.8125rem; margin-bottom: 12px; }
.import-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.file-label { display: inline-flex; align-items: center; }
.import-preview { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.alert { border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 0.8125rem; }
.alert-error { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.alert-ok { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.alert-info { background: var(--primary-bg); color: var(--tip-fg); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- 排行 / 图表 ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.rank-no { width: 22px; height: 22px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 0.75rem; display: flex; align-items: center; justify-content: center; flex: none; }
.rank-list li:first-child .rank-no { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.rank-name { width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
.rank-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-soft), var(--primary)); border-radius: 4px; }
.rank-val { flex: none; }
.chart-svg { width: 100%; height: auto; }
.chart-tick { font-size: 0.75rem; fill: var(--muted); }

/* ---------- 企业信息 ---------- */
.form-section { margin-bottom: 14px; }
.form-section h4 {
  margin: 0 0 8px; font-size: 0.8125rem; color: var(--primary); font-weight: 600;
  padding-left: 8px; border-left: 3px solid var(--primary);
}
.company-card { padding: 18px 20px; }
.company-head { align-items: flex-start; }
.company-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.company-title h3 { font-size: 1.0625rem; }
.progress-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.progress { flex: 1; max-width: 260px; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-soft), var(--primary)); }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; }
.info-item { background: var(--panel); padding: 9px 12px; display: flex; gap: 10px; }
.info-item.span2 { grid-column: span 2; }
.info-key { color: var(--muted); font-size: 0.75rem; width: 132px; flex: none; }
.info-val { font-size: 0.8125rem; word-break: break-all; }
.info-val.empty-val { color: var(--empty-fg); }
@media (max-width: 820px) { .info-grid { grid-template-columns: 1fr; } .info-item.span2 { grid-column: span 1; } }

/* ---------- 消息提醒 ---------- */
.notify-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.remind-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; flex-wrap: wrap; }
.remind-banner:hover { filter: brightness(.98); }
.remind-banner-go { font-weight: 600; white-space: nowrap; }
.remind-list { list-style: none; margin: 0; padding: 0; }
.remind-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 6px 11px 12px;
  border-bottom: 1px solid var(--line); border-left: 3px solid var(--line);
}
.remind-item:last-child { border-bottom: none; }
.remind-item.new_order { border-left-color: var(--primary); background: var(--tint-blue); }
.remind-item.overdue { border-left-color: var(--red); background: var(--tint-red); }
.remind-item.service_due { border-left-color: var(--red); background: var(--tint-pink); }
.remind-item.milestone2 { border-left-color: var(--orange); background: var(--tint-orange); }
.remind-item.milestone1 { border-left-color: var(--yellow); background: var(--tint-yellow); }
.remind-item.is-ignored { background: transparent; border-left-color: var(--line); opacity: .7; }
.remind-body { flex: 1; min-width: 0; }
.remind-title { font-weight: 600; font-size: 0.875rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.remind-desc { font-size: 0.8125rem; margin-top: 3px; }
.remind-meta { color: var(--muted); font-size: 0.75rem; margin-top: 3px; }
.remind-ops { display: flex; flex-direction: column; gap: 2px; flex: none; align-items: flex-end; }
.ignored-box { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 16px; }
.ignored-box > summary { cursor: pointer; font-weight: 600; font-size: 0.875rem; color: var(--muted); }
.ignored-box .remind-list { margin-top: 10px; }
@media (max-width: 820px) {
  .remind-item { flex-direction: column; }
  .remind-ops { flex-direction: row; align-items: flex-start; }
}

/* ---------- 生产流程状态 ---------- */
.badge-short { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.badge-preparing { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.badge-smt-ing { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.badge-dip-test { background: var(--tone-purple-bg); color: var(--tone-purple-fg); }
.badge-ready { background: var(--tone-indigo-bg); color: var(--tone-indigo-fg); }
.badge-smt { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.badge-dip { background: var(--tone-cyan-bg); color: var(--tone-cyan-fg); }
.badge-test { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.badge-packing { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.badge-ready-ship { background: var(--tone-teal-bg); color: var(--tone-teal-fg); }
.status-progress {
  display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: var(--line);
  overflow: hidden; vertical-align: middle; margin-left: 6px;
}
.status-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-soft), var(--primary)); }
.stage-board { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stage-chip {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 12px; cursor: pointer; box-shadow: var(--shadow); transition: .15s;
}
.stage-chip:hover { border-color: var(--primary); transform: translateY(-1px); }
.stage-chip.active { border-color: var(--primary); background: var(--primary-bg); }
.stage-chip b { font-size: 0.9375rem; }
.flow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.flow-node {
  font-size: 0.75rem; padding: 3px 9px; border-radius: 12px; background: var(--bg);
  color: var(--muted); border: 1px solid var(--line);
}
.flow-node.done { background: var(--tone-green-bg); color: var(--tone-green-fg); border-color: var(--tone-green-line); }
.flow-node.cur { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.flow-line { width: 12px; height: 1px; background: var(--line); flex: none; }
.select-auto { width: auto; }
.stage-rank { list-style: none; margin: 0; padding: 0; }
.stage-rank li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.stage-rank .badge { width: 88px; justify-content: center; flex: none; }

/* ---------- 成员审核与权限 ---------- */
.gate-card { text-align: left; }
.gate-info {
  display: flex; flex-direction: column; gap: 8px; background: var(--bg);
  border-radius: 10px; padding: 12px 14px; margin: 14px 0;
}
.gate-info > div { display: flex; justify-content: space-between; gap: 12px; font-size: 0.8125rem; }
.gate-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pending-card { border: 1px solid var(--tone-amber-fg); }
.pending-list { list-style: none; margin: 0; padding: 0; }
.pending-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.pending-item:last-child { border-bottom: none; }
.pending-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.row-dim { opacity: .62; }
.perm-tag {
  display: inline-block; background: var(--primary-bg); color: var(--tip-fg); border-radius: 6px;
  padding: 1px 8px; font-size: 0.75rem; margin: 1px 4px 1px 0;
}
.perm-list { display: flex; flex-direction: column; gap: 8px; }
.perm-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.perm-row:hover { border-color: var(--primary); background: var(--primary-bg); }
.perm-row input { margin-top: 3px; flex: none; }
.perm-row span { display: flex; flex-direction: column; gap: 2px; }
.perm-row i { font-style: normal; }
.invite-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.invite-step { display: flex; gap: 10px; align-items: flex-start; }
.invite-step > b {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 0.75rem; display: flex; align-items: center; justify-content: center;
}
.invite-link {
  background: var(--bg); border-radius: 6px; padding: 6px 10px; margin-top: 4px;
  word-break: break-all; font-size: 0.75rem; color: var(--primary);
}

/* 空状态 */
.empty-state { text-align: center; padding: 34px 16px; }
.empty-icon { font-size: 2.75rem; }
.empty-state h3 { margin: 10px 0 6px; font-size: 1rem; }
.empty-state p { max-width: 460px; margin: 0 auto 16px; }

/* 弹窗底部左侧复选框 */
.modal-foot.foot-split { justify-content: flex-start; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--muted); }
.flex-1 { flex: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav { display: flex; overflow-x: auto; padding: 6px; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { border-top: none; margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
  .sidebar-foot .me { margin-bottom: 0; }
  .sidebar-foot .btn-block { width: auto; }
  .page { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .search { width: 150px; }
}

/* ==========================================================================
   用户指定：侧边栏 / 按钮 / 表单 / 徽标 / 图表刻度 统一字号 = 1rem（当前 14px）
   这几类元素原本散落在 10.5~13px，统一抬到 14px。改根字号（html font-size）
   时它们会一起缩放；若将来只想单独调这一组，改这里的 1rem 即可。
   ========================================================================== */
.brand,
.nav-item,
.nav-sub-item,
.me-info b,
.me-info .small,
.me-info .mono,
.btn,
.btn-sm,
.btn-text,
.btn-link,
.field > span,
.field input,
.field select,
.field textarea,
.search,
.ss-input,
.ss-item,
.ss-empty,
.badge,
.owner-tag,
.sub-tag,
.chart-tick {
  font-size: 1rem;
}
/* 字号变大后配套微调：徽标收紧内边距，避免表格行高被抬太多 */
.badge { padding: 1px 8px; }
.chart-tick { font-size: 1rem; }

/* ==========================================================================
   侧边栏底部（账号信息 + 修改密码 / 切换主题 / 退出登录）单独缩小一档。
   上面的「五类文字统一 1rem」把这块也带大了，用户反馈偏大，这里按作用域
   覆盖回去：姓名与按钮 0.8125rem（≈11.4px），角色与账号 0.75rem（10.5px），
   头像 26px，内边距收紧。作用域限定 .sidebar-foot，不影响其它按钮与表单。
   ========================================================================== */
.sidebar-foot { padding: 9px 12px; }
.sidebar-foot .me { gap: 8px; margin-bottom: 7px; }
.sidebar-foot .avatar { width: 24px; height: 24px; font-size: 0.75rem; }
.sidebar-foot .me-info { line-height: 1.25; }
.sidebar-foot .me-info b { font-size: 0.8125rem; }
.sidebar-foot .me-info .small,
.sidebar-foot .me-info .mono { font-size: 0.75rem; }
.sidebar-foot .sidebar-acts { gap: 4px; }
.sidebar-foot .btn { font-size: 0.8125rem; padding: 5px 12px; border-radius: 7px; }

/* ==========================================================================
   表格分页器（订单录入页：每页 10 条）
   放在 .card 内、.table-wrap 下方；有分页器时表格容器要少留 46px 高度，
   否则「表头吸顶高度 + 表格最大高度 + 分页器」会超出视口。
   ========================================================================== */
.table-wrap.has-pager { max-height: calc(100vh - var(--thead-top, 79px) - 76px); }
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px 2px 0; margin-top: 2px; border-top: 1px solid var(--line);
}
.pager-info { color: var(--muted); font-size: 0.8125rem; }
.pager-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager .btn { padding: 4px 10px; }
.pager .btn[disabled] { opacity: .45; cursor: default; }
.pager-num { min-width: 32px; justify-content: center; }
.pager-num.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.pager-gap { color: var(--muted); padding: 0 2px; font-size: 0.8125rem; }

/* 生产表只冻结前两列（订单号 / 客户名称），右边界阴影落在 fx2 */
.tbl-production .fx2 { box-shadow: inset -1px 0 0 var(--line); }

/* ---------- 客户信用额度 / 锁定（2026-11-04） ---------- */
/* 系统级拦截弹窗：红圈叉 + 说明，只有「确认」一个出口 */
.sys-alert { display: flex; gap: 14px; align-items: flex-start; }
.sys-alert-icon {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--red); color: var(--red);
  font-size: 1.125rem; font-weight: 700; line-height: 1;
}
.sys-alert-text { font-size: 0.9375rem; line-height: 1.75; }
.sys-alert-sub {
  margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 0.8125rem; color: var(--muted); line-height: 1.7;
}

/* 客户账务弹窗：四格汇总 + 状态条 */
.credit-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.credit-cell {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px;
}
.credit-cell span { font-size: 0.75rem; color: var(--muted); }
.credit-cell b { font-size: 1rem; }
.credit-cell em { font-style: normal; font-size: 0.75rem; color: var(--muted); }
.credit-state { border-radius: 8px; padding: 9px 12px; font-size: 0.8125rem; line-height: 1.6; margin-bottom: 12px; }
.credit-state.is-ok { background: rgba(53, 194, 107, .12); color: var(--green); }
.credit-state.is-hold { background: rgba(251, 146, 60, .14); color: var(--orange); }
.credit-state.is-locked { background: rgba(242, 85, 90, .14); color: var(--red); }

.table-wrap.mini { max-height: 260px; }
.credit-hold { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.hold-row { display: flex; gap: 12px; margin-top: 8px; }
.hold-row .field { flex: 1; margin: 0; }

/* 前期欠款表：金额列右对齐等宽 */
.tbl-debts .th-num { text-align: right; }
