:root {
  --bg-deep: #04142e;
  --bg-mid: #071f45;
  --bg-card: rgba(6, 28, 62, 0.84);
  --bg-card-strong: rgba(8, 38, 82, 0.94);
  --primary: #00d4ff;
  --secondary: #2f7dff;
  --gold: #f6c453;
  --danger: #ff5c73;
  --success: #24e0a4;
  --purple: #8d7cff;
  --text-main: #e9f6ff;
  --text-soft: #a8cdec;
  --text-dim: #6f98bb;
  --border: rgba(0, 212, 255, 0.28);
  --border-strong: rgba(0, 212, 255, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.grid-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(17, 94, 173, 0.22), transparent 34%),
    radial-gradient(circle at 18% 24%, rgba(0, 212, 255, 0.11), transparent 22%),
    radial-gradient(circle at 78% 78%, rgba(47, 125, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #061833 0%, #031024 100%);
  z-index: 0;
}

.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
}

.grid-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.44) 100%);
}

.scan-line {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 212, 255, 0.13) 50%, transparent 100%);
  height: 18%;
  animation: scan 8s linear infinite;
  opacity: 0.45;
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.78);
  animation: float 14s linear infinite;
  opacity: 0;
}

.screen-scale-wrapper {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.screen-container {
  position: absolute;
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
  display: flex;
  flex-direction: column;
  padding: 18px 24px 22px;
}

.top-header {
  height: 126px;
  display: grid;
  grid-template-columns: 430px 1fr 430px;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.top-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.75), transparent);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.34);
}

.header-left,
.header-right {
  min-width: 0;
}

.header-mini-label {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.header-kpi-row {
  display: flex;
  gap: 12px;
}

.header-kpi {
  min-width: 142px;
  height: 54px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(47, 125, 255, 0.05));
  padding: 8px 12px;
}

.header-kpi-num {
  display: block;
  font-size: 24px;
  color: var(--primary);
  font-weight: 700;
  line-height: 1;
}

.header-kpi-label,
.region-chip,
.weather,
.refresh-time {
  color: var(--text-soft);
  font-size: 13px;
}

.region-chip {
  margin-top: 9px;
}

.header-center {
  text-align: center;
  position: relative;
}

.title-line {
  width: 540px;
  height: 16px;
  margin: 0 auto -2px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.42), transparent);
  clip-path: polygon(10% 44%, 90% 44%, 100% 50%, 90% 56%, 10% 56%, 0 50%);
}

.header-center h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: 4px;
  text-shadow: 0 0 18px rgba(0, 212, 255, 0.42);
}

.header-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(180, 220, 255, 0.72);
  letter-spacing: 3px;
}

.status-strip {
  margin: 9px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  font-size: 13px;
  border: 1px solid rgba(0, 212, 255, 0.24);
  padding: 4px 16px;
  background: rgba(4, 20, 45, 0.56);
}

.status-dot,
.weather-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 14px var(--success);
  animation: pulse 2s infinite;
}

.split-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(233, 246, 255, 0.52);
}

.header-right {
  text-align: right;
}

.time {
  font-size: 32px;
  color: var(--primary);
  font-weight: 700;
  line-height: 1.1;
}

.date {
  color: var(--text-soft);
  font-size: 15px;
}

.weather {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.refresh-time {
  margin-top: 8px;
}

.refresh-time strong {
  color: var(--gold);
  font-weight: 600;
}

.view-tabs {
  height: 42px;
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 4px 0 12px;
  flex-shrink: 0;
}

.view-tab {
  min-width: 210px;
  height: 36px;
  border: 1px solid rgba(0, 212, 255, 0.25);
  background: rgba(7, 31, 69, 0.58);
  color: rgba(210, 238, 255, 0.72);
  letter-spacing: 1px;
}

.view-tab:hover {
  color: #fff;
  border-color: rgba(0, 212, 255, 0.46);
}

.view-tab.active {
  color: #fff;
  border-color: var(--border-strong);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.22), rgba(47, 125, 255, 0.18));
  box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.1), 0 0 18px rgba(0, 212, 255, 0.12);
}

.view-tab.disabled {
  opacity: 0.54;
}

.screen-content {
  flex: 1;
  min-height: 0;
  position: relative;
}

.view-panel {
  display: none;
  height: 100%;
  min-height: 0;
}

.view-panel.active {
  display: grid;
}

.overview-view {
  grid-template-columns: 420px 1fr 420px;
  grid-template-rows: 1fr 250px;
  gap: 14px;
}

.left-stack,
.right-stack,
.inventory-side {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trend-panel {
  grid-column: 1 / 4;
}

.panel-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.055), transparent 34%),
    var(--bg-card);
  box-shadow: inset 0 0 38px rgba(0, 103, 191, 0.09), 0 10px 28px rgba(0, 0, 0, 0.16);
  padding: 14px;
}

.panel-card::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.76), transparent);
}

.panel-card::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 18px;
  height: 18px;
  border-top: 1px solid rgba(0, 212, 255, 0.7);
  border-left: 1px solid rgba(0, 212, 255, 0.7);
}

.panel-header {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.panel-title {
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: "";
  width: 3px;
  height: 16px;
  background: linear-gradient(180deg, var(--primary), transparent);
}

.panel-hint {
  margin-left: 12px;
  color: var(--text-dim);
  font-size: 12px;
}

.panel-badge {
  flex-shrink: 0;
  color: var(--primary);
  border: 1px solid rgba(0, 212, 255, 0.28);
  background: rgba(0, 212, 255, 0.08);
  padding: 3px 8px;
  font-size: 12px;
}

.panel-badge.danger {
  color: var(--danger);
  border-color: rgba(255, 92, 115, 0.38);
  background: rgba(255, 92, 115, 0.08);
}

.overview-kpis {
  flex: 0 0 252px;
}

.risk-panel {
  flex: 1;
}

.activity-panel,
.batch-panel,
.logistics-panel {
  flex: 1;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  height: calc(100% - 38px);
}

.kpi-card {
  min-width: 0;
  border: 1px solid rgba(0, 212, 255, 0.18);
  background: rgba(2, 18, 42, 0.55);
  padding: 12px;
  position: relative;
}

.kpi-card.wide {
  grid-column: 1 / 3;
}

.kpi-label,
.kpi-unit,
.summary-item span,
.inventory-kpi span {
  color: var(--text-dim);
  font-size: 13px;
}

.kpi-value {
  display: inline-block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
  color: var(--primary);
  font-weight: 800;
}

.kpi-value.success,
.success {
  color: var(--success);
}

.kpi-value.warning,
.warning {
  color: var(--gold);
}

.kpi-value.purple,
.purple {
  color: var(--purple);
}

.kpi-unit {
  margin-left: 4px;
}

.risk-body {
  display: grid;
  grid-template-rows: 190px 1fr;
  gap: 10px;
  height: calc(100% - 38px);
  min-height: 0;
}

.chart {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map-panel,
.batch-map-card,
.inventory-map-card {
  padding-bottom: 8px;
}

.map-toolbar {
  align-items: flex-start;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
}

.screen-input,
.screen-select {
  height: 32px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  background: rgba(1, 12, 29, 0.72);
  color: var(--text-main);
  outline: none;
  padding: 0 10px;
  min-width: 168px;
}

.screen-input::placeholder {
  color: rgba(168, 205, 236, 0.55);
}

.screen-select option {
  background: #061833;
}

.map-back-button {
  height: 32px;
  border: 1px solid rgba(246, 196, 83, 0.42);
  background: rgba(246, 196, 83, 0.12);
  color: #ffe3a1;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
}

.map-back-button:hover {
  background: rgba(246, 196, 83, 0.2);
  box-shadow: 0 0 14px rgba(246, 196, 83, 0.16);
}

.map-stat-row {
  height: 30px;
  display: flex;
  gap: 20px;
  color: var(--text-soft);
  font-size: 13px;
  padding-left: 8px;
}

.map-stat-row b {
  color: var(--primary);
  font-weight: 800;
}

.overview-map {
  min-width: 0;
}

.map-chart {
  height: calc(100% - 78px);
}

.map-float-card {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 230px;
  border: 1px solid rgba(0, 212, 255, 0.24);
  background: rgba(2, 16, 38, 0.82);
  padding: 12px;
  z-index: 3;
}

.float-title {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 6px;
}

.map-float-card strong {
  display: block;
  color: #fff;
  font-size: 16px;
  margin-bottom: 6px;
}

.map-float-card div {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.alert-list,
.activity-list,
.priority-batches,
.logistics-list,
.waybill-list,
.factory-table {
  min-height: 0;
  overflow: hidden;
}

.alert-item,
.activity-item,
.priority-item,
.logistics-item,
.waybill-item,
.factory-row {
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  padding: 8px 4px;
  color: var(--text-soft);
  font-size: 13px;
}

.alert-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px;
  align-items: center;
}

.priority-item {
  cursor: pointer;
}

.priority-item:hover,
.factory-row:hover,
.batch-row:hover {
  background: rgba(0, 212, 255, 0.08);
}

.item-title,
.batch-row strong,
.factory-row strong,
.waybill-item strong {
  color: #fff;
  font-weight: 600;
}

.risk-tag,
.event-tag,
.status-tag {
  display: inline-block;
  padding: 2px 7px;
  font-size: 12px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  color: var(--primary);
  background: rgba(0, 212, 255, 0.08);
}

.risk-low {
  color: var(--success);
  border-color: rgba(36, 224, 164, 0.36);
  background: rgba(36, 224, 164, 0.08);
}

.risk-medium {
  color: var(--primary);
}

.risk-high {
  color: var(--gold);
  border-color: rgba(246, 196, 83, 0.4);
  background: rgba(246, 196, 83, 0.08);
}

.risk-critical {
  color: var(--danger);
  border-color: rgba(255, 92, 115, 0.44);
  background: rgba(255, 92, 115, 0.1);
  animation: blink 1.8s infinite;
}

.trend-chart {
  height: calc(100% - 38px);
}

.batch-view {
  grid-template-columns: 360px 1fr 420px;
  grid-template-rows: 250px 1fr;
  gap: 14px;
}

.batch-summary-card {
  grid-column: 1 / 4;
}

.batch-id-line {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}

.batch-id-line strong {
  font-size: 24px;
  color: #fff;
}

.batch-id-line span {
  color: var(--text-soft);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.summary-item,
.inventory-kpi {
  border: 1px solid rgba(0, 212, 255, 0.18);
  background: rgba(2, 18, 42, 0.55);
  padding: 10px 12px;
}

.summary-item strong,
.inventory-kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  color: var(--primary);
}

.batch-search-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  height: 36px;
}

.batch-search-row .screen-input {
  width: 100%;
  min-width: 0;
  height: 36px;
}

.timeline-card,
.waybill-card {
  min-height: 0;
}

.timeline {
  height: calc(100% - 38px);
  overflow: hidden;
  padding-left: 12px;
}

.timeline-item {
  position: relative;
  padding: 0 0 18px 18px;
  border-left: 1px solid rgba(0, 212, 255, 0.26);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.8);
}

.timeline-title {
  color: #fff;
  font-weight: 700;
  margin-bottom: 4px;
}

.timeline-meta {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.batch-map-chart {
  height: calc(100% - 38px);
}

.waybill-list {
  height: calc(100% - 38px);
}

.waybill-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inventory-view {
  grid-template-columns: 1fr 520px;
  grid-template-rows: 130px 1fr;
  gap: 14px;
}

.inventory-kpis {
  grid-column: 1 / 3;
}

.inventory-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.inventory-map-chart {
  height: calc(100% - 44px);
}

.inventory-side {
  grid-row: 2;
}

.inventory-table-card {
  flex: 1.16;
}

.chemical-stock-card {
  flex: 0.84;
}

.factory-table {
  height: calc(100% - 38px);
}

.factory-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.factory-row .meta {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}

.chemical-stock-chart {
  height: calc(100% - 38px);
}

.modal-mask {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 7, 18, 0.58);
}

.modal-mask.open {
  display: flex;
}

.modal {
  width: 860px;
  height: 620px;
  border: 1px solid rgba(0, 212, 255, 0.45);
  border-radius: 6px;
  background: var(--bg-card-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46), inset 0 0 48px rgba(0, 103, 191, 0.11);
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.18);
  padding-bottom: 12px;
}

.modal-kicker {
  color: var(--primary);
  font-size: 12px;
  letter-spacing: 2px;
}

.modal h2 {
  margin: 6px 0;
  font-size: 24px;
}

.modal p {
  margin: 0;
  color: var(--text-soft);
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.08);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  height: 506px;
  overflow: hidden;
  padding-top: 12px;
}

.batch-table {
  height: 100%;
  overflow: hidden;
}

.batch-row {
  display: grid;
  grid-template-columns: 160px 1fr 120px 110px 100px;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  color: var(--text-soft);
  cursor: pointer;
}

.batch-row.active {
  background: rgba(0, 212, 255, 0.11);
  border-color: rgba(0, 212, 255, 0.34);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-width: 280px;
  text-align: center;
  padding: 10px 18px;
  color: #fff;
  background: rgba(3, 18, 42, 0.92);
  border: 1px solid rgba(0, 212, 255, 0.38);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.highlight-row {
  background: rgba(0, 212, 255, 0.08);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes scan {
  0% {
    transform: translateY(-120%);
  }
  100% {
    transform: translateY(620%);
  }
}

@keyframes float {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  12% {
    opacity: 0.55;
  }
  90% {
    opacity: 0.24;
  }
  100% {
    transform: translateY(-980px);
    opacity: 0;
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}
