/* ============================================================
   外贸助手 · 设计系统
   单主色（深青），低饱和；中文优先字体栈；无 emoji
   层次：画布（淡青灰）→ 卡片（纯白 + 柔和投影）→ 悬浮层
   ============================================================ */

:root {
  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --border: #e3e9ed;
  --border-strong: #cfdcE4;
  --line: #edf1f4;

  --ink: #0f2027;
  --ink-2: #44545f;
  --ink-3: #7e8c99;

  --primary: #0f7d72;
  --primary-hover: #0b6359;
  --primary-deep: #084b44;
  --primary-soft: #e6f4f2;
  --primary-ring: rgba(15, 125, 114, .16);
  --accent: #2ab3a2;
  --accent-soft: rgba(42, 179, 162, .12);

  --success: #15803d;
  --success-soft: #e8f6ee;
  --warn: #b45309;
  --warn-soft: #fdf3e6;
  --danger: #b91c1c;
  --danger-soft: #fdeeee;
  --info: #0e7490;
  --info-soft: #e8f4f8;
  --neutral-soft: #eef1f5;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(15, 40, 46, .05);
  --sh-2: 0 1px 2px rgba(15, 40, 46, .05), 0 12px 28px -16px rgba(15, 40, 46, .18);
  --sh-3: 0 24px 64px -16px rgba(10, 35, 40, .30), 0 4px 16px rgba(10, 35, 40, .08);

  --sidebar-w: 232px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-elastic: cubic-bezier(.34, 1.56, .64, 1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1100px 420px at 18% -8%, rgba(15, 125, 114, .055), transparent 62%),
    radial-gradient(900px 380px at 100% 0%, rgba(14, 116, 144, .04), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: rgba(42, 179, 162, .26); }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c9d3da; border-radius: 8px; border: 2.5px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aebbc5; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   应用骨架
   ============================================================ */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background:
    radial-gradient(420px 260px at 10% -4%, rgba(42, 179, 162, .22), transparent 64%),
    radial-gradient(560px 360px at 112% 114%, rgba(42, 179, 162, .10), transparent 62%),
    linear-gradient(178deg, #0d2a2e 0%, #0b2429 48%, #092024 100%);
  color: #c3d9d8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
  box-shadow: 1px 0 0 rgba(255, 255, 255, .045), 14px 0 36px -22px rgba(8, 30, 35, .6);
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(140deg, #3ecdb8, #0d7d70 72%);
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: 0 8px 18px -8px rgba(42, 179, 162, .65), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-text { min-width: 0; }
.brand-title { color: #fff; font-size: 15.5px; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.brand-sub {
  font-size: 11px; color: #7fa6a4; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}

.nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.nav-group-label {
  font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  color: #5d8a88; padding: 18px 10px 7px; font-weight: 650;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 12px; border-radius: 10px; color: #b4cfcd;
  font-weight: 500;
  cursor: pointer; user-select: none; margin-bottom: 3px;
  transition: background .16s var(--ease), color .16s var(--ease), transform .12s var(--ease);
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item:active { transform: scale(.985); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(42, 179, 162, .24), rgba(42, 179, 162, .07));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(42, 179, 162, .26);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #4fe0cc, #1d9c8c);
  box-shadow: 0 0 14px rgba(79, 224, 204, .75);
}
.nav-item .ico { flex: none; opacity: .92; }
.nav-item .nav-badge {
  margin-left: auto; background: rgba(255, 255, 255, .13); color: #eafffb;
  font-size: 11px; font-weight: 600; padding: 1.5px 7.5px; border-radius: 20px; font-variant-numeric: tabular-nums;
}
.nav-item .nav-badge.hot { background: linear-gradient(180deg, #e08a2e, #b45309); box-shadow: 0 2px 8px -2px rgba(180, 83, 9, .6); }

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 12px; cursor: pointer; transition: background .16s var(--ease);
  background: rgba(255, 255, 255, .04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}
.user-chip:hover { background: rgba(255, 255, 255, .08); }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, #3ecdb8, #0d7d70 74%); color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 10px -4px rgba(42, 179, 162, .6);
}
.user-chip .u-name { color: #fff; font-size: 13px; line-height: 1.25; }
.user-chip .u-role { color: #7fa6a4; font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(14px) saturate(1.6);
  border-bottom: 1px solid rgba(16, 42, 47, .08);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 18.5px; letter-spacing: -.02em; }
.topbar .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }

/* 铃铛（站内提醒） */
.bell-btn { position: relative; }
.bell-btn svg { display: block; }
.bell-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread .notif-title { font-weight: 600; }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.notif-dot.info { background: var(--info); }
.notif-dot.warning { background: var(--warn); }
.notif-dot.danger { background: var(--danger); }

/* 附件面板 */
.att-drop { border: 1px dashed transparent; border-radius: var(--r); transition: border-color .15s, background .15s; }
.att-drop.dragging { border-color: var(--primary); background: var(--primary-soft); }
.att-item {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.att-item:last-child { border-bottom: none; }
.att-thumb {
  width: 34px; height: 34px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--border); flex: none;
}
.att-ico {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: var(--neutral-soft); color: var(--ink-3);
}
.att-actions { display: flex; gap: 2px; flex: none; }

.content { padding: 26px 28px 44px; flex: 1; }
.container { max-width: 1480px; margin: 0 auto; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 1.5px rgba(15, 40, 46, .05);
  transition: background .15s var(--ease), border-color .15s var(--ease),
              transform .12s var(--ease), box-shadow .15s var(--ease), color .15s var(--ease);
}
.btn:hover { background: #f8fafb; border-color: #b8c8d2; transform: translateY(-1px); box-shadow: 0 4px 12px -5px rgba(15, 40, 46, .22); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: 0 1px 1.5px rgba(15, 40, 46, .05); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: linear-gradient(180deg, #149387, var(--primary));
  border-color: var(--primary-deep); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 16px -7px rgba(15, 125, 114, .55);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #118277, var(--primary-hover));
  border-color: var(--primary-deep);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 20px -7px rgba(15, 125, 114, .6);
}
.btn-danger { background: linear-gradient(180deg, #c32d2d, var(--danger)); border-color: #8f1818; color: #fff; }
.btn-danger:hover { background: linear-gradient(180deg, #b02525, #991b1b); border-color: #8f1818; }
/* 「仍然继续」这类需要用户明确承担风险的动作：用 warning 色，别和主操作同色 */
.btn-warn { background: linear-gradient(180deg, #c26611, var(--warn)); border-color: #8a4008; color: #fff; }
.btn-warn:hover { background: linear-gradient(180deg, #a95a0e, #92400e); border-color: #8a4008; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: #eaf0f2; border-color: transparent; transform: none; box-shadow: none; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }

/* ============================================================
   表单
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field > label { font-size: 12.5px; font-weight: 560; color: var(--ink-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 1px 1.5px rgba(15, 40, 46, .04) inset;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { height: auto; min-height: 82px; padding: 9px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--primary-ring);
}
.input:disabled, .select:disabled, .textarea:disabled { background: #f1f4f6; color: var(--ink-3); cursor: not-allowed; box-shadow: none; }
.input.err, .select.err, .textarea.err { border-color: var(--danger); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.field .err-msg { font-size: 12px; color: var(--danger); }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237e8c99' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ============================================================
   卡片 / 面板
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid rgba(16, 42, 47, .075);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(15, 40, 46, .04), 0 14px 34px -24px rgba(15, 40, 46, .22);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; letter-spacing: -.01em; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 20px; }

.section { margin-bottom: 20px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 620; color: var(--ink-2);
  margin-bottom: 11px; letter-spacing: .01em;
}
.section-title::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

/* ============================================================
   统计卡
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  background: var(--surface);
  border: 1px solid rgba(16, 42, 47, .075); border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  box-shadow: 0 1px 2px rgba(15, 40, 46, .04), 0 14px 34px -24px rgba(15, 40, 46, .22);
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.stat::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(42, 179, 162, .5), transparent);
  opacity: .8;
}
.stat:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: rgba(16, 42, 47, .12); }
.stat-top { display: flex; align-items: center; gap: 9px; }
.stat-label { font-size: 12px; color: var(--ink-3); font-weight: 550; letter-spacing: .02em; }
.stat-ico {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); margin-left: auto; flex: none;
  box-shadow: inset 0 0 0 1px rgba(15, 125, 114, .08);
}
.stat-value {
  font-size: 30px; font-weight: 700; letter-spacing: -.032em;
  font-variant-numeric: tabular-nums; line-height: 1.08;
}
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }

/* 多币种金额：一币一行，绝不相加（见 ui.js fmtAmounts） */
.amount-stack {
  display: flex; flex-direction: column; gap: 1px;
  align-items: flex-start; line-height: 1.25;
}
.amount-line { display: flex; align-items: baseline; gap: 6px; font-size: 20px; letter-spacing: -.02em; }
.amount-line .cur {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-3); font-style: normal; text-transform: uppercase;
}
.amount-line b { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-stack.one .amount-line { font-size: 28px; letter-spacing: -.03em; }
.amount-stack.one .amount-line .cur { font-size: 11px; }
.stat-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
/* 多币种时脚注会变长，允许换行 */
.stat-foot.wrap { flex-wrap: wrap; gap: 4px 8px; }
.stat-foot .delta { font-weight: 600; }
.stat-foot .delta.up { color: var(--success); }
.stat-foot .delta.down { color: var(--danger); }
/* 强调卡：不再用左边框（圆角卡上很突兀），改用淡色渐变打底 */
.stat.accent { border-left: none; background: linear-gradient(135deg, rgba(15, 125, 114, .07), rgba(15, 125, 114, 0) 58%), var(--surface); }
.stat.accent::before { background: linear-gradient(90deg, transparent, rgba(42, 179, 162, .85), transparent); }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; padding: 2px 14px 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
/* 基础表格（弹窗里的小表格）：紧凑、细线 */
table.tbl th {
  text-align: left; font-weight: 620; font-size: 12px; color: var(--ink-2);
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  background: transparent; white-space: nowrap;
}
table.tbl td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
table.tbl tbody tr { transition: background .12s var(--ease); }
table.tbl tbody tr:hover { background: #f7fafb; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .mono { font-family: var(--mono); font-size: 12.5px; }
table.tbl .actions { white-space: nowrap; text-align: right; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--ink-3); }

/* 列表页的表格（.table-wrap 内）：行即卡片 —— 去「Excel 感」的关键一步。
   用 border-spacing 播出行间距，每行自己的底色 + 圆角 + 描边，
   悬停时描边转主色并微微上浮。表头去底色、改小号大写间距字。 */
.table-wrap table.tbl { border-collapse: separate; border-spacing: 0 5px; }
.table-wrap table.tbl thead th {
  font-size: 11px; font-weight: 620; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); padding: 4px 14px 7px;
  background: transparent; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
/* 描边只用上下（左右只给首/尾格）：若用 box-shadow 逐格描边，
   相邻两格的阴影会在中间叠出一条竖线，看起来又回到了 Excel 网格。 */
.table-wrap table.tbl tbody td {
  background: var(--surface); padding: 13px 14px;
  border: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  vertical-align: middle;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.table-wrap table.tbl tbody td:first-child {
  border-left: 1px solid var(--line); border-radius: 11px 0 0 11px;
}
.table-wrap table.tbl tbody td:last-child {
  border-right: 1px solid var(--line); border-radius: 0 11px 11px 0;
}
.table-wrap table.tbl tbody tr { cursor: default; }
.table-wrap table.tbl tbody tr.clickable { cursor: pointer; }
.table-wrap table.tbl tbody tr:hover td {
  background: #f5fbfa; border-color: rgba(15, 125, 114, .30);
}
.table-wrap table.tbl tbody tr:hover td:first-child { border-left-color: rgba(15, 125, 114, .30); }
.table-wrap table.tbl tbody tr:hover td:last-child { border-right-color: rgba(15, 125, 114, .30); }

/* 弹窗 / 抽屉里的明细表退回「紧凑细线」。
   它们本来就已经装在一个自带描边 + 圆角的盒子里（页面 JS 内联写的
   border:1px solid var(--border);border-radius:8px），此时再套行卡片会变成
   「盒子里飘着几条互不相干的记录」，5px 的行间隙还会让人看不出它们属于同一张单据。
   这里按容器把卡片化整段撤销 —— 不用改任何页面 JS，DOM 契约保持不变。 */
.overlay .modal .table-wrap,
.drawer .table-wrap { padding: 0; }
.overlay .modal .table-wrap table.tbl,
.drawer .table-wrap table.tbl { border-collapse: collapse; border-spacing: 0; }
.overlay .modal .table-wrap table.tbl thead th,
.drawer .table-wrap table.tbl thead th {
  position: static; font-size: 12px; font-weight: 620;
  letter-spacing: 0; text-transform: none;
  color: var(--ink-2); padding: 9px 12px;
}
.overlay .modal .table-wrap table.tbl tbody td,
.drawer .table-wrap table.tbl tbody td {
  padding: 10px 12px; border-radius: 0;
  border: none; border-bottom: 1px solid var(--line);
  background: transparent;
}
.overlay .modal .table-wrap table.tbl tbody td:first-child,
.drawer .table-wrap table.tbl tbody td:first-child { border-left: none; }
.overlay .modal .table-wrap table.tbl tbody td:last-child,
.drawer .table-wrap table.tbl tbody td:last-child { border-right: none; }
.overlay .modal .table-wrap table.tbl tbody tr:hover td,
.drawer .table-wrap table.tbl tbody tr:hover td {
  background: #f7fafb; border-color: var(--line);
}
.overlay .modal .table-wrap table.tbl tbody tr:last-child td,
.drawer .table-wrap table.tbl tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   徽章 / 标签
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  background: var(--neutral-soft); color: var(--ink-2); white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(16, 42, 47, .05);
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); box-shadow: inset 0 0 0 1px rgba(21, 128, 61, .14); }
.badge-warn { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(180, 83, 9, .14); }
.badge-danger { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px rgba(185, 28, 28, .14); }
.badge-info { background: var(--info-soft); color: var(--info); box-shadow: inset 0 0 0 1px rgba(14, 116, 144, .14); }
.badge-primary { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(15, 125, 114, .14); }
.tag {
  display: inline-block; padding: 1.5px 8px; border-radius: 6px; font-size: 11.5px;
  background: var(--neutral-soft); color: var(--ink-2); border: 1px solid var(--border);
}
.level-chip {
  display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 8px; font-size: 12px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(16, 42, 47, .06);
}
.level-A { background: #fee9e9; color: #b91c1c; }
.level-B { background: #fdf2d4; color: #a16207; }
.level-C { background: #e3f2fc; color: #075985; }
.level-D { background: #eef1f5; color: #64748b; }

/* ============================================================
   页签
   ============================================================ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab {
  padding: 9px 13px; font-size: 13.5px; font-weight: 500; color: var(--ink-3);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s var(--ease), border-color .15s var(--ease);
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ============================================================
   工具栏 / 筛选
   ============================================================ */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px;
}
.toolbar .grow { flex: 1; min-width: 160px; }
.search-box { position: relative; max-width: 300px; width: 100%; }
.search-box .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-box .input { padding-left: 33px; }
.toolbar .select { width: auto; min-width: 124px; }
.toolbar-spacer { margin-left: auto; }

/* ============================================================
   弹窗 / 抽屉
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 30, 40, .42);
  backdrop-filter: blur(2px);
  /* 必须高于抽屉（.drawer-overlay 110 / .drawer 111）：
     详情抽屉里到处都有「编辑」「新建跟进」这类弹窗入口，
     弹窗低于抽屉时会被抽屉盖掉一大半，footer 按钮根本点不到。
     又必须低于 toast（300），提示条要浮在最上层。 */
  z-index: 120;
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .18s var(--ease);
}
.modal {
  background: var(--surface); border-radius: 18px;
  width: 100%; max-width: 560px; max-height: 88dvh;
  display: flex; flex-direction: column; box-shadow: var(--sh-3);
  animation: modalIn .28s var(--ease);
}
.modal.wide { max-width: 900px; }
.modal.narrow { max-width: 420px; }
.modal.preview { width: min(980px, 94vw); height: min(94dvh, 1080px); max-width: none; max-height: none; }
.modal.preview .modal-body { padding: 0; display: flex; overflow: hidden; }
.modal.preview .modal-body iframe { flex: 1; width: 100%; border: 0; background: #525659; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px 16px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head h3 { font-size: 16px; letter-spacing: -.01em; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 22px; border-top: 1px solid var(--line); flex: none; background: var(--surface-2);
  border-radius: 0 0 18px 18px;
}

.drawer-overlay { position: fixed; inset: 0; background: rgba(12, 30, 34, .4); backdrop-filter: blur(2px); z-index: 110; animation: fadeIn .18s var(--ease); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw);
  background: var(--surface); z-index: 111; display: flex; flex-direction: column;
  box-shadow: var(--sh-3); animation: drawerIn .3s var(--ease);
}
.drawer-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line); flex: none;
}
.drawer-head .close { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

/* ============================================================
   Toast
   ============================================================ */
.toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: rgba(18, 32, 38, .94); backdrop-filter: blur(8px);
  color: #eaf2f4; padding: 11px 16px;
  border-radius: 12px; box-shadow: var(--sh-3); font-size: 13.5px;
  animation: toastIn .3s var(--ease); max-width: min(460px, 90vw);
}
.toast.success { background: rgba(16, 74, 42, .95); }
.toast.error { background: rgba(118, 26, 26, .95); }
.toast.warn { background: rgba(110, 50, 14, .95); }

/* ============================================================
   空态 / 加载 / 错误
   ============================================================ */
.empty { padding: 56px 20px; text-align: center; color: var(--ink-3); }
.empty .empty-ico {
  width: 56px; height: 56px; margin: 0 auto 15px; border-radius: 16px;
  background: linear-gradient(150deg, #f0f5f6, #e4ecef);
  box-shadow: inset 0 0 0 1px rgba(16, 42, 47, .05), 0 10px 22px -14px rgba(15, 40, 46, .35);
  display: grid; place-items: center; color: #9cb0b4;
}
.empty .empty-title { color: var(--ink-2); font-weight: 620; font-size: 15px; margin-bottom: 5px; }
.empty .empty-desc { font-size: 13px; max-width: 380px; margin: 0 auto 16px; line-height: 1.7; }

.skeleton {
  background: linear-gradient(90deg, #edf1f4 25%, #f7f9fa 37%, #edf1f4 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.sk-line { height: 12px; margin-bottom: 9px; }
.sk-card { height: 98px; border-radius: var(--r-lg); }
.sk-row { height: 52px; margin-bottom: 6px; border-radius: 11px; }

.loading-inline { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 40px; color: var(--ink-3); font-size: 13px; }
.spinner {
  width: 17px; height: 17px; border: 2px solid var(--border-strong);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
}

.error-box {
  padding: 20px; border-radius: var(--r); background: var(--danger-soft);
  border: 1px solid #f3c9c9; color: #7f1d1d; display: flex; gap: 11px; align-items: flex-start;
}
.error-box .title { font-weight: 600; margin-bottom: 3px; }
.error-box .msg { font-size: 13px; opacity: .9; }

/* ============================================================
   分页
   ============================================================ */
.pager {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-top: 1px solid var(--border); font-size: 13px; color: var(--ink-3);
}
.pager .pages { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 7px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
  display: grid; place-items: center; font-size: 13px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.pager .pg:hover:not(:disabled) { background: #f4f6f8; }
.pager .pg.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pg:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================
   图表（手写 SVG，无外部依赖）
   ============================================================ */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: #eef1f5; stroke-width: 1; }
.chart .axis-label { font-size: 11px; fill: var(--ink-3); }
.chart .bar { transition: opacity .15s var(--ease); cursor: pointer; }
.chart .bar:hover { opacity: .82; }
.chart .bar-label { font-size: 11px; fill: var(--ink-3); text-anchor: middle; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.chart-legend .lg { display: flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 3px; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #16242e; color: #fff; font-size: 12px; padding: 6px 9px;
  border-radius: 6px; white-space: nowrap; transform: translate(-50%, -120%);
  opacity: 0; transition: opacity .13s var(--ease); box-shadow: var(--sh-2);
}
.chart-tooltip.show { opacity: 1; }
/* 多币种提示：一币一行，并注明不做汇率折算 */
.chart-tooltip .tt-head { display: block; font-weight: 600; margin-bottom: 4px; opacity: .85; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; line-height: 1.55; }
.chart-tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tooltip .tt-row em { font-style: normal; opacity: .82; }
.chart-tooltip .tt-row b { font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 10px; }
.chart-tooltip .tt-note { display: block; margin-top: 5px; font-size: 10.5px; opacity: .6; }

.dist-list { display: flex; flex-direction: column; gap: 11px; }
.dist-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dist-item .name { width: 92px; flex: none; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-item .track { flex: 1; height: 7px; border-radius: 4px; background: #eef1f5; overflow: hidden; }
.dist-item .fill { height: 100%; border-radius: 4px; background: var(--primary); transition: width .5s var(--ease); }
.dist-item .val { width: 40px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); flex: none; }

/* ============================================================
   描述列表（详情）
   ============================================================ */
.desc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 22px; }
.desc-item .k { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.desc-item .v { font-size: 13.5px; color: var(--ink); word-break: break-word; }
.desc-item .v.mono { font-family: var(--mono); font-size: 12.5px; }

/* 时间线 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--primary);
}
.tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.tl-time { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.tl-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; }

/* ============================================================
   登录页（非对称分栏 + 产品预览卡）
   ============================================================ */
.auth { display: grid; grid-template-columns: 1.08fr .92fr; min-height: 100dvh; }
.auth-aside {
  background:
    radial-gradient(760px 460px at 12% -6%, rgba(42, 179, 162, .30), transparent 62%),
    radial-gradient(620px 420px at 108% 110%, rgba(42, 179, 162, .14), transparent 60%),
    linear-gradient(166deg, #103639 0%, #0c2a2f 52%, #092024 100%);
  color: #dceceb; padding: 52px 56px 44px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
/* 细网格底纹：给深色面板一点「工程感」的肌理，不再是死黑一块 */
.auth-aside::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(720px 480px at 26% 12%, rgba(0, 0, 0, .85), transparent 76%);
}
.auth-aside::after {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  right: -240px; bottom: -300px;
  background: radial-gradient(circle, rgba(42, 179, 162, .26), transparent 62%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 54px; position: relative; z-index: 1; }
.auth-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.auth-brand .t { color: #fff; font-size: 17.5px; font-weight: 650; letter-spacing: .01em; }
.auth-aside h2 {
  color: #fff; font-size: 35px; line-height: 1.26; letter-spacing: -.03em;
  margin-bottom: 16px; max-width: 16ch; position: relative; z-index: 1;
}
.auth-aside .lead { color: #a3c6c2; font-size: 15px; line-height: 1.78; max-width: 44ch; position: relative; z-index: 1; }

/* 产品界面预览卡：让访客在登录前就「看见产品长什么样」 */
.auth-mock {
  margin: 38px 0 0; max-width: 400px; position: relative; z-index: 1;
  background: rgba(255, 255, 255, .97);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 32px 64px -24px rgba(4, 22, 26, .65);
  transform: perspective(1200px) rotateY(-4deg) rotateX(1.6deg);
  transform-origin: left center;
}
.mock-bar {
  display: flex; align-items: center; gap: 5px;
  padding: 9px 12px; background: #eef3f4; border-bottom: 1px solid #e2eaec;
}
.mock-bar i { width: 8px; height: 8px; border-radius: 50%; background: #cfdadd; }
.mock-bar i:first-child { background: #f0a8a0; }
.mock-bar i:nth-child(2) { background: #f2cf9a; }
.mock-bar i:nth-child(3) { background: #a8dcc9; }
.mock-bar span { margin-left: 8px; font-size: 10.5px; color: #7e8c99; letter-spacing: .02em; }
.mock-body { padding: 14px 14px 16px; }
.mock-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.mock-kpis > div {
  background: #f7fafb; border: 1px solid #e8eef1; border-radius: 10px; padding: 9px 11px;
  display: flex; flex-direction: column; gap: 1px;
}
.mock-kpis b { font-size: 15px; letter-spacing: -.02em; color: #0f2027; font-variant-numeric: tabular-nums; }
.mock-kpis span { font-size: 10.5px; color: #7e8c99; }
.mock-chart { display: block; width: 100%; height: 64px; }
.mock-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.mock-row {
  display: flex; align-items: center; gap: 9px;
  background: #f7fafb; border: 1px solid #e8eef1; border-radius: 9px; padding: 7px 10px;
}
.mock-row .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.mock-row .bar { flex: 1; height: 5px; border-radius: 3px; background: #e6edf0; overflow: hidden; }
.mock-row .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #2ab3a2, #0f7d72); }
.mock-row .pct { font-size: 10.5px; color: #7e8c99; font-variant-numeric: tabular-nums; }

.auth-points { margin-top: auto; display: flex; flex-direction: column; gap: 17px; position: relative; z-index: 1; padding-top: 34px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; }
.auth-point .p-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  color: #5fd6c3; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.auth-point .p-t { color: #fff; font-size: 13.5px; font-weight: 620; margin-bottom: 2px; }
.auth-point .p-d { color: #8fb3b0; font-size: 12.5px; line-height: 1.65; }

.auth-main {
  display: grid; place-items: center; padding: 44px 24px;
  background:
    radial-gradient(720px 420px at 82% -4%, rgba(15, 125, 114, .07), transparent 62%),
    #f4f7f8;
}
.auth-form {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid rgba(16, 42, 47, .07);
  border-radius: 20px;
  padding: 34px 34px 28px;
  box-shadow: 0 1px 2px rgba(15, 40, 46, .04), 0 28px 64px -30px rgba(10, 35, 40, .30);
}
.auth-form h1 { font-size: 25px; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-form .sub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 26px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-3); }
.auth-switch a { font-weight: 560; cursor: pointer; }
.auth-alert {
  padding: 9px 12px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 14px;
  background: var(--danger-soft); color: #7f1d1d; border: 1px solid #f3c9c9;
}
.auth-alert.ok { background: var(--success-soft); color: #14532d; border-color: #bfe3cb; }

/* ============================================================
   版本选择（个人版 / 企业版入口）
   ------------------------------------------------------------
   为什么把「选版本」做成第一步而不是藏在菜单里：这两个版本的区别
   是**权限模型**而非功能清单，进去了再选就得重登一次，不如先问清楚。
   ============================================================ */
.edition-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 4px; }
.edition-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  text-align: left; cursor: pointer;
  padding: 18px 16px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color .16s, box-shadow .16s, transform .16s, background .16s;
}
.edition-card:hover {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 10px 26px -14px rgba(15, 125, 114, .5);
  transform: translateY(-2px);
}
.edition-card:active { transform: translateY(0); }
.edition-card .e-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; margin-bottom: 6px;
  background: var(--primary-soft); color: var(--primary);
}
.edition-card .e-t { font-size: 16px; font-weight: 620; letter-spacing: -.01em; }
.edition-card .e-d { font-size: 12.5px; color: var(--ink-3); }
.edition-card .e-list {
  list-style: none; margin: 8px 0 2px; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
}
.edition-card .e-list li {
  position: relative; padding-left: 15px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
}
.edition-card .e-list li::before {
  content: ''; position: absolute; left: 2px; top: 7px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--primary);
}
.edition-card .e-go {
  margin-top: auto; padding-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary);
}

/* 版本面板头部：返回按钮 + 当前版本标识 */
.pane-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.btn-back {
  border: none; background: none; padding: 4px 0; cursor: pointer;
  font-size: 13px; color: var(--ink-3); font-weight: 500;
}
.btn-back:hover { color: var(--primary); }
.edition-tag {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}

@media (max-width: 480px) {
  .edition-pick { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .edition-card { padding: 14px 14px 12px; }
  .edition-card .e-list { display: none; }   /* 手机上面板放不下卖点列表，保留标题与一句说明 */
  .edition-card .e-go { padding-top: 6px; }
}

@media (max-width: 1240px) {
  .auth-mock { display: none; }
  .auth-aside h2 { font-size: 30px; }
}

/* 初始密码提醒条（贴在主区域顶部，不遮挡内容、也不拦截操作） */
.pwd-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 auto; padding: 9px 14px;
  max-width: 1400px; width: 100%;
  border-radius: 0 0 var(--r) var(--r);
  background: linear-gradient(180deg, #fff8e8, #fef3d8);
  border: 1px solid #f0dcae; border-top: none;
  color: #6b4c14; font-size: 13px;
  animation: riseIn .28s var(--ease) both;
}
.pwd-banner.hidden { display: none; }
.pwd-banner-ico { display: inline-flex; color: #b7791f; flex: none; }
.pwd-banner .btn { flex: none; margin-left: auto; }
.pwd-banner .btn + .btn { margin-left: 0; }

/* ============================================================
   杂项工具类
   ============================================================ */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 10px; }
.gap-sm { gap: 6px; } .gap-lg { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nums { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* 客户详情 · 业务往来（询盘 / 报价单 / 订单 迷你列表，整行可点） */
.biz-group + .biz-group { margin-top: 14px; }
.biz-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 0 2px 6px;
}
.biz-head .badge { font-weight: 500; }
.biz-head .biz-more {
  margin-left: auto; font-size: 12px; font-weight: 500;
  color: var(--primary); background: none; border: 0; padding: 2px 4px;
  cursor: pointer; border-radius: var(--r-sm);
}
.biz-head .biz-more:hover { background: var(--primary-soft); }
.biz-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; text-align: left; width: 100%;
  background: var(--surface); font-family: inherit;
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.biz-row:hover { background: var(--surface-2); border-color: var(--border); }
.biz-row:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 1px; }
.biz-no {
  display: block; flex: none; min-width: 104px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
}
.biz-main { display: block; min-width: 0; flex: 1; }
.biz-title {
  display: block; font-size: 13px; color: var(--ink); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.biz-meta { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.biz-amt {
  display: block; flex: none; font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 600; color: var(--ink); text-align: right;
}
.biz-amt .biz-sub { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); text-align: right; }
.biz-empty { font-size: 12px; color: var(--ink-3); padding: 6px 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }

/* 动效 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes drawerIn { from { transform: translateX(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.rise { animation: riseIn .38s var(--ease) both; }
.stagger > * { animation: riseIn .4s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ============================================================
   响应式
   ============================================================ */
/* ⚠️ 单列轨道一律写 `minmax(0, 1fr)`，不能只写 `1fr`。
   `1fr` 等价于 `minmax(auto, 1fr)` —— 最小值是 auto，也就是**内容的 min-content**，
   于是「已逾期 20 天」这类 nowrap 徽章会把轨道撑到比屏幕还宽（实测 375px 下卡片 400px、
   整页横向溢出 42px）。写成 minmax(0, ...) 才允许轨道被压到 0、由内容自己折行。 */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .28s var(--ease); box-shadow: var(--sh-3);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 30, 40, .4); z-index: 39; animation: fadeIn .2s var(--ease); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .toolbar .search-box { max-width: none; }
  .stat-value { font-size: 23px; }
}

@media print {
  .sidebar, .topbar, .toolbar, .modal-foot, .pager, .drawer-head .close { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
}

/* ============================================================
   只读角色（财务）
   ------------------------------------------------------------
   财务能看全公司的钱，但不能改业务单据，所以写操作入口一律隐藏。
   这只是界面表现 —— 真正的权限由服务端 middleware/auth.js 的
   financeReadonly 强制，按钮万一露出来点了也是 403。

   注意 data-act 白名单里不含 add-payment：收款录入是财务的本职动作，
   服务端也单独放开了（见 server.js 的 /api/orders 挂载）。
   ============================================================ */
body.readonly-mode #btn-new,
body.readonly-mode #dash-new-customer,
body.readonly-mode [data-act="edit"],
body.readonly-mode [data-act="delete"],
body.readonly-mode [data-act="del"],
body.readonly-mode [data-act="save"],
body.readonly-mode [data-act="ok"],
body.readonly-mode [data-act="copy"],
body.readonly-mode [data-act="status"],
body.readonly-mode [data-act="claim"],
body.readonly-mode [data-act="release"],
body.readonly-mode [data-act="transfer"],
body.readonly-mode [data-act="follow"],
body.readonly-mode [data-act="quote"],
body.readonly-mode [data-act="to-order"],
body.readonly-mode [data-act="reset"],
body.readonly-mode [data-act="add-contact"],
body.readonly-mode [data-act="edit-contact"],
body.readonly-mode [data-act="del-contact"],
body.readonly-mode [data-act="add-shipment"] { display: none !important; }

/* ============================================================
   全局搜索（顶栏入口 + Ctrl/⌘+K 面板）
   ============================================================ */
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 34px; padding: 0 10px 0 11px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2, #f6f8fa); color: var(--ink-3);
  font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.search-btn:hover { border-color: var(--border-strong); color: var(--ink-2); background: #fff; }
.search-btn svg { display: block; }
.search-btn-label { white-space: nowrap; }
.search-kbd {
  font-family: var(--mono); font-size: 10.5px; line-height: 1;
  padding: 4px 5px; border-radius: 5px;
  border: 1px solid var(--border); background: #fff; color: var(--ink-3);
}
@media (max-width: 900px) {
  .search-btn-label, .search-kbd { display: none; }
  .search-btn { padding: 0 9px; }
}

.sp-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 27, 30, .38); backdrop-filter: blur(2px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 9vh 16px 16px;
}
.sp {
  width: 100%; max-width: 640px; max-height: 74vh;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 24px 60px rgba(15, 27, 30, .24);
  overflow: hidden;
}
.sp-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 13px 14px; border-bottom: 1px solid var(--border);
}
.sp-ico { color: var(--ink-3); display: flex; flex: none; }
.sp-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 15px; color: var(--ink);
}
.sp-input::-webkit-search-cancel-button { display: none; }
.sp-kbd, .sp-foot kbd {
  font-family: var(--mono); font-size: 10.5px; line-height: 1;
  padding: 4px 5px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-2, #f6f8fa); color: var(--ink-3);
}
.sp-body { overflow: auto; padding: 6px 0 8px; }
.sp-foot {
  display: flex; gap: 16px; flex: none;
  padding: 9px 14px; border-top: 1px solid var(--border);
  background: var(--surface-2, #f6f8fa);
  font-size: 11.5px; color: var(--ink-3);
}
.sp-foot span { display: inline-flex; align-items: center; gap: 5px; }

.sp-group-head {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px 5px; font-size: 11.5px; font-weight: 600;
  color: var(--ink-3); letter-spacing: .02em;
}
.sp-group-ico { display: flex; }
.sp-group-more { font-weight: 400; margin-left: auto; font-size: 11px; }
.sp-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; cursor: pointer;
  border-left: 2px solid transparent;
}
.sp-item.active { background: var(--primary-soft); border-left-color: var(--primary); }
.sp-main { min-width: 0; flex: 1; }
.sp-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.sp-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.sp-right { display: flex; align-items: center; gap: 9px; flex: none; font-size: 12.5px; color: var(--ink-2); }

.sp-intro { padding: 12px 14px 6px; }
.sp-intro-row { font-size: 12.5px; color: var(--ink-2); padding: 4px 0; }
.sp-tag {
  display: inline-block; min-width: 52px; margin-right: 8px; text-align: center;
  padding: 2px 7px; border-radius: 5px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 11px; font-weight: 600;
}
.sp-intro-note {
  margin-top: 8px; padding-top: 9px; border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--ink-3);
}
.sp-empty { padding: 26px 14px; text-align: center; font-size: 13px; color: var(--ink-3); }
