/* ============================================
   智能分析看板 - 深色科技风 CSS
   Author: AI, 2026-07-20
   注入位置: index.html head
   ============================================ */

/* === 根容器 === */
.dash-root {
  position: relative;
  min-height: 100vh;
  background: #020617; /* slate-950 */
  background-image:
    radial-gradient(ellipse at top left, rgba(34, 211, 238, 0.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.08), transparent 50%),
    linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  background-attachment: fixed;
  padding: 16px;
  color: #e2e8f0; /* slate-200 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* === 头部扁平横条（无卡片） === */
.dash-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 8px 4px 12px 4px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.15);
  margin-bottom: 4px;
}
.dash-body { padding: 0 4px; }
.dash-spacer { flex: 1 1 auto; }
.dash-header-bar .dash-title { margin: 0; line-height: 1.2; }
.dash-header-bar .dash-meta { margin-top: 0; }
.dash-header-bar .dash-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #06b6d4, #9333ea);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.5);
  color: white;
}
.dash-title {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(90deg, #67e8f9, #d8b4fe, #f9a8d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.05em;
}
.dash-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.dash-meta-date {
  font-size: 12px;
  color: rgba(103, 232, 249, 0.85);
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.dash-meta-time {
  font-size: 12px;
  color: rgba(216, 180, 252, 0.85);
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.dash-live-tag {
  padding: 2px 8px;
  font-size: 10px;
  border-radius: 9999px;
  background: rgba(34, 211, 238, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(34, 211, 238, 0.4);
  font-weight: 500;
  letter-spacing: 0.05em;
}
.dash-period-label {
  font-size: 12px;
  color: rgba(216, 180, 252, 0.85);
}
.dash-period-select {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #a5f3fc;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}
.dash-period-select:focus {
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.4);
}
.dash-period-select option {
  background: #0f172a;
  color: #a5f3fc;
}
.dash-refresh-btn {
  padding: 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #67e8f9;
  cursor: pointer;
  transition: all 0.2s;
}
.dash-refresh-btn:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.6);
}
.dash-refresh-btn.spin svg {
  animation: dash-spin 1s linear infinite;
}
@keyframes dash-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* === Tab 切换 === */
.dash-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.dash-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.dash-tab:hover {
  color: #67e8f9;
  background: rgba(30, 41, 59, 0.4);
}
.dash-tab.active {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.2), rgba(168, 85, 247, 0.2));
  color: white;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
}

/* === KPI 卡片网格 === */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1024px) { .dash-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* === 单个 KPI 卡片 === */
.dash-kpi-card {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 14px;
  transition: all 0.3s;
}
.dash-kpi-card:hover {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.2);
}
.dash-kpi-glow {
  position: absolute;
  top: -48px;
  right: -48px;
  width: 128px;
  height: 128px;
  border-radius: 9999px;
  filter: blur(32px);
  opacity: 0.15;
  transition: opacity 0.3s;
  pointer-events: none;
}
.dash-kpi-card:hover .dash-kpi-glow {
  opacity: 0.3;
}
.dash-kpi-label-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}
.dash-kpi-label {
  font-size: 11px;
  color: #e2e8f0 !important;
  letter-spacing: 0.05em;
}
.dash-kpi-icon {
  font-size: 16px;
  opacity: 0.9;
}
.dash-kpi-value-row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.dash-kpi-value {
  font-size: 24px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, monospace;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.dash-kpi-unit {
  font-size: 11px;
  color: #cbd5e1 !important;
}
.dash-kpi-sub {
  position: relative;
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === 渐变预设 === */
.g-cyan-blue { background-image: linear-gradient(90deg, #22d3ee, #3b82f6); }
.g-blue-indigo { background-image: linear-gradient(90deg, #60a5fa, #6366f1); }
.g-emerald-teal { background-image: linear-gradient(90deg, #34d399, #14b8a6); }
.g-purple-fuchsia { background-image: linear-gradient(90deg, #c084fc, #d946ef); }
.g-amber-orange { background-image: linear-gradient(90deg, #fbbf24, #f97316); }
.g-pink-rose { background-image: linear-gradient(90deg, #f472b6, #f43f5e); }
.g-violet-purple { background-image: linear-gradient(90deg, #a78bfa, #a855f7); }
.g-red-rose { background-image: linear-gradient(90deg, #fb7185, #e11d48); }
.g-orange-amber { background-image: linear-gradient(90deg, #fb923c, #f59e0b); }
.g-orange-red { background-image: linear-gradient(90deg, #fb923c, #ef4444); }
.g-slate { background-image: linear-gradient(90deg, #94a3b8, #64748b); }
.g-red-strong { background-image: linear-gradient(90deg, #ef4444, #dc2626); }

/* === 明细卡片 === */
.dash-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1024px) { .dash-detail-grid { grid-template-columns: 1fr; } }

.dash-detail-card {
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.6));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(34, 211, 238, 0.3);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}
.dash-detail-card.over {
  border-color: rgba(244, 63, 94, 0.3);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.1);
}
.dash-detail-head {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.2);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.1), rgba(168, 85, 247, 0.1));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-detail-head.over {
  border-bottom-color: rgba(244, 63, 94, 0.2);
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.1), rgba(249, 115, 22, 0.1));
}
.dash-detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-detail-bar {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, #22d3ee, #a855f7);
}
.dash-detail-bar.over {
  background: linear-gradient(180deg, #fb7185, #f97316);
}
.dash-detail-title {
  font-size: 14px;
  font-weight: 600;
  color: #67e8f9 !important;
}
.dash-detail-title.over { color: #fda4af !important; }
.dash-detail-count {
  font-size: 11px;
  color: #cbd5e1 !important;
}
.dash-detail-sort {
  font-size: 12px;
  color: #67e8f9 !important;
  font-family: ui-monospace, monospace;
}
.dash-detail-sort.over { color: #fda4af !important; }

/* === 表格 === */
.dash-table-wrap {
  overflow: auto;
  max-height: 400px;
}
.dash-table {
  min-width: 100%;
  font-size: 13px;
  border-collapse: collapse;
  width: 100%;
}
.dash-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dash-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: #67e8f9 !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid rgba(34, 211, 238, 0.2);
}
.dash-table th.over { color: rgba(244, 63, 94, 0.8); border-bottom-color: rgba(244, 63, 94, 0.2); }
.dash-table td {
  padding: 8px 12px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}
.dash-table tbody tr {
  transition: background 0.15s;
}
.dash-table tbody tr:hover {
  background: rgba(34, 211, 238, 0.05);
}
.dash-td-group { color: #67e8f9 !important; font-size: 11px; }
.dash-td-order { color: #f1f5f9 !important; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 600; }
.dash-td-project { color: #e2e8f0 !important; font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.dash-td-num { color: #f1f5f9 !important; font-size: 12px; text-align: right; font-family: ui-monospace, monospace; }
.dash-td-num.budget { color: #cbd5e1 !important; }
.dash-td-progress {
  min-width: 100px;
}
.dash-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 9999px;
  overflow: hidden;
  min-width: 50px;
}
.dash-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #22d3ee, #34d399);
  transition: width 0.3s;
}
.dash-progress-fill.warn {
  background: linear-gradient(90deg, #f59e0b, #facc15);
}
.dash-progress-fill.over {
  background: linear-gradient(90deg, #ef4444, #fb7185);
}
.dash-progress-text {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  white-space: nowrap;
  color: #34d399 !important;
}
.dash-progress-text.warn { color: #fbbf24 !important; }
.dash-progress-text.over { color: #f87171 !important; font-weight: 600; }
.dash-progress-row { display: flex; align-items: center; gap: 6px; }
.dash-td-status {
  text-align: center;
}
.dash-status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  border: 1px solid;
  white-space: nowrap;
}
.dash-status-completed {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}
.dash-status-active {
  background: rgba(34, 211, 238, 0.2);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.4);
}
.dash-status-paused {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}
.dash-status-cancelled {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
.dash-status-other {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border-color: rgba(100, 116, 139, 0.4);
}
.dash-empty {
  padding: 32px 16px;
  text-align: center;
  color: #94a3b8 !important;
  font-size: 13px;
}

/* === 错误提示 === */
.dash-error {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-size: 13px;
}

/* === 加载中 === */
.dash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  color: rgba(34, 211, 238, 0.7);
  font-size: 13px;
}
.dash-loading svg {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  animation: dash-spin 1s linear infinite;
}

/* === 平铺双表（订单情况 / 工时情况） === */
.dash-tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1024px) { .dash-tile-grid { grid-template-columns: 1fr; } }

.dash-detail-card.tile {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.12);
}
.dash-detail-card.tile .dash-detail-head {
  border-bottom-color: rgba(99, 102, 241, 0.25);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.10), rgba(34, 211, 238, 0.10));
}
.dash-detail-card.tile .dash-detail-bar {
  background: linear-gradient(180deg, #6366f1, #22d3ee);
}

.dash-table-tile {
  font-size: 13px;
}
.dash-table-tile thead {
  position: static;
}
.dash-table-tile th {
  font-size: 11px;
  color: #67e8f9 !important;
}
.dash-table-tile td {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: #f8fafc !important;
}
.dash-table-tile tbody tr td:first-child {
  color: #f8fafc !important;
}
.dash-table-tile tbody tr:first-child td {
  /* 让产品组行不要太抢眼 */
}