/* ==========================================================================
   电梯维保报修数据驾驶舱 —— 深色科技风大屏样式
   设计基准：1920 x 1080（由 JS 整体 scale 自适应）
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #03080f;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
  color: #e6f2ff;
  -webkit-font-smoothing: antialiased;
}

/* ============================== 舞台与画布 ============================== */
#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  position: relative;
  width: 1920px;
  height: 1080px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 0 20px 18px;
  transform-origin: center center;
  overflow: hidden;
  background:
    radial-gradient(1100px 480px at 18% -5%, rgba(0, 96, 190, 0.30), transparent 62%),
    radial-gradient(1000px 620px at 88% 104%, rgba(0, 150, 170, 0.16), transparent 60%),
    linear-gradient(158deg, #071527 0%, #040c18 55%, #061020 100%);
}

/* 网格纹理 + 中央微光 */
#screen::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 160, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 160, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
}

/* ============================== 顶栏 ============================== */
.dash-header {
  position: relative;
  height: 84px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  z-index: 2;
}

.dash-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00e5ff 28%, #2f7dff 72%, transparent);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.65);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(135deg, #00e5ff, #2f7dff);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.9);
  transform: rotate(45deg);
  animation: logoPulse 2.6s ease-in-out infinite;
}

@keyframes logoPulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.55);
  }

  50% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 1);
  }
}

.header-left h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 6px;
  background: linear-gradient(92deg, #eef8ff 20%, #8fdcff 60%, #4fb3ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.clock-time {
  font-family: 'Bahnschrift', 'DIN Alternate', 'Consolas', monospace;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #dff4ff;
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.55);
}

.clock-date {
  font-size: 16px;
  color: #7fa8c9;
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6ef7c4;
  padding: 5px 14px;
  border: 1px solid rgba(0, 224, 138, 0.45);
  border-radius: 999px;
  background: rgba(0, 224, 138, 0.08);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00e08a;
  box-shadow: 0 0 10px #00e08a;
  animation: liveBlink 1.4s ease-in-out infinite;
}

@keyframes liveBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

.update-time {
  font-size: 14px;
  color: #7fa8c9;
}

.update-time em {
  font-style: normal;
  color: #cfe9ff;
}

.refresh-btn {
  font-size: 14px;
  color: #bfe7ff;
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.4);
  background: rgba(0, 140, 220, 0.12);
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover {
  background: rgba(0, 180, 255, 0.25);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

.refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================== 主体三列 ============================== */
.dash-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 430px 1fr 470px;
  gap: 14px;
  padding-top: 14px;
  position: relative;
  z-index: 1;
}

.col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================== 面板通用 ============================== */
.panel {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.22);
  background: linear-gradient(180deg, rgba(14, 42, 74, 0.82), rgba(8, 24, 44, 0.9));
  box-shadow: inset 0 0 26px rgba(0, 140, 200, 0.08);
}

/* 四角装饰 */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid #00e5ff;
  border-left: 2px solid #00e5ff;
  border-top-left-radius: 6px;
}

.panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid #00e5ff;
  border-right: 2px solid #00e5ff;
  border-bottom-right-radius: 6px;
}

.panel-title {
  flex: none;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: #d9f1ff;
  border-bottom: 1px solid rgba(0, 229, 255, 0.14);
  white-space: nowrap;
  overflow: hidden;
}

.title-mark {
  flex: none;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, #00e5ff, #2f7dff);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.8);
}

.title-mark.mark-warn {
  background: linear-gradient(180deg, #ffb020, #ff3b5c);
  box-shadow: 0 0 8px rgba(255, 59, 92, 0.85);
}

.panel-sub {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: #6f97b8;
  letter-spacing: 0.5px;
}

.panel-body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 8px 10px 10px;
}

.chart {
  width: 100%;
  height: 100%;
}

/* 中列 / 右列面板高度分配 */
.panel-trend {
  flex: none;
  height: 420px;
}

.panel-alert {
  flex: 1;
  min-height: 0;
}

.panel-component {
  flex: none;
  height: 340px;
}

.panel-cause {
  flex: none;
  height: 310px;
}

.panel-hour {
  flex: 1;
  min-height: 0;
}

/* 左列：KPI 网格 + 项目排名 */
.kpi-grid {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.panel-project {
  flex: 1;
  min-height: 0;
}

/* ============================== KPI 卡 ============================== */
.kpi-card {
  position: relative;
  height: 104px;
  padding: 12px 14px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  background: linear-gradient(180deg, rgba(16, 48, 84, 0.85), rgba(8, 26, 48, 0.92));
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  right: -18px;
  top: -18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.22), transparent 70%);
}

.kpi-label {
  font-size: 13px;
  color: #8fb4d4;
  letter-spacing: 0.5px;
}

.kpi-value {
  margin-top: 6px;
  font-family: 'Bahnschrift', 'DIN Alternate', 'Consolas', monospace;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: #4fe3ff;
  text-shadow: 0 0 16px rgba(0, 229, 255, 0.55);
}

.kpi-value .kpi-unit {
  font-size: 14px;
  font-weight: 400;
  color: #7fa8c9;
  margin-left: 4px;
  text-shadow: none;
}

.kpi-foot {
  margin-top: 5px;
  font-size: 11px;
  color: #5f86a8;
  letter-spacing: 0.5px;
}

.kpi-value.warn {
  color: #ffb020;
  text-shadow: 0 0 16px rgba(255, 176, 32, 0.55);
}

.kpi-value.danger {
  color: #ff5f7a;
  text-shadow: 0 0 16px rgba(255, 59, 92, 0.6);
}

.kpi-value.safe {
  color: #3ef0a8;
  text-shadow: 0 0 16px rgba(0, 224, 138, 0.55);
}

/* 涉及电梯卡（跨两列，与下方高危电梯卡呼应） */
.kpi-card.kpi-wide {
  grid-column: 1 / -1;
}

/* 高危电梯卡（跨两列，红色呼吸强调，联动预警模块） */
.kpi-card.kpi-high {
  grid-column: 1 / -1;
  height: 104px;
  border-color: rgba(255, 59, 92, 0.55);
  background: linear-gradient(180deg, rgba(84, 16, 34, 0.85), rgba(46, 10, 24, 0.92));
  animation: highCardPulse 2s ease-in-out infinite;
}

.kpi-card.kpi-high::after {
  background: radial-gradient(circle, rgba(255, 59, 92, 0.3), transparent 70%);
}

.kpi-card.kpi-high .kpi-label {
  color: #ff9fb2;
}

.kpi-card.kpi-high .kpi-value {
  color: #ff3b5c;
  text-shadow: 0 0 20px rgba(255, 59, 92, 0.9);
}

@keyframes highCardPulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 59, 92, 0.25), inset 0 0 18px rgba(255, 59, 92, 0.12);
  }

  50% {
    box-shadow: 0 0 22px rgba(255, 59, 92, 0.6), inset 0 0 26px rgba(255, 59, 92, 0.22);
  }
}

/* ============================== 连续报修预警列表 ============================== */
.alert-summary {
  display: inline-flex;
  gap: 8px;
  margin-left: 6px;
}

.summary-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.summary-chip.chip-high {
  color: #ff8ba0;
  border: 1px solid rgba(255, 59, 92, 0.5);
  background: rgba(255, 59, 92, 0.1);
}

.summary-chip.chip-watch {
  color: #ffd27d;
  border: 1px solid rgba(255, 176, 32, 0.5);
  background: rgba(255, 176, 32, 0.1);
}

.alert-body {
  padding: 6px 10px 10px;
  overflow: hidden;
}

.alert-list {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}

.alert-list::-webkit-scrollbar {
  display: none;
}

.scroll-mask {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 26px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 3;
}

.scroll-mask.show {
  opacity: 1;
}

.scroll-mask-top {
  top: 6px;
  background: linear-gradient(180deg, rgba(8, 24, 44, 0.98), transparent);
}

.scroll-mask-bottom {
  bottom: 10px;
  background: linear-gradient(0deg, rgba(8, 24, 44, 0.98), transparent);
}

/* 单条预警 */
.alert-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(10, 30, 54, 0.6);
}

.alert-item.level-high {
  border-color: rgba(255, 59, 92, 0.55);
  background: linear-gradient(90deg, rgba(96, 16, 36, 0.75), rgba(30, 10, 20, 0.75) 65%);
  animation: highItemPulse 1.8s ease-in-out infinite;
}

@keyframes highItemPulse {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(255, 59, 92, 0.25);
  }

  50% {
    box-shadow: 0 0 18px rgba(255, 59, 92, 0.65);
  }
}

.alert-item.level-watch {
  border-color: rgba(255, 176, 32, 0.5);
  background: linear-gradient(90deg, rgba(84, 56, 8, 0.7), rgba(26, 20, 8, 0.75) 65%);
}

/* 呼吸灯 */
.alert-light {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.level-high .alert-light {
  background: #ff3b5c;
  box-shadow: 0 0 12px #ff3b5c;
  animation: lightBreath 1.2s ease-in-out infinite;
}

.level-watch .alert-light {
  background: #ffb020;
  box-shadow: 0 0 10px #ffb020;
  animation: lightBreath 1.8s ease-in-out infinite;
}

@keyframes lightBreath {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.3;
    transform: scale(0.72);
  }
}

.alert-main {
  flex: 1;
  min-width: 0;
}

.alert-name {
  font-size: 17px;
  font-weight: 600;
  color: #f2f9ff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-high .alert-name {
  color: #ffdbe2;
}

.alert-name .alert-project {
  color: #9dc6e6;
  font-weight: 400;
}

.level-high .alert-name .alert-project {
  color: #ffb3c1;
}

.tag-trapped {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  color: #fff;
  background: #ff3b5c;
  box-shadow: 0 0 10px rgba(255, 59, 92, 0.8);
  vertical-align: 2px;
  animation: liveBlink 1.2s ease-in-out infinite;
}

.alert-desc {
  margin-top: 4px;
  font-size: 13px;
  color: #8fb4d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-right {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.alert-badges {
  display: flex;
  gap: 6px;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: 'Bahnschrift', 'Consolas', monospace;
}

.badge.b30 {
  color: #cfe9ff;
  border: 1px solid rgba(0, 229, 255, 0.4);
  background: rgba(0, 140, 220, 0.12);
}

.level-high .badge.b30 {
  color: #ffc9d3;
  border-color: rgba(255, 59, 92, 0.55);
  background: rgba(255, 59, 92, 0.14);
}

.level-watch .badge.b30 {
  color: #ffe2b0;
  border-color: rgba(255, 176, 32, 0.5);
  background: rgba(255, 176, 32, 0.12);
}

.badge.b7 {
  color: #ffd27d;
  border: 1px solid rgba(255, 176, 32, 0.5);
  background: rgba(255, 176, 32, 0.1);
}

.alert-last {
  font-size: 12px;
  color: #6f97b8;
  font-family: 'Bahnschrift', 'Consolas', monospace;
}

/* 无预警安全态 */
.alert-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #3ef0a8;
}

.alert-empty .empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(0, 224, 138, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #3ef0a8;
  box-shadow: 0 0 24px rgba(0, 224, 138, 0.45), inset 0 0 18px rgba(0, 224, 138, 0.2);
}

.alert-empty p {
  font-size: 17px;
  letter-spacing: 1px;
}

/* ============================== 加载遮罩 / 错误提示 ============================== */
.loading-mask {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(3, 8, 15, 0.72);
  color: #9cc7e8;
  font-size: 15px;
  letter-spacing: 2px;
  backdrop-filter: blur(2px);
  transition: opacity 0.35s;
}

.loading-mask.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid rgba(0, 229, 255, 0.18);
  border-top-color: #00e5ff;
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.35);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-toast {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-radius: 8px;
  border: 1px solid rgba(255, 59, 92, 0.6);
  background: rgba(70, 12, 26, 0.95);
  box-shadow: 0 0 24px rgba(255, 59, 92, 0.4);
  font-size: 15px;
  color: #ffdbe2;
}

.error-toast.hidden {
  display: none;
}

.retry-btn {
  font-size: 14px;
  color: #fff;
  padding: 6px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background: linear-gradient(90deg, #ff3b5c, #ff7a3d);
  transition: filter 0.2s;
}

.retry-btn:hover {
  filter: brightness(1.15);
}

/* 分钟数值的小数缩减：保持等宽数字 */
.kpi-value,
.badge,
.alert-last,
.clock-time {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   窄屏自适应（手机 / 竖屏平板）：视口宽度 ≤ 900px 时取消 1920 等比缩放，
   切换为纵向单列布局、页面自然滚动（桌面大屏的缩放效果不受影响）
   ========================================================================== */
@media (max-width: 900px) {

  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #stage {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100vh;
  }

  #screen {
    width: 100%;
    height: auto;
    min-height: 100vh;
    padding: 0 12px 20px;
    transform: none;
    overflow: visible;
    background:
      radial-gradient(620px 300px at 18% -2%, rgba(0, 96, 190, 0.28), transparent 68%),
      linear-gradient(170deg, #071527 0%, #040c18 48%, #061020 100%);
  }

  /* ---------- 顶栏：两行布局（标题+刷新 / 时钟），精简装饰信息 ---------- */
  .dash-header {
    height: auto;
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 12px 2px 10px;
  }

  .header-left {
    gap: 8px;
  }

  .header-left h1 {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .logo-mark {
    width: 10px;
    height: 10px;
  }

  .header-center {
    position: static;
    transform: none;
    order: 10;
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 10px;
  }

  .clock-time {
    font-size: 22px;
  }

  .clock-date {
    font-size: 12px;
  }

  .header-right {
    gap: 10px;
  }

  .live-badge,
  .update-time {
    display: none; /* 窄屏精简顶栏，聚焦核心数据 */
  }

  /* ---------- 主体：三列改为纵向单列 ---------- */
  .dash-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 10px;
  }

  .col {
    gap: 12px;
  }

  /* ---------- 面板高度：单列后需显式定高供图表 / 预警列表使用 ---------- */
  .panel-trend,
  .panel-project,
  .panel-component,
  .panel-cause,
  .panel-hour,
  .panel-alert {
    flex: none;
  }

  .panel-trend { height: 300px; }
  .panel-project { height: 300px; }
  .panel-component { height: 300px; }
  .panel-cause { height: 280px; }
  .panel-hour { height: 280px; }
  .panel-alert { height: 440px; }

  .panel-title {
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
  }

  /* 预警面板标题的判定口径说明换行显示，避免被截断 */
  .panel-alert .panel-title {
    height: auto;
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 8px 12px;
  }

  .panel-alert .panel-sub {
    flex: 1 1 100%;
    margin-left: 0;
    white-space: normal;
    line-height: 1.4;
  }

  /* ---------- KPI 卡 ---------- */
  .kpi-grid {
    gap: 10px;
  }

  .kpi-card {
    height: auto;
    min-height: 92px;
    padding: 10px 12px 8px;
  }

  .kpi-card.kpi-high {
    height: auto;
    min-height: 92px;
  }

  .kpi-label {
    font-size: 12px;
  }

  .kpi-value {
    font-size: 26px;
  }

  .kpi-value .kpi-unit {
    font-size: 12px;
  }

  .kpi-foot {
    font-size: 10px;
  }

  /* ---------- 预警条目 ---------- */
  .alert-item {
    padding: 8px 10px;
    gap: 8px;
  }

  .alert-name {
    font-size: 15px;
  }

  .alert-desc {
    font-size: 12px;
  }

  .badge {
    font-size: 11px;
    padding: 2px 7px;
  }

  /* ---------- 加载遮罩 / 错误提示改为视口固定定位 ---------- */
  .loading-mask {
    position: fixed;
  }

  .error-toast {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    transform: none;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
  }

}
