/* Route optimization simulation view, isolated from global map node classes. */

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

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

.route-optimization-view {
  margin-top: 16px;
}

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

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

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

.routeopt-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgba(11, 92, 173, 0.28);
  border-radius: var(--radius);
  background: #eff8ff;
  color: var(--official-blue);
  font-weight: 950;
  white-space: nowrap;
}

.routeopt-status-pill span {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--route-cyan);
  box-shadow: 0 0 0 6px rgba(20, 194, 204, 0.13);
}

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

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

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

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

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

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

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

.routeopt-score {
  display: grid;
  min-width: 136px;
  padding: 10px 12px;
  border: 1px solid rgba(11, 92, 173, 0.25);
  border-radius: var(--radius);
  background: #eff8ff;
}

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

.routeopt-score strong {
  color: var(--official-blue);
  font-size: 1.8rem;
  line-height: 1;
}

.routeopt-scene {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: var(--radius);
  background: #dfeef6;
}

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

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

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

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

.routeopt-path {
  fill: none;
  opacity: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
  transition:
    opacity 180ms ease,
    stroke-width 180ms ease;
}

.routeopt-path-fast {
  color: #ffd166;
  stroke: currentColor;
  marker-end: url("#routeOptArrow");
}

.routeopt-path-safe {
  color: #45e07f;
  stroke: currentColor;
  marker-end: url("#routeOptArrow");
}

.routeopt-path-energy {
  color: #33c7ff;
  stroke: currentColor;
  marker-end: url("#routeOptArrow");
}

.routeopt-path-blocked {
  color: var(--alert);
  stroke: currentColor;
  stroke-dasharray: 12 10;
}

.routeopt-scene:not(.waiting) .routeopt-path {
  opacity: 0.45;
}

.routeopt-scene.routeopt-weight .routeopt-path,
.routeopt-scene.routeopt-compare .routeopt-path,
.routeopt-scene.routeopt-dispatch .routeopt-path,
.routeopt-scene.routeopt-record .routeopt-path {
  opacity: 0.72;
}

.routeopt-scene.routeopt-blocked .routeopt-path {
  opacity: 0.36;
}

.routeopt-scene:not(.waiting).case-normal .routeopt-path-safe,
.routeopt-scene:not(.waiting).case-traffic .routeopt-path-safe,
.routeopt-scene:not(.waiting).case-urgent .routeopt-path-fast,
.routeopt-scene:not(.waiting).case-battery .routeopt-path-energy {
  opacity: 1;
  stroke-width: 9;
  filter: url("#routeOptGlow");
}

.routeopt-scene.routeopt-blocked .routeopt-path-blocked {
  opacity: 1;
  stroke-width: 11;
  filter: url("#routeOptGlow");
}

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

.routeopt-scene.routeopt-dispatch .routeopt-pulse,
.routeopt-scene.routeopt-record .routeopt-pulse,
.routeopt-scene.routeopt-blocked .routeopt-pulse {
  opacity: 1;
}

.routeopt-heat-zone,
.routeopt-map-card,
.routeopt-candidate-card,
.routeopt-weight-card,
.routeopt-node {
  position: absolute;
  z-index: 5;
}

.routeopt-heat-zone {
  left: 8%;
  bottom: 15%;
  width: 24%;
  height: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 48% 50%, rgba(225, 75, 75, 0.54), rgba(244, 165, 28, 0.34) 43%, rgba(244, 165, 28, 0) 70%);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.routeopt-heat-zone span {
  position: absolute;
  left: 20%;
  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;
}

.routeopt-scene.routeopt-weight .routeopt-heat-zone,
.routeopt-scene.routeopt-compare .routeopt-heat-zone,
.routeopt-scene.routeopt-dispatch .routeopt-heat-zone,
.routeopt-scene.routeopt-record .routeopt-heat-zone,
.routeopt-scene.routeopt-blocked .routeopt-heat-zone,
.routeopt-scene.case-traffic .routeopt-heat-zone {
  opacity: 1;
}

.routeopt-scene.case-traffic .routeopt-heat-zone,
.routeopt-scene.routeopt-blocked .routeopt-heat-zone {
  transform: scale(1.18);
}

.routeopt-map-card,
.routeopt-candidate-card,
.routeopt-weight-card {
  width: 220px;
  padding: 12px;
  border: 1px solid rgba(14, 116, 144, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(9, 24, 44, 0.12);
}

.routeopt-map-card {
  left: 28px;
  top: 26px;
}

.routeopt-candidate-card {
  right: 28px;
  top: 26px;
  border-color: rgba(244, 165, 28, 0.34);
  background: rgba(255, 249, 235, 0.9);
}

.routeopt-weight-card {
  left: 28px;
  bottom: 30px;
  border-color: rgba(39, 189, 117, 0.34);
  background: rgba(240, 251, 245, 0.9);
}

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

.routeopt-map-card strong,
.routeopt-candidate-card strong,
.routeopt-weight-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.routeopt-node {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--official-blue);
  color: #ffffff;
  font-size: 0.82rem;
  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;
}

.routeopt-scene:not(.waiting) .routeopt-node {
  opacity: 1;
  transform: scale(1);
}

.routeopt-node-start {
  left: 9%;
  bottom: 24%;
  background: var(--dock-slate);
}

.routeopt-node-a {
  left: 38%;
  bottom: 36%;
  background: var(--route-cyan);
}

.routeopt-node-b {
  right: 34%;
  top: 42%;
  background: var(--amber);
}

.routeopt-node-c {
  right: 22%;
  top: 30%;
  background: var(--green);
}

.routeopt-node-end {
  right: 10%;
  top: 19%;
  background: var(--violet);
}

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

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

.routeopt-flow li.is-active {
  border-color: rgba(11, 92, 173, 0.34);
  background: #eef8ff;
  box-shadow: inset 0 0 0 2px rgba(11, 92, 173, 0.08);
}

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

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

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

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

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

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

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

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

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

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

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

.routeopt-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;
}

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

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

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

#routeOptModeBadge,
#routeOptReasonBadge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eff8ff;
  color: var(--official-blue);
  font-size: 0.74rem;
  font-weight: 950;
  white-space: nowrap;
}

.routeopt-reason-panel.is-risk #routeOptReasonBadge,
.routeopt-weight-panel.is-risk #routeOptModeBadge {
  background: #fff4e5;
  color: #9a5400;
}

.routeopt-reason-panel.is-blocked #routeOptReasonBadge,
.routeopt-weight-panel.is-blocked #routeOptModeBadge {
  background: #fff1f0;
  color: #a62626;
}

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

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

.routeopt-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;
}

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

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

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

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

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

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

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

.routeopt-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;
}

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

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

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

#routeOptReasonText {
  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;
}

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

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

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

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

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

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

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

  .routeopt-map-card,
  .routeopt-candidate-card,
  .routeopt-weight-card {
    width: 190px;
  }

  .routeopt-weight-card {
    bottom: 24px;
  }
}

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

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