/* NodeBench workspace — shared tokens + primitives
   --------------------------------------------------
   Scenario across all surfaces: DISCO (legal tech diligence)
*/

:root {
  --accent: #D97757;
  --accent-hover: #C76648;
  --accent-tint: rgba(217,119,87,.10);
  --accent-border: rgba(217,119,87,.24);
  --accent-ink: #AD5F45;

  --indigo: #5E6AD2;
  --indigo-tint: rgba(94,106,210,.08);
  --indigo-border: rgba(94,106,210,.22);

  --bg-app: #FBF9F6;        /* warm off-white app shell */
  --bg-canvas: #F5F2EE;     /* canvas background (design-canvas) */
  --bg-surface: #FFFFFF;
  --bg-muted: #F5F4F1;
  --bg-notebook: #FFFCF6;   /* parchment */
  --bg-inspector: #FAFAF7;

  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;

  --border-subtle: rgba(15,23,42,.06);
  --border-default: rgba(15,23,42,.10);
  --border-strong: rgba(15,23,42,.16);

  --success: #047857;
  --success-tint: rgba(4,120,87,.08);
  --warn: #B45309;
  --warn-tint: rgba(180,83,9,.08);
  --fail: #B91C1C;

  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 1px rgba(15,23,42,.03);
  --shadow-md: 0 8px 22px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 48px rgba(15,23,42,.12), 0 4px 10px rgba(15,23,42,.06);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-serif: "Lora", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }

/* ──────────────────────────────────────────────────────────────────
   Shell — header + tab switcher + (optional) right inspector
   ────────────────────────────────────────────────────────────────── */
.ws-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg-app);
  font-family: var(--font-sans);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
}

.ws-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 10;
}
.ws-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13.5px; letter-spacing: -0.01em;
}
.ws-brand img { width: 22px; height: 22px; border-radius: 5px; }
.ws-brand span em { font-style: normal; color: var(--accent); }

.ws-entity {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}
.ws-entity-avatar {
  width: 22px; height: 22px; border-radius: 5px;
  background: linear-gradient(135deg, #1A365D, #0F4C81);
  color: #FFFAF0; font-weight: 700; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.04em;
}
.ws-entity-name { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.ws-entity-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.ws-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 2px;
  background: var(--bg-muted);
  border-radius: 10px;
  margin-left: auto;
}
.ws-tab {
  padding: 6px 14px;
  border: 0; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 180ms var(--ease-out-expo);
  letter-spacing: -0.005em;
}
.ws-tab[data-active="true"] {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.ws-tab-count {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 999px;
  background: var(--border-subtle);
  color: var(--text-muted);
}
.ws-tab[data-active="true"] .ws-tab-count {
  background: var(--accent-tint); color: var(--accent-ink);
}

.ws-header-actions { display: flex; gap: 6px; align-items: center; }
.ws-icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.ws-icon-btn:hover { background: var(--bg-muted); border-color: var(--border-default); color: var(--text-primary); }

.ws-body {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  min-height: 0;
}
.ws-body[data-has-inspector="true"] {
  grid-template-columns: 1fr 360px;
}

.ws-main {
  overflow-y: auto;
  min-height: 0;
  position: relative;
}
.ws-main::-webkit-scrollbar { width: 10px; }
.ws-main::-webkit-scrollbar-track { background: transparent; }
.ws-main::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,.1); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
}

/* ──────────────────────────────────────────────────────────────────
   Right inspector (contextual)
   ────────────────────────────────────────────────────────────────── */
.ws-inspector {
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-inspector);
  overflow-y: auto;
  min-height: 0;
  display: flex; flex-direction: column;
}
.ws-inspector-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-inspector);
  z-index: 2;
}
.ws-inspector-kicker {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--text-muted);
}
.ws-inspector-title {
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin: 3px 0 0;
}
.ws-inspector-body {
  padding: 14px 18px 40px;
  display: flex; flex-direction: column; gap: 18px;
}
.ws-insp-section {
  display: flex; flex-direction: column; gap: 8px;
}
.ws-insp-section h4 {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted);
  margin: 0;
}

/* ──────────────────────────────────────────────────────────────────
   Primitives: entity chips, citations, pills, panels, cards
   ────────────────────────────────────────────────────────────────── */
.ent-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px 1px 4px;
  background: var(--indigo-tint);
  color: var(--indigo);
  border: 1px solid var(--indigo-border);
  border-radius: 5px;
  font-weight: 600; font-size: 12.5px;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 140ms var(--ease-out-expo);
}
.ent-chip:hover { background: rgba(94,106,210,.14); }
.ent-chip-dot {
  width: 14px; height: 14px; border-radius: 3px;
  background: linear-gradient(135deg, #1A365D, #0F4C81);
  color: #FFFAF0; font-size: 8px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.ent-chip-dot--green { background: linear-gradient(135deg, #0E7A5C, #16A37E); }
.ent-chip-dot--amber { background: linear-gradient(135deg, #C77826, #E09149); }
.ent-chip-dot--purple { background: linear-gradient(135deg, #6B3BA3, #8B5CC1); }
.ent-chip-dot--slate  { background: linear-gradient(135deg, #334155, #475569); }

.cite {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px;
  background: var(--accent-tint);
  color: var(--accent-ink);
  border: 1px solid var(--accent-border);
  vertical-align: baseline;
  margin: 0 1px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
.cite:hover { background: rgba(217,119,87,.18); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: -0.005em;
  border: 1px solid;
}
.pill-neutral { background: var(--bg-muted); border-color: var(--border-subtle); color: var(--text-secondary); }
.pill-accent  { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent-ink); }
.pill-ok      { background: var(--success-tint); border-color: rgba(4,120,87,.2); color: var(--success); }
.pill-warn    { background: var(--warn-tint); border-color: rgba(180,83,9,.2); color: var(--warn); }
.pill-indigo  { background: var(--indigo-tint); border-color: var(--indigo-border); color: var(--indigo); }
.pill-mono    { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; }

.kicker {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted);
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

/* Company card (reused in Chat, Cards, Notebook embeds) */
.cc {
  display: flex; flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: box-shadow 180ms var(--ease-out-expo), transform 180ms var(--ease-out-expo);
  cursor: pointer;
}
.cc:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.cc[data-active="true"] {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-tint), var(--shadow-sm);
}
.cc-header {
  padding: 12px 14px 10px;
  display: flex; align-items: flex-start; gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.cc-avatar {
  width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0;
  color: #FFFAF0; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.02em;
}
.cc-title-row { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cc-title {
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 6px;
}
.cc-subtitle {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 1px; font-family: var(--font-mono);
}
.cc-body {
  padding: 10px 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.cc-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 11.5px;
}
.cc-metric {
  display: flex; justify-content: space-between;
  padding: 2px 0;
}
.cc-metric-label { color: var(--text-muted); }
.cc-metric-val { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }
.cc-metric-val[data-trend="up"]::after   { content: ' ↑'; color: var(--success); }
.cc-metric-val[data-trend="down"]::after { content: ' ↓'; color: var(--fail); }

.cc-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ──────────────────────────────────────────────────────────────────
   Composer
   ────────────────────────────────────────────────────────────────── */
.composer {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
}
.composer-input {
  border: 0; outline: 0; resize: none;
  font: inherit; font-size: 14px;
  padding: 6px 4px;
  width: 100%; min-height: 38px;
  background: transparent;
  color: var(--text-primary);
  line-height: 1.55;
}
.composer-tools {
  display: flex; align-items: center; gap: 6px;
}
.composer-tool-btn {
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 11.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.composer-tool-btn:hover { background: var(--bg-surface); border-color: var(--border-default); color: var(--text-primary); }
.composer-tool-btn[data-active="true"] {
  background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent-ink);
}
.composer-submit {
  margin-left: auto;
  width: 32px; height: 32px; border-radius: 10px;
  border: 0;
  background: linear-gradient(180deg, #D97757 96%, #C6684A 100%);
  color: #FFFAF8; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(217,119,87,.28);
  transition: transform 80ms var(--ease-out-expo);
}
.composer-submit:active { transform: scale(0.94); }

/* ──────────────────────────────────────────────────────────────────
   Icons (inline feather/lucide outlines, uniform 1.75 stroke)
   ────────────────────────────────────────────────────────────────── */
.ws-ic { stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; fill: none; }
