/* Mission Control — operator console */
:root {
  /* Base — cool slate, no warmth */
  --bg-0: #0a0c10;
  --bg-1: #0f1217;
  --bg-2: #14181f;
  --bg-3: #1a1f27;
  --bg-4: #222831;
  --bg-hover: #1d232c;
  --bg-active: #252c37;

  --border: #232932;
  --border-strong: #2e353f;
  --border-soft: #1b2027;

  --text-0: #e7ebef;   /* primary */
  --text-1: #aab1bb;   /* secondary */
  --text-2: #717886;   /* tertiary */
  --text-3: #4a525e;   /* quaternary */

  /* Semantic */
  --running: #36d2a3;
  --running-bg: rgba(54, 210, 163, 0.10);
  --running-bd: rgba(54, 210, 163, 0.28);

  --queued: #e6b450;
  --queued-bg: rgba(230, 180, 80, 0.10);
  --queued-bd: rgba(230, 180, 80, 0.28);

  --failed: #ef6f6c;
  --failed-bg: rgba(239, 111, 108, 0.10);
  --failed-bd: rgba(239, 111, 108, 0.30);

  --attn: #f4994d;
  --attn-bg: rgba(244, 153, 77, 0.10);
  --attn-bd: rgba(244, 153, 77, 0.30);

  --ok: #6dc28e;
  --ok-bg: rgba(109, 194, 142, 0.08);
  --ok-bd: rgba(109, 194, 142, 0.24);

  --info: #7aa8f2;
  --info-bg: rgba(122, 168, 242, 0.10);
  --info-bd: rgba(122, 168, 242, 0.28);

  --idle: #6b7280;
  --idle-bg: rgba(107, 114, 128, 0.10);
  --idle-bd: rgba(107, 114, 128, 0.28);

  --accent: #6ea8ff;  /* primary action accent — cool blue */
  --accent-strong: #4b8df0;
  --accent-bg: rgba(110, 168, 255, 0.12);

  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Geist', 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text-0); font-family: var(--sans); font-size: 13px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
#root { height: 100vh; width: 100vw; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }

/* === Shell === */
.shell {
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  grid-template-rows: 48px 1fr;
  grid-template-areas:
    "sidebar header header"
    "sidebar main activity";
  height: 100vh;
  background: var(--bg-0);
}
.shell.no-activity { grid-template-columns: 220px 1fr; grid-template-areas: "sidebar header" "sidebar main"; }

/* === Sidebar === */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-1);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-brand {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  border-radius: 4px;
  position: relative;
}
.brand-mark::after {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--running);
  box-shadow: 0 0 0 2px var(--bg-2);
}
.brand-text { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.brand-text .sub { display: block; font-size: 10px; font-weight: 500; color: var(--text-2); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 1px; }

.nav { padding: 8px 8px; flex: 1; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-section-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 12px 10px 6px; }

.nav-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--text-1);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-0); }
.nav-item.active { background: var(--bg-active); color: var(--text-0); border-color: var(--border); }
.nav-item .ico { color: var(--text-2); }
.nav-item.active .ico { color: var(--accent); }
.nav-item .count {
  font-family: var(--mono); font-size: 10px; color: var(--text-2);
  background: var(--bg-3); padding: 1px 6px; border-radius: 3px; border: 1px solid var(--border);
  min-width: 18px; text-align: center;
}
.nav-item.active .count { color: var(--text-0); background: var(--bg-4); }
.nav-item .count.attn { color: var(--attn); border-color: var(--attn-bd); background: var(--attn-bg); }

.sidebar-foot {
  border-top: 1px solid var(--border-soft);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Header === */
.header {
  grid-area: header;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
}
.header-title { display: flex; flex-direction: column; }
.header-title h1 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.header-title .crumb { font-size: 11px; color: var(--text-2); letter-spacing: 0.04em; }

.system-strip { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.sys-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; font-size: 11px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-1); height: 28px;
}
.sys-pill .lbl { color: var(--text-2); letter-spacing: 0.04em; text-transform: uppercase; font-size: 10px; }
.sys-pill .val { color: var(--text-0); font-family: var(--mono); }
.sys-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-running { background: var(--running); box-shadow: 0 0 6px var(--running); }
.dot-attn { background: var(--attn); }
.dot-failed { background: var(--failed); }
.dot-idle { background: var(--idle); }
.dot-info { background: var(--info); }
.dot-ok { background: var(--ok); }
.dot-queued { background: var(--queued); }
.dot-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.header-cta { display: flex; align-items: center; gap: 6px; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--border); }
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--bg-2); border-radius: 4px;
  color: var(--text-1); cursor: pointer;
}
.icon-btn:hover { color: var(--text-0); border-color: var(--border-strong); background: var(--bg-3); }
.icon-btn.active { color: var(--accent); border-color: var(--accent-bd, var(--border-strong)); background: var(--accent-bg); }

/* === Main === */
.main {
  grid-area: main;
  background: var(--bg-0);
  overflow-y: auto;
  padding: 20px 24px 80px;
  min-width: 0;
  container-type: inline-size;
  container-name: main;
}
.main-grid { display: flex; flex-direction: column; gap: 20px; max-width: 1280px; margin: 0 auto; }

/* Container queries — respond to actual available main width, not viewport */
@container main (max-width: 960px) {
  .bounty-grid { grid-template-columns: 1fr !important; }
  .findings-grid { grid-template-columns: 1fr !important; }
}
@container main (max-width: 720px) {
  .two-col { grid-template-columns: 1fr !important; }
  .stat-strip { grid-template-columns: repeat(2, 1fr) !important; }
  .target-strip { grid-template-columns: repeat(3, 1fr) !important; }
  .artifact-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .agent-grid { grid-template-columns: 1fr !important; }
}

/* Section header */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; gap: 16px; }
.section-head h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-1); }
.section-head h2 .n { color: var(--text-3); font-weight: 500; margin-left: 6px; font-family: var(--mono); }
.section-head .actions { display: flex; gap: 6px; }
.section-head .meta { font-size: 11px; color: var(--text-2); }

/* Card */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}
.card.padded { padding: 16px; }

/* === Dispatch composer === */
.dispatch {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px 14px;
}
.dispatch-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dispatch-head .title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-1);
  display: inline-flex; align-items: center; gap: 8px;
}
.dispatch-head .title::before { content: ''; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.dispatch-head .hint { color: var(--text-2); font-size: 11px; }
.dispatch-head .right { margin-left: auto; display: flex; gap: 6px; font-size: 11px; color: var(--text-2); }
.dispatch-head .kbd {
  font-family: var(--mono); font-size: 10px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 5px; color: var(--text-1);
}

.dispatch-row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; }
.dispatch-brief {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}
.brief-textarea {
  background: transparent; border: 0; outline: 0;
  color: var(--text-0); padding: 12px 14px;
  font-size: 14px; resize: none; min-height: 96px; line-height: 1.5;
  font-family: var(--sans);
}
.brief-textarea::placeholder { color: var(--text-3); }
.brief-foot {
  border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
}

.agent-picker {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 6px;
  display: flex; flex-direction: column;
}
.agent-picker .label {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); padding: 8px 10px 4px;
}
.agent-list { display: flex; flex-direction: column; padding: 0 6px 6px; gap: 1px; max-height: 160px; overflow-y: auto; }
.agent-row {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 8px;
  padding: 6px 8px; border-radius: 4px; align-items: center;
  cursor: pointer; font-size: 12px; color: var(--text-1); border: 1px solid transparent;
}
.agent-row:hover { background: var(--bg-hover); color: var(--text-0); }
.agent-row.selected { background: var(--bg-active); border-color: var(--border); color: var(--text-0); }
.agent-row .meta { font-family: var(--mono); font-size: 10px; color: var(--text-2); }

.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px; font-size: 11px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-1);
  cursor: pointer;
}
.chip:hover { color: var(--text-0); border-color: var(--border-strong); }
.chip.active { background: var(--accent-bg); border-color: var(--accent); color: var(--text-0); }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); }
.chip.active .dot { background: var(--accent); }

.dispatch-actions { display: flex; align-items: center; gap: 8px; padding: 10px 0 0; }
.dispatch-actions .left { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.dispatch-actions .right { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; height: 30px;
  border: 1px solid var(--border); background: var(--bg-2);
  color: var(--text-0); border-radius: 5px; font-size: 12px; cursor: pointer;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.btn.ghost { background: transparent; border-color: var(--border-soft); color: var(--text-1); }
.btn.ghost:hover { color: var(--text-0); background: var(--bg-hover); }
.btn.primary {
  background: var(--accent-strong); border-color: var(--accent);
  color: #0c1320; font-weight: 600;
  padding: 7px 18px; height: 34px;
  box-shadow: 0 0 0 1px rgba(110, 168, 255, 0.25), 0 6px 16px -8px rgba(110, 168, 255, 0.5);
}
.btn.primary:hover { background: var(--accent); }
.btn.danger { color: var(--failed); border-color: var(--failed-bd); }
.btn .kbd { font-family: var(--mono); font-size: 10px; background: rgba(0,0,0,0.25); padding: 1px 5px; border-radius: 3px; }

/* Quick presets */
.preset-strip { display: flex; gap: 6px; padding: 8px 0 0; flex-wrap: wrap; }
.preset {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 5px; font-size: 11px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-1);
  cursor: pointer;
}
.preset:hover { color: var(--text-0); border-color: var(--border-strong); }
.preset .pname { font-weight: 500; color: var(--text-0); }
.preset .pdesc { color: var(--text-2); font-size: 10.5px; }

/* === Stat strip === */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow: hidden;
}
.stat {
  background: var(--bg-1);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.stat .lbl { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); }
.stat .val { font-size: 22px; font-family: var(--mono); font-weight: 500; color: var(--text-0); letter-spacing: -0.01em; line-height: 1; }
.stat .sub { font-size: 10.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.stat .accent { color: var(--running); }
.stat .accent.attn { color: var(--attn); }
.stat .accent.failed { color: var(--failed); }
.stat .accent.queued { color: var(--queued); }

/* === Two col === */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* === Run table / list === */
.run-list { display: flex; flex-direction: column; }
.run-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 130px 100px 130px auto;
  gap: 14px;
  padding: 11px 14px;
  border-top: 1px solid var(--border-soft);
  align-items: center;
  cursor: pointer;
  min-width: 0;
}
.run-row > * { min-width: 0; }
.run-row:first-child { border-top: 0; }
.run-row:hover { background: var(--bg-hover); }
.run-row.selected { background: var(--bg-active); }
.run-row .col-status { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.run-row .ws-title { font-size: 13px; color: var(--text-0); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.run-row .ws-summary { font-size: 11.5px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row .col-id { font-family: var(--mono); font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row .col-time { font-family: var(--mono); font-size: 11px; color: var(--text-1); }
.run-row .col-agent { font-size: 11px; color: var(--text-1); display: flex; align-items: center; gap: 6px; overflow: hidden; }
.run-row .col-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 80ms ease; }
.run-row:hover .col-actions, .run-row.selected .col-actions { opacity: 1; }

/* Active recon row variant — wider title, shorter time/id */
.brun-row {
  grid-template-columns: 96px minmax(0, 1fr) 88px 92px auto !important;
  gap: 12px !important;
}
.brun-row .ws-title { white-space: nowrap; }

.row-act {
  height: 24px; padding: 0 8px; border-radius: 4px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-1);
  font-size: 11px; cursor: pointer;
}
.row-act:hover { color: var(--text-0); background: var(--bg-3); }

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px; font-size: 10.5px;
  font-weight: 500; letter-spacing: 0.03em; text-transform: uppercase;
}
.s-running { background: var(--running-bg); color: var(--running); border: 1px solid var(--running-bd); }
.s-queued { background: var(--queued-bg); color: var(--queued); border: 1px solid var(--queued-bd); }
.s-failed { background: var(--failed-bg); color: var(--failed); border: 1px solid var(--failed-bd); }
.s-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-bd); }
.s-idle { background: var(--idle-bg); color: var(--idle); border: 1px solid var(--idle-bd); }
.s-attn { background: var(--attn-bg); color: var(--attn); border: 1px solid var(--attn-bd); }
.s-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-bd); }

/* Finding card */
.finding {
  border-top: 1px solid var(--border-soft);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}
.finding:first-child { border-top: 0; }
.finding:hover { background: var(--bg-hover); }
.finding .conf {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 6px;
  border-radius: 4px;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--bg-2);
  margin-top: 1px;
  white-space: nowrap;
}
.finding .conf .bar { display: inline-flex; gap: 2px; }
.finding .conf .bar span { width: 2px; height: 8px; background: var(--text-3); border-radius: 1px; }
.finding.solid .conf { color: var(--ok); border-color: var(--ok-bd); background: var(--ok-bg); }
.finding.solid .conf .bar span { background: var(--ok); }
.finding.directional .conf { color: var(--info); border-color: var(--info-bd); background: var(--info-bg); }
.finding.directional .conf .bar span:nth-child(3) { background: var(--text-3); }
.finding.directional .conf .bar span:nth-child(1), .finding.directional .conf .bar span:nth-child(2) { background: var(--info); }
.finding.vibes .conf { color: var(--queued); border-color: var(--queued-bd); background: var(--queued-bg); }
.finding.vibes .conf .bar span:nth-child(1) { background: var(--queued); }
.finding.vibes .conf .bar span:nth-child(2), .finding.vibes .conf .bar span:nth-child(3) { background: var(--text-3); }

.finding .body { min-width: 0; }
.finding .body .title { font-size: 13px; color: var(--text-0); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.finding .body .meta { font-size: 11px; color: var(--text-2); display: flex; gap: 10px; align-items: center; font-family: var(--mono); }
.finding .body .meta .agent { color: var(--text-1); font-family: var(--sans); }
.finding .side { font-family: var(--mono); font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Schedule strip */
.schedule-track { padding: 12px 16px; }
.schedule-bar { position: relative; height: 60px; padding-top: 22px; }
.schedule-axis { position: absolute; left: 0; right: 0; top: 22px; height: 1px; background: var(--border); }
.schedule-tick { position: absolute; top: 22px; width: 1px; height: 6px; background: var(--border-strong); }
.schedule-tick .lbl { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.schedule-now { position: absolute; top: 14px; bottom: 0; width: 2px; background: var(--running); box-shadow: 0 0 6px var(--running); }
.schedule-now .lbl { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 9px; color: var(--running); white-space: nowrap; letter-spacing: 0.05em; }
.schedule-job {
  position: absolute; top: 30px; height: 18px;
  background: var(--bg-3); border: 1px solid var(--border-strong);
  border-radius: 3px;
  font-size: 10px; color: var(--text-1); padding: 0 6px;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); overflow: hidden; white-space: nowrap;
}
.schedule-job.j-running { border-color: var(--running-bd); background: var(--running-bg); color: var(--running); }
.schedule-job.j-failed { border-color: var(--failed-bd); background: var(--failed-bg); color: var(--failed); }
.schedule-job.j-ok { border-color: var(--ok-bd); background: var(--ok-bg); color: var(--ok); }
.schedule-job.j-queued { border-color: var(--queued-bd); background: var(--queued-bg); color: var(--queued); }

/* Workflow chip */
.wf-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; font-size: 10.5px;
  border: 1px solid var(--border); border-radius: 3px;
  color: var(--text-1); background: var(--bg-2);
  font-family: var(--mono);
}
.wf-tag .dot { width: 5px; height: 5px; border-radius: 50%; }
.wf-hermes .dot { background: #c084fc; }
.wf-bounty .dot { background: #ef6f6c; }
.wf-anthropic .dot { background: #f4994d; }
.wf-newsletter .dot { background: #7aa8f2; }
.wf-pressure .dot { background: #36d2a3; }
.wf-zo .dot { background: #fbbf24; }
.wf-backend .dot { background: #94a3b8; }

/* === Activity panel === */
.activity {
  grid-area: activity;
  background: var(--bg-1);
  border-left: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  min-width: 0;
}
.activity-head {
  height: 48px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}
.activity-head .title { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-1); font-weight: 600; display: inline-flex; align-items: center; gap: 8px;}
.activity-body { flex: 1; overflow-y: auto; padding: 8px 0; }

.activity-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12px;
  position: relative;
}
.activity-item .marker {
  width: 7px; height: 7px; border-radius: 50%; margin-top: 5px;
  background: var(--text-3);
}
.activity-item.t-run .marker { background: var(--running); }
.activity-item.t-fail .marker { background: var(--failed); }
.activity-item.t-ok .marker { background: var(--ok); }
.activity-item.t-find .marker { background: var(--info); }
.activity-item.t-queue .marker { background: var(--queued); }
.activity-item .when { font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-bottom: 2px; }
.activity-item .what { color: var(--text-0); }
.activity-item .what .em { color: var(--text-1); }

/* spine connecting markers */
.activity-stream { position: relative; }
.activity-stream::before {
  content: ''; position: absolute;
  left: 19.5px; top: 12px; bottom: 12px; width: 1px;
  background: var(--border);
}

/* === Run detail (modal/panel) === */
.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 7, 11, 0.6);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex; justify-content: flex-end;
}
.detail-panel {
  width: min(720px, 90vw);
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.detail-head { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 12px; }
.detail-head .id { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.detail-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.detail-tabs { display: flex; gap: 0; padding: 0 18px; border-bottom: 1px solid var(--border-soft); }
.detail-tab { padding: 8px 14px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; }
.detail-tab.active { color: var(--text-0); border-bottom-color: var(--accent); }
.detail-body { flex: 1; overflow-y: auto; padding: 16px 18px; }

/* Log block */
.log-block {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  background: var(--bg-0); border: 1px solid var(--border);
  border-radius: 5px; padding: 12px 14px;
  color: var(--text-1);
  white-space: pre-wrap;
}
.log-block .log-time { color: var(--text-3); margin-right: 8px; }
.log-block .log-info { color: var(--info); }
.log-block .log-ok { color: var(--ok); }
.log-block .log-err { color: var(--failed); }
.log-block .log-warn { color: var(--queued); }

/* Agents grid */
.agent-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.agent-card {
  background: var(--bg-1); border: 1px solid var(--border-soft); border-radius: 6px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer;
}
.agent-card:hover { border-color: var(--border); }
.agent-card .head { display: flex; align-items: center; gap: 8px; }
.agent-card .name { font-weight: 600; font-size: 14px; color: var(--text-0); }
.agent-card .kind { font-family: var(--mono); font-size: 10px; color: var(--text-2); margin-left: auto; }
.agent-card .desc { font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.agent-card .stats { display: flex; gap: 14px; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.agent-card .stats > div { display: flex; flex-direction: column; gap: 2px; }
.agent-card .stats .k { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.agent-card .stats .v { font-family: var(--mono); font-size: 12px; color: var(--text-0); }
.agent-card .stats .v.fail { color: var(--failed); }
.agent-card .stats .v.ok { color: var(--ok); }

/* Sparkline */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.spark span { width: 3px; background: var(--text-3); border-radius: 1px; }
.spark span.ok { background: var(--ok); }
.spark span.fail { background: var(--failed); }
.spark span.run { background: var(--running); }
.spark span.queue { background: var(--queued); }

/* Empty state */
.empty {
  padding: 32px 16px; text-align: center;
  border: 1px dashed var(--border); border-radius: 6px;
  color: var(--text-2); font-size: 12px;
}
.empty .h { font-size: 13px; color: var(--text-1); margin-bottom: 4px; }

/* Filter bar */
.filterbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-1); border: 1px solid var(--border-soft); border-radius: 6px;
}
.filterbar .sep { width: 1px; height: 16px; background: var(--border); }
.search-input {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 10px; font-size: 12px; color: var(--text-0);
  height: 28px; min-width: 220px; outline: 0;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: var(--accent); }

select.search-input { padding-right: 24px; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%23717886' fill='none' stroke-width='1.4'/></svg>"); background-repeat: no-repeat; background-position: right 8px center; }

/* Mobile preview frame */
.mobile-preview { display: flex; gap: 18px; align-items: flex-start; }
.phone-frame {
  width: 280px; height: 580px; border: 1px solid var(--border-strong);
  background: var(--bg-0); border-radius: 22px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
  flex-shrink: 0;
}
.phone-frame .notch { width: 90px; height: 5px; background: var(--bg-3); border-radius: 3px; margin: 0 auto 4px; }

/* Toast */
.toast-stack { position: fixed; right: 360px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.shell.no-activity .toast-stack { right: 96px; bottom: 24px; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 10px 14px;
  font-size: 12px; color: var(--text-0);
  display: flex; align-items: center; gap: 10px;
  min-width: 240px;
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.5);
  animation: toast-in 200ms ease;
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.toast.t-queued { border-color: var(--queued-bd); }
.toast.t-running { border-color: var(--running-bd); }
.toast.t-ok { border-color: var(--ok-bd); }
.toast.t-failed { border-color: var(--failed-bd); }

/* Findings grid layout */
.findings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Schedules table */
.sched-table { width: 100%; border-collapse: collapse; }
.sched-table th, .sched-table td { text-align: left; padding: 9px 14px; border-top: 1px solid var(--border-soft); font-size: 12px; }
.sched-table th { font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-2); font-weight: 500; background: var(--bg-1); border-top: 0; }
.sched-table tr:hover td { background: var(--bg-hover); }
.sched-table td.mono { font-family: var(--mono); color: var(--text-1); font-size: 11px; }

/* Detail metric */
.metric-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border-soft); font-size: 12px; }
.metric-row:first-child { border-top: 0; }
.metric-row .k { color: var(--text-2); }
.metric-row .v { color: var(--text-0); font-family: var(--mono); font-size: 11.5px; }

/* Artifact tile */
.artifact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.artifact-tile {
  background: var(--bg-1); border: 1px solid var(--border-soft);
  border-radius: 6px; padding: 12px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
}
.artifact-tile:hover { border-color: var(--border); }
.artifact-tile .top { display: flex; align-items: center; gap: 8px; }
.artifact-tile .kind {
  font-family: var(--mono); font-size: 10px; padding: 1px 6px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 3px;
  color: var(--text-1); letter-spacing: 0.06em; text-transform: uppercase;
}
.artifact-tile .title { font-size: 12.5px; color: var(--text-0); line-height: 1.4; }
.artifact-tile .foot { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); display: flex; gap: 10px; align-items: center; }

/* Tweaks panel — close button helper */
.x-close {
  border: 0; background: transparent; cursor: pointer; color: var(--text-2);
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px;
}
.x-close:hover { color: var(--text-0); background: var(--bg-hover); }

/* Scrollbar */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Mobile breakpoint */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 200px 1fr; grid-template-areas: "sidebar header" "sidebar main"; }
  .activity { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .dispatch-row { grid-template-columns: 1fr; }
  .bounty-grid { grid-template-columns: 1fr !important; }
  .target-strip { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 700px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "header" "main"; grid-template-rows: 48px 1fr; }
  .sidebar { display: none; }
  .main { padding: 14px; }
  .run-row { grid-template-columns: 1fr; gap: 6px; }
  .run-row .col-actions { opacity: 1; }
  .findings-grid, .artifact-grid, .agent-grid { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .target-strip { grid-template-columns: 1fr !important; }
  .attention-rail { grid-auto-columns: 78vw !important; }
}

/* ============================================================
   BUG BOUNTY MODULE
============================================================ */

/* Target selector tabs */
.target-tabs {
  display: flex; gap: 4px; padding: 6px;
  background: var(--bg-1); border: 1px solid var(--border-soft);
  border-radius: 6px; overflow-x: auto;
}
.target-tab {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 12px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-1);
  cursor: pointer;
  min-width: 200px;
  text-align: left;
}
.target-tab:hover { background: var(--bg-hover); }
.target-tab.active { background: var(--bg-active); border-color: var(--border); color: var(--text-0); }
.target-tab .tt-name { font-weight: 600; font-size: 13px; color: var(--text-0); letter-spacing: -0.005em; }
.target-tab.active .tt-name { color: var(--text-0); }
.target-tab .tt-prog { font-size: 10.5px; color: var(--text-2); margin-top: 1px; }
.target-tab .tt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.target-tab .tt-payout { font-family: var(--mono); font-size: 10px; color: var(--text-2); }
.target-tab .tt-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 4px; }

/* Target health strip */
.target-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow: hidden;
}
.target-stat {
  background: var(--bg-1);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.target-stat .lbl { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); }
.target-stat .val { font-size: 18px; font-family: var(--mono); font-weight: 500; color: var(--text-0); line-height: 1; }
.target-stat .sub { font-size: 10.5px; color: var(--text-2); }
.target-stat .val.running { color: var(--running); }
.target-stat .val.attn { color: var(--attn); }
.target-stat .val.failed { color: var(--failed); }
.target-stat .val.info { color: var(--info); }

/* Needs Attention rail */
.attention-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 1px 4px;
}
.attention-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 5px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  min-height: 78px;
}
.attention-card:hover { background: var(--bg-hover); }
.attention-card .a-head { display: flex; align-items: center; gap: 8px; }
.attention-card .a-label {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-1); font-weight: 600;
}
.attention-card .a-id { font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-left: auto; }
.attention-card .a-detail { font-size: 12px; color: var(--text-0); line-height: 1.4; }
.attention-card .a-foot { display: flex; gap: 4px; margin-top: 2px; }

.attention-card.k-review { border-left-color: var(--attn); }
.attention-card.k-review .a-label { color: var(--attn); }
.attention-card.k-duplicate { border-left-color: var(--queued); }
.attention-card.k-duplicate .a-label { color: var(--queued); }
.attention-card.k-failed { border-left-color: var(--failed); }
.attention-card.k-failed .a-label { color: var(--failed); }
.attention-card.k-stale { border-left-color: var(--idle); }
.attention-card.k-stale .a-label { color: var(--text-1); }
.attention-card.k-draft { border-left-color: var(--running); }
.attention-card.k-draft .a-label { color: var(--running); }
.attention-card.k-scope { border-left-color: var(--info); }
.attention-card.k-scope .a-label { color: var(--info); }

/* Severity badge */
.sev {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 3px; border: 1px solid var(--border);
  font-family: var(--mono);
}
.sev::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.sev-critical { color: #ff5d5a; background: rgba(255, 93, 90, 0.12); border-color: rgba(255, 93, 90, 0.32); }
.sev-high { color: var(--failed); background: var(--failed-bg); border-color: var(--failed-bd); }
.sev-medium { color: var(--attn); background: var(--attn-bg); border-color: var(--attn-bd); }
.sev-low { color: var(--info); background: var(--info-bg); border-color: var(--info-bd); }
.sev-info { color: var(--text-1); background: var(--bg-3); border-color: var(--border); }

/* Bounty confidence pills */
.bconf {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; font-size: 10px; font-weight: 500;
  border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-1); background: var(--bg-2);
  letter-spacing: 0.02em;
}
.bconf .d { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.bconf-needs-review { color: var(--queued); border-color: var(--queued-bd); background: var(--queued-bg); }
.bconf-likely-valid { color: var(--ok); border-color: var(--ok-bd); background: var(--ok-bg); }
.bconf-duplicate-risk { color: var(--text-1); border-color: var(--border); border-style: dashed; background: var(--bg-2); }
.bconf-out-of-scope { color: var(--text-2); background: var(--bg-2); border-color: var(--border); }
.bconf-out-of-scope .d { display: none; }
.bconf-ready-to-draft { color: var(--running); border-color: var(--running-bd); background: var(--running-bg); }

/* Bounty finding card (vertical) */
.bf-card {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 13px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.bf-card:hover { border-color: var(--border); }
.bf-card .bf-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bf-card .bf-id { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.bf-card .bf-title { font-size: 13px; color: var(--text-0); line-height: 1.45; font-weight: 500; }
.bf-card .bf-summary { font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.bf-card .bf-endpoint { font-family: var(--mono); font-size: 11px; color: var(--info); background: var(--info-bg); border: 1px solid var(--info-bd); padding: 5px 8px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.bf-card .bf-foot { display: flex; gap: 4px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.bf-card .bf-foot .row-act { font-size: 11px; }
.bf-card .bf-meta { font-size: 11px; color: var(--text-2); display: flex; gap: 10px; align-items: center; font-family: var(--mono); }

/* Bounty grid */
.bounty-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: flex-start;
}
.bounty-grid > * { min-width: 0; }

/* Leads list */
.lead-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border-soft);
  align-items: center;
  cursor: pointer;
}
.lead-row > * { min-width: 0; }
.lead-row:first-child { border-top: 0; }
.lead-row:hover { background: var(--bg-hover); }
.lead-row .lr-dot { width: 7px; height: 7px; border-radius: 50%; }
.lead-row .lr-dot.fresh { background: var(--info); }
.lead-row .lr-dot.stale { background: var(--queued); }
.lead-row .lr-title { font-size: 12px; color: var(--text-0); }
.lead-row .lr-meta { font-size: 11px; color: var(--text-2); font-family: var(--mono); }
.lead-row .lr-acts { display: flex; gap: 4px; opacity: 0; }
.lead-row:hover .lr-acts { opacity: 1; }

/* Scope notes panel */
.scope-panel { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.scope-panel li { list-style: none; font-size: 12px; color: var(--text-1); line-height: 1.5; padding-left: 14px; position: relative; }
.scope-panel li::before {
  content: ''; position: absolute; left: 0; top: 8px; width: 6px; height: 1px; background: var(--text-3);
}
.scope-panel li.warn { color: var(--attn); }
.scope-panel li.warn::before { background: var(--attn); }

/* Compact preset grid for bounty */
.bp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 10px; }
.bp-card {
  border: 1px solid var(--border); background: var(--bg-2);
  border-radius: 5px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
  cursor: pointer;
}
.bp-card:hover { background: var(--bg-3); border-color: var(--border-strong); }
.bp-card .bp-top { display: flex; align-items: center; gap: 6px; }
.bp-card .bp-icon {
  width: 18px; height: 18px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 14px; color: var(--accent);
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 3px;
}
.bp-card .bp-name { font-size: 11.5px; font-weight: 500; color: var(--text-0); }
.bp-card .bp-desc { font-size: 10.5px; color: var(--text-2); line-height: 1.4; padding-left: 24px; }

/* Compact dispatch (bounty side) */
.mini-dispatch {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.mini-dispatch .mini-head { display: flex; align-items: center; gap: 8px; }
.mini-dispatch .mini-head .title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-1);
  display: inline-flex; align-items: center; gap: 8px;
}
.mini-dispatch .mini-head .title::before { content: ''; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.mini-dispatch textarea {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 5px;
  padding: 8px 10px; font-size: 12px; color: var(--text-0); outline: 0;
  resize: none; min-height: 70px; font-family: var(--sans); line-height: 1.5;
}
.mini-dispatch textarea::placeholder { color: var(--text-3); }
.mini-dispatch textarea:focus { border-color: var(--accent); }
.mini-dispatch .mini-row { display: flex; gap: 6px; align-items: center; }
.mini-dispatch select.search-input { height: 28px; min-width: 0; flex: 1; }

/* Run history compact */
.bhist-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px 96px auto;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border-soft);
  align-items: center;
  cursor: pointer;
  font-size: 12px;
}
.bhist-row > * { min-width: 0; }
.bhist-row:first-child { border-top: 0; }
.bhist-row:hover { background: var(--bg-hover); }
.bhist-row .bh-id { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.bhist-row .bh-title { color: var(--text-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bhist-row .bh-summary { font-size: 11px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bhist-row .bh-time { font-family: var(--mono); font-size: 11px; color: var(--text-1); }
.bhist-row .bh-acts { display: flex; gap: 4px; opacity: 0; }
.bhist-row:hover .bh-acts { opacity: 1; }

/* ============================================================
   GHOST ASSISTANT (floating)
============================================================ */
.ghost-fab {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(180deg, #1a1f27 0%, #14181f 100%);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-0);
  z-index: 200;
  box-shadow:
    0 0 0 1px rgba(110, 168, 255, 0.08),
    0 8px 24px -6px rgba(0, 0, 0, 0.6),
    0 0 30px -10px rgba(110, 168, 255, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.ghost-fab:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(110, 168, 255, 0.18),
    0 10px 28px -6px rgba(0, 0, 0, 0.6),
    0 0 40px -10px rgba(110, 168, 255, 0.4);
  border-color: var(--accent);
}
.ghost-fab .gf-ico { animation: ghost-bob 3.2s ease-in-out infinite; }
@keyframes ghost-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}
.ghost-fab::after {
  content: ''; position: absolute; right: 8px; top: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--running);
  box-shadow: 0 0 6px var(--running), 0 0 0 2px var(--bg-1);
  animation: pulse 2s ease-in-out infinite;
}

/* Chat panel */
.ghost-panel {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 420px; height: min(640px, calc(100vh - 80px));
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; flex-direction: column;
  z-index: 201;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.4),
    0 24px 48px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: ghost-in 200ms ease;
}
@keyframes ghost-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
}

.ghost-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
}
.ghost-head .g-mark {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  color: var(--text-0); position: relative;
}
.ghost-head .g-mark::after {
  content: ''; position: absolute; right: -2px; top: -2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--running); box-shadow: 0 0 0 2px var(--bg-1);
}
.ghost-head .g-title { font-weight: 600; font-size: 13px; letter-spacing: -0.005em; }
.ghost-head .g-sub { font-size: 10px; color: var(--text-2); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 1px; font-family: var(--mono); }

.ghost-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Empty state */
.ghost-empty {
  display: flex; flex-direction: column; gap: 14px;
  padding: 12px 2px;
}
.ghost-empty .eh { font-size: 14px; color: var(--text-0); }
.ghost-empty .es { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.ghost-empty .ctx-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-1); font-family: var(--mono);
  align-self: flex-start;
}
.ghost-empty .ctx-pill .dot { width: 6px; height: 6px; background: var(--running); border-radius: 50%; box-shadow: 0 0 4px var(--running); }
.ghost-suggestions { display: flex; flex-direction: column; gap: 6px; }
.ghost-suggestion {
  text-align: left;
  padding: 9px 12px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  border-radius: 6px; color: var(--text-1);
  font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.ghost-suggestion:hover { background: var(--bg-3); border-color: var(--border); color: var(--text-0); }
.ghost-suggestion .arr { color: var(--text-3); margin-left: auto; }

/* Messages */
.g-msg { display: flex; gap: 9px; align-items: flex-start; }
.g-msg.user { flex-direction: row-reverse; }
.g-msg .g-bubble {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.g-msg.user .g-bubble {
  background: var(--accent-bg);
  border: 1px solid rgba(110, 168, 255, 0.28);
  color: var(--text-0);
}
.g-msg.assistant .g-bubble {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  color: var(--text-0);
}
.g-msg.assistant.error .g-bubble {
  background: var(--failed-bg);
  border-color: var(--failed-bd);
  color: var(--failed);
}
.g-msg .g-avi {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 5px;
  display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 10px; font-family: var(--mono); color: var(--text-1);
}
.g-msg.user .g-avi { background: var(--accent-bg); border-color: rgba(110, 168, 255, 0.32); color: var(--accent); }

.g-meta { font-size: 10px; color: var(--text-3); font-family: var(--mono); margin-top: 4px; }
.g-msg.user .g-meta { text-align: right; }

.g-thinking {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 6px;
  font-size: 11px; color: var(--text-2);
}
.g-thinking .dt { width: 4px; height: 4px; border-radius: 50%; background: var(--text-2); animation: tdot 1.2s ease-in-out infinite; }
.g-thinking .dt:nth-child(2) { animation-delay: 0.15s; }
.g-thinking .dt:nth-child(3) { animation-delay: 0.3s; }
@keyframes tdot { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* Composer */
.ghost-composer {
  border-top: 1px solid var(--border-soft);
  padding: 10px 12px;
  background: var(--bg-1);
  display: flex; flex-direction: column; gap: 8px;
}
.ghost-input-wrap {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.ghost-input-wrap:focus-within { border-color: var(--accent); }
.ghost-input {
  width: 100%;
  background: transparent;
  border: 0; outline: 0; resize: none;
  color: var(--text-0); font-family: var(--sans);
  font-size: 13px; line-height: 1.5;
  min-height: 36px; max-height: 140px;
  padding: 2px 0;
}
.ghost-input::placeholder { color: var(--text-3); }

.ghost-input-row {
  display: flex; align-items: center; gap: 6px;
}
.cli-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 6px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-1); font-size: 11px;
  cursor: pointer; position: relative;
  height: 24px;
}
.cli-pick:hover { color: var(--text-0); background: var(--bg-3); border-color: var(--border-strong); }
.cli-pick .cli-dot { width: 6px; height: 6px; border-radius: 50%; }
.cli-pick .cli-name { font-weight: 500; }
.cli-pick .cli-cmd { font-family: var(--mono); font-size: 10px; color: var(--text-3); }

.cli-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  box-shadow: 0 14px 28px -10px rgba(0,0,0,0.6);
  padding: 4px;
  z-index: 10;
  display: flex; flex-direction: column; gap: 1px;
}
.cli-option {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-0);
  cursor: pointer;
  border: 0; background: transparent; text-align: left;
}
.cli-option:hover { background: var(--bg-3); }
.cli-option.active { background: var(--bg-active); }
.cli-option .cli-dot { width: 7px; height: 7px; border-radius: 50%; }
.cli-option .cli-name { font-weight: 500; }
.cli-option .cli-cmd { font-family: var(--mono); font-size: 10px; color: var(--text-2); }
.cli-option.add { border-top: 1px solid var(--border); color: var(--accent); margin-top: 4px; padding-top: 9px; }
.cli-option.add .cli-name { color: var(--accent); }

.cli-add-form {
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.cli-add-form input {
  background: var(--bg-0); border: 1px solid var(--border);
  border-radius: 4px; padding: 6px 9px; font-size: 12px;
  color: var(--text-0); outline: 0;
}
.cli-add-form input:focus { border-color: var(--accent); }
.cli-add-form .row { display: flex; gap: 6px; }
.cli-add-form .row button { flex: 1; }

.ghost-send {
  margin-left: auto;
  background: var(--accent-strong);
  border: 1px solid var(--accent);
  color: #0c1320; font-weight: 600;
  padding: 0 12px; height: 26px;
  border-radius: 5px;
  font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.ghost-send:hover { background: var(--accent); }
.ghost-send:disabled { opacity: 0.5; cursor: not-allowed; }

.ghost-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 0 2px; font-size: 10.5px; color: var(--text-3);
}
.ghost-foot .ctx-mini {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono);
}
.ghost-foot .ctx-mini .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--running); }

@media (max-width: 700px) {
  .ghost-panel { width: calc(100vw - 16px); right: 8px; bottom: 8px; height: min(80vh, 600px); }
  .ghost-fab { right: 14px; bottom: 14px; }
}

.auth-screen{min-height:100vh;display:grid;place-items:center;background:var(--bg-0);padding:24px}.auth-card{width:min(440px,calc(100vw - 32px));border:1px solid var(--line-1);background:var(--panel-1);border-radius:14px;padding:28px;box-shadow:var(--shadow-2)}.brand-mark{width:44px;height:44px;display:grid;place-items:center;border:1px solid var(--line-2);border-radius:10px;font-family:var(--mono);color:var(--accent);margin-bottom:14px}.segmented{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:var(--panel-0);border:1px solid var(--line-1);border-radius:10px;padding:5px;margin:18px 0}.segmented button{border:0;background:transparent;color:var(--text-2);border-radius:7px;height:34px}.segmented button.active{background:var(--panel-2);color:var(--text-0)}.input{width:100%;height:42px;border:1px solid var(--line-1);background:var(--panel-0);color:var(--text-0);border-radius:9px;padding:0 12px;margin-bottom:10px}.auth-code{text-align:center;font-family:var(--mono);font-size:24px;letter-spacing:.35em}.loading{min-height:100vh;display:grid;place-items:center;color:var(--text-2);background:var(--bg-0)}

/* Production responsive guard: no operator-console surface may force page-level x-scroll. */
html, body, #root { max-width: 100%; overflow-x: hidden; }
.shell, .main, .activity, .sidebar { min-width: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .activity { max-width: 100vw; }
  .main { width: 100%; max-width: 100vw; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr) !important; grid-template-areas: "header" "main" !important; grid-template-rows: 48px minmax(0, 1fr); }
  .sidebar { display: none !important; }
  .header, .main { width: 100% !important; max-width: 100vw !important; }
}
