/* ============================================================
   羽墨集运 · 运营管理后台样式（纯原生 CSS，零依赖）
   主色：#2563eb
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-50: #eff6ff;
  --sidebar-bg: #0f1e3d;
  --sidebar-active: #1e3a6e;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --bg: #f3f5f9;
  --card-bg: #ffffff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0891b2;
  --info-bg: #cffafe;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --gray-bg: #f3f4f6;
  --shadow-sm: 0 1px 2px rgba(15, 30, 61, .06);
  --shadow: 0 4px 16px rgba(15, 30, 61, .10);
  --shadow-lg: 0 12px 40px rgba(15, 30, 61, .22);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 232px;
  --topbar-h: 60px;
}

html, body {
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { min-width: 1080px; }

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.boot-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 16px; color: var(--text-secondary);
}

/* ---------------- 加载态 ---------------- */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner-lg { width: 38px; height: 38px; border-width: 4px; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 72px 0; color: var(--text-secondary);
}

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1e3d 0%, #1e3a6e 45%, #2563eb 100%);
  padding: 24px;
}
.login-card {
  width: 400px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 32px;
}
.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.login-title { text-align: center; font-size: 20px; font-weight: 700; }
.login-sub { text-align: center; color: var(--text-secondary); font-size: 13px; margin: 6px 0 28px; }
.login-error {
  display: none;
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid #fecaca; border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; margin-bottom: 16px;
}
.login-error.show { display: block; }
.login-tip {
  margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-muted);
  background: var(--gray-bg); border-radius: var(--radius-sm); padding: 8px;
}

/* ---------------- 表单 ---------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-right: 2px; }
.form-control {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
select.form-control { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.form-control:disabled { background: var(--gray-bg); color: var(--text-muted); cursor: not-allowed; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border-color: #bfd4fb; }
.btn-outline:hover:not(:disabled) { background: var(--primary-50); }
.btn-default { background: #fff; color: var(--text); border-color: var(--border); }
.btn-default:hover:not(:disabled) { border-color: #c7ccd4; background: var(--gray-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 5px; }
.btn-block { width: 100%; height: 40px; font-size: 14px; }
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}

/* ---------------- 主框架布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #c4d0e6;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  color: #fff; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand .brand-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  flex-shrink: 0;
}
.sidebar-brand small { display: block; font-size: 11px; font-weight: 400; color: #7f90b2; margin-top: 1px; }
.sidebar-menu { flex: 1; padding: 14px 12px; overflow-y: auto; }
.menu-label {
  font-size: 11px; color: #5d6f94; letter-spacing: 1px;
  padding: 12px 12px 6px;
}
.menu-item {
  display: flex; align-items: center; gap: 11px;
  height: 44px; padding: 0 12px; margin-bottom: 4px;
  border-radius: 8px;
  color: #b7c4dd; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; user-select: none;
}
.menu-item .mi-icon { font-size: 17px; width: 20px; text-align: center; }
.menu-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, .4); }
.menu-item.logout { color: #f0a3a3; }
.menu-item.logout:hover { background: rgba(220, 38, 38, .18); color: #fecaca; }
.sidebar-footer {
  padding: 14px 18px; font-size: 11px; color: #56688d;
  border-top: 1px solid rgba(255, 255, 255, .08); line-height: 1.7;
}

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.topbar-title .title-icon { font-size: 20px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 6px; background: var(--primary-50);
  border: 1px solid #d3e1fb; border-radius: 999px;
}
.admin-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.admin-meta { line-height: 1.3; }
.admin-meta .am-name { font-size: 13px; font-weight: 600; }
.admin-meta .am-role { font-size: 11px; color: var(--text-secondary); }

.content { padding: 22px 26px 40px; }

/* ---------------- 卡片 / 栅格 ---------------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* ---------------- 仪表盘概览卡片 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .sc-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .sc-label { font-size: 12px; color: var(--text-secondary); }
.stat-card .sc-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.stat-card .sc-value { font-size: 26px; font-weight: 700; margin-top: 10px; line-height: 1.1; }
.stat-card .sc-unit { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-left: 3px; }
.sc-icon.blue { background: var(--primary-light); }
.sc-icon.green { background: var(--success-bg); }
.sc-icon.amber { background: var(--warning-bg); }
.sc-icon.cyan { background: var(--info-bg); }
.sc-icon.purple { background: var(--purple-bg); }
.sc-icon.red { background: var(--danger-bg); }
.stat-card.accent::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary);
}

/* ---------------- 待办清单 ---------------- */
.todo-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; background: #fff;
}
.todo-item:hover { border-color: var(--primary); background: var(--primary-50); }
.todo-item .ti-icon {
  width: 40px; height: 40px; border-radius: 10px; font-size: 19px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.todo-item .ti-label { font-size: 13px; color: var(--text-secondary); }
.todo-item .ti-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.todo-item .ti-arrow { margin-left: auto; color: var(--text-muted); font-size: 16px; }

/* ---------------- 状态分布条 ---------------- */
.dist-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dist-row:last-child { margin-bottom: 0; }
.dist-label { width: 76px; font-size: 13px; color: var(--text-secondary); flex-shrink: 0; }
.dist-track { flex: 1; height: 18px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 999px; min-width: 2px; transition: width .5s ease; }
.dist-count { width: 42px; text-align: right; font-size: 13px; font-weight: 600; }

/* ---------------- 柱状图（纯 CSS/SVG） ---------------- */
.chart-wrap { width: 100%; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-value { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.bar {
  width: 60%; max-width: 42px;
  background: linear-gradient(180deg, #60a5fa 0%, var(--primary) 100%);
  border-radius: 6px 6px 0 0;
  min-height: 3px;
  transition: height .5s ease;
  position: relative;
}
.bar:hover { background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%); }
.bar-label { font-size: 12px; color: var(--text-secondary); }

/* ---------------- 筛选工具条 / Tabs ---------------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 16px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.tab {
  padding: 7px 16px; border-radius: 5px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--primary); }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(37, 99, 235, .32); }
.tab .tab-count {
  background: rgba(0, 0, 0, .08); border-radius: 999px;
  font-size: 11px; padding: 1px 7px; font-weight: 700;
}
.tab.active .tab-count { background: rgba(255, 255, 255, .25); }

/* 包裹五步作业流程指引条 */
.flow-guide {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 16px;
}
.flow-step {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); background: #f1f5f9; cursor: pointer; user-select: none;
  transition: all .15s ease; white-space: nowrap;
}
.flow-step:hover { color: var(--primary); background: #eff6ff; }
.flow-step-active {
  background: var(--primary); color: #fff;
  box-shadow: 0 3px 8px rgba(37, 99, 235, .32);
}
.flow-step-active:hover { color: #fff; background: var(--primary); }
.flow-arrow { color: #94a3b8; font-size: 14px; font-weight: 700; }

.filter-group { display: flex; gap: 10px; align-items: center; }
.search-box { position: relative; }
.search-box .sb-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.search-box input { width: 260px; height: 36px; padding: 0 12px 0 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: .3px;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f7;
  vertical-align: middle;
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--primary-50); }
.data-table .col-actions { white-space: nowrap; text-align: right; }
.data-table .col-actions .btn { margin-left: 6px; }
.data-table .col-actions .btn:first-child { margin-left: 0; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cell-nowrap { white-space: nowrap; }
.cell-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.mono { font-family: "SF Mono", Consolas, Menlo, monospace; font-size: 12.5px; }

.empty-state {
  text-align: center; padding: 64px 20px; color: var(--text-muted);
}
.empty-state .es-icon { font-size: 46px; margin-bottom: 12px; opacity: .7; }
.empty-state .es-text { font-size: 14px; }

/* ---------------- 状态标签 tag ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-gray { background: var(--gray-bg); color: #4b5563; }
.tag-blue { background: var(--primary-light); color: var(--primary-dark); }
.tag-amber { background: var(--warning-bg); color: var(--warning); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-cyan { background: var(--info-bg); color: var(--info); }
.tag-purple { background: var(--purple-bg); color: var(--purple); }
.tag-red { background: var(--danger-bg); color: var(--danger); }

/* ---------------- 分页器 ---------------- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.page-info { font-size: 13px; color: var(--text-secondary); }
.page-info b { color: var(--text); }
.page-controls { display: flex; gap: 6px; align-items: center; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); background: #fff;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: var(--text); display: inline-flex; align-items: center; justify-content: center;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-ellipsis { padding: 0 3px; color: var(--text-muted); }

/* ---------------- 弹窗 Modal ---------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .52);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 1000; padding: 6vh 20px 40px;
  overflow-y: auto;
  animation: maskIn .18s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 14px;
  width: 520px; max-width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
  margin: auto;
}
.modal.modal-lg { width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close {
  width: 30px; height: 30px; border: none; background: var(--gray-bg);
  border-radius: 8px; font-size: 16px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 22px; max-height: 66vh; overflow-y: auto; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* 弹窗内描述列表 */
.desc-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: 13px; }
.desc-grid dt { color: var(--text-secondary); }
.desc-grid dd { color: var(--text); font-weight: 500; word-break: break-all; }
.section-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin: 18px 0 10px; padding-left: 9px; border-left: 3px solid var(--primary);
}
.section-title:first-child { margin-top: 0; }

/* 费用明细 */
.fee-box { background: var(--primary-50); border: 1px solid #d3e1fb; border-radius: var(--radius-sm); padding: 14px 16px; }
.fee-row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; color: var(--text-secondary); }
.fee-row.total { border-top: 1px dashed #b9cdf5; margin-top: 6px; padding-top: 10px; color: var(--text); font-weight: 700; font-size: 15px; }
.fee-row.total .fr-value { color: var(--danger); font-size: 17px; }

/* 时间轴 */
.timeline { list-style: none; padding-left: 6px; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--border); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--text-muted);
}
.timeline li.done::before { background: var(--primary); border-color: var(--primary); }
.timeline .tl-text { font-size: 13px; font-weight: 600; }
.timeline .tl-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 国际转运轨迹弹窗（包裹管理） */
.track-list { position: relative; padding-left: 8px; max-height: 360px; overflow-y: auto; }
.track-item {
  position: relative; padding: 0 0 16px 20px;
  border-left: 2px solid var(--border);
}
.track-item:last-child { padding-bottom: 0; border-left-color: transparent; }
.track-item::before {
  content: ""; position: absolute; left: -7px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--text-muted);
}
.track-item.track-active::before { background: var(--primary); border-color: var(--primary); }
.track-item.track-active .track-desc { color: var(--primary); font-weight: 700; }
.track-desc { font-size: 13px; line-height: 1.5; }
.track-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 地址卡 */
.address-card {
  background: var(--gray-bg); border-radius: var(--radius-sm);
  padding: 13px 15px; font-size: 13px; line-height: 1.8;
}
.address-card .ac-name { font-weight: 700; font-size: 14px; }

/* 包裹快照小表 */
.snapshot-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.snapshot-table th { background: #f8fafc; padding: 8px 10px; text-align: left; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.snapshot-table td { padding: 8px 10px; border-bottom: 1px solid #f1f3f7; }

/* ---------------- Toast ---------------- */
.toast-root {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: #1f2937; color: #fff;
  padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  max-width: 480px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.toast.toast-out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px); } }
.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }
.toast-warning { background: #b45309; }
.toast .t-icon { font-size: 16px; }

/* ---------------- 杂项 ---------------- */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.fw-700 { font-weight: 700; }
.money { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.stack-actions { display: inline-flex; gap: 0; }
.kv-inline { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.badge-soft {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  background: var(--gray-bg); color: var(--text-secondary); font-size: 12px; font-weight: 600;
}

@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------------- 系统对接页 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; line-height: 1.6; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }

.webhook-info { display: flex; flex-direction: column; gap: 10px; }
.wh-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; font-size: 13px; }
.wh-key { color: var(--text-secondary, #7a8299); font-weight: 600; padding-top: 2px; }
.wh-val { background: #f6f8fc; border: 1px solid var(--border, #e5e8f0); border-radius: 8px; padding: 7px 10px; word-break: break-all; line-height: 1.6; }

.integ-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.integ-status.ok { background: #ecfdf5; color: #047857; }
.integ-status.err { background: #fef2f2; color: #b91c1c; }
.integ-status.wait { background: #f1f5f9; color: #475569; }

.integ-box { border: 1px solid var(--border, #e5e8f0); border-radius: 10px; padding: 14px 16px; background: #fafbfe; }
.integ-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.integ-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.integ-err { margin-top: 10px; padding: 8px 12px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 8px; font-size: 12.5px; }
.ext-timeline { margin-top: 12px; }
.empty-box { padding: 18px; text-align: center; color: var(--text-secondary, #7a8299); background: #f8fafc; border: 1px dashed var(--border, #e5e8f0); border-radius: 10px; font-size: 13px; }

/* ================= SaaS 扩展样式 ================= */
.sub-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.sub-tab { border: 1px solid var(--border, #e5e8f0); background: #fff; color: var(--text, #1f2937); padding: 8px 18px; border-radius: 20px; font-size: 14px; cursor: pointer; transition: all .15s; }
.sub-tab:hover { border-color: #2563eb; color: #2563eb; }
.sub-tab.active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border: 1px solid var(--border, #e5e8f0); border-radius: 12px; padding: 18px; display: flex; align-items: center; gap: 14px; }
.sc-icon { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; font-size: 24px; background: #eff4ff; border-radius: 12px; flex-shrink: 0; }
.sc-value { font-size: 22px; font-weight: 800; color: var(--text, #1f2937); }
.sc-label { font-size: 13px; color: var(--text-secondary, #7a8299); margin-top: 2px; }

.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.channel-item { border: 1px solid var(--border, #e5e8f0); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.ch-name { font-weight: 700; font-size: 15px; }
.ch-meta { font-size: 12px; color: var(--text-secondary, #7a8299); }
.channel-item .switch { position: absolute; top: 14px; right: 14px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 24px; transition: .2s; }
.switch-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .switch-slider { background: #2563eb; }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

.grant-result { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.grant-customer { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border, #e5e8f0); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.grant-customer.selected { border-color: #2563eb; background: #eff4ff; }

.wh-check-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.wh-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border, #e5e8f0); border-radius: 8px; padding: 8px 12px; font-size: 14px; cursor: pointer; background: #fff; }
.form-group.full-row { grid-column: 1 / -1; }

.rate-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rate-name { width: 140px; font-size: 14px; }
.rate-input { width: 120px; }

.track-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset-chip { border: 1px solid var(--border, #e5e8f0); background: #f8fafc; color: var(--text, #1f2937); border-radius: 16px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.preset-chip:hover { border-color: #2563eb; color: #2563eb; }
.tl-del { color: #dc2626; cursor: pointer; font-size: 13px; padding: 0 4px; }

.page-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.text-muted { color: var(--text-secondary, #7a8299); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }

/* ===== 轻量 CRM：客户标签 / 跟进时间线 ===== */
.small { font-size: 12px; }
.crm-section-title { font-weight: 700; margin: 16px 0 8px; font-size: 14px; border-left: 3px solid var(--primary); padding-left: 8px; }
.crm-tag-box { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; }
.crm-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-bg, #eff6ff); color: var(--primary);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600;
}
.crm-tag-x {
  border: none; background: transparent; color: var(--primary); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
}
.crm-tag-x:hover { color: var(--danger); }
.crm-tag-form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.crm-tag-form .form-control { flex: 1; }
.crm-follow-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 8px 12px; }
.crm-follow { padding: 10px 0; border-bottom: 1px dashed var(--border, #e5e7eb); }
.crm-follow:last-child { border-bottom: none; }
.crm-follow-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.crm-follow-body { font-size: 13px; color: var(--text-1, #1f2937); line-height: 1.6; word-break: break-all; }
.crm-add-follow { margin-top: 14px; border-top: 1px solid var(--border, #e5e7eb); padding-top: 14px; }

/* ===== 线下收款码配置与凭证审核 ===== */
.qr-editor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.qr-channel-editor { border: 1px solid var(--border, #e5e8f0); border-radius: 12px; padding: 14px 16px; background: #fafbfd; }
.qr-channel-editor .wh-check { margin-bottom: 10px; }
.qr-thumb { display: none; width: 140px; height: 140px; object-fit: contain; margin-top: 8px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; background: #fff; padding: 4px; }
.proof-link { color: var(--primary, #2563eb); cursor: pointer; font-size: 12.5px; text-decoration: none; }
.proof-link:hover { text-decoration: underline; }
.proof-modal { display: flex; flex-direction: column; gap: 12px; }
.proof-meta { font-size: 13px; line-height: 1.9; color: var(--text-1, #1f2937); }
.proof-image { width: 100%; max-height: 60vh; object-fit: contain; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: #f8fafc; }

/* P2-B：盘点差异明细行 */
.diff-row {
  display: flex; align-items: center; padding: 8px 4px;
  border-bottom: 1px solid #f0f2f6; font-size: 13px;
}
.diff-row:last-child { border-bottom: none; }
.empty-tip { text-align: center; color: #98a0ad; padding: 24px 0; font-size: 13px; }
