/* Minimum tokens + utility classes needed by the NodeBench UI kit.
   Mirrors a subset of ../colors_and_type.css so this folder runs standalone. */

:root {
  --accent-primary: #D97757;
  --accent-primary-hover: #C76648;
  --accent-primary-tint: rgba(217, 119, 87, 0.10);
  --accent-primary-border: rgba(217, 119, 87, 0.24);
  --accent-ink: #AD5F45;
  --indigo: #5E6AD2;

  --bg-app: #FAFAFA;
  --bg-surface: #FFFFFF;
  --bg-secondary: #F3F4F6;
  --bg-tertiary: #E5E7EB;
  --bg-paper: #FBF8F2;

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

  --border-subtle: rgba(15, 23, 42, 0.06);
  --border-default: rgba(15, 23, 42, 0.10);
  --border-strong: #E5E7EB;

  --success: #047857;
  --warning: #B45309;
  --danger: #DC2626;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;

  --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 24px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 4px 8px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.08);
  --shadow-accent: 0 14px 34px rgba(217, 119, 87, 0.25);

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

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg-app: #09090B;
  --bg-surface: #111418;
  --bg-secondary: #171B20;
  --bg-tertiary: #1B2027;
  --bg-paper: #1B1A18;

  --text-primary: #F2F4F7;
  --text-secondary: #C6CCD4;
  --text-muted: #99A3AE;
  --text-faint: #6B7280;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

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

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

/* Layered radial glow on app bg */
body.nb-app {
  background:
    radial-gradient(circle at 12% -12%, rgba(217, 119, 87, 0.08), transparent 28%),
    radial-gradient(circle at 92% 4%, rgba(94, 106, 210, 0.06), transparent 24%),
    var(--bg-app);
  min-height: 100vh;
}
html[data-theme="dark"] body.nb-app {
  background:
    radial-gradient(circle at 12% -12%, rgba(217, 119, 87, 0.14), transparent 28%),
    radial-gradient(circle at 92% 4%, rgba(94, 106, 210, 0.10), transparent 24%),
    linear-gradient(180deg, #101317, #111419);
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* === Buttons === */
.nb-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  transition: all 160ms var(--ease-out-expo);
  background: transparent;
  color: var(--text-primary);
}
.nb-btn:active { transform: translateY(1px) scale(0.985); transition-duration: 75ms; }

.nb-btn-primary {
  border-radius: 16px;
  border-color: var(--accent-primary-border);
  background: linear-gradient(180deg, #D97757 96%, #C6684A 100%);
  color: #FFFAF8;
  font-weight: 600;
  padding: 10px 18px;
  box-shadow: var(--shadow-accent);
}
.nb-btn-primary:hover { filter: brightness(1.03); }

.nb-btn-secondary {
  border-radius: 999px;
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
}
html[data-theme="dark"] .nb-btn-secondary { background: rgba(23, 27, 32, 0.78); }
.nb-btn-secondary:hover { background: var(--bg-surface); }

.nb-btn-ghost:hover { background: rgba(15, 23, 42, 0.04); color: var(--text-primary); }
html[data-theme="dark"] .nb-btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }

/* === Panels === */
.nb-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.nb-panel-soft {
  border-radius: 22px;
  background: color-mix(in oklab, var(--bg-surface) 86%, transparent);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
}
.nb-hover-lift {
  transition: transform 180ms var(--ease-out-expo), box-shadow 180ms var(--ease-out-expo), border-color 180ms var(--ease-out-expo);
}
.nb-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

/* === Badges === */
.nb-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text-muted);
}
html[data-theme="dark"] .nb-badge { background: rgba(255, 255, 255, 0.04); }
.nb-badge-accent { border-color: var(--accent-primary-border); background: var(--accent-primary-tint); color: var(--accent-ink); }
.nb-badge-success { border-color: rgba(5, 150, 105, 0.16); background: rgba(5, 150, 105, 0.08); color: var(--success); }
.nb-badge-warn { border-color: rgba(180, 83, 9, 0.2); background: rgba(180, 83, 9, 0.06); color: var(--warning); }

/* === Kicker === */
.nb-kicker {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--text-muted);
}

/* === Reveal === */
@keyframes nb-reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
/* Default is the final state — animation is only applied via .nb-animate-in,
   which we skip in iframes that pause animations (fallback: content is visible). */
.nb-reveal, .nb-reveal-stagger > * { opacity: 1; }
.nb-animate-in.nb-reveal,
.nb-animate-in .nb-reveal-stagger > * { animation: nb-reveal 480ms var(--ease-out-expo) both; }
.nb-reveal-stagger > *:nth-child(1) { animation-delay: 0ms; }
.nb-reveal-stagger > *:nth-child(2) { animation-delay: 100ms; }
.nb-reveal-stagger > *:nth-child(3) { animation-delay: 200ms; }
.nb-reveal-stagger > *:nth-child(4) { animation-delay: 300ms; }
.nb-reveal-stagger > *:nth-child(5) { animation-delay: 400ms; }
.nb-reveal-stagger > *:nth-child(6) { animation-delay: 500ms; }

@media (prefers-reduced-motion: reduce) {
  .nb-reveal, .nb-reveal-stagger > * { animation: none; }
}

/* === Layout shell === */
.nb-shell {
  max-width: 72rem;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.nb-topnav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 248, 245, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}
html[data-theme="dark"] .nb-topnav { background: rgba(13, 16, 20, 0.82); }

/* === Focus === */
.nb-focus:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.25);
  border-color: var(--accent-primary-border);
}

/* ═══════════════════════════════════════════════════════════════════
   Tweaks — feel-axis CSS variables driven by the panel
   - --feel-density: 0.8 compact → 1.25 spacious (scales paddings, line-height, gaps)
   - --feel-texture: 0 clean → 1 paper (enables grain + parchment tones)
   - data-pace on body: "instant" | "conversational" | "deliberate" — tunes stream rate
   ══════════════════════════════════════════════════════════════════ */
:root {
  --feel-density: 1;
  --feel-texture: 0;
}
body[data-pace="instant"]       { --pace-mult: 0.18; }
body[data-pace="conversational"]{ --pace-mult: 1;    }
body[data-pace="deliberate"]    { --pace-mult: 2.4;  }

/* Texture dial — parchment/grain layer mixed into bg */
body.nb-app[data-texture="on"] {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(217,119,87,.10), transparent 28%),
    radial-gradient(circle at 85% 8%,  rgba(94,106,210,.07), transparent 26%),
    radial-gradient(1px 1px at 10% 20%, rgba(27,26,24,.04) 50%, transparent 52%),
    radial-gradient(1px 1px at 40% 60%, rgba(27,26,24,.04) 50%, transparent 52%),
    radial-gradient(1px 1px at 80% 40%, rgba(27,26,24,.04) 50%, transparent 52%),
    radial-gradient(1px 1px at 65% 85%, rgba(27,26,24,.04) 50%, transparent 52%),
    linear-gradient(180deg, #FBF8F2, #F7F2E9);
}
body.nb-app[data-texture="on"] .nb-panel {
  background: linear-gradient(180deg, #FFFDF7, #FCF8F0);
  border-color: color-mix(in oklab, var(--accent-primary) 16%, var(--border-subtle));
}

/* density knob — applied to selected chrome */
.nb-shell { padding: calc(32px * var(--feel-density)) 24px calc(64px * var(--feel-density)); }
.nb-panel.nb-density { padding: calc(20px * var(--feel-density)); }

/* ═══════════════════════════════════════════════════════════════════
   Streaming trace + cursor (AnswerPacket)
   ══════════════════════════════════════════════════════════════════ */
.nb-reasoning {
  background: var(--bg-secondary);
  border: 1px dashed var(--border-default);
  border-radius: 12px;
  transition: opacity 360ms var(--ease-out-expo), filter 360ms var(--ease-out-expo);
}
.nb-reasoning[data-phase="done"] {
  opacity: 0.72;
}
.nb-reasoning-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--text-muted);
}
.nb-reasoning-list li {
  display: flex; align-items: center; gap: 8px;
  transition: color 200ms var(--ease-out-expo), opacity 240ms var(--ease-out-expo);
}
.nb-reasoning-list li[data-state="pending"] { opacity: 0.3; }
.nb-reasoning-list li[data-state="active"] {
  color: var(--accent-ink);
}
.nb-reasoning-list li[data-state="active"] .nb-reasoning-dot {
  background: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-primary-tint);
}
.nb-reasoning-list li[data-state="done"] {
  color: var(--text-secondary);
}
.nb-reasoning-list li[data-state="done"] .nb-reasoning-dot {
  background: var(--success);
}
.nb-reasoning-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  transition: background 200ms var(--ease-out-expo), box-shadow 200ms var(--ease-out-expo);
}

.nb-cite {
  font-size: 10px; font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-primary-tint);
  border: 1px solid var(--accent-primary-border);
  padding: 0 4px; border-radius: 4px;
  margin-left: 2px;
  cursor: pointer;
  font-family: var(--font-mono);
  vertical-align: super;
  line-height: 1;
}

.nb-stream-cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent-primary);
  vertical-align: -2px;
  margin-left: 3px;
  animation: nb-caret 700ms steps(2) infinite;
  border-radius: 1px;
}
@keyframes nb-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0.2; } }

.nb-dot-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-primary-border);
  border-top-color: var(--accent-primary);
  animation: nb-spin 0.9s linear infinite;
}
.nb-dot-spinner--sm { width: 7px; height: 7px; border-width: 1.2px; }
@keyframes nb-spin { to { transform: rotate(360deg); } }

.nb-sources, .nb-followup {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 420ms var(--ease-out-expo), transform 420ms var(--ease-out-expo);
}
.nb-sources[data-shown="true"], .nb-followup[data-shown="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   Reports — grid/list modes with preview thumbnails
   ══════════════════════════════════════════════════════════════════ */
.nb-reports-toolbar {
  display: flex; align-items: center; gap: 8px;
}
.nb-view-toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--bg-secondary);
  border-radius: 10px;
}
.nb-view-toggle button {
  border: 0; background: transparent;
  padding: 5px 10px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.nb-view-toggle button[data-active="true"] {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}

.nb-reports-grid {
  display: grid;
  gap: 16px;
}
.nb-reports-grid[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.nb-reports-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.nb-reports-grid[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .nb-reports-grid[data-cols="3"], .nb-reports-grid[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .nb-reports-grid { grid-template-columns: 1fr !important; }
}

.nb-rcard {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 200ms var(--ease-out-expo), box-shadow 200ms var(--ease-out-expo), border-color 200ms var(--ease-out-expo);
  display: flex; flex-direction: column;
}
.nb-rcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}
.nb-rcard-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}
.nb-rcard-thumb svg { width: 100%; height: 100%; display: block; }
.nb-rcard-thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(17,24,39,.12));
  pointer-events: none;
}
.nb-rcard-thumb-overlay {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; align-items: center; gap: 6px;
  z-index: 2;
}
.nb-rcard-body {
  padding: 14px 16px 14px;
  display: flex; flex-direction: column; gap: 8px;
  flex: 1;
}
.nb-rcard-title {
  font-size: 14.5px; font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--text-primary);
  text-wrap: pretty;
}
.nb-rcard-sub {
  font-size: 12.5px; color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.nb-rcard-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-faint);
}
.nb-rcard-watch {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border-default);
  background: rgba(255,255,255,.78);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.nb-rcard-watch[data-on="true"] {
  border-color: var(--accent-primary-border);
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
}

/* ═══════════════════════════════════════════════════════════════════
   Inbox (formerly Nudges) — actionable row pattern
   ══════════════════════════════════════════════════════════════════ */
.nb-inbox-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.nb-inbox-filter {
  display: inline-flex; gap: 2px;
  background: var(--bg-secondary);
  padding: 3px; border-radius: 10px;
}
.nb-inbox-filter button {
  border: 0; background: transparent;
  padding: 5px 12px; border-radius: 8px;
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.nb-inbox-filter button[data-active="true"] {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.nb-inbox-filter .count {
  margin-left: 5px; font-family: var(--font-mono);
  font-size: 10px; color: var(--text-faint);
}

.nb-ibx-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: 12px;
  padding: 14px 14px 12px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  transition: all 200ms var(--ease-out-expo);
}
.nb-ibx-row:hover { box-shadow: var(--shadow-sm); border-color: var(--border-default); }
.nb-ibx-row[data-priority="act"]     { border-left-color: var(--accent-primary); }
.nb-ibx-row[data-priority="watch"]   { border-left-color: var(--indigo); }
.nb-ibx-row[data-priority="fyi"]     { border-left-color: var(--border-default); }
.nb-ibx-row[data-priority="auto"]    { border-left-color: var(--success); }

.nb-ibx-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.nb-ibx-row[data-priority="act"]   .nb-ibx-icon { background: var(--accent-primary-tint); color: var(--accent-ink); }
.nb-ibx-row[data-priority="watch"] .nb-ibx-icon { background: rgba(94,106,210,.10);       color: var(--indigo); }
.nb-ibx-row[data-priority="auto"]  .nb-ibx-icon { background: rgba(4,120,87,.10);         color: var(--success); }

.nb-ibx-body { min-width: 0; }
.nb-ibx-top {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px;
  flex-wrap: wrap;
}
.nb-ibx-entity {
  font-size: 11px; font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-primary-tint);
  padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--accent-primary-border);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.nb-ibx-title {
  font-size: 13.5px; font-weight: 600;
  letter-spacing: -0.008em;
  color: var(--text-primary);
}
.nb-ibx-when {
  margin-left: auto;
  font-size: 11px; color: var(--text-faint);
  font-family: var(--font-mono);
}
.nb-ibx-msg {
  font-size: 12.5px; color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.nb-ibx-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.nb-ibx-actions button {
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer;
  transition: all 140ms var(--ease-out-expo);
}
.nb-ibx-actions button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.nb-ibx-actions button.primary {
  background: var(--accent-primary);
  color: #FFFAF8;
  border-color: var(--accent-primary);
}
.nb-ibx-actions button.primary:hover { filter: brightness(1.03); }
.nb-ibx-actions button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.nb-ibx-actions .dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  margin-right: 3px;
}

.nb-ibx-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.nb-ibx-priority {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 4px;
  font-family: var(--font-mono);
}
.nb-ibx-priority[data-k="act"]   { background: var(--accent-primary-tint); color: var(--accent-ink); }
.nb-ibx-priority[data-k="watch"] { background: rgba(94,106,210,.10);       color: var(--indigo); }
.nb-ibx-priority[data-k="auto"]  { background: rgba(4,120,87,.10);         color: var(--success); }
.nb-ibx-priority[data-k="fyi"]   { background: var(--bg-secondary);        color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════
   Me page — split layout: profile + notebook + settings
   ══════════════════════════════════════════════════════════════════ */
.nb-me-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) { .nb-me-grid { grid-template-columns: 1fr; } }

.nb-me-sidenav {
  position: sticky; top: 84px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}
.nb-me-sidenav .hd {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}
.nb-me-sidenav .hd .av {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #D97757, #5E6AD2);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.nb-me-sidenav .hd .nm { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.nb-me-sidenav .hd .em { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }

.nb-me-sidenav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px; border-radius: 8px;
  border: 0; background: transparent;
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 140ms var(--ease-out-expo);
}
.nb-me-sidenav button:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-me-sidenav button[data-active="true"] {
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  font-weight: 600;
}
.nb-me-sidenav .count {
  margin-left: auto;
  font-size: 10.5px; color: var(--text-faint);
  font-family: var(--font-mono);
}
.nb-me-sidenav .divider {
  height: 1px; background: var(--border-subtle);
  margin: 6px 4px;
}
.nb-me-sidenav .section-title {
  padding: 8px 10px 4px;
  font-size: 10px; font-weight: 700; color: var(--text-faint);
  letter-spacing: 0.16em; text-transform: uppercase;
  font-family: var(--font-sans);
}

/* Settings content */
.nb-settings-h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.nb-settings-sub {
  font-size: 13px; color: var(--text-muted);
  margin: 0 0 24px;
}
.nb-settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.nb-settings-section h2 {
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.nb-settings-section p {
  font-size: 12.5px; color: var(--text-muted);
  margin: 0 0 16px;
}
.nb-field {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 14px; padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  align-items: center;
}
.nb-field:first-of-type { border-top: 0; }
.nb-field-l { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.nb-field-l .hint { display: block; font-size: 11px; font-weight: 500; color: var(--text-faint); margin-top: 2px; }
.nb-field-r { display: flex; align-items: center; gap: 8px; }
.nb-field-r input[type="text"], .nb-field-r input[type="email"], .nb-field-r select {
  flex: 1; max-width: 320px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: 8px; padding: 7px 10px;
  font-family: inherit; font-size: 12.5px;
  color: var(--text-primary);
}
.nb-field-r input[type="text"]:focus, .nb-field-r input[type="email"]:focus, .nb-field-r select:focus { outline: none; border-color: var(--accent-primary-border); box-shadow: 0 0 0 3px var(--accent-primary-tint); }

.nb-switch {
  position: relative;
  width: 34px; height: 20px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms var(--ease-out-expo);
  border: 0; padding: 0;
  flex-shrink: 0;
}
.nb-switch[data-on="true"] { background: var(--accent-primary); }
.nb-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: transform 160ms var(--ease-out-expo);
  box-shadow: 0 1px 2px rgba(15,23,42,.2);
}
.nb-switch[data-on="true"]::after { transform: translateX(14px); }

.nb-integration-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 8px;
}
.nb-integration-card:last-of-type { margin-bottom: 0; }
.nb-integration-card .icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--text-secondary);
}
.nb-integration-card .t { font-size: 13px; font-weight: 600; }
.nb-integration-card .s { font-size: 11.5px; color: var(--text-muted); }

/* Usage bars */
.nb-usage-row { padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.nb-usage-row:first-of-type { border-top: 0; }
.nb-usage-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.nb-usage-head .k { color: var(--text-primary); font-weight: 600; }
.nb-usage-head .v { color: var(--text-muted); font-family: var(--font-mono); font-size: 11.5px; }
.nb-usage-bar {
  height: 6px; border-radius: 3px;
  background: var(--bg-secondary);
  overflow: hidden;
  position: relative;
}
.nb-usage-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #E59579);
  transition: width 360ms var(--ease-out-expo);
}
.nb-usage-bar.warn > span { background: linear-gradient(90deg, var(--warning), #D8A75A); }

/* ═══════════════════════════════════════════════════════════════════
   Chat thread — classic Claude-style vertical thread
   Sidebar (past threads) + thread (user right / agent left) + composer pinned
   Density: tight Linear/Slack-style lines with avatar gutters.
   ══════════════════════════════════════════════════════════════════ */

/* Override shell padding for chat — it owns the full viewport */
.nb-chat-root {
  position: fixed;
  top: 57px; /* topnav height */
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg-app);
  overflow: hidden;
}
@media (max-width: 760px) {
  .nb-chat-root { grid-template-columns: 1fr; }
  .nb-chat-sidebar { display: none; }
}

/* ─── Sidebar ─── */
.nb-chat-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  min-width: 0;
}
.nb-chat-sidebar-head {
  padding: 14px 14px 10px;
  display: flex; gap: 8px;
}
.nb-chat-new {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--accent-primary-border);
  background: linear-gradient(180deg, #D97757 96%, #C6684A 100%);
  color: #FFFAF8;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: filter 140ms;
}
.nb-chat-new:hover { filter: brightness(1.04); }
.nb-chat-search {
  position: relative;
  margin: 0 14px 10px;
}
.nb-chat-search input {
  width: 100%;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 6px 10px 6px 28px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
}
.nb-chat-search input:focus {
  outline: none;
  border-color: var(--accent-primary-border);
  box-shadow: 0 0 0 3px var(--accent-primary-tint);
}
.nb-chat-search svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint);
}
.nb-chat-threads {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 14px;
}
.nb-chat-threads-group {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 8px 4px;
}
.nb-chat-thread-item {
  display: flex; flex-direction: column;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0; background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 120ms;
  gap: 2px;
  min-width: 0;
}
.nb-chat-thread-item:hover { background: rgba(15,23,42,.04); }
html[data-theme="dark"] .nb-chat-thread-item:hover { background: rgba(255,255,255,.04); }
.nb-chat-thread-item[data-active="true"] {
  background: var(--bg-surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
  color: var(--text-primary);
}
.nb-chat-thread-title {
  font-size: 12.5px; font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.nb-chat-thread-title .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent-primary);
  flex-shrink: 0;
}
.nb-chat-thread-snippet {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-chat-thread-time {
  font-size: 10px; color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ─── Thread pane ─── */
.nb-chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  min-width: 0;
  background: var(--bg-app);
}

/* Header strip above the thread */
.nb-chat-header {
  padding: 10px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(250, 248, 245, 0.82);
  backdrop-filter: blur(18px);
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
html[data-theme="dark"] .nb-chat-header { background: rgba(13,16,20,.8); }
.nb-chat-header h2 {
  font-size: 13.5px; font-weight: 700;
  letter-spacing: -0.008em;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
.nb-chat-header-meta {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.nb-chat-header-icon {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #D97757, #5E6AD2);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.nb-chat-header-actions {
  display: flex; gap: 6px;
}
.nb-chat-header-actions button {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 140ms;
}
.nb-chat-header-actions button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Scrolling thread body */
.nb-chat-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0 24px;
  min-height: 0;
}
.nb-chat-scroll-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Turn (tight avatar + content) ─── */
.nb-turn {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 8px 0;
  min-width: 0;
}
.nb-turn-avatar {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 1px;
}
.nb-turn-avatar[data-role="user"] {
  background: linear-gradient(135deg, #5E6AD2, #4A54B0);
  color: #fff;
}
.nb-turn-avatar[data-role="agent"] {
  background: linear-gradient(135deg, #D97757, #C6684A);
  color: #FFFAF8;
}
.nb-turn-avatar svg { width: 14px; height: 14px; }

.nb-turn-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.nb-turn-head {
  display: flex; align-items: baseline; gap: 8px;
}
.nb-turn-who {
  font-size: 12.5px; font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-primary);
}
.nb-turn-time {
  font-size: 10.5px; color: var(--text-faint);
  font-family: var(--font-mono);
}
.nb-turn-actions {
  margin-left: auto;
  display: none; gap: 2px;
  opacity: 0;
  transition: opacity 160ms;
}
.nb-turn:hover .nb-turn-actions { display: inline-flex; opacity: 1; }
.nb-turn-actions button {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 0; background: transparent;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 120ms;
}
.nb-turn-actions button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* User turn text */
.nb-turn[data-role="user"] .nb-turn-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* User editable textarea */
.nb-turn-edit {
  width: 100%;
  border: 1px solid var(--accent-primary-border);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-primary-tint);
  min-height: 48px;
}
.nb-turn-edit-actions {
  display: flex; gap: 6px; margin-top: 6px;
}
.nb-turn-edit-actions button {
  padding: 5px 11px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.nb-turn-edit-actions button.primary {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: #FFFAF8;
}

/* Agent turn */
.nb-turn[data-role="agent"] .nb-turn-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.6;
}
.nb-turn[data-role="agent"] .nb-turn-text p {
  margin: 0 0 8px;
  text-wrap: pretty;
}
.nb-turn[data-role="agent"] .nb-turn-text p:last-child { margin-bottom: 0; }
.nb-turn[data-role="agent"] .nb-turn-text strong {
  color: var(--text-primary);
  font-weight: 700;
}
.nb-turn-receipts {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  margin-top: 4px;
}

/* Sources strip */
.nb-turn-sources {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.nb-turn-sources .ttl {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
  margin-right: 6px;
  align-self: center;
}
.nb-src-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px 9px 2px 4px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 140ms;
  max-width: 220px;
}
.nb-src-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-secondary);
}
.nb-src-chip .fav {
  width: 16px; height: 16px; border-radius: 4px;
  background: var(--bg-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.nb-src-chip .dom {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}
.nb-src-chip .n {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-right: 2px;
}
.nb-src-chip-more {
  font-size: 11px; color: var(--text-muted);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px dashed var(--border-default);
  background: transparent;
  cursor: pointer;
}

/* Branches */
.nb-turn-branches {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 8px;
}
.nb-turn-branches-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 4px 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}
.nb-branch {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 120ms;
}
.nb-branch:hover { background: var(--bg-secondary); }
.nb-branch .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-branch .n {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-secondary);
}
.nb-branch[data-active="true"] { background: var(--accent-primary-tint); color: var(--accent-ink); font-weight: 600; }
.nb-branch[data-active="true"] .n { background: rgba(217,119,87,.2); color: var(--accent-ink); }

/* Action chips row */
.nb-turn-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.nb-action-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: all 140ms;
}
.nb-action-chip:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.nb-action-chip.primary {
  background: var(--accent-primary);
  color: #FFFAF8;
  border-color: var(--accent-primary);
}
.nb-action-chip.primary:hover { filter: brightness(1.03); }

/* Follow-up suggestions */
.nb-followups {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
}
.nb-followup-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-primary-border);
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: all 140ms;
  text-align: left;
  max-width: 100%;
}
.nb-followup-chip:hover {
  background: color-mix(in oklab, var(--accent-primary) 16%, var(--bg-surface));
}

/* Quote/reply popover */
.nb-quote-pop {
  position: fixed;
  z-index: 50;
  background: var(--text-primary);
  color: var(--bg-surface);
  border-radius: 8px;
  padding: 5px;
  box-shadow: var(--shadow-lg);
  display: flex; gap: 2px;
  transform: translate(-50%, -100%);
  margin-top: -8px;
}
.nb-quote-pop::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--text-primary);
}
.nb-quote-pop button {
  border: 0; background: transparent;
  color: var(--bg-surface);
  padding: 5px 10px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.nb-quote-pop button:hover { background: rgba(255,255,255,.12); }

/* Reasoning trace (collapsible on agent turn) */
.nb-trace {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.nb-trace-head {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 0;
  padding: 2px 6px 2px 2px;
  border-radius: 5px;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.nb-trace-head:hover { background: var(--bg-secondary); color: var(--text-muted); }
.nb-trace-head .caret { transition: transform 180ms; }
.nb-trace-head[data-open="true"] .caret { transform: rotate(90deg); }
.nb-trace-body {
  list-style: none;
  margin: 4px 0 0;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: 6px;
  display: flex; flex-direction: column; gap: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.nb-trace-body li {
  display: flex; align-items: center; gap: 7px;
}
.nb-trace-body li .d {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.nb-trace-body li[data-active="true"] .d {
  background: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-tint);
}
.nb-trace-body li[data-active="true"] { color: var(--accent-ink); }

/* "Thinking…" indicator */
.nb-thinking {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  font-family: inherit;
}
.nb-thinking-dots {
  display: inline-flex; gap: 2px;
}
.nb-thinking-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent-primary);
  animation: nb-blink 1.4s infinite ease-in-out both;
}
.nb-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.nb-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes nb-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* ─── Composer ─── */
.nb-chat-composer {
  padding: 10px 24px 16px;
  background: rgba(250, 248, 245, 0.9);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
}
html[data-theme="dark"] .nb-chat-composer { background: rgba(13,16,20,.88); }
.nb-chat-composer-inner {
  max-width: 780px; margin: 0 auto;
}
.nb-pins {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.nb-pin {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 4px 3px 9px;
  border-radius: 999px;
  background: var(--accent-primary-tint);
  border: 1px solid var(--accent-primary-border);
  color: var(--accent-ink);
  font-size: 11px; font-weight: 600;
}
.nb-pin .typ {
  font-family: var(--font-mono);
  font-size: 9.5px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nb-pin button {
  width: 18px; height: 18px;
  border: 0; background: rgba(173,95,69,.15);
  color: inherit;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.nb-pin button:hover { background: rgba(173,95,69,.28); }

.nb-chat-field {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  transition: border-color 160ms, box-shadow 160ms;
}
.nb-chat-field:focus-within {
  border-color: var(--accent-primary-border);
  box-shadow: 0 0 0 4px var(--accent-primary-tint);
}
.nb-chat-field textarea {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.55;
  resize: none;
  min-height: 24px;
  max-height: 180px;
  padding: 6px 0;
}
.nb-chat-field textarea::placeholder { color: var(--text-faint); }
.nb-chat-attach {
  display: flex; gap: 2px;
}
.nb-chat-attach button {
  width: 32px; height: 32px;
  border: 0; background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 140ms;
}
.nb-chat-attach button:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-chat-send {
  width: 32px; height: 32px;
  border: 0;
  background: var(--accent-primary);
  color: #FFFAF8;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 140ms;
}
.nb-chat-send:hover { filter: brightness(1.04); }
.nb-chat-send:disabled {
  background: var(--bg-tertiary);
  color: var(--text-faint);
  cursor: not-allowed;
}

.nb-chat-hint {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  padding: 0 4px;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.nb-chat-hint kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-muted);
  margin: 0 2px;
}



/* ═══════════════════════════════════════════════════════════════════════════
   REPORT DETAIL — opens from a Reports card
   Three layout variants share these primitives.
   ═══════════════════════════════════════════════════════════════════════════ */

.nb-rdetail {
  display: grid;
  gap: 0;
  min-height: calc(100vh - 200px);
  background: transparent;
  position: relative;
  overflow: hidden;
}
/* Notebook always gets the floor — rails overlay on demand instead of reflowing. */
.nb-rdetail[data-layout="three-pane"],
.nb-rdetail[data-layout="two-pane"],
.nb-rdetail[data-layout="notion"] { grid-template-columns: minmax(0, 1fr); }

/* Outline & inspector are absolute overlays within the report — match Chat surface pattern.
   They float above the notebook when toggled, never reflow. */
.nb-rdetail-outline,
.nb-rdetail-right {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 8;
  background: var(--bg-surface);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), box-shadow 220ms;
  will-change: transform;
}
.nb-rdetail-outline {
  left: 0;
  width: 280px;
  transform: translateX(-100%);
  border-right: 1px solid var(--border-default);
}
.nb-rdetail-right {
  right: 0;
  width: 360px;
  transform: translateX(100%);
  border-left: 1px solid var(--border-default);
}
.nb-rdetail[data-left-collapsed="false"]  > .nb-rdetail-outline {
  transform: translateX(0);
  box-shadow: 12px 0 40px -18px rgba(15, 23, 42, .22);
}
.nb-rdetail[data-right-collapsed="false"] > .nb-rdetail-right {
  transform: translateX(0);
  box-shadow: -12px 0 40px -18px rgba(15, 23, 42, .22);
}

/* Scrim — closes open rails on click, same flavor as the Chat surface scrim. */
.nb-rdetail-scrim {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.18);
  z-index: 7;
  cursor: pointer;
  animation: nb-rdetail-scrim-in 180ms ease-out;
}
@keyframes nb-rdetail-scrim-in { from { opacity: 0; } to { opacity: 1; } }

/* ── shared sub-header (above all panes) ── */
.nb-rdetail-header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  z-index: 5;
}
.nb-rdetail-back {
  width: 30px; height: 30px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 140ms;
}
.nb-rdetail-back:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* Rail toggles use the shared .nb-rail-toggle class (same as Chat). */
.nb-rdetail-crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); flex: 1; min-width: 0;
}
.nb-rdetail-crumbs .sep { color: var(--text-faint); }
.nb-rdetail-crumbs strong { color: var(--text-primary); font-weight: 600; }
.nb-rdetail-actions {
  display: flex; gap: 6px; align-items: center;
}
.nb-rdetail-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 140ms;
}
.nb-rdetail-action:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-rdetail-action-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16,185,129,.6);
  animation: nb-rd-pulse 2s ease-out infinite;
  flex-shrink: 0;
}
.nb-rdetail-action-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 500;
  margin-left: 1px;
}
@keyframes nb-rd-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.nb-rdetail-action[data-primary="true"] {
  background: var(--accent-primary-tint);
  border-color: var(--accent-primary-border);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ─── LEFT OUTLINE ─── */
.nb-rdetail-outline {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-y: auto;
  padding: 16px 8px 16px 12px;
}
.nb-rdetail-outline-h {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 8px 4px;
  margin-top: 4px;
}
.nb-rdetail-outline-h:first-child { margin-top: 0; }
.nb-rdetail-outline-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: all 120ms;
}
.nb-rdetail-outline-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-rdetail-outline-item[data-active="true"] {
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  font-weight: 600;
  border-color: var(--accent-primary-border);
}
.nb-rdetail-outline-item .num {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-faint);
  width: 16px; text-align: right;
}
.nb-rdetail-outline-item[data-depth="2"] { padding-left: 22px; font-size: 12px; color: var(--text-muted); }
.nb-rdetail-outline-pill {
  margin-left: auto;
  font-size: 9.5px; font-weight: 600;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.nb-rdetail-outline-pill[data-flavor="claim"]   { background: rgba(94,106,210,.10); color: #4853A6; }
.nb-rdetail-outline-pill[data-flavor="entity"]  { background: var(--accent-primary-tint); color: var(--accent-ink); }
.nb-rdetail-outline-pill[data-flavor="weak"]    { background: rgba(180, 83, 9, .12); color: var(--warning); }

/* ─── CENTER NOTEBOOK ─── */
.nb-rdetail-center {
  background: transparent;
  position: relative;
}
body[data-texture="on"] .nb-rdetail-center { background: transparent; }

.nb-nb-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 28px 240px;
}
.nb-nb-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.10em;
  margin-bottom: 10px;
}
.nb-nb-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-primary); }
.nb-nb-h1 {
  font-size: 32px; line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
  outline: 0;
}
.nb-nb-meta {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.nb-nb-meta .chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 11px; color: var(--text-secondary);
}
.nb-nb-meta .chip strong { color: var(--text-primary); font-weight: 600; }

/* Notebook blocks */
.nb-nb-block {
  position: relative;
  margin: 14px 0;
  padding: 2px 0;
  outline: 0;
  border-radius: 4px;
  transition: background 140ms;
}
.nb-nb-block:hover { background: rgba(217,119,87,.025); }
.nb-nb-block:hover .nb-nb-handle { opacity: 1; }

.nb-nb-handle {
  position: absolute; left: -28px; top: 4px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  border-radius: 4px;
  cursor: grab;
  opacity: 0;
  transition: opacity 140ms;
}
.nb-nb-handle:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-nb-handle::before {
  content: '⋮⋮';
  font-size: 10px;
  letter-spacing: -1px;
}

.nb-nb-h2 {
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 22px 0 8px;
}
.nb-nb-h3 {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nb-nb-p {
  font-size: 14.5px; line-height: 1.65;
  color: var(--text-primary);
  margin: 0;
}
.nb-nb-p .ent {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  border: 1px solid var(--accent-primary-border);
  cursor: pointer;
  font-size: 0.96em;
}
.nb-nb-p .ent[data-kind="person"]  { background: rgba(94,106,210,.10); color: #4853A6; border-color: rgba(94,106,210,.22); }
.nb-nb-p .ent[data-kind="event"]   { background: rgba(4,120,87,.08); color: var(--success); border-color: rgba(4,120,87,.22); }
.nb-nb-p .cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  margin: 0 1px 0 2px;
  vertical-align: 1px;
  font-size: 9.5px; font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  cursor: pointer;
  transition: all 120ms;
}
.nb-nb-p .cite:hover { background: var(--accent-primary-tint); color: var(--accent-ink); border-color: var(--accent-primary-border); }

/* Claim blocks */
.nb-nb-claim {
  position: relative;
  display: flex; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 10px;
  margin: 12px 0;
}
.nb-nb-claim::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--success);
  border-radius: 2px;
}
.nb-nb-claim[data-conf="weak"]::before    { background: var(--warning); }
.nb-nb-claim[data-conf="field"]::before   { background: var(--text-faint); }
.nb-nb-claim-mark {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: rgba(4,120,87,.10);
  color: var(--success);
  display: flex; align-items: center; justify-content: center;
}
.nb-nb-claim[data-conf="weak"] .nb-nb-claim-mark    { background: rgba(180,83,9,.10); color: var(--warning); }
.nb-nb-claim[data-conf="field"] .nb-nb-claim-mark   { background: var(--bg-secondary); color: var(--text-faint); }
.nb-nb-claim-body { flex: 1; min-width: 0; }
.nb-nb-claim-text { font-size: 13.5px; color: var(--text-primary); line-height: 1.55; }
.nb-nb-claim-foot {
  margin-top: 6px;
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-faint);
}
.nb-nb-claim-foot .conf {
  text-transform: uppercase; font-weight: 600; letter-spacing: 0.08em;
  color: var(--success);
}
.nb-nb-claim[data-conf="weak"] .nb-nb-claim-foot .conf  { color: var(--warning); }
.nb-nb-claim[data-conf="field"] .nb-nb-claim-foot .conf { color: var(--text-muted); }

/* Card embed */
.nb-nb-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  margin: 12px 0;
  cursor: pointer;
  transition: all 140ms;
}
.nb-nb-card:hover { border-color: var(--accent-primary-border); box-shadow: var(--shadow-sm); }
.nb-nb-card-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.nb-nb-card-h .kind {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.nb-nb-card-name { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.nb-nb-card-attrs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px;
  margin-top: 6px;
}
.nb-nb-card-attrs > div {
  display: flex; gap: 6px; font-size: 11.5px; min-width: 0;
}
.nb-nb-card-attrs .k { color: var(--text-faint); flex-shrink: 0; min-width: 64px; }
.nb-nb-card-attrs .v { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Quote / pull */
.nb-nb-quote {
  border-left: 3px solid var(--accent-primary);
  padding: 4px 14px;
  margin: 14px 0;
  font-size: 14.5px;
  color: var(--text-secondary);
  font-style: italic;
}
.nb-nb-quote .att {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: normal;
  font-family: var(--font-mono);
}

/* Bullet list */
.nb-nb-ul {
  margin: 8px 0;
  padding: 0 0 0 4px;
  list-style: none;
}
.nb-nb-ul li {
  position: relative;
  padding: 3px 0 3px 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
}
.nb-nb-ul li::before {
  content: '';
  position: absolute; left: 5px; top: 11px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-faint);
}

/* ─── SLASH MENU ─── */
.nb-slash {
  position: absolute;
  z-index: 30;
  width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-size: 12.5px;
}
.nb-slash-h {
  padding: 8px 12px 6px;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-subtle);
}
.nb-slash-list { max-height: 320px; overflow-y: auto; padding: 4px; }
.nb-slash-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.nb-slash-item[data-active="true"] { background: var(--accent-primary-tint); }
.nb-slash-item .ico {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.nb-slash-item[data-active="true"] .ico {
  background: var(--bg-surface);
  border-color: var(--accent-primary-border);
  color: var(--accent-ink);
}
.nb-slash-item .t { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.nb-slash-item .s { font-size: 11px; color: var(--text-muted); }
.nb-slash-item .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px; color: var(--text-faint);
  padding: 1px 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
}

/* ─── SELECTION MENU ─── */
.nb-selmenu {
  position: absolute; z-index: 30;
  background: var(--text-primary);
  color: #FFF;
  border-radius: 8px;
  display: flex;
  padding: 3px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
html[data-theme="dark"] .nb-selmenu { background: #fff; color: #0F1419; }
.nb-selmenu button {
  background: transparent; border: 0;
  color: inherit;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 9px;
  border-radius: 5px;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer;
  transition: background 120ms;
}
.nb-selmenu button:hover { background: rgba(255,255,255,.14); }
html[data-theme="dark"] .nb-selmenu button:hover { background: rgba(0,0,0,.06); }
.nb-selmenu .sep { width: 1px; background: rgba(255,255,255,.18); margin: 4px 2px; }
html[data-theme="dark"] .nb-selmenu .sep { background: rgba(0,0,0,.10); }

/* ─── INLINE RUN TRACE ─── */
.nb-inline-trace {
  margin: 16px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-surface);
  overflow: hidden;
}
.nb-inline-trace-h {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.nb-inline-trace-h:hover { background: var(--bg-secondary); }
.nb-inline-trace-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.nb-inline-trace-h .lbl { font-weight: 600; color: var(--text-primary); }
.nb-inline-trace-h .sub { color: var(--text-muted); }
.nb-inline-trace-h .chev { margin-left: auto; color: var(--text-faint); transition: transform 160ms; }
.nb-inline-trace[data-open="true"] .nb-inline-trace-h .chev { transform: rotate(180deg); }

.nb-inline-trace-body {
  display: none;
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border-subtle);
}
.nb-inline-trace[data-open="true"] .nb-inline-trace-body { display: block; }

.nb-inline-trace-step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-subtle);
}
.nb-inline-trace-step:last-child { border-bottom: 0; }
.nb-inline-trace-step .marker {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 4px;
}
.nb-inline-trace-step .marker .pip {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 1px var(--border-default);
}
.nb-inline-trace-step[data-state="ok"] .marker .pip { background: var(--success); box-shadow: 0 0 0 1px rgba(4,120,87,.3); }
.nb-inline-trace-step[data-state="warn"] .marker .pip { background: var(--warning); }
.nb-inline-trace-step .b { min-width: 0; }
.nb-inline-trace-step .label {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}
.nb-inline-trace-step .label code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.nb-inline-trace-step .meta {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.nb-inline-trace-step .ev {
  margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.nb-inline-trace-step .ev .src {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* ─── RIGHT INSPECTOR / TRACE PANEL ─── */
.nb-rdetail-right {
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.nb-insp-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 8px;
  flex-shrink: 0;
}
.nb-insp-tabs button {
  flex: 1;
  padding: 10px 6px;
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: all 140ms;
}
.nb-insp-tabs button:hover { color: var(--text-primary); }
.nb-insp-tabs button[data-active="true"] {
  color: var(--accent-ink);
  font-weight: 600;
  border-bottom-color: var(--accent-primary);
}
.nb-insp-tabs .pill {
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-muted);
}
.nb-insp-tabs button[data-active="true"] .pill {
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
}
.nb-insp-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.nb-insp-body section + section { margin-top: 18px; }
.nb-insp-h {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}

/* Always-on live agent feed */
.nb-feed {
  display: flex; flex-direction: column; gap: 6px;
}
.nb-feed-event {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-surface);
  font-size: 11.5px;
}
.nb-feed-event[data-state="active"] {
  border-color: var(--accent-primary-border);
  background: var(--accent-primary-tint);
}
.nb-feed-event .pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-top: 4px;
}
.nb-feed-event[data-state="active"] .pip {
  background: var(--accent-primary);
  animation: nb-pulse 1.4s infinite;
}
.nb-feed-event[data-state="warn"] .pip { background: var(--warning); }
@keyframes nb-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-primary-tint); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}
.nb-feed-event .lbl {
  font-size: 11.5px;
  color: var(--text-primary); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-feed-event .lbl code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent-ink);
}
.nb-feed-event .meta {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.nb-feed-event .age {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-faint);
}

/* Proposed changes */
.nb-proposal {
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  position: relative;
}
.nb-proposal::before {
  content: '';
  position: absolute;
  top: 10px; bottom: 10px; left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--indigo);
}
.nb-proposal[data-kind="add"]::before    { background: var(--success); }
.nb-proposal[data-kind="remove"]::before { background: var(--danger); }
.nb-proposal[data-kind="link"]::before   { background: var(--indigo); }
.nb-proposal[data-kind="entity"]::before { background: var(--accent-primary); }
.nb-proposal-h {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px;
  text-transform: uppercase; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.nb-proposal-h .kind {
  padding: 1px 5px;
  font-size: 9.5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  background: var(--bg-secondary);
}
.nb-proposal[data-kind="add"] .nb-proposal-h .kind     { background: rgba(4,120,87,.10); color: var(--success); }
.nb-proposal[data-kind="remove"] .nb-proposal-h .kind  { background: rgba(220,38,38,.10); color: var(--danger); }
.nb-proposal[data-kind="link"] .nb-proposal-h .kind    { background: rgba(94,106,210,.10); color: #4853A6; }
.nb-proposal[data-kind="entity"] .nb-proposal-h .kind  { background: var(--accent-primary-tint); color: var(--accent-ink); }
.nb-proposal-summary { font-size: 12px; color: var(--text-primary); line-height: 1.45; font-weight: 500; }
.nb-proposal-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  line-height: 1.5;
}
.nb-proposal-actions {
  display: flex; gap: 4px;
  margin-top: 8px;
}
.nb-proposal-actions button {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms;
}
.nb-proposal-actions button:hover { background: var(--bg-tertiary); }
.nb-proposal-actions .yes {
  background: var(--accent-primary);
  color: #FFFAF8;
  border-color: var(--accent-primary);
}
.nb-proposal-actions .yes:hover { filter: brightness(1.04); }

.nb-proposal-bulk {
  display: flex; gap: 6px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  align-items: center;
}
.nb-proposal-bulk .lbl { flex: 1; font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.nb-proposal-bulk button {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 5px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}
.nb-proposal-bulk .yes-all {
  background: var(--accent-primary);
  color: #FFFAF8;
  border-color: var(--accent-primary);
  font-weight: 600;
}

/* Notion variant: floating drawer for trace+proposals */
.nb-floating-drawer {
  position: absolute;
  top: 80px;
  right: 24px;
  width: 320px;
  max-height: calc(100vh - 200px);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  z-index: 8;
  overflow: hidden;
}
.nb-floating-drawer-h {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
}
.nb-floating-drawer-h .pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: nb-pulse 1.4s infinite;
}
.nb-floating-drawer-h .x {
  margin-left: auto;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
}
.nb-floating-drawer-h .x:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* Notion floating launcher */
.nb-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 6;
}
.nb-fab button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 160ms;
}
.nb-fab button:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.nb-fab .count {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  background: var(--accent-primary);
  color: #FFFAF8;
  border-radius: 999px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT EXPLORER (design canvas with three variants side-by-side)
   ═══════════════════════════════════════════════════════════════════════════ */
.nb-le {
  margin: -28px -28px;
  height: calc(100vh - 64px);
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(45deg, rgba(15,23,42,.018) 0 1px, transparent 1px 18px),
    var(--bg-secondary);
}
.nb-le-toolbar {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  padding: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 4;
}
.nb-le-toolbar button {
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 140ms;
}
.nb-le-toolbar button:hover { color: var(--text-primary); }
.nb-le-toolbar button[data-active="true"] {
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
}
.nb-le-stage {
  display: flex; gap: 36px;
  padding: 70px 36px 36px;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}
.nb-le-board {
  flex: 0 0 auto;
  width: 1100px;
  height: 100%;
  display: flex; flex-direction: column;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  background: var(--bg-app);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.nb-le-board .nb-rdetail {
  height: 100%;
  margin: 0;
  border-radius: 0;
}
.nb-le-board-label {
  padding: 10px 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 8px;
}
.nb-le-board-label .num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #FFFAF8;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WORKSPACE MEMORY surface
   ═══════════════════════════════════════════════════════════════════════════ */
.nb-mem {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}
.nb-mem-side {
  position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 2px;
}
.nb-mem-side button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  text-align: left;
  background: transparent; border: 0;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms;
}
.nb-mem-side button:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-mem-side button[data-active="true"] {
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  font-weight: 600;
}
.nb-mem-side button .count {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-faint);
}
.nb-mem-side .grp {
  font-size: 10px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 12px 4px;
}
.nb-mem-side .grp:first-child { padding-top: 0; }

.nb-mem-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 140ms;
}
.nb-mem-row:hover { border-color: var(--border-default); }
.nb-mem-row .av {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-family: var(--font-mono);
  flex-shrink: 0;
}
.nb-mem-row .nm { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.nb-mem-row .sub {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 2px;
}
.nb-mem-row .sub code {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--bg-secondary);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.nb-mem-row .actions { display: flex; gap: 4px; }
.nb-mem-row .actions button {
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 5px;
  cursor: pointer;
}
.nb-mem-row .actions button:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nb-mem-h2 {
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--text-primary);
}
.nb-mem-sub {
  font-size: 12.5px; color: var(--text-muted);
  margin: 0 0 14px;
}


/* ═══════════════════════════════════════════════════════════════════
   PROPOSED CHANGES — review queue with bulk accept/reject
   ═══════════════════════════════════════════════════════════════════ */

.nb-pc {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 980px) {
  .nb-pc { grid-template-columns: 1fr; }
}

/* ─── Sidebar ─── */
.nb-pc-side {
  position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
}
.nb-pc-side .grp {
  font-size: 10px; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 12px 4px;
}
.nb-pc-side .grp:first-child { padding-top: 0; }
.nb-pc-side button {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12.5px; color: var(--text-secondary);
  text-align: left; cursor: pointer;
  transition: all 120ms;
  font-family: inherit;
}
.nb-pc-side button .b { flex: 1; min-width: 0; }
.nb-pc-side button .t {
  font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-pc-side button .s {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-pc-side button:hover { background: var(--bg-secondary); }
.nb-pc-side button[data-active="true"] {
  background: var(--accent-primary-tint);
  border-color: var(--accent-primary-border);
}
.nb-pc-side button[data-active="true"] .t { color: var(--accent-ink); }
.nb-pc-side button .count {
  margin-left: auto;
  font-size: 10.5px; font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-faint);
  background: var(--bg-secondary);
  padding: 2px 6px; border-radius: 4px;
  flex-shrink: 0;
}
.nb-pc-side button[data-active="true"] .count {
  color: var(--accent-primary); background: var(--bg-surface);
}
.nb-pc-risk-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
}
.nb-pc-risk-dot.risk-low    { background: #2F7D5C; }
.nb-pc-risk-dot.risk-medium { background: #B45309; }
.nb-pc-risk-dot.risk-high   { background: #B23A48; }

/* ─── Main pane ─── */
.nb-pc-main {
  position: relative;
  min-height: 320px;
}

/* Filter chip strip */
.nb-pc-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 14px;
}
.nb-pc-chips button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms;
}
.nb-pc-chips button:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-pc-chips button[data-active="true"] {
  background: var(--accent-primary-tint);
  color: var(--accent-ink);
  border-color: var(--accent-primary-border);
  font-weight: 600;
}
.nb-pc-chips button .n {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--text-faint);
  background: var(--bg-secondary);
  padding: 1px 5px; border-radius: 4px;
}
.nb-pc-chips button[data-active="true"] .n {
  background: var(--bg-surface); color: var(--accent-primary);
}
.nb-pc-selall {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms;
}
.nb-pc-selall:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* Universal checkbox */
.nb-pc-check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 120ms;
  color: #fff;
}
.nb-pc-check:hover { border-color: var(--accent-primary); }
.nb-pc-check.on {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ─── List ─── */
.nb-pc-list {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 80px; /* room for bulk bar */
}
.nb-pc-empty {
  display: flex; align-items: center; gap: 14px;
  padding: 28px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--success);
}

/* ─── Single change row ─── */
.nb-pc-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px 14px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: all 140ms;
}
.nb-pc-row:hover { border-color: var(--border-default); }
.nb-pc-row[data-checked="true"] {
  border-color: var(--accent-primary-border);
  background: var(--accent-primary-tint);
}
.nb-pc-row > .nb-pc-check {
  margin-top: 2px;
  border: 0;
  padding: 0;
  background: transparent;
}
.nb-pc-row > .nb-pc-check:not(.on) {
  border: 1.5px solid var(--border-default);
  background: var(--bg-surface);
}

.nb-pc-row .head {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  grid-column: 2;
}
.nb-pc-row .head .title {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.nb-pc-row .head .conf {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 6px; border-radius: 4px;
}
.nb-pc-row .head .chev {
  color: var(--text-faint);
  transition: transform 200ms;
}
.nb-pc-row[data-expanded="true"] .head .chev { transform: rotate(180deg); }

.nb-pc-row .why {
  grid-column: 2;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 760px;
}

.nb-pc-row .acts {
  grid-column: 2;
  display: flex; gap: 6px;
}
.nb-pc-row .acts button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms;
}
.nb-pc-row .acts button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.nb-pc-row .acts button[data-primary="true"] {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}
.nb-pc-row .acts button[data-primary="true"]:hover {
  filter: brightness(1.05);
}

/* Kind badge */
.nb-pc-kind {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.nb-pc-kind.kind-purple { background: rgba(94,106,210,.10);  color: #4853A6; }
.nb-pc-kind.kind-amber  { background: rgba(180,83,9,.10);    color: #B45309; }
.nb-pc-kind.kind-teal   { background: rgba(15,118,110,.10);  color: #0F766E; }
.nb-pc-kind.kind-green  { background: rgba(4,120,87,.10);    color: var(--success); }
.nb-pc-kind.kind-red    { background: rgba(220,38,38,.08);   color: var(--danger); }
.nb-pc-kind.kind-blue   { background: rgba(37,99,235,.10);   color: #1D4ED8; }
html[data-theme="dark"] .nb-pc-kind.kind-purple { background: rgba(124,138,250,.18); color: #B5BCFF; }
html[data-theme="dark"] .nb-pc-kind.kind-amber  { background: rgba(217,158,90,.18);  color: #E2B57A; }
html[data-theme="dark"] .nb-pc-kind.kind-teal   { background: rgba(94,201,189,.18);  color: #9DDCD3; }

/* Risk badge */
.nb-pc-risk {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.nb-pc-risk.risk-low    { background: rgba(4,120,87,.10);  color: var(--success); }
.nb-pc-risk.risk-medium { background: rgba(180,83,9,.12);  color: var(--warning); }
.nb-pc-risk.risk-high   { background: rgba(178,58,72,.12); color: var(--danger); }

/* ─── Diff body (expanded) ─── */
.nb-pc-row .diff {
  grid-column: 2;
  padding: 14px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
body[data-texture="on"] .nb-pc-row .diff { background: var(--bg-paper); }
.nb-pc-row .diff .lbl {
  font-size: 9.5px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.diff-row {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  gap: 10px;
  align-items: stretch;
}
.diff-row.diff-stack {
  grid-template-columns: 1fr 1fr;
}
.diff-row.diff-stack .diff-arrow { display: none; }
.diff-arrow {
  align-self: center;
  text-align: center;
  font-size: 16px;
  color: var(--text-faint);
  font-weight: 600;
}
.diff-col {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.diff-col[data-side="before"] .lbl { color: var(--danger); }
.diff-col[data-side="after"]  .lbl { color: var(--success); }

/* Entity card in diff */
.diff-cards { display: flex; flex-direction: column; gap: 6px; }
.nb-pc-ent {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 9px 11px;
}
.nb-pc-ent[data-merged="true"] {
  border: 1px solid var(--success);
  background: rgba(4,120,87,.04);
}
.nb-pc-ent .hd {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 6px;
}
.nb-pc-ent .hd .kind {
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint);
}
.nb-pc-ent .hd .nm {
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
}
.nb-pc-ent .attrs {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11.5px;
}
.nb-pc-ent .attrs > div {
  display: flex; gap: 6px;
}
.nb-pc-ent .attrs .k {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  min-width: 70px;
}
.nb-pc-ent .attrs .v { color: var(--text-secondary); }
.nb-pc-ent .aliases {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}
.nb-pc-ent .aliases code {
  margin-left: 4px;
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--bg-secondary);
  padding: 1px 5px; border-radius: 4px;
  color: var(--text-secondary);
}

/* Claim diff card */
.nb-pc-claim {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
}
.diff-col[data-side="before"] .nb-pc-claim {
  border-color: rgba(178,58,72,.30);
  background: rgba(178,58,72,.03);
}
.diff-col[data-side="after"] .nb-pc-claim {
  border-color: rgba(4,120,87,.30);
  background: rgba(4,120,87,.03);
}
.nb-pc-claim .t {
  font-size: 12.5px; line-height: 1.5;
  color: var(--text-primary);
}
.nb-pc-claim .m {
  margin-top: 6px;
  display: flex; gap: 6px;
}
.nb-pc-claim .conf {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.nb-pc-claim .s {
  margin-top: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.nb-pc-claim .s .src {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 1px 6px; border-radius: 4px;
}
.nb-pc-claim .s .empty {
  font-style: italic;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* Source attach diff */
.nb-pc-add {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  color: var(--success);
  background: rgba(4,120,87,.06);
  border-left: 3px solid var(--success);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
}

/* Block-level proposed content */
.nb-pc-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--success);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 12.5px; line-height: 1.5;
  color: var(--text-secondary);
}
.nb-pc-block[data-strike="true"] {
  border-left-color: var(--danger);
  text-decoration: line-through;
  color: var(--text-faint);
}
.nb-pc-block .hd {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.nb-pc-block ul {
  margin: 0; padding-left: 18px;
  display: flex; flex-direction: column; gap: 3px;
}
.nb-pc-block p { margin: 0; }

/* Field edit diff */
.nb-pc-fielddiff {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.nb-pc-fielddiff .before {
  text-decoration: line-through;
  color: var(--danger);
}
.nb-pc-fielddiff .arr {
  color: var(--text-faint);
  font-weight: 600;
}
.nb-pc-fielddiff .after {
  color: var(--success);
  font-weight: 700;
}

/* Evidence strip */
.nb-pc-evidence {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
}
.nb-pc-evidence .ev {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.nb-pc-evidence .ev .src {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 7px; border-radius: 4px;
}

/* ─── Bulk action bar (sticky bottom) ─── */
.nb-pc-bulk {
  position: sticky;
  bottom: 16px;
  margin-top: 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-md), 0 4px 24px -8px rgba(15,23,42,.18);
  backdrop-filter: blur(8px);
  animation: nb-pc-bulk-in 200ms var(--ease-out-expo);
  z-index: 5;
}
@keyframes nb-pc-bulk-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nb-pc-bulk .cnt {
  font-size: 12.5px; font-weight: 700;
  color: var(--text-primary);
}
.nb-pc-bulk .sep {
  width: 1px; height: 16px;
  background: var(--border-subtle);
}
.nb-pc-bulk .hint {
  font-size: 11.5px;
  color: var(--text-muted);
}
.nb-pc-bulk-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms;
}
.nb-pc-bulk-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.nb-pc-bulk-btn[data-flavor="reject"] {
  color: var(--danger);
  border-color: rgba(178,58,72,.25);
}
.nb-pc-bulk-btn[data-flavor="reject"]:hover {
  background: rgba(178,58,72,.08);
  color: var(--danger);
  border-color: var(--danger);
}
.nb-pc-bulk-btn[data-flavor="accept"] {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.nb-pc-bulk-btn[data-flavor="accept"]:hover {
  filter: brightness(1.05);
}


/* ═══════════════════════════════════════════════════════════════════
   ChatStream — continuous research conversation
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Reading-width toggle (in surface headers) ─── */
.nb-width-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 2px;
  gap: 1px;
}
.nb-width-toggle button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 7px;
  border: 0; background: transparent;
  font-family: inherit;
  font-size: 11px; font-weight: 500;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
  transition: all 120ms;
}
.nb-width-toggle button:hover { color: var(--text-primary); }
.nb-width-toggle button[data-active="true"] {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.nb-width-toggle button .lbl { font-size: 11px; }

/* ─── Narrow reading mode for chat: cap + center the center column ─── */
body[data-chat-width="narrow"] .nb-stream-inner {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
body[data-chat-width="narrow"] .nb-stream-savebar,
body[data-chat-width="narrow"] .nb-stream-composer-inner {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
body[data-chat-width="narrow"] .nb-stream-header {
  /* keep header full bleed but cap the meta block visually */
}

/* ─── Narrow reading mode for report detail ─── */
body[data-report-width="narrow"] .nb-rdetail-center .nb-nb-page,
body[data-report-width="narrow"] .nb-rdetail-center .nb-rdetail-notebook {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Chat shell — seamless on the page (no card frame), inside .nb-shell.
   Single 760px reading column. Rails are absent in Focus mode and slide in
   as floating overlays when toggled — NEVER push the column. ─── */
.nb-stream-root {
  position: relative;
  height: calc(100vh - 57px - 96px - 88px);
  min-height: 560px;
  display: flex;
  flex-direction: column;
  background: transparent;
  margin: -8px 0 0;
}

/* Default (Focus): rails are gone. */
.nb-stream-root .nb-chat-sidebar,
.nb-stream-root .nb-rail {
  overflow: hidden;
  border: 0;
}
.nb-stream-root:not([data-left="peek"]):not([data-left="expanded"]) .nb-chat-sidebar { display: none; }
.nb-stream-root:not([data-right="peek"]):not([data-right="expanded"]):not([data-right="docked"]) .nb-rail { display: none; }

/* Rails as overlays when opened — float above the stage, never push it */
.nb-stream-root[data-left="peek"]      .nb-chat-sidebar,
.nb-stream-root[data-left="expanded"]  .nb-chat-sidebar {
  position: absolute; top: 0; bottom: 0; left: 0;
  z-index: 5;
  box-shadow: 8px 0 24px rgba(15,23,42,.10);
  background: var(--bg-app);
  border-right: 1px solid var(--border-subtle);
  border-radius: 0 12px 12px 0;
  overflow: auto;
}
.nb-stream-root[data-left="peek"]      .nb-chat-sidebar { width: 280px; }
.nb-stream-root[data-left="expanded"]  .nb-chat-sidebar { width: 320px; }

.nb-stream-root[data-right="peek"]     .nb-rail,
.nb-stream-root[data-right="expanded"] .nb-rail,
.nb-stream-root[data-right="docked"]   .nb-rail {
  position: absolute; top: 0; bottom: 0; right: 0;
  z-index: 5;
  box-shadow: -8px 0 24px rgba(15,23,42,.10);
  background: var(--bg-app);
  border-left: 1px solid var(--border-subtle);
  border-radius: 12px 0 0 12px;
  overflow: auto;
}
/* Docked = permanent split. Reads as part of the workspace, not a transient
   overlay — flatter, sharper edge, no drop shadow, no inner corner curve. */
.nb-stream-root[data-right="docked"]   .nb-rail {
  box-shadow: none;
  border-left: 1px solid var(--border-default);
  border-radius: 0;
  background: var(--bg-secondary);
}
/* Reserve canvas space for the docked rail so content centers correctly */
.nb-stream-root[data-right="docked"]   .nb-stream-main { padding-right: 320px; }
.nb-stream-root[data-right="peek"]     .nb-rail { width: 320px; }
.nb-stream-root[data-right="docked"]   .nb-rail { width: 320px; }
.nb-stream-root[data-right="expanded"] .nb-rail { width: 360px; }

@media (max-width: 980px) {
  .nb-stream-root { grid-template-columns: 1fr; height: auto; min-height: 70vh; }
}

/* Lock stream + composer to a single 760px reading column inside the frame */
.nb-stream-inner,
.nb-stream-composer-inner,
.nb-stream-savebar { max-width: 760px; margin-left: auto; margin-right: auto; }

/* Rail toggles — minimal icon buttons inline in the chat header */
.nb-rail-toggle {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.nb-rail-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.nb-rail-toggle[data-active="true"] {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Scrim behind opened rails */
.nb-stream-scrim {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.18);
  z-index: 4;
  animation: nb-scrim-in .14s ease-out;
}
@keyframes nb-scrim-in { from { opacity: 0; } to { opacity: 1; } }

.nb-stream-main {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  min-height: 0;
  flex: 1;
  border: 0;
  background: transparent;
}

/* Header */
.nb-stream-header {
  padding: 10px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 10px;
  background: transparent;
}
html[data-theme="dark"] .nb-stream-header { background: transparent; }
.nb-stream-header h2 {
  font-size: 13.5px; font-weight: 700;
  letter-spacing: -0.008em;
  color: var(--text-primary);
  margin: 0 0 2px;
}
.nb-stream-header-meta {
  font-size: 10.5px; color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex; gap: 5px; flex-wrap: wrap;
}
.nb-stream-fresh { color: var(--success); font-weight: 600; }
.nb-stream-fresh[data-state="stale"] { color: var(--warning); }

/* Save bar */
.nb-stream-savebar {
  padding: 7px 22px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-secondary);
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
}
.nb-stream-savebar-icon {
  color: var(--accent-primary); font-size: 10px;
  animation: nb-pulse 2s ease-in-out infinite;
}
@keyframes nb-pulse { 0%,100%{opacity:.4;} 50%{opacity:1;} }
.nb-stream-savebar strong { color: var(--text-primary); font-weight: 600; }
.nb-stream-savebar .dim { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; }
.nb-stream-savebar button {
  border: 1px solid var(--accent-primary-border);
  background: var(--bg-surface);
  color: var(--accent-ink);
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px;
  cursor: pointer;
  transition: all 140ms;
}
.nb-stream-savebar button:hover { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

/* Scroll area */
.nb-stream-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-app);
  min-height: 0;
}
.nb-stream-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 28px 32px;
  display: flex; flex-direction: column; gap: 28px;
}

/* Composer */
.nb-stream-composer {
  padding: 10px 22px 14px;
  background: transparent;
  border-top: 1px solid var(--border-subtle);
}
html[data-theme="dark"] .nb-stream-composer { background: transparent; }
.nb-stream-composer-inner {
  max-width: 760px; margin: 0 auto;
}

.nb-pin-ctx {
  font-size: 10.5px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  align-self: center;
  margin-right: 4px;
}
.nb-pin-add {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px;
  border: 1px dashed var(--border-default);
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 500;
  cursor: pointer;
}
.nb-pin-add:hover { background: var(--bg-secondary); color: var(--text-primary); }

.nb-prompt-chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  margin-right: 5px;
  transition: all 140ms;
}
.nb-prompt-chip:hover { color: var(--text-primary); border-color: var(--border-default); }

/* ─── Composer card — premium minimal unified surface ─────────────────── */
.nb-composer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 12px 10px;
  display: flex; flex-direction: column;
  transition: border-color 160ms, box-shadow 160ms;
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
}
.nb-composer-card:focus-within {
  border-color: var(--border-default);
  box-shadow: 0 0 0 3px var(--accent-primary-tint), 0 1px 0 rgba(15,23,42,.02);
}

.nb-composer-pins {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 2px 4px 8px;
  border-bottom: 1px dashed var(--border-subtle);
  margin: 0 0 8px;
}
.nb-composer-pins .nb-pin {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 4px 2px 8px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.nb-composer-pins .nb-pin .typ {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.nb-composer-pins .nb-pin button {
  width: 16px; height: 16px;
  border: 0; background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}
.nb-composer-pins .nb-pin button:hover { background: var(--bg-secondary); color: var(--text-primary); }

.nb-composer-pins .nb-pin-add {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  background: transparent;
  border: 1px dashed var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
}
.nb-composer-pins .nb-pin-add:hover { color: var(--text-primary); border-color: var(--border-default); }

.nb-composer-input {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  resize: none;
  min-height: 28px;
  max-height: 220px;
  padding: 4px 4px 6px;
}
.nb-composer-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.nb-composer-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}
.nb-composer-tools {
  display: flex; align-items: center; gap: 2px;
  min-width: 0;
  flex-wrap: nowrap;
}
.nb-composer-tools button {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}
.nb-composer-tools button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.nb-composer-divider {
  width: 1px; height: 16px;
  background: var(--border-subtle);
  margin: 0 6px;
}

.nb-composer-send-group {
  display: inline-flex; align-items: center; gap: 10px;
}
.nb-composer-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.005em;
}
.nb-composer-send {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0;
  background: var(--text-primary);
  color: var(--bg-surface);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, transform 100ms;
}
.nb-composer-send:hover { transform: translateY(-1px); }
.nb-composer-send:active { transform: translateY(0); }
.nb-composer-send:disabled {
  background: var(--bg-tertiary);
  color: var(--text-faint);
  cursor: not-allowed;
  transform: none;
}

.nb-composer-suggest {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 8px 4px 0;
}
.nb-composer-suggest .nb-prompt-chip { margin-right: 0; }

/* ─── Model picker (composer dropdown) ───────────────────────────────── */
.nb-model-picker { position: relative; display: inline-flex; }
.nb-model-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 8px 0 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background 120ms;
}
.nb-model-trigger:hover { border-color: var(--border-default); color: var(--text-primary); background: var(--bg-primary); }
.nb-model-trigger .nm { font-weight: 500; }
.nb-model-trigger .dot,
.nb-model-menu .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.nb-model-trigger .dot[data-provider="anthropic"],
.nb-model-menu .dot[data-provider="anthropic"] { background: #C96442; }
.nb-model-trigger .dot[data-provider="openai"],
.nb-model-menu .dot[data-provider="openai"]    { background: #10A37F; }
.nb-model-trigger .dot[data-provider="google"],
.nb-model-menu .dot[data-provider="google"]    { background: #4285F4; }
.nb-model-trigger .dot[data-provider="xai"],
.nb-model-menu .dot[data-provider="xai"]       { background: #1f1f1f; }
html[data-theme="dark"] .nb-model-trigger .dot[data-provider="xai"],
html[data-theme="dark"] .nb-model-menu .dot[data-provider="xai"] { background: #e5e5e5; }
.nb-model-trigger .dot[data-provider="groq"],
.nb-model-menu .dot[data-provider="groq"]      { background: #F55036; }

.nb-model-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 460px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: 0 16px 40px -12px rgba(15,23,42,0.22), 0 4px 12px -4px rgba(15,23,42,0.10);
  z-index: 100;
  font-family: var(--font-sans);
  animation: nb-model-pop 140ms ease-out;
}
@keyframes nb-model-pop {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nb-model-menu .hd {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 2px;
}
.nb-model-menu .hd strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.nb-model-menu .hd span {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.nb-model-menu .grp { padding: 6px 0; }
.nb-model-menu .grp + .grp { border-top: 1px solid var(--border-subtle); }
.nb-model-menu .grp-hd {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px 4px;
}
.nb-model-menu .grp-hd .prov {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.nb-model-menu .grp-hd .tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 1px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}
.nb-model-menu .row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background 100ms;
  position: relative;
}
.nb-model-menu .row:hover { background: var(--bg-secondary); }
.nb-model-menu .row[data-active="true"] { background: var(--bg-secondary); }
.nb-model-menu .row[data-active="true"]::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--accent-primary);
  border-radius: 0 2px 2px 0;
}
.nb-model-menu .row-l { flex: 1; min-width: 0; }
.nb-model-menu .row .nm {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.nb-model-menu .row .spec {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.nb-model-menu .row .cost {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: right;
}
.nb-model-menu .row .cost .unit {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: -1px;
}
.nb-model-menu .row svg { color: var(--accent-primary); flex-shrink: 0; }
.nb-model-menu .ft {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  border-radius: 0 0 10px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}
.nb-model-menu .ft .lk {
  background: transparent; border: 0; padding: 0;
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
}
.nb-model-menu .ft .lk:hover { text-decoration: underline; }

/* Header actions wrapper (renders as nested buttons; reset cosmetics) */
.nb-stream-header > .nb-chat-header-actions {
  border: 0; background: transparent; padding: 0; cursor: default;
}

/* ─── Run bar (above each agent turn) ─── */
.nb-runbar {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}
.nb-runbar .ic {
  font-size: 12px;
  color: var(--accent-primary);
}
.nb-runbar .sum strong { color: var(--text-primary); font-weight: 600; }
.nb-runbar .dt { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; }
.nb-runbar .bdg {
  display: inline-flex; gap: 8px;
  margin-left: auto;
  padding-left: 10px;
  border-left: 1px solid var(--border-default);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.nb-runbar[data-kind="research"] { background: rgba(94,106,210,.08); border-color: rgba(94,106,210,.20); }
.nb-runbar[data-kind="research"] .ic { color: var(--indigo); }
.nb-runbar[data-kind="capture"]  { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.20); }
.nb-runbar[data-kind="capture"]  .ic { color: var(--success); }

/* ─── Compact reasoning trace (open/closed) ─── */
.nb-trace2 {
  margin: 4px 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-secondary);
}
.nb-trace2-head {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 0; background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-secondary);
  text-align: left;
}
.nb-trace2-head .caret { transition: transform 160ms; color: var(--text-faint); flex-shrink: 0; }
.nb-trace2-head[data-open="true"] .caret { transform: rotate(90deg); }
.nb-trace2-head .dim {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-faint);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nb-trace2-list {
  list-style: none;
  margin: 0; padding: 4px 12px 10px;
  font-size: 11.5px; color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
}
.nb-trace2-list li {
  display: grid; grid-template-columns: 64px 1fr auto;
  gap: 10px; align-items: baseline;
  padding: 5px 0;
}
.nb-trace2-list .step {
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent-primary);
  background: var(--accent-primary-tint);
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
}
.nb-trace2-list .step[data-step="mem"]     { color: var(--indigo);  background: rgba(94,106,210,.10); }
.nb-trace2-list .step[data-step="cache"]   { color: var(--success); background: rgba(16,185,129,.10); }
.nb-trace2-list .step[data-step="live"]    { color: var(--warning); background: rgba(180,83,9,.10);   }
.nb-trace2-list .step[data-step="extract"] { color: var(--accent-primary); }
.nb-trace2-list .step[data-step="compose"] { color: var(--text-secondary); background: var(--bg-tertiary); }
.nb-trace2-list .hits {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint);
}

/* ─── Block-level prose helpers ─── */
.nb-block-h {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 6px;
}
.nb-block-p {
  font-size: 14px; line-height: 1.65;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.nb-block-list {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 14px; line-height: 1.65;
  color: var(--text-primary);
}
.nb-block-list li { margin-bottom: 5px; }

/* ─── Entity pill (inline in prose) ─── */
.nb-epill {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 1px 7px 1px 6px;
  margin: 0 1px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 5px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  vertical-align: baseline;
  transition: all 140ms;
  line-height: 1.45;
}
.nb-epill:hover {
  border-color: var(--border-default);
  background: var(--bg-secondary);
  transform: translateY(-1px);
}
.nb-epill .d {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  align-self: center;
}
.nb-epill .lbl { font-weight: 600; }
.nb-epill .sub {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-weight: 400;
}
.nb-epill[data-kind="company"] .d { background: var(--indigo); }
.nb-epill[data-kind="company"]:hover { box-shadow: inset 0 0 0 1px var(--indigo); }
.nb-epill[data-kind="person"]  .d { background: #0EA5E9; }
.nb-epill[data-kind="person"]:hover  { box-shadow: inset 0 0 0 1px #0EA5E9; }
.nb-epill[data-kind="theme"]   .d { background: var(--accent-primary); }
.nb-epill[data-kind="theme"]:hover   { box-shadow: inset 0 0 0 1px var(--accent-primary); }
.nb-epill[data-kind="event"]   .d { background: var(--success); }
.nb-epill[data-kind="event"]:hover   { box-shadow: inset 0 0 0 1px var(--success); }

/* ─── Embedded entity card (inline in agent prose) ─── */
.nb-embed-card {
  margin: 14px 0;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
}
.nb-embed-card[data-kind="company"] { border-left: 3px solid var(--indigo); }
.nb-embed-card[data-kind="person"]  { border-left: 3px solid #0EA5E9; }
.nb-embed-card[data-kind="theme"]   { border-left: 3px solid var(--accent-primary); }
.nb-embed-card[data-kind="event"]   { border-left: 3px solid var(--success); }
.nb-embed-head {
  display: flex; align-items: center; gap: 10px;
}
.nb-embed-name {
  font-size: 14.5px; font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-primary);
}
.nb-embed-tagline {
  font-size: 11.5px; color: var(--text-muted);
}
.nb-embed-meta {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.nb-embed-summary {
  font-size: 13px; line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}
.nb-embed-rels {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}
.nb-embed-actions {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}
.nb-embed-actions button {
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px; font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 140ms;
}
.nb-embed-actions button:first-child {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.nb-embed-actions button:first-child:hover { background: var(--accent-primary-hover); }
.nb-embed-actions button:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ─── Run-update chips (after answer) ─── */
.nb-runups {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
.nb-runup {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.nb-runup .ic {
  width: 16px; flex-shrink: 0;
  font-size: 11px;
  color: var(--accent-primary);
  text-align: center;
}
.nb-runup[data-kind="graph"]    .ic { color: var(--indigo); }
.nb-runup[data-kind="notebook"] .ic { color: var(--success); }
.nb-runup[data-kind="followup"] .ic { color: var(--accent-primary); }
.nb-runup .lbl strong { color: var(--text-primary); font-weight: 600; }
.nb-runup .lbl .dim { color: var(--text-faint); font-family: var(--font-mono); font-size: 10.5px; }

/* ─── Confirm match card ─── */
.nb-confirm {
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed var(--accent-primary-border);
  background: var(--accent-primary-tint);
  border-radius: 8px;
}
.nb-confirm .hd {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-primary);
  margin-bottom: 8px;
}
.nb-confirm .d {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-primary);
}
.nb-confirm .conf {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  color: var(--warning);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.nb-confirm .actions {
  display: flex; gap: 6px;
}
.nb-confirm .actions button {
  padding: 5px 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
.nb-confirm .actions button.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* ─── Source chip — extras (cached / live badges) ─── */
.nb-src-chip .badge {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 3px;
}
.nb-src-chip .badge.live { background: rgba(180,83,9,.12); color: var(--warning); }

/* ─── Sources strip wrapper ─── */
.nb-turn-sources {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  align-items: center;
}
.nb-turn-sources .ttl {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}

/* ─── Thinking pane (during agent response) ─── */
.nb-thinking2 {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-top: 4px;
  font-family: var(--font-sans);
}
.nb-thinking2-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  color: var(--text-faint);
  transition: color 200ms;
}
.nb-thinking2-step .d {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-default);
  flex-shrink: 0;
}
.nb-thinking2-step .step {
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint);
  width: 56px;
}
.nb-thinking2-step[data-state="active"] {
  color: var(--text-primary);
}
.nb-thinking2-step[data-state="active"] .d {
  background: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-tint);
}
.nb-thinking2-step[data-state="active"] .step { color: var(--accent-primary); }
.nb-thinking2-step[data-state="done"] {
  color: var(--text-secondary);
}
.nb-thinking2-step[data-state="done"] .d { background: var(--success); }
.nb-thinking2-step[data-state="done"] .step { color: var(--success); }

/* ═══════════════════════════════════════════════════════════════════
   Right rail
   ═══════════════════════════════════════════════════════════════════ */

.nb-rail {
  display: flex; flex-direction: column;
  background: var(--bg-app);
  border-left: 1px solid var(--border-subtle);
  min-width: 0;
  overflow: hidden;
}
.nb-rail-tabs {
  display: flex; gap: 0;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-x: auto;
  flex-shrink: 0;
}
.nb-rail-tab {
  padding: 6px 10px;
  border: 0; background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px; font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 140ms;
}
.nb-rail-tab:hover { color: var(--text-primary); background: var(--bg-secondary); }
.nb-rail-tab[data-active="true"] {
  color: var(--text-primary);
  background: var(--bg-secondary);
  font-weight: 600;
}
.nb-rail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.nb-rail-empty {
  padding: 32px 12px;
  font-size: 12px; color: var(--text-faint);
  text-align: center;
  line-height: 1.5;
}

.nb-rail-card {
  display: flex; flex-direction: column; gap: 10px;
}

/* Entity card head */
.nb-ec-head {
  display: flex; align-items: center; gap: 10px;
}
.nb-ec-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}
.nb-ec-avatar[data-kind="company"] { background: var(--indigo); }
.nb-ec-avatar[data-kind="person"]  { background: #0EA5E9; }
.nb-ec-avatar[data-kind="theme"]   { background: var(--accent-primary); }
.nb-ec-avatar[data-kind="event"]   { background: var(--success); }
.nb-ec-name {
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nb-ec-tagline {
  font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nb-ec-kind {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  flex-shrink: 0;
}
.nb-ec-kind[data-kind="company"] { color: var(--indigo); background: rgba(94,106,210,.10); }
.nb-ec-kind[data-kind="person"]  { color: #0EA5E9;       background: rgba(14,165,233,.10); }
.nb-ec-kind[data-kind="theme"]   { color: var(--accent-primary); background: var(--accent-primary-tint); }
.nb-ec-kind[data-kind="event"]   { color: var(--success); background: rgba(16,185,129,.10); }
.nb-ec-meta {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.nb-ec-section {
  display: flex; flex-direction: column; gap: 4px;
}
.nb-ec-h {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--text-muted);
}
.nb-ec-p {
  font-size: 12.5px; line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}
.nb-ec-rels {
  display: flex; flex-direction: column; gap: 4px;
}
.nb-ec-rel {
  display: flex; align-items: baseline; gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 140ms;
}
.nb-ec-rel:hover { border-color: var(--border-default); background: var(--bg-secondary); }
.nb-ec-rel .d {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  align-self: center;
}
.nb-ec-rel .d[data-kind="company"] { background: var(--indigo); }
.nb-ec-rel .d[data-kind="person"]  { background: #0EA5E9; }
.nb-ec-rel .d[data-kind="theme"]   { background: var(--accent-primary); }
.nb-ec-rel .d[data-kind="event"]   { background: var(--success); }
.nb-ec-rel .lbl { font-size: 12px; font-weight: 600; color: var(--text-primary); flex: 1; }
.nb-ec-rel .rel { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }

.nb-ec-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.nb-ec-stats > div {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.nb-ec-stats .n {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
}
.nb-ec-stats .l {
  font-size: 9.5px; color: var(--text-faint);
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.nb-ec-actions {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.nb-ec-btn {
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px; font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: all 140ms;
}
.nb-ec-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nb-ec-btn.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.nb-ec-btn.primary:hover { background: var(--accent-primary-hover); }

/* Graph */
.nb-graph-wrap {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
}
.nb-graph-svg { width: 100%; height: auto; display: block; }
.nb-graph-node:hover circle { stroke: var(--accent-primary); }
.nb-graph-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.nb-graph-legend span {
  display: inline-flex; align-items: center; gap: 4px;
}
.nb-graph-legend .d {
  width: 6px; height: 6px; border-radius: 50%;
}
.nb-graph-legend .d[data-kind="company"] { background: var(--indigo); }
.nb-graph-legend .d[data-kind="person"]  { background: #0EA5E9; }
.nb-graph-legend .d[data-kind="theme"]   { background: var(--accent-primary); }
.nb-graph-legend .d[data-kind="event"]   { background: var(--success); }
.nb-graph-footer {
  font-size: 11px; color: var(--text-faint);
  text-align: center;
  padding-top: 4px;
}
.nb-graph-footer strong { color: var(--text-secondary); }

/* Sources rail */
.nb-rail-srcs {
  display: flex; flex-direction: column; gap: 4px;
}
.nb-rail-src {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.nb-rail-src .n {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  color: var(--accent-primary);
  width: 18px;
}
.nb-rail-src .fav {
  width: 18px; height: 18px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.nb-rail-src .body { flex: 1; min-width: 0; }
.nb-rail-src .ttl {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-rail-src .dom {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--text-faint);
}

/* Threads rail */
.nb-rail-threads {
  display: flex; flex-direction: column; gap: 4px;
}
.nb-rail-thread {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: all 140ms;
}
.nb-rail-thread:hover { background: var(--bg-secondary); border-color: var(--border-default); }
.nb-rail-thread .ttl {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
}
.nb-rail-thread .meta {
  font-size: 10px; color: var(--text-faint);
  font-family: var(--font-mono);
}

/* Report rail */
.nb-rail-report {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}
.nb-rail-report .ttl { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.nb-rail-report .status {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--success);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.nb-rail-report-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 6px 0;
}
.nb-rail-report-stats > div {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 4px;
  background: var(--bg-secondary);
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
}
.nb-rail-report-stats .n {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
}
.nb-rail-report-stats .l {
  font-size: 9px; color: var(--text-faint);
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.05em;
}


/* ═══════════════════════════════════════════════════════════════════
   HOME PULSE — proof that NodeBench memory is compounding.
   Sections: PulseStrip (metrics), TodayIntel (4 lanes), ActiveEvent
   (event corpus + captures), RecentReports (3 cards).
   ─────────────────────────────────────────────────────────────────── */

.nb-home-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 16px;
}
@media (max-width: 1100px) {
  .nb-home-grid { grid-template-columns: 1fr; }
}

.nb-home-block {
  padding: 22px 22px 20px;
  display: flex; flex-direction: column; gap: 18px;
}
.nb-home-block-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.nb-home-block-title {
  margin: 6px 0 0;
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
  text-wrap: balance;
}
.nb-home-block-link {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 8px;
  cursor: pointer; transition: all 140ms;
  white-space: nowrap;
}
.nb-home-block-link:hover { border-color: var(--accent-primary-border); color: var(--accent-ink); background: var(--accent-primary-tint); }

/* ─── Pulse strip ─── */
.nb-pulse {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 22px 20px;
  display: flex; flex-direction: column; gap: 18px;
  position: relative; overflow: hidden;
}
.nb-pulse::before {
  /* warm wash so the pulse feels alive vs the surrounding shell */
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(900px 200px at 12% -10%, rgba(217,119,87,.08), transparent 70%);
  pointer-events: none;
}
.nb-pulse > * { position: relative; }

.nb-pulse-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.nb-pulse-title {
  margin: 6px 0 0;
  font-size: 22px; font-weight: 700; letter-spacing: -0.015em;
  color: var(--text-primary);
  text-wrap: balance;
}
.nb-pulse-sub {
  margin: 4px 0 0;
  font-size: 13px; color: var(--text-muted);
}
.nb-pulse-priv {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.nb-pulse-priv-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(4,120,87,.10);
}

/* Cards layout (default) */
.nb-pulse-cards {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 980px) {
  .nb-pulse-cards { grid-template-columns: 1fr 1fr; }
}
.nb-pulse-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 14px 0;
  display: flex; flex-direction: column; gap: 4px;
  overflow: hidden;
  min-height: 124px;
  transition: border-color 140ms, transform 140ms;
}
.nb-pulse-card:hover { border-color: var(--accent-primary-border); }
.nb-pulse-card[data-hero="true"] {
  background: linear-gradient(180deg, var(--accent-primary-tint), var(--bg-surface) 70%);
  border-color: var(--accent-primary-border);
}
.nb-pulse-card-num {
  font-size: 30px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.nb-pulse-card-num .u {
  font-size: 16px; font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}
.nb-pulse-card[data-hero="true"] .nb-pulse-card-num { color: var(--accent-ink); font-size: 36px; }
.nb-pulse-card[data-hero="true"] .nb-pulse-card-num .u { color: var(--accent-primary); }
.nb-pulse[data-scale="editorial"] .nb-pulse-card-num { font-size: 24px; }
.nb-pulse[data-scale="editorial"] .nb-pulse-card[data-hero="true"] .nb-pulse-card-num { font-size: 28px; }
.nb-pulse[data-scale="quiet"]     .nb-pulse-card-num { font-size: 18px; font-family: var(--font-mono); }
.nb-pulse[data-scale="quiet"]     .nb-pulse-card[data-hero="true"] .nb-pulse-card-num { font-size: 20px; }

.nb-pulse-card-label {
  font-size: 11.5px; color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
.nb-pulse-card-trend {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.nb-pulse-trend-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--success);
}
.nb-pulse-trend-dot[data-dir="down"] { background: var(--warning); }

.nb-pulse-spark {
  display: block;
  width: calc(100% + 28px);
  height: 28px;
  margin: auto -14px 0;
}
.nb-pulse-spark .line {
  fill: none; stroke: var(--accent-primary);
  stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.nb-pulse-spark .fill {
  fill: var(--accent-primary-tint); opacity: 0.9;
  stroke: none;
}
.nb-pulse-card:not([data-hero="true"]) .nb-pulse-spark .line { stroke: var(--text-faint); opacity: 0.7; }
.nb-pulse-card:not([data-hero="true"]) .nb-pulse-spark .fill { fill: var(--bg-secondary); }

/* Secondary mini row — denser, monospace */
.nb-pulse-secondary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  border: 1px solid var(--border-subtle);
  background: var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}
@media (max-width: 980px) { .nb-pulse-secondary { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .nb-pulse-secondary { grid-template-columns: repeat(2, 1fr); } }

.nb-pulse-mini {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  background: var(--bg-surface);
}
.nb-pulse-mini .v {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.nb-pulse-mini .v .u {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  margin-left: 1px;
}
.nb-pulse-mini .l {
  font-size: 10.5px; color: var(--text-muted);
  text-transform: lowercase;
}
.nb-pulse-mini .t {
  font-size: 9.5px; color: var(--text-faint);
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 1px;
}

/* Ticker layout */
.nb-pulse-ticker {
  display: flex; gap: 26px;
  align-items: baseline;
  padding: 6px 4px;
  font-family: var(--font-mono);
  overflow-x: auto;
  scrollbar-width: none;
}
.nb-pulse-ticker::-webkit-scrollbar { display: none; }
.nb-pulse-tick {
  display: flex; align-items: baseline; gap: 8px;
  white-space: nowrap;
}
.nb-pulse-tick .v {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.nb-pulse-tick .l { font-size: 11px; color: var(--text-muted); }

/* Headline layout */
.nb-pulse-headline {
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  gap: 14px;
}
@media (max-width: 980px) { .nb-pulse-headline { grid-template-columns: 1fr; } }
.nb-pulse-hero-card {
  background: linear-gradient(180deg, var(--accent-primary-tint), var(--bg-surface) 80%);
  border: 1px solid var(--accent-primary-border);
  border-radius: 16px;
  padding: 18px 20px 20px;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 200px;
  position: relative;
}
.nb-pulse-hero-num {
  font-size: 64px; font-weight: 700; letter-spacing: -0.03em;
  color: var(--accent-ink); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.nb-pulse-hero-num .u {
  font-size: 32px; color: var(--accent-primary); margin-left: 2px;
}
.nb-pulse-hero-label {
  font-size: 12px; font-weight: 600;
  color: var(--accent-ink);
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
.nb-pulse-hero-trend {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--accent-ink); opacity: 0.8;
  font-family: var(--font-mono);
}
.nb-pulse-hero-what {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--text-muted);
  text-wrap: balance;
}
.nb-pulse-supports {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border: 1px solid var(--border-subtle);
  background: var(--border-subtle);
  border-radius: 12px; overflow: hidden;
}
.nb-pulse-support {
  background: var(--bg-surface);
  padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.nb-pulse-support .v {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.nb-pulse-support .v .u { font-size: 13px; color: var(--text-muted); margin-left: 1px; }
.nb-pulse-support .l { font-size: 11px; color: var(--text-muted); text-transform: lowercase; }
.nb-pulse-support .t { font-size: 9.5px; color: var(--text-faint); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; }

/* ─── Today's intelligence ─── */
.nb-today-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border: 1px solid var(--border-subtle);
  background: var(--border-subtle);
  border-radius: 12px; overflow: hidden;
}
.nb-today-lane {
  background: var(--bg-surface);
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 160px;
}
.nb-today-lane-head {
  display: flex; align-items: center; gap: 8px;
}
.nb-today-lane-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-primary);
}
.nb-today-lane[data-accent="indigo"]  .nb-today-lane-dot { background: var(--indigo); }
.nb-today-lane[data-accent="success"] .nb-today-lane-dot { background: var(--success); }
.nb-today-lane[data-accent="warning"] .nb-today-lane-dot { background: var(--warning); }
.nb-today-lane-title {
  font-size: 12px; font-weight: 700;
  color: var(--text-primary);
}
.nb-today-lane-count {
  margin-left: auto;
  font-size: 10.5px; font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-faint);
  background: var(--bg-secondary);
  padding: 1px 6px; border-radius: 4px;
}
.nb-today-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.nb-today-item {
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms;
}
.nb-today-item:hover { background: var(--bg-secondary); }
.nb-today-item .hd {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.nb-today-item .meta {
  font-size: 10.5px; color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 1px;
}

/* ─── Active event ─── */
.nb-event {
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent-primary) 5%, var(--bg-surface)), var(--bg-surface) 60%);
  border-color: var(--accent-primary-border);
}
.nb-event-pip {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-primary);
  margin-right: 4px; vertical-align: 1px;
  animation: nb-pulse 1.6s infinite;
}
.nb-event-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border: 1px solid var(--border-subtle);
  background: var(--border-subtle);
  border-radius: 10px; overflow: hidden;
}
@media (max-width: 720px) { .nb-event-stats { grid-template-columns: repeat(2, 1fr); } }
.nb-event-stat {
  background: var(--bg-surface);
  padding: 12px 14px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.nb-event-stat[data-emph="true"] {
  background: var(--accent-primary-tint);
}
.nb-event-stat .v {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.nb-event-stat[data-emph="true"] .v { color: var(--accent-ink); }
.nb-event-stat .l {
  font-size: 10.5px; color: var(--text-muted);
}

.nb-event-captures {
  display: flex; flex-direction: column; gap: 8px;
}
.nb-event-captures-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.nb-event-captures-meta {
  font-size: 10.5px; color: var(--text-faint);
  font-family: var(--font-mono);
}
.nb-event-cap-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: 10px; overflow: hidden;
  background: var(--bg-surface);
}
.nb-event-cap {
  display: grid;
  grid-template-columns: 80px minmax(0, 1.1fr) minmax(0, 2fr);
  gap: 12px;
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.nb-event-cap:last-child { border-bottom: 0; }
.nb-event-cap .t {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.nb-event-cap .who {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-event-cap .note {
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── Recent reports ─── */
.nb-recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 980px) { .nb-recent-grid { grid-template-columns: 1fr; } }
.nb-recent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px 14px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  transition: border-color 140ms, box-shadow 140ms, transform 140ms;
  text-align: left;
}
.nb-recent-card:hover {
  border-color: var(--accent-primary-border);
  box-shadow: var(--shadow-sm);
}
.nb-recent-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.nb-recent-eye {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint);
}
.nb-recent-fresh {
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--success);
}
.nb-recent-fresh[data-state="updated"]  { color: var(--indigo); }
.nb-recent-fresh[data-state="watching"] { color: var(--accent-ink); }
.nb-recent-title {
  margin: 0;
  font-size: 14.5px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-wrap: balance;
}
.nb-recent-teaser {
  margin: 0;
  font-size: 12px; color: var(--text-muted);
  line-height: 1.45;
  text-wrap: pretty;
}
.nb-recent-meta {
  font-size: 10.5px; color: var(--text-faint);
  font-family: var(--font-mono);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.nb-recent-actions {
  display: flex; gap: 6px; margin-top: 4px;
}
.nb-recent-action {
  flex: 1;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px;
  cursor: pointer; transition: all 140ms;
}
.nb-recent-action:hover { border-color: var(--accent-primary-border); color: var(--accent-ink); background: var(--accent-primary-tint); }
.nb-recent-action[data-primary="true"] {
  border-color: var(--accent-primary-border);
  background: var(--accent-primary);
  color: #FFFAF8;
}
.nb-recent-action[data-primary="true"]:hover { background: var(--accent-primary-hover); }
