/* Inbound identity simulation view, scoped from the existing sandbox views. */

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

.app-shell[data-active-view="inbound"] .decision-grid,
.app-shell[data-active-view="inbound"] .insight-grid,
.app-shell[data-active-view="inbound"] .digital-twin-view {
  display: none;
}

.inbound-identity-view {
  margin-top: 16px;
}

.inbound-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.15);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.9)),
    #ffffff;
  box-shadow: 0 14px 36px rgba(9, 24, 44, 0.1);
}

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

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

.inbound-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgba(39, 189, 117, 0.28);
  border-radius: var(--radius);
  background: #effcf5;
  color: #0b6b44;
  font-weight: 950;
  white-space: nowrap;
}

.inbound-status-pill span {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(39, 189, 117, 0.12);
}

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

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

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

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

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

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

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

.identity-score {
  display: grid;
  min-width: 126px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 194, 204, 0.22);
  border-radius: var(--radius);
  background: #f6fcff;
}

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

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

.identity-scene {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border: 1px solid rgba(11, 92, 173, 0.14);
  border-radius: var(--radius);
  background: #dfeef8;
}

.identity-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(7, 24, 39, 0.08), rgba(7, 24, 39, 0) 34%, rgba(255, 255, 255, 0.12)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(6, 31, 57, 0.1));
  pointer-events: none;
}

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

.dock-wall,
.gate-arm,
.truck-body,
.package-stack {
  display: none;
}

.dock-wall {
  position: absolute;
  top: 42px;
  left: 38px;
  width: 46%;
  height: 178px;
  padding: 28px;
  border: 1px solid rgba(9, 24, 44, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(11, 92, 173, 0.09) 1px, transparent 1px),
    linear-gradient(#ffffff, #d9e6f2);
  background-size: 20px 100%, auto;
  box-shadow: inset 0 -12px 0 rgba(11, 92, 173, 0.18);
}

.dock-wall::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -118px;
  width: 218px;
  height: 118px;
  border: 8px solid #1c5b97;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(9, 24, 44, 0.16), rgba(9, 24, 44, 0.02));
}

.dock-number {
  position: absolute;
  left: 22px;
  bottom: 22px;
  color: rgba(11, 92, 173, 0.7);
  font-size: 3rem;
  font-weight: 950;
}

.dock-wall strong {
  display: inline-block;
  margin-left: 72px;
  padding: 10px 22px;
  border-radius: 6px;
  background: #0b5cad;
  color: #ffffff;
  font-size: 1.36rem;
}

.dock-wall small {
  display: block;
  margin-top: 18px;
  margin-left: 78px;
  color: #31516b;
  font-size: 0.92rem;
  font-weight: 850;
}

.gate-arm {
  position: absolute;
  left: 210px;
  top: 335px;
  z-index: 5;
  width: 342px;
  height: 13px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, #ffffff 0 34px, #e14b4b 34px 62px),
    #ffffff;
  box-shadow: 0 8px 18px rgba(9, 24, 44, 0.16);
  transform-origin: left center;
  transition: transform 360ms ease;
}

.identity-scene.release .gate-arm {
  transform: rotate(-18deg);
}

.identity-scene.blocked .gate-arm {
  background:
    repeating-linear-gradient(90deg, #fff3d5 0 34px, #e14b4b 34px 62px),
    #fff3d5;
}

.truck-body {
  position: absolute;
  left: 98px;
  top: 270px;
  z-index: 4;
  width: 360px;
  height: 136px;
  transition: transform 420ms ease;
}

.identity-scene.release .truck-body {
  transform: translateX(118px);
}

.truck-box {
  position: absolute;
  left: 72px;
  top: 6px;
  width: 238px;
  height: 104px;
  border: 2px solid #c5d4e3;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(9, 24, 44, 0.05) 1px, transparent 1px),
    linear-gradient(#f8fbfd, #dce8f2);
  background-size: 24px 100%, auto;
  box-shadow: 0 16px 26px rgba(9, 24, 44, 0.16);
}

.truck-cab {
  position: absolute;
  right: 0;
  top: 42px;
  width: 92px;
  height: 70px;
  border-radius: 14px 16px 10px 8px;
  background: linear-gradient(135deg, #ffffff, #c9d9e7);
  box-shadow: 0 16px 26px rgba(9, 24, 44, 0.15);
}

.truck-cab::before,
.truck-box::before {
  content: "";
  position: absolute;
  bottom: -20px;
  width: 34px;
  height: 34px;
  border: 7px solid #263447;
  border-radius: 999px;
  background: #ffffff;
}

.truck-cab::before {
  right: 12px;
}

.truck-box::before {
  left: 24px;
}

.truck-body em {
  position: absolute;
  right: 14px;
  top: 98px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #0b5cad;
  color: #ffffff;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
}

.scanner-tower,
.rfid-reader {
  position: absolute;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 86px;
  min-height: 86px;
  padding: 8px;
  border: 1px solid rgba(20, 194, 204, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: #0b5cad;
  font-size: 0.76rem;
  font-weight: 950;
  text-align: center;
  box-shadow: 0 12px 28px rgba(9, 24, 44, 0.13);
}

.scanner-tower {
  left: 48%;
  top: 24%;
}

.rfid-reader {
  left: 55%;
  top: 42%;
}

.scanner-tower i,
.rfid-reader i {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #14c2cc;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.55);
}

.rfid-reader i {
  border-radius: 999px;
  background: var(--official-blue);
}

.scan-beam {
  position: absolute;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.beam-camera {
  left: 41%;
  top: 35%;
  width: 31%;
  height: 20%;
  background: linear-gradient(105deg, rgba(20, 194, 204, 0.4), rgba(20, 194, 204, 0));
  clip-path: polygon(0 30%, 100% 0, 100% 100%, 0 70%);
}

.beam-rfid {
  left: 52%;
  top: 52%;
  width: 24%;
  height: 20%;
  border: 2px solid rgba(11, 92, 173, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(11, 92, 173, 0.08), 0 0 0 38px rgba(20, 194, 204, 0.08);
}

.identity-scene.ocr .beam-camera,
.identity-scene.order .beam-camera,
.identity-scene.scan .beam-camera,
.identity-scene.scan .beam-rfid,
.identity-scene.compare .beam-camera,
.identity-scene.compare .beam-rfid,
.identity-scene.release .beam-rfid,
.identity-scene.blocked .beam-camera,
.identity-scene.blocked .beam-rfid {
  opacity: 1;
  animation: scanPulse 1.4s ease-in-out infinite;
}

.package-stack {
  position: absolute;
  right: 56px;
  bottom: 78px;
  display: grid;
  grid-template-columns: repeat(3, 70px);
  gap: 10px;
}

.package-stack span {
  position: relative;
  height: 66px;
  border: 1px solid rgba(107, 79, 37, 0.22);
  border-radius: 6px;
  background: linear-gradient(135deg, #d8ae72, #f0cf98);
  box-shadow: 0 12px 22px rgba(9, 24, 44, 0.14);
}

.package-stack span::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background:
    linear-gradient(90deg, #263447 45%, transparent 45% 55%, #263447 55%),
    linear-gradient(#263447 45%, transparent 45% 55%, #263447 55%),
    #ffffff;
  background-size: 8px 8px;
}

.identity-terminal,
.digital-shadow {
  position: absolute;
  z-index: 7;
  width: 220px;
  padding: 12px;
  border: 1px solid rgba(11, 92, 173, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(9, 24, 44, 0.12);
}

.identity-terminal {
  left: 28px;
  bottom: 28px;
}

.digital-shadow {
  right: 30px;
  top: 30px;
  border-color: rgba(20, 194, 204, 0.34);
  background: rgba(236, 252, 255, 0.88);
}

.identity-terminal p,
.digital-shadow p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.identity-terminal strong,
.digital-shadow strong {
  color: var(--ink);
  font-size: 1rem;
}

.identity-scene.blocked .identity-terminal {
  border-color: rgba(225, 75, 75, 0.35);
  background: #fff5f3;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#identityRiskBadge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #effcf5;
  color: #0b6b44;
  font-size: 0.74rem;
  font-weight: 950;
  white-space: nowrap;
}

.identity-reason-panel.is-risk #identityRiskBadge {
  background: #fff4e5;
  color: #9a5400;
}

.identity-reason-panel.is-blocked #identityRiskBadge {
  background: #fff1f0;
  color: #a62626;
}

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

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

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

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

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

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

.identity-scene .dock-wall,
.identity-scene .gate-arm,
.identity-scene .truck-body,
.identity-scene .package-stack {
  display: none;
}

@keyframes scanPulse {
  0%,
  100% {
    filter: saturate(1);
    transform: scale(0.98);
  }
  50% {
    filter: saturate(1.2);
    transform: scale(1.02);
  }
}

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

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

}

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

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

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

  .dock-wall {
    width: calc(100% - 40px);
    left: 20px;
  }

  .scanner-tower {
    left: 30px;
    top: 230px;
  }

  .rfid-reader {
    left: 128px;
    top: 230px;
  }

  .truck-body {
    left: 32px;
    top: 344px;
    transform: scale(0.86);
    transform-origin: left top;
  }

  .identity-scene.release .truck-body {
    transform: translateX(44px) scale(0.86);
  }

  .gate-arm {
    left: 72px;
    top: 420px;
    width: 260px;
  }

  .digital-shadow {
    top: 316px;
    right: 18px;
  }

  .package-stack {
    right: 20px;
    bottom: 34px;
    grid-template-columns: repeat(3, 56px);
  }
}

@media (max-width: 520px) {
  .view-switcher {
    grid-template-columns: 1fr;
  }

  .identity-data-grid {
    grid-template-columns: 1fr;
  }

  .identity-terminal,
  .digital-shadow {
    width: 190px;
  }
}
