/* 数据大屏：响应式布局与常开性能优化，沿用页面现有配色变量。 */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.top,
.kpis,
.grid,
.bottom {
  width: 100%;
}

.top {
  flex-wrap: wrap;
  gap: 10px 18px;
}

.top .time {
  margin-left: auto;
  white-space: nowrap;
}

.kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
}

.kpi,
.panel,
.channel-name,
.order-lines {
  min-width: 0;
}

.kpi b {
  overflow-wrap: anywhere;
}

.channel-head,
.channel-foot {
  min-width: 0;
}

.channel-foot {
  flex-wrap: wrap;
}

.channel-foot span {
  min-width: 0;
}

.feed-track {
  backface-visibility: hidden;
}

.connection {
  max-width: calc(100vw - 32px);
}

.retry-btn {
  font: inherit;
  font-size: 12px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
  color: var(--amber);
  border-radius: 12px;
  padding: 2px 10px;
  cursor: pointer;
  pointer-events: auto;
}

.retry-btn:hover {
  background: rgba(251, 191, 36, 0.22);
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1880px;
  margin: 0 auto 16px;
  font-size: 13px;
  color: var(--sub);
}

.filters label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.filters select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 132px;
  outline: none;
}

.filters select:focus {
  border-color: var(--blue);
}

.filters select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.filter-note {
  color: var(--amber);
  font-size: 12px;
}

.spot-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.spot-text {
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.spot-btn {
  font: inherit;
  font-size: 12px;
  color: var(--blue);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
}

.spot-btn:hover {
  background: rgba(56, 189, 248, 0.18);
}

.panel {
  transition: box-shadow 0.35s, border-color 0.35s;
}

.panel.is-spotlight {
  border-color: rgba(56, 189, 248, 0.62);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.32), 0 0 28px rgba(56, 189, 248, 0.18);
}

.fs-btn {
  margin-left: 12px;
  font: inherit;
  font-size: 12px;
  color: var(--blue);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
}

.fs-btn:hover {
  background: rgba(56, 189, 248, 0.18);
}

.fs-exit {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  font: inherit;
  font-size: 12px;
  color: var(--blue);
  background: rgba(19, 31, 51, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.hide-top .top {
  display: none;
}

@media (max-width: 640px) {
  .filters {
    gap: 8px;
  }

  .filters select {
    min-width: 0;
    flex: 1;
  }

  .filter-note {
    width: 100%;
  }

  .spot-ctl {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 1100px) {
  body {
    padding: 16px;
  }

  .top {
    align-items: flex-start;
  }

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

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

  .channel-list {
    max-height: none;
  }

  .heat {
    height: 320px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .top h1 {
    font-size: 19px;
    letter-spacing: 1px;
  }

  .top .time {
    margin-left: 0;
    white-space: normal;
  }

  .kpis {
    gap: 10px;
  }

  .kpi {
    padding: 14px 8px;
  }

  .kpi b {
    font-size: 24px;
  }

  .panel {
    padding: 13px;
  }

  .row-p {
    gap: 7px;
  }

  .row-p .name {
    width: 70px;
  }

  .status-list .val {
    width: 96px;
  }

  .connection {
    right: 16px;
    bottom: 16px;
  }
}

/* 异常 / 超时订单高亮 */
.feed .item.is-abnormal {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.16), transparent 72%);
  box-shadow: inset 2px 0 0 var(--red);
  border-radius: 6px;
  padding-left: 8px;
}

.feed .item.is-timeout {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.14), transparent 72%);
  box-shadow: inset 2px 0 0 var(--amber);
  border-radius: 6px;
  padding-left: 8px;
}

.tag.timeout {
  background: #78350f;
  color: var(--amber);
}

/* 渠道 TOP3 标注 */
.channel-item.is-top {
  border-left: 2px solid rgba(56, 189, 248, 0.6);
  padding-left: 8px;
}

.top-rank {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  color: #0b1220;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 6px;
}

.top-rank.rank-2 {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
}

.top-rank.rank-3 {
  background: linear-gradient(135deg, #fdba74, #fb923c);
}

/* 最新订单紧凑列表 */
.latest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 18px;
  max-height: 190px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.latest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  min-width: 0;
}

.latest-item .order-no {
  color: #dbeafe;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.latest-item .latest-meta {
  color: var(--sub);
  font-size: 11px;
  white-space: nowrap;
  flex: none;
}

.latest-item.is-abnormal {
  background: rgba(239, 68, 68, 0.14);
  box-shadow: inset 2px 0 0 var(--red);
}

.latest-item.is-timeout {
  background: rgba(251, 191, 36, 0.12);
  box-shadow: inset 2px 0 0 var(--amber);
}

@media (max-width: 600px) {
  .latest-list {
    grid-template-columns: 1fr;
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .feed-track {
    will-change: auto;
  }
}

.top .time #lastUpdate {
  color: var(--ink);
}

.top .time #lastUpdate.stale,
.top .time .stale-tip {
  color: var(--amber);
}

.net-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  font-size: 12px;
  color: var(--sub);
}

.net-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.65);
}

.net-status.bad {
  color: var(--red);
}

.net-status.bad .net-dot {
  background: var(--red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.65);
}

.spot-btn.is-locked {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .fs-exit {
    top: 10px;
    right: 10px;
    min-height: 32px;
    padding: 6px 12px;
    font-size: 12px;
    z-index: 40;
  }
}

.spot-progress {
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  flex: none;
}

.spot-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 2px;
  transition: width 0.25s linear;
}

.grid .panel h3 {
  cursor: pointer;
}

.data-age {
  font-size: 12px;
  color: var(--sub);
}

.data-age.bad {
  color: var(--red);
  font-weight: 600;
}

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

body.compact .grid > .col:nth-child(2) {
  display: none;
}
