:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e3e6ee;
  --text: #1f2430;
  --muted: #7a8194;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand { font-size: 18px; font-weight: 700; white-space: nowrap; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.15s;
}
.tab:hover { background: #eef2fb; color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }

main {
  width: 100%;
  max-width: none;
  padding: 28px 32px 60px;
  box-sizing: border-box;
}

.page { display: none; }
.page.active { display: block; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.page-head h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1a2942;
  margin: 0;
}
.page-head h2 small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 8px; }

h2 { font-size: 16px; margin-bottom: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.card-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.card-toolbar input { flex: 1; min-width: 200px; max-width: 320px; }
.card-toolbar select.filter-select { min-width: 110px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; }
.card-toolbar input.search-input { flex: 0 0 auto; width: 150px; min-width: 150px; max-width: 150px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.card-toolbar input.filter-date, .card-toolbar input.filter-month { flex: 0 0 auto; width: 148px; min-width: 148px; max-width: 148px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; box-sizing: border-box; }
.card-toolbar .range-sep { color: var(--muted); }
.card-toolbar .hint { margin: 0; }

/* 配置信息单元格：最多显示2行，超出隐藏，悬浮 title 显示全文 */
.cfg-cell {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  cursor: default;
}

/* 绑定信息：客户名称超长截断（单行省略号），悬浮 title 显示全文 */
.bind-customer {
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* 合同表单：车辆搜索 + 复选框列表 */
.vc-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.vehicle-check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2px 14px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
}
.vehicle-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.1s;
}
.vehicle-check-item:hover { background: #f0f4ff; }
.vehicle-check-item input[type=checkbox] { flex-shrink: 0; width: 16px; height: 16px; }
.vehicle-check-item .vc-code { font-weight: 600; flex-shrink: 0; }
.vehicle-check-item .vc-brand { color: var(--muted); white-space: nowrap; }
.vehicle-check-item .vc-model { color: var(--muted); flex: 0 1 auto; min-width: 0; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-check-item .vc-sn { font-size: 12px; color: var(--muted); font-family: monospace; flex: 0 1 130px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-check-item .vc-cfg { flex: 0 1 120px; min-width: 0; color: #666; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-check-item .badge { flex-shrink: 0; font-size: 11px; padding: 1px 6px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 4px;
}
.pager .page-info { color: var(--muted); font-size: 13px; }
.pager .btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* 总览统计按 车辆/合同/欠款逾期 分三组 */
#stats-area {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
.stats-section h2 { margin: 18px 0 10px; font-size: 16px; }
.stats-section:first-child h2 { margin-top: 0; }
.stats-section .stats-grid { margin-bottom: 0; }
.stats-section + .stats-section { margin-top: 6px; }

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.stat .num { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat.warn .num { color: var(--warn); }
.stat.danger .num { color: var(--danger); }
.stat.ok .num { color: var(--ok); }
.stat.sold .num { color: #b45309; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.table th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfe; }
.table tr:hover td { background: #f8faff; }
.table tr.due-row td { background: #fee2e2; }
.table tr.due-row:hover td { background: #fbd5d5; }
.table td .badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }

/* 合同台账（V2.3.2 改版）：11 列百分比宽，一屏内完整显示，无需左右滑动；首列合同号仍左侧冻结 */
.contracts-wrap { overflow-x: auto; }
.contracts-wrap .table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.contracts-wrap th, .contracts-wrap td {
  position: sticky;
  box-sizing: border-box;
  border-right: 1px solid var(--border);
  white-space: nowrap;          /* 内容不断行（两行信息用块级 div 叠放） */
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.45;
}
.contracts-wrap .table th, .contracts-wrap .table td { padding: 9px 8px; }
.contracts-wrap thead th {
  text-align: center;           /* 表头居中加粗 + 深色底白字 */
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}
.contracts-wrap th { background: #334155; z-index: 3; color: #fff; }
.contracts-wrap td { background: var(--card); z-index: 1; }
/* 列宽（百分比，合计 100%）：合同号 10 / 客户 17 / 业务员 6 / 起租 8 / 期数周期 8 / 每期 8 / 应付 10 / 实收 10 / 扣款 7 / 绑定 5 / 操作 11 */
.contracts-wrap .c-fix1 { left: 0; width: 10%; text-align: center; z-index: 3; }
.contracts-wrap th:nth-child(2), .contracts-wrap td:nth-child(2) { width: 17%; }
.contracts-wrap th:nth-child(3), .contracts-wrap td:nth-child(3) { width: 6%; text-align: center; }
.contracts-wrap th:nth-child(4), .contracts-wrap td:nth-child(4) { width: 8%; text-align: center; }
.contracts-wrap th:nth-child(5), .contracts-wrap td:nth-child(5) { width: 8%; text-align: center; }
.contracts-wrap th:nth-child(6), .contracts-wrap td:nth-child(6) { width: 8%; text-align: center; }
.contracts-wrap th:nth-child(7), .contracts-wrap td:nth-child(7) { width: 10%; text-align: center; }
.contracts-wrap th:nth-child(8), .contracts-wrap td:nth-child(8) { width: 10%; text-align: center; }
.contracts-wrap th:nth-child(9), .contracts-wrap td:nth-child(9) { width: 7%; text-align: center; }
.contracts-wrap th:nth-child(10), .contracts-wrap td:nth-child(10) { width: 5%; text-align: center; }
/* 合同号下方的类型+状态徽章 */
.contracts-wrap .cell-badges { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.contracts-wrap .cell-badges .badge { font-size: 11px; padding: 1px 7px; }
/* 期数/周期的第二行小一号 */
.contracts-wrap .cell-sub { font-size: 12px; }
/* 金额列第二行（欠款/逾期徽标）小一号 */
.contracts-wrap .money-sub { font-size: 12px; }
.contracts-wrap .money-sub .badge { font-size: 11px; padding: 1px 6px; }
.contracts-wrap .c-fixr {
  right: auto;      /* 取消右侧冻结，操作列随表格完整显示 */
  z-index: 1;
  border-left: 1px solid var(--border);
  background: #f8fafc;
  text-align: center;
  white-space: normal;
}
.contracts-wrap .c-fixr .btn { padding: 2px 7px; font-size: 12px; }
.contracts-wrap .c-fixr th, .contracts-wrap .c-fixr td { background: #f8fafc; }
.contracts-wrap .c-fixr th { font-weight: 700; background: #fafbfe; color: var(--danger) !important; }
/* 操作按钮 2 列网格：左列上查看下期次，右列删除（无删除权限时仅左列上下两个） */
.contracts-wrap .op-grid { display: inline-grid; grid-template-columns: auto auto; gap: 3px 6px; align-items: center; justify-items: center; }
.contracts-wrap .op-grid .op-c1 { grid-column: 1; }
.contracts-wrap .op-grid .op-c2 { grid-column: 2; grid-row: 1 / span 2; }
/* 金额列数字等宽对齐更整齐 */
.contracts-wrap td.money { font-variant-numeric: tabular-nums; }

.badge.rent { background: #e0e7ff; color: #4338ca; }
.badge.lease { background: #d1fae5; color: #047857; }
.badge.idle { background: #dcfce7; color: #166534; }
.badge.sold { background: #fef3c7; color: #b45309; }
.badge.reserve { background: #dbeafe; color: #1d4ed8; }
/* V2.4.2：线索阶段「试用中」用绿色徽章（区别于跟进中/已成交） */
.badge.trial { background: #dcfce7; color: #15803d; }
/* V2.3.2c：合同状态徽章统一样式（合同台账/回款汇总/发票期次/回款弹窗四处一致） */
.badge.status-badge,
.table td .badge.status-badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 20px; vertical-align: middle; line-height: 1.6; }

.badge.active { background: #e0e7ff; color: #4338ca; }
.badge.ended { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.badge.overdue { background: #fee2e2; color: #b91c1c; }
.badge.paid { background: #dcfce7; color: #166534; }

/* 车辆照片 */
.vehicle-thumbs { display: inline-flex; align-items: center; cursor: pointer; position: relative; }
.vehicle-thumbs img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.vehicle-thumbs i {
  position: absolute; top: -6px; right: -6px; background: var(--primary); color: #fff;
  font-style: normal; font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 10px;
}
.photo-section { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 6px; }
.photo-section label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
textarea#f-config { width: 100%; min-height: 64px; resize: vertical; }

.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.btn:hover { background: #f1f4fa; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.blue { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.blue:hover { background: #1d4ed8; }
.btn.green { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.green:hover { background: #15803d; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }

.btn-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
/* 导出时间范围输入控件 */
.exp-date { width: 128px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.exp-date-sep { color: var(--muted); margin: 0 2px; align-self: center; }
/* 导出弹窗 */
.exp-modal { width: 360px; }
.exp-modal-body { padding: 18px 20px; }
.exp-range-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.exp-range-row label { width: 70px; color: var(--text); font-weight: 500; }
.exp-range-row input { flex: 1; }
/* 打包进度弹窗 */
.pack-modal { width: 320px; }
.pack-modal-body { padding: 26px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pack-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary, #2563eb);
  animation: pack-spin 0.8s linear infinite;
}
@keyframes pack-spin { to { transform: rotate(360deg); } }

input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
select[multiple] { width: 100%; height: 150px; padding: 4px 6px; }
select[multiple] option { padding: 4px 6px; border-radius: 4px; }
label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
input[type="date"], input[type="number"] { width: 100%; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.form-grid .full { grid-column: 1 / -1; }
/* form-grid 内输入框/文本域撑满所在列（checkbox/radio 除外，避免影响复选框列表） */
.form-grid input:not([type=checkbox]):not([type=radio]):not([type=file]),
.form-grid textarea { width: 100%; }

/* 还款计划：已还清浅绿、当月及当月之前待还款浅红 */
.pp-row-done { background: #ecfdf3; }
.pp-row-done:hover { background: #d1fadf; }
.pp-row-due { background: #fef2f2; }
.pp-row-due:hover { background: #fee2e2; }
/* 车架号旁已关联付款单徽章 */
.pp-pay-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pp-pay-tag { font-weight: 400; font-size: 11px; border: 1px solid transparent; }
.pp-pay-tag.c0 { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.pp-pay-tag.c1 { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.pp-pay-tag.c2 { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
/* 车辆收益 */
.income-warn {
  font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 6px; padding: 6px 10px; margin: 6px 0;
  line-height: 1.5;
}
/* 醒目版：用于「成本缺失/占比失真」这类会直接影响金额判断的提醒 */
.income-warn.strong {
  font-size: 13px; font-weight: 600; color: #9a3412;
  border-left: 4px solid #f59e0b; padding: 8px 12px;
}
.income-big { font-size: 22px; font-weight: 700; color: var(--primary); margin: 6px 0; }
.income-sub { margin: 10px 0; padding: 8px 0; border-top: 1px dashed var(--border); }
.income-sub-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
/* 车辆收益搜索候选下拉 */
#income-candidates {
  position: relative; z-index: 20; display: none; margin-top: 4px; max-height: 240px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.income-cand { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.income-cand:hover { background: #f1f4fa; }
.pp-pay-tag.c3 { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.pp-pay-tag.c4 { background: #cffafe; color: #155e75; border-color: #a5f3fc; }
/* 还款计划状态下拉（编辑模式） */
.plan-status-sel { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
/* 还款计划汇总：置于底部、加大字号 */
.pp-summary {
  display: flex; gap: 32px; justify-content: flex-end; align-items: baseline;
  font-size: 15px; font-weight: 600; color: var(--text);
  padding: 12px 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
}
.pp-summary b { font-size: 18px; }

/* 车辆维保 */
.rp-parts { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 130px; overflow-y: auto; padding: 6px 2px; }
.rp-part { display: flex; align-items: center; gap: 4px; font-size: 13px; margin: 0; }
.rp-part input { width: 14px; height: 14px; }
.rp-photo-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.rp-thumb { position: relative; width: 60px; height: 60px; }
.rp-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }
.rp-thumb b { position: absolute; top: -7px; right: -7px; background: var(--danger); color: #fff; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; font-size: 11px; cursor: pointer; }
/* 维修单车架号候选下拉 */
#rp-sn-candidates {
  position: relative; z-index: 20; display: none; margin-top: 4px; max-height: 200px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
/* 同步维保醒目提示 */
.rp-sync-warn {
  display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin: 4px 0;
  color: #7c2d12; background: #ffedd5; border: 1px solid #fed7aa; border-radius: 8px; padding: 12px 14px; cursor: pointer;
}
.rp-sync-warn input { width: 17px; height: 17px; flex-shrink: 0; }
/* 维修单候选：客户信息副行 */
.cand-cust { font-size: 12px; color: #7a7f8c; margin-top: 2px; }
/* 客户名称手动修改 → 高亮 */
.rp-cust-edited { border-color: #f59e0b !important; background: #fffbeb !important; color: #92400e !important; }
/* 维修单缩略图（弹窗 + 表格） */
.rp-doc-preview { display: inline-flex; align-items: center; gap: 8px; }
.rp-doc-preview img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }
.rp-doc-preview b { cursor: pointer; color: var(--danger); }
.doc-thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); vertical-align: middle; }
.doc-thumb-link:hover { opacity: .85; }
/* 月度维保计划：车辆多选 */
.pl-vlist { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; padding: 6px; }
.pl-vitem { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; margin: 0; }
.pl-vitem:hover { background: #f1f4fa; }
.pl-vitem input { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.pl-vsel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pl-vchip { display: inline-flex; align-items: center; gap: 6px; background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.pl-vchip b { cursor: pointer; color: var(--danger); font-weight: 700; }
/* 维保计划表：表头与内容居中 */
#plans-table th, #plans-table td { text-align: center; }
#plan-detail-table th, #plan-detail-table td { text-align: center; }

/* 编辑类弹窗内容更舒展：加大内边距、表单间距与输入框 */
.modal #modal-body { padding: 16px 24px; flex: 1; min-height: 0; overflow-y: auto; }
.modal.modal-plans #modal-body { padding: 16px 24px 20px; }
.modal label:not(.vehicle-check-item) { margin: 12px 0 6px; font-size: 13px; }
.modal input:not([type=checkbox]):not([type=radio]):not([type=file]),
.modal select, .modal textarea {
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.5;
}
.modal .form-grid { gap: 6px 24px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 1200px;
  min-width: 0;
  max-width: 94vw;
  height: 84vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
/* V2.3.2d：内容弹窗统一尺寸（1200px × 84vh）——合同/车辆/回款/期次明细/绑定/线索 观感完全一致 */
.modal.modal-plans,
.modal.modal-vehicle { width: 1200px; }
.modal.modal-vehicle .form-grid { grid-template-columns: repeat(3, 1fr); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; }
.modal-close { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
#modal-body { padding: 16px 24px; flex: 1; min-height: 0; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* 期次明细：顶部（押金）固定，表格区滚动且表头冻结 */
.modal.modal-plans #modal-body { overflow: hidden; }
.plans-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.plans-top { flex-shrink: 0; }
/* V2.2：回款计划「重新生成」工具条 + 人工调整原因小字 */
.plans-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 2px;
}
.plans-toolbar .hint { flex: 1; min-width: 0; }
.adj-note {
  font-size: 12px;
  line-height: 1.4;
  color: #b45309;
  margin-top: 2px;
}
.adj-mark { color: #b45309; font-size: 12px; cursor: help; }
/* 车辆收益③：预付期次标记 */
.pp-prepaid {
  display: inline-block;
  font-size: 11px;
  line-height: 16px;
  padding: 0 4px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #b45309;
  border-radius: 4px;
  vertical-align: middle;
}
/* 打印时隐藏的辅助文案（回款计划弹窗的操作提示行等，不随打印输出） */
@media print { .no-print { display: none !important; } }
.plans-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.plans-table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}
.plans-table-wrap table { border: none; }
.plans-table-wrap .plans-unassigned { padding: 0 12px 12px; }
.plans-summary {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 2px solid var(--border);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  z-index: 3;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 300;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.toast.hidden { display: none; }
.toast.error { background: var(--danger); }

.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.hint { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.plan-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plan-row .due { font-weight: 600; min-width: 120px; }
.plan-row .amt { color: var(--muted); min-width: 90px; }
.plan-row .status { margin-left: auto; }

.money { font-variant-numeric: tabular-nums; }

.history-timeline { border-left: 3px solid #e0e7ff; margin: 10px 0 4px 10px; padding-left: 18px; }
.history-item { position: relative; padding: 8px 0 16px; }
.history-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}
/* 绑定中：绿色圆圈；已结束：保持蓝色 */
.history-item.active::before {
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ok);
}

/* 登录覆盖层 */
.login-overlay { position: fixed; inset: 0; z-index: 500; background: linear-gradient(135deg,#1e293b,#1a5fb4); display: flex; align-items: center; justify-content: center; }
.login-overlay.hidden { display: none; }
.login-card { background: #fff; padding: 36px 40px; border-radius: 14px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { font-size: 48px; text-align: center; }
.login-card h2 { text-align: center; margin: 10px 0 2px; color: #134a8f; font-size: 20px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-field { margin-bottom: 14px; }
.login-field input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.login-msg { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.login-btn { width: 100%; padding: 10px; font-size: 15px; }

/* ========== 左侧菜单栏布局 ========== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: #1e293b; color: #cbd5e1;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 90;
}
.sidebar-brand { padding: 18px 16px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid #334155; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-nav .tab {
  border: none; background: transparent; text-align: left; padding: 11px 20px; width: 100%;
  cursor: pointer; font-size: 14px; color: #cbd5e1; transition: background .15s; border-radius: 0;
}
.sidebar-nav .tab:hover { background: #334155; color: #fff; }
.sidebar-nav .tab.active { background: #2563eb; color: #fff; }
/* 二级菜单 */
.nav-group .nav-sub { display: none; }
.nav-group .nav-sub.open { display: block; }
.nav-sub .tab { padding: 9px 10px 9px 32px; font-size: 13px; color: #94a3b8; }
.nav-sub .tab:hover { background: #2b3f5c; color: #fff; }
.nav-sub .tab.active { background: #1d4ed8; color: #fff; }
.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid #334155; display: flex; flex-direction: column; gap: 10px;
}
.user-box { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #334155; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.logout-btn { background: #334155; color: #e2e8f0; border-color: #475569; }
.logout-btn:hover { background: #475569; }
.main-area { flex: 1; min-width: 0; margin-left: 210px; display: flex; flex-direction: column; background: var(--bg); }

/* ========== V2.3.2e 侧栏手动收起（仅图标） ========== */
.sidebar { transition: width .18s ease; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-text { white-space: nowrap; overflow: hidden; }
.sidebar-toggle {
  border: none; background: #334155; color: #cbd5e1; width: 26px; height: 26px; padding: 0;
  border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1; flex-shrink: 0;
}
.sidebar-toggle:hover { background: #475569; color: #fff; }
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed + .main-area { margin-left: 64px; }
.sidebar.collapsed .sidebar-brand { padding: 18px 8px; justify-content: center; }
.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .sidebar-nav .tab { padding: 12px 0; text-align: center; font-size: 17px; }
.sidebar.collapsed .sidebar-nav .tab .nv { display: none; }
.sidebar.collapsed .nav-sub { display: none !important; }
/* V2.3.2f 收起态：点一级图标 → 在该组下方弹出二级图标（同列、仅图标）；点其它一级自动收起 */
.sidebar.collapsed .nav-group.subopen > .nav-sub { display: block !important; background: #172033; }
.sidebar.collapsed .nav-group.subopen > .tab { background: #334155; color: #fff; }
.sidebar.collapsed .sidebar-nav .nav-sub .tab { font-size: 15px; padding: 9px 0; }
.sidebar.collapsed .sidebar-foot { padding: 14px 8px; align-items: center; }
.sidebar.collapsed .sidebar-foot .user-info,
.sidebar.collapsed .sidebar-foot .logout-btn { display: none; }

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand, .sidebar-foot { display: none; }
  .sidebar-nav .tab { padding: 14px 0; text-align: center; font-size: 0; }
  .sidebar-nav .tab::after { font-size: 14px; }
  .main-area { margin-left: 60px; }
}

/* ========== 通用确认弹窗 ========== */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 600; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
  background: #fff; border-radius: 12px; width: 400px; max-width: 90vw;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3); overflow: hidden;
  display: flex; flex-direction: column;
}
.confirm-head {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.confirm-head h3 { margin: 0; font-size: 15px; color: var(--text); }
.confirm-body { padding: 20px; font-size: 14px; color: var(--text); line-height: 1.6; word-break: break-all; }
.confirm-body p { margin: 0; }
.confirm-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.confirm-foot .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.confirm-foot .btn.danger:hover { background: #dc2626; }

/* ========== 合同关联车辆选择器 ========== */
.contract-vehicles { border-top: 1px dashed var(--border); padding-top: 10px; }
.vc-search { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; cursor: pointer; background: #f8fafc; }
.picked-vehicle-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.picked-vehicle {
  padding: 7px 10px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.picked-vehicle .pv-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pv-code { font-weight: 600; color: var(--primary); }
.pv-sn { color: #64748b; font-size: 12px; }
.pv-brand, .pv-model { color: var(--text); }
.picked-vehicle .btn { margin-left: auto; }
/* 关联车辆配置信息：独立一行，自动换行显示齐全 */
.pv-config { margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); word-break: break-all; white-space: normal; }
.pv-config-label { color: var(--text); font-weight: 600; margin-right: 4px; }
/* 合同关联车辆：备用车蓝色标记 + 勾选（备用车复选框固定最右侧、编辑态才显示、加大加粗） */
.picked-vehicle.pv-reserve { border-color: #60a5fa; background: #eff6ff; box-shadow: inset 0 0 0 1px #bfdbfe; }
.pv-reserve-tag { display: none; color: #1d4ed8; font-weight: 700; }
.picked-vehicle.pv-reserve .pv-reserve-tag { display: inline; }
.pv-reserve-check { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 15px; font-weight: 700; color: #1d4ed8; cursor: pointer; white-space: nowrap; }
.pv-reserve-check input { width: 16px; height: 16px; cursor: pointer; }
/* 合同弹窗：合同级"客户自理"标记块（2×2 排列 + 高亮背景） */
.contract-self-handled { border-top: 1px dashed var(--border); padding-top: 10px; }
.contract-self-box {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
  background: #fef9ec; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px;
}
.contract-self-box .self-item { display: flex; align-items: center; gap: 5px; margin: 0; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }
.contract-self-box .self-item input { width: 16px; height: 16px; cursor: pointer; }
.contract-self-box .self-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin: 2px 0 0; line-height: 1.5; }
/* 车辆档案：年检/保险 2 行显示 */
.bidate-cell { display: flex; flex-direction: column; gap: 2px; font-size: 12px; white-space: nowrap; }

/* 选择器弹窗 */
.picker-overlay {
  position: fixed; inset: 0; z-index: 550; background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
}
.picker-box {
  background: #fff; border-radius: 12px; width: min(880px, 92vw); height: 72vh; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}
.picker-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.picker-head h3 { margin: 0; font-size: 15px; }
.picker-search { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.picker-search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.picker-list { flex: 1; overflow-y: auto; padding: 10px 20px; display: flex; flex-direction: column; gap: 4px; }
.pk-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; font-size: 13px; transition: background .12s;
}
.pk-item:hover { background: #f1f5f9; }
.pk-item.picked { background: #eff6ff; border-color: #bfdbfe; }
.pk-item .pk-checkbox { width: 16px; height: 16px; }
.pk-code { font-weight: 600; color: var(--primary); min-width: 76px; }
.pk-sn { color: #64748b; font-size: 12px; }
.pk-brand, .pk-model { color: var(--text); }
.pk-cfg { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.picker-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.picker-foot .hint { margin-right: auto; }

/* 车辆台账：已终止且有逾期的合同绑定 → 红色标记提醒 */
.bind-warn b { color: var(--danger); }
.bind-warn .bind-customer { color: var(--danger) !important; }
.bind-warn-tip { color: var(--danger); font-size: 11px; font-weight: 600; margin-top: 2px; }

/* 绑定记录：时间冲突异常标记 */
.bind-conflict td { background: #fff1f2 !important; }
.bind-conflict:hover td { background: #ffe4e6 !important; }

/* 账号列表小头像 */
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}

/* 合同附件归档 */
.contract-attachments { margin-top: 10px; }
.attach-cat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fafbfe;
}
.attach-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.attach-cat-head b { font-size: 13px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-empty { font-size: 12px; padding: 4px 0; }
.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--card);
  max-width: 100%;
}
.attach-item img {
  width: 52px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
}
/* 竖排附件（图片缩略图在上，文件名称在下）——车辆照片/车辆资料图片 */
.attach-item.attach-vert { flex-direction: column; align-items: center; gap: 4px; width: 88px; }
.attach-item.attach-vert img { width: 80px; height: 64px; }
.attach-name {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
  max-width: 100%;
  line-height: 1.3;
  cursor: pointer;
}
.attach-item.attach-vert .attach-name { max-height: 26px; overflow: hidden; }
.attach-file-link {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
  max-width: 260px;
  line-height: 1.3;
}
.attach-file-link:hover { text-decoration: underline; }
.attach-size { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* 附件大图预览（lightbox 翻页） */
.attach-preview-box {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.attach-preview-box img {
  max-width: 90vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
}
.attach-preview-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}
.attach-preview-close:hover { background: rgba(255,255,255,.3); }
.attach-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  font-size: 30px;
  width: 44px;
  height: 64px;
  border-radius: 8px;
  cursor: pointer;
}
.attach-preview-nav:hover { background: rgba(255,255,255,.35); }
.attach-preview-nav.prev { left: 24px; }
.attach-preview-nav.next { right: 24px; }
.attach-preview-count {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(255,255,255,.15);
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* 合同查看模式：只读，禁止编辑/上传 */
.modal-view #modal-body input,
.modal-view #modal-body select,
.modal-view #modal-body textarea {
  pointer-events: none;
  background: #f8fafc;
  color: #334155;
}
.modal-view .vc-search { pointer-events: none; }
.modal-view .picked-vehicle .btn { display: none; }

/* 编辑车辆弹窗：车辆信息 / 证照信息 / 保险信息 三大块 */
.vm-section { margin-bottom: 14px; }
/* 证照信息 / 保险信息 / 维修信息 / 维保信息 左右两列分栏（可换行 2×2） */
.vm-split { display: flex; gap: 16px; flex-wrap: wrap; }
.vm-split .vm-split-item { flex: 1 1 calc(50% - 8px); min-width: 0; }
.vm-section-title {
  font-weight: 700; font-size: 13px; color: #1e3a8a;
  padding: 6px 10px; border-left: 3px solid #2563eb;
  background: #f0f6ff; border-radius: 0 6px 6px 0;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.vm-block {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; background: #fafbfe; min-height: 40px;
}
.vm-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.vm-row:last-child { border-bottom: none; }
.vm-row span { color: var(--muted); flex-shrink: 0; }
.vm-row b { text-align: right; }
/* 维修/维保信息明细表（紧凑小字号） */
.vm-table th, .vm-table td { padding: 4px 6px; font-size: 12px; white-space: nowrap; }
/* 维修内容：自动换行 */
.vm-table td.vm-wrap { white-space: normal; max-width: 160px; word-break: break-all; }
/* 证照/保险弹窗内附件列表：右对齐、可换行 */
.vm-attach-list { justify-content: flex-end; flex-wrap: wrap; }
/* 证照/保险模块"客户自理"复选框行 */
.vm-self-check {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 6px; border-bottom: 1px dashed var(--border); margin-bottom: 6px;
}
.vm-self-check label { display: flex; align-items: center; gap: 5px; margin: 0; font-size: 13px; color: var(--text); cursor: pointer; }
.vm-self-check input { width: 15px; height: 15px; cursor: pointer; }
/* 客户自理说明块（勾选后仅展示） */
.vm-self-note {
  font-size: 13px; color: #1e3a8a; background: #eef4ff;
  border: 1px solid #c7d7fe; border-radius: 8px;
  padding: 8px 10px; line-height: 1.6;
}

/* 审批人圆形头像 */
.appr-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: linear-gradient(135deg, #4f8ef7, #7b5ef0);
  color: #fff; font-weight: 600; flex-shrink: 0; line-height: 1;
  vertical-align: middle;
}

/* ============ AI 助手（右下角悬浮） ============ */
.ai-fab {
  position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px;
  border-radius: 50%; border: none; background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-size: 24px; cursor: pointer; z-index: 990;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35); transition: transform .15s;
}
.ai-fab:hover { transform: scale(1.06); }
.ai-fab-badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 10px; background: #dc2626; color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
  border: 2px solid #fff;
}
.ai-panel {
  position: fixed; right: 22px; bottom: 88px; width: 420px;
  max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 120px));
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .18); z-index: 990;
  display: flex; flex-direction: column; overflow: hidden;
}
.ai-panel.hidden { display: none; }
.ai-panel-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc; flex-wrap: wrap;
}
.ai-panel-title { font-weight: 700; font-size: 14px; color: #1e3a8a; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.ai-panel-mode {
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 3px 6px; border-radius: 8px; white-space: nowrap;
  background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0;
}
.ai-panel-mode.llm { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.ai-panel-mode.rule { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.ai-panel-tabs { display: flex; gap: 4px; flex: 1; min-width: 200px; }
.ai-tab {
  border: 1px solid #e2e8f0; background: #fff; color: #475569;
  border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.ai-tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.ai-panel-close { border: none; background: none; font-size: 15px; cursor: pointer; color: #64748b; padding: 2px 4px; }
.ai-body { display: none; flex: 1; overflow-y: auto; padding: 10px 12px; }
.ai-body.active { display: block; }
.ai-loading { color: #94a3b8; font-size: 13px; padding: 20px 0; text-align: center; }
.ai-sec { margin-bottom: 12px; }
.ai-sec-title {
  font-size: 12px; font-weight: 700; color: #475569; margin: 0 0 6px;
  display: flex; align-items: center; gap: 6px;
}
.ai-sec-num { background: #e2e8f0; color: #334155; border-radius: 8px; padding: 0 7px; font-size: 11px; }
.ai-sec.overdue .ai-sec-num { background: #fee2e2; color: #b91c1c; }
.ai-sec.today .ai-sec-num { background: #fef3c7; color: #b45309; }
.ai-item {
  border: 1px solid #e2e8f0; border-left: 3px solid #94a3b8; border-radius: 8px;
  padding: 7px 10px; margin-bottom: 6px; cursor: pointer; background: #fff;
}
.ai-item:hover { background: #f8fafc; }
.ai-item.overdue { border-left-color: #dc2626; }
.ai-item.today { border-left-color: #d97706; }
.ai-item.week { border-left-color: #2563eb; }
.ai-item.month { border-left-color: #64748b; }
.ai-item.other { border-left-color: #7c3aed; }
.ai-item.error { border-left-color: #dc2626; }
.ai-item.warn { border-left-color: #d97706; }
.ai-item.ok { border-left-color: #16a34a; }
.ai-item-title { font-size: 13px; font-weight: 600; color: #0f172a; }
.ai-item-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.ai-item-tag {
  display: inline-block; font-size: 11px; color: #475569; background: #f1f5f9;
  border-radius: 4px; padding: 0 5px; margin-right: 6px;
}
.ai-more { font-size: 12px; color: #94a3b8; padding: 2px 2px 6px; }
.ai-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.ai-stat { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 6px; text-align: center; background: #fff; }
.ai-stat b { display: block; font-size: 18px; color: #0f172a; }
.ai-stat span { font-size: 11px; color: #64748b; }
.ai-stat.red b { color: #dc2626; }
.ai-stat.amber b { color: #d97706; }
.ai-stat.green b { color: #16a34a; }
.ai-trend { display: flex; align-items: flex-end; gap: 4px; height: 56px; padding: 4px 2px 0; }
.ai-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; justify-content: flex-end; }
.ai-trend-bar { width: 100%; background: #93c5fd; border-radius: 3px 3px 0 0; }
.ai-trend-day { font-size: 10px; color: #94a3b8; }
.ai-health { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%); margin-bottom: 12px; }
.ai-health h4 { margin: 0 0 8px; font-size: 13px; color: #0f172a; }
.ai-health .ai-stat-grid { margin-bottom: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ai-empty { border: 1px dashed #16a34a; border-radius: 10px; padding: 16px 10px; text-align: center; color: #16a34a; background: #f0fdf4; font-size: 13px; margin-bottom: 12px; }
.ai-chat-body { padding: 0; }
.ai-chat-body.active { display: flex; flex-direction: column; }
#ai-chat-log {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.ai-msg {
  max-width: 85%; padding: 7px 10px; border-radius: 10px;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.ai-msg-bot { background: #f1f5f9; color: #0f172a; align-self: flex-start; border-bottom-left-radius: 3px; }
.ai-msg-user { background: #2563eb; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.ai-chat-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #e2e8f0; }
#ai-chat-input {
  flex: 1; border: 1px solid #e2e8f0; border-radius: 8px; padding: 7px 10px;
  font-size: 13px; outline: none; font-family: inherit; line-height: 1.5;
  min-height: 30px; max-height: 110px; resize: vertical;
}
/* 回款速录草稿卡 */
.ai-entry-wrap { max-width: 100%; align-self: stretch; background: #fff; border: 1px solid #dbe4f0; }
.ai-entry { font-size: 12px; line-height: 1.5; width: 100%; }
.ai-entry-title { font-weight: 700; color: #1e3a8a; margin-bottom: 6px; font-size: 12.5px; }
.ai-entry-row {
  padding: 5px 8px; border-left: 3px solid #22c55e; background: #f8fafc;
  margin-bottom: 5px; border-radius: 3px; word-break: break-all;
}
.ai-entry-row.over { border-color: #f59e0b; background: #fffbeb; }
.ai-entry-row.deposit-in { border-color: #3b82f6; background: #eff6ff; }
.ai-entry-row.deposit-out { border-color: #a855f7; background: #faf5ff; }
.ai-entry-row.veh { border-color: #0891b2; background: #ecfeff; }
.ai-entry-row.ctr { border-color: #d97706; background: #fff7ed; }
.ai-entry-row.inv { border-color: #0d9488; background: #f0fdfa; }
.ai-entry-row.lead { border-color: #db2777; background: #fdf2f8; }
.ai-entry-date { color: #64748b; margin-left: 6px; font-size: 11px; }
.ai-entry-tag { font-weight: 600; }
.ai-entry-warn { color: #b45309; font-size: 11px; margin-top: 2px; }
.ai-entry-err { color: #b91c1c; font-size: 11px; margin-top: 6px; background: #fef2f2; padding: 4px 6px; border-radius: 4px; }
.ai-entry-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ai-entry-actions .btn {
  border: 1px solid #cbd5e1; background: #fff; color: #334155; cursor: pointer;
  border-radius: 6px; padding: 5px 12px; font-size: 12px; line-height: 1.4;
}
.ai-entry-actions .btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.ai-entry-actions .btn:hover { opacity: .9; }
.ai-entry-actions .btn:disabled { opacity: .5; cursor: not-allowed; }

.req { color: #e53935; }

/* ---- 系统设置：数据变动 + 数据备份 ---- */
.restore-zone { border: 1px dashed var(--border, #cbd5e1); border-radius: 8px; padding: 14px; background: #fffdf5; }
#oplog-summary span { line-height: 1.9; }
#oplog-tbody td { vertical-align: middle; }
#backup-tbody td { vertical-align: middle; }

/* ---- AI 助手：业务记忆 + 速录工具行 ---- */
.ai-chat-tools { padding: 6px 10px 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-chat-tools .btn { padding: 3px 10px; font-size: 12px; }
.ai-chat-tools-hint { font-size: 11px; color: var(--muted); }
.ai-mem-list { margin-top: 6px; }
.ai-mem-item { margin: 5px 0; font-size: 12px; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px; background: #fff; }
.ai-mem-item summary { cursor: pointer; font-weight: 600; }
.ai-mem-rule { padding: 3px 0 2px; color: #334155; line-height: 1.55; }
.ai-mem-item ul { margin: 4px 0 2px 18px; }
.ai-mem-item li { margin: 2px 0; line-height: 1.55; }

/* 2026-09-04 保险重叠提醒条（证照/保险增强） */
#insurance-overlap-bar{background:#fff7e6;border:1px solid #ffd591;border-left:4px solid #fa8c16;border-radius:6px;padding:8px 12px;margin-bottom:10px;font-size:13px;color:#8c4b00}
#insurance-overlap-bar .ov-head{font-weight:600;margin-bottom:4px}
#insurance-overlap-bar .ov-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:4px 0;border-top:1px dashed #ffe0b2}
#insurance-overlap-bar .ov-row:first-of-type{border-top:0}
#insurance-overlap-bar .ov-ins{background:#fff;border:1px solid #ffd591;padding:1px 8px;border-radius:10px;font-size:12px;white-space:nowrap}
#insurance-overlap-bar .ov-and{color:#b55300;font-size:12px}
#insurance-overlap-bar .ov-veh{white-space:nowrap}

/* ===== 合同台账 · 审批中遮罩标记（2026-09-05） ===== */
/* 注意：td 本身是 position:sticky（左 4 列冻结依赖它），不可覆盖为 relative，
   否则横向滚动时表体冻结列脱位（表头仍冻结 → 类型列错位）。sticky 即定位元素，
   td::after 绝对定位仍以 td 为包含块，斜纹覆盖不受影响。 */
#contracts-table tr.appr-mask td::after {
  content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(-45deg, rgba(255,180,0,.05) 0 10px, rgba(255,180,0,.11) 10px 20px);
  pointer-events: none; z-index: 2;
}
#contracts-table tr.appr-mask td:nth-child(1) { background: #fff8e6; }
#contracts-table tr.appr-mask td:nth-child(11) { background: #fffdf5; }
.appr-chips { text-align: center; margin-bottom: 3px; white-space: normal; line-height: 1.35; }
.appr-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px;
  cursor: pointer; margin: 0 2px; white-space: nowrap; border: 1px solid transparent;
  position: relative; z-index: 3;
}
.appr-chip.del { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.appr-chip.del:hover { background: #fecaca; }
.appr-chip.end { color: #9a3412; background: #ffedd5; border-color: #fed7aa; }
.appr-chip.end:hover { background: #fed7aa; }
.appr-banner { margin: 0 0 6px; padding: 7px 12px; border-radius: 8px; background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; font-size: 13px; line-height: 1.9; }
.appr-banner-chip { display: inline-block; margin: 0 6px 0 0; padding: 1px 10px; background: #fff; border: 1px solid #fdba74; border-radius: 12px; cursor: pointer; font-size: 12px; }
.appr-banner-chip:hover { background: #fed7aa; }

/* ===== 通用审批遮罩（2026-09-05）：维修记录 / 维保记录 / 维保计划 / 车辆档案 =====
   正常审批（新增/编辑 approval_status=pending）→ 黄斜纹 .appr-mask
   删除审批（approval_instance pending + action=delete）→ 红斜纹 .appr-mask-del
   目标表 td 无 sticky 冻结（仅 contracts-wrap 冻结），可安全设 relative 作 ::after 包含块 */
#repairs-table tr.appr-mask td,
#maintains-table tr.appr-mask td,
#plans-table tr.appr-mask td,
#vehicles-table tr.appr-mask td,
#repairs-table tr.appr-mask-del td,
#maintains-table tr.appr-mask-del td,
#plans-table tr.appr-mask-del td,
#vehicles-table tr.appr-mask-del td { position: relative; }
#repairs-table tr.appr-mask td::after,
#repairs-table tr.appr-mask-del td::after,
#maintains-table tr.appr-mask td::after,
#maintains-table tr.appr-mask-del td::after,
#plans-table tr.appr-mask td::after,
#plans-table tr.appr-mask-del td::after,
#vehicles-table tr.appr-mask td::after,
#vehicles-table tr.appr-mask-del td::after {
  content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 1;
}
#repairs-table tr.appr-mask td::after,
#maintains-table tr.appr-mask td::after,
#plans-table tr.appr-mask td::after,
#vehicles-table tr.appr-mask td::after {
  background: repeating-linear-gradient(-45deg, rgba(255, 180, 0, .05) 0 10px, rgba(255, 180, 0, .11) 10px 20px);
}
#repairs-table tr.appr-mask-del td::after,
#maintains-table tr.appr-mask-del td::after,
#plans-table tr.appr-mask-del td::after,
#vehicles-table tr.appr-mask-del td::after {
  background: repeating-linear-gradient(-45deg, rgba(220, 38, 38, .05) 0 10px, rgba(220, 38, 38, .11) 10px 20px);
}
/* 正常审批（新增/编辑）徽标：黄系，与删除审批红系区分 */
.appr-chip.add { color: #854d0e; background: #fef3c7; border-color: #fde68a; }
.appr-chip.add:hover { background: #fde68a; }

/* 审批记录弹窗：审批中 / 已结束 双 Tab（已结束懒加载 + 每页 10 条分页） */
.appr-list-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.appr-tab-btn { border: 1px solid var(--border); background: #fff; color: #475569; padding: 5px 14px; border-radius: 16px; cursor: pointer; font-size: 13px; transition: all .15s; }
.appr-tab-btn:hover { border-color: #93c5fd; color: #2563eb; }
.appr-tab-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }

/* 批量导入统一弹窗（导入中 → 结果 + 一键复制） */
.import-modal { width: 1200px; max-width: 94vw; }
#import-modal-done.hidden { display: none; }
.import-result-text { margin: 0; padding: 12px 14px; max-height: 52vh; overflow: auto; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-family: Consolas, "Microsoft YaHei", monospace; font-size: 12px; line-height: 1.8; color: #334155; white-space: pre-wrap; word-break: break-all; }

/* AI 提醒跳转定位：目标区块短暂高亮（board.js boardScrollTo） */
.blk-flash { animation: blkFlash 1.8s ease-out 1; border-radius: 10px; }
@keyframes blkFlash {
  0%   { box-shadow: 0 0 0 3px rgba(37, 99, 235, .55); background: rgba(37, 99, 235, .07); }
  60%  { box-shadow: 0 0 0 3px rgba(37, 99, 235, .30); background: rgba(37, 99, 235, .04); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);     background: transparent; }
}

/* 客户名称下方的小字（客户简称） */
.sub-text { display:inline-block; font-size:11px; color: var(--muted); line-height:1.3; }

/* ==================== 设备监控 / 车辆地图（需求2） ==================== */
.dm-loading, .dm-empty { padding: 28px; text-align: center; color: var(--muted); }
.dm-muted { color: var(--muted); }
.dm-sub { font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.dm-warn-text { color: var(--danger); }
.dm-ellip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 统计卡 */
.dm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.dm-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-left: 4px solid var(--border); }
.dm-card-danger { border-left-color: var(--danger); }
.dm-card-warn { border-left-color: var(--warn); }
.dm-card-ok { border-left-color: var(--ok); }
.dm-card-num { font-size: 26px; font-weight: 700; line-height: 1.15; }
.dm-card-num span { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.dm-card-danger .dm-card-num { color: var(--danger); }
.dm-card-warn .dm-card-num { color: var(--warn); }
.dm-card-ok .dm-card-num { color: var(--ok); }
.dm-card-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* 今日换电/充电/总计 三色分列（V2.3.2c） */
.dm-card .dm-ev { font-size: 20px; font-weight: 700; margin-right: 12px; }
.dm-card .dm-ev:last-child { margin-right: 0; }
.dm-card .dm-ev i { font-style: normal; font-size: 12px; font-weight: 400; color: var(--muted); margin-right: 3px; }

/* 键值块 */
.dm-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; padding: 10px 12px; }
.dm-kv > div { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.dm-kv > div > span { color: var(--muted); min-width: 92px; }
.dm-kv > div > b { font-weight: 600; }

/* 徽标 */
.dm-badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.dm-b-danger { background: #fdecec; color: var(--danger); }
.dm-b-warn { background: #fdf3e3; color: var(--warn); }
.dm-b-ok { background: #e8f6ec; color: var(--ok); }

/* 电量 */
.dm-soc { font-weight: 700; }
.dm-soc-low { color: var(--danger); }
.dm-soc-warn { color: var(--warn); }
.dm-soc-ok { color: var(--ok); }

/* 电量趋势 */
.dm-trend { width: 100%; height: 150px; display: block; background: #fbfcfe; border-radius: 8px; }
.dm-trend-grid { stroke: #e6ebf3; stroke-width: 1; stroke-dasharray: 4 4; }
.dm-trend-grid-warn { stroke: #f6d9a8; }
.dm-trend-grid-low { stroke: #f3bcbc; }
.dm-trend-area { fill: rgba(37, 99, 235, .10); stroke: none; }
.dm-trend-line { fill: none; stroke: var(--primary); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.dm-trend-dot { fill: var(--primary); }

/* 设备详情 */
.dm-detail-head { margin-bottom: 10px; }
.dm-detail-sn { font-size: 18px; font-weight: 700; margin-right: 8px; }
.dm-alert-line { background: #fdecec; color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; }

/* 日志级别 */
.dm-log-lv { padding: 1px 7px; border-radius: 4px; font-size: 11px; background: #eef1f6; color: var(--muted); }
.dm-log-info { background: #eaf2fe; color: var(--primary); }
.dm-log-warn { background: #fdf3e3; color: var(--warn); }
.dm-log-error { background: #fdecec; color: var(--danger); }

/* 推送开关条 */
.dm-switches { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
.dm-switch { padding: 3px 10px; border-radius: 20px; font-size: 12px; background: #eef1f6; color: var(--muted); }
.dm-switch.on { background: #e8f6ec; color: var(--ok); }
.dm-switch.off { background: #f3f4f7; color: var(--muted); }

/* 消息预览 */
.dm-preview { margin: 0; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; font-family: Consolas, "Microsoft YaHei", monospace; font-size: 12px; line-height: 1.8; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; }

/* ===== 车辆地图分布看板 ===== */
.dm-legend { display: flex; align-items: center; gap: 16px; padding: 6px 2px 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.dm-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dm-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dm-dot-danger { background: #fdeceb; border: 1px solid #f6cfcd; }
.dm-dot-warn { background: #fdf5e5; border: 1px solid #f5dcb0; }
.dm-dot-ok { background: #e9f7ee; border: 1px solid #cbe9d6; }

.dm-listcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.dm-listcard-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafbfd; }
.dm-listcard-head b { font-size: 14px; }
.dm-listcard-ops { display: inline-flex; gap: 6px; }
.dm-mini { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: #eef1f6; color: var(--muted); }
.dm-mini-ok { background: #e8f6ec; color: var(--ok); }
.dm-mini-warn { background: #fdf3e3; color: var(--warn); }
.dm-counts { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.dm-counts b { font-weight: 700; }
.dm-c-danger { color: var(--danger); }
.dm-c-warn { color: var(--warn); }
.dm-c-ok { color: var(--ok); }

.dm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px; padding: 12px 14px; max-height: 520px; overflow: auto; }
/* 地图格子（卡片化）：客户名称 + 简称小字 / 地址 / 车架号 / 电量 */
.dm-cell-cust { font-weight: 600; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dm-cell-sub { display: block; font-weight: 400; font-size: 10px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* 只看园区过滤条 */
.dm-filterbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; margin-bottom: 10px; background: #eef4ff; border: 1px solid #c7d7fe; border-radius: var(--radius); font-size: 13px; }
.dm-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 8px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; text-align: left; font-size: 11px; line-height: 1.25; transition: transform .08s; }
.dm-cell:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(15, 23, 42, .14); }
.dm-cell-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dm-cell-soc { font-size: 11px; opacity: .85; }
.dm-cell-danger { background: #fdeceb; color: #b91c1c; border-color: #f6cfcd; }
.dm-cell-warn { background: #fdf5e5; color: #b45309; border-color: #f5dcb0; }
.dm-cell-ok { background: #e9f7ee; color: #15803d; border-color: #cbe9d6; }

.dm-chip { display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 11px; margin: 1px 2px 1px 0; background: #eef1f6; color: var(--muted); }
.dm-chip-danger { background: #fdeceb; color: #b91c1c; }
.dm-chip-warn { background: #fdf5e5; color: #b45309; }
.dm-chip-ok { background: #e9f7ee; color: #15803d; }

/* 设备搜索建议 */
.dm-suggest { max-height: 190px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; }
.dm-suggest:empty { display: none; }
.dm-suggest-item { padding: 6px 10px; cursor: pointer; font-size: 12px; border-bottom: 1px solid #f1f3f8; display: flex; gap: 10px; align-items: baseline; }
.dm-suggest-item:last-child { border-bottom: none; }
.dm-suggest-item:hover { background: #f3f7ff; }
.dm-suggest-item span { color: var(--muted); }
.dm-suggest-empty { padding: 8px 10px; color: var(--muted); font-size: 12px; }

/* ============ 车辆地图：排序/筛选控制条（2026-09-24） ============ */
.dm-inline-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dm-inline-ctl select { height: 30px; padding: 0 6px; font-size: 12px; }
.dm-cell-cust { display: flex; align-items: center; gap: 3px; width: 100%; font-weight: 600; font-size: 11.5px; }
.dm-cell-custname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-cell-edit { font-style: normal; font-size: 10px; opacity: .4; flex-shrink: 0; }
.dm-cell-edit:hover { opacity: 1; }
/* 按客户视图：问题设备明细，每台 2 行（车架号 / 电量+状态），多台自动换行 */
.dm-custdev-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-custdev { display: flex; flex-direction: column; gap: 1px; min-width: 132px; padding: 4px 7px; border-radius: 6px; border: 1px solid transparent; font-size: 11px; line-height: 1.3; cursor: pointer; }
.dm-custdev:hover { box-shadow: 0 2px 6px rgba(15, 23, 42, .14); }
.dm-custdev b { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.2px; }
.dm-custdev > span { opacity: .9; }
.dm-custdev-danger { background: #fdeceb; color: #b91c1c; border-color: #f6cfcd; }
.dm-custdev-warn { background: #fdf5e5; color: #b45309; border-color: #f5dcb0; }
.dm-custdev-ok { background: #e9f7ee; color: #15803d; border-color: #cbe9d6; }
/* 设备详情：客户名称/地址可编辑行 */
.dm-detail-cust { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; font-size: 13px; }
.dm-cust-label { display: inline-block; min-width: 65px; color: var(--muted); font-size: 12px; }
/* 查看车辆：只读信息块 */
.vm-ro { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 34px; padding: 6px 10px; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.vm-ro-sep { color: var(--muted); }

/* ---------- 绑定信息两行格式（车辆列表 / 查看车辆弹窗） ---------- */
.bind-info { display: inline-block; }
.bind-line { display: block; white-space: nowrap; }
.bind-line + .bind-line { margin-top: 1px; }
.bind-sep { font-style: normal; color: var(--muted); margin: 0 5px; }
.bind-line .bind-customer { max-width: 180px; }

/* ---------- 设备详情底部操作区（不再关注 / 转移关注清单） ---------- */
.dm-detail-ops {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.dm-ops-move { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.dm-ops-move select { min-width: 150px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ---------- 清单 Excel 导入预览（需求E） ---------- */
.dm-imp-sum { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.dm-imp-sum .dm-mini { margin: 0 2px; }
.dm-imp-missing-text { color: var(--danger); }
.dm-imp-missing td { color: var(--danger); background: #fdf2f2; }

/* ---------- 趋势图昼夜带与横轴（需求I） ---------- */
.dm-trend-night { fill: rgba(31, 36, 48, 0.07); }
.dm-trend-tick { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.dm-trend-axis { position: relative; height: 16px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.dm-trend-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.dm-trend-axis .dm-trend-axis-note { right: 0; left: auto !important; transform: none; opacity: 0.8; }

/* ---------- 换电/充电时段柱状图（需求K） ---------- */
.dm-hourly-chart { display: block; }
.dm-bar-swap { fill: #d97706; }
.dm-bar-swap:hover { fill: #b45309; }
.dm-bar-charge { fill: #3b82f6; }
.dm-bar-charge:hover { fill: #2563eb; }
.dm-bar-axis { stroke: var(--border); stroke-width: 1; }
.dm-bar-label { font-size: 8.5px; fill: var(--muted); text-anchor: middle; font-family: "Microsoft YaHei", sans-serif; }
.dm-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.dm-swatch-charge { background: #3b82f6; }
.dm-swatch-swap { background: #d97706; }

/* ---------- 车辆地图仪表盘（需求L，移植独立监控总览样式） ---------- */
.dm-dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.dm-dash-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.dm-dash-card.total { grid-column: 1 / -1; }
.dm-dash-title { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.dm-dash-days { display: flex; gap: 22px; }
.dm-dash-num { font-size: 20px; font-weight: 600; }
.dm-dash-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.dm-dash-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* ---------- 按客户设备卡片：日均 SOC 子卡（需求N） ---------- */
.dm-custdev-foot { flex-basis: 100%; display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--border); margin-top: 3px; padding-top: 3px; font-size: 11px; }

/* ---------- 需求W：仪表盘清单卡拖动排序 ---------- */
.dm-dash-grip { cursor: grab; color: var(--muted); font-size: 15px; letter-spacing: -1px; user-select: none; margin-right: 2px; }
.dm-dash-grip:active { cursor: grabbing; }
.dm-dash-card[data-list] { transition: box-shadow 0.15s, opacity 0.15s; }
.dm-dash-card.dm-dash-dragging { opacity: 0.55; box-shadow: 0 0 0 2px var(--primary, #2563eb); }
