:root {
  --primary: #1f6feb;
  --primary-dark: #1858bd;
  --bg: #f3f5f8;
  --card: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7787;
  --green: #1a9e5c;
  --orange: #e8890c;
  --red: #d93a3a;
  --shadow: 0 2px 10px rgba(20, 40, 70, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1f6feb 0%, #38a3f5 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.login-card .logo {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.login-card .sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  background: #16233a;
  color: #dce6f2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  padding: 18px 18px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #cdd9e8;
  margin-bottom: 4px;
}
.sidebar nav a.active, .sidebar nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.sidebar .side-foot {
  padding: 14px 18px;
  font-size: 12px;
  color: #8fa3bc;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}
.topbar .menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
}
.topbar .title { font-weight: 700; flex: 1; }
.topbar .user-info { color: var(--muted); font-size: 13px; }
.content { padding: 20px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ===== 卡片与统计 ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.panel h3 { font-size: 15px; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h3 { margin: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.tbl th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.tbl tr:hover td { background: #f8fafc; }

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.in_transit { background: #e7f1ff; color: var(--primary); }
.badge.in_repair { background: #fff3e2; color: var(--orange); }
.badge.for_sale { background: #ecebff; color: #6a5ae0; }
.badge.self_transferred { background: #e3f4f8; color: #0e7c96; }
.badge.sold { background: #e6f7ee; color: var(--green); }
.badge.transferred { background: #eef1f5; color: var(--muted); }
.badge.draft { background: #f1f2f4; color: var(--muted); }
.badge.finance { background: #eaf6ec; color: #1e7a3c; }
.badge.attachment { background: #eef4fb; color: #3f6ea8; }

.badge.warn { background: #fdecec; color: var(--red); }
.badge.low { background: #fff3e2; color: var(--orange); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 14px;
  cursor: pointer;
  background: #eef2f7;
  color: var(--text);
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: #fdecec; color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.link { background: none; color: var(--primary); padding: 6px 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== 详情分段 ===== */
.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.detail-head .name { font-size: 20px; font-weight: 700; }
.section-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}
.kv { font-size: 13px; }
.section-grid > div { display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; }
.section-grid dt { color: var(--muted); font-size: 12.5px; }
.section-grid dd { margin: 0; word-break: break-all; }

/* 环节就近证据缩略图条 */
.ev-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ev-thumb {
  width: 64px; height: 64px; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--border); display: block; background: #f1f5f9;
}
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-pdf {
  width: 64px; height: 64px; border-radius: 9px; background: #fdecec;
  color: var(--red); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.cost-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.cost-strip .item {
  background: #f7f9fc;
  border-radius: 10px;
  padding: 12px;
}
.cost-strip .item .k { color: var(--muted); font-size: 12px; }
.cost-strip .item .v { font-weight: 700; font-size: 16px; margin-top: 2px; }
.cost-strip .item.net .v { color: var(--green); }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 45, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
  z-index: 50;
  overflow-y: auto;
}
.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 760px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 16px; }

/* ===== 提示 ===== */
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.alert {
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fdecec;
  color: var(--red);
}
.muted { color: var(--muted); }
.right { text-align: right; }
.mt-12 { margin-top: 12px; }

/* ===== 附件：证件 / 车辆图片 ===== */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.att-group { margin-bottom: 16px; }
.att-group:last-child { margin-bottom: 0; }
.att-group-title { font-weight: 600; margin-bottom: 10px; }
.att-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.att-card a { display: block; }
.att-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.att-pdf {
  width: 100%; height: 110px; display: flex; align-items: center; justify-content: center;
  background: #fdecec; color: var(--red); font-weight: 700; letter-spacing: 1px;
}
.att-meta { padding: 8px 10px; }
.att-title { font-size: 13px; }
.att-name { font-size: 11px; margin-top: 2px; word-break: break-all; color: var(--muted); }
.att-card .btn { margin: 0 10px 10px; }

/* ===== 销售管理分组 Tab 与筛选栏 ===== */
.tab-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 10px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; color: var(--text);
}
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-btn .muted { color: inherit; opacity: 0.8; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter-bar input {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 14px;
  min-width: 140px; background: #fff; color: var(--text);
}
.filter-bar select {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 14px;
  background: #fff; color: var(--text); min-width: 150px;
}
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--primary); }
.filter-bar input[type="date"] { min-width: 150px; }
.fin-filter { gap: 8px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 成交截图 OCR 识别面板 */
.ocr-panel {
  border: 1px dashed var(--primary); border-radius: var(--radius);
  background: #f7faff; padding: 16px; margin-bottom: 18px;
}
.ocr-head { margin-bottom: 12px; }
.ocr-head .muted { font-size: 13px; }
.ocr-upload-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ocr-upload-row label { cursor: pointer; }
.ocr-thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.ocr-thumb {
  width: 120px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff;
}
.ocr-thumb img { width: 100%; height: 84px; object-fit: cover; display: block; }
.ocr-thumb span {
  display: block; font-size: 12px; color: var(--muted); padding: 6px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ocr-text { margin-top: 10px; font-size: 12px; word-break: break-all; }

/* 遮罩（手机抽屉） */
.drawer-mask { display: none; }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .section-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 60;
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-mask.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15,28,45,0.4);
    z-index: 55;
  }
  .topbar .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 14px; }
  .form-grid, .section-grid { grid-template-columns: 1fr; }
  .section-grid > div { grid-template-columns: 96px 1fr; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 个人中心 / 权限配置 ===== */
.btn.ghost { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }

.app-footer {
  padding: 14px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.profile-info { margin-bottom: 16px; }
.profile-info .info-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.profile-info .info-row span { color: var(--muted); }
.profile-info .info-row strong { font-weight: 600; }

.role-perm-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
  background: #fff;
}
.role-perm-card:last-child { margin-bottom: 0; }
.role-perm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.perm-group { margin-bottom: 12px; }
.perm-group:last-child { margin-bottom: 0; }
.perm-group-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.perm-checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.perm-check {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer;
}
.perm-check input { width: 16px; height: 16px; accent-color: var(--primary); }

.tab-bar .btn.primary { margin-left: auto; }


/* ===== 保银官网统一样式：登录页 ===== */
.login-wrap{background:radial-gradient(1200px 600px at 15% 10%,#EAF5FD 0%,#F7FCFF 55%,#FFFFFF 100%)!important}
.login-card{background:#fff!important;border:1px solid #DCEBF7!important;border-radius:18px!important;
  box-shadow:0 18px 50px rgba(28,92,137,.12)!important;padding:34px 32px!important}
.lg-brand{display:flex;align-items:center;gap:12px;margin-bottom:10px}
.lg-brand img{width:42px;height:42px;border-radius:50%}
.lg-brand b{display:block;font-size:16.5px;color:#0F3550;letter-spacing:.2px}
.lg-brand em{display:block;font-style:normal;font-size:10px;color:#7C94A8;letter-spacing:.14em;margin-top:3px}
.login-card .sub{color:#54718A!important}
.login-card label{color:#54718A!important}
.login-card input{background:#F7FCFF!important;border:1px solid #DCEBF7!important;color:#0F3550!important;border-radius:10px!important}
.login-card input:focus{border-color:#5AA9E0!important;box-shadow:0 0 0 3px rgba(90,169,224,.15)!important}
.lg-back{display:flex;justify-content:space-between;align-items:center;margin-top:16px;font-size:12px;color:#7C94A8}
.lg-back a{color:#2E86C1;text-decoration:none}
.sidebar .brand{display:block;color:#fff;text-decoration:none}
.app-footer a{color:#7C94A8}

/* 登录验证码 */
.cap-row{display:flex;gap:10px;align-items:center}
.cap-row input{flex:1;min-width:0}
.cap-img{height:42px;width:132px;object-fit:cover;border:1px solid #DCEBF7;border-radius:9px;background:#F7FCFF;cursor:pointer}
