:root {
  color-scheme: dark;
  --bg: #101215;
  --panel: #181b20;
  --panel-2: #20242a;
  --line: #343b46;
  --text: #f5f7fa;
  --muted: #a9b0bb;
  --green: #57c78b;
  --red: #eb6a6a;
  --blue: #77a8ff;
  --gold: #efc15f;
  --teal: #68d0c7;
  --violet: #b596ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 780;
}

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

.status-strip {
  min-width: 300px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}

.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  min-height: 92px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metrics span,
.panel-head span,
small {
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  font-size: 30px;
  line-height: 1;
}

.grid {
  display: grid;
  grid-template-columns: 1.25fr .95fr;
  gap: 12px;
}

.panel {
  min-height: 320px;
  padding: 16px;
}

.panel.wide {
  grid-column: span 2;
  min-height: 280px;
}

.panel-head {
  height: 42px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.map {
  position: relative;
  min-height: 268px;
}

.agent-node {
  position: absolute;
  min-width: 230px;
  min-height: 76px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-node.primary {
  left: 20px;
  top: 94px;
  border-color: var(--blue);
}

.agent-node.bev { right: 24px; top: 18px; border-color: var(--teal); }
.agent-node.codex { right: 24px; top: 104px; border-color: var(--blue); }
.agent-node.claude { right: 24px; top: 190px; border-color: var(--violet); }

.node-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2f3640;
  color: var(--text);
  font-weight: 800;
}

.lane {
  position: absolute;
  left: 265px;
  right: 266px;
  height: 2px;
  background: var(--line);
}

.lane-one { top: 56px; transform: rotate(-13deg); }
.lane-two { top: 142px; }
.lane-three { top: 214px; transform: rotate(12deg); }

.agent-list,
.cron-list,
.session-rows,
.bars {
  display: grid;
  gap: 8px;
}

.agent-card,
.cron-row,
.session-row,
.bar-row {
  min-height: 58px;
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-card {
  grid-template-columns: 42px 1fr auto;
}

.agent-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #303846;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, var(--line)); }
.badge.error { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, var(--line)); }

.cron-row {
  grid-template-columns: minmax(210px, 1.4fr) 80px 110px minmax(180px, 1fr) minmax(160px, 1fr);
}

.session-row {
  grid-template-columns: minmax(160px, .8fr) minmax(220px, 1.3fr) 90px 110px 90px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #2b3038;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
}

.bar-row {
  grid-template-columns: minmax(180px, 1fr) 2fr 42px;
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .topbar,
  .status-strip {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .panel.wide {
    grid-column: span 1;
  }

  .cron-row,
  .session-row,
  .bar-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .map {
    min-height: 390px;
  }

  .agent-node {
    left: 0 !important;
    right: 0 !important;
    width: 100%;
  }

  .agent-node.primary { top: 0; }
  .agent-node.bev { top: 94px; }
  .agent-node.codex { top: 188px; }
  .agent-node.claude { top: 282px; }
  .lane { display: none; }
}
