/* ─────────────────────────────────────────────────────────────────
   Dashboard styles — categories bar, agent panel, agent detail
   ─────────────────────────────────────────────────────────────── */

.dash {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Header strip with project info + master KPIs ───────────── */
.dash-head {
  border-bottom: 1px solid var(--border);
  padding: var(--gap-4) var(--gap-4) var(--gap-3);
  background: var(--bg);
}
.dash-head .top-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--gap-3); flex-wrap: wrap;
}
.proj-title { display: flex; flex-direction: column; gap: 6px; }
.proj-title h1 {
  font-size: 30px;
  display: flex; align-items: center; gap: 10px;
}
.proj-title h1 .live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 14px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.proj-title .sub-row {
  display: flex; align-items: center; gap: var(--gap-2);
  color: var(--muted); font-size: 13.5px;
}
.proj-title .sub-row .website { color: var(--accent); }

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: var(--gap-2);
  margin-top: var(--gap-3);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.kpi .label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.kpi .value {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi .delta { font-size: 11.5px; color: var(--accent); font-family: var(--font-mono); }
.kpi .delta.down { color: #ff8a4d; }
.kpi .spark { position: absolute; right: 8px; top: 14px; width: 56px; height: 24px; opacity: .8; }

/* ── Category bar (tabs at top) ────────────────────────────── */
.cat-bar {
  display: flex;
  gap: 4px;
  padding: var(--gap-2) var(--gap-4) 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 12px 16px 14px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.cat-tab:hover { color: var(--text-2); background: var(--surface-2); }
.cat-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: var(--surface);
}
.cat-tab .icon {
  color: var(--accent);
  font-size: 13px;
}
.cat-tab .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-hi);
}
.cat-tab.active .count { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ── Sub-toolbar above panel ───────────────────────────────── */
.panel-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap-2);
  padding: var(--gap-3) var(--gap-4);
  flex-wrap: wrap;
}
.panel-tools .left, .panel-tools .right {
  display: flex; align-items: center; gap: 10px;
}
.filter-pills { display: flex; gap: 6px; }
.filter-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
}
.filter-pill:hover { background: var(--surface); }
.filter-pill.on {
  background: var(--text); color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}
.view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  background: var(--surface);
}
.view-switch button {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.view-switch button.on { background: var(--surface-hi); color: var(--text); }

/* ── Agent panel — GRID view ───────────────────────────────── */
.agent-panel {
  padding: 0 var(--gap-4) var(--gap-4);
}
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap-2);
}
.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
  position: relative;
}
.agent-card:hover {
  border-color: var(--surface-hi);
  background: var(--surface-2);
}
.agent-card .top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.agent-card .num {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted-2);
  letter-spacing: 0.05em;
}
.agent-card .name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-top: 4px;
}
.agent-card .mission {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-card .kpi-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}
.agent-card .kpi-row .kv { display: flex; flex-direction: column; gap: 2px; }
.agent-card .kpi-row .kv .v {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.agent-card .kpi-row .kv .l {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.agent-card .spark-wrap { width: 88px; }
.agent-card .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--muted-2);
  font-family: var(--font-mono);
}
.agent-card .meta .deliv { color: var(--text-2); }
.agent-card .meta .deliv:hover { color: var(--accent); }

/* ── Agent panel — LIST view ───────────────────────────────── */
.agent-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.list-head, .list-row {
  display: grid;
  grid-template-columns: 48px minmax(180px, 2fr) minmax(140px, 1.4fr) 110px 1fr 80px 80px;
  align-items: center;
  gap: var(--gap-2);
  padding: 12px 18px;
}
.list-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.list-row {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13.5px;
  transition: background .12s ease;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .name { font-weight: 600; }
.list-row .mission { color: var(--muted); font-size: 12.5px; }
.list-row .deliv { color: var(--text-2); font-family: var(--font-mono); font-size: 12px; }
.list-row .cost { font-family: var(--font-mono); color: var(--muted); font-size: 12.5px; }
.list-row .kpi-v {
  font-family: var(--font-display); font-weight: 600;
  font-size: 17px; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.list-row .num { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.list-row .spark { width: 100%; }

/* ── Agent panel — KANBAN view ─────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-2);
}
.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 320px;
}
.kanban-col h4 {
  font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.kanban-col h4 .badge {
  font-family: var(--font-mono);
  background: var(--surface-hi);
  color: var(--text-2);
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  transition: border-color .12s ease;
}
.kanban-card:hover { border-color: var(--surface-hi); }
.kanban-card .name { font-weight: 600; font-size: 13.5px; }
.kanban-card .v {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.kanban-card .l {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.kanban-col[data-status="live"] { border-color: color-mix(in srgb, var(--status-live) 30%, var(--border)); }
.kanban-col[data-status="running"] { border-color: color-mix(in srgb, var(--status-running) 30%, var(--border)); }

/* ── Activity rail ─────────────────────────────────────────── */
.activity-rail {
  border-top: 1px solid var(--border);
  padding: var(--gap-3) var(--gap-4) var(--gap-5);
  margin-top: var(--gap-3);
}
.activity-rail h3 {
  font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: var(--gap-2);
}
.activity-log { display: flex; flex-direction: column; gap: 8px; }
.log-row {
  display: grid;
  grid-template-columns: 80px 22px 1fr;
  gap: 14px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.log-row .time { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.log-row .agent-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 2px 4px; border-radius: 4px;
  text-align: center;
}
.log-row .msg { color: var(--text-2); }
.log-row .msg b { color: var(--text); }

/* ── Agent detail (modal-ish, slides in) ───────────────────── */
.agent-detail-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  z-index: 40;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.agent-detail {
  position: fixed;
  top: 24px; right: 24px; bottom: 24px;
  width: min(680px, calc(100vw - 48px));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  z-index: 41;
  display: flex; flex-direction: column;
  animation: slideIn .25s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.agent-detail-head {
  padding: var(--gap-3) var(--gap-4);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--gap-2);
  background: var(--bg-soft);
}
.agent-detail-head .crumbs {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--muted); letter-spacing: 0.04em;
}
.agent-detail-head .crumbs .sep { color: var(--muted-2); }
.agent-detail-head .close {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
}
.agent-detail-head .close:hover { background: var(--surface); color: var(--text); }
.agent-detail-body {
  flex: 1;
  padding: var(--gap-4);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--gap-3);
}
.agent-detail-body h2 { font-size: 32px; }
.agent-detail-body .mission {
  color: var(--text-2);
  font-size: 16px; line-height: 1.5;
  max-width: 540px;
}
.detail-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--gap-3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-3);
}
.detail-kpi .big-v {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.detail-kpi .l {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 4px;
}
.detail-kpi .spark-big { height: 76px; width: 100%; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--gap-2);
}
.detail-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.detail-tile .l {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600;
}
.detail-tile .v { font-size: 15px; font-weight: 500; }
.detail-tile .v.mono { font-family: var(--font-mono); font-size: 13px; }
.deps { display: flex; flex-wrap: wrap; gap: 6px; }
.dep-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
}
.dep-chip:hover { border-color: var(--accent); color: var(--accent); }

.agent-actions {
  padding: var(--gap-3) var(--gap-4);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px;
  background: var(--bg-soft);
}

/* deliverable preview */
.deliv-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.deliv-preview-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-2);
}
.deliv-preview-head .dots { display: flex; gap: 5px; }
.deliv-preview-head .dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface-hi);
}
.deliv-preview-body {
  padding: var(--gap-3);
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  white-space: pre-wrap;
}
.deliv-preview-body .h { color: var(--text); font-weight: 600; display: block; margin-bottom: 6px; font-size: 13.5px; }
.deliv-preview-body .ac { color: var(--accent); }
.deliv-preview-body .mu { color: var(--muted); }

/* responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .tiers { grid-template-columns: repeat(2, 1fr); }
  .cats-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .onb { flex-direction: column; }
  .onb-side { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .tiers { grid-template-columns: 1fr; }
  .cats-grid { grid-template-columns: 1fr; }
  .list-head { display: none; }
  .list-row { grid-template-columns: 1fr; gap: 6px; }
  .kanban { grid-template-columns: 1fr; }
}
