:root {
  --bg: #0b0d10;
  --bg-elev: #13171c;
  --bg-card: #171c22;
  --border: #22282f;
  --text: #e6edf3;
  --text-dim: #9aa4ad;
  --text-muted: #6b7480;
  --accent: #6ee7b7;
  --accent-dim: #2f8f6a;
  --warn: #f2c94c;
  --danger: #ef4444;
  --info: #60a5fa;
  --chip-pending: #3a414a;
  --chip-progress: #1d4f7b;
  --chip-done: #1f6f4e;
  --chip-blocked: #7c2d2d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; color: var(--text-dim); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6ee7b7 0%, #3b82f6 100%);
  box-shadow: 0 2px 12px rgba(110, 231, 183, 0.2);
}
.brand-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.brand-subtitle { font-size: 12px; color: var(--text-dim); }
.brand-subtitle code { font-size: 11px; }

.overall { display: flex; align-items: center; gap: 14px; }
.overall-pct {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.overall-label { font-size: 13px; color: var(--text-dim); text-align: right; }
.overall-label .tiny { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

.col-span-2 { grid-column: span 2; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.card h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 0 0 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.muted { font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; font-size: 12px; }

.phases { display: flex; flex-direction: column; gap: 10px; }
.phase {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--bg-elev);
}
.phase.phase-current { border-color: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-dim) inset; }
.phase-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.phase-name { font-weight: 500; font-size: 13px; }
.phase-pct {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-dim);
  min-width: 42px;
  text-align: right;
}

.bar {
  height: 6px;
  background: #20262d;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 100%); transition: width 0.4s ease; }
.bar-fill.pending { background: #3a414a; }

.tasks { margin-top: 10px; display: none; flex-direction: column; gap: 4px; }
.phase.expanded .tasks { display: flex; }
.task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.task:hover { background: rgba(255,255,255,0.02); }
.chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 70px;
  text-align: center;
}
.chip-pending { background: var(--chip-pending); color: #c2c8ce; }
.chip-in_progress { background: var(--chip-progress); color: #cfe3f7; }
.chip-completed { background: var(--chip-done); color: #d4f0e2; }
.chip-blocked { background: var(--chip-blocked); color: #fccfcf; }
.chip-failed { background: var(--chip-blocked); color: #fccfcf; }
.task-name { flex: 1; color: var(--text); }
.task-id { color: var(--text-muted); font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 10px; min-width: 28px; }

.agents, .health, .kpis { display: flex; flex-direction: column; gap: 10px; }
.agents .empty, .log .empty { color: var(--text-muted); font-size: 12px; padding: 8px 0; }

.agent-row, .health-row, .kpi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-elev);
  border-radius: 6px;
  font-size: 12px;
}
.agent-role {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(110, 231, 183, 0.12);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.agent-role.role-auditor { background: rgba(96, 165, 250, 0.12); color: var(--info); }
.agent-role.role-verifier { background: rgba(242, 201, 76, 0.12); color: var(--warn); }
.agent-activity { color: var(--text-dim); font-size: 11px; flex: 1; margin: 0 10px; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.dot-ok { background: var(--accent); box-shadow: 0 0 6px rgba(110, 231, 183, 0.4); }
.dot-warn { background: var(--warn); box-shadow: 0 0 6px rgba(242, 201, 76, 0.4); }
.dot-down, .dot-failed { background: var(--danger); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.dot-unknown { background: var(--text-muted); }
.dot-deploying { background: var(--info); animation: pulse 1.5s infinite; }
.dot-not_deployed { background: var(--chip-pending); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.health-service { font-weight: 500; }
.health-status { color: var(--text-dim); font-size: 11px; }

.health-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.health-group { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.health-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.health-group-count { font-size: 10px; color: var(--text-muted); font-weight: 400; }
.health-check {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
}
.health-check:last-child { border-bottom: none; }
.health-check-name { color: var(--text); }
.health-check-msg { color: var(--text-muted); font-size: 10px; margin-top: 2px; }
.health-check-meta { color: var(--text-muted); font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.health-check-meta .val { color: var(--text); font-weight: 500; }
.health-check.warn { background: rgba(242, 201, 76, 0.06); }
.health-check.crit { background: rgba(239, 68, 68, 0.08); }

.spark {
  width: 56px;
  height: 16px;
  vertical-align: middle;
  display: inline-block;
}
.uptime {
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-muted);
}
.uptime.warn { color: var(--warn); }
.uptime.crit { color: var(--danger); }
.health-summary-pill {
  display: inline-flex;
  gap: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.health-summary-pill .pill-ok { color: var(--accent); }
.health-summary-pill .pill-warn { color: var(--warn); }
.health-summary-pill .pill-crit { color: var(--danger); }

.kpi-metric { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.kpi-name { font-weight: 500; }
.kpi-thresholds { font-size: 10px; color: var(--text-muted); }
.kpi-current { font-variant-numeric: tabular-nums; font-weight: 600; }
.kpi-current.warn { color: var(--warn); }
.kpi-current.critical { color: var(--danger); }

.log { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 11px; max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.log-entry { display: flex; gap: 10px; padding: 3px 6px; border-radius: 4px; }
.log-entry:hover { background: rgba(255,255,255,0.02); }
.log-ts { color: var(--text-muted); min-width: 75px; }
.log-level { min-width: 52px; font-weight: 600; }
.log-level.info { color: var(--info); }
.log-level.warn { color: var(--warn); }
.log-level.error { color: var(--danger); }
.log-level.ok { color: var(--accent); }
.log-msg { color: var(--text); flex: 1; word-break: break-word; }

.foot {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 11px;
}
.foot .sep { margin: 0 6px; }

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; padding: 16px; }
  .col-span-2 { grid-column: span 1; }
  .topbar { padding: 14px 16px; }
  .overall-pct { font-size: 26px; }
}
