/* Aigents Control A - premium dark ops dashboard styles. */

:root {
  --bg: #05070d;
  --panel: #0b0f19;
  --panel-2: #10162b;
  --panel-3: #151c33;
  --text: #e7ebf6;
  --text-2: #9aa4bf;
  --text-3: #657196;
  --accent: #5ee4ff;
  --accent-2: #8b5cf6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --executing: #34d399;
  --deploying: #60a5fa;
  --monitoring: #a78bfa;
  --reviewing: #f472b6;
  --blocked: #ef4444;
  --idle: #94a3b8;
  --border: rgba(148, 163, 184, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grid-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(94, 228, 255, 0.08), transparent 35%),
    radial-gradient(circle at 85% 90%, rgba(139, 92, 246, 0.06), transparent 30%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #000;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.04em;
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.brand small {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.system-pill.small {
  padding: 4px 8px;
  font-size: 10px;
}

.refresh-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(94, 228, 255, 0.08);
  border: 1px solid rgba(94, 228, 255, 0.22);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(94, 228, 255, 0.45);
}

.refresh-pill.loading .refresh-dot {
  animation: pulse 1.2s infinite;
}

.refresh-pill.error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.refresh-pill.error .refresh-dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 1.8s infinite;
}

.safe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(94, 228, 255, 0.35);
}

.clock {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  margin-bottom: 28px;
  align-items: start;
}

.hero-copy-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 10px;
}

h1,
h2 {
  margin: 0 0 12px;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.hero-copy {
  color: var(--text-2);
  max-width: 720px;
  margin: 0 0 20px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}

.exec-brief {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 18px;
  margin: 0 0 28px;
}

.exec-brief article {
  background: linear-gradient(180deg, rgba(16, 22, 43, 0.96), rgba(11, 15, 25, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.exec-brief span {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.exec-brief p,
.panel-subcopy {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.incident-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.incident-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-weight: 700;
}

.incident-card strong {
  font-size: 28px;
  color: var(--ok);
  text-transform: capitalize;
}

.incident-card small {
  color: var(--text-2);
}

.incident-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-3);
  overflow: hidden;
  margin-top: 4px;
}

.incident-meter span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width 0.4s ease;
}

.incident-meter span.warn {
  background: linear-gradient(90deg, var(--warn), var(--danger));
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.metrics article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.metrics article span {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.metrics article strong {
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  font-family: var(--mono);
}

.metrics article small {
  color: var(--text-3);
  font-size: 12px;
}

/* Ops panel */
.ops-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-head.compact {
  align-items: center;
  margin-bottom: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.executing-task,
.status-dot.executing,
.status-executing-task .status-dot,
.status-executing .status-dot {
  background: var(--executing);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

.status-dot.unknown,
.status-unknown .status-dot {
  background: var(--warn);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.55);
}

.status-dot.reviewing,
.status-reviewing .status-dot {
  background: var(--reviewing);
}

.status-dot.deploying,
.status-deploying .status-dot {
  background: var(--deploying);
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
}

.status-dot.monitoring,
.status-monitoring .status-dot {
  background: var(--monitoring);
}

.status-dot.blocked,
.status-blocked .status-dot {
  background: var(--blocked);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.status-dot.idle,
.status-idle .status-dot {
  background: var(--idle);
}

.validation-strip {
  font-size: 12px;
  color: var(--text-3);
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 18px;
  font-family: var(--mono);
}

/* Canvas */
.canvas-wrap {
  position: relative;
  background: linear-gradient(180deg, rgba(11, 15, 25, 0.6), rgba(11, 15, 25, 0.3));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 420px;
  overflow: hidden;
}

.links {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  color: rgba(148, 163, 184, 0.18);
}

.canvas {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.lane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lane-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  padding: 0 4px;
}

.lane-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(94, 228, 255, 0.4);
}

.lane-count {
  margin-left: auto;
  color: var(--text-3);
  font-family: var(--mono);
}

.lane-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.agent-card {
  position: relative;
  width: 220px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.card-pulse {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.status-executing-task .card-pulse,
.status-executing .card-pulse {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.5);
  animation: borderPulse 2s infinite;
}

.status-deploying .card-pulse {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.5);
  animation: borderPulse 2s infinite;
}

.status-blocked .card-pulse {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.5);
}

@keyframes borderPulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--panel-3);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--mono);
}

.card-meta {
  min-width: 0;
}

.card-meta strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta small {
  display: block;
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.task-value {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-line,
.usage-line,
.model-line {
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-line {
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 11px;
}

.model-line {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
}

.progress-track {
  height: 4px;
  background: var(--panel-3);
  border-radius: 999px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.latency {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}

/* Activity grid */
.activity-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  margin-bottom: 28px;
}

.feed-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}

.feed li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.feed time {
  font-family: var(--mono);
  color: var(--text-3);
  font-size: 11px;
  white-space: nowrap;
}

.feed strong {
  color: var(--accent);
}

.health-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.health-row {
  display: grid;
  grid-template-columns: 1fr 120px 42px;
  align-items: center;
  gap: 12px;
}

.health-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.health-info span {
  font-size: 13px;
  font-weight: 600;
}

.health-info small {
  font-size: 11px;
  color: var(--text-3);
}

.health-bar {
  height: 6px;
  background: var(--panel-3);
  border-radius: 999px;
  overflow: hidden;
}

.health-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.health-row strong {
  text-align: right;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text-2);
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-3);
  font-size: 12px;
  flex-wrap: wrap;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  padding: 40px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--panel);
}

::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Responsive */
@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .activity-grid {
    grid-template-columns: 1fr;
  }

  .exec-brief {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .agent-card {
    width: 100%;
  }

  .health-row {
    grid-template-columns: 1fr 80px 40px;
  }
}
