* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: #1f2329;
  font-size: 14px;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* 登录页 */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}
.login-box {
  background: #fff; border-radius: 12px; padding: 40px 36px; width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
}
.login-box h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-box .sub { margin: 0 0 28px; text-align: center; color: #888; font-size: 13px; }
.login-box label { display: block; margin: 14px 0 6px; color: #555; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #d0d5dd; border-radius: 8px; }
.login-box .btn-primary { width: 100%; margin-top: 22px; }
.err { color: #d93026; min-height: 20px; text-align: center; margin: 12px 0 0; }

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #1e3a8a; color: #fff; padding: 0 24px; height: 56px;
}
.topbar .brand { font-size: 18px; font-weight: 600; }
.user-area { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.user-area button { color: #fff; }

/* 标签页 */
.tabs { display: flex; background: #fff; border-bottom: 1px solid #e5e7eb; padding: 0 16px; }
.tab {
  border: none; background: none; padding: 14px 22px; font-size: 15px; color: #555;
  border-bottom: 3px solid transparent;
}
.tab.active { color: #1e3a8a; border-bottom-color: #1e3a8a; font-weight: 600; }

main { padding: 20px 24px; max-width: 1200px; margin: 0 auto; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; border-radius: 10px; padding: 18px 16px; border: 1px solid #eceef1; }
.kpi-label { color: #8a919c; font-size: 13px; margin-bottom: 8px; }
.kpi-num { font-size: 26px; font-weight: 600; }
.kpi-num.ontime { color: #16a34a; }
.kpi-num.diff { color: #dc2626; }

.dash-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.dash-filter label { color: #555; }
.dash-filter input { padding: 8px 12px; border: 1px solid #d0d5dd; border-radius: 8px; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; padding: 18px 20px; border: 1px solid #eceef1; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.dash-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.chart { height: 280px; width: 100%; }

.part-stats { display: flex; flex-direction: column; gap: 18px; }
.part-label { color: #8a919c; font-size: 13px; }
.part-num { font-size: 26px; font-weight: 600; margin-top: 4px; }
.part-num.warn { color: #d97706; }
.part-item.clickable { cursor: pointer; }
.part-item.clickable:hover .part-num { color: #b45309; text-decoration: underline; }
.click-hint { color: #b0b7c0; font-size: 12px; font-weight: normal; margin-left: 2px; }

/* 交车计划 */
.dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dp-block { border: 1px solid #eceef1; border-radius: 10px; padding: 14px 16px; }
.dp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dp-title { font-weight: 600; font-size: 15px; }
.dp-count { font-size: 22px; font-weight: 700; color: #1e3a8a; }
.dp-overdue { font-size: 13px; color: #dc2626; font-weight: 600; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #f0f1f3; white-space: nowrap; }
th { color: #8a919c; font-weight: 500; font-size: 13px; }
tr:hover td { background: #fafbfc; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input { flex: 1; padding: 9px 12px; border: 1px solid #d0d5dd; border-radius: 8px; }
.toolbar select { padding: 9px 12px; border: 1px solid #d0d5dd; border-radius: 8px; }

/* 按钮 */
.btn-primary {
  background: #1e3a8a; color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-size: 14px;
}
.btn-primary:hover { background: #1e40af; }
.btn-primary.sm { padding: 5px 12px; font-size: 13px; }
.btn-ghost { background: none; border: 1px solid #d0d5dd; padding: 8px 14px; border-radius: 8px; color: #555; }
.btn-link { background: none; border: none; color: #1e3a8a; padding: 4px 6px; font-size: 13px; }
.btn-link.danger { color: #dc2626; }
.btn-link:disabled { color: #b9bec7; cursor: not-allowed; }
/* 表头筛选下拉 */
.th-flt { font-weight: 500; font-size: 12px; padding: 3px 4px; border: 1px solid #e3e6ea; border-radius: 6px; background: #f8fafc; color: #333; max-width: 100px; }
.th-flt:focus { outline: none; border-color: #1e3a8a; }
.th-range { display: block; margin-top: 2px; width: 108px; max-width: 108px; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.badge.green { background: #dcfce7; color: #16a34a; }
.badge.red { background: #fee2e2; color: #dc2626; }
.badge.gray { background: #f1f5f9; color: #64748b; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }

/* 弹窗 */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; }
.modal-box.wide { width: 900px; }
.modal-box.sm-box { width: 380px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #f0f1f3; font-size: 16px; font-weight: 600; }
.modal-head .close { border: none; background: none; font-size: 24px; color: #999; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid #f0f1f3; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; }
.field.full { grid-column: 1 / -1; }
.field label { color: #555; margin-bottom: 6px; font-size: 13px; }
.field input, .field select, .field textarea { padding: 9px 12px; border: 1px solid #d0d5dd; border-radius: 8px; }
.hint { color: #aaa; font-size: 12px; font-weight: normal; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.detail-info { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 16px; background: #f8fafc; border-radius: 8px; font-size: 13px; }
.detail-info span b { color: #1e3a8a; }

/* 进度操作 */
.progress-panel { margin-top: 16px; padding: 14px 16px; background: #f8fafc; border-radius: 10px; }
.progress-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.progress-current { font-weight: 600; margin-right: 6px; }
.stage-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.stage-btn { padding: 8px 14px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; }
.stage-btn:hover:not(:disabled) { border-color: #1e3a8a; color: #1e3a8a; }
.stage-btn.active { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
.stage-btn:disabled { opacity: .5; cursor: not-allowed; }
.deliver { background: #16a34a; }
.deliver:hover { background: #15803d; }
.summary { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.sum-chip { background: #eef2ff; color: #3730a3; padding: 5px 12px; border-radius: 20px; font-size: 13px; }

/* 车牌键盘 */
.plate-box { width: 420px; }
.plate-preview { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.plate-cell {
  width: 34px; height: 46px; border-radius: 6px; background: #1e3a8a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600;
}
.plate-cell.active { outline: 2px solid #ef9f27; outline-offset: 2px; }
.plate-cell:empty { color: rgba(255,255,255,.25); }
.plate-group { margin-bottom: 12px; }
.plate-group-label { font-size: 13px; color: #8a919c; margin-bottom: 8px; }
.plate-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.plate-key {
  width: 34px; height: 40px; border: 1px solid #d0d5dd; border-radius: 6px; background: #fff;
  font-size: 16px; cursor: pointer; font-weight: 500;
}
.plate-key:hover:not(:disabled) { border-color: #1e3a8a; color: #1e3a8a; }
.plate-key:disabled { opacity: .3; cursor: not-allowed; }
.plate-actions { display: flex; gap: 10px; margin-top: 16px; }
.plate-fn { flex: 1; padding: 10px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; font-size: 15px; }
.plate-ok { flex: 2; padding: 10px; font-size: 15px; }

/* 响应式 */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-row, .two-col, .dp-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* 延误工单：在修状态且超过预估交车时间 → 整行所有字体标红提醒 */
.delay-row td { background: #fef2f2; color: #dc2626; }
.delay-row td:first-child { font-weight: 600; }
.delay-row .badge { color: #dc2626; background: #fee2e2; }
.delay-row a { color: #dc2626; }
.delay-row:hover td { background: #fee2e2; }

/* 备货等待累计 chip（醒目） */
.sum-chip.warn { background: #fef3c7; color: #b45309; }

/* 备件无货状态按钮（危险态） */
.btn-ghost.danger { border-color: #dc2626; color: #dc2626; background: #fee2e2; }

/* 各班组分析：SA 定损台次 */
.sa-estimate { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e5e7eb; }
.sa-estimate-title { font-size: 13px; color: #8a919c; font-weight: 600; margin-bottom: 8px; }
.sa-estimate-body { display: flex; flex-wrap: wrap; gap: 8px; }
.sa-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 5px 10px; font-size: 13px;
}
.sa-chip b { color: #1e3a8a; font-weight: 600; }
.sa-chip em { font-style: normal; color: #dc2626; font-weight: 600; }
.sa-estimate .empty { color: #999; font-size: 13px; }
