/* 企业数据看板 - 对齐 opc_admin/src/views/aiDashboard/dashboard.scss */

html,
body {
  margin: 0;
  min-height: 100%;
  background: #f3f5f7;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: #1f2937;
}

.ai-dashboard {
  --dash-bg: #f3f5f7;
  --dash-panel: #ffffff;
  --dash-line: #e4e7ed;
  --dash-cyan: #0ea5e9;
  --dash-green: #22c55e;
  --dash-text: #1f2937;
  --dash-muted: #6b7280;

  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
  margin: 0;
  padding: 18px 20px 20px;
  overflow: auto;
  color: var(--dash-text);
  background:
    radial-gradient(900px 360px at 8% 0%, rgba(14, 165, 233, 0.08), transparent 55%),
    radial-gradient(700px 320px at 92% 12%, rgba(34, 197, 94, 0.06), transparent 60%),
    var(--dash-bg);
}

.ai-dashboard.is-fullscreen,
.ai-dashboard:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(900px 360px at 8% 0%, rgba(14, 165, 233, 0.08), transparent 55%),
    radial-gradient(700px 320px at 92% 12%, rgba(34, 197, 94, 0.06), transparent 60%),
    var(--dash-bg);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 0;
}

.dash-header__left,
.dash-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #111827;
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 999px;
  color: #16a34a;
  font-size: 11px;
  letter-spacing: 0.8px;
  background: rgba(34, 197, 94, 0.08);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dash-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
  animation: live-pulse 1.4s ease-in-out infinite;
}

.time-block {
  text-align: right;
  line-height: 1.35;
}

.now-time {
  font-size: 13px;
  color: #374151;
}

.updated-time {
  font-size: 11px;
  color: var(--dash-muted);
}

.fs-btn,
.back-btn {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.fs-btn {
  color: #fff;
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.fs-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.32);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--dash-cyan);
  border: 1px solid rgba(14, 165, 233, 0.25);
  background: rgba(14, 165, 233, 0.06);
}

.back-btn:hover {
  background: rgba(14, 165, 233, 0.1);
  color: var(--dash-cyan);
}

.dash-card {
  position: relative;
  border: 1px solid var(--dash-line);
  border-radius: 14px;
  background: var(--dash-panel);
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 8px 20px rgba(16, 24, 40, 0.05);
}

.kpi-row,
.chart-row {
  display: grid;
  gap: 14px;
}

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

.dash-loading {
  grid-column: 1 / -1;
  padding: 28px 8px;
  color: #6b7280;
  font-size: 14px;
}

.kpi-card {
  min-width: 0;
  padding: 14px 14px 12px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}

.kpi-card:hover {
  border-color: rgba(14, 165, 233, 0.35);
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.05),
    0 12px 24px rgba(16, 24, 40, 0.08);
  transform: translateY(-2px);
}

.kpi-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  color: var(--dash-cyan);
  background: rgba(14, 165, 233, 0.1);
}

.kpi-card.is-blue .kpi-icon {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.kpi-card.is-green .kpi-icon,
.kpi-card.is-green .kpi-value {
  color: var(--dash-green);
}

.kpi-card.is-green .kpi-icon {
  background: rgba(34, 197, 94, 0.1);
}

.kpi-card.is-orange .kpi-icon {
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
}

.kpi-label {
  color: var(--dash-muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.kpi-value {
  color: #111827;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.kpi-card.is-cyan .kpi-value {
  color: var(--dash-cyan);
}

.kpi-unit {
  margin-left: 4px;
  color: var(--dash-muted);
  font-size: 13px;
  font-weight: 500;
}

.kpi-bar {
  height: 3px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.kpi-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.35), var(--dash-cyan));
}

.kpi-card.is-green .kpi-bar i {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.3), var(--dash-green));
}

.kpi-card.is-orange .kpi-bar i {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.3), #f97316);
}

.kpi-card.is-blue .kpi-bar i {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.3), #3b82f6);
}

.chart-row--main {
  grid-template-columns: 1.15fr 1fr;
  height: 272px;
}

.chart-row--three {
  grid-template-columns: 1.1fr 1.2fr 0.85fr;
  height: 300px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px 14px 10px;
}

.panel-title {
  position: relative;
  margin-bottom: 8px;
  padding-left: 10px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
}

.panel-title::before {
  position: absolute;
  top: 3px;
  left: 0;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--dash-cyan);
  content: '';
}

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

.chart-host {
  width: 100%;
  height: 100%;
  min-height: 180px;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.75);
  }
}

@media (max-width: 1600px) {
  .kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chart-row--three {
    grid-template-columns: 1fr 1fr;
    height: auto;
  }

  .panel-body {
    min-height: 210px;
  }
}

@media (max-width: 1100px) {
  .kpi-row,
  .chart-row--main,
  .chart-row--three {
    grid-template-columns: 1fr;
    height: auto;
  }

  .dash-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dash-header__right {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .ai-dashboard {
    padding: 12px;
    gap: 10px;
  }

  .dash-title {
    font-size: 18px;
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-value {
    font-size: 20px;
  }
}
