/* ═══════════════════════════════════════════
   回款监控管理系统 · 样式
   ═══════════════════════════════════════════ */

:root {
  --bg:            #f4f6fa;
  --panel:         #ffffff;
  --panel-2:       #fafbfd;
  --border:        #e3e8f0;
  --border-strong: #cbd5e1;
  --text:          #1e293b;
  --text-2:        #475569;
  --text-3:        #94a3b8;
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-soft:  #eff4ff;
  --cyan:          #0891b2;
  --amber:         #d97706;
  --purple:        #7c3aed;
  --green:         #059669;
  --red:           #dc2626;
  --red-soft:      #fef2f2;
  --green-soft:    #ecfdf5;
  --amber-soft:    #fffbeb;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.06);
  --shadow-lg:     0 10px 30px rgba(15,23,42,.12), 0 2px 8px rgba(15,23,42,.06);
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
code { font-family: var(--mono); background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* ───────── 登录 ───────── */
.login-mask {
  position: fixed; inset: 0; z-index: 99;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0891b2 100%);
}
.login-card {
  width: 380px; padding: 32px 30px 24px;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { font-size: 18px; }
.login-brand p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 12px; color: var(--text-2); }
.login-card input {
  width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-bottom: 8px; }
.login-tip { margin: 14px 0 0; font-size: 11.5px; color: var(--text-3); text-align: center; }

/* ───────── 布局 ───────── */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 208px; flex: none; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  display: flex; align-items: center; justify-content: center;
}
.brand-text strong { display: block; font-size: 14.5px; }
.brand-text span { font-size: 11px; color: var(--text-3); }
.nav { padding: 10px 10px; flex: 1; overflow: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; margin-bottom: 2px;
  border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; font-size: 13.5px;
  user-select: none;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.ic { width: 16px; height: 16px; flex: none; border-radius: 3px; background: currentColor; opacity: .75; }
.ic-dash  { clip-path: polygon(0 0,45% 0,45% 45%,0 45%,0 0,0 55%,45% 55%,45% 100%,0 100%,0 55%,55% 45%,100% 45%,100% 0,55% 0,55% 45%); }
.ic-list  { clip-path: polygon(0 20%,100% 20%,100% 30%,0 30%,0 20%,0 55%,100% 55%,100% 65%,0 65%,0 55%,0 90%,70% 90%,70% 100%,0 100%); }
.ic-export{ clip-path: polygon(38% 0,62% 0,62% 38%,100% 38%,100% 62%,62% 62%,62% 100%,38% 100%,38% 62%,0 62%,0 38%,38% 38%); }
.ic-cog   { clip-path: circle(38% at 50% 50%); }
.ic-dict  { clip-path: polygon(0 12%,100% 12%,100% 28%,0 28%,0 12%,0 44%,100% 44%,100% 60%,0 60%,0 44%,0 76%,70% 76%,70% 92%,0 92%); }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.who { margin-bottom: 10px; }
.who span { display: block; font-size: 13px; font-weight: 600; }
.who em { font-size: 11px; color: var(--text-3); font-style: normal; }
.sidebar-foot .btn { width: 100%; margin-top: 4px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 14px 22px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-title h2 { font-size: 18px; }
.topbar-title small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ───────── 业务模式切换（外贸 / 国内） ───────── */
.mode-switch {
  display: inline-flex; padding: 3px; gap: 2px; flex: none;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
}
.mode-switch button {
  padding: 5px 16px; font-size: 13px; font-family: inherit; font-weight: 500;
  color: var(--text-2); background: transparent; border: 0; border-radius: 999px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.mode-switch button:hover { color: var(--text); background: #eef2f7; }
.mode-switch button.on {
  color: #fff; background: var(--primary); box-shadow: 0 1px 3px rgba(37,99,235,.35);
}
.mode-switch button.on:hover { background: var(--primary-dark); }
body[data-mode="domestic"] .mode-switch button.on { background: var(--cyan); box-shadow: 0 1px 3px rgba(8,145,178,.35); }
body[data-mode="domestic"] .mode-switch button.on:hover { background: #0e7490; }

/* 只读提示条 */
.readonly-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding: 8px 12px; font-size: 12.5px; color: #92400e;
  background: var(--amber-soft); border: 1px solid #fde68a; border-radius: var(--radius-sm);
}
.filterbar { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.fld { display: flex; flex-direction: column; gap: 3px; }
.fld > span { font-size: 11px; color: var(--text-3); padding-left: 2px; }

select, input[type=text], input[type=date], input[type=number], input[type=password], textarea {
  padding: 6px 9px; font-size: 13px; font-family: inherit; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none; min-height: 32px;
}
select:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
input[type=date] { min-width: 138px; }

.content { flex: 1; overflow: auto; padding: 18px 22px 40px; }

/* ───────── 按钮 ───────── */
.btn {
  padding: 6px 13px; font-size: 13px; font-family: inherit; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); white-space: nowrap; transition: .12s;
}
.btn:hover { background: var(--panel-2); border-color: #94a3b8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ───────── 通用面板 ───────── */
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-hd h3 { font-size: 14px; }
.panel-hd small { color: var(--text-3); font-size: 11.5px; }
.panel-bd { padding: 14px 16px; }
.panel-bd.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.page-head .left h3 { font-size: 15px; }
.page-head .left p { margin: 3px 0 0; font-size: 12px; color: var(--text-3); }

/* ───────── KPI 卡片 ───────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.kpi.k-cyan::before   { background: var(--cyan); }
.kpi.k-amber::before  { background: var(--amber); }
.kpi.k-red::before    { background: var(--red); }
.kpi.k-green::before  { background: var(--green); }
.kpi.k-purple::before { background: var(--purple); }
.kpi-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.kpi-value { font-size: 22px; font-weight: 650; margin: 6px 0 3px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); }
.kpi-sub b { font-weight: 600; }
.kpi.v-red .kpi-value { color: var(--red); }
.kpi.v-green .kpi-value { color: var(--green); }
.kpi.v-amber .kpi-value { color: var(--amber); }
.progress { height: 5px; background: #eef2f7; border-radius: 3px; margin-top: 9px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width .4s; }
.progress.good i { background: var(--green); }
.progress.warn i { background: var(--amber); }
.progress.bad i  { background: var(--red); }

/* ───────── 图表 ───────── */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 14px; }
.chart-box { width: 100%; overflow: hidden; }
.chart-box svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 4px 6px; font-size: 11.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bar-track { height: 20px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 4px; }

/* 排名列表 */
.rank-list { display: flex; flex-direction: column; gap: 11px; }
.rank-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 12.5px; }
.rank-item .nm { font-weight: 500; }
.rank-item .vl { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rank-item .bar-track { grid-column: 1 / -1; }

/* ───────── 表格 ───────── */
.table-wrap { overflow: auto; max-height: calc(100vh - 250px); position: relative; }
.tbl { border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; }
.tbl th, .tbl td { padding: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tbl thead th { background: var(--panel-2); }
.tbl .grp-th {
  position: sticky; top: 0; z-index: 3; height: 26px; padding: 0 10px;
  font-size: 11.5px; font-weight: 600; color: #fff; text-align: center; letter-spacing: .5px;
}
.tbl .fld-th {
  position: sticky; top: 26px; z-index: 3; height: 38px; padding: 4px 8px;
  background: var(--panel-2); font-size: 11.5px; font-weight: 600; color: var(--text-2);
  text-align: center; vertical-align: middle; line-height: 1.25; cursor: pointer; user-select: none;
}
.tbl .fld-th:hover { background: #eef2f7; }
.tbl .fld-th .derived-tag { display: block; font-size: 9px; font-weight: 400; color: var(--text-3); margin-top: 1px; }
.tbl td { height: 30px; padding: 0 8px; vertical-align: middle; background: #fff; }
.tbl tbody tr:hover td { background: #f8fbff; }
.tbl tbody tr.sel td { background: var(--primary-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.tbl .ctr { text-align: center; }
.tbl .sticky-col { position: sticky; z-index: 2; background: #fff; }
.tbl thead .sticky-col { z-index: 4; }
.tbl tbody tr:hover .sticky-col { background: #f8fbff; }
.tbl tbody tr.sel .sticky-col { background: var(--primary-soft); }
.tbl td.warn { background: var(--red-soft) !important; color: #9f1239; font-weight: 600; }
.tbl td.editable { cursor: text; }
.tbl td.editable:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.tbl td input.cell-edit {
  width: 100%; height: 28px; border: none; padding: 0 6px; font: inherit; font-size: 12.5px;
  background: #fff; outline: 2px solid var(--primary); outline-offset: -2px;
}
.tbl-empty { padding: 50px; text-align: center; color: var(--text-3); }
.row-actions { display: flex; gap: 4px; justify-content: center; }
.mini-btn {
  border: none; background: transparent; cursor: pointer; padding: 2px 6px; border-radius: 4px;
  font-size: 12px; color: var(--text-2);
}
.mini-btn:hover { background: #eef2f7; color: var(--text); }
.mini-btn.del:hover { background: var(--red-soft); color: var(--red); }

/* 徽标 */
.pill {
  display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px;
  font-weight: 600; line-height: 17px; white-space: nowrap;
}
.pill-gray   { background: #f1f5f9; color: #475569; }
.pill-blue   { background: #dbeafe; color: #1d4ed8; }
.pill-cyan   { background: #cffafe; color: #0e7490; }
.pill-amber  { background: #fef3c7; color: #b45309; }
.pill-red    { background: #fee2e2; color: #b91c1c; }
.pill-green  { background: #d1fae5; color: #047857; }
.pill-purple { background: #ede9fe; color: #6d28d9; }

/* ───────── 工具条 ───────── */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search input { padding-left: 28px; width: 220px; }
.search::before {
  content: ''; position: absolute; left: 9px; top: 50%; margin-top: -5px;
  width: 10px; height: 10px; border: 1.5px solid var(--text-3); border-radius: 50%;
  border-right-color: transparent; border-bottom-color: transparent; transform: rotate(45deg);
}
.chip-group { display: flex; gap: 2px; background: #eef2f7; padding: 2px; border-radius: 8px; }
.chip {
  padding: 5px 11px; font-size: 12.5px; border-radius: 6px; cursor: pointer; border: none;
  background: transparent; color: var(--text-2); font-family: inherit;
}
.chip.on { background: #fff; color: var(--primary-dark); font-weight: 600; box-shadow: var(--shadow); }

/* ───────── 抽屉 / 弹窗 ───────── */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-mask, .modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.42); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(860px, 92vw);
  background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-hd { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-hd h3 { font-size: 15px; }
.drawer-bd { flex: 1; overflow: auto; padding: 16px 18px; }
.drawer-ft { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; }
.modal-panel {
  position: relative; background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  width: min(760px, 92vw); max-height: 88vh; display: flex; flex-direction: column;
}
.modal-hd { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-hd h3 { font-size: 15px; }
.modal-bd { padding: 16px 18px; overflow: auto; }
.modal-ft { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.x-btn { border: none; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-3); padding: 2px 6px; border-radius: 5px; }
.x-btn:hover { background: var(--panel-2); color: var(--text); }

/* ───────── 表单 ───────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 14px; }
.form-grid.col3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-item { display: flex; flex-direction: column; gap: 4px; }
.form-item label { font-size: 12px; color: var(--text-2); }
.form-item label .req { color: var(--red); }
.form-item label .auto { color: var(--purple); font-size: 10.5px; margin-left: 4px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; }
.form-item input[readonly] { background: var(--panel-2); color: var(--text-2); }
.form-section { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.form-section h4 { font-size: 13px; }
.form-section .line { flex: 1; height: 1px; background: var(--border); }
.form-section .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 8px; color: #fff; }

/* ───────── 其它 ───────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 8px 14px; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-2); white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

.stat-strip { display: flex; gap: 24px; flex-wrap: wrap; padding: 10px 16px; background: var(--panel-2); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.stat-strip b { font-weight: 650; }

.quick-row { display: flex; gap: 6px; padding: 8px 22px; background: #fff; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.quick-row .chip { background: #eef2f7; }
.quick-row .chip.on { background: var(--primary-soft); color: var(--primary-dark); }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 15px; border-radius: 8px; background: #1e293b; color: #fff; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: pop .2s ease-out; max-width: 340px;
}
.toast.ok   { background: #047857; }
.toast.err  { background: #b91c1c; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.muted { color: var(--text-3); }
.right { text-align: right; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.empty-state { padding: 46px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty-state .big { font-size: 30px; opacity: .35; margin-bottom: 8px; }
.inline-note { font-size: 11.5px; color: var(--text-3); margin-top: 6px; line-height: 1.6; }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .nm { flex: 1; font-size: 13px; }
.switch-row .desc { font-size: 11px; color: var(--text-3); }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px 12px; }
.check-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.radio-card {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-size: 13px;
  background: #fff; transition: .12s;
}
.radio-card small { display: block; color: var(--text-3); font-size: 11px; margin-top: 2px; }
.radio-card.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.log-line { display: grid; grid-template-columns: 148px 92px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; align-items: baseline; }
.log-line .t { color: var(--text-3); font-family: var(--mono); font-size: 11.5px; }
.log-line .a { font-weight: 600; }
.dict-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); align-items: center; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-item { display: inline-flex; align-items: center; gap: 5px; padding: 3px 5px 3px 9px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; font-size: 12.5px; }
.tag-item button { border: none; background: transparent; cursor: pointer; color: var(--text-3); font-size: 14px; line-height: 1; padding: 0 3px; border-radius: 50%; }
.tag-item button:hover { color: var(--red); background: var(--red-soft); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv .k { color: var(--text-3); }
.stage-row { display: grid; grid-template-columns: 100px 1fr 62px; gap: 10px; align-items: center; font-size: 12.5px; }
.stage-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; position: relative; }
.tl-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); margin-left: 5px; z-index: 1; }
.tl-item.done .dot { background: var(--green); }
.tl-item.todo .dot { background: var(--border-strong); }
.tl-item::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: var(--border); }
.tl-item:first-child::before { top: 50%; }
.tl-item:last-child::before { bottom: 50%; }
.tl-item .nm { font-size: 13px; }
.tl-item .dt { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.tl-item .dt.none { color: var(--text-3); }
.tl-gap { font-size: 11px; color: var(--text-3); }

/* ───────── 自动计算 / 可选值 板块 ───────── */
.formula-box {
  background: var(--bg-2, #f8fafc);
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple, #7c3aed);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-1);
}
.formula-box b { color: var(--purple, #7c3aed); font-weight: 600; }
.formula-box code {
  font-family: var(--mono);
  background: var(--bg-3, #eef2f7);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.switch-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.switch-line input[type="checkbox"] { width: 15px; height: 15px; flex: none; cursor: pointer; }
.switch-line .muted { line-height: 1.5; }
.bool-yes { color: var(--green, #047857); font-weight: 600; }
.cell-check { width: 15px; height: 15px; cursor: pointer; }

/* ───────── 台账选择列 ───────── */
.tbl .sel-col {
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
}
.tbl .sel-all {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 34px;
  margin: 0; cursor: pointer;
}
.tbl .sel-all input[type="checkbox"] {
  width: 15px; height: 15px; margin: 0; cursor: pointer; flex: none;
}
.sel-bar {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 10px; border-radius: 6px;
  background: var(--primary-soft); font-size: 12.5px; color: var(--text-1);
  white-space: nowrap;
}
.sel-bar b { color: var(--primary, #1d4ed8); font-size: 13.5px; }

/* ───────── 条件格式：颜色标记 ───────── */
.tbl tbody td.cm-red    { background: #ffc7ce !important; color: #9c0006 !important; }
.tbl tbody td.cm-purple { background: #7c3aed !important; color: #ffffff !important; font-weight: 700 !important; }
.tbl tbody td.cm-yellow { background: #ffeb9c !important; color: #9c6500 !important; }
.tbl tbody td.cm-green  { background: #c6efce !important; color: #006100 !important; }
.tbl tbody td.cm-gray   { background: #e2e8f0 !important; color: #64748b !important; }
.tbl tbody td.cm-orange { background: #fed7aa !important; color: #9a3412 !important; }

/* ═════════ 字典联想控件（Combobox） ═════════ */
.combo-input { padding-right: 22px; }
.combo-panel {
  position: fixed; z-index: 300; overflow: auto;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 4px; font-size: 13px;
  animation: comboIn .12s ease-out;
}
@keyframes comboIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.combo-list { display: flex; flex-direction: column; gap: 1px; }
.combo-item {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 6px 9px; border-radius: 6px; cursor: pointer; color: var(--text);
}
.combo-item:hover { background: var(--panel-2); }
.combo-item.on { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.combo-item .combo-val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-item .combo-val b { color: var(--primary); font-weight: 700; }
.combo-src {
  flex: none; font-size: 10px; padding: 0 5px; border-radius: 8px; line-height: 15px;
  background: #ede9fe; color: #6d28d9;
}
.combo-src.auto { background: #ede9fe; color: #6d28d9; }
.combo-status { padding: 14px 12px; text-align: center; color: var(--text-3); }
.combo-status .em { font-size: 13px; color: var(--text-2); margin-bottom: 3px; }
.combo-status .sub { font-size: 11.5px; line-height: 1.6; }
.combo-foot {
  margin-top: 4px; padding: 5px 9px; border-top: 1px dashed var(--border);
  font-size: 11px; color: var(--text-3);
}

/* ═════════ 字典管理页 ═════════ */
.dict-head-act { display: flex; gap: 8px; }
.dict-strip { border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; margin-bottom: 0; }
.dict-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.dict-cat-card {
  position: relative; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; background: #fff; transition: .12s;
}
.dict-cat-card:hover { border-color: var(--primary); background: var(--primary-soft); }
.dict-cat-card.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.dict-cat-card.off { background: var(--panel-2); color: var(--text-3); }
.dict-cat-card .nm { font-size: 13px; font-weight: 600; }
.dict-cat-card .ct { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.dict-cat-card .tag-off { position: absolute; right: 8px; top: 8px; font-size: 10px; color: var(--text-3); }

/* 图例 */
.cm-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 5px; font-size: 12px; line-height: 1.4;
  border: 1px solid rgba(0,0,0,.06);
}
.cm-chip.cm-red    { background: #ffc7ce; color: #9c0006; }
.cm-chip.cm-purple { background: #7c3aed; color: #fff; font-weight: 700; }
.cm-chip.cm-yellow { background: #ffeb9c; color: #9c6500; }
.cm-chip.cm-green  { background: #c6efce; color: #006100; }
.cm-chip.cm-gray   { background: #e2e8f0; color: #64748b; }
.cm-chip.cm-orange { background: #fed7aa; color: #9a3412; }

/* 客户未回款提示条（选中客户后展示） */.cust-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff7ed; border: 1px solid #fdba74; color: #9a3412;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px;
}
.cust-hint b { color: #c2410c; }
.cust-hint .cust-hint-link { color: #2563eb; cursor: pointer; text-decoration: underline; }
.cust-hint.ok { background: #f0fdf4; border-color: #86efac; color: #166534; }

/* 订单详情：单证齐备度行 */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.doc-row .doc-ic { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: none; }
.doc-row.ok .doc-ic { background: #c6efce; color: #006100; }
.doc-row.miss .doc-ic { background: #ffeb9c; color: #9c6500; }
.doc-row .doc-nm { font-weight: 600; flex: none; }
.doc-row .doc-no { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-hd { margin: 14px 0 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }

/* 档案中心：分段选项卡 / 标签行 / 宽表单项 */
.seg-tabs { display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; gap: 2px; }
.seg-tabs .seg { border: none; background: transparent; padding: 6px 16px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 600; }
.seg-tabs .seg.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row .cm-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.form-item.wide { grid-column: 1 / -1; }
.form-item textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13.5px; resize: vertical; background: #fff; }
.cm-chip.plain     { background: #f1f5f9; color: var(--text-2); }

/* ═══════════════ 仪表盘：业务数据汇总 + 分业务分区 ═══════════════ */
.sec-tabs {
  position: sticky; top: -18px; z-index: 6;
  display: flex; align-items: center; gap: 4px;
  margin: -4px 0 14px; padding: 8px 0 7px;
  background: linear-gradient(var(--bg) 78%, rgba(244, 246, 250, .86));
  backdrop-filter: blur(3px);
}
.sec-tabs .tab {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 5px 13px; border-radius: 999px; font: inherit; font-size: 12.5px;
  color: var(--text-2); font-weight: 500;
}
.sec-tabs .tab:hover { background: #eef2f7; }
.sec-tabs .tab.on {
  background: #fff; color: var(--primary-dark); font-weight: 600;
  border-color: var(--border); box-shadow: var(--shadow);
}

.sec { scroll-margin-top: 46px; }
.sec + .sec { margin-top: 26px; }
.sec-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.sec-hd-l { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sec-hd-l h3 { font-size: 14px; white-space: nowrap; }
.sec-hd-l small { color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sec-hd-r { display: flex; gap: 8px; flex: none; }
.sec.collapsed .sec-bd { display: none; }
.sec.collapsed .sec-hd { margin-bottom: 0; }
.sec#sec-all .sec-hd { border-left-color: #0f172a; }

/* 汇总区：结构对比条 */
.sum-cmp { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.15fr); gap: 22px; align-items: start; }
@media (max-width: 1180px) { .sum-cmp { grid-template-columns: 1fr; gap: 14px; } }
.split-row { margin-bottom: 15px; }
.split-lb { font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.split-bar {
  display: flex; height: 12px; border-radius: 5px; overflow: hidden;
  background: #f1f5f9;
}
.split-bar i { display: block; height: 100%; transition: width .4s; }
.split-val {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11.5px; color: var(--text-3); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* 汇总区：分业务对比表 */
.cmp-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cmp-tbl th, .cmp-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.cmp-tbl thead th { color: var(--text-3); font-weight: 600; font-size: 11.5px; background: var(--panel-2); }
.cmp-tbl thead th:first-child, .cmp-tbl tbody th { text-align: left; }
.cmp-tbl tbody th { font-weight: 500; color: var(--text-2); }
.cmp-tbl tbody tr:hover td, .cmp-tbl tbody tr:hover th { background: #f8fbff; }
.cmp-tbl .cmp-total { font-weight: 650; color: var(--text); }
.cmp-tbl tr.danger td { color: var(--red); }
.cmp-tbl tr.danger .cmp-total { color: var(--red); }

/* ── 应收管理：导航徽标与页内组件 ── */
.nav-item { position: relative; }
.nav-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #dc2626; color: #fff; font-size: 10px; line-height: 16px;
  text-align: center; font-style: normal; font-weight: 700; }
.nav-badge.hidden { display: none; }
.ar-lvl-severe { color: #b91c1c; font-weight: 700; }
.ar-lvl-warn { color: #b45309; font-weight: 700; }
.ar-lvl-info { color: #1d4ed8; font-weight: 600; }
.alloc-row td input { width: 110px; }
.alloc-row .inv-no { color: #1d4ed8; cursor: pointer; text-decoration: underline; }

/* ── 经营仪表盘：五分区布局 ── */
.dash-trend { margin-bottom: 14px; }
.dash-sections { display: flex; flex-direction: column; gap: 14px; }
.dash-rank { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }

/* 月度趋势图例开关 */
.month-toggle { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.mt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; font-size: 12px; color: var(--text-2);
  cursor: pointer; transition: opacity .15s; }
.mt-chip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.mt-chip.on { border-color: transparent; background: #f1f5f9; color: var(--text); }
.mt-chip:not(.on) { opacity: .45; }
.mt-chip:not(.on) i { background: #cbd5e1 !important; }

/* 环比变化箭头：变长=红↑，变短=绿↓ */
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-up { color: #dc2626; }
.delta-down { color: #059669; }
.delta-flat { color: #94a3b8; font-weight: 500; }
.kpi-sub .delta { font-size: 13px; }

/* 仪表盘：顶部趋势行 + 01-04 四列 + 榜单 */
.dash-top-row { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; margin-bottom: 14px; align-items: stretch; }
.dash-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; align-items: start; }
.dash-cols .kpi-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 0; }
.dash-cols .panel-hd h3 { font-size: 14px; }
.dash-cols .panel-hd small { font-size: 11px; }
.dash-cols .kpi { padding: 11px 13px; }
.dash-cols .kpi-value { font-size: 19px; }
@media (max-width: 1180px) {
  .dash-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-top-row { grid-template-columns: 1fr; }
}
/* 订单表单：流程深度切换 + 排名序号 */
.flow-toggle { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--primary); text-decoration: none; white-space: nowrap; }
.flow-toggle:hover { text-decoration: underline; }
.rank-no { display: inline-block; min-width: 16px; margin-right: 4px; color: #94a3b8; font-size: 12px; text-align: center; }

/* 智管台内嵌容器 */
.ld-embed { height: calc(100vh - 190px); min-height: 560px; }
.ld-embed iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; background: #fff; display: block; }
