/* Screen 01 — Tổng quan */
.page-wrap { gap: 9px; padding: 10px 20px 14px; }
.kpi-card { padding: 9px 14px; }
.kpi-value { font-size: 21px; }
.card { padding: 10px 14px; }
.card-head { margin-bottom: 7px; }
.ai-banner { padding: 8px 14px; }

.pipeline-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
}
.pipeline-intro {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  flex-shrink: 0;
}
.pipeline-intro-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pipeline-intro-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.pipeline-intro-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.pipeline-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.stage-node {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.stage-node:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(18, 32, 58, 0.06);
}
.stage-node.done {
  background: #effaf3;
  border-color: var(--ok-border);
}
.stage-node.running {
  background: #edf4ff;
  border-color: #7eb0fb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.stage-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.stage-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.stage-node.done .stage-status { color: var(--ok); }
.stage-node.running .stage-status { color: var(--blue); }
.stage-arrow {
  color: #7b8ba3;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

@keyframes spinRing {
  to { transform: rotate(360deg); }
}
.spin-ring {
  animation: spinRing 1.4s linear infinite;
  transform-origin: center;
}

/* Middle 2-Column Grid */
.mid-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.section-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sub-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.sub-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

/* Approval & Bottleneck Lists */
.list-rows {
  display: flex;
  flex-direction: column;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #eef2f8;
  transition: background 0.12s;
  border-radius: 6px;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f8fafe; }
.row-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}
.row-check {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.row-label.approved {
  color: var(--muted);
  text-decoration: line-through;
}
.row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.row-chevron {
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 2px 4px;
}

/* AI Running Jobs */
.job-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.job-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.02fr) minmax(135px, 1.22fr) 38px 98px;
  align-items: center;
  gap: 10px;
}
.job-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.job-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.job-icon.blue { background: var(--blue-soft); color: var(--blue); }
.job-icon.ok { background: var(--ok-soft); color: var(--ok); }
.job-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-desc {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-pct {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* System Connections */
.conn-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.conn-card {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.conn-card:hover {
  background: #f0f5ff;
  border-color: var(--blue-border);
}
.conn-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #16a34a;
  flex-shrink: 0;
}
.conn-state {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
}

/* AI Recommendation Banner */
.ai-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ai-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #e5dfff;
  color: var(--ai);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.ai-banner-sub {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 1px;
}

/* Bottom Champion & Benchmark Section */
.bottom-grid {
  display: grid;
  grid-template-columns: 0.92fr 1.15fr;
  gap: 20px;
  align-items: stretch;
}
.champion-box {
  background: #f8fbff;
  border: 1px solid #e1e8f5;
  border-radius: 10px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.champion-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.champion-body {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.champion-model {
  display: flex;
  align-items: center;
  gap: 12px;
}
.champion-model-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
}
.champion-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.champion-metrics {
  display: flex;
  align-items: center;
  gap: 24px;
}
.champ-stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.champ-stat-val {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.champ-stat-delta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ok);
  margin-top: 2px;
}

/* Benchmark Chart */
.chart-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chart-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.chart-select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: 600 12px var(--font-sans);
  cursor: pointer;
}
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-svg {
  width: 100%;
  height: auto;
  max-height: 126px;
  display: block;
  overflow: visible;
}
.chart-node {
  cursor: pointer;
  transition: r 0.12s;
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #162033;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.35;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translate(-50%, -115%);
  transition: opacity 0.12s;
  white-space: nowrap;
  z-index: 20;
}
.chart-tooltip.visible { opacity: 1; }

@media (max-width: 1180px) {
  .pipeline-card { flex-direction: column; align-items: stretch; }
  .pipeline-track { flex-wrap: wrap; }
  .mid-grid, .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .conn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-row { grid-template-columns: 1fr auto; }
  .job-row .progress-track { display: none; }
}
