/* TMS v9.9.9 - 调度操作记录页面重新排版 */

:root {
  --tms-primary: #173a79;
  --tms-text: #1f2937;
  --tms-line: #e5e7eb;
  --tms-bg: #f5f7fa;
  --tms-success: #14866d;
  --tms-warning: #d97706;
  --tms-danger: #d92d20;
}

html[data-tms-theme] .tms-dispatch-audit-page-v999 {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--tms-text-primary, var(--tms-text));
}

/* 单一标题下方的信息条 */
html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 4px 6px 4px 11px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  border: 1px solid var(--tms-line) !important;
  border-radius: 8px !important;
  background: var(--tms-info-strip, #f1f3f6) !important;
  color: var(--tms-text-primary, var(--tms-text)) !important;
  box-shadow: none !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero > div:first-child {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero h2 {
  display: none !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero .sub {
  min-width: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  color: var(--tms-text-secondary, #596579) !important;
  opacity: 1 !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero .sub::before {
  content: "ⓘ";
  flex: 0 0 auto;
  margin-right: 7px;
  color: var(--tms-text-muted, #7d8796);
  font-size: 13px;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero button {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  border: 1px solid var(--tms-line) !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--tms-text-secondary, #596579) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero button:hover {
  border-color: color-mix(in srgb, var(--tms-line) 48%, #667085) !important;
  background: var(--tms-bg-panel, #fff) !important;
  color: var(--tms-text-primary, var(--tms-text)) !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero .tms-dispatch-audit-refresh {
  border-color: var(--tms-primary) !important;
  background: var(--tms-primary) !important;
  color: #fff !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero .tms-dispatch-audit-refresh:hover {
  border-color: #102f67 !important;
  background: #102f67 !important;
  color: #fff !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero button:disabled {
  cursor: wait !important;
  opacity: .58 !important;
}

/* 筛选条件收拢为一张紧凑卡片 */
html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter {
  display: block !important;
  margin: 0 !important;
  padding: 14px !important;
  border: 1px solid var(--tms-line) !important;
  border-radius: 12px !important;
  background: var(--tms-bg-panel, #fff) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04) !important;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-grid {
  display: grid;
  grid-template-columns: minmax(130px, .9fr) minmax(150px, .8fr) minmax(170px, 1fr) minmax(300px, 1.55fr);
  gap: 10px 12px;
  align-items: end;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--tms-text-secondary, #596579);
  font-size: 12px;
  font-weight: 600;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-field input,
html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-field select {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 36px !important;
  height: 36px !important;
  margin: 0 !important;
  padding: 0 10px !important;
  border: 1px solid var(--tms-line) !important;
  border-radius: 7px !important;
  background: var(--tms-bg-panel, #fff) !important;
  color: var(--tms-text-primary, var(--tms-text)) !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-field input:focus,
html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-field select:focus {
  outline: 2px solid color-mix(in srgb, var(--tms-primary) 24%, transparent) !important;
  outline-offset: 1px !important;
  border-color: var(--tms-primary) !important;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-range {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(125px, 1fr) auto minmax(125px, 1fr);
  gap: 7px;
  align-items: center;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-range > span {
  text-align: center;
  white-space: nowrap;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-footer {
  min-height: 34px;
  margin-top: 12px;
  padding-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--tms-line);
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-quick-dates,
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-actions {
  justify-content: flex-end;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-chip {
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 10px !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--tms-text-secondary, #596579) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-chip:hover,
html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-chip.active {
  border-color: color-mix(in srgb, var(--tms-primary) 24%, var(--tms-line)) !important;
  background: color-mix(in srgb, var(--tms-primary) 8%, var(--tms-bg-panel, #fff)) !important;
  color: var(--tms-primary) !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-actions .smallbtn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  border: 1px solid var(--tms-line) !important;
  border-radius: 7px !important;
  background: var(--tms-bg-panel, #fff) !important;
  color: var(--tms-text-primary, var(--tms-text)) !important;
  box-shadow: none !important;
}

/* 表格与分页合并为一张完整卡片 */
html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-table-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--tms-line) !important;
  border-radius: 12px !important;
  background: var(--tms-bg-panel, #fff) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04) !important;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table-head {
  min-height: 48px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--tms-line);
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table-head strong {
  color: var(--tms-text-primary, var(--tms-text));
  font-size: 14px;
  font-weight: 700;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-table {
  width: 100% !important;
  margin: 0 !important;
  overflow: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--tms-bg-panel, #fff) !important;
  box-shadow: none !important;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table table {
  width: 100%;
  min-width: 1120px;
  margin: 0;
  border-collapse: collapse;
  background: var(--tms-bg-panel, #fff);
  table-layout: auto;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th,
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table td {
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--tms-line) !important;
  text-align: left;
  vertical-align: middle;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 44px;
  background: var(--tms-table-head, #f7f8fa) !important;
  color: var(--tms-text-secondary, #596579) !important;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table td {
  height: 56px;
  background: var(--tms-bg-panel, #fff) !important;
  color: var(--tms-text-primary, var(--tms-text));
  font-size: 13px;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table tbody tr:hover td {
  background: var(--tms-row-hover, #f6f8fb) !important;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(1) { width: 185px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(2) { width: 82px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(3) { width: 130px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(4) { width: 120px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(5) { width: 125px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(6) { min-width: 220px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(7) { min-width: 145px; }
.tms-dispatch-audit-page-v999 .tms-dispatch-audit-table th:nth-child(8) { width: 145px; }

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-time-cell {
  white-space: nowrap;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-change-cell {
  line-height: 1.55;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-trace {
  max-width: 130px;
  display: inline-block;
  overflow: hidden;
  color: var(--tms-text-muted, #7d8796);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.tms-dispatch-audit-page-v999 .tms-audit-badge {
  min-height: 26px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  border: 0 !important;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.tms-dispatch-audit-page-v999 .tms-audit-type-reassign {
  background: color-mix(in srgb, var(--tms-warning) 12%, var(--tms-bg-panel, #fff));
  color: var(--tms-warning);
}

.tms-dispatch-audit-page-v999 .tms-audit-type-cancel {
  background: color-mix(in srgb, var(--tms-transition, #7a45ba) 12%, var(--tms-bg-panel, #fff));
  color: var(--tms-transition, #7a45ba);
}

.tms-dispatch-audit-page-v999 .tms-audit-type-void,
.tms-dispatch-audit-page-v999 .tms-audit-type-delete {
  background: color-mix(in srgb, var(--tms-danger) 11%, var(--tms-bg-panel, #fff));
  color: var(--tms-danger);
}

.tms-dispatch-audit-page-v999 .tms-audit-type-normal {
  background: color-mix(in srgb, var(--tms-primary) 9%, var(--tms-bg-panel, #fff));
  color: var(--tms-primary);
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-empty {
  padding: 30px 14px;
  color: var(--tms-text-muted, #7d8796);
  text-align: center;
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-pager {
  min-height: 50px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--tms-line);
  color: var(--tms-text-muted, #7d8796);
}

.tms-dispatch-audit-page-v999 .tms-dispatch-audit-page-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-page-controls .smallbtn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  border: 1px solid var(--tms-line) !important;
  border-radius: 6px !important;
  background: var(--tms-bg-panel, #fff) !important;
  color: var(--tms-text-secondary, #596579) !important;
  box-shadow: none !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-page-controls .smallbtn:hover:not(:disabled) {
  border-color: var(--tms-primary) !important;
  color: var(--tms-primary) !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-page-controls .smallbtn:disabled {
  cursor: not-allowed !important;
  opacity: .45 !important;
}

html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-audit-error {
  margin: 10px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--tms-danger) 35%, var(--tms-line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--tms-danger) 7%, var(--tms-bg-panel, #fff));
  color: var(--tms-danger);
}

@media (max-width: 1120px) {
  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  html[data-tms-theme] #c .tms-dispatch-audit-page-v999 .tms-dispatch-audit-hero,
  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-footer,
  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-pager {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-grid {
    grid-template-columns: 1fr;
  }

  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date {
    grid-column: auto;
  }

  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-range {
    grid-template-columns: 1fr;
  }

  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-date-range > span {
    display: none;
  }

  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-filter-actions,
  .tms-dispatch-audit-page-v999 .tms-dispatch-audit-page-controls {
    width: 100%;
    justify-content: space-between;
  }
}
