.workflow-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  flex-wrap: wrap;
  color: #bceeff;
}
.workflow-bar + .sensor-table-wrapper {
  min-height: 0;
  overflow: auto;
}
.workflow-bar {
  flex-shrink: 0;
}
.live-alarm-button {
  color: #bceeff;
  background: transparent;
  border: 1px solid #29789a;
  padding: 3px 8px;
  cursor: pointer;
}
.workflow-bar button,
.review-actions button,
.workflow-content button {
  background: #123652;
  color: #bceeff;
  border: 1px solid #29789a;
  border-radius: 4px;
  padding: 5px 9px;
  cursor: pointer;
}
.workflow-bar .selected {
  border-color: #ffc15c;
  color: #ffc15c;
}
#workflow-error,
.review-error {
  color: #ff9a9a;
  font-size: 12px;
}
.review-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.alarm-review-table {
  table-layout: fixed;
}
.alarm-review-table thead {
  display: table-header-group;
}
.alarm-review-table tbody {
  display: table-row-group;
  max-height: none;
}
.alarm-review-table tbody tr {
  display: table-row;
}
.alarm-review-table th {
  position: sticky;
  top: 0;
  background: #075078;
  z-index: 1;
}
.alarm-review-table td,
.alarm-review-table td.review-actions {
  display: table-cell;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
  line-height: 1.6;
}
.alarm-review-table th:nth-child(1),
.alarm-review-table td:nth-child(1) {
  width: 16%;
}
.alarm-review-table th:nth-child(2),
.alarm-review-table td:nth-child(2) {
  width: 22%;
}
.alarm-review-table th:nth-child(3),
.alarm-review-table td:nth-child(3) {
  width: 10%;
}
.alarm-review-table th:nth-child(4),
.alarm-review-table td:nth-child(4) {
  width: 20%;
}
.alarm-review-table th:nth-child(5),
.alarm-review-table td:nth-child(5) {
  width: 16%;
}
.alarm-review-table th:nth-child(6),
.alarm-review-table td:nth-child(6) {
  width: 16%;
}
.alarm-review-table td.review-actions button {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  margin: 3px;
  padding: 4px 7px;
  vertical-align: middle;
}
.alarm-review-table .sensor-loading::after {
  display: none;
}
.review-actions a {
  color: #6ce5ff;
}
.workflow-content {
  padding: 16px;
  color: #dff7ff;
  max-height: 65vh;
  overflow: auto;
  line-height: 1.8;
}
.workflow-content label {
  display: block;
  margin: 12px 0;
}
.workflow-content input,
.workflow-content textarea,
.workflow-content select {
  background: #102c43;
  color: #e8f7ff;
  border: 1px solid #317799;
  padding: 6px;
  max-width: 100%;
}
.workflow-content textarea {
  display: block;
  width: 100%;
  min-height: 75px;
}
.rule-row {
  border-bottom: 1px solid #317799;
  padding: 10px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.rule-row input[type="number"] {
  width: 90px;
}
.rule-row input[name="event_type"] {
  width: 130px;
}
.sensor-table small {
  font-size: 11px;
  color: #9cb2c5;
}

/* Match the bureau dashboard panels while keeping all rules local to this dialog. */
.dispatch-dialog,
.dispatch-dialog * {
  box-sizing: border-box;
}
.dispatch-dialog {
  width: min(1440px, 94vw);
  max-height: 90vh;
  background: linear-gradient(145deg, #073451, #061f35);
  border: 1px solid #2788b1;
}
.dispatch-dialog .attention-dialog-head {
  background: linear-gradient(90deg, rgba(0, 160, 220, 0.2), transparent);
  border-bottom: 2px solid #098aba;
}
.dispatch-dialog .attention-dialog-head h3 {
  color: #bfefff;
  letter-spacing: 2px;
}
.dispatch-dialog .dispatch-content {
  height: calc(90vh - 72px);
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 16px 20px;
}
.dispatch-state {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.dispatch-source,
.dispatch-state-badge {
  padding: 3px 10px;
  border: 1px solid #2a94b6;
  border-radius: 4px;
  background: rgba(0, 150, 220, 0.12);
  font-size: 12px;
  color: #82dfff;
}
.dispatch-state-badge {
  border-color: #bb9146;
  color: #ffd17c;
  background: rgba(180, 120, 20, 0.12);
}
.dispatch-ended {
  margin-left: auto;
  color: #71d7b1;
  font-size: 12px;
}
.dispatch-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid rgba(45, 148, 188, 0.35);
  background: rgba(45, 148, 188, 0.25);
  flex-shrink: 0;
}
.dispatch-summary > div {
  background: #0b324c;
  padding: 9px 13px;
  min-width: 0;
}
.dispatch-summary small {
  display: block;
  color: #7fa9bd;
  font-size: 12px;
  margin-bottom: 4px;
}
.dispatch-summary strong {
  display: block;
  color: #e0f6ff;
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.dispatch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.dispatch-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(45, 148, 188, 0.4);
  background: rgba(0, 14, 30, 0.28);
}
.dispatch-section-title {
  padding: 9px 13px;
  border-bottom: 1px solid rgba(45, 148, 188, 0.3);
  background: linear-gradient(90deg, rgba(0, 160, 220, 0.16), transparent);
  color: #80deff;
  font-size: 14px;
  font-weight: 600;
}
.dispatch-tabs {
  display: flex;
  gap: 7px;
  padding: 10px 12px;
  flex-shrink: 0;
}
.dispatch-tabs button {
  color: #89b5c9;
}
.dispatch-tabs .selected {
  border-color: #00c9f5;
  color: #9decff;
  background: rgba(0, 164, 218, 0.22);
  box-shadow: inset 0 -2px #00bfe9;
}
.dispatch-view {
  position: relative;
  flex: 1;
  min-height: 180px;
  overflow: auto;
  padding: 8px;
}
.dispatch-frame {
  display: block;
  width: 100%;
  height: calc(100% - 24px);
  min-height: 180px;
  border: 0;
  background: #0a233c;
}
.dispatch-open {
  display: block;
  text-align: right;
  color: #72d9fb;
  font-size: 12px;
  height: 24px;
}
.dispatch-tools {
  overflow: auto;
  border: 1px solid rgba(45, 148, 188, 0.4);
  background: rgba(0, 14, 30, 0.22);
}
.dispatch-tool-card,
.dispatch-preview {
  margin: 12px;
  padding: 12px;
  border: 1px solid rgba(45, 148, 188, 0.25);
  background: linear-gradient(
    120deg,
    rgba(22, 95, 130, 0.18),
    rgba(10, 39, 61, 0.7)
  );
}
.dispatch-tool-card h4,
.dispatch-preview h4 {
  margin: 0 0 8px;
  color: #b2edff;
  font-size: 14px;
}
.dispatch-tool-card p,
.dispatch-preview p {
  color: #82a9bf;
  font-size: 12px;
  margin: 8px 0 12px;
}
.dispatch-pending {
  display: inline-block;
  color: #c9a665;
  font-size: 11px;
  margin: 0 0 0 8px;
}
.dispatch-empty {
  font-size: 12px;
  color: #658ca5;
  padding: 8px 0;
  line-height: 1.8;
}
.dispatch-preview label {
  font-size: 12px;
}
.dispatch-preview button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.dispatch-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(45, 148, 188, 0.35);
  padding-top: 12px;
  flex-shrink: 0;
}
.dispatch-footer span {
  font-size: 12px;
  color: #8aafc2;
}
.dispatch-footer button {
  margin-left: 8px;
  min-width: 84px;
}
.dispatch-footer .dispatch-primary {
  background: linear-gradient(#137da4, #0c5175);
  border-color: #4bc6e9;
  color: #e6faff;
}
.dispatch-footer .review-error {
  margin: 0;
}
.dispatch-detail-card {
  padding: 12px 16px;
}
.dispatch-detail-card h3 {
  color: #ffd28a;
  margin: 0 0 8px;
}
.dispatch-detail-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dispatch-detail-card dl div {
  border-bottom: 1px solid #1c516d;
  padding: 8px 0;
}
.dispatch-detail-card dt {
  color: #7fa9bd;
  font-size: 12px;
}
.dispatch-detail-card dd {
  margin: 5px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.dispatch-demo-note {
  color: #bfaa76;
  font-size: 12px;
  padding: 0 8px;
}
.dispatch-completion { flex-shrink:0; border:1px solid #2b718b; padding:8px 12px; font-size:12px; color:#9bc7d9; overflow:auto; max-height:100px; }
.dispatch-completion span { margin-right:18px; }
.dispatch-completion p { margin:6px 0 0; overflow-wrap:anywhere; }
.dispatch-demo-chart {
  width: 100%;
  height: calc(100% - 28px);
  min-height: 180px;
}
@media (max-width: 1000px) {
  .dispatch-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
  .dispatch-dialog .dispatch-content {
    padding: 12px;
    gap: 10px;
  }
  .dispatch-summary > div {
    padding: 7px 9px;
  }
}
