/* Dispatch audit: readable cards at every viewport width. */
.strategy-queue-panel {
  overflow: visible;
}

.strategy-queue-panel .table-scroll {
  overflow: visible;
}

.dispatch-audit-table {
  display: block;
  width: 100%;
  min-width: 0 !important;
  border: 0;
}

.dispatch-audit-table thead {
  display: none !important;
}

.dispatch-audit-table tbody {
  display: grid !important;
  width: 100%;
  padding: 16px;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--panel-soft);
}

.dispatch-audit-table tbody tr {
  display: grid !important;
  width: 100%;
  min-width: 0;
  grid-template-columns: 74px minmax(140px, 1.2fr) minmax(140px, 1.2fr) minmax(130px, .9fr);
  grid-template-areas:
    "seq strategy strategy created"
    "request request request request"
    "mode state paper attempts"
    "core ecrouter ecrouter ecrouter";
  gap: 1px;
  padding: 1px;
  overflow: hidden;
  background: var(--border-strong);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--bg) 22%, transparent);
}

.dispatch-audit-table tbody td {
  display: grid !important;
  width: auto !important;
  min-width: 0;
  min-height: 62px;
  height: auto !important;
  padding: 10px 12px !important;
  align-content: center;
  justify-content: stretch !important;
  gap: 6px;
  overflow: hidden;
  color: var(--text);
  background: var(--panel);
  border: 0 !important;
  text-align: left !important;
  white-space: normal !important;
}

.dispatch-audit-table tbody td::before {
  color: var(--faint);
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .13em;
}

.dispatch-audit-table td:nth-child(1) { grid-area: seq; }
.dispatch-audit-table td:nth-child(2) { grid-area: strategy; }
.dispatch-audit-table td:nth-child(3) { grid-area: request; }
.dispatch-audit-table td:nth-child(4) { grid-area: mode; }
.dispatch-audit-table td:nth-child(5) { grid-area: state; }
.dispatch-audit-table td:nth-child(6) { grid-area: paper; }
.dispatch-audit-table td:nth-child(7) { grid-area: attempts; }
.dispatch-audit-table td:nth-child(8) { grid-area: core; }
.dispatch-audit-table td:nth-child(9) { grid-area: ecrouter; }
.dispatch-audit-table td:nth-child(10) { grid-area: created; }

.dispatch-audit-table td:nth-child(1)::before { content: "SEQUENCE"; }
.dispatch-audit-table td:nth-child(2)::before { content: "STRATEGY"; }
.dispatch-audit-table td:nth-child(3)::before { content: "REQUEST ID"; }
.dispatch-audit-table td:nth-child(4)::before { content: "EXECUTION MODE"; }
.dispatch-audit-table td:nth-child(5)::before { content: "DISPATCH STATE"; }
.dispatch-audit-table td:nth-child(6)::before { content: "PAPER RESULT"; }
.dispatch-audit-table td:nth-child(7)::before { content: "ATTEMPTS"; }
.dispatch-audit-table td:nth-child(8)::before { content: "CORE RESPONSE"; }
.dispatch-audit-table td:nth-child(9)::before { content: "ECROUTER"; }
.dispatch-audit-table td:nth-child(10)::before { content: "RECEIVED AT"; }

.dispatch-audit-table td:nth-child(1),
.dispatch-audit-table td:nth-child(2),
.dispatch-audit-table td:nth-child(10) {
  background: var(--panel-hover);
}

.dispatch-audit-table td:nth-child(1) b {
  color: var(--accent);
  font-size: 16px;
}

.dispatch-audit-table td:nth-child(2),
.dispatch-audit-table td:nth-child(10) {
  font-family: var(--font-data);
  font-size: 13px;
}

.dispatch-audit-table td:nth-child(7) {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 800;
}

.dispatch-audit-table .request-id {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  white-space: normal;
  color: var(--text-strong);
  background: var(--panel-soft);
  border-left: 2px solid var(--accent);
  font-size: 13px;
  line-height: 1.45;
  text-overflow: clip;
}

.dispatch-audit-table .status-badge {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-audit-table td[colspan] {
  grid-area: 1 / 1 / -1 / -1;
  min-height: 118px;
}

.dispatch-audit-table td[colspan]::before {
  content: none;
}

@media (max-width: 1500px) {
  .dispatch-audit-table tbody {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dispatch-audit-table tbody {
    padding: 10px;
    gap: 10px;
  }

  .dispatch-audit-table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "seq created"
      "strategy strategy"
      "request request"
      "mode state"
      "paper attempts"
      "core ecrouter";
  }

  .dispatch-audit-table tbody td {
    min-height: 58px;
    padding: 9px 10px !important;
  }
}
