:root {
  --bg: #040c20;
  --bg-deep: #020611;
  --panel-bg: rgba(8, 24, 52, 0.8);
  --panel-bg-2: rgba(6, 18, 39, 0.88);
  --panel-border: rgba(96, 176, 255, 0.34);
  --panel-line: rgba(156, 218, 255, 0.08);
  --text: #cfe8ff;
  --muted: #7ea9d5;
  --title: #f4fbff;
  --accent: #28d7ff;
  --accent-2: #1de9b6;
  --accent-3: #6ea8ff;
  --positive: #65f6c7;
  --negative: #ff7c9d;
  --neutral: #ffd166;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
  --page-pad-x: clamp(10px, 0.8vw, 16px);
  --page-pad-y: clamp(10px, 0.75vh, 14px);
  --grid-gap: clamp(8px, 0.62vw, 12px);
  --topbar-h: clamp(56px, 5.7vh, 72px);
  --panel-radius: clamp(12px, 0.8vw, 16px);
  --metric-label-size: 14px;
  --metric-value-size: clamp(24px, 1.68vw, 34px);
  --metric-value-gap: 16px;
  --metric-foot-size: 13px;
  --metric-foot-gap: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.screen-bg,
.screen-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.screen-bg {
  z-index: -3;
  background:
    radial-gradient(circle at 16% 18%, rgba(40, 128, 255, 0.24), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(29, 233, 182, 0.12), transparent 24%),
    radial-gradient(circle at 78% 72%, rgba(40, 215, 255, 0.16), transparent 30%),
    linear-gradient(145deg, #07112c 0%, #041022 55%, var(--bg-deep) 100%);
}

.screen-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88, 173, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 173, 255, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.3;
}

.screen-overlay {
  z-index: -2;
  background:
    radial-gradient(circle at center, transparent 55%, rgba(0, 0, 0, 0.25) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 30%);
}

.dashboard {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: var(--page-pad-y) var(--page-pad-x) calc(var(--page-pad-y) + 2px);
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  gap: var(--grid-gap);
}

.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 32%),
    linear-gradient(145deg, rgba(9, 31, 67, 0.9), var(--panel-bg));
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow:
    inset 0 0 24px rgba(26, 151, 255, 0.08),
    0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  pointer-events: none;
}

.panel::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -18%;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(40, 215, 255, 0.12), transparent 72%);
  pointer-events: none;
}

.top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 18px;
}

.top-bar h1 {
  font-size: clamp(24px, 2.05vw, 32px);
  letter-spacing: 0.18em;
  color: var(--title);
  text-shadow: 0 0 16px rgba(110, 220, 255, 0.5);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.left-info,
.right-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #a8d7ff;
  min-width: 0;
}

#currentTime {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.right-info {
  justify-content: flex-end;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 14px rgba(29, 233, 182, 0.9);
  animation: blink 1.2s infinite;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(122, 191, 255, 0.32);
  background: rgba(16, 56, 111, 0.36);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-live {
  color: #88ffe8;
}

.main-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, 30fr) minmax(540px, 45fr) minmax(360px, 25fr);
  grid-template-rows: minmax(0, 0.88fr) minmax(0, 1.12fr);
  grid-template-areas:
    "realtime map side"
    "ops map side";
  gap: var(--grid-gap);
}

.realtime-panel {
  grid-area: realtime;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.ops-panel {
  grid-area: ops;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.map-panel {
  grid-area: map;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.side-column {
  grid-area: side;
  display: grid;
  grid-template-rows: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 12px;
  min-height: 0;
}

.chart-panel,
.table-panel {
  min-height: 0;
}

.chart-panel {
  display: flex;
  flex-direction: column;
  padding: 16px 18px 12px;
}

.table-panel {
  display: flex;
  flex-direction: column;
  padding: 16px 18px 14px;
}

.panel-toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.side-column .section-head h2 {
  font-size: 20px;
  letter-spacing: 0.04em;
}

.section-head h2 {
  font-size: clamp(20px, 1.55vw, 24px);
  color: var(--title);
  letter-spacing: 0.06em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.metric-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ops-panel .metric-grid {
  flex: 1;
  grid-auto-rows: minmax(0, 1fr);
}

.realtime-panel .metric-grid {
  flex: 1;
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
}

.realtime-panel .metric-tile {
  padding: 13px 14px;
}

.realtime-panel .metric-tile::after {
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
}

.metric-grid-ops {
  margin-top: 8px;
}

.metric-tile {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 13px 14px;
  border-radius: 12px;
  background:
    linear-gradient(160deg, rgba(10, 35, 76, 0.95), rgba(8, 24, 52, 0.86)),
    var(--panel-bg-2);
  border: 1px solid rgba(112, 190, 255, 0.18);
  box-shadow: var(--shadow);
}

.metric-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 36%),
    linear-gradient(90deg, transparent 0, rgba(40, 215, 255, 0.06) 100%);
  pointer-events: none;
}

.metric-tile::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(40, 215, 255, 0.14), transparent 70%);
  pointer-events: none;
}

.metric-tile-accent {
  border-color: rgba(86, 221, 255, 0.32);
  box-shadow:
    inset 0 0 18px rgba(40, 215, 255, 0.08),
    0 0 18px rgba(40, 215, 255, 0.08);
}

.metric-label {
  font-size: var(--metric-label-size);
  line-height: 1.22;
  color: #98cfff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  margin-top: var(--metric-value-gap);
  font-size: var(--metric-value-size);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f9fdff;
  line-height: 1.08;
  text-shadow: 0 0 14px rgba(94, 215, 255, 0.18);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-foot {
  margin-top: var(--metric-foot-gap);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--metric-foot-size);
  line-height: 1.2;
  color: #81b6e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delta {
  font-weight: 700;
}

.delta.positive {
  color: var(--positive);
}

.delta.negative {
  color: var(--negative);
}

.delta.neutral {
  color: var(--neutral);
}

.range-switch {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.dim-btn {
  min-width: 64px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(117, 197, 255, 0.28);
  background: linear-gradient(145deg, rgba(15, 54, 110, 0.56), rgba(11, 34, 70, 0.74));
  color: #cde9ff;
  font-size: 11px;
  line-height: 1.1;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.dim-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(131, 212, 255, 0.48);
}

.dim-btn.active {
  color: #03152b;
  border-color: transparent;
  background: linear-gradient(90deg, #73ebff, #51a9ff);
  box-shadow: 0 0 16px rgba(73, 184, 255, 0.35);
  font-weight: 700;
}

.range-pill {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(122, 191, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: #9fcbf7;
  font-size: 12px;
  max-width: min(100%, 280px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #91c2f2;
  font-size: 13px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-hub {
  background: #fff176;
  box-shadow: 0 0 10px rgba(255, 241, 118, 0.8);
}

.legend-node {
  background: #6be8ff;
  box-shadow: 0 0 10px rgba(107, 232, 255, 0.8);
}

.map-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.chart {
  width: 100%;
  height: 100%;
}

.chart-panel .chart {
  flex: 1;
  min-height: 0;
  height: auto;
}

.map-chart {
  position: absolute;
  inset: 0;
}

.table-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-top: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

thead th {
  padding: 10px 4px;
  text-align: left;
  color: #a8d8ff;
  border-bottom: 1px solid rgba(111, 181, 244, 0.3);
}

tbody td {
  padding: 9px 4px;
  color: #d7efff;
  border-bottom: 1px dashed rgba(87, 157, 218, 0.18);
}

thead th:nth-child(1),
tbody td:nth-child(1) {
  width: 32%;
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  width: 34%;
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  width: 16%;
  text-align: center;
}

thead th:nth-child(4),
tbody td:nth-child(4) {
  width: 18%;
}

.cell-text {
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.ok {
  color: #7dffd8;
}

.wait {
  color: #ffd166;
}

.pending {
  color: #7bc4ff;
}

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

  50% {
    opacity: 0.35;
  }
}

@media (max-width: 1480px) {
  :root {
    --metric-value-size: clamp(22px, 1.62vw, 30px);
  }

  .main-layout {
    grid-template-columns: 31fr 42fr 27fr;
  }
}

@media (max-height: 920px) and (min-width: 1201px) {
  :root {
    --page-pad-y: 8px;
    --page-pad-x: 10px;
    --grid-gap: 8px;
    --topbar-h: 52px;
    --metric-label-size: 13px;
    --metric-value-size: clamp(22px, 1.5vw, 30px);
    --metric-value-gap: 8px;
    --metric-foot-size: 11px;
    --metric-foot-gap: 8px;
  }

  .panel::before {
    inset: 9px;
  }

  .top-bar h1 {
    font-size: clamp(22px, 1.6vw, 28px);
    letter-spacing: 0.14em;
  }

  .status {
    min-height: 24px;
    font-size: 10px;
  }

  .realtime-panel,
  .ops-panel {
    padding: 10px;
  }

  .map-panel,
  .chart-panel,
  .table-panel {
    padding: 12px 14px;
  }

  .section-head {
    margin-bottom: 8px;
  }

  .metric-tile {
    padding: 8px 10px;
  }

  .table-wrap {
    margin-top: 2px;
  }

  thead th,
  tbody td {
    padding-top: 7px;
    padding-bottom: 7px;
  }
}

@media (min-width: 1920px) and (min-height: 1080px) {
  :root {
    --metric-label-size: 15px;
    --metric-value-size: clamp(28px, 1.9vw, 40px);
    --metric-value-gap: 18px;
    --metric-foot-size: 13px;
    --metric-foot-gap: 14px;
  }

  .top-bar h1 {
    font-size: clamp(30px, 1.9vw, 42px);
  }

  .section-head h2 {
    font-size: clamp(22px, 1.25vw, 30px);
  }

  table {
    font-size: 14px;
  }

  .realtime-panel .metric-tile,
  .ops-panel .metric-tile {
    padding: 14px 16px;
  }
}

@media (min-width: 1800px) and (min-aspect-ratio: 21/9) {
  body {
    display: flex;
    align-items: stretch;
    justify-content: center;
  }

  .dashboard {
    width: min(100vw, calc(100vh * 16 / 9));
    margin: 0 auto;
  }
}

@media (max-width: 1200px) {
  body {
    overflow: auto;
  }

  .dashboard {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto auto;
  }

  .main-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto minmax(520px, auto);
    grid-template-areas:
      "realtime ops"
      "map map"
      "side side";
  }
}

@media (max-width: 860px) {
  :root {
    --metric-label-size: 12px;
    --metric-value-size: clamp(22px, 5.2vw, 30px);
    --metric-value-gap: 10px;
    --metric-foot-size: 11px;
    --metric-foot-gap: 8px;
  }

  .top-bar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 16px;
  }

  .left-info,
  .right-info {
    justify-content: center;
    flex-wrap: wrap;
  }

  .main-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "realtime"
      "ops"
      "map"
      "side";
    grid-template-rows: auto;
  }

  .section-head,
  .panel-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .range-switch {
    justify-content: flex-start;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-rows: 360px 460px;
  }

  table {
    font-size: 12px;
  }

  thead th,
  tbody td {
    padding: 8px 3px;
  }
}
