/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0A0A0B;
  --bg-raised:  #111114;
  --bg-hover:   #18181C;
  --border:     rgba(255, 255, 255, 0.07);
  --border-m:   rgba(255, 255, 255, 0.12);
  --text:       #E4E4E7;
  --text-muted: #71717A;
  --text-dim:   #3F3F46;
  --accent:     #00D4FF;
  --accent-dim: rgba(0, 212, 255, 0.12);
  --green:      #22C55E;
  --green-dim:  rgba(34, 197, 94, 0.12);
  --red:        #EF4444;
  --red-dim:    rgba(239, 68, 68, 0.12);
  --yellow:     #EAB308;
  --yellow-dim: rgba(234, 179, 8, 0.12);
  --radius:     6px;
  --radius-lg:  10px;
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-m); border-radius: 2px; }

/* ─── Typography ─────────────────────────────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo {
  width: 28px;
  height: 28px;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.header-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
}

.header-title span {
  color: var(--text-muted);
  font-weight: 400;
}

.header-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.header-status-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  transition: all 150ms ease;
}

.header-status-badge.all-good {
  background: var(--green-dim);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--green);
}

.header-status-badge.degraded {
  background: var(--yellow-dim);
  border-color: rgba(234, 179, 8, 0.2);
  color: var(--yellow);
}

.header-status-badge.outage {
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--red);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-updated {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Countdown ring */
.refresh-ring {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.refresh-ring svg {
  transform: rotate(-90deg);
}

.refresh-ring circle.track {
  fill: none;
  stroke: var(--border-m);
  stroke-width: 2.5;
}

.refresh-ring circle.progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.refresh-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.refresh-ring:hover .refresh-icon { color: var(--accent); }

/* ─── Main Content ───────────────────────────────────────────────────────── */
#main {
  flex: 1;
  padding: 28px 0 48px;
}

/* ─── Section headers ────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-count {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Status dot ─────────────────────────────────────────────────────────── */
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.gray { background: var(--text-dim); }

.dot.pulse-green {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  animation: pulse-green 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dot.pulse-red {
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  animation: pulse-red 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 150ms ease;
}

.card:hover { border-color: var(--border-m); }

/* ─── Projects Grid ──────────────────────────────────────────────────────── */
#projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.project-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 150ms ease;
  position: relative;
  overflow: hidden;
}

.project-card:hover { border-color: var(--border-m); }

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 150ms ease;
}

.project-card.healthy::before { background: var(--green); opacity: 1; }
.project-card.degraded::before { background: var(--yellow); opacity: 1; }
.project-card.down::before { background: var(--red); opacity: 1; }

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.project-domain {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.project-meta-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.meta-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  width: 54px;
  flex-shrink: 0;
  padding-top: 1px;
}

.meta-value {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.meta-value .commit-msg {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.meta-value .commit-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Response time badge */
.response-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.response-badge.fast {
  background: var(--green-dim);
  color: var(--green);
}

.response-badge.medium {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.response-badge.slow {
  background: var(--red-dim);
  color: var(--red);
}

/* Smoke test indicator */
.smoke-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.smoke-indicator.pass {
  background: var(--green-dim);
  color: var(--green);
}

.smoke-indicator.fail {
  background: var(--red-dim);
  color: var(--red);
}

.smoke-indicator.running {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
}

/* Run smoke button */
.run-smoke-btn {
  margin-top: 4px;
  width: 100%;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}

.run-smoke-btn:hover {
  border-color: var(--border-m);
  color: var(--text);
  background: var(--bg-hover);
}

.run-smoke-btn:active {
  transform: scale(0.98);
}

.run-smoke-btn.running {
  border-color: rgba(0, 212, 255, 0.25);
  color: var(--accent);
}

.run-smoke-btn.disabled, .run-smoke-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Infra Panel ─────────────────────────────────────────────────────────── */
.infra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.infra-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.infra-card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* CPU load */
.load-meters {
  display: flex;
  gap: 16px;
}

.load-meter {
  flex: 1;
  text-align: center;
}

.load-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
  transition: color 300ms ease;
}

.load-value.warn { color: var(--yellow); }
.load-value.crit { color: var(--red); }

.load-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Bar meters */
.bar-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-item {}

.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.bar-label {
  font-size: 11px;
  color: var(--text-muted);
}

.bar-numbers {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-fill.warn { background: var(--yellow); }
.bar-fill.crit { background: var(--red); }
.bar-fill.green { background: var(--green); }

/* ─── Deploy Feed ─────────────────────────────────────────────────────────── */
.deploy-list {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.deploy-item {
  display: grid;
  grid-template-columns: 100px 80px 1fr 56px 28px;
  align-items: start;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 150ms ease;
}

.deploy-item:last-child { border-bottom: none; }
.deploy-item:hover { background: var(--bg-hover); }

.deploy-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.deploy-project {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  padding-top: 2px;
}

.deploy-commit {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deploy-commit-hash {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
}

.deploy-commit-msg {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.deploy-duration {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  padding-top: 2px;
}

.deploy-status-icon {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 2px;
}

/* Status icons SVG */
.icon-success { color: var(--green); }
.icon-failure { color: var(--red); }
.icon-smoke-fail { color: var(--yellow); }
.icon-running { color: var(--accent); }

/* ─── Containers Table ───────────────────────────────────────────────────── */
.containers-table {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  display: grid;
  grid-template-columns: 200px 1fr 100px 100px 80px;
  gap: 12px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
}

.th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

.container-row {
  display: grid;
  grid-template-columns: 200px 1fr 100px 100px 80px;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 150ms ease;
}

.container-row:last-child { border-bottom: none; }
.container-row:hover { background: var(--bg-hover); }
.container-row.unhealthy { background: rgba(239, 68, 68, 0.04); }

.container-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.container-status {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.container-stat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Two-column layout sections ─────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.full-col {
  grid-column: 1 / -1;
}

/* ─── Sections spacing ────────────────────────────────────────────────────── */
.section { margin-bottom: 32px; }

/* ─── Skeleton ───────────────────────────────────────────────────────────── */
.skeleton {
  background: var(--border);
  border-radius: 4px;
  animation: shimmer 1.5s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: shimmer-slide 1.5s ease-in-out infinite;
}

@keyframes shimmer-slide {
  100% { transform: translateX(100%); }
}

/* ─── Empty/Error states ─────────────────────────────────────────────────── */
.state-message {
  padding: 32px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.state-message.error { color: var(--red); }

/* ─── Number animate ─────────────────────────────────────────────────────── */
.num-change {
  animation: num-pop 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes num-pop {
  0% { transform: scale(1.15); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Loading spinner (only for run-smoke) ───────────────────────────────── */
.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ─── Login page ─────────────────────────────────────────────────────────── */
#login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  width: 360px;
  padding: 36px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.login-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color 150ms ease;
  margin-bottom: 16px;
}

.login-input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #000;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.login-btn:hover { opacity: 0.9; }
.login-btn:active { transform: scale(0.98); }

.login-error {
  margin-top: 12px;
  font-size: 12px;
  color: var(--red);
  text-align: center;
  min-height: 16px;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  #projects-grid { grid-template-columns: repeat(2, 1fr); }
  .infra-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .deploy-item { grid-template-columns: 100px 80px 1fr 60px 32px; gap: 8px; }
  .table-header, .container-row { grid-template-columns: 160px 1fr 90px 90px 70px; }
}

@media (max-width: 768px) {
  .container { padding: 0 16px; }
  #projects-grid { grid-template-columns: 1fr; }
  .header-inner { gap: 12px; }
  .header-sep { display: none; }
  .last-updated { display: none; }
  .deploy-item { grid-template-columns: 90px 70px 1fr 28px; gap: 8px; }
  .deploy-duration { display: none; }
  .table-header, .container-row { grid-template-columns: 140px 1fr 70px 70px; }
  .th:last-child, .container-stat:last-child { display: none; }
  .load-value { font-size: 20px; }
}

@media (max-width: 480px) {
  .deploy-time { display: none; }
  .deploy-item { grid-template-columns: 80px 1fr 28px; }
  .table-header, .container-row { grid-template-columns: 120px 1fr 60px; }
}

/* ─── Header Nav Tabs ────────────────────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-badge {
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Agents Summary Bar ─────────────────────────────────────────────────── */
.agents-summary {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.agents-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 100px;
}

.agents-summary-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 24px;
}

.agents-summary-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-summary-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

/* ─── Office Floor ───────────────────────────────────────────────────────── */
.office-floor {
  /* Pixel art floor: subtle grid lines */
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 400px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px;
  align-content: start;
  position: relative;
}

.office-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
}

.office-empty-icon {
  font-size: 32px;
  opacity: 0.3;
}

/* ─── Agent Card ─────────────────────────────────────────────────────────── */
.agent-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 150ms ease, box-shadow 150ms ease;
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.agent-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-m);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.agent-card:active {
  transform: translateY(0) scale(0.98);
}

/* State: active — cyan pulsing border */
.agent-card.state-active {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.15);
  animation: card-pulse-border 2.5s ease infinite;
}

/* State: idle — dimmed */
.agent-card.state-idle {
  border-color: var(--border);
  opacity: 0.85;
}

/* State: stale — very dim, desaturated */
.agent-card.state-stale {
  border-color: rgba(255, 255, 255, 0.04);
  opacity: 0.45;
  filter: saturate(0.3);
}

@keyframes card-pulse-border {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.15); }
  50%       { box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08); }
}

/* Top accent line */
.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 150ms;
}

.agent-card.state-active::before {
  background: var(--accent);
  opacity: 1;
}

.agent-card.state-idle::before {
  background: var(--text-dim);
  opacity: 0.5;
}

/* ─── Agent Card: Avatar row ─────────────────────────────────────────────── */
.agent-avatar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.agent-avatar {
  width: 36px;
  height: 36px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  /* Pixel art: no border-radius on inner for that sharp look */
  image-rendering: pixelated;
}

.agent-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.agent-badge.sprint {
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.agent-badge.running {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.agent-badge.live {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ─── Agent Card: Speech bubble (active only) ────────────────────────────── */
.agent-speech {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--accent);
  min-height: 16px;
}

.agent-speech.hidden { opacity: 0; }

.typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.2s ease infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* ─── Agent Card: Info rows ──────────────────────────────────────────────── */
.agent-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.agent-info-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.agent-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.agent-info-activity {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.agent-pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.state-active .agent-pulse-dot {
  background: var(--accent);
  animation: pulse-cyan 2s ease infinite;
}

.state-idle .agent-pulse-dot { background: var(--text-dim); }
.state-stale .agent-pulse-dot { background: var(--text-dim); opacity: 0.4; }

@keyframes pulse-cyan {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
  50%       { box-shadow: 0 0 0 4px rgba(0, 212, 255, 0); }
}

.agent-tokens {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.agent-time {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Agent Detail Panel ─────────────────────────────────────────────────── */
.agent-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
}

.agent-panel.open {
  display: flex;
}

.agent-panel-inner {
  background: var(--bg-raised);
  border: 1px solid var(--border-m);
  border-radius: var(--radius-lg);
  width: 360px;
  max-width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.agent-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.agent-panel-avatar {
  width: 40px;
  height: 40px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.agent-panel-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.agent-panel-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.agent-panel-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 150ms ease;
}

.agent-panel-close:hover {
  color: var(--text);
  border-color: var(--border-m);
}

.agent-panel-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.panel-row-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

.panel-row-value {
  font-size: 12px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}

.panel-row-value.normal {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

/* ─── Mobile responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .office-floor {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 14px;
  }

  .agents-summary {
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 16px;
  }

  .agents-summary-sep { display: none; }

  .agents-summary-stat {
    flex: 0 0 calc(50% - 8px);
  }

  .agent-panel-inner {
    width: 100%;
  }
}
