:root {
  --bg: #060a14;
  --bg-accent-a: #10233d;
  --bg-accent-b: #221339;
  --text-primary: #e6eeff;
  --text-secondary: #9db0cf;
  --text-dim: #7486a6;

  --surface-1: rgba(17, 24, 37, 0.92);
  --surface-2: #121b2a;
  --surface-3: #1a2537;
  --surface-4: #111827;
  --line: #2a3a54;
  --line-soft: #223149;

  --accent: #66d5ff;
  --accent-strong: #22d3ee;
  --accent-soft: rgba(102, 213, 255, 0.16);
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;

  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.24);
}

:root[data-theme="light"] {
  --bg: #f4f7fd;
  --bg-accent-a: #d7e7ff;
  --bg-accent-b: #fbe4e8;
  --text-primary: #0f1b2e;
  --text-secondary: #53698d;
  --text-dim: #6f7f99;

  --surface-1: rgba(255, 255, 255, 0.9);
  --surface-2: #ffffff;
  --surface-3: #f4f8ff;
  --surface-4: #f0f6ff;
  --line: #d4e0f2;
  --line-soft: #e5edf9;

  --accent: #0ea5e9;
  --accent-strong: #2563eb;
  --accent-soft: rgba(14, 165, 233, 0.14);
  --ok: #16a34a;
  --warn: #ca8a04;
  --bad: #dc2626;

  --shadow-lg: 0 18px 45px rgba(51, 75, 120, 0.12);
  --shadow-md: 0 8px 20px rgba(51, 75, 120, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text-primary);
  font-family: "Sora", "IBM Plex Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 15% 15%, var(--bg-accent-a) 0%, transparent 38%),
    radial-gradient(circle at 90% 10%, var(--bg-accent-b) 0%, transparent 42%),
    var(--bg);
}

body {
  position: relative;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(46px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.bg-shape-a {
  width: 420px;
  height: 420px;
  background: linear-gradient(145deg, #1f70ff, #2dd4bf);
  top: -120px;
  right: -120px;
}

.bg-shape-b {
  width: 340px;
  height: 340px;
  background: linear-gradient(145deg, #7c3aed, #ec4899);
  bottom: -100px;
  left: -100px;
}

.page {
  position: relative;
  z-index: 1;
  width: min(1760px, 95vw);
  margin: 0 auto;
  padding: 20px 0 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.brand-wrap {
  display: grid;
  gap: 8px;
}

.brand-kicker {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: clamp(25px, 3.2vw, 38px);
  line-height: 1.08;
}

.brand p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  width: fit-content;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 12px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.header-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
  min-width: 260px;
}

.action-btn {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(160deg, var(--surface-3), var(--surface-2));
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 13px;
  cursor: pointer;
  transition: 160ms ease;
}

.action-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.live-box {
  width: 100%;
  border: 1px solid var(--line-soft);
  background: var(--surface-3);
  border-radius: 11px;
  padding: 10px 12px;
}

.meta-line {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.control-strip {
  margin-top: 13px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  margin-right: 5px;
}

.chip-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 11px;
  cursor: pointer;
  transition: 140ms ease;
}

.chip-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.chip-btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.control-note {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

.metrics-wrap {
  margin-top: 16px;
}

.section-head {
  margin-bottom: 9px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.metric-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  box-shadow: var(--shadow-md);
}

.metric-label {
  display: block;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.metric-value {
  display: block;
  margin-top: 7px;
  font-size: 29px;
  line-height: 1;
  color: var(--text-primary);
}

.metric-sub {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 11px;
}

.workspace {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
}

.board-wrap {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 8px;
}

.board-header h2 {
  margin: 0;
  font-size: 18px;
}

.board-header p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.board-hint {
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-3);
  white-space: nowrap;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(285px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 0 6px;
}

.board::-webkit-scrollbar,
.feed-list::-webkit-scrollbar,
.lane-body::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.board::-webkit-scrollbar-thumb,
.feed-list::-webkit-scrollbar-thumb,
.lane-body::-webkit-scrollbar-thumb {
  background: #4c5c7a;
  border-radius: 999px;
}

.lane {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 340px;
}

.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-4);
  border-radius: 14px 14px 0 0;
  padding: 10px 10px 9px;
}

.lane-title {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.lane-count {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 2px 8px;
}

.lane-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 360px);
  overflow: auto;
}

.task-card {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 10px;
}

.task-card.stage-done {
  border-left-color: var(--ok);
}

.task-card.stage-failed {
  border-left-color: var(--bad);
}

.task-card.stage-inbox {
  border-left-color: var(--warn);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.task-id {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.stage-chip {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-4);
  color: var(--accent);
  padding: 3px 7px;
  font-weight: 600;
}

.task-title {
  margin: 8px 0 6px;
  font-size: 13px;
  line-height: 1.35;
}

.task-order {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.36;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.meta-pill {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-4);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.meta-pill strong {
  color: var(--text-primary);
  font-size: 10px;
}

.progress {
  margin-top: 8px;
  height: 7px;
  border-radius: 999px;
  background: #1b2a43;
  overflow: hidden;
}

:root[data-theme="light"] .progress {
  background: #e2ebfb;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #6366f1);
}

.sidepanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-block {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px;
  box-shadow: var(--shadow-md);
}

.panel-block.grow {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-head h3 {
  margin: 0;
  font-size: 14px;
}

.panel-head p {
  margin: 4px 0 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.agents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-item {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--surface-3);
  padding: 8px;
}

.agent-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.agent-role {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
}

.agent-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
}

.agent-status.busy {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.4);
}

.agent-status.assigned {
  background: rgba(102, 213, 255, 0.15);
  color: var(--accent);
  border-color: rgba(102, 213, 255, 0.4);
}

.agent-status.idle {
  background: rgba(74, 222, 128, 0.12);
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.35);
}

.agent-meta {
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.feed-list {
  min-height: 280px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
  border-left: 3px solid #5b79bd;
  border-radius: 10px;
  padding: 8px;
}

.feed-item.actor-hue {
  border-left-color: #22d3ee;
}

.feed-item.actor-orchestrator {
  border-left-color: #818cf8;
}

.feed-item.actor-dev {
  border-left-color: #f59e0b;
}

.feed-item.actor-qa {
  border-left-color: #34d399;
}

.feed-item.actor-release-manager {
  border-left-color: #fb7185;
}

.feed-item.actor-ops-guardian {
  border-left-color: #facc15;
}

.feed-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.feed-actor {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.feed-time {
  font-size: 10px;
  color: var(--text-dim);
}

.feed-message {
  margin: 6px 0 6px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-primary);
}

.feed-meta {
  font-size: 10px;
  color: var(--text-secondary);
}

.empty {
  color: var(--text-secondary);
  font-size: 12px;
  padding: 10px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-3);
}

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

  .workspace {
    grid-template-columns: 1fr 330px;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidepanel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .feed-list {
    max-height: 500px;
  }
}

@media (max-width: 820px) {
  .page {
    width: 96vw;
    padding-top: 10px;
  }

  .topbar {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-items: stretch;
  }

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

  .control-note {
    text-align: left;
  }

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

  .board {
    grid-auto-columns: minmax(260px, 1fr);
  }

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

