/* ============================================================
   NICO by Macrodeep — GTM engineering workspace
   Visual system: dark "engineer's instrument", mono-forward,
   one electric signal-lime accent for agent activity.
   ============================================================ */

:root {
  /* ---- Surfaces (deep warm-cool ink) ---- */
  --bg:        oklch(0.158 0.006 264);
  --surface-1: oklch(0.188 0.007 264);
  --surface-2: oklch(0.222 0.008 264);
  --surface-3: oklch(0.262 0.010 265);
  --hover:     oklch(0.300 0.012 265);
  --raise:     oklch(0.330 0.013 265);

  /* ---- Lines ---- */
  --line:      oklch(0.330 0.012 265 / 0.65);
  --line-soft: oklch(0.300 0.010 265 / 0.40);
  --line-bright: oklch(0.420 0.014 265 / 0.55);

  /* ---- Text ---- */
  --text:   oklch(0.965 0.004 250);
  --text-2: oklch(0.760 0.010 255);
  --text-3: oklch(0.600 0.012 258);
  --text-4: oklch(0.485 0.012 260);

  /* ---- Brand accent (Macrodeep logo blue, lifted for dark bg) ---- */
  --accent:      oklch(0.700 0.110 255);
  --accent-dim:  oklch(0.700 0.110 255 / 0.15);
  --accent-line: oklch(0.700 0.110 255 / 0.42);
  --accent-text: oklch(0.780 0.090 255);
  --on-accent:   oklch(0.985 0.010 255);
  /* Macrodeep brand mark (the logo glyph) — fixed brand colors */
  --brand-blue:  #507099;
  --brand-paper: #F5F1E8;

  /* ---- Status ---- */
  --run:  oklch(0.830 0.150 85);
  --ok:   oklch(0.805 0.150 150);
  --err:  oklch(0.690 0.190 25);
  --info: oklch(0.770 0.110 240);
  --run-dim: oklch(0.830 0.150 85 / 0.14);
  --ok-dim:  oklch(0.805 0.150 150 / 0.14);
  --info-dim: oklch(0.770 0.110 240 / 0.14);

  /* ---- Connector brand dots ---- */
  --c-salesforce: #00A1E0;
  --c-hubspot:    #FF7A59;
  --c-clay:       #C9A8FF;
  --c-slack:      #36C5AB;
  --c-gmail:      #EA6A56;
  --c-outlook:    #0078D4;
  --c-saleshub:   oklch(0.885 0.190 128);
  --c-salestools: #5B8DEF;
  --c-zoominfo:   oklch(0.600 0.210 27);   /* ZoomInfo red */
  --c-builtwith:  oklch(0.640 0.180 295);  /* BuiltWith violet */
  --c-instantly:  oklch(0.600 0.180 275);  /* Instantly indigo */
  --c-firecrawl:  oklch(0.720 0.170 55);   /* Firecrawl flame */
  --c-lusha:       oklch(0.640 0.150 250); /* Lusha blue */
  --c-lemlist:     oklch(0.800 0.140 95);  /* lemlist lemon (dark fg) */
  --c-prospeo:     oklch(0.650 0.130 220); /* Prospeo cyan-blue */
  --c-smartlead:   oklch(0.600 0.170 285); /* Smartlead violet */
  --c-fireflies:   oklch(0.620 0.160 315); /* Fireflies purple */
  --c-salesloft:   oklch(0.640 0.150 150); /* Salesloft green */
  --c-amplemarket: oklch(0.560 0.160 262); /* Amplemarket indigo */

  /* ---- Type ---- */
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --density: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(1200px 700px at 18% -8%, oklch(0.235 0.030 150 / 0.18), transparent 60%),
    radial-gradient(1000px 800px at 110% 120%, oklch(0.220 0.020 265 / 0.30), transparent 55%),
    oklch(0.110 0.006 264);
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* ============================================================
   STAGE — scales the fixed 1440×900 window to any viewport
   ============================================================ */
#stage {
  position: fixed;
  inset: 0;
  display: block;
}
/* Fill the OS window — the frameless Electron window is itself the "card",
   so the content stretches edge-to-edge and grows with the window. */
#window {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: 46px 1fr;
  position: relative;
}

/* ============================================================
   TITLEBAR
   ============================================================ */
#titlebar {
  display: grid;
  grid-template-columns: 280px 1fr auto;
  align-items: center;
  height: 46px;
  padding: 0 14px 0 16px;
  background: linear-gradient(180deg, var(--surface-1), var(--bg));
  border-bottom: 0.5px solid var(--line);
  -webkit-app-region: drag;
  position: relative;
  z-index: 30;
}
.tl-left { display: flex; align-items: center; gap: 16px; }
.traffic { display: flex; gap: 8px; align-items: center; -webkit-app-region: no-drag; }
.traffic i {
  width: 12px; height: 12px; border-radius: 50%;
  display: block; border: 0.5px solid oklch(0 0 0 / 0.25);
  cursor: pointer;
}
.traffic:hover i::after {
  content: ""; display: block; width: 100%; height: 100%;
}
.traffic .r { background: #ff5f57; }
.traffic .y { background: #febc2e; }
.traffic .g { background: #28c840; }

/* native macOS shell (Swift/WKWebView): the REAL macOS traffic-light buttons live top-left,
   so hide the web dots and reserve room for them before the brand mark. Guarded by the
   nico-native-mac class the shell injects — inert on web and the Electron desktop. */
.nico-native-mac .traffic { display: none; }
.nico-native-mac .tl-left { padding-left: 62px; }

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 22px; height: 22px;
  color: var(--brand-blue);
  display: grid; place-items: center;
  position: relative;
}
.brand-mark svg { display: block; }
.brand-name {
  font-family: var(--mono);
  font-weight: 600; font-size: 13px; letter-spacing: -0.01em;
  color: var(--text);
}
.brand-name b { color: var(--text); }
.brand-by {
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  letter-spacing: 0.04em; text-transform: uppercase;
}

.tl-center { display: flex; align-items: center; justify-content: center; gap: 10px; }
.run-pill {
  display: flex; align-items: center; gap: 9px;
  height: 28px; padding: 0 12px 0 11px;
  background: var(--surface-2);
  border: 0.5px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  -webkit-app-region: no-drag;
  max-width: 460px;
}
.run-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--run);
  box-shadow: 0 0 0 3px var(--run-dim);
  animation: pulse 1.6s ease-in-out infinite;
}
.run-pill.done .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); animation: none; }
.run-pill .path { color: var(--text); font-weight: 500; }
.run-pill .sep { color: var(--text-4); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.tl-right { display: flex; align-items: center; gap: 8px; -webkit-app-region: no-drag; }
.conn-stack { display: flex; align-items: center; }
.conn-stack .av {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--surface-1);
  margin-left: -7px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700; color: #fff;
  position: relative;
}
.conn-stack .av:first-child { margin-left: 0; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-3); background: transparent;
  border: 0.5px solid transparent; cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }

/* ============================================================
   BODY GRID
   ============================================================ */
#body {
  display: grid;
  grid-template-columns: var(--sidebar-w, 280px) minmax(420px, 1fr) var(--canvas-w, 560px);
  min-height: 0;
  background: var(--bg);
}
#body.layout-focus { grid-template-columns: var(--sidebar-w, 280px) 1fr 0fr; }
#body.layout-canvas { grid-template-columns: var(--sidebar-w, 280px) 0.7fr 1.45fr; }
/* collapsed sidebar (toggle in the titlebar) */
body.sidebar-collapsed #body,
body.sidebar-collapsed #body.layout-focus,
body.sidebar-collapsed #body.layout-canvas { grid-template-columns: 0 minmax(420px, 1fr) var(--canvas-w, 560px); }
/* keep the sidebar as a grid item (width 0) — display:none would remove it
   from the grid and shift thread/canvas into the wrong columns */
body.sidebar-collapsed #sidebar { width: 0; min-width: 0; overflow: hidden; padding: 0; border: none; opacity: 0; pointer-events: none; }
.sidebar-toggle { -webkit-app-region: no-drag; }
body.sidebar-collapsed .sidebar-toggle { color: var(--accent-text); background: var(--accent-dim); border-color: var(--accent-line); }

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */
/* ---- mode rail (constant shell; switches the active session) ---- */
.mode-rail {
  display: flex; gap: 4px; padding: 9px 10px 6px;
  border-bottom: 0.5px solid var(--line-soft);
}
.mode-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 4px 5px; border-radius: var(--r-md); cursor: pointer;
  background: transparent; border: 0.5px solid transparent;
  color: var(--text-3); font-family: var(--mono); font-size: 10px; font-weight: 500;
  transition: all 0.14s;
}
.mode-tab .mt-ic {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 0.5px solid var(--line);
  color: var(--text-3);
  transition: all 0.16s; position: relative;
}
.mode-tab .mt-ic svg { width: 16px; height: 16px; display: block; }
.mode-tab:hover { color: var(--text-2); }
.mode-tab:hover .mt-ic { color: var(--text); border-color: var(--line-bright); transform: translateY(-1px); }
.mode-tab.on { color: var(--text); }
.mode-tab.on .mt-ic {
  background: var(--accent); color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 2px 10px var(--accent-dim), inset 0 1px 0 oklch(1 0 0 / 0.25);
}

#sidebar {
  background: linear-gradient(180deg, var(--surface-1), var(--bg) 70%);
  border-right: 0.5px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
  position: relative;
}
/* drag handle on the sidebar's right edge */
.sidebar-resize {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 25; -webkit-app-region: no-drag;
}
.sidebar-resize::after {
  content: ""; position: absolute; top: 0; right: 3px; width: 1.5px; height: 100%;
  background: transparent; transition: background .12s;
}
.sidebar-resize:hover::after, .sidebar-resize.drag::after { background: var(--accent); }
body.resizing-sidebar { cursor: col-resize; user-select: none; }
.side-sec { padding: 9px 10px 5px; }
.side-label {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-4); padding: 0 6px 5px;
  display: flex; align-items: center; justify-content: space-between;
}
.side-label .add { cursor: pointer; color: var(--text-3); }
.side-label .add:hover { color: var(--accent-text); }

.new-run {
  display: flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 12px; margin: 0 0 2px;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-md); cursor: pointer;
  font-family: var(--mono); font-weight: 600; font-size: 12.5px;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.2) inset, 0 4px 14px oklch(0.885 0.19 128 / 0.22);
  transition: transform 0.1s, filter 0.12s;
}
.new-run:hover { filter: brightness(1.06); }
.new-run:active { transform: translateY(1px); }
.new-run .kbd {
  margin-left: auto; font-size: 10px; opacity: 0.65;
  border: 0.5px solid oklch(0.235 0.07 142 / 0.4); border-radius: 4px;
  padding: 1px 5px;
}

.run-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 5px 8px; border-radius: var(--r-md); cursor: pointer;
  position: relative; transition: background 0.12s;
}
.run-item:hover { background: var(--surface-2); }
.run-item.active { background: var(--surface-2); }
.run-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 2.5px; border-radius: 2px; background: var(--accent);
}
.run-item .rdot {
  width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex: none;
}
.run-item .rdot.running { background: var(--run); box-shadow: 0 0 0 3px var(--run-dim); animation: pulse 1.6s infinite; }
.run-item .rdot.done { background: var(--ok); }
.run-item .rdot.idle { background: var(--text-4); }
.run-meta { min-width: 0; flex: 1; }
.run-title {
  font-size: 12.5px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.run-sub {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-4);
  margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.side-spacer { flex: 1; min-height: 8px; }

/* connectors */
#connectors { border-top: 0.5px solid var(--line-soft); padding-bottom: 8px; }
.conn-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: var(--r-sm); cursor: pointer;
  transition: background 0.12s;
}
.conn-row:hover { background: var(--surface-2); }
.conn-ic {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 8.5px; font-weight: 700; color: #fff;
}
.conn-name { font-size: 12px; color: var(--text-2); flex: 1; }
/* "Show all N" row — opens the connectors page instead of a long inline list */
.conn-more {
  padding: 5px 8px 2px; margin-top: 1px; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  color: var(--text-3); letter-spacing: -0.01em;
}
.conn-more:hover { color: var(--accent-text); }
.conn-state {
  font-family: var(--mono); font-size: 10px; color: var(--text-4);
  display: flex; align-items: center; gap: 5px;
}
.conn-state .s { width: 6px; height: 6px; border-radius: 50%; }
.conn-state .s.on { background: var(--ok); box-shadow: 0 0 6px oklch(0.805 0.15 150 / 0.6); }
.conn-state .s.off { background: var(--text-4); }

.side-foot {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-top: 0.5px solid var(--line-soft);
}
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-salestools), var(--c-clay));
  display: grid; place-items: center; color: #fff;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
}
.side-foot .nm { font-size: 12px; color: var(--text-2); font-weight: 500; }
.side-foot .role { font-family: var(--mono); font-size: 10px; color: var(--text-4); }

/* ============================================================
   CENTER — AGENT THREAD
   ============================================================ */
#thread-col {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 0.5px solid var(--line);
  background: var(--bg);
  position: relative;          /* anchors the canvas resize/collapse divider */
}
.col-head {
  height: 42px; flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-bottom: 0.5px solid var(--line-soft);
}
.col-head .h-title {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
  /* long session titles ellipsize on one line — never wrap over the thread */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.col-head { overflow: hidden; }
/* the code-workspace chip only belongs to Code mode */
#codeWs { display: none; }
body[data-session="code"] #codeWs { display: inline-flex; }
.col-head .h-spacer { flex: 1; }
.seg {
  display: flex; background: var(--surface-2); border-radius: 8px;
  padding: 2px; border: 0.5px solid var(--line-soft);
}
.seg button {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  color: var(--text-3); background: transparent; border: none;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.12s;
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px oklch(0 0 0 / 0.3); }

#thread {
  flex: 1; overflow-y: auto; padding: 18px 18px 8px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
#thread.hide { display: none; }
.alt-thread {
  flex: 1; overflow-y: auto; padding: 18px 18px 8px;
  display: none; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.alt-thread.on { display: flex; }

/* agent action log (cowork narration) */
.do-log {
  border: 0.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-1); overflow: hidden;
}
.do-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px;
  font-size: 12.5px; color: var(--text-2); border-bottom: 0.5px solid var(--line-soft);
}
.do-row:last-child { border-bottom: none; color: var(--text-3); }
.do-ic { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }

/* dynamic canvas tab slot */
.ctab-slot { display: flex; align-items: stretch; gap: 2px; }


/* user message */
.msg-user {
  align-self: flex-end; max-width: 86%;
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 12px 12px 4px 12px;
  padding: 11px 14px; font-size: 13.5px; line-height: 1.5;
  color: var(--text); letter-spacing: -0.005em;
}
.msg-user .u-tag {
  font-family: var(--mono); font-size: 10px; color: var(--text-4);
  margin-bottom: 4px; letter-spacing: 0.04em;
}

/* nico turn */
.turn { display: flex; gap: 11px; max-width: 100%; }
.turn .nico-ic {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--brand-blue); color: var(--brand-paper); display: grid; place-items: center;
  margin-top: 1px;
  box-shadow: 0 0 0 1px oklch(0.62 0.18 35 / 0.35), 0 2px 10px oklch(0.62 0.18 35 / 0.22);
}
.turn-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.turn-name {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--accent-text); display: flex; align-items: center; gap: 8px;
}
.turn-name .t { color: var(--text-4); font-weight: 400; }
.prose { font-size: 13.5px; line-height: 1.55; color: var(--text-2); letter-spacing: -0.005em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose code {
  font-family: var(--mono); font-size: 12px; background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px; color: var(--accent-text);
  border: 0.5px solid var(--line-soft);
}

/* plan / todo block */
.plan {
  background: var(--surface-1); border: 0.5px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
}
.plan-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-bottom: 0.5px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px; color: var(--text-2); font-weight: 500;
}
.plan-head .pcount { margin-left: auto; color: var(--text-4); }
.plan-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; font-size: 12.5px; color: var(--text-2);
  border-bottom: 0.5px solid var(--line-soft);
}
.plan-item:last-child { border-bottom: none; }
/* v2: mono step numbers (01 02 …) in the accent, before the check */
.plan-item .pnum { font-family: var(--mono); font-size: 10.5px; color: var(--accent-text); min-width: 18px; text-align: right; flex: none; }
.plan-item.done .pnum { color: var(--text-4); }
.plan-item .chk {
  width: 16px; height: 16px; border-radius: 5px; flex: none;
  border: 1.5px solid var(--line-bright); display: grid; place-items: center;
  transition: all 0.2s;
}
.plan-item.done .chk { background: var(--accent); border-color: var(--accent); }
.plan-item.done .chk svg { opacity: 1; }
.plan-item .chk svg { opacity: 0; }
.plan-item.done .ptxt { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-bright); }
.plan-item.active .chk { border-color: var(--run); box-shadow: 0 0 0 3px var(--run-dim); }
.plan-item.active .ptxt { color: var(--text); }
.plan-item .ptag {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  color: var(--text-4); display: flex; align-items: center; gap: 5px;
}

/* tool call card */
.tool {
  border: 0.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-1); overflow: hidden;
}
.tool-head {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; cursor: pointer;
  font-family: var(--mono); font-size: 11.5px;
}
.tool-head:hover { background: var(--surface-2); }
.tool-ic {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700; color: #fff; font-family: var(--mono);
}
.tool-verb { color: var(--text); font-weight: 600; }
/* v2 execution-log: connector attribution beside the verb, muted mono */
.tool-conn { color: var(--text-4); font-size: 10.5px; letter-spacing: 0.01em; }
.tool-arg { color: var(--text-3); }
.tool-arg b { color: var(--accent-text); font-weight: 500; }
.tool-status {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--text-4);
}
.tool-status .spin {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--line-bright); border-top-color: var(--run);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-status.ok { color: var(--ok); }
.tool-elapsed { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* live run-status line — "Nico is working · 4.2s · 2 running" while streaming */
.run-status {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 2px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--surface-1); border: 0.5px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  letter-spacing: 0.02em;
}
.run-status .rs-spin {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--line-bright); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.run-status .rs-txt { font-variant-numeric: tabular-nums; }
.tool-body {
  border-top: 0.5px solid var(--line-soft);
  padding: 10px 12px; font-family: var(--mono); font-size: 11px;
  color: var(--text-3); line-height: 1.6;
  background: oklch(0.145 0.006 264);
}
.tool-body .row { display: flex; gap: 8px; }
.tool-body .k { color: var(--text-4); }
.tool-body .v { color: var(--text-2); }
.tool-body .added { color: var(--accent-text); }

/* result rows under a finished tool call — a source-list group (favicon + label + muted detail),
   like a web-search result card. Rendered by finishToolCard() only when the real payload yields
   labelable rows; the header's .tool-status becomes the "N results" count. */
.tool-rows { border-top: 0.5px solid var(--line-soft); padding: 4px 6px 6px; display: flex; flex-direction: column; }
.tool-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 7px; border-radius: 8px; min-width: 0;
  font-family: var(--sans); font-size: 12px; color: var(--text-2);
}
.tool-row + .tool-row { border-top: 0.5px solid var(--line-soft); }
.tool-row:hover { background: var(--surface-2); }
.tr-ic {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  font-size: 9px; font-weight: 700; font-family: var(--mono);
  background: var(--surface-3);
}
.tr-ic.has-fav { background: #fff; }
.tr-ic img { width: 16px; height: 16px; object-fit: contain; display: block; }
.tr-main {
  color: var(--text); font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0;
}
.tr-sub {
  margin-left: auto; padding-left: 10px; color: var(--text-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 46%; flex: 0 1 auto; font-size: 11.5px;
}
.tr-more {
  padding: 5px 9px 3px; font-family: var(--mono); font-size: 10.5px; color: var(--text-4);
}
/* single-object tool results — compact in-card KPI tiles / bar rows / excerpts.
   Reuses the pipeline pane's .kpi/.stage-row tokens at chat-card scale. */
.tool .tool-kpis-wrap { border-top: 0.5px solid var(--line-soft); padding: 8px 10px 10px; }
.tool .tool-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0; }
.tool .tool-kpis .kpi { padding: 7px 9px; background: var(--surface-2); border: 0.5px solid var(--line-soft); border-radius: 8px; }
.tool .tool-kpis .kv { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); }
.tool .tool-kpis .kl { font-size: 9.5px; color: var(--text-4); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool .tool-bars-label { padding: 8px 2px 2px; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-4); }
.tool .tool-bars { display: flex; flex-direction: column; gap: 3px; padding: 4px 2px 0; }
.tool .tool-kpis-wrap .tool-bars, .tool > .tool-bars { border-top: 0.5px solid var(--line-soft); padding: 8px 10px 10px; }
.tool .tool-bars .stage-row { display: flex; align-items: center; gap: 8px; }
.tool .tool-bars .sn { flex: 0 0 108px; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool .tool-bars .sbar { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.tool .tool-bars .sbar i { display: block; height: 100%; border-radius: 3px; }
.tool .tool-bars .sv { flex: none; font-family: var(--mono); font-size: 11px; color: var(--text-2); min-width: 34px; text-align: right; }
.tool .tool-excerpt { border-top: 0.5px solid var(--line-soft); padding: 6px 10px 8px; }
.tool .tool-excerpt summary { cursor: pointer; font-family: var(--mono); font-size: 10.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; }
.tool .tool-excerpt .tx { padding: 6px 2px 0; font-size: 12px; line-height: 1.55; color: var(--text-3); white-space: pre-wrap; }

/* ============================================================
   DELTA 1 — inline approval-gate card. A confirm-gated write that
   the model PREVIEWED (server preview:true) renders here as an
   in-thread approval. Attention state = --run (amber, "pending"),
   approved = --ok. Accent blue is reserved for the primary Approve.
   Tokens only — works in dark / light / sierra.
   ============================================================ */
.gate-card {
  border: 0.5px solid var(--run); border-radius: var(--r-md);
  background: var(--surface-1); overflow: hidden; margin: 8px 0;
  box-shadow: 0 0 0 3px var(--run-dim);
}
.gate-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-bottom: 0.5px solid var(--line-soft);
  font-family: var(--mono); font-size: 11.5px;
}
.gate-head .gate-ic { color: var(--run); display: grid; place-items: center; flex: none; }
.gate-title { color: var(--text); font-weight: 600; letter-spacing: 0.01em; }
.gate-conn { color: var(--text-4); font-size: 10.5px; }
.gate-count {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  color: var(--run); background: var(--run-dim);
  border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums;
}
.gate-sum { padding: 9px 12px 4px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.gate-diff { padding: 2px 12px 8px; display: flex; flex-direction: column; gap: 3px; }
.gate-field { display: flex; gap: 10px; align-items: baseline; font-family: var(--mono); font-size: 11px; min-width: 0; }
.gate-field .gf-k { color: var(--text-4); flex: 0 0 32%; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gate-field .gf-v { color: var(--text-2); flex: 1 1 auto; min-width: 0; word-break: break-word; }
.gate-acts {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px 11px; border-top: 0.5px solid var(--line-soft);
}
.gate-btn {
  font: 600 11.5px/1 var(--sans); padding: 8px 13px; border-radius: 8px;
  cursor: pointer; border: 0.5px solid var(--line); background: transparent; color: var(--text-2);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.gate-btn:hover { border-color: var(--line-bright); color: var(--text); }
.gate-btn.approve { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.gate-btn.approve:hover { color: var(--on-accent); box-shadow: 0 2px 10px var(--accent-dim), inset 0 1px 0 oklch(1 0 0 / 0.22); }
.gate-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.gate-btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.gate-state { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.gate-card.approved { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); }
.gate-card.approved .gate-ic, .gate-card.approved .gate-title, .gate-card.approved .gate-state { color: var(--ok); }
.gate-card.skipped { border-color: var(--line); box-shadow: none; opacity: 0.72; }
.gate-skipped { padding: 8px 12px 11px; font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }

/* ============================================================
   DELTA 2 — stage-grouped execution log. Consecutive tool cards
   fold under a named, collapsible stage header with a real
   wall-clock duration (first tool start → last tool done). No
   fabricated stage timings.
   ============================================================ */
.stage-group {
  border: 0.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-1); overflow: hidden; margin: 8px 0;
}
.stage-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 8px 11px; font-family: var(--mono); font-size: 11px; color: var(--text-2);
}
.stage-head:hover { background: var(--surface-2); }
.stage-head .sg-caret { color: var(--text-4); font-size: 9px; width: 10px; flex: none; transition: transform 0.15s; }
.stage-group.collapsed .sg-caret { transform: rotate(-90deg); }
.stage-head .sg-name { color: var(--text); font-weight: 600; }
.stage-head .sg-meta { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--text-4); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.stage-head .sg-spin {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--line-bright); border-top-color: var(--run);
  animation: spin 0.7s linear infinite;
}
.stage-head .sg-check { color: var(--ok); display: grid; place-items: center; }
.stage-tools { border-top: 0.5px solid var(--line-soft); padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.stage-group.collapsed .stage-tools { display: none; }
.stage-tools .tool { background: var(--surface-2); }
.stage-tools .tool-head:hover { background: var(--surface-3); }

/* ============================================================
   DELTA 4 — richer run-plan card. Real tool labels attach to the
   step they correspond to (by execution order); a gate tag + an
   "Approve & run" footer appear only when a write is genuinely
   pending approval. No pre-run estimates.
   ============================================================ */
.plan-item .plan-step-tool {
  font-family: var(--mono); font-size: 10px; color: var(--text-4);
  margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%;
}
.plan-item .gate-tag {
  margin-left: auto; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.03em;
  color: var(--run); background: var(--run-dim); border-radius: 999px; padding: 2px 7px; text-transform: uppercase; flex: none;
}
.plan-item .gate-tag.ok { color: var(--ok); background: var(--ok-dim); }
.plan-item .gate-tag.skip { color: var(--text-4); background: var(--surface-3); }
.plan-approve {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-top: 0.5px solid var(--line-soft); background: var(--run-dim);
}
.plan-approve .pa-note { font-family: var(--mono); font-size: 10.5px; color: var(--run); }

/* ============================================================
   EXECUTION PLAN (server per-step protocol) — the plan is a
   STOP-POINT: steps stream in PENDING (empty circles) and only
   fill in as the APPROVED run's tools actually complete. Reject
   greys everything that never ran. Tokens only — dark / light /
   sierra all inherit their own --run/--accent/--text ramps.
   ============================================================ */
.plan.exec .plan-item .chk { border-radius: 999px; }
/* log style, not strike-through — a completed step is history, not noise */
.plan.exec .plan-item.done .ptxt { text-decoration: none; color: var(--text-3); }
.plan.exec .plan-item.active .chk { border-color: var(--run); animation: plan-pulse 1.2s ease-in-out infinite; }
@keyframes plan-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--run-dim); }
  50%      { box-shadow: 0 0 0 5px var(--run-dim); }
}
.plan-item.skip .ptxt, .plan-item.skip .pnum { color: var(--text-4); }
.plan-item.skip .chk { border-color: var(--line); opacity: 0.55; }
/* gate-in-card footer: Approve & Execute = primary accent, Reject = neutral
   surface, Other… = the existing outline .gate-btn default. The chosen button
   stays at full strength after the row is disabled (visible decision). */
.plan-approve.plan-gate { flex-wrap: wrap; }
.plan-approve.plan-gate .pa-note { margin-left: auto; }
.plan-approve .gate-btn.neutral { background: var(--surface-2); }
.plan-approve .gate-btn.chosen:disabled { opacity: 1; }

/* result chips */
.result-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 8px; padding: 7px 11px;
}
.chip .big { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--text); }
.chip .lbl { font-size: 10.5px; color: var(--text-4); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }

/* typing indicator */
.typing { display: flex; align-items: center; gap: 5px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,60%,100% { opacity: 0.25; } 30% { opacity: 1; } }

/* composer */
#composer {
  flex: none; padding: 12px 16px 16px; border-top: 0.5px solid var(--line-soft);
  background: linear-gradient(0deg, var(--surface-1), var(--bg));
}
.composer-box {
  background: var(--surface-2); border: 0.5px solid var(--line-bright);
  border-radius: var(--r-lg); padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* v2 keyboard hints under the composer — real bindings only */
.composer-hint {
  text-align: center; padding: 6px 0 0;
  font: 400 10px var(--mono); color: var(--text-4); letter-spacing: 0.03em;
}
.composer-hint kbd {
  font: 500 9.5px var(--mono); color: var(--text-3);
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 4px; padding: 1.5px 5px; margin-right: 1px;
}
.composer-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-dim); }
.composer-box textarea {
  width: 100%; background: transparent; border: none; resize: none;
  color: var(--text); font-family: var(--sans); font-size: 13.5px;
  line-height: 1.5; outline: none; min-height: 22px; max-height: 120px;
}
.composer-box textarea::placeholder { color: var(--text-4); }
.composer-bar { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.cbtn {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px;
  background: var(--surface-3); border: 0.5px solid var(--line);
  border-radius: 7px; color: var(--text-3); cursor: pointer;
  font-family: var(--mono); font-size: 11px; transition: all 0.12s;
}
.cbtn:hover { background: var(--hover); color: var(--text-2); }
.cbtn.model { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); }
.composer-bar .sp { flex: 1; }

/* ---- usage chip + popover (5-hour · weekly · monthly limits) ---- */
.cbtn.usage .usage-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim);
}
.cbtn.usage.warn .usage-dot { background: var(--run); box-shadow: 0 0 0 3px var(--run-dim); }
.cbtn.usage.crit .usage-dot { background: var(--err); box-shadow: 0 0 0 3px oklch(0.690 0.190 25 / 0.16); }
.cbtn.usage.nodata .usage-dot { background: var(--text-4); box-shadow: none; }
.cbtn.usage.open { color: var(--text); border-color: var(--line); background: var(--hover); }

.composer-box { position: relative; }
.usage-pop {
  position: absolute; bottom: 48px; right: 0; width: 290px; z-index: 40;
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 12px; padding: 13px 15px;
  box-shadow: 0 14px 38px oklch(0 0 0 / 0.34);
}
.usage-pop[hidden] { display: none; }
.usage-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px;
}
.usage-plan { color: var(--accent-text); text-transform: none; letter-spacing: 0; font-weight: 500; }
.usage-row { margin-bottom: 12px; }
.usage-row:last-child { margin-bottom: 0; }
.usage-row .lbl {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12px; color: var(--text-2); margin-bottom: 5px;
}
.usage-row .lbl .nm { font-weight: 500; }
.usage-row .lbl .rt { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); margin-left: auto; padding-left: 8px; }
.usage-row .amt { font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-top: 4px; }
.usage-track { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.usage-fill { height: 100%; border-radius: 4px; background: var(--ok); transition: width 0.25s ease; }
.usage-fill.warn { background: var(--run); }
.usage-fill.crit { background: var(--err); }
.usage-fill.unlimited { background: var(--info); opacity: 0.45; }
.usage-upgrade {
  width: 100%; margin-top: 13px; height: 32px; border-radius: 8px;
  border: 0.5px solid var(--accent-line); background: var(--accent-dim);
  color: var(--accent-text); font-family: var(--sans); font-size: 12.5px;
  font-weight: 500; cursor: pointer; transition: all 0.12s;
}
.usage-upgrade:hover { background: var(--accent); color: var(--bg); }
.usage-upgrade[hidden] { display: none; }

.send {
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  box-shadow: 0 2px 10px oklch(0.885 0.19 128 / 0.25);
  transition: filter 0.12s, transform 0.1s;
}
.send:hover { filter: brightness(1.06); }
.send:active { transform: translateY(1px); }

/* ============================================================
   RIGHT — WORK CANVAS
   ============================================================ */
#canvas-col {
  display: flex; flex-direction: column; min-height: 0; background: var(--surface-1);
  overflow: hidden;
}
.canvas-tabs {
  height: 42px; flex: none; display: flex; align-items: stretch;
  padding: 0 8px; border-bottom: 0.5px solid var(--line);
  background: var(--bg); gap: 2px;
}
.ctab {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-3);
  cursor: pointer; position: relative; border: none; background: transparent;
  transition: color 0.12s;
}
.ctab:hover { color: var(--text-2); }
.ctab.on { color: var(--text); }
.ctab.on::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -0.5px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.ctab .tdot { width: 6px; height: 6px; border-radius: 50%; }
.ctab .badge {
  font-size: 9.5px; background: var(--surface-3); color: var(--text-3);
  border-radius: 20px; padding: 1px 6px; border: 0.5px solid var(--line-soft);
}
.ctab.on .badge { background: var(--accent-dim); color: var(--accent-text); border-color: var(--accent-line); }
.canvas-tabs .sp { flex: 1; }
.canvas-tools { display: flex; align-items: center; gap: 4px; }

/* artifact history: one quick-open chip PER capture at the top of a thread — reopen
   any earlier result as a labeled snapshot (newest-first, active one highlighted) */
.art-chipbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 2px 0 16px; padding: 10px 12px;
  background: var(--surface-1); border: 0.5px solid var(--line-soft); border-radius: 12px;
  /* pinned so saved leads/accounts artifacts are always one tap away — they must never
     scroll out of reach when the conversation grows or the canvas artifact changes */
  position: sticky; top: 6px; z-index: 6;
  background: var(--surface-2); box-shadow: 0 2px 10px -6px var(--shadow, rgba(0,0,0,0.25));
  backdrop-filter: blur(6px);
}
.acb-label { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); letter-spacing: 0.02em; margin-right: 2px; }
.art-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border: 0.5px solid var(--line-soft); border-radius: 20px;
  padding: 5px 11px; cursor: pointer; transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.art-chip:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-dim); }
/* the active (currently-open) capture */
.art-chip.on { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); }
.art-chip .tdot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
/* label parts: connector · tool · time */
.art-chip .ac-conn { text-transform: lowercase; }
.art-chip .ac-tool { color: var(--text); }
.art-chip.on .ac-tool { color: var(--accent-text); }
.art-chip .ac-conn::after, .art-chip .ac-tool::after { content: "·"; margin: 0 5px 0 6px; color: var(--text-4); }
.art-chip .ac-time { color: var(--text-4); }
.art-chip .badge {
  font-size: 9.5px; background: var(--surface-3); color: var(--text-3);
  border-radius: 20px; padding: 1px 6px; border: 0.5px solid var(--line-soft);
}
.art-chip.on .badge { background: var(--accent-line); color: var(--accent-text); border-color: var(--accent-line); }

/* model-emitted quick replies (CHOICES: protocol) — tappable answers under a short question,
   rendered by renderChoices() in nico-api.js; a tap sends the exact label as the user's reply */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.choice-btn {
  font: 600 12px/1 var(--sans); padding: 9px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 0.5px solid var(--line-bright);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.choice-btn:hover { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-dim); }
/* rich options: two-line buttons with an optional data chip, ★ + why on the recommended one */
.choice-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; max-width: 300px; }
.choice-btn .choice-label { display: flex; align-items: center; gap: 6px; line-height: 1.2; }
.choice-btn .choice-star { color: var(--accent-text); }
.choice-btn .choice-chip {
  font: 600 10px/1 var(--mono); padding: 2.5px 7px; border-radius: 20px;
  background: var(--accent-dim); color: var(--accent-text); border: 0.5px solid var(--accent-line);
}
.choice-btn .choice-sub { font: 400 11px/1.4 var(--sans); color: var(--text-3); }
.choice-btn .choice-why { font: 400 10.5px/1.4 var(--sans); color: var(--accent-text); }
.choice-btn.rec { border-color: var(--accent-line); background: var(--accent-dim); }

.canvas-stage { flex: 1; min-height: 0; position: relative; }
.pane { position: absolute; inset: 0; display: none; flex-direction: column; min-height: 0; }
.pane.on { display: flex; }

/* ---- PREVIEW PANE (live running app + dev chrome) ---- */
.browser-chrome {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 0.5px solid var(--line);
  background: var(--bg);
}
.bc-nav { display: flex; gap: 2px; }
.bc-btn {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 0.5px solid transparent; color: var(--text-3);
  transition: all 0.12s;
}
.bc-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.bc-btn.on { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent-text); }
.bc-btn:disabled { opacity: 0.35; cursor: default; }
.bc-btn svg { width: 15px; height: 15px; }
.bc-url {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 11px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--text-3); min-width: 0;
}
.bc-url .lock { color: var(--ok); flex: none; }
.bc-url .host { color: var(--text-2); }
.bc-url .pathp { color: var(--accent-text); }
.bc-url .live-dot { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--ok); flex: none; }
.bc-url .live-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.bc-tools { display: flex; gap: 2px; }

.preview-host { flex: 1; min-height: 0; display: flex; flex-direction: column; background: oklch(0.135 0.005 264); position: relative; }
.preview-frame {
  flex: 1; min-height: 0; overflow: auto; position: relative;
  transition: max-width 0.3s ease, margin 0.3s ease;
}
.preview-frame.tablet { max-width: 720px; margin: 0 auto; border-left: 0.5px solid var(--line); border-right: 0.5px solid var(--line); }
.preview-frame.phone { max-width: 390px; margin: 0 auto; border-left: 0.5px solid var(--line); border-right: 0.5px solid var(--line); }

/* select-mode element highlight */
.preview-frame.selecting [data-el] { cursor: crosshair; }
.preview-frame.selecting [data-el]:hover {
  outline: 1.5px solid var(--accent); outline-offset: 1px;
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.sel-tag {
  position: absolute; z-index: 60; pointer-events: none;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  transform: translateY(-100%); margin-top: -4px;
  opacity: 0; transition: opacity 0.1s;
}

/* ---- the live GTM dashboard Nico built ---- */
.app {
  --app-bg: var(--surface-1);
  --app-card: var(--surface-2);
  --app-line: var(--line);
  background: var(--app-bg); min-height: 100%; padding: 20px 22px 28px;
  font-family: var(--sans);
}
.app-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.app-logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(150deg, var(--accent), oklch(0.78 0.17 150));
  display: grid; place-items: center; color: var(--on-accent); font-family: var(--mono); font-weight: 700; font-size: 13px;
  box-shadow: 0 2px 10px oklch(0.885 0.19 128 / 0.25);
}
.app-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.app-head .ah-sub { font-family: var(--mono); font-size: 11px; color: var(--text-4); margin-top: 2px; }
.app-head .ah-live { margin-left: auto; display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--ok); padding: 4px 9px; border: 0.5px solid oklch(0.805 0.15 150 / 0.4); border-radius: 20px; }
.app-head .ah-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--app-card); border: 0.5px solid var(--app-line); border-radius: 11px; padding: 13px 14px; }
.kpi .kv { font-family: var(--mono); font-size: 23px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.kpi .kl { font-size: 11px; color: var(--text-4); margin-top: 3px; }
.kpi .kd { font-family: var(--mono); font-size: 10px; margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.kpi .kd.up { color: var(--ok); }
.kpi .kd.acc { color: var(--accent-text); }

.app-card { background: var(--app-card); border: 0.5px solid var(--app-line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.app-card .ac-head { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 0.5px solid var(--app-line); }
.app-card .ac-head h3 { font-size: 13px; font-weight: 600; }
.app-card .ac-head .ac-meta { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }

/* score distribution bars */
.dist { display: flex; align-items: stretch; gap: 7px; height: 96px; padding: 14px 16px 0; }
.dist .col { flex: 1; position: relative; }
.dist .col .bar2 { position: absolute; left: 0; right: 0; bottom: 20px; height: 8px; border-radius: 5px 5px 0 0; background: var(--surface-3); transition: height 0.6s cubic-bezier(0.2,0,0,1); }
.dist .col .lbl2 { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 9px; color: var(--text-4); }

/* top accounts list inside app */
.acct { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 0.5px solid var(--app-line); }
.acct:last-child { border-bottom: none; }
.acct .rank { font-family: var(--mono); font-size: 11px; color: var(--text-4); width: 16px; }
.acct .alogo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-family: var(--mono); font-size: 9px; font-weight: 700; color: #fff; }
.acct .an { font-size: 13px; font-weight: 500; color: var(--text); }
.acct .ad { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.acct .ascore { display: flex; align-items: center; gap: 9px; }
.acct .ascore .ring { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.acct .ascore .rbar { width: 56px; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.acct .ascore .rbar i { display: block; height: 100%; border-radius: 4px; }
.acct .abtn { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); background: var(--surface-3); border: 0.5px solid var(--app-line); border-radius: 7px; padding: 5px 9px; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.acct .abtn:hover { background: var(--hover); color: var(--text); }

/* ---- console strip (Tests / Terminal / Problems) ---- */
.console {
  flex: none; border-top: 0.5px solid var(--line); background: oklch(0.125 0.005 264);
  display: flex; flex-direction: column;
}
.console.collapsed .console-body { display: none; }
.console-tabs { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 0.5px solid var(--line-soft); }
.console-tab {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  background: transparent; border: none; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.12s;
}
.console-tab:hover { color: var(--text-2); }
.console-tab.on { background: var(--surface-2); color: var(--text); }
.console-tab .cbdg { font-size: 9px; padding: 0 5px; border-radius: 10px; }
.console-tab .cbdg.pass { background: var(--ok-dim); color: var(--ok); }
.console-tab .cbdg.fail { background: oklch(0.69 0.19 25 / 0.16); color: var(--err); }
.console-tabs .csp { flex: 1; }
.console-collapse { width: 24px; height: 24px; border-radius: 6px; border: none; background: transparent; color: var(--text-4); cursor: pointer; display: grid; place-items: center; }
.console-collapse:hover { background: var(--surface-2); color: var(--text-2); }
.console-body { height: 162px; overflow: auto; padding: 9px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.65; }
.console-pane { display: none; }
.console-pane.on { display: block; }

/* test rows */
.test-row { display: flex; align-items: center; gap: 9px; padding: 2px 0; color: var(--text-2); }
.test-row .ti { width: 13px; flex: none; }
.test-row.pass .ti { color: var(--ok); }
.test-row.fail .ti { color: var(--err); }
.test-row.run .ti { color: var(--run); }
.test-row .tt { color: var(--text-3); }
.test-row .tt b { color: var(--text); font-weight: 500; }
.test-row .tms { margin-left: auto; color: var(--text-4); font-size: 10px; }
.test-summary { margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--line-soft); color: var(--text-3); }
.test-summary b.ok { color: var(--ok); }

/* ---- CODE PANE ---- */
.code-top {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-bottom: 0.5px solid var(--line-soft); flex: none;
}
.file-tab {
  display: flex; align-items: center; gap: 7px; padding: 5px 10px;
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 7px 7px 0 0; font-family: var(--mono); font-size: 11px; color: var(--text-2);
}
.file-tab .fdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.code-scroll { flex: 1; overflow: auto; min-height: 0; background: oklch(0.142 0.006 264); }
pre.code {
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  padding: 14px 0; color: var(--text-2); tab-size: 2;
}
pre.code .ln {
  display: grid; grid-template-columns: 44px 1fr; align-items: baseline;
  padding: 0 14px 0 0;
}
pre.code .ln:hover { background: oklch(0.18 0.007 264); }
pre.code .ln.hl { background: var(--accent-dim); }
pre.code .gut { color: var(--text-4); text-align: right; padding-right: 16px; user-select: none; font-size: 11px; }
.tok-k { color: oklch(0.78 0.13 330); }   /* keyword */
.tok-f { color: oklch(0.82 0.12 230); }   /* function */
.tok-s { color: oklch(0.83 0.13 140); }   /* string */
.tok-n { color: oklch(0.83 0.12 60); }    /* number */
.tok-c { color: var(--text-4); font-style: italic; }  /* comment */
.tok-t { color: oklch(0.84 0.10 195); }   /* type */
.tok-p { color: var(--text-3); }          /* punctuation */
.tok-v { color: var(--text); }            /* variable */

/* terminal under code */
.terminal {
  flex: none; height: 188px; border-top: 0.5px solid var(--line);
  background: oklch(0.125 0.005 264); display: flex; flex-direction: column;
}
.term-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px;
  border-bottom: 0.5px solid var(--line-soft);
  font-family: var(--mono); font-size: 10.5px; color: var(--text-4);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.term-head .tcontrols { margin-left: auto; display: flex; gap: 8px; }
.term-body {
  flex: 1; overflow: auto; padding: 10px 14px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: var(--text-2);
}
.term-body .line { white-space: pre-wrap; }
.term-body .p { color: var(--accent-text); }
.term-body .dim { color: var(--text-4); }
.term-body .ok { color: var(--ok); }
.term-body .warn { color: var(--run); }
.term-body .cur::after { content: "▋"; color: var(--accent); animation: blink2 1s steps(2) infinite; }
@keyframes blink2 { 50% { opacity: 0; } }

/* ---- DATA PANE ----
   Rhythm: every full-width surface in the artifact panel shares one 16px
   horizontal inset (.data-top, .art-toolbar, first/last table cells, drawer
   sections, cadence scrollers) so headers, toolbars and cards line up. */
.data-top {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  min-height: 46px;
  border-bottom: 0.5px solid var(--line-soft); flex: none;
}
.data-top .dtitle { font-family: var(--mono); font-size: 12px; color: var(--text); font-weight: 500; }
.data-top .dmeta { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.pillbtn {
  display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 7px;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2); cursor: pointer;
}
.pillbtn:hover { background: var(--hover); }
.data-scroll { flex: 1; overflow: auto; min-height: 0; overscroll-behavior: contain; }
/* separate (not collapsed) borders so the header hairline travels WITH the
   sticky thead — collapsed borders detach from sticky cells in Chromium */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
table.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); text-align: left;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-4);
  padding: 9px 12px; border-bottom: 0.5px solid var(--line);
  box-shadow: 0 3px 8px -4px oklch(0 0 0 / 0.16);
  white-space: nowrap;
}
table.grid tbody td {
  padding: 10px 12px; border-bottom: 0.5px solid var(--line-soft);
  color: var(--text-2); vertical-align: middle; white-space: nowrap;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis;   /* one huge value can't blow up a column */
}
/* first/last cells carry the shared 16px panel inset */
table.grid thead th:first-child, table.grid tbody td:first-child { padding-left: 16px; }
table.grid thead th:last-child,  table.grid tbody td:last-child  { padding-right: 16px; }
table.grid tbody tr { transition: background 0.12s; }
table.grid tbody tr:nth-child(even) { background: color-mix(in oklab, var(--surface-2) 45%, transparent); }  /* subtle zebra, token-derived */
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tbody tr.fresh { animation: rowin 0.5s ease; }
@keyframes rowin { from { background: var(--accent-dim); } to { background: transparent; } }
.co { display: flex; align-items: center; gap: 9px; }
.co-logo {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-family: var(--mono); font-size: 9px; font-weight: 700; color: #fff;
}
.co-name { color: var(--text); font-weight: 500; }
.co-dom { font-family: var(--mono); font-size: 10px; color: var(--text-4); }
.score {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-weight: 600;
}
.score .bar { width: 42px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.score .bar i { display: block; height: 100%; border-radius: 3px; }
.tag {
  font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 5px;
  border: 0.5px solid var(--line); color: var(--text-3); background: var(--surface-2);
}
.tag.hot { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); }
.tag.sync { color: var(--info); border-color: oklch(0.77 0.11 240 / 0.4); background: var(--info-dim); }
.srcdots { display: flex; gap: 3px; }
.srcdots i { width: 14px; height: 14px; border-radius: 4px; display: grid; place-items: center; font-size: 7px; font-weight: 700; color: #fff; font-family: var(--mono); }

/* ---- COWORK PANE ---- */
.cowork {
  flex: 1; min-height: 0; overflow: auto; padding: 16px;
  background:
    radial-gradient(700px 400px at 80% 0%, oklch(0.22 0.02 240 / 0.25), transparent 60%),
    var(--surface-1);
}
.cw-app {
  background: oklch(0.205 0.008 255); border: 0.5px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 18px 50px oklch(0 0 0 / 0.4);
  /* this mockup window is always dark — pin a dark palette locally so its
     contents stay readable when the app runs a light/sierra theme */
  --bg:        oklch(0.158 0.006 264);
  --surface-1: oklch(0.188 0.007 264);
  --surface-2: oklch(0.222 0.008 264);
  --surface-3: oklch(0.262 0.010 265);
  --line:      oklch(0.330 0.012 265 / 0.65);
  --line-soft: oklch(0.300 0.010 265 / 0.40);
  --line-bright: oklch(0.420 0.014 265 / 0.55);
  --text:   oklch(0.965 0.004 250);
  --text-2: oklch(0.780 0.010 255);
  --text-3: oklch(0.660 0.012 258);
  --text-4: oklch(0.600 0.012 260);
}
.cw-bar {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  border-bottom: 0.5px solid var(--line); background: var(--surface-2);
}
.cw-url {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 11px;
  background: var(--bg); border: 0.5px solid var(--line); border-radius: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}
.cw-body { padding: 16px; }
.cw-crmhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cw-crmhead h4 { font-size: 14px; color: var(--text); font-weight: 600; }
.cw-crmhead .sub { font-family: var(--mono); font-size: 11px; color: var(--text-4); }
.cw-record {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px; border: 0.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-1); margin-bottom: 8px; position: relative;
}
.cw-record.touched { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), 0 0 22px oklch(0.885 0.19 128 / 0.12); }
.cw-field { font-size: 12px; }
.cw-field .fl { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.05em; }
.cw-field .fv { color: var(--text); margin-top: 2px; }
.cw-cursor {
  position: absolute; width: 18px; height: 18px; pointer-events: none; z-index: 40;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); filter: drop-shadow(0 2px 3px oklch(0 0 0 / 0.5));
}
.cw-cursor .lbl {
  position: absolute; left: 16px; top: 16px; white-space: nowrap;
  background: var(--accent); color: var(--on-accent); font-family: var(--mono);
  font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px;
}

/* email draft (cowork hubspot) */
.email {
  border: 0.5px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-1); margin-top: 14px;
}
.email-h { padding: 11px 14px; border-bottom: 0.5px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.email-h .erow { display: flex; gap: 8px; font-size: 12px; }
.email-h .ek { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); width: 52px; }
.email-h .ev { color: var(--text-2); }
.email-h .ev b { color: var(--text); }
.email-body { padding: 14px; font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.email-body .var { background: var(--accent-dim); color: var(--accent-text); padding: 0 4px; border-radius: 4px; border: 0.5px solid var(--accent-line); }

/* ---- CHAT (GTM) PANES: pipeline board + signals feed ---- */
.board-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.stage-rows { padding: 6px 14px 12px; }
.stage-row { display: grid; grid-template-columns: 90px 1fr 56px; align-items: center; gap: 12px; padding: 7px 0; }
.stage-row .sn { font-size: 12px; color: var(--text-2); }
.stage-row .sbar { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.stage-row .sbar i { display: block; height: 100%; border-radius: 5px; }
.stage-row .sv { font-family: var(--mono); font-size: 12px; color: var(--text); text-align: right; }

.feed { padding: 10px 14px 16px; }
.feed-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 0.5px solid var(--line-soft); }
.feed-item:last-child { border-bottom: none; }
.feed-item .fdot2 { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.feed-item .ft { font-size: 13px; color: var(--text); }
.feed-item .ft b { font-weight: 600; }
.feed-item .fm { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); margin-top: 2px; }

/* ---- CO-WORK PANES: hubspot sequence + inbox ---- */
.seq-step { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 0.5px solid var(--line); border-radius: var(--r-md); background: var(--surface-1); margin-bottom: 8px; }
.seq-step .seq-n { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center; background: var(--surface-3); border: 0.5px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.seq-step > div { flex: 1; }
.seq-step .seq-t { font-size: 12.5px; color: var(--text); }
.seq-step .seq-m { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); margin-top: 2px; }

.mail-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-md); cursor: pointer; transition: background 0.12s; }
.mail-row:hover { background: var(--surface-2); }
.mail-row.unread { background: var(--accent-dim); }
.mail-row .mail-av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: #fff; }
.mail-row .mail-t { font-size: 12.5px; color: var(--text); font-weight: 500; }
.mail-row .mail-p { font-size: 11.5px; color: var(--text-4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.mail-row .mail-time { font-family: var(--mono); font-size: 10px; color: var(--accent-text); flex: none; }


/* empty state */
.pane-empty {
  flex: 1; display: grid; place-items: center; text-align: center; padding: 40px;
}
.pane-empty .inner { max-width: 280px; }
.pane-empty .eic { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); border: 0.5px solid var(--line); display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-4); }
.pane-empty h5 { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.pane-empty p { font-size: 12px; color: var(--text-4); line-height: 1.5; font-family: var(--mono); }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--raise); background-clip: padding-box; }

/* utility */
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* ============================================================
   THEMES — Dark (default) · Light · Sierra
   data-theme lives on <html>. Default :root values = Dark.
   ============================================================ */

/* code-token color set is theme-tuned via vars */
:root {
  --tk-k:  oklch(0.78 0.13 330);
  --tk-f:  oklch(0.82 0.12 230);
  --tk-s:  oklch(0.83 0.13 140);
  --tk-n:  oklch(0.83 0.12 60);
  --tk-c:  var(--text-4);
  --tk-v:  var(--text);
  --canvas-bg:
    radial-gradient(1200px 700px at 18% -8%, oklch(0.235 0.030 150 / 0.18), transparent 60%),
    radial-gradient(1000px 800px at 110% 120%, oklch(0.220 0.020 265 / 0.30), transparent 55%),
    oklch(0.110 0.006 264);
  --code-bg: oklch(0.142 0.006 264);
  --term-bg: oklch(0.125 0.005 264);
}
.tok-k { color: var(--tk-k); }
.tok-f { color: var(--tk-f); }
.tok-s { color: var(--tk-s); }
.tok-n { color: var(--tk-n); }
.tok-c { color: var(--tk-c); font-style: italic; }
.tok-v { color: var(--tk-v); }
.code-scroll { background: var(--code-bg); }
.preview-host { background: var(--code-bg); }
.console { background: var(--term-bg); }
.console-body { color: var(--text-2); }

/* ---------- LIGHT ---------- */
[data-theme="light"] {
  --bg:        oklch(0.995 0.001 250);
  --surface-1: oklch(0.975 0.002 255);
  --surface-2: oklch(0.955 0.003 258);
  --surface-3: oklch(0.928 0.004 260);
  --hover:     oklch(0.905 0.005 262);
  --raise:     oklch(0.880 0.006 262);

  --line:      oklch(0.885 0.005 262 / 0.9);
  --line-soft: oklch(0.910 0.004 262 / 0.7);
  --line-bright: oklch(0.840 0.006 262 / 0.9);

  --text:   oklch(0.235 0.012 264);
  --text-2: oklch(0.400 0.012 262);
  --text-3: oklch(0.530 0.012 260);
  --text-4: oklch(0.640 0.010 258);

  --accent:      oklch(0.538 0.075 255);
  --accent-dim:  oklch(0.538 0.075 255 / 0.13);
  --accent-line: oklch(0.538 0.075 255 / 0.40);
  --accent-text: oklch(0.470 0.080 255);
  --on-accent:   oklch(0.995 0.005 255);

  --run:  oklch(0.640 0.150 70);
  --ok:   oklch(0.580 0.150 150);
  --err:  oklch(0.580 0.200 25);
  --info: oklch(0.560 0.130 250);
  --run-dim: oklch(0.640 0.150 70 / 0.13);
  --ok-dim:  oklch(0.580 0.150 150 / 0.13);
  --info-dim: oklch(0.560 0.130 250 / 0.12);

  --tk-k: oklch(0.50 0.18 330);
  --tk-f: oklch(0.46 0.16 250);
  --tk-s: oklch(0.46 0.14 150);
  --tk-n: oklch(0.52 0.15 50);
  --tk-c: oklch(0.660 0.020 260);
  --tk-v: oklch(0.300 0.012 264);
  --canvas-bg:
    radial-gradient(1200px 700px at 18% -8%, oklch(0.78 0.05 150 / 0.20), transparent 60%),
    radial-gradient(1000px 800px at 110% 120%, oklch(0.80 0.04 265 / 0.30), transparent 55%),
    oklch(0.905 0.006 255);
  --code-bg: oklch(0.978 0.002 255);
  --term-bg: oklch(0.965 0.003 258);

  /* connector chips — darkened for contrast on light surfaces */
  --c-clay:      oklch(0.620 0.150 300);
  --c-zoominfo:  oklch(0.540 0.200 27);
  --c-builtwith: oklch(0.560 0.180 295);
  --c-instantly: oklch(0.520 0.180 275);
  --c-firecrawl: oklch(0.620 0.160 55);
  --c-lusha:       oklch(0.560 0.140 250);
  --c-lemlist:     oklch(0.680 0.130 95);
  --c-prospeo:     oklch(0.570 0.120 220);
  --c-smartlead:   oklch(0.540 0.160 285);
  --c-fireflies:   oklch(0.550 0.150 315);
  --c-salesloft:   oklch(0.560 0.140 150);
  --c-amplemarket: oklch(0.510 0.150 262);
}
[data-theme="light"] #window {
  border-color: oklch(0.86 0.005 262);
  box-shadow: 0 0 0 1px oklch(0.80 0.006 262 / 0.6), 0 40px 110px oklch(0.5 0.02 264 / 0.22), 0 8px 30px oklch(0.5 0.02 264 / 0.12);
}
[data-theme="light"] .traffic i { border-color: oklch(0 0 0 / 0.12); }

/* ---------- SIERRA (warm sand + clay accent) ---------- */
[data-theme="sierra"] {
  --bg:        oklch(0.970 0.012 78);
  --surface-1: oklch(0.948 0.014 76);
  --surface-2: oklch(0.922 0.016 74);
  --surface-3: oklch(0.890 0.018 72);
  --hover:     oklch(0.860 0.020 70);
  --raise:     oklch(0.835 0.022 68);

  --line:      oklch(0.860 0.018 70 / 0.9);
  --line-soft: oklch(0.890 0.014 72 / 0.7);
  --line-bright: oklch(0.815 0.022 68 / 0.9);

  --text:   oklch(0.285 0.022 50);
  --text-2: oklch(0.430 0.028 48);
  --text-3: oklch(0.545 0.030 50);
  --text-4: oklch(0.640 0.028 52);

  --accent:      oklch(0.538 0.075 255);
  --accent-dim:  oklch(0.538 0.075 255 / 0.13);
  --accent-line: oklch(0.538 0.075 255 / 0.42);
  --accent-text: oklch(0.465 0.080 255);
  --on-accent:   oklch(0.985 0.008 80);

  --run:  oklch(0.620 0.140 60);
  --ok:   oklch(0.560 0.130 145);
  --err:  oklch(0.560 0.200 28);
  --info: oklch(0.540 0.120 250);
  --run-dim: oklch(0.620 0.140 60 / 0.13);
  --ok-dim:  oklch(0.560 0.130 145 / 0.13);
  --info-dim: oklch(0.540 0.120 250 / 0.12);

  --tk-k: oklch(0.50 0.17 350);
  --tk-f: oklch(0.46 0.15 250);
  --tk-s: oklch(0.46 0.14 145);
  --tk-n: oklch(0.52 0.15 55);
  --tk-c: oklch(0.640 0.030 55);
  --tk-v: oklch(0.330 0.022 50);
  --canvas-bg:
    radial-gradient(1200px 700px at 18% -8%, oklch(0.82 0.06 60 / 0.40), transparent 60%),
    radial-gradient(1000px 800px at 110% 120%, oklch(0.84 0.05 40 / 0.40), transparent 55%),
    oklch(0.880 0.022 68);
  --code-bg: oklch(0.952 0.014 76);
  --term-bg: oklch(0.935 0.016 74);

  /* connector chips — warmed + darkened for the sand surfaces */
  --c-clay:      oklch(0.600 0.140 300);
  --c-zoominfo:  oklch(0.530 0.190 30);
  --c-builtwith: oklch(0.550 0.170 295);
  --c-instantly: oklch(0.510 0.170 275);
  --c-firecrawl: oklch(0.600 0.155 58);
  --c-lusha:       oklch(0.550 0.130 250);
  --c-lemlist:     oklch(0.670 0.125 95);
  --c-prospeo:     oklch(0.560 0.115 220);
  --c-smartlead:   oklch(0.530 0.150 285);
  --c-fireflies:   oklch(0.540 0.140 315);
  --c-salesloft:   oklch(0.550 0.130 148);
  --c-amplemarket: oklch(0.500 0.140 262);
}
[data-theme="sierra"] #window {
  border-color: oklch(0.82 0.02 68);
  box-shadow: 0 0 0 1px oklch(0.74 0.03 60 / 0.5), 0 40px 110px oklch(0.45 0.05 50 / 0.25), 0 8px 30px oklch(0.45 0.05 50 / 0.14);
}
[data-theme="sierra"] .traffic i { border-color: oklch(0 0 0 / 0.12); }

/* themed canvas backdrop applies to body */
body { background: var(--canvas-bg); }

/* ============================================================
   OVERLAYS — backdrop, command palette, drawers, home
   ============================================================ */
.scrim {
  position: absolute; inset: 0; z-index: 90;
  background: oklch(0.10 0.01 264 / 0.55);
  backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center;
}
.scrim.on { display: flex; }
[data-theme="light"] .scrim, [data-theme="sierra"] .scrim { background: oklch(0.30 0.02 60 / 0.30); }

/* ---- command palette ---- */
.cmdk {
  margin-top: 96px; width: 580px; max-width: 90%;
  background: var(--surface-1); border: 0.5px solid var(--line-bright);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 80px oklch(0 0 0 / 0.5);
  transform: translateY(-8px); opacity: 0; transition: transform .16s, opacity .16s;
}
.scrim.on .cmdk { transform: translateY(0); opacity: 1; }
.cmdk-input { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 0.5px solid var(--line-soft); }
.cmdk-input svg { width: 17px; height: 17px; color: var(--text-3); }
.cmdk-input input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: var(--sans); font-size: 15px; }
.cmdk-input input::placeholder { color: var(--text-4); }
.cmdk-input .esc { font-family: var(--mono); font-size: 10px; color: var(--text-4); border: 0.5px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: 8px; }
.cmdk-group { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); padding: 10px 10px 5px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px; cursor: pointer; }
.cmdk-item:hover, .cmdk-item.sel { background: var(--surface-3); }
.cmdk-item .cic { width: 26px; height: 26px; border-radius: 7px; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text-2); }
.cmdk-item .cic svg { width: 14px; height: 14px; }
.cmdk-item .ctxt { flex: 1; font-size: 13px; color: var(--text); }
.cmdk-item .ctxt small { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text-4); margin-top: 1px; }
.cmdk-item .ck { font-family: var(--mono); font-size: 10px; color: var(--text-4); }

/* ---- right drawer (settings / connector detail) ---- */
.drawer {
  position: absolute; top: 0; right: -460px; bottom: 0; z-index: 95; width: 420px; max-width: 86%;
  background: var(--surface-1); border-left: 0.5px solid var(--line-bright);
  box-shadow: -20px 0 60px oklch(0 0 0 / 0.35);
  display: flex; flex-direction: column;
}
.drawer.on { right: 0; animation: drawerIn .2s ease; }
@keyframes drawerIn { from { opacity: .3; } to { opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 0.5px solid var(--line-soft); }
.drawer-head h3 { font-size: 14px; font-weight: 600; flex: 1; }
.drawer-head .dh-sub { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-sec { margin-bottom: 24px; }
.drawer-sec .ds-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-4); margin-bottom: 11px; }

/* theme swatches */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { cursor: pointer; border-radius: 11px; border: 1.5px solid var(--line); overflow: hidden; transition: border-color .15s, transform .1s; background: var(--surface-2); }
.theme-opt:hover { transform: translateY(-1px); }
.theme-opt.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.theme-prev { height: 56px; display: flex; flex-direction: column; gap: 4px; padding: 9px; }
.theme-prev .pl { height: 6px; border-radius: 3px; }
.theme-prev .pl.a { width: 60%; }
.theme-prev .pl.b { width: 85%; }
.theme-prev .dotrow { display: flex; gap: 4px; margin-top: auto; }
.theme-prev .dotrow i { width: 8px; height: 8px; border-radius: 50%; }
.theme-opt .tn { font-size: 12px; font-weight: 500; padding: 8px 10px; border-top: 0.5px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.theme-opt .tn .chk { color: var(--accent); opacity: 0; }
.theme-opt.sel .tn .chk { opacity: 1; }

/* segmented option (density / accent) */
.opt-seg { display: flex; gap: 6px; }
.opt-seg button { flex: 1; padding: 9px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text-2); font-family: var(--mono); font-size: 11px; cursor: pointer; transition: all .12s; }
.opt-seg button.sel { border-color: var(--accent); color: var(--accent-text); background: var(--accent-dim); }
.accent-row { display: flex; gap: 9px; }
.accent-sw { width: 34px; height: 34px; border-radius: 9px; cursor: pointer; border: 2px solid transparent; transition: transform .1s; }
.accent-sw:hover { transform: scale(1.08); }
.accent-sw.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px currentColor; }

/* connector detail */
.cd-hero { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.cd-hero .cd-ic { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 16px; color: #fff; }
.cd-hero h2 { font-size: 17px; font-weight: 600; }
.cd-hero .cd-meta { font-family: var(--mono); font-size: 11px; color: var(--text-4); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.cd-hero .cd-meta .on { color: var(--ok); display: flex; align-items: center; gap: 5px; }
.cd-hero .cd-meta .on i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.tool-list { display: flex; flex-direction: column; gap: 7px; }
.tool-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 0.5px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.tool-item .tmono { font-family: var(--mono); font-size: 12px; color: var(--accent-text); }
.tool-item .tdesc { font-size: 11.5px; color: var(--text-3); margin-left: auto; }
.scope-row { display: flex; flex-wrap: wrap; gap: 7px; }
.scope { font-family: var(--mono); font-size: 10.5px; padding: 4px 9px; border-radius: 6px; border: 0.5px solid var(--line); color: var(--text-3); background: var(--surface-2); }

/* ---- new-run home ---- */
#home {
  position: absolute; inset: 0; z-index: 80; background: var(--bg);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px;
}
#home.on { display: flex; }
.home-inner { width: 660px; max-width: 100%; }
.home-greet { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.home-greet .hg-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); display: grid; place-items: center; box-shadow: 0 4px 16px var(--accent-dim); }
.home-greet h1 { font-size: 27px; font-weight: 600; letter-spacing: -0.02em; }
.home-greet h1 .accent { color: var(--accent-text); }
.home-composer { background: var(--surface-2); border: 0.5px solid var(--line-bright); border-radius: 16px; padding: 18px 20px; margin-bottom: 22px; }
.home-composer textarea { width: 100%; background: none; border: none; outline: none; resize: none; color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.55; min-height: 52px; max-height: 220px; overflow-y: auto; }
.home-composer textarea::placeholder { color: var(--text-4); }
.home-composer .hc-bar { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.home-suggest-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); margin-bottom: 12px; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 0.5px solid var(--line); border-radius: 12px; background: var(--surface-1); cursor: pointer; transition: border-color .14s, transform .1s; text-align: left; }
.home-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.home-card .hc-ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--surface-3); border: 0.5px solid var(--line); }
.home-card .hc-ic svg { width: 15px; height: 15px; color: var(--accent-text); }
.home-card .hc-t { font-size: 13px; font-weight: 500; color: var(--text); }
.home-card .hc-d { font-size: 11.5px; color: var(--text-4); margin-top: 3px; line-height: 1.4; }

/* ============================================================
   DEMO INTERACTION LAYER — clickable examples + toast
   ============================================================ */
.acct, .feed-item, .seq-step, .mail-row, .conn-stack .av { cursor: pointer; }
.acct, .feed-item, .seq-step, .mail-row {
  transition: background 0.12s ease, transform 0.08s ease;
}
.acct:hover, .feed-item:hover, .seq-step:hover, .mail-row:hover {
  background: var(--hover);
}
.flash { animation: nico-flash 0.28s ease; }
@keyframes nico-flash {
  0%   { box-shadow: 0 0 0 0 var(--accent); }
  40%  { box-shadow: 0 0 0 2px var(--accent); filter: brightness(1.08); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.nico-toast {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translate(-50%, 16px);
  background: var(--surface-3);
  color: var(--text);
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 30px oklch(0 0 0 / 0.45);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.nico-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* plan-mode toggle (composer) active state */
.cbtn.active { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); }
/* tool/plan cards rendered inside a chat turn */
.turn-body .tool, .turn-body .plan { margin: 8px 0; }

/* ============================================================
   NATIVE CONNECTOR LOGOS — saleshub, salestools, salesforce
   When an icon tile holds a real brand logo, let the image fill
   the tile (logos carry their own background) and drop the tint.
   ============================================================ */
.conn-ic.has-logo, .tool-ic.has-logo, .conn-stack .av.has-logo, .co-logo.has-logo { background: none !important; padding: 0; overflow: hidden; }
.conn-ic img.brand, .tool-ic img.brand, .conn-stack .av img.brand, .co-logo img.brand {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}

/* ============================================================
   MCP SERVER MANAGER
   ============================================================ */
.mcp-list { display: flex; flex-direction: column; gap: 8px; }
.mcp-empty { font-size: 12px; color: var(--text-4); padding: 10px 2px; }
.mcp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 0.5px solid var(--line); border-radius: 10px;
  background: var(--surface-1);
}
.mcp-ic {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); color: var(--text-2);
  font-family: var(--mono); font-size: 9px; font-weight: 700;
}
.mcp-ic.has-logo { background: none; }
.mcp-ic img.brand { width: 100%; height: 100%; object-fit: cover; }
.mcp-meta { flex: 1; min-width: 0; }
.mcp-name { font-size: 12.5px; color: var(--text); font-weight: 500; }
.mcp-url { font-size: 10.5px; color: var(--text-4); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcp-status { font-size: 11px; color: var(--text-3); font-family: var(--mono); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.mcp-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.mcp-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); }
.mcp-dot.off { background: var(--text-4); }
.mcp-x {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  border: 0.5px solid var(--line); background: var(--surface-2);
  color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer;
}
.mcp-x:hover { background: var(--err-dim, var(--hover)); color: var(--err, var(--text)); border-color: var(--err, var(--line-bright)); }
.mcp-x:disabled { opacity: 0.4; cursor: default; }

.mcp-form { display: flex; flex-direction: column; gap: 8px; }
.mcp-in {
  width: 100%; background: var(--surface-1); border: 0.5px solid var(--line-bright);
  border-radius: 9px; padding: 9px 11px; color: var(--text);
  font-family: var(--mono); font-size: 12px; outline: none;
}
.mcp-in:focus { border-color: var(--accent-line); }
.mcp-in::placeholder { color: var(--text-4); }
.mcp-form-row { display: flex; align-items: center; gap: 10px; }
.mcp-btn {
  border: 0.5px solid var(--line-bright); background: var(--surface-2);
  color: var(--text); border-radius: 9px; padding: 8px 16px;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.mcp-btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.mcp-btn.primary:hover { filter: brightness(1.05); }
.mcp-btn:disabled { opacity: 0.5; cursor: default; }
.mcp-msg { font-size: 11.5px; font-family: var(--mono); }
.mcp-msg.ok { color: var(--ok); }
.mcp-msg.err { color: var(--err, #e5894a); }
.mcp-hint { font-size: 11px; color: var(--text-4); line-height: 1.5; margin-top: 10px; }

/* chat suggestion chips — clicked/locked state */
.result-grid .cbtn.sel { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); }
.result-grid .cbtn:disabled { opacity: 0.5; }
.result-grid .cbtn.sel:disabled { opacity: 1; }

/* ============================================================
   MARKDOWN RENDERING in chat prose (headings, tables, lists)
   ============================================================ */
.prose .md-p { margin: 0 0 7px; }
.prose .md-p:last-child { margin-bottom: 0; }
.prose .md-sp { height: 6px; }
.prose .md-h { font-weight: 600; color: var(--text); letter-spacing: -0.01em; margin: 12px 0 6px; }
.prose .md-h1 { font-size: 16px; }
.prose .md-h2 { font-size: 14.5px; }
.prose .md-h3 { font-size: 13px; }
.prose .md-h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-family: var(--mono); }
.prose .md-li { position: relative; padding-left: 16px; margin: 3px 0; }
.prose .md-li::before { content: "•"; position: absolute; left: 4px; color: var(--accent-text); }
.prose .md-table {
  width: 100%; border-collapse: collapse; margin: 10px 0;
  font-size: 12px; border: 0.5px solid var(--line); border-radius: 8px; overflow: hidden;
}
.prose .md-table thead { background: var(--surface-2); }
.prose .md-table th {
  text-align: left; padding: 7px 11px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 0.5px solid var(--line); white-space: nowrap;
}
.prose .md-table td { padding: 7px 11px; color: var(--text-2); border-bottom: 0.5px solid var(--line-soft); vertical-align: top; }
.prose .md-table tbody tr:last-child td { border-bottom: none; }
.prose .md-table tbody tr:hover { background: var(--surface-1); }
.prose .md-table a { color: var(--accent-text); }
/* ordered lists keep their real numbers (no invented bullet) */
.prose .md-li.md-ol { padding-left: 4px; }
.prose .md-li.md-ol::before { content: none; }
.prose .md-li.md-ol .md-n { color: var(--accent-text); font-family: var(--mono); font-size: 11px; margin-right: 2px; }
/* fenced code blocks — verbatim, scrollable, mono */
.prose .md-code {
  margin: 10px 0; padding: 10px 12px; background: var(--surface-2);
  border: 0.5px solid var(--line); border-radius: 8px; overflow-x: auto;
}
.prose .md-code code {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--text-2);
  white-space: pre; background: none; padding: 0; border: none;
}

/* live-result panes (chat Accounts) */
.pane-note {
  padding: 26px 16px; color: var(--text-4); font-size: 12.5px; line-height: 1.6;
  font-family: var(--mono);
}
#pane-accounts .data-scroll { overflow: auto; min-height: 0; }
.ctab.flash { animation: nico-flash 0.42s ease; }

/* Accounts / People toggle in the Data canvas */
.data-seg {
  display: inline-flex; gap: 2px; margin-left: 14px;
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 8px; padding: 2px; -webkit-app-region: no-drag;
}
.data-seg button {
  font-family: var(--mono); font-size: 11px; padding: 4px 12px;
  border-radius: 6px; border: none; background: transparent;
  color: var(--text-3); cursor: pointer; transition: background .12s, color .12s;
}
.data-seg button:hover { color: var(--text-2); }
.data-seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px oklch(0 0 0 / 0.2); }

/* ============================================================
   LOGIN / AUTH GATE
   ============================================================ */
.auth-gate {
  position: fixed; inset: 0; z-index: 500;
  background: radial-gradient(1000px 620px at 50% -12%, var(--surface-1), var(--bg) 70%);
  display: flex; flex-direction: column;
}
.auth-gate.hidden { display: none; }
.auth-drag { height: 46px; -webkit-app-region: drag; display: flex; align-items: center; padding: 0 16px; }
.auth-drag .traffic { display: flex; gap: 8px; align-items: center; -webkit-app-region: no-drag; }
.auth-card { margin: auto; width: 344px; max-width: 88vw; padding: 0 0 24px; text-align: center; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.auth-wordmark { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--text); }
.auth-wordmark span { color: var(--text-4); font-weight: 400; }
.auth-h1 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text-3); margin-bottom: 22px; }
.auth-fields { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.auth-in {
  width: 100%; background: var(--surface-1); border: 0.5px solid var(--line-bright);
  border-radius: 10px; padding: 12px 13px; color: var(--text);
  font-family: var(--sans); font-size: 14px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.auth-in:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-dim); }
.auth-in::placeholder { color: var(--text-4); }
.auth-btn {
  width: 100%; height: 44px; margin-top: 14px; border: none; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-family: var(--sans);
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.18) inset, 0 4px 16px var(--accent-dim);
}
.auth-btn:hover { filter: brightness(1.05); }
.auth-btn:disabled { opacity: 0.6; cursor: default; }
.auth-msg { min-height: 18px; margin-top: 10px; font-size: 12px; color: var(--err); font-family: var(--mono); }
.auth-switch { margin-top: 16px; font-size: 12.5px; color: var(--text-3); cursor: pointer; }
.auth-switch b { color: var(--accent-text); font-weight: 600; }
.auth-foot { margin-top: 22px; font-size: 11px; color: var(--text-4); font-family: var(--mono); }
/* social sign-in + reset divider */
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--text-4); font-size: 11px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line, oklch(1 0 0 / 0.12)); }
.auth-social { display: flex; flex-direction: column; gap: 8px; }
.auth-social-btn {
  width: 100%; height: 42px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2, oklch(1 0 0 / 0.05)); color: var(--text); border: 1px solid var(--line, oklch(1 0 0 / 0.14));
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
}
.auth-social-btn:hover { background: var(--surface-3, oklch(1 0 0 / 0.09)); }
.auth-social-btn:disabled { opacity: 0.6; cursor: default; }

/* collapsible right artifacts panel (toggle lives on the divider) */
body.canvas-collapsed #body { grid-template-columns: var(--sidebar-w, 280px) 1fr 0fr; }
body.canvas-collapsed #canvas-col { display: none; }
body.sidebar-collapsed.canvas-collapsed #body { grid-template-columns: 0fr 1fr 0fr; }

/* ---- draggable divider + collapse toggle between chat and artifacts ---- */
.canvas-divider {
  position: absolute; top: 0; bottom: 0; right: -4px; width: 9px; z-index: 40;
  cursor: col-resize; display: flex; align-items: center; justify-content: center;
  -webkit-app-region: no-drag;
}
.canvas-divider::before {              /* the visible hairline that brightens on hover/drag */
  content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px;
  background: transparent; transition: background .14s;
}
.canvas-divider:hover::before, .canvas-divider.dragging::before { background: var(--accent-line); }
.cd-toggle {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 17px; height: 42px; border-radius: 7px; cursor: pointer;
  background: var(--surface-2); border: 0.5px solid var(--line-bright);
  color: var(--text-3); display: grid; place-items: center;
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.18); transition: all .14s; padding: 0;
}
.cd-toggle:hover { color: var(--text); background: var(--surface-3); border-color: var(--accent-line); }
.cd-toggle::before {                    /* chevron drawn with borders, flips by state */
  content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); margin-left: 2px;             /* points right = collapse */
}
body.canvas-collapsed .cd-toggle::before { transform: rotate(135deg); margin-left: -2px; }  /* points left = expand */
/* when collapsed, the divider sits at the far right edge of the window */
body.canvas-collapsed .canvas-divider { right: 0; }
body.canvas-collapsed .cd-toggle { right: 4px; }

/* empty artifacts canvas (fresh chat) */
.blank-canvas {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px; gap: 6px;
}
.blank-mark {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center;
  background: var(--surface-2); border: 0.5px solid var(--line); color: var(--text-4); margin-bottom: 10px;
}
.blank-title { font-size: 15px; font-weight: 600; color: var(--text-2); letter-spacing: -0.01em; }
.blank-sub { font-size: 12.5px; color: var(--text-4); max-width: 300px; line-height: 1.55; }

/* settings auto-save confirmation toast */
.set-toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 600;
  background: var(--text); color: var(--bg);
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 10px;
  box-shadow: 0 10px 34px oklch(0 0 0 / 0.28);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.set-toast::before { content: "✓  "; }
.set-toast.on { opacity: 1; transform: translateY(0); }

/* ---- real brand logos in connector tiles (Brandfetch / favicon, monogram fallback) ---- */
.mk-ic, .qc-ic, .mcp-ic { overflow: hidden; }
.mcp-logo { width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: inherit; display: block; }
/* honest "not connected" state on the connector detail page */
.cx-off .hero-meta, .cx-off .side-card .health, .cx-off .side-card .kv-row { opacity: 0.5; }

/* perf: freeze all animation when the window is backgrounded (no idle CPU burn) */
body.app-hidden *, body.app-hidden *::before, body.app-hidden *::after { animation-play-state: paused !important; transition: none !important; }

/* ============ Code mode: real agent tool cards + permissions ============ */
.code-tool { background: var(--surface-1); border: 0.5px solid var(--line); border-radius: 10px; margin: 8px 0; overflow: hidden; }
.code-tool .ct-head { display: flex; align-items: center; gap: 9px; padding: 8px 12px; cursor: pointer; }
.code-tool .ct-ic { width: 20px; height: 20px; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; color: var(--text-2); flex: none; }
.code-tool .ct-name { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text-2); flex: none; }
.code-tool .ct-sum { font-family: var(--mono); font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.code-tool .ct-sum code { color: var(--text-3); background: none; padding: 0; }
.code-tool .ct-state { flex: none; display: grid; place-items: center; width: 16px; }
.code-tool .ct-out { margin: 0; padding: 10px 12px; border-top: 0.5px solid var(--line-soft); font-family: var(--mono); font-size: 10.5px; line-height: 1.5; color: var(--text-3); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto; background: var(--surface-2); }
.code-diff { border-top: 0.5px solid var(--line-soft); font-family: var(--mono); font-size: 10.5px; line-height: 1.5; }
.code-diff .cd-del, .code-diff .cd-add { padding: 7px 12px; white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow-y: auto; }
.code-diff .cd-del { background: color-mix(in oklab, #e5484d 12%, transparent); color: var(--text-3); text-decoration: line-through; text-decoration-color: color-mix(in oklab, #e5484d 50%, transparent); }
.code-diff .cd-add { background: color-mix(in oklab, var(--ok) 10%, transparent); color: var(--text-2); }
.code-foot { font-family: var(--mono); font-size: 11px; color: var(--text-4); margin-top: 10px; }

.code-perm-overlay { position: fixed; inset: 0; z-index: 400; background: oklch(0 0 0 / 0.45); display: grid; place-items: center; }
.code-perm { width: min(560px, calc(100vw - 60px)); background: var(--surface-1); border: 0.5px solid var(--line-bright); border-radius: 14px; padding: 18px; box-shadow: 0 24px 80px oklch(0 0 0 / 0.45); }
.code-perm .cp-t { font-size: 15px; font-weight: 600; color: var(--text); }
.code-perm .cp-d { font-size: 12.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.code-perm .cp-pre { margin: 12px 0 0; padding: 10px 12px; background: var(--surface-2); border: 0.5px solid var(--line-soft); border-radius: 9px; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; }
.code-perm .cp-btns { display: flex; align-items: center; gap: 9px; margin-top: 14px; }

/* empty conversation state (any mode, before you talk to Nico) */
.thread-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 60%; padding: 40px 28px; text-align: center; }
.thread-empty .te-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); box-shadow: 0 6px 20px oklch(0 0 0 / 0.18); }
/* Empty state uses the Macrodeep brand mark (paper-on-brand-blue), not the accent tile. */
.thread-empty .te-mark.te-logo {
  background: var(--brand-blue);
  color: var(--brand-paper);
  box-shadow: 0 6px 22px oklch(0.42 0.06 245 / 0.28);
}
.thread-empty .te-mark.te-logo svg { display: block; }
.thread-empty .te-t { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.thread-empty .te-m { font-size: 12.5px; color: var(--text-4); line-height: 1.5; max-width: 320px; }

/* ============ live CRM artifacts: toolbar, provenance, sort, drawer ============
   Everything below uses the shared oklch tokens only, so all three themes
   (dark / light / sierra) work without theme-specific overrides. */
.art-toolbar { display: flex; align-items: center; gap: 9px; padding: 10px 16px; min-height: 46px; border-bottom: 0.5px solid var(--line); flex-wrap: wrap; }
/* one scroll surface per artifact card: the toolbar stays put and the table
   scrolls (both axes) inside .art-region — a wide table can never drag the
   whole pane sideways. :has() ships everywhere we run (Electron + evergreen
   browsers); without it the pane simply keeps the old single-scroller layout. */
.data-scroll:has(> .art-wrap),
#pane-accounts .data-scroll:has(> .art-wrap) { overflow: hidden; display: flex; flex-direction: column; }  /* ID variant outguns the `#pane-accounts .data-scroll { overflow:auto }` rule above */
.data-scroll > .art-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.art-wrap .art-toolbar, .art-wrap .art-err { flex: none; }
.data-scroll:has(> .art-wrap) .art-region {
  flex: 1; min-height: 0; min-width: 0;
  overflow: auto; overscroll-behavior: contain;
}
.art-filter {
  width: 148px; height: 26px; padding: 0 9px;
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 7px;
  color: var(--text); font-family: var(--mono); font-size: 11px; outline: none;
}
.art-filter:focus { border-color: var(--accent-line); }
.art-filter::placeholder { color: var(--text-4); }
.art-filter:disabled { opacity: 0.5; }
.art-count { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); white-space: nowrap; }
.prov-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 999px; background: var(--surface-2); border: 0.5px solid var(--line);
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.prov-chip .pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 2.4s ease infinite; }
/* restored snapshot (earlier session / another surface) — gray dot, no pulse, never reads "live" */
.prov-chip.snap .pdot { background: var(--text-4); animation: none; }
.prov-chip.snap { color: var(--text-4); }
.art-refresh:disabled { opacity: 0.5; cursor: default; }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--text-2); }
table.grid th.sortable .sort-ind { display: inline-block; width: 10px; margin-left: 3px; color: var(--accent-text); font-size: 8px; }
.art-region table.grid tbody tr[data-ri] { cursor: pointer; }
.cell-score { font-family: var(--mono); font-weight: 600; color: var(--accent-text); }
.cell-name { font-weight: 600; color: var(--text); }
/* v2 entity cell — letter chip + name stacked over a muted sub-line */
.cell-ent { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-ent .ent-ic {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: grid; place-items: center;
  font: 700 10px var(--mono); color: var(--accent-text);
  background: var(--accent-dim); border: 0.5px solid var(--accent-line);
}
.cell-ent .ent-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cell-ent .ent-sub {
  font: 400 10.5px var(--mono); color: var(--text-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.api-plan .plan-item.done .ptxt { text-decoration: none; color: var(--text-2); }   /* run plans read as a log, not a todo */
.cell-null { color: var(--text-4); }

/* ---- Instantly campaign viewer (read-only) — tokens only, all three themes ---- */
.inst-steps { display: flex; flex-direction: column; }
.inst-step { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-bottom: 0.5px solid var(--app-line, var(--line-soft)); }
.inst-step:last-child { border-bottom: none; }
.inst-snum {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: grid; place-items: center;
  font: 700 10px var(--mono); color: var(--accent-text);
  background: var(--accent-dim); border: 0.5px solid var(--accent-line);
}
.inst-sbody { flex: 1; min-width: 0; line-height: 1.35; }
.inst-stype { font-size: 12.5px; font-weight: 500; color: var(--text); }
.inst-ssub { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst-swait { flex: none; font-family: var(--mono); font-size: 10px; color: var(--text-3); background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.inst-status {
  display: inline-flex; align-items: center; flex: none;
  font-family: var(--mono); font-size: 10px; padding: 2px 8px; border-radius: 999px;
  color: var(--text-3); background: var(--surface-2); border: 0.5px solid var(--line);
}
.inst-status.ok { color: var(--ok); background: var(--ok-dim); border-color: transparent; }
.inst-status.warn { color: var(--run); background: var(--run-dim); border-color: transparent; }
.inst-status.done { color: var(--text-4); }

/* ---- Prospects LIBRARY toggle ([This search | This chat | Everywhere]) — the leads
   pane can show the live search, this chat's slice of the deduped library, or the whole
   workspace-wide library. Token-only. ---- */
.lib-toggle { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 9px; padding: 2px; }
.lib-chip { border: none; background: none; color: var(--text-3); font: inherit; font-size: 11.5px; font-weight: 550; padding: 4px 9px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.lib-chip:hover { color: var(--text); }
.lib-chip.on { background: var(--accent); color: var(--on-accent); }
.clay-chatbadge { margin-left: 6px; font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--accent-text); background: var(--accent-dim); border-radius: 5px; padding: 1px 5px; vertical-align: middle; }

/* ---- Clay/Airtable people TABLE (Leads canvas, #leadsScroll.leads-clay) — token-only
   so dark/light/sierra all work. Comfortable rows, avatar first column, company
   favicon, LinkedIn chip, sensible column widths with ellipsis. ---- */
.leads-clay table.grid tbody td { padding-top: 11px; padding-bottom: 11px; }
.leads-clay table.grid thead th { box-shadow: 0 4px 10px -5px oklch(0 0 0 / 0.22); }   /* a touch more lift on the sticky header */
.leads-clay .art-toolbar { gap: 8px; }
.clay-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.clay-av {
  position: relative; width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: var(--accent-dim); border: 0.5px solid var(--accent-line);
}
.clay-av .clay-av-l { font: 700 10px var(--mono); color: var(--accent-text); }
.clay-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clay-person-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.clay-person-sub {
  font: 400 10.5px var(--mono); color: var(--text-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clay-co { display: flex; align-items: center; gap: 8px; min-width: 0; }
.clay-co .tr-ic { width: 20px; height: 20px; border-radius: 5px; }
.clay-co-nm { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clay-dom { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.clay-li {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 8px; border-radius: 6px; text-decoration: none;
  font-family: var(--mono); font-size: 10.5px; color: var(--accent-text);
  border: 0.5px solid var(--accent-line); background: var(--accent-dim);
}
.clay-li:hover { filter: brightness(1.06); }
.clay-li svg { width: 11px; height: 11px; flex: none; }
.clay-li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-addseq { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-dim); font-weight: 600; }
.art-addseq:hover { filter: brightness(1.06); background: var(--accent-dim); }
.grade-chip {
  display: inline-block; min-width: 20px; text-align: center; padding: 2px 6px; border-radius: 6px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2); border: 0.5px solid var(--line);
}
.grade-chip.ga, .grade-chip.gb { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 40%, transparent); background: var(--ok-dim); }
.grade-chip.gc { color: var(--run); border-color: color-mix(in oklab, var(--run) 40%, transparent); background: var(--run-dim); }
.grade-chip.gd, .grade-chip.ge, .grade-chip.gf { color: var(--err); border-color: color-mix(in oklab, var(--err) 35%, transparent); background: color-mix(in oklab, var(--err) 12%, transparent); }
.art-err {
  margin: 12px 16px; padding: 10px 12px; border-radius: 9px;
  border: 0.5px solid color-mix(in oklab, var(--err) 45%, transparent);
  background: color-mix(in oklab, var(--err) 8%, transparent);
  font-family: var(--mono); font-size: 11px; color: var(--err); line-height: 1.5; word-break: break-word;
}
.art-empty { padding: 26px 16px; text-align: center; color: var(--text-4); font-family: var(--mono); font-size: 11.5px; line-height: 1.6; }
.art-skel { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.art-skel i {
  display: block; height: 13px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%; animation: art-shimmer 1.2s linear infinite;
}
@keyframes art-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.art-spin {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block; vertical-align: -1px;
  border: 1.5px solid var(--line-bright); border-top-color: var(--accent-text);
  animation: spin 0.7s linear infinite;
}
/* pipeline campaign rows drill into the cadence artifact */
#pane-pipeline .acct.pl-camp { cursor: pointer; }
#pane-pipeline .acct.pl-camp:hover { background: var(--hover); }

/* ---- row detail drawer (right side, over the canvas) ---- */
.drawer-scrim { position: fixed; inset: 0; z-index: 380; background: oklch(0 0 0 / 0.35); opacity: 0; pointer-events: none; transition: opacity 0.18s; }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
[data-theme="light"] .drawer-scrim, [data-theme="sierra"] .drawer-scrim { background: oklch(0.30 0.02 60 / 0.30); }
.row-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); z-index: 381;
  background: var(--surface-1); border-left: 0.5px solid var(--line-bright);
  box-shadow: -18px 0 50px oklch(0 0 0 / 0.35);
  transform: translateX(103%); transition: transform 0.22s cubic-bezier(0.3, 0.9, 0.3, 1);
  display: flex; flex-direction: column;
}
.row-drawer.open { transform: translateX(0); }
.row-drawer .dr-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 12px; border-bottom: 0.5px solid var(--line); }
.row-drawer .dr-title { font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-drawer .dr-sub { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 3px; }
.row-drawer .dr-close { margin-left: auto; flex: none; }
.row-drawer .dr-scroll { flex: 1; overflow: auto; min-height: 0; padding: 4px 0 16px; overscroll-behavior: contain; }
.dr-badges { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; }
.dr-sec { padding: 14px 16px 2px; }
.dr-sec h4 {
  font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-4); margin: 0 0 8px;
}
.dr-kv { display: grid; grid-template-columns: 112px 1fr; gap: 3px 10px; }
.dr-kv .k { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); padding: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-kv .v { font-size: 12px; color: var(--text-2); padding: 3px 0; word-break: break-word; }
.dr-err { font-family: var(--mono); font-size: 10.5px; color: var(--err); padding: 4px 0; line-height: 1.5; word-break: break-word; }
.dr-note { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); line-height: 1.55; }
.dr-ev { padding: 8px 0; border-bottom: 0.5px solid var(--line-soft); }
.dr-ev:last-child { border-bottom: none; }
.dr-ev .eh { display: flex; gap: 8px; font-family: var(--mono); font-size: 10px; color: var(--text-4); }
.dr-ev .eb { font-size: 12px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.dr-actions { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 0.5px solid var(--line); flex-wrap: wrap; }
.pillbtn.dr-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.pillbtn.dr-primary:hover { filter: brightness(1.06); background: var(--accent); }
.pillbtn.dr-primary:disabled { opacity: 0.6; cursor: default; }
/* campaign picker + confirm step (writes are always confirm-gated) */
.dr-pick { border: 0.5px solid var(--line); border-radius: var(--r-md); margin-top: 6px; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
.dr-pick .pk { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-bottom: 0.5px solid var(--line-soft); cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.dr-pick .pk:last-child { border-bottom: none; }
.dr-pick .pk:hover { background: var(--hover); color: var(--text); }
.dr-pick .pk .st { margin-left: auto; font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-4); }
.dr-confirm { margin-top: 10px; border: 0.5px solid var(--accent-line); background: var(--accent-dim); border-radius: var(--r-md); padding: 12px; }
.dr-confirm .ct { font-size: 12.5px; color: var(--text); font-weight: 600; line-height: 1.4; }
.dr-confirm .cd { font-size: 11.5px; color: var(--text-2); line-height: 1.55; margin-top: 5px; }
.dr-confirm .cw { font-family: var(--mono); font-size: 10.5px; color: var(--run); margin-top: 7px; line-height: 1.5; }
.dr-confirm .cbtns { display: flex; gap: 8px; margin-top: 11px; }
/* honest write-result toast */
.art-toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 420;
  background: var(--surface-2); border: 0.5px solid var(--line-bright); border-radius: 10px;
  padding: 10px 14px; font-family: var(--mono); font-size: 11.5px; color: var(--text);
  box-shadow: 0 10px 34px oklch(0 0 0 / 0.35); max-width: 340px;
  opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; pointer-events: none;
}
.art-toast.on { opacity: 1; transform: none; }

/* ---- artifact panel scroll polish: thin themed scrollbars ----
   Scoped to the canvas panes + row drawer only; thumb/hover use the shared
   line/accent tokens so all three themes resolve. */
.canvas-stage ::-webkit-scrollbar,
.row-drawer ::-webkit-scrollbar { width: 8px; height: 8px; }
.canvas-stage ::-webkit-scrollbar-track,
.row-drawer ::-webkit-scrollbar-track { background: transparent; }
.canvas-stage ::-webkit-scrollbar-thumb,
.row-drawer ::-webkit-scrollbar-thumb {
  background: var(--line-bright); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
.canvas-stage ::-webkit-scrollbar-thumb:hover,
.row-drawer ::-webkit-scrollbar-thumb:hover { background: var(--accent-line); background-clip: padding-box; }
.canvas-stage ::-webkit-scrollbar-corner,
.row-drawer ::-webkit-scrollbar-corner { background: transparent; }
.art-toast.err { color: var(--err); border-color: color-mix(in oklab, var(--err) 45%, transparent); }

/* ---- Salesforce pane: SOQL aggregate answers (COUNT / SUM / GROUP BY) ----
   summaries render as KPI tiles or per-group bars, never a 1-row alias table */
.sf-agg-kpis { padding: 12px 14px 14px; margin-bottom: 0; }
.sf-agg-kpis .kpi { min-width: 0; }
.sf-agg-kpis .kpi .kv { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-agg { padding: 8px 14px 12px; }
.sf-agg .agg-legend { font-family: var(--mono); font-size: 10px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 0 8px; }
.sf-agg .stage-row { grid-template-columns: minmax(110px, 190px) 1fr auto; }
.sf-agg .sn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-agg .sv { min-width: 80px; }
/* the exact query behind the artifact, collapsed (provenance, not noise) */
.sf-soql { border-top: 0.5px solid var(--line-soft); padding: 8px 14px 10px; }
.sf-soql summary { cursor: pointer; font-family: var(--mono); font-size: 10.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.04em; }
.sf-soql .tx { padding: 6px 0 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--text-3); white-space: pre-wrap; word-break: break-word; }

/* ---- narrow desktop/web shell ------------------------------------------------
   Keep the mode rail available at compact widths, but stop the desktop thread +
   canvas minimums from pushing titlebar actions and Today content off-screen.
   Focus mode shows the thread; canvas mode shows the artifact pane. */
@media (max-width: 700px) {
  :root { --sidebar-w: 200px !important; }
  #titlebar { grid-template-columns: minmax(0, 1fr) auto; }
  .tl-center { display: none; }
  .brand-by { display: none; }

  #body,
  #body.layout-focus {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0;
  }
  #body.layout-canvas {
    grid-template-columns: var(--sidebar-w) 0 minmax(0, 1fr);
  }
  body.sidebar-collapsed #body,
  body.sidebar-collapsed #body.layout-focus {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }
  body.sidebar-collapsed #body.layout-canvas {
    grid-template-columns: 0 0 minmax(0, 1fr);
  }
}
