/* === Dashboard: Metrics Grid, Pipeline, Priority Lists === */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s;
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 500;
}

#metric-total .metric-value { color: var(--text); }
#metric-b24 .metric-value { color: var(--status-dev); }
#metric-bus .metric-value { color: var(--status-spec); }
#metric-published .metric-value { color: var(--status-published); }
#metric-blockers .metric-value { color: var(--status-test); }
#metric-revenue .metric-value { color: var(--status-package); }

/* --- Pipeline (10 stages) --- */
.pipeline-scroll-wrapper {
  margin-bottom: 28px;
  overflow: visible;
}

.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  min-width: 68px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: transform 0.15s;
  cursor: pointer;
  flex-shrink: 0;
}

.pipeline-stage:hover {
  transform: scale(1.06);
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.pipeline-stage[data-status="IDEA"] { background: var(--status-idea-bg); color: var(--status-idea); }
.pipeline-stage[data-status="RESEARCH"] { background: var(--status-research-bg); color: var(--status-research); }
.pipeline-stage[data-status="SPEC"] { background: var(--status-spec-bg); color: var(--status-spec); }
.pipeline-stage[data-status="DEV"] { background: var(--status-dev-bg); color: var(--status-dev); }
.pipeline-stage[data-status="TEST"] { background: var(--status-test-bg); color: var(--status-test); }
.pipeline-stage[data-status="DOCS"] { background: var(--status-docs-bg); color: var(--status-docs); }
.pipeline-stage[data-status="PACKAGE"] { background: var(--status-package-bg); color: var(--status-package); }
.pipeline-stage[data-status="REVIEW"] { background: var(--status-review-bg); color: var(--status-review); }
.pipeline-stage[data-status="PUBLISHED"] { background: var(--status-published-bg); color: var(--status-published); }
.pipeline-stage[data-status="PROMO"] { background: var(--status-promo-bg); color: var(--status-promo); }

.stage-count {
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stage-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 4px;
  font-weight: 600;
}

.pipeline-arrow {
  width: 8px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  border-radius: 1px;
}

/* --- Priority Lists --- */
.priority-section h3 {
  margin: 24px 0 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.priority-section h3:first-child {
  margin-top: 0;
}

.priority-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  font-size: 0.875rem;
}

.priority-item:hover {
  background: var(--surface-hover);
  box-shadow: var(--shadow-sm);
}

.priority-item-name {
  flex: 1;
  color: var(--text);
}

.priority-item-month {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 500;
}

.blocker-icon {
  color: var(--status-test);
  font-size: 0.9rem;
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .metric-value {
    font-size: 1.6rem;
  }

  .pipeline {
    padding: 16px;
    gap: 4px;
  }

  .pipeline-stage {
    min-width: 80px;
    padding: 10px 14px;
  }

  .stage-count {
    font-size: 1.2rem;
  }

  .pipeline-arrow {
    width: 10px;
  }
}

/* === Dashboard panels (Docker, Keys, Claude) === */
.dash-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
  margin-top: 20px;
}

.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dash-panel-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-hover);
}

.dash-panel-icon {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

.dash-panel-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  flex: 1;
}

.dash-panel-refresh {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.dash-panel-refresh:hover { color: var(--accent); }

.dash-panel-link {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: 4px;
  transition: color 0.15s;
  text-decoration: none;
}
.dash-panel-link:hover { color: var(--accent); }

.dash-panel-body {
  padding: 12px 16px 14px;
}

.dash-loading {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  padding: 8px 0;
}

/* Docker rows */
.dash-docker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.dash-docker-row:last-child { border-bottom: none; }

.dash-stack-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.dash-stack-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-stack-status.running { background: var(--status-published-bg); color: var(--status-published); }
.dash-stack-status.stopped { background: var(--status-test-bg); color: var(--status-test); }
.dash-stack-status.partial { background: var(--status-review-bg); color: var(--status-review); }
.dash-stack-status.not_created { background: var(--border-light); color: var(--text-tertiary); }

.dash-stack-actions {
  display: flex;
  gap: 4px;
}
.dash-stack-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.dash-stack-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* API key rows */
.dash-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
}
.dash-key-row:last-child { border-bottom: none; }

.dash-key-name {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.dash-key-svc {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.dash-key-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-key-dot.ok { background: var(--status-published); }
.dash-key-dot.warn { background: var(--status-review); }
.dash-key-dot.empty { background: var(--border); }

/* Claude status rows */
.dash-claude-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
}
.dash-claude-row:last-child { border-bottom: none; }
.dash-claude-label {
  flex: 1;
  color: var(--text-secondary);
}
.dash-claude-value {
  color: var(--text);
  font-weight: 500;
  font-size: 0.82rem;
}
.dash-claude-ok { color: var(--status-published); font-weight: 600; }
.dash-claude-warn { color: var(--status-test); font-weight: 600; }

/* TEST projects section */
.dash-section-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.dash-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.dash-section-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--status-test-bg);
  color: var(--status-test);
}

.dash-section-link {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}
.dash-section-link:hover { text-decoration: underline; }

.dash-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.dash-test-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.dash-test-id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  flex-shrink: 0;
}

.dash-test-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-test-mp {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.dash-test-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dash-test-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.dash-test-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.dash-test-btn.deploy { border-color: var(--status-published); color: var(--status-published); }
.dash-test-btn.deploy:hover { background: var(--status-published); color: white; }

.dash-empty {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  padding: 16px 0;
  text-align: center;
}

@media (max-width: 1100px) {
  .dash-panels {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .dash-panels {
    grid-template-columns: 1fr;
  }
}
