/* Multi-agent dispatch simulation view, isolated from the shared sand-table styles. */

.app-shell[data-active-view="simulation"] .multi-agent-dispatch-view,
.app-shell[data-active-view="inbound"] .multi-agent-dispatch-view,
.app-shell[data-active-view="twin"] .multi-agent-dispatch-view,
.app-shell[data-active-view="sorting"] .multi-agent-dispatch-view,
.app-shell[data-active-view="packing"] .multi-agent-dispatch-view,
.app-shell[data-active-view="route-opt"] .multi-agent-dispatch-view {
  display: none;
}

.app-shell[data-active-view="multi-agent"] .decision-grid,
.app-shell[data-active-view="multi-agent"] .insight-grid,
.app-shell[data-active-view="multi-agent"] .digital-twin-view,
.app-shell[data-active-view="multi-agent"] .inbound-identity-view,
.app-shell[data-active-view="multi-agent"] .visual-sorting-view,
.app-shell[data-active-view="multi-agent"] .flexible-packaging-view,
.app-shell[data-active-view="multi-agent"] .route-optimization-view {
  display: none;
}

.multi-agent-dispatch-view {
  margin-top: 16px;
}

.agentdispatch-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(102, 87, 240, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 255, 0.95)),
    #ffffff;
  box-shadow: 0 14px 36px rgba(9, 24, 44, 0.1);
}

.agentdispatch-hero h2 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: clamp(1.5rem, 2vw, 2rem);
  letter-spacing: 0;
}

.agentdispatch-hero p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.agentdispatch-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgba(102, 87, 240, 0.28);
  border-radius: var(--radius);
  background: #f3f2ff;
  color: var(--violet);
  font-weight: 950;
  white-space: nowrap;
}

.agentdispatch-status-pill span {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--violet);
  box-shadow: 0 0 0 6px rgba(102, 87, 240, 0.12);
}

.agentdispatch-status-pill.is-blocked {
  border-color: rgba(225, 75, 75, 0.28);
  background: #fff1f0;
  color: #a62626;
}

.agentdispatch-status-pill.is-blocked span {
  background: var(--alert);
  box-shadow: 0 0 0 6px rgba(225, 75, 75, 0.12);
}

.agentdispatch-layout {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.agentdispatch-stage-card,
.agentdispatch-console .panel {
  border: 1px solid rgba(9, 24, 44, 0.1);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.agentdispatch-stage-card {
  min-width: 0;
  padding: 16px;
}

.agentdispatch-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.agentdispatch-stage-head h2,
.agentdispatch-console h2 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.agentdispatch-score {
  display: grid;
  min-width: 136px;
  padding: 10px 12px;
  border: 1px solid rgba(102, 87, 240, 0.25);
  border-radius: var(--radius);
  background: #f3f2ff;
}

.agentdispatch-score span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.agentdispatch-score strong {
  color: var(--violet);
  font-size: 1.8rem;
  line-height: 1;
}

.agentdispatch-scene {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border: 1px solid rgba(102, 87, 240, 0.16);
  border-radius: var(--radius);
  background: #e7f1fb;
}

.agentdispatch-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(6, 31, 57, 0.08), rgba(6, 31, 57, 0) 48%, rgba(255, 255, 255, 0.14)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(5, 46, 54, 0.13));
  pointer-events: none;
}

.agentdispatch-scene-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.agentdispatch-svg {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.agentdispatch-svg marker path {
  fill: currentColor;
}

.agentdispatch-link {
  fill: none;
  opacity: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
  transition: opacity 180ms ease, stroke-width 180ms ease;
}

.agentdispatch-link-a {
  color: #34d399;
  stroke: currentColor;
  marker-end: url("#multiAgentArrow");
}

.agentdispatch-link-b {
  color: #38bdf8;
  stroke: currentColor;
  marker-end: url("#multiAgentArrow");
}

.agentdispatch-link-c {
  color: #fbbf24;
  stroke: currentColor;
  marker-end: url("#multiAgentArrow");
}

.agentdispatch-conflict-line {
  color: var(--alert);
  stroke: currentColor;
  stroke-dasharray: 12 10;
}

.agentdispatch-scene:not(.waiting) .agentdispatch-link {
  opacity: 0.52;
}

.agentdispatch-scene.agentdispatch-assign .agentdispatch-link,
.agentdispatch-scene.agentdispatch-negotiate .agentdispatch-link,
.agentdispatch-scene.agentdispatch-execute .agentdispatch-link,
.agentdispatch-scene.agentdispatch-review .agentdispatch-link {
  opacity: 0.82;
}

.agentdispatch-scene.case-peak .agentdispatch-link-a,
.agentdispatch-scene.case-urgent .agentdispatch-link-b,
.agentdispatch-scene.case-charging .agentdispatch-link-c,
.agentdispatch-scene.case-failure .agentdispatch-link-a {
  opacity: 1;
  stroke-width: 10;
  filter: url("#multiAgentGlow");
}

.agentdispatch-scene.agentdispatch-blocked .agentdispatch-conflict-line {
  opacity: 1;
  stroke-width: 12;
  filter: url("#multiAgentGlow");
}

.agentdispatch-pulse {
  fill: #ffffff;
  opacity: 0;
  stroke: var(--green);
  stroke-width: 4;
  filter: url("#multiAgentGlow");
}

.agentdispatch-scene.agentdispatch-execute .agentdispatch-pulse,
.agentdispatch-scene.agentdispatch-review .agentdispatch-pulse,
.agentdispatch-scene.agentdispatch-blocked .agentdispatch-pulse {
  opacity: 1;
}

.agentdispatch-conflict-zone,
.agentdispatch-card,
.agentdispatch-agent,
.agentdispatch-charger {
  position: absolute;
  z-index: 5;
}

.agentdispatch-conflict-zone {
  left: 38%;
  top: 48%;
  width: 20%;
  height: 16%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(225, 75, 75, 0.48), rgba(244, 165, 28, 0.24) 43%, rgba(244, 165, 28, 0) 72%);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

.agentdispatch-conflict-zone span {
  position: absolute;
  left: 22%;
  top: -8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #9a3412;
  font-size: 0.74rem;
  font-weight: 950;
  white-space: nowrap;
}

.agentdispatch-scene.agentdispatch-negotiate .agentdispatch-conflict-zone,
.agentdispatch-scene.agentdispatch-blocked .agentdispatch-conflict-zone {
  opacity: 1;
  transform: scale(1.1);
}

.agentdispatch-card {
  width: 220px;
  padding: 12px;
  border: 1px solid rgba(102, 87, 240, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(9, 24, 44, 0.12);
}

.agentdispatch-command-card {
  left: 28px;
  top: 26px;
}

.agentdispatch-queue-card {
  right: 28px;
  top: 26px;
  border-color: rgba(39, 189, 117, 0.34);
  background: rgba(240, 251, 245, 0.9);
}

.agentdispatch-reason-card {
  left: 28px;
  bottom: 30px;
  border-color: rgba(244, 165, 28, 0.36);
  background: rgba(255, 249, 235, 0.9);
}

.agentdispatch-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.agentdispatch-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.agentdispatch-agent,
.agentdispatch-charger {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: var(--violet);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 950;
  box-shadow: 0 8px 22px rgba(9, 24, 44, 0.22);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 180ms ease, transform 180ms ease;
}

.agentdispatch-scene:not(.waiting) .agentdispatch-agent,
.agentdispatch-scene:not(.waiting) .agentdispatch-charger {
  opacity: 1;
  transform: scale(1);
}

.agent-a {
  left: 22%;
  bottom: 24%;
  background: #22c55e;
}

.agent-b {
  left: 51%;
  top: 49%;
  background: #f59e0b;
}

.agent-c {
  right: 21%;
  top: 30%;
  background: #38bdf8;
}

.agent-d {
  right: 15%;
  bottom: 22%;
  background: #a855f7;
}

.agentdispatch-charger {
  right: 9%;
  bottom: 32%;
  background: #10b981;
}

.agentdispatch-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.agentdispatch-flow li {
  min-height: 74px;
  padding: 10px;
  border: 1px solid rgba(9, 24, 44, 0.09);
  border-radius: var(--radius);
  background: #f7fbff;
  color: #31516b;
}

.agentdispatch-flow li.is-active {
  border-color: rgba(102, 87, 240, 0.34);
  background: #f3f2ff;
  box-shadow: inset 0 0 0 2px rgba(102, 87, 240, 0.08);
}

.agentdispatch-flow li.is-done {
  border-color: rgba(39, 189, 117, 0.28);
  background: #f0fbf5;
}

.agentdispatch-flow li.is-error {
  border-color: rgba(225, 75, 75, 0.32);
  background: #fff5f3;
}

.agentdispatch-flow span {
  display: block;
  margin-bottom: 6px;
  color: var(--violet);
  font-size: 0.74rem;
  font-weight: 950;
}

.agentdispatch-flow strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.35;
}

.agentdispatch-lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.agentdispatch-lesson-grid article {
  min-height: 104px;
  padding: 12px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #fbfdff;
}

.agentdispatch-lesson-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--violet);
  font-size: 0.78rem;
  font-weight: 950;
}

.agentdispatch-lesson-grid p {
  margin: 0;
  color: var(--dock-slate);
  font-size: 0.9rem;
  line-height: 1.5;
}

.agentdispatch-console {
  display: grid;
  gap: 12px;
}

.agentdispatch-console .panel {
  padding: 14px;
}

.agentdispatch-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.agentdispatch-data-grid article {
  display: grid;
  min-height: 82px;
  align-content: center;
  padding: 10px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #f7fbff;
}

.agentdispatch-data-grid span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.agentdispatch-data-grid strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.02rem;
}

.agentdispatch-roster-head,
.agentdispatch-weight-head,
.agentdispatch-reason-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

#multiAgentModeBadge,
#multiAgentReasonBadge,
#multiAgentPlanBadge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f3f2ff;
  color: var(--violet);
  font-size: 0.74rem;
  font-weight: 950;
  white-space: nowrap;
}

.agentdispatch-weight-panel.is-risk #multiAgentReasonBadge,
.agentdispatch-reason-panel.is-risk #multiAgentPlanBadge {
  background: #fff4e5;
  color: #9a5400;
}

.agentdispatch-weight-panel.is-blocked #multiAgentReasonBadge,
.agentdispatch-reason-panel.is-blocked #multiAgentPlanBadge {
  background: #fff1f0;
  color: #a62626;
}

.agentdispatch-roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.agentdispatch-roster article {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 10px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #fbfdff;
}

.agentdispatch-roster span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.agentdispatch-roster strong {
  color: var(--ink);
  font-size: 0.96rem;
}

.agentdispatch-roster i {
  display: block;
  width: var(--load, 0%);
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--route-cyan), var(--violet));
  transition: width 260ms ease;
}

.agentdispatch-formula {
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: #f4f8fd;
  color: #31516b;
  font-size: 0.84rem;
  font-weight: 900;
}

.agentdispatch-weight-list {
  display: grid;
  gap: 9px;
}

.agentdispatch-weight-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 88px 42px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #fbfdff;
}

.agentdispatch-weight-row strong,
.agentdispatch-weight-row span,
.agentdispatch-weight-row em {
  display: block;
}

.agentdispatch-weight-row strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.agentdispatch-weight-row span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
}

.agentdispatch-weight-row em {
  color: var(--violet);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 950;
  text-align: right;
}

.agentdispatch-weight-meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe8f4;
}

.agentdispatch-weight-meter i {
  display: block;
  width: var(--weight, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--route-cyan), var(--violet));
  transition: width 260ms ease;
}

.agentdispatch-check-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.agentdispatch-check-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--dock-slate);
  font-size: 0.88rem;
  font-weight: 800;
}

.agentdispatch-check-list span {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #b8c5d2;
}

.agentdispatch-check-list li.is-pass span {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(39, 189, 117, 0.1);
}

.agentdispatch-check-list li.is-fail span {
  background: var(--alert);
  box-shadow: 0 0 0 5px rgba(225, 75, 75, 0.1);
}

#multiAgentReasonText {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  background: #fff9eb;
  color: #684608;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.45;
}

.agentdispatch-reason-panel.is-blocked #multiAgentReasonText {
  border-left-color: var(--alert);
  background: #fff5f3;
  color: #8b1e1e;
}

@media (max-width: 1180px) {
  .agentdispatch-layout {
    grid-template-columns: 1fr;
  }

  .agentdispatch-console {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agentdispatch-roster-panel,
  .agentdispatch-weight-panel,
  .agentdispatch-reason-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .agentdispatch-hero,
  .agentdispatch-stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .agentdispatch-scene {
    min-height: 620px;
  }

  .agentdispatch-flow,
  .agentdispatch-lesson-grid,
  .agentdispatch-console,
  .agentdispatch-roster {
    grid-template-columns: 1fr;
  }

  .agentdispatch-card {
    width: 190px;
  }

  .agentdispatch-reason-card {
    bottom: 24px;
  }
}

@media (max-width: 520px) {
  .agentdispatch-data-grid,
  .agentdispatch-weight-row {
    grid-template-columns: 1fr;
  }

  .agentdispatch-weight-row em {
    text-align: left;
  }
}
