:root {
  color-scheme: dark;
  --bg: #09111f;
  --panel: rgba(17, 27, 46, .86);
  --panel-2: rgba(25, 38, 62, .96);
  --line: rgba(148, 163, 184, .18);
  --text: #e5eefc;
  --muted: #8ea0b8;
  --brand: #7c3aed;
  --brand-2: #06b6d4;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #38bdf8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(124, 58, 237, .24), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(6, 182, 212, .18), transparent 30rem),
    var(--bg);
  color: var(--text);
  display: flex;
}
button, input, textarea, select { font: inherit; }
.sidebar {
  width: 292px;
  border-right: 1px solid var(--line);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(5, 10, 20, .62);
  backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.logo {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 900; letter-spacing: -.08em;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; }
.brand p, .muted { color: var(--muted); }
.helper-copy { margin: -4px 0 14px; line-height: 1.45; }
nav { display: grid; gap: 8px; }
.nav {
  text-align: left; color: var(--muted); background: transparent; border: 1px solid transparent;
  padding: 12px 14px; border-radius: 14px; cursor: pointer;
}
.nav:hover, .nav.active { color: var(--text); background: rgba(124, 58, 237, .16); border-color: rgba(124, 58, 237, .32); }
.sidebar-card {
  position: absolute; left: 24px; right: 24px; bottom: 24px;
  padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel);
}
.sidebar-card p { color: var(--muted); font-size: 13px; margin-top: 8px; line-height: 1.45; }
main { flex: 1; padding: 28px; max-width: 1500px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; gap: 16px; }
.eyebrow { color: var(--brand-2); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; }
h2 { font-size: 32px; letter-spacing: -.04em; margin-top: 4px; }
.actions { display: flex; gap: 10px; }
.profile-picker { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.profile-picker select { width: auto; min-width: 150px; padding: 9px 30px 9px 10px; }
button { border: 0; border-radius: 12px; padding: 10px 14px; color: var(--text); cursor: pointer; }
.primary { background: linear-gradient(135deg, var(--brand), #2563eb); box-shadow: 0 12px 26px rgba(37, 99, 235, .22); }
.secondary { background: rgba(148, 163, 184, .1); border: 1px solid var(--line); }
.view { display: none; }
.view.active { display: block; }
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card, .panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}
.card { padding: 18px; }
.card strong { display: block; font-size: 30px; letter-spacing: -.05em; margin: 10px 0 2px; }
.card span { color: var(--muted); font-size: 13px; }
.panel { padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.panel-head h3 { font-size: 17px; }
.panel-head span { color: var(--muted); font-size: 13px; }
.grid.two { display: grid; grid-template-columns: .9fr 1.1fr; gap: 16px; }
.stack { display: grid; gap: 12px; }
.approval-item, .task-row, .automation, .artifact, .agent-card, .integration-card, .guardrail-card {
  background: rgba(15, 23, 42, .78); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
}
.approval-item h4, .automation h4, .agent-card h4, .integration-card h4, .guardrail-card h4 { margin: 0 0 8px; }
.approval-item p, .automation p, .task-row p, .agent-card p, .integration-card p, .guardrail-card p, .artifact p { color: var(--muted); line-height: 1.45; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 9px; font-size: 12px; background: rgba(148, 163, 184, .12); color: var(--muted); }
.badge.high, .badge.blocked { color: #fecaca; background: rgba(239, 68, 68, .16); }
.badge.medium, .badge.waiting_for_approval { color: #fde68a; background: rgba(245, 158, 11, .16); }
.badge.running, .badge.connected { color: #bae6fd; background: rgba(56, 189, 248, .14); }
.badge.completed, .badge.good { color: #bbf7d0; background: rgba(34, 197, 94, .14); }
.badge.queued, .badge.idle, .badge.draft_only, .badge.limited { color: #ddd6fe; background: rgba(124, 58, 237, .16); }
.badge.expired, .badge.disconnected, .badge.needs_attention, .badge.setup_needed, .badge.approval_required { color: #fde68a; background: rgba(245, 158, 11, .16); }
.tool-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tool-list span { color: var(--muted); background: rgba(148, 163, 184, .08); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; font-size: 12px; }
.panel-head.compact { margin-bottom: 10px; }
.agent-grid, .deliverable-grid, .integration-grid, .guardrail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.timeline { display: grid; gap: 12px; }
.event { display: grid; grid-template-columns: 12px 1fr; gap: 12px; }
.dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 5px rgba(6, 182, 212, .08); }
.event strong { display: block; font-size: 14px; }
.event p { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 3px; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.lane { min-height: 230px; border: 1px dashed var(--line); border-radius: 18px; padding: 12px; background: rgba(2, 6, 23, .24); }
.lane h4 { margin: 0 0 12px; color: var(--muted); font-size: 13px; text-transform: capitalize; }
.mini-task { padding: 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 10px; cursor: pointer; }
.mini-task strong { display: block; font-size: 13px; line-height: 1.3; margin-bottom: 8px; }
.table { display: grid; gap: 10px; }
.task-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; cursor: pointer; }
.task-row:hover, .mini-task:hover { border-color: rgba(6, 182, 212, .38); }
.row-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.detail h3 { margin-bottom: 10px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.approval-grid, .automation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.approval-actions { display: flex; gap: 8px; margin-top: 14px; }
.approve { background: rgba(34, 197, 94, .22); color: #bbf7d0; }
.reject { background: rgba(239, 68, 68, .22); color: #fecaca; }
.hidden { display: none !important; }
dialog { width: min(620px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 22px; background: #0f172a; color: var(--text); padding: 0; }
dialog::backdrop { background: rgba(2, 6, 23, .72); backdrop-filter: blur(8px); }
form { padding: 20px; display: grid; gap: 14px; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.icon { width: 34px; height: 34px; padding: 0; background: rgba(148, 163, 184, .12); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
input, textarea, select { width: 100%; color: var(--text); background: rgba(2, 6, 23, .66); border: 1px solid var(--line); border-radius: 12px; padding: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 140px; gap: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: #111827; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
html { overflow-x: hidden; }
body { overflow-x: hidden; }
.mobile-menu-btn, .sidebar-overlay { display: none; }

@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kanban { grid-template-columns: repeat(6, minmax(220px, 1fr)); }
}

@media (max-width: 950px) {
  body { display: block; padding-top: 58px; }
  body.menu-open { overflow: hidden; }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 40;
    min-height: 40px;
    background: rgba(15, 23, 42, .92);
    border: 1px solid var(--line);
    box-shadow: 0 14px 42px rgba(0,0,0,.32);
    backdrop-filter: blur(14px);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(2, 6, 23, .66);
    backdrop-filter: blur(3px);
  }
  .sidebar {
    width: min(86vw, 320px);
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform .22s ease;
    padding: 70px 18px 18px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-card { position: static; margin-top: 20px; }
  main { width: auto; max-width: 100%; min-width: 0; padding: 16px; overflow-x: hidden; }
  .topbar { align-items: stretch; flex-direction: column; margin-bottom: 16px; min-width: 0; }
  .actions { width: 100%; min-width: 0; }
  .profile-picker { flex: 1 1 0; }
  .profile-picker select { min-width: 0; }
  .actions button { flex: 1 1 0; min-width: 0; min-height: 44px; white-space: nowrap; }
  h2 { font-size: clamp(26px, 8vw, 34px); }
  .cards, .grid.two, .detail-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; border-radius: 18px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .kanban {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
  .lane { min-height: auto; }
  .task-row { grid-template-columns: 1fr; }
  .task-row > .muted { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .approval-grid, .automation-grid { grid-template-columns: 1fr; }
  .approval-actions { flex-direction: column; }
  .approval-actions button { width: 100%; min-height: 44px; }
}

@media (max-width: 640px) {
  main { padding: 12px 28px 12px 12px; }
  .brand { margin-bottom: 22px; }
  .logo { width: 40px; height: 40px; border-radius: 14px; }
  .cards { gap: 10px; }
  .card { padding: 14px; border-radius: 18px; }
  .actions { flex-direction: column; }
  .actions button { width: 100%; }
  .card strong { font-size: 26px; }
  .panel { margin-bottom: 12px; }
  .row-meta { gap: 6px; }
  .badge { max-width: 100%; overflow-wrap: anywhere; }
  .approval-item, .task-row, .automation, .artifact, .agent-card, .integration-card, .guardrail-card { padding: 12px; border-radius: 14px; }
  .event { grid-template-columns: 10px 1fr; gap: 10px; }
  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    border-radius: 18px;
  }
  form { padding: 16px; }
  .dialog-head, .dialog-actions { align-items: stretch; flex-direction: column; }
  .dialog-actions button { width: 100%; min-height: 44px; }
  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .actions { flex-direction: column; }
  .card strong { font-size: 24px; }
  .panel-head h3 { font-size: 16px; }
  button { width: auto; }
}
