:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

  /* —— 数据看板（工业仪表盘）扩展令牌 —— */
  --accent: #f59e0b;          /* 琥珀强调色（预警/关键动作） */
  --accent-soft: #fef3c7;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", "Consolas", monospace; /* 等宽数字 */
  --critical: #dc2626;        /* 强烈预警红 */
  --alert: #f59e0b;           /* 普通预警琥珀 */
  --ok: #10b981;              /* 正常绿 */
  --info: #0891b2;            /* 信息青 */
  --violet: #7c3aed;          /* 图表辅助 */
  --hairline: rgba(15, 23, 42, 0.08);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-base: 320ms;
  --dur-slow: 640ms;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  padding: 20px;
}
.login-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.brand-logo { font-size: 44px; margin-bottom: 8px; }
.brand-logo.small { font-size: 24px; }
.login-brand h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-brand p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.login-form .form-item { margin-bottom: 18px; }
.login-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.login-form input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; transition: border .2s, box-shadow .2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-extra { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: 13px; }
.checkbox { display: flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: pointer; }
.login-tip { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }

.btn-primary {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: none; padding: 6px 4px;
  color: var(--primary); font-size: 12px; cursor: pointer;
  border-radius: 4px; transition: background .15s;
}
.btn-link:hover { background: #eff6ff; text-decoration: underline; }
.btn-default {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 18px; font-size: 13px; cursor: pointer;
}
.btn-default:hover { background: var(--bg); }
.btn-danger {
  background: var(--danger); color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 13px; cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }

/* ============ 主应用布局 ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 100; transition: transform .25s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px;
  font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 8px; color: var(--sidebar-text); text-decoration: none;
  margin-bottom: 4px; transition: background .2s; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; }

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--sidebar-text); }
.btn-logout {
  width: 100%; background: rgba(255,255,255,0.06); color: var(--sidebar-text);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 8px;
  cursor: pointer; font-size: 13px; transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* 数据文件夹信息框（Electron 专用，侧边栏底部） */
.data-path-box {
  margin-bottom: 12px; padding: 10px; border-radius: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
}
.data-path-head {
  display: flex; align-items: center; gap: 6px; color: #fff;
  font-size: 12px; font-weight: 600; margin-bottom: 6px;
}
.data-path-icon { font-size: 13px; }
.data-path-label {
  font-size: 11px; color: var(--sidebar-text); word-break: break-all;
  line-height: 1.4; max-height: 40px; overflow: hidden;
}

.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar h2 { font-size: 18px; font-weight: 700; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
.topbar-right { margin-left: auto; }
.today-label { color: var(--text-muted); font-size: 13px; }

.content { padding: 24px; flex: 1; }
.page { display: none; }
.page.active { display: block; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 90; }

/* ============ 看板 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); }
.stat-icon.green { background: #dcfce7; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.red { background: #fee2e2; }
.stat-info .stat-value { font-size: 24px; font-weight: 700; }
.stat-info .stat-label { font-size: 13px; color: var(--text-muted); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.card-full { grid-column: 1 / -1; }

/* 状态进度条 */
.status-bar { margin-bottom: 14px; }
.status-bar .sb-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.status-bar .sb-head .sb-count { color: var(--text-muted); }
.status-bar .sb-track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.status-bar .sb-fill { height: 100%; border-radius: 4px; transition: width .3s; }

/* ============ 列表 ============ */
.list-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box input {
  width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
}
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.list-toolbar select, .list-toolbar .btn-primary {
  padding: 9px 14px; border-radius: 8px; font-size: 13px; border: 1px solid var(--border);
  background: #fff; cursor: pointer;
}
.btn-secondary {
  padding: 9px 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: #f1f5f9; border-color: #94a3b8; }
.more-filter-panel {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 14px 16px; margin: -8px 0 16px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
}
.more-filter-row { display: flex; align-items: center; gap: 8px; }
.more-filter-row label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.more-filter-row select {
  padding: 7px 12px; border-radius: 6px; font-size: 13px;
  border: 1px solid var(--border); background: #fff;
}

.table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
thead th {
  text-align: left; padding: 12px 14px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.tag-green { background: #dcfce7; color: #15803d; }
.tag-orange { background: #fef3c7; color: #b45309; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-blue { background: var(--primary-light); color: #1d4ed8; }
.tag-gray { background: #e2e8f0; color: #475569; }

.action-btns { display: flex; gap: 6px; }
.btn-icon {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text);
}
.btn-icon.edit:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon.del:hover { border-color: var(--danger); color: var(--danger); }
.btn-icon.view:hover { border-color: var(--info, #0891b2); color: var(--info, #0891b2); }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; font-size: 13px; color: var(--text-muted); }
.pagination .page-btns { display: flex; gap: 6px; }
.page-btns button {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px;
}
.page-btns button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btns button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ 表单 ============ */
.form-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.form-group-title {
  font-size: 15px; font-weight: 700; margin: 24px 0 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light); color: var(--primary);
}
.form-group-title:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-field label .req { color: var(--danger); margin-left: 2px; }
.form-field input, .form-field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; transition: border .2s;
}
.form-field input:focus, .form-field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
/* 进度必填字段缺失高亮 */
.form-field.field-error input, .form-field.field-error select {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
  animation: field-error-pulse 1.2s ease-in-out 2;
}
.form-field.field-error label { color: var(--danger); }
@keyframes field-error-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
  50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.28); }
}
.form-actions { display: flex; gap: 12px; margin-top: 28px; }
.form-actions .btn-primary { padding: 11px 28px; }

/* ============ 弹窗 ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 760px;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.modal-mask .modal { background: #fff; border-radius: 12px; box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2); width: 100%; max-width: 500px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-mask .modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-mask .modal-body { padding: 18px; overflow-y: auto; }
.modal-mask .modal-body p { margin: 0; }
.modal-mask .modal-body .hint { color: #64748b; font-size: 12px; }
.modal-mask .modal-body .form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; }

.import-stat { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; }
.import-stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #475569; }
.import-stat-row b { font-weight: 700; color: #1e293b; font-variant-numeric: tabular-nums; }
.import-stat-row.new b { color: #16a34a; }
.import-stat-row.dup b { color: #d97706; }

/* 字段提示 */
.field-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* 文件上传 */
.file-upload {
  border: 1.5px dashed var(--border); border-radius: 8px; padding: 14px;
  cursor: pointer; transition: border-color .2s, background .2s; text-align: center;
}
.file-upload:hover, .file-upload.dragover { border-color: var(--primary); background: #f8fafc; }
.file-input { display: none; }
.file-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.file-icon { font-size: 20px; }
.file-preview { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.file-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.file-name { font-weight: 600; color: var(--text); word-break: break-all; }
.file-size { color: var(--text-muted); font-size: 12px; }
.file-remove {
  background: var(--danger); color: #fff; border: none; border-radius: 4px;
  width: 20px; height: 20px; line-height: 20px; cursor: pointer; font-size: 12px;
}

/* 成本面板 */
.cost-panel { margin-bottom: 20px; background: linear-gradient(135deg, #f0f6ff 0%, #f8fafc 100%); }
.cost-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.cost-grid:last-child { margin-bottom: 0; }
.cost-grid-2 { grid-template-columns: repeat(2, 1fr); }
.cost-item {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.cost-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cost-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.cost-formula { font-size: 11px; color: var(--text-muted); }

/* 车辆编辑器 */
.vehicle-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.vehicle-row {
  border: 1px dashed var(--border); border-radius: 8px; padding: 12px; background: #fff;
}
.vehicle-row-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px; font-weight: 700; font-size: 13px; color: var(--text);
}
.vehicle-row-head > span:first-child { flex: 0 0 auto; }
.vehicle-row-tag {
  font-size: 11px; color: var(--text-muted); font-weight: 400;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 2px 8px; border-radius: 999px;
}
.vehicle-row-head .btn-icon.del { margin-left: auto; }
.btn-add-vehicle { margin-top: 4px; }

/* 车型行编辑器 */
.model-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; }
.model-row {
  border: 2px solid var(--primary-light); border-radius: 10px;
  padding: 14px; background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
}
.model-row-head {
  display: flex; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; color: var(--primary-dark);
}
.model-row-head > span:first-child { flex: 1 1 auto; }
.model-row-head .btn-icon.del { margin-left: auto; }
.vehicle-sub-title {
  font-size: 12px; color: var(--text-muted); margin: 10px 0 8px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-add-model { margin-top: 4px; }

/* 境外运输公司（多行） */
.forwarder-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.forwarder-row {
  border: 1px dashed var(--primary-light); border-radius: 8px;
  padding: 12px; background: #fff; position: relative;
}
.forwarder-row-head {
  display: flex; align-items: center;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--border);
  font-weight: 700; font-size: 13px; color: var(--primary-dark);
}
.forwarder-row-head > span:first-child { flex: 1 1 auto; }
.forwarder-row-head .btn-icon.del { margin-left: auto; }
.btn-add-forwarder { margin-top: 4px; }

/* 客户付款差额面板 */
.pay-diff-panel { margin-bottom: 20px; background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%); }
.pay-diff-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pay-diff-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; background: #fff; border-radius: 6px; border: 1px solid var(--border);
}
.pd-label { font-size: 12px; color: var(--text-muted); }
.pd-value { font-size: 18px; font-weight: 700; color: var(--text); }
.pd-value.pd-positive { color: #16a34a; }
.pd-value.pd-negative { color: #dc2626; }
@media (max-width: 900px) { .pay-diff-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .pay-diff-grid { grid-template-columns: 1fr; } }

/* Toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 24px; border-radius: 8px;
  z-index: 300; font-size: 14px; box-shadow: var(--shadow-lg);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ 订单详情弹窗 ============ */
.detail-group {
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px dashed var(--border);
}
.detail-group:last-child { border-bottom: none; margin-bottom: 0; }
.detail-group h4 {
  font-size: 14px; font-weight: 700; color: var(--primary-dark);
  margin-bottom: 10px; padding-left: 8px; border-left: 3px solid var(--primary);
}
.detail-item {
  display: flex; gap: 12px; padding: 6px 0; font-size: 13px;
}
.detail-label {
  flex: 0 0 120px; color: var(--text-muted); font-weight: 500; text-align: right;
}
.detail-value { flex: 1 1 auto; color: var(--text); word-break: break-all; }
.detail-sub {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #f8fafc;
}
.detail-sub > strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 13px; }
.detail-empty { color: var(--text-muted); font-size: 13px; padding: 4px 0; }
.detail-vehicles { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.detail-vehicle {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  border: 1px dashed var(--border); border-radius: 6px; padding: 8px 10px;
  font-size: 12px; color: var(--text);
}
.detail-vehicle .dv-index { font-weight: 700; color: var(--primary-dark); }
.detail-vehicle .tag { font-size: 11px; padding: 2px 8px; }
@media (max-width: 600px) {
  .detail-item { flex-direction: column; gap: 2px; }
  .detail-label { flex: none; text-align: left; }
}

/* ============ 数据看板（工业仪表盘风） ============ */
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: #16a34a; }
.neg { color: #dc2626; }

/* 入场动画 */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* 顶部工具条 */
.dash-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); line-height: 1.1; }
.dash-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.dash-filter { display: flex; align-items: center; gap: 10px; }
.dash-filter-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.dash-select {
  padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--surface); cursor: pointer; min-width: 160px;
}
.dash-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* 预警横幅 */
.alert-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-radius: 10px; margin-bottom: 20px;
  background: var(--accent-soft); border: 1px solid rgba(217, 119, 6, 0.35);
}
.alert-banner.has-critical {
  background: #fee2e2; border-color: rgba(220, 38, 38, 0.4);
}
.alert-banner-icon { font-size: 22px; }
.alert-banner-body { display: flex; flex-direction: column; gap: 2px; }
.alert-banner-body strong { font-size: 14px; color: var(--text); }
.alert-banner-body span { font-size: 13px; color: var(--text-muted); }
.ab-critical { color: var(--critical); font-weight: 700; }
.ab-warning { color: var(--warning); font-weight: 700; }

/* 预警清单 */
.alert-card { border-top: 3px solid var(--accent); }
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-radius: 8px; font-size: 13px; border: 1px solid var(--hairline);
  background: #fff;
}
.alert-item.critical { background: #fef2f2; border-color: rgba(220, 38, 38, 0.25); }
.alert-item.warning { background: #fffbeb; border-color: rgba(217, 119, 6, 0.25); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-item.critical .alert-dot { background: var(--critical); animation: pulse 1.2s infinite; }
.alert-item.warning .alert-dot { background: var(--warning); }
.alert-order { font-weight: 700; color: var(--text); }
.alert-customer { color: var(--text-muted); }
.alert-days { font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 12px; margin-left: auto; }
.alert-days.critical { background: #fee2e2; color: var(--critical); }
.alert-days.warning { background: var(--accent-soft); color: var(--warning); }
.alert-date { color: var(--text-muted); font-size: 12px; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* KPI 指标卡 */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  position: relative; padding: 20px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
  border: 1px solid var(--hairline); overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.kpi-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.kpi-orders::before { background: var(--primary); }
.kpi-vehicles::before { background: #10b981; }
.kpi-sales::before { background: var(--accent); }
.kpi-profit::before { background: #7c3aed; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi-label { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); line-height: 1.1; }
.kpi-foot { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* 时间维度卡片 */
.period-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 24px; }
.period-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dashed var(--hairline); font-size: 13px;
}
.period-row:last-child { border-bottom: none; }
.period-row span { color: var(--text-muted); }
.period-row b { font-size: 15px; color: var(--text); }

/* 柱状图（销售趋势） */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-val { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; white-space: nowrap; }
.bar-track { width: 100%; max-width: 46px; flex: 1; display: flex; align-items: flex-end; background: var(--bg); border-radius: 6px 6px 0 0; overflow: hidden; }
.bar-fill { width: 100%; background: linear-gradient(180deg, var(--primary) 0%, #3b82f6 100%); border-radius: 6px 6px 0 0; transition: height var(--dur-slow) var(--ease-out); }
.bar-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* 销售漏斗 */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { align-self: center; width: 100%; }
.funnel-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; border-radius: 6px; color: #fff; font-size: 13px;
  transition: transform var(--dur-base) var(--ease-out);
}
.funnel-bar:hover { transform: translateX(4px); }
.funnel-label { font-weight: 600; }
.funnel-count { font-weight: 800; }

/* 业务员表格卡片 */
.owner-table-card { margin-bottom: 24px; }
.owner-table-card .pos, .owner-table-card .neg { font-weight: 700; }

/* ============ 订单列表进度条 ============ */
.progress-cell { min-width: 180px; }
.progress-mini { display: flex; flex-direction: column; gap: 5px; cursor: pointer; border-radius: 8px; padding: 4px; transition: background .2s; }
.progress-mini:hover { background: var(--primary-light); }
.progress-mini-track {
  height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden;
}
.progress-mini-fill {
  height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary) 0%, #3b82f6 100%);
  transition: width var(--dur-base) var(--ease-out);
}
.progress-mini-steps { display: flex; gap: 4px; }
.pstep {
  flex: 1; height: 5px; border-radius: 999px; background: var(--border);
  transition: background var(--dur-base) var(--ease-out);
}
.pstep.done { background: #10b981; }
.progress-mini-text { font-size: 11px; color: var(--text-muted); text-align: right; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .period-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .cost-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .overlay.show { display: block; }
  .stat-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .cost-grid { grid-template-columns: 1fr; }
  .cost-grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 100%; }
  .alert-item { flex-wrap: wrap; }
  .alert-days { margin-left: 0; }
}

@media (max-width: 500px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .dash-toolbar { flex-direction: column; align-items: stretch; }
  .dash-filter { justify-content: space-between; }
}
