/* ===================== UnERP 设计系统 ===================== */
:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --primary-light: #e6f0ff;
  --success: #16a34a;
  --success-light: #e8f7ee;
  --warning: #d97706;
  --warning-light: #fef3e2;
  --danger: #dc2626;
  --danger-light: #fdeaea;
  --purple: #7c3aed;
  --cyan: #0891b2;

  --text: #1f2430;
  --text-2: #5b6478;
  --text-3: #8d95a6;
  --border: #e5e8ef;
  --border-2: #eff1f6;
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --bg-hover: #f7f9fc;

  /* 侧边栏主题变量（默认：明亮） */
  --sidebar-bg: #ffffff;
  --sidebar-text: #454d5f;
  --sidebar-sub: #8d95a6;
  --sidebar-brand-title: #1f2430;
  --sidebar-brand-sub: #8d95a6;
  --sidebar-tenant-name: #1f2430;
  --sidebar-tenant-bg: #f4f6fa;
  --sidebar-group: #9aa2b1;
  --sidebar-hover-bg: #f2f5fa;
  --sidebar-hover-text: #1f2430;
  --sidebar-active-bg: #e6f0ff;
  --sidebar-active-text: #1677ff;
  --sidebar-active-border: #1677ff;
  --sidebar-divider: #e9ecf2;
  --sidebar-tag-bg: #eaf1ff;
  --sidebar-tag-text: #1677ff;
  --sidebar-scroll: #d3d8e2;

  /* 暗色侧边栏主题（data-theme="dark" 时启用） */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 12px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 216px;
  --header-h: 56px;
}

/* ===================== 暗色侧边栏主题 ===================== */
[data-theme="dark"] {
  --sidebar-bg: #16202e;
  --sidebar-text: #b6c0cf;
  --sidebar-sub: #6b7686;
  --sidebar-brand-title: #ffffff;
  --sidebar-brand-sub: #6b7686;
  --sidebar-tenant-name: #e8ecf3;
  --sidebar-tenant-bg: rgba(255, 255, 255, .04);
  --sidebar-group: #59657a;
  --sidebar-hover-bg: rgba(255, 255, 255, .05);
  --sidebar-hover-text: #dfe5ee;
  --sidebar-active-bg: rgba(22, 119, 255, .14);
  --sidebar-active-text: #ffffff;
  --sidebar-active-border: #1677ff;
  --sidebar-divider: rgba(255, 255, 255, .07);
  --sidebar-tag-bg: rgba(22, 119, 255, .18);
  --sidebar-tag-text: #6cb2ff;
  --sidebar-scroll: #2c3949;
}
[data-theme="dark"] .combobox-list { background: #1f2a38; border-color: rgba(255, 255, 255, .12); }
[data-theme="dark"] .combobox-item:hover { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .combobox-item.on { background: rgba(22, 119, 255, .22); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d8e2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b9c0ce; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 布局 ===================== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 50;
  border-right: 1px solid var(--sidebar-divider);
}
.sidebar-brand {
  height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 18px;
  border-bottom: 1px solid var(--sidebar-divider); flex-shrink: 0;
}
.sidebar-brand .logo {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, #1677ff, #4dabf7);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.sidebar-brand .title { color: var(--sidebar-brand-title); font-weight: 600; font-size: 15px; letter-spacing: .3px; }
.sidebar-brand .sub { font-size: 11px; color: var(--sidebar-brand-sub); }
/* 企业 logo 覆盖整个顶部品牌区：拉伸铺满横条，去掉四周留白（贴合四条边） */
.sidebar-brand.has-logo { padding: 0; }
.sidebar-brand.has-logo .brand-logo {
  width: 100%; height: 100%; object-fit: fill; display: block; border-radius: 0;
}

.sidebar-tenant {
  padding: 12px 16px; border-bottom: 1px solid var(--sidebar-divider);
  font-size: 12px; line-height: 1.6; background: var(--sidebar-tenant-bg);
}
.sidebar-tenant .name { color: var(--sidebar-tenant-name); font-weight: 500; font-size: 13px; }
.sidebar-tenant .tag {
  display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 4px;
  background: var(--sidebar-tag-bg); color: var(--sidebar-tag-text); font-size: 11px;
}

.sidebar-menu { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: var(--sidebar-scroll); }

/* 语音输入麦克风按钮 */
.input.has-voice, .textarea.has-voice { padding-right: 36px; }
.voice-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 16px; line-height: 1; cursor: pointer; opacity: .5; user-select: none;
  padding: 5px; border-radius: 8px; z-index: 3; transition: opacity .15s, background .15s;
}
.voice-btn:hover { opacity: 1; background: var(--bg-2); }
.voice-btn.on { opacity: 1; color: #e5484d; background: rgba(229, 72, 77, .14); animation: voicePulse 1s infinite; }
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .55); }
  50% { box-shadow: 0 0 0 7px rgba(229, 72, 77, 0); }
}
/* 语音开单管家面板 */
.voice-agent { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: var(--bg-1); }
.voice-chat { max-height: 220px; overflow: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.voice-bubble { max-width: 85%; padding: 7px 11px; border-radius: 12px; font-size: 13px; line-height: 1.5; word-break: break-all; }
.voice-bubble.agent { align-self: flex-start; background: var(--primary); color: #fff; border-bottom-left-radius: 4px; }
.voice-bubble.user { align-self: flex-end; background: var(--bg-2); color: var(--text); border-bottom-right-radius: 4px; }
.voice-bar { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.voice-bar .js-voice-text { flex: 1; }
.voice-bar .js-voice-send { white-space: nowrap; }
.voice-bar .js-voice-mic.on { color: #e5484d; background: rgba(229, 72, 77, .14); animation: voicePulse 1s infinite; }
.voice-bar .js-voice-mic { white-space: nowrap; }
.sidebar-foot { flex-shrink: 0; padding: 8px 18px 12px; font-size: 11px; color: var(--sidebar-group); border-top: 1px solid var(--sidebar-divider); letter-spacing: .5px; }
/* 仪表盘底部「语音开单」长条入口 */
.voice-launch-bar { margin-top: 18px; }
.voice-launch-bar .js-voice-launch {
  width: 100%; justify-content: center; padding: 15px 16px; font-size: 15px; font-weight: 600;
  background: linear-gradient(90deg, #e5484d, #f0883e); border: none; color: #fff;
  box-shadow: 0 6px 18px rgba(229, 72, 77, .28); border-radius: 10px; letter-spacing: .5px;
}
.voice-launch-bar .js-voice-launch:hover { filter: brightness(1.05); }
/* 开单商品四级检索：名称 / 型号 / 规格 / 产地 */
.prod-search-4-row { display: flex; gap: 6px; }
.prod-search-4-row input { flex: 1; min-width: 0; }
.prod-search-4-row input.js-f-name { flex: 1.6; }
/* 台账页/出入库页四联检索：抵消 .toolbar .input 的 min-width:130px，让四框自由伸缩 */
.toolbar .prod-search-4-row input { min-width: 0; }
@media (max-width: 900px) {
  .prod-search-4 { min-width: 100% !important; }
  .prod-search-4-row { flex-wrap: wrap; }
  .prod-search-4-row input { flex: 1 1 46%; }
}
.menu-group { padding: 14px 18px 6px; font-size: 11px; color: var(--sidebar-group); letter-spacing: 1px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer;
  font-size: 13.5px; border-left: 3px solid transparent; transition: all .15s; position: relative;
}
.menu-item:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-hover-text); }
.menu-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); border-left-color: var(--sidebar-active-border); }
.menu-item .ico { width: 16px; text-align: center; font-size: 15px; opacity: .9; }
.menu-item.disabled { opacity: .45; cursor: not-allowed; }
.menu-item.disabled:hover { background: transparent; color: inherit; }
.menu-item .badge-dot {
  margin-left: auto; background: var(--danger); color: #fff; border-radius: 9px;
  padding: 0 6px; font-size: 11px; line-height: 17px; min-width: 18px; text-align: center;
}

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.header {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 14px; position: sticky; top: 0; z-index: 40;
}
.header .page-title { font-size: 16px; font-weight: 600; }
.header .spacer { flex: 1; }
.header .quick-scan {
  display: flex; align-items: center; gap: 6px; background: var(--primary-light); color: var(--primary);
  padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 13px; border: none;
}
.header .quick-scan:hover { background: #d6e6ff; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.user-chip:hover { background: var(--bg-hover); }
/* 站内信铃铛 + 未读徽标 */
.notif-bell {
  position: relative; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); cursor: pointer; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.notif-bell:hover { border-color: var(--primary); color: var(--primary); }
.notif-bell .badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px;
  text-align: center; box-shadow: 0 0 0 2px #fff;
}
.notif-bell .badge:empty { display: none; }
/* 有未读消息时铃铛持续闪动提醒：脉冲光环 + 徽标跳动 */
.notif-bell.has-unread { color: var(--danger); border-color: var(--danger); }
.notif-bell.has-unread::after {
  content: ''; position: absolute; inset: -2px; border-radius: 10px;
  border: 2px solid var(--danger); pointer-events: none;
  animation: notifPing 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.notif-bell.has-unread .badge { animation: notifBadgePulse 1.5s ease-in-out infinite; }
@keyframes notifPing {
  0%   { transform: scale(0.9); opacity: 0.8; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes notifBadgePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}
/* 站内信面板 */
.notif-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  position: relative; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-hover); cursor: pointer; transition: background .15s;
}
.notif-item.unread { background: var(--primary-light); border-color: var(--primary); }
.notif-item:hover { filter: brightness(0.98); }
.notif-item .dot { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.notif-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-content { white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.notif-list .empty { color: var(--text-3); text-align: center; padding: 24px 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #1677ff, #69b1ff);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.content { padding: 18px 20px 40px; flex: 1; }

/* ===================== 卡片 / 面板 ===================== */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat .label { color: var(--text-3); font-size: 12.5px; margin-bottom: 8px; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.5px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.stat .ico {
  position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: var(--primary-light); color: var(--primary);
}
.stat.green .ico { background: var(--success-light); color: var(--success); }
.stat.orange .ico { background: var(--warning-light); color: var(--warning); }
.stat.red .ico { background: var(--danger-light); color: var(--danger); }
.stat.purple .ico { background: #f3ebff; color: var(--purple); }
/* 毛利润卡片：金色描边高亮 */
.stat.profit { border: 1px solid #f0c060; background: linear-gradient(135deg, #fffdf5, #fff7e6); }
.stat.profit .value { color: #b7791f; }
.stat.profit.red .value { color: var(--danger); }
.stat.profit .ico { background: #fbe9b7; color: #b7791f; }
.stat.profit.red .ico { background: var(--danger-light); color: var(--danger); }
/* 可点击跳转的 KPI 卡片 */
.stat.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.stat.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.10); }
.stat.clickable::after { content: '›'; position: absolute; right: 12px; bottom: 10px; font-size: 20px; line-height: 1; color: var(--text-3); opacity: .55; }

/* 卡片显隐设置弹窗 */
.card-vis-list { display: flex; flex-direction: column; gap: 4px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.switch-row:hover { border-color: var(--primary); background: var(--bg-2); }
.switch-row span { font-size: 14px; }
.switch-row input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }
.vis-group + .vis-group { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-2); }

/* 企业 Logo 拖拽上传区 */
.logo-drop {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg-2);
  padding: 18px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  outline: none;
}
.logo-drop:hover, .logo-drop:focus-visible { border-color: var(--primary); background: var(--bg-3); }
.logo-drop.drag { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--bg-2)); }
.logo-drop-ic { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.logo-drop-t { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.vis-group-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.vis-group-title .small { font-weight: 400; }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; transition: all .15s;
  font-size: 13.5px; white-space: nowrap; line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ===================== 表单 ===================== */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.field > label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none; transition: all .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 119, 255, .1); }
.input:disabled, .select:disabled { background: #f6f7f9; color: var(--text-3); }
.textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }

/* ===================== 模糊搜索组合框（开单选客户） ===================== */
.combobox { position: relative; }
.combobox-list {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 30, 50, .14); padding: 4px;
}
.combobox-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.combobox-item:hover { background: #f3f6fb; }
.combobox-item.on { background: var(--primary-light); }
.combobox-item .bold { font-size: 13.5px; }
.combobox-empty { padding: 14px 10px; color: var(--text-3); font-size: 13px; text-align: center; }

/* 配送分区树（管理页 + 开单选区模态） */
.zone-tree { max-height: 60vh; overflow: auto; margin: -4px 0; }
.zone-node { padding: 7px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.zone-node:hover { background: var(--bg-2); }
.zone-node .zone-name { font-weight: 500; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar .spacer { flex: 1; }

/* ===================== 表格 ===================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  background: #fafbfd; color: var(--text-2); font-weight: 500; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 13px;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--bg-hover); }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .ops { white-space: nowrap; }
table.tbl .ops a { margin-right: 10px; cursor: pointer; font-size: 13px; }
table.tbl .ops a.danger { color: var(--danger); }
.order-no-link { color: var(--primary); cursor: pointer; text-decoration: none; }
.order-no-link:hover { text-decoration: underline; }
table.tbl tr.sel { background: var(--primary-light) !important; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 36px; opacity: .35; margin-bottom: 10px; }

.pager { display: flex; align-items: center; gap: 8px; padding: 14px 18px; justify-content: flex-end; flex-wrap: wrap; }
.pager .info { color: var(--text-3); font-size: 13px; margin-right: auto; }
.pager button {
  min-width: 32px; height: 32px; border: 1px solid var(--border); background: #fff;
  border-radius: var(--radius-sm); cursor: pointer; padding: 0 8px;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ===================== 标签 ===================== */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; line-height: 18px;
  background: #f0f2f5; color: var(--text-2); white-space: nowrap;
}
.tag.blue { background: var(--primary-light); color: var(--primary); }
.tag.green { background: var(--success-light); color: var(--success); }
.tag.orange { background: var(--warning-light); color: var(--warning); }
.tag.red { background: var(--danger-light); color: var(--danger); }
.tag.purple { background: #f3ebff; color: var(--purple); }
.tag.cyan { background: #e0f5fa; color: var(--cyan); }
.tag.gray { background: #f0f2f5; color: var(--text-3); }

.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 12.5px; }
.money { font-variant-numeric: tabular-nums; }
.money::before { content: "¥"; font-size: .85em; opacity: .7; margin-right: 1px; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.small { font-size: 12px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-col { display: flex; flex-direction: column; gap: 4px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }

/* ===================== 模态框 ===================== */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 900;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 560px; max-width: 100%;
  box-shadow: var(--shadow-lg); animation: slideUp .2s; margin: auto 0;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border-2); display: flex; align-items: center; }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .close { margin-left: auto; cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; }
.modal-head .close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border-2); display: flex; justify-content: flex-end; gap: 10px; }
.f8-hint { font-size: 12px; color: var(--text-3); align-self: center; user-select: none; }
.f8-hint::before {
  content: 'F8'; display: inline-block; margin-right: 4px; padding: 0 6px; border: 1px solid var(--border-2);
  border-bottom-width: 2px; border-radius: 4px; background: var(--bg-2); color: var(--text-2);
  font-family: Consolas, Monaco, monospace; font-size: 11px; line-height: 16px; vertical-align: 1px;
}
[data-theme="dark"] .f8-hint { color: rgba(255, 255, 255, .42); }
[data-theme="dark"] .f8-hint::before { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .7); }

/* ===================== 提示 ===================== */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #fff; padding: 10px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px; font-size: 14px; animation: slideDown .2s; max-width: 520px;
  border-left: 3px solid var(--primary);
}
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; }
.alert.info { background: var(--primary-light); color: #0b4fb3; }
.alert.warn { background: var(--warning-light); color: #92400e; }
.alert.error { background: var(--danger-light); color: #991b1b; }
.alert.success { background: var(--success-light); color: #14532d; }

.loading { padding: 46px; text-align: center; color: var(--text-3); }
.spin {
  width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== 标签页 ===================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs .tab {
  padding: 9px 16px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-2);
  font-size: 14px; white-space: nowrap;
}
.tabs .tab:hover { color: var(--primary); }
.tabs .tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ===================== 时间轴（物流轨迹） ===================== */
.timeline { padding: 6px 0 6px 4px; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--border);
  flex-shrink: 0; margin-top: 3px; z-index: 1;
}
.tl-item.first .tl-dot { border-color: var(--success); box-shadow: 0 0 0 4px var(--success-light); }
.tl-body { flex: 1; min-width: 0; }
.tl-item.first .tl-text { color: var(--text); font-weight: 500; }
.tl-text { color: var(--text-2); line-height: 1.55; font-size: 13.5px; }
.tl-time { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ===================== 条码 / 扫码 ===================== */
.barcode-box { text-align: center; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.barcode-box img { max-width: 100%; height: auto; }
.scan-input {
  font-size: 17px; padding: 12px 14px; letter-spacing: 1px; font-family: "SFMono-Regular", Consolas, monospace;
}
.scan-cam-wrap {
  position: relative; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  overflow: hidden; background: #0b0f17; aspect-ratio: 4 / 3; display: none;
}
.scan-cam-wrap.on { display: block; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-cam-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #c7d0dd; font-size: 14px; pointer-events: none;
}

.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.label-card { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 8px; text-align: center; background: #fff; }
.label-card .nm { font-size: 12px; margin-bottom: 4px; height: 32px; overflow: hidden; line-height: 16px; }
.label-card img { max-width: 100%; }

/* ===================== 明细行编辑 ===================== */
.items-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-tbl th { background: #fafbfd; padding: 8px 8px; border: 1px solid var(--border-2); font-weight: 500; color: var(--text-2); }
.items-tbl td { padding: 4px 6px; border: 1px solid var(--border-2); }
.items-tbl input, .items-tbl select { width: 100%; border: none; padding: 6px 4px; outline: none; background: transparent; }
.items-tbl input:focus { background: var(--primary-light); }
.items-tbl .del { color: var(--danger); cursor: pointer; text-align: center; }

/* ===================== 登录页 ===================== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1c2e 0%, #1a2f4b 45%, #163a5f 100%);
  position: relative; overflow: hidden; padding: 20px;
}
.login-page::before, .login-page::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35;
}
.login-page::before { width: 420px; height: 420px; background: #1677ff; top: -120px; right: -80px; }
.login-page::after { width: 360px; height: 360px; background: #0891b2; bottom: -120px; left: -60px; }
.login-wrap { display: flex; width: 900px; max-width: 100%; z-index: 1; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-intro { flex: 1; background: linear-gradient(160deg, #1677ff, #0958d9); color: #fff; padding: 44px 38px; }
.login-intro h1 { font-size: 25px; margin-bottom: 10px; letter-spacing: .5px; }
.login-intro p { opacity: .85; line-height: 1.7; font-size: 13.5px; }
.login-intro ul { list-style: none; margin-top: 26px; }
.login-intro li { padding: 7px 0; font-size: 13.5px; opacity: .95; display: flex; gap: 8px; align-items: center; }
.login-box { width: 400px; background: #fff; padding: 38px 36px; }
.login-box h2 { font-size: 21px; margin-bottom: 4px; }
.login-box .sub { color: var(--text-3); font-size: 13px; margin-bottom: 24px; }
.login-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.login-tabs div { padding: 8px 0; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; }
.login-tabs div.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.code-display {
  font-size: 40px; font-weight: 700; letter-spacing: 12px; text-align: center; color: var(--primary);
  padding: 18px 0 10px; font-variant-numeric: tabular-nums;
}
.demo-accounts { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--text-3); }
.demo-accounts b { color: var(--text-2); }
.demo-accounts .row { display: flex; justify-content: space-between; padding: 3px 0; cursor: pointer; }
.demo-accounts .row:hover { color: var(--primary); }

/* ===================== 移动端 ===================== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .login-wrap { flex-direction: column; width: 100%; }
  .login-intro { display: none; }
  .login-box { width: 100%; padding: 30px 22px; }
  .content { padding: 12px; }
  .form-grid, .form-grid.cols-2 { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; font-size: 20px; cursor: pointer; }
@media (max-width: 900px) { .menu-toggle { display: block; } }

/* ===================== 打印 ===================== */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* ===================== 合伙人 / 战略伙伴佣金卡片 ===================== */
.commission-card {
  border: 1px solid #f0c060;
  background: linear-gradient(135deg, #fffdf5, #fff7e6);
}
.commission-card .card-head h3 { color: #b7791f; }
/* 进度预警：当月佣金落后上月节奏时，卡片转琥珀色并轻微脉冲以吸引注意 */
.commission-card.commission-warn {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb, #fff3da);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .14);
  animation: commissionPulse 1.6s ease-in-out infinite;
}
@keyframes commissionPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, .14); }
  50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, .22); }
}
@media (prefers-reduced-motion: reduce) {
  .commission-card.commission-warn { animation: none; }
}
.commission-pace {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.55;
}
.commission-pace.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.commission-pace.warn { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.commission-flex { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.commission-item { min-width: 140px; }
.commission-op { font-size: 22px; font-weight: 700; color: var(--text-3); }
.big-num { font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: #1f2937; }
.big-num.accent { color: #b7791f; }
@media (max-width: 700px) {
  .commission-flex { gap: 12px; }
  .commission-op { font-size: 18px; }
  .big-num { font-size: 22px; }
}

/* ===================== 本月可能产生佣金卡片（CEO 驾驶舱） ===================== */
.commission-potential-card {
  border: 1px solid #f0c060;
  background: linear-gradient(135deg, #fffdf5, #fff7e6);
}
.commission-potential-card .card-head h3 { color: #b7791f; }
.cp-main { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.cp-total {
  min-width: 200px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #f3d99a;
  box-shadow: 0 1px 3px rgba(183, 121, 31, .08);
}
.cp-total-label { font-size: 13px; color: var(--text-3); }
.cp-total-value { font-size: 30px; font-weight: 800; color: #b7791f; letter-spacing: -.5px; line-height: 1.2; }
.cp-total-foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.cp-breakdown { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.cp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px; background: #fff;
  border: 1px solid #f3e2bd;
}
.cp-row-name { min-width: 84px; }
.cp-row-calc { flex: 1; color: var(--text-3); font-size: 14px; }
.cp-op { margin: 0 4px; font-weight: 700; color: var(--text-3); }
.cp-row-amount { font-size: 16px; min-width: 120px; text-align: right; }
@media (max-width: 700px) {
  .cp-main { gap: 14px; }
  .cp-total-value { font-size: 24px; }
}
