* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: #d8ecff;
  background:
    radial-gradient(circle at 50% -18%, rgba(0, 168, 255, .22), transparent 34%),
    linear-gradient(180deg, #071a2c 0%, #061422 42%, #04101c 100%);
}

.screen {
  min-height: 100vh;
  padding: 8px;
}

h1, h2, p { margin: 0; }

.view { display: none; }
.view.is-active { display: block; }

body.embedFlowMap {
  color: #111827;
  background: #eef2f6;
}

body.embedFlowMap .screen { padding: 0; }
body.embedFlowMap .screenHeader { display: none; }
body.embedFlowMap .flowMapLayout { height: 100vh; background: #f8fafc; }
body.embedFlowMap .flowMapSurface {
  height: calc(100vh - 24px);
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fff;
}
body.embedMap .flowDebugPanel { display: none; }
body.embedMap .flowMapLayout { place-items: center; }
body.embedMap .flowMapSurface {
  width: calc((100vh - 24px) * .8061);
  max-width: 100%;
}

body.embedConsole .flowDebugPanel {
  border-color: #bfd5f2;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
}

body.embedConsole .flowDebugPanel h2 { color: #111827; }
body.embedConsole .flowDebugPanel label { color: #475569; }
body.embedConsole .flowDebugPanel select {
  border-color: #cbd5e1;
  color: #111827;
  background: #fff;
}
body.embedConsole .debugDivider { background: #d8e0ea; }
body.embedConsole .flowDebugPanel button {
  border-color: #1f6fd1;
  color: #fff;
  background: #1f6fd1;
}

.screenHeader {
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr 260px;
  align-items: center;
  min-height: 52px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid #15446b;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(10, 42, 68, .96), rgba(6, 26, 44, .96));
  box-shadow: inset 0 -1px 0 rgba(44, 212, 255, .12), 0 10px 32px rgba(0, 0, 0, .28);
}

.screenHeader h1 {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0;
  color: #f2f8ff;
  text-shadow: 0 0 16px rgba(0, 178, 255, .42);
}

.screenTabs a,
.headerTools a,
.headerTools button {
  width: max-content;
  color: #9fd8ff;
  text-decoration: none;
  border: 1px solid #1c5f91;
  border-radius: 4px;
  background: #09233a;
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
}

.screenTabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.screenTabs a {
  min-width: 84px;
  text-align: center;
}

.screenTabs a.is-active {
  border-color: #00d7ff;
  color: #001727;
  background: linear-gradient(180deg, #26e8ff, #0894ff);
  box-shadow: 0 0 18px rgba(0, 215, 255, .36);
}

.headerTools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  color: #5b6776;
  color: #8db9dc;
  font-size: 12px;
}

.panel {
  border: 1px solid #1d4f79;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(10, 38, 63, .96), rgba(7, 27, 47, .96));
  box-shadow: inset 0 0 0 1px rgba(55, 207, 255, .04), 0 12px 28px rgba(0, 0, 0, .18);
}

.panel h2,
.panelTitle h2 {
  font-size: 16px;
  color: #f3f9ff;
}

.panel h2::before,
.panelTitle h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  margin-right: 8px;
  border-radius: 999px;
  vertical-align: -3px;
  background: #04e2de;
  box-shadow: 0 0 10px rgba(4, 226, 222, .75);
}

.panelTitle {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panelTitle.centered {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.panelTitle span {
  color: #8eb7d7;
  font-size: 12px;
}

.productionLayout {
  display: grid;
  grid-template-columns: 16% 1fr 25%;
  gap: 8px;
  min-height: calc(100vh - 132px);
}

.orderInfo,
.flowBoard,
.deviceRail,
.agvPanel,
.siteMapPanel,
.warningTablePanel,
.suggestionsPanel,
.traceMain,
.traceTimelinePanel {
  padding: 14px;
}

.infoList {
  display: grid;
  margin-top: 12px;
  border-top: 1px solid #214f75;
}

.infoList div {
  display: grid;
  gap: 5px;
  padding: 13px 0;
  border-bottom: 1px solid #214f75;
}

.infoList span {
  color: #8eb7d7;
  font-size: 12px;
}

.infoList strong {
  color: #eef8ff;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.infoList .stateText {
  color: #04e2de;
}

.flowBoard {
  display: grid;
  grid-template-rows: auto 1fr;
}

.flowNodes {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(86px, 1fr));
  gap: 46px 32px;
  padding: 28px 18px 22px;
}

.flowNode {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 94px;
  text-align: center;
}

.flowNode::after {
  content: "";
  position: absolute;
  top: 18px;
  left: calc(50% + 22px);
  width: calc(100% - 12px);
  height: 1px;
  background: linear-gradient(90deg, #2d8dcb, rgba(45, 141, 203, .2));
}

.flowNode:nth-child(5n)::after,
.flowNode:last-child::after {
  display: none;
}

.flowNode b {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid #c7d0dc;
  border-radius: 50%;
  background: #09233a;
  color: #8eb7d7;
  font-size: 16px;
}

.flowNode span {
  color: #eff8ff;
  font-weight: 700;
  font-size: 14px;
}

.flowNode small {
  color: #8eb7d7;
  font-size: 12px;
}

.flowNode.ok b {
  border-color: #04e2de;
  color: #04e2de;
  box-shadow: 0 0 16px rgba(4, 226, 222, .34);
}

.flowNode.running b {
  border-color: #00aaff;
  box-shadow: inset 0 0 0 8px rgba(0, 170, 255, .18), 0 0 20px rgba(0, 170, 255, .44);
  color: #4fc3ff;
}

.flowNode.danger b {
  border-color: #ef4444;
  color: #ff6767;
}

.flowNode.warn b {
  border-color: #f59e0b;
  color: #ffd21c;
}

.railList {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.railDevice {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr 78px 12px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid #24577f;
  border-radius: 5px;
  background: #0b2844;
}

.railDevice strong {
  color: #f1f8ff;
  font-size: 14px;
}

.railDevice span {
  color: #00c8ff;
  font-size: 12px;
  text-align: right;
}

.railDevice i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #04e2de;
  box-shadow: 0 0 12px rgba(4, 226, 222, .72);
}

.railDevice.danger i { background: #ff4f67; box-shadow: 0 0 12px rgba(255, 79, 103, .72); }
.railDevice.warn i { background: #ffd21c; box-shadow: 0 0 12px rgba(255, 210, 28, .72); }
.railDevice.running i { background: #00aaff; box-shadow: 0 0 12px rgba(0, 170, 255, .72); }

.deviceIcon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
}

.deviceIcon svg,
.stationIcon svg,
.currentAgv svg,
.agvStatus svg,
.agvMarker svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #5c6673;
  stroke: #83bfe8;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flowMapLayout {
  position: relative;
  height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.flowDebugPanel {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  width: 214px;
  padding: 12px;
  border: 1px solid rgba(38, 155, 220, .72);
  border-radius: 6px;
  background: rgba(4, 31, 51, .88);
  box-shadow: 0 0 18px rgba(0, 178, 255, .16);
}

.flowDebugPanel h2 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #f2f8ff;
}

.flowDebugPanel label {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  color: #9ecdec;
  font-size: 12px;
}

.flowDebugPanel select {
  height: 32px;
  border: 1px solid #1d5f91;
  border-radius: 4px;
  padding: 0 8px;
  color: #eaf8ff;
  background: #082842;
  outline: none;
}

.flowDebugPanel button {
  width: 100%;
  height: 34px;
  margin-top: 2px;
  border: 1px solid #16bff4;
  border-radius: 4px;
  color: #001827;
  font-weight: 700;
  background: linear-gradient(180deg, #16d5ff, #0aa5e8);
  cursor: pointer;
}

.flowMapSurface {
  width: min(96vw, calc((100vh - 96px) * 0.8061));
  height: calc(100vh - 96px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.flowMapImageFrame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  aspect-ratio: 1164 / 1444;
}

.flowMapSurface img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.flowFence {
  display: none;
}

.flowFence::before,
.flowFence::after {
  display: none;
}

.flowFence::before {
  left: -10px;
  right: -10px;
  bottom: -10px;
  height: 100%;
  background:
    repeating-linear-gradient(72deg, transparent 0 20px, rgba(45, 126, 190, .58) 21px 23px, transparent 24px 42px),
    repeating-linear-gradient(0deg, transparent 0 96px, rgba(45, 126, 190, .76) 97px 103px, transparent 104px 152px);
  clip-path: polygon(0 0, 10px 0, 10px calc(100% - 10px), 100% calc(100% - 10px), 100% 100%, 0 100%, 0 0, calc(100% - 10px) 0, 100% 0, 100% 100%, calc(100% - 10px) 100%, calc(100% - 10px) 0);
  opacity: .72;
}

.flowFence::after {
  display: none;
}

.flowWarehouseSlots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.warehouseSlotOverlay {
  stroke: rgba(55, 84, 104, .92);
  stroke-width: 4;
  shape-rendering: geometricPrecision;
}

.warehouseSlotOverlay.red {
  fill: #ff6472;
}

.warehouseSlotOverlay.green {
  fill: #1ee8ba;
}

.warehouseSlotOverlay.blink {
  fill: #ff6472;
  animation: warehouseSlotBlink 1s steps(1, end) infinite;
}

@keyframes warehouseSlotBlink {
  0%,
  49% {
    fill: #ff6472;
  }

  50%,
  100% {
    fill: #ffffff;
  }
}

.debugDivider {
  height: 1px;
  margin: 12px 0 2px;
  background: rgba(125, 197, 255, .28);
}

.warehouseLamp {
  stroke: #fff;
  stroke-width: 1.4;
  filter: drop-shadow(0 0 3px currentColor);
}

.warehouseLamp.empty {
  color: #e22b2b;
  fill: #e22b2b;
}

.warehouseLamp.occupied {
  color: #19a55a;
  fill: #19a55a;
}

.flowAgvRouteMarker {
  filter: drop-shadow(0 0 3px rgba(100, 130, 145, .36));
}

.bottomBand {
  display: grid;
  grid-template-columns: 44% 1fr;
  gap: 8px;
  min-height: 120px;
  margin-top: 8px;
}

.alarmPanel {
  border-color: #7b2a3a;
  background: linear-gradient(180deg, rgba(63, 18, 34, .9), rgba(31, 15, 29, .92));
  padding: 14px 18px;
}

.alarmPanel h2 {
  color: #ff6b7b;
}

.alarmPanel p,
.nextAction p {
  margin-top: 10px;
  line-height: 1.45;
  font-size: 14px;
}

.alarmPanel small {
  display: block;
  margin-top: 8px;
  color: #ff8a96;
}

.nextAction {
  padding: 14px 18px;
}

.dangerText { color: #ff6b7b; font-weight: 700; }
.okText { color: #04e2de; font-weight: 700; }

.siteLayout {
  display: grid;
  grid-template-columns: 20% 1fr 22%;
  gap: 8px;
  min-height: calc(100vh - 182px);
}

.agvStatus {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.agvStatus div {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 4px 10px;
  padding: 10px 0;
  border-bottom: 1px solid #214f75;
}

.agvStatus svg {
  grid-row: span 2;
}

.agvStatus span {
  color: #8eb7d7;
  font-size: 12px;
}

.agvStatus strong {
  color: #04e2de;
  font-size: 14px;
}

.siteMapPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.siteMap {
  position: relative;
  min-height: 610px;
  overflow: hidden;
}

.mapCanvas {
  position: absolute;
  inset: 0 0 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mapReference {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.currentMapPoint {
  position: absolute;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 5px;
  transform: translate(-50%, -50%);
  color: #075985;
  font-size: 12px;
  font-weight: 700;
}

.currentMapPoint::before {
  content: "";
  position: absolute;
  top: -16px;
  width: 74px;
  height: 74px;
  border: 2px dashed #0284c7;
  border-radius: 50%;
  background: rgba(2, 132, 199, .06);
  pointer-events: none;
}

.currentMapAgv {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #0284c7;
  border-radius: 50%;
  background: #eef8ff;
  box-shadow: 0 0 14px rgba(2, 132, 199, .24);
}

.currentMapAgv svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #075985;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.station {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 96px;
  color: #17476f;
  text-align: center;
}

.station.workstation {
  min-width: 96px;
}

.stationBlock {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  grid-template-rows: 1fr auto;
  gap: 6px;
  width: 100%;
  min-height: 96px;
  padding: 9px 8px;
  border: 2px dashed rgba(31, 91, 139, .74);
  border-radius: 14px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 4px 14px rgba(48, 112, 170, .08);
}

.stationBlock::before {
  display: none;
}

.station.warehouse .stationBlock,
.station.display .stationBlock {
  min-height: 88px;
}

.station.model .stationBlock,
.station.charge .stationBlock {
  min-height: 78px;
}

.station.is-current .stationBlock {
  border-color: rgba(0, 157, 218, .95);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 157, 218, .12), 0 8px 20px rgba(48, 112, 170, .16);
}

.currentRing {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: calc(100% + 36px);
  max-width: 176px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(0, 157, 218, .9);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 157, 218, .08), transparent 62%);
  box-shadow: 0 0 20px rgba(0, 157, 218, .18);
  pointer-events: none;
}

.currentAgv {
  position: absolute;
  right: 12%;
  bottom: 12%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #1e75b3;
  border-radius: 50%;
  background: #eef8ff;
  box-shadow: 0 0 14px rgba(30, 117, 179, .32);
}

.currentAgv svg {
  width: 23px;
  height: 23px;
  stroke: #1e75b3;
}

.stationIcon {
  display: grid;
  place-items: center;
  width: 86px;
  height: 62px;
}

.station.warehouse .stationIcon,
.station.display .stationIcon {
  width: 140px;
  height: 62px;
}

.station.model .stationIcon,
.station.charge .stationIcon {
  width: 54px;
  height: 46px;
}

.stationIcon svg {
  stroke: #214d70;
  stroke-width: 3.1;
  filter: none;
}

.station strong {
  color: #17476f;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-shadow: none;
}

.station span {
  position: relative;
  z-index: 2;
  color: #4a779c;
  font-size: 12px;
}

.operationDesk {
  position: absolute;
  left: 50%;
  bottom: 3%;
  transform: translateX(-50%);
  color: #2f7ebb;
  font-size: 13px;
  letter-spacing: 0;
  opacity: .9;
}

.agvMarker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
}

.agvMarker svg {
  stroke: #04e2de;
  filter: drop-shadow(0 0 4px rgba(4, 226, 222, .85));
}

.mapLegend {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-around;
  gap: 36px;
  min-height: 26px;
  padding-top: 6px;
  color: #8eb7d7;
  font-size: 12px;
  border-top: 1px solid rgba(33, 79, 117, .72);
  background: linear-gradient(180deg, rgba(7, 27, 47, .92), rgba(7, 27, 47, .98));
}

.mapLegend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agvDot {
  width: 14px;
  height: 10px;
  border: 2px solid #3b82f6;
  border-radius: 3px;
}

.routeLine {
  width: 34px;
  border-top: 2px dashed #00aaff;
}

.stationMark {
  width: 12px;
  height: 12px;
  border: 1px solid #6ea8d4;
  background: #12395b;
}

.warningTablePanel,
.suggestionsPanel {
  padding: 12px 14px;
}

table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 8px 10px;
  border: 1px solid #214f75;
  text-align: left;
}

th {
  background: #0b2844;
  color: #bfe5ff;
}

td {
  color: #d8ecff;
}

.suggestionsPanel p {
  display: grid;
  grid-template-columns: 1fr 22px;
  align-items: center;
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid #214f75;
  border-radius: 4px;
  background: #09233a;
  font-size: 13px;
}

.suggestionsPanel span {
  text-align: right;
  color: #00c8ff;
}

.traceLayout {
  display: grid;
  grid-template-columns: 1fr 22%;
  gap: 8px;
  min-height: calc(100vh - 68px);
}

.traceSummary,
.qualityCards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.traceSummary div,
.qualityCards div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid #214f75;
  border-radius: 4px;
  background: #0b2844;
}

.traceSummary span,
.qualityCards span {
  display: block;
  color: #8eb7d7;
  font-size: 12px;
}

.traceSummary strong,
.qualityCards strong {
  display: block;
  margin-top: 8px;
  color: #04e2de;
  font-size: 18px;
}

.qualityCards {
  margin-top: 18px;
}

.qualityCards strong {
  display: inline-block;
  font-size: 32px;
}

.qualityCards small {
  margin-left: 6px;
  color: #8eb7d7;
}

.timeline {
  position: relative;
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.timelineItem {
  position: relative;
  display: grid;
  grid-template-columns: 14px 70px 1fr;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.timelineItem b {
  width: 9px;
  height: 9px;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  background: #fff;
  background: #071b2e;
}

.timelineItem span {
  color: #00c8ff;
}

.timelineItem strong {
  color: #d8ecff;
}

.empty {
  padding: 16px;
  color: #8eb7d7;
}

@media (max-width: 1200px) {
  .screenHeader,
  .productionLayout,
  .siteLayout,
  .bottomBand,
  .traceLayout {
    grid-template-columns: 1fr;
  }

  .flowNodes {
    grid-template-columns: repeat(3, minmax(86px, 1fr));
  }

  .flowNode:nth-child(5n)::after {
    display: block;
  }

  .flowNode:nth-child(3n)::after {
    display: none;
  }

  .traceSummary,
  .qualityCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
