/* Neuraluna Interface System 2.5.0 / v3 - Pure 2-Pane Chat + Deal Workbench */
:root {
  --canvas: #F6F7FB;
  --surface: #FFFFFF;
  --surface-subtle: #EEF0F6;
  --surface-hover: #E7EAF2;
  --surface-raised: #F0F2F8;
  --border: #E1E4EE;
  --border-strong: #CDD2E0;
  --text-1: #202131;
  --text-2: #565B70;
  --text-3: #62677A;
  --icon: #777386;
  --primary-text: #5D36D5;
  --primary-text-hover: #5C33D6;
  --primary-solid: #6D43E8;
  --primary-solid-hover: #5D35D8;
  --on-primary: #FFFFFF;
  --secondary-text: #2C7267;
  --secondary-soft: rgba(44, 114, 103, 0.1);
  --danger-text: #BE354A;
  --danger-solid: #C23B50;
  --danger-soft: rgba(190, 53, 74, 0.1);
  --warning-text: #8A5A00;
  --warning-soft: rgba(138, 90, 0, 0.1);
  --focus: #74747D;
  --accent-soft: #EEE7FF;
  --switch-track: #E5E2DE;
  --switch-track-hover: #D8D8DE;
  --switch-track-on-hover: #5E36D8;
  --switch-thumb: #FEFDFC;
  --brandmark: #100F0D;
  --resizer-active: rgba(109, 67, 232, 0.38);

  --viz-series: #2a78d6;
  --viz-ord-3: #104281;
  --viz-reference: #7a8094;
  --viz-axis: #cdd2e0;
  --viz-grid: #eef0f6;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --r-compact: 5px;
  --r-sm: 6px;
  --r-control: 7px;
  --r-surface: 10px;
  --r-dialog: 16px;

  --shadow-subtle: 0 1px 2px rgba(17, 17, 20, 0.05);
  --shadow-menu: 0 12px 32px rgba(17, 17, 20, 0.12);
  --shadow-dialog: 0 24px 48px rgba(10, 10, 12, 0.18);
  --shadow-thumb: 0 1px 2px rgba(17, 17, 20, 0.16);
  --backdrop: rgba(0, 0, 0, 0.35);

  --dur-fast: 120ms;
  --dur-control: 140ms;
  --dur-default: 160ms;
  --chat-w: 380px;
  color-scheme: light;
}

html.dark {
  --canvas: #111113;
  --surface: #171719;
  --surface-subtle: #1E1E21;
  --surface-hover: #222225;
  --surface-raised: #262629;
  --border: #2A2A2E;
  --border-strong: #38383E;
  --text-1: #E4E4E7;
  --text-2: #A7A7AF;
  --text-3: #898993;
  --icon: #9B9BA4;
  --primary-text: #B7AAE8;
  --primary-text-hover: #A595F0;
  --primary-solid: #7964D7;
  --primary-solid-hover: #6D58CA;
  --on-primary: #FFFFFF;
  --secondary-text: #5F9B8D;
  --secondary-soft: rgba(95, 155, 141, 0.14);
  --danger-text: #D96A78;
  --danger-solid: #B94154;
  --danger-soft: rgba(217, 106, 120, 0.14);
  --warning-text: #E7A93D;
  --warning-soft: rgba(231, 169, 61, 0.14);
  --focus: #74747D;
  --accent-soft: #262334;
  --switch-track: #303034;
  --switch-track-hover: #3A3A40;
  --switch-track-on-hover: #876FE0;
  --switch-thumb: #FEFDFC;
  --brandmark: #FFFFFF;
  --resizer-active: rgba(121, 100, 215, 0.45);

  --viz-series: #3987e5;
  --viz-ord-3: #9ec5f4;
  --viz-reference: #8b90a0;
  --viz-axis: #3a3d47;
  --viz-grid: #26272d;

  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-menu: 0 12px 32px rgba(0, 0, 0, 0.24);
  --shadow-dialog: 0 24px 48px rgba(0, 0, 0, 0.32);
  --backdrop: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--canvas);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
}
/* Interface System rule: only weights 400 and 500 on signed-in product surfaces */
b, strong, h1, h2, h3, th { font-weight: 500; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: var(--primary-text-hover); text-decoration: underline; text-underline-offset: 3px; }
.mono { font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--text-3); }
.nl-caption { font-size: 12px; line-height: 16px; color: var(--text-3); }
.nl-tertiary { color: var(--text-3); font-weight: 400; }

/* Lucide 2px-stroke icons */
.lucide {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}
.lucide-sm { width: 12px; height: 12px; }

/* ---------- Pure 2-Pane Halo Workspace Shell ---------- */
.nl-shell {
  display: flex;
  flex-direction: row;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--canvas);
}

/* Shared 40px (h-10) content-box bar so rules align level across Chat and Workbench */
.nl-bar {
  box-sizing: content-box;
  height: 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.nl-mobile-bar { display: none; }
.nl-fs-only { display: none !important; }

/* Left Pane: Deal Lead Conversation */
.nl-chat-pane {
  width: var(--chat-w);
  flex: 0 0 var(--chat-w);
  min-width: 330px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.nl-chat-head { padding: 0 8px 0 12px; gap: 6px; }
.nl-brand-deal { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; }
.nl-brandmark { color: var(--brandmark); flex-shrink: 0; }
.nl-deal-btn { padding: 0 6px; min-width: 0; max-width: 220px; font-size: 13px; }

.nl-chat-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* 1px Halo ResizeHandle (useResizer.tsx 1:1) */
.nl-resizer {
  width: 1px;
  flex: 0 0 1px;
  background: var(--border);
  position: relative;
  cursor: col-resize;
  z-index: 60;
  transition: background-color var(--dur-fast) ease;
}
.nl-resizer::before {
  content: "";
  position: absolute;
  inset: 0 -4px;
}
.nl-resizer:hover, .nl-resizer.is-resizing {
  background: var(--resizer-active);
}

/* Right Pane: Deal Workbench (WorkbenchFrame.tsx 1:1) */
.nl-workbench-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  overflow: hidden;
  container-type: inline-size;
}
.nl-wb-head {
  padding: 0 12px;
  gap: 8px;
}
.nl-wb-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}
.nl-wb-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
@container (max-width: 660px) {
  .nl-wb-btn-label { display: none; }
}

/* Fullscreen Workbench Mode on Desktop */
@media (min-width: 960px) {
  .nl-shell.wb-fullscreen .nl-chat-pane,
  .nl-shell.wb-fullscreen .nl-resizer {
    display: none !important;
  }
  .nl-shell.wb-fullscreen .nl-fs-only {
    display: inline-flex !important;
  }
}

/* Zero-Deal Empty Workspace Mode */
.nl-shell.no-deal .nl-chat-pane,
.nl-shell.no-deal .nl-resizer,
.nl-shell.no-deal #tabs,
.nl-shell.no-deal #fullscreenBtn,
.nl-shell.no-deal #fsChatLauncher,
.nl-shell.no-deal #mobileModeTabs {
  display: none !important;
}
.nl-shell.no-deal .nl-fs-only {
  display: inline-flex !important;
}

.nl-wb-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
}
.nl-page-content {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px 48px;
}
.nl-view { display: none; }
.nl-view.on { display: block; }
.nl-stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Halo Primitives (Button, Tabs, Chip, ToggleSwitch, Input, Card) ---------- */

.nl-btn {
  font: inherit;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-control);
  border: 0;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-control) ease-out, color var(--dur-control) ease-out;
}
.nl-btn:active:not(:disabled) { transform: translateY(1px); }
.nl-btn:disabled { pointer-events: none; opacity: 0.42; }
.nl-btn-primary { background: var(--primary-solid); color: var(--on-primary); }
.nl-btn-primary:hover { background: var(--primary-solid-hover); }
.nl-btn-secondary { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-1); }
.nl-btn-secondary:hover { background: var(--surface-hover); }
.nl-btn-ghost { background: transparent; color: var(--text-1); }
.nl-btn-ghost:hover { background: var(--surface-hover); }
.nl-btn-sm { height: 28px; padding: 0 8px; font-size: 12px; line-height: 14px; }
.nl-btn-icon { width: 32px; padding: 0; }
.nl-btn-icon.nl-btn-sm { width: 28px; padding: 0; }

.nl-link {
  font: inherit;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--primary-text);
  background: transparent;
  border: 0;
  padding: 2px 4px;
  border-radius: var(--r-compact);
  cursor: pointer;
}
.nl-link:hover { color: var(--primary-text-hover); text-decoration: underline; text-underline-offset: 3px; }
.nl-link:disabled { opacity: 0.42; pointer-events: none; }
.nl-btn-danger-text { color: var(--danger-text); }
.nl-btn-danger-text:hover { background: var(--danger-soft); color: var(--danger-text); }

/* Tabs.tsx 1:1: quiet default, text-only hover, neutral selected fill (NEVER purple, underline, or border) */
.nl-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nl-tab {
  font: inherit;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-control);
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  line-height: 18px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-control) ease-out, color var(--dur-control) ease-out;
}
.nl-tabs-sm .nl-tab {
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
}
.nl-tab:hover { color: var(--text-1); }
.nl-tab[aria-selected="true"], .nl-tab[aria-pressed="true"] {
  background: var(--surface-hover);
  color: var(--text-1);
  font-weight: 500;
}
.nl-tab-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  font-weight: 400;
}
.nl-tab[aria-selected="true"] .nl-tab-count { color: var(--text-1); }

/* Chip.tsx 1:1: h-[22px] rounded-md (7px) px-[7px] text-caption (11px/16px) font-normal */
.nl-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-control);
  font-size: 11px;
  line-height: 16px;
  font-weight: 400;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.nl-chip-neutral { background: var(--surface-subtle); color: var(--text-2); }
.nl-chip-accent { background: var(--accent-soft); color: var(--primary-text); }
.nl-chip-success { background: var(--secondary-soft); color: var(--secondary-text); }
.nl-chip-warning { background: var(--warning-soft); color: var(--warning-text); }

/* ToggleSwitch.tsx 1:1: 32x20 track, 16px thumb travelling 12px */
.nl-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 32px;
  height: 20px;
  padding: 2px;
  border-radius: 999px;
  background: var(--switch-track);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--dur-default) ease;
}
.nl-switch::before {
  content: "";
  position: absolute;
  inset: -12px -6px;
}
.nl-switch:hover { background: var(--switch-track-hover); }
.nl-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.nl-switch-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--switch-thumb);
  box-shadow: var(--shadow-thumb);
  pointer-events: none;
  transition: transform var(--dur-default) ease;
}
.nl-switch:has(input:checked) { background: var(--primary-solid); }
.nl-switch:hover:has(input:checked) { background: var(--switch-track-on-hover); }
.nl-switch input:checked + .nl-switch-thumb {
  transform: translateX(12px);
  background: var(--on-primary);
}
.nl-switch:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.nl-switch:has(input:disabled) { opacity: 0.48; pointer-events: none; }

/* inputBase.ts 1:1 */
.nl-input, textarea {
  font: inherit;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-control);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-1);
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  transition: border-color var(--dur-control) ease;
}
.nl-input::placeholder, textarea::placeholder { color: var(--text-3); }
.nl-input:hover, textarea:hover { border-color: var(--focus); }
.nl-input:focus-visible, textarea:focus-visible {
  border-color: var(--text-1);
  outline: none;
}
.nl-input:disabled, textarea:disabled { opacity: 0.48; pointer-events: none; }
select.nl-input { cursor: pointer; padding-right: 24px; }
input[type="file"].nl-input { height: auto; padding: 6px 8px; }
textarea { height: auto; padding: 8px; width: 100%; resize: vertical; }

/* Card.tsx / .ui-card 1:1: flat crisp surface, NO drop shadow */
.ui-card {
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 20px;
  color: var(--text-1);
  min-width: 0;
}

/* ---------- Anchored Menus & Version History Popover ---------- */
.nl-menu {
  position: fixed;
  z-index: 2500;
  min-width: 204px;
  max-width: calc(100vw - 16px);
  padding: 4px;
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}
.nl-menu-wide { min-width: 244px; }
.nl-menu-label { padding: 6px 8px 4px; font-size: 11px; line-height: 16px; color: var(--text-3); }
.nl-menu-sep { height: 1px; background: var(--border); margin: 4px; }
.nl-menu-item {
  font: inherit;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text-1);
  font-size: 13px;
  line-height: 18px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-decoration: none;
}
.nl-menu-item:hover, .nl-menu-item:focus-visible {
  background: var(--surface-hover);
  text-decoration: none;
  outline: none;
}
.nl-menu-item.active-deal { background: var(--accent-soft); color: var(--primary-text); font-weight: 500; }
.nl-menu-item:disabled { opacity: 0.42; pointer-events: none; }
.nl-deal-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; }
.nl-menu-sub { font-size: 11px; line-height: 16px; color: var(--text-3); }
.nl-menu-danger { color: var(--danger-text); }

.nl-seg-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  margin: 2px 4px 4px;
  border-radius: var(--r-control);
  background: var(--surface-subtle);
}
.nl-seg-btn {
  font: inherit;
  height: 26px;
  border: 0;
  border-radius: var(--r-compact);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}
.nl-seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text-1);
  font-weight: 500;
  box-shadow: var(--shadow-subtle);
}

/* Version History Popover */
.nl-history-pop {
  width: min(350px, calc(100vw - 16px));
  max-height: min(440px, calc(100dvh - 72px));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.nl-history-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}
.nl-hist {
  list-style: none;
  margin: 0;
  padding: 4px 14px 12px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.nl-hist li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.nl-hist li:last-child { border-bottom: 0; }
.nl-hist-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nl-hist time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Left Deal Lead Stream, Starters, Receipts, & Composer ---------- */
.nl-thread {
  list-style: none;
  margin: 0;
  padding: 14px;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nl-msg {
  max-width: 92%;
  padding: 8px 11px;
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  line-height: 20px;
}
.nl-msg.you {
  align-self: flex-end;
  background: var(--surface-subtle);
  border-color: transparent;
}
.nl-msg-who { font-size: 11px; line-height: 16px; color: var(--text-3); margin-bottom: 2px; }
.nl-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.nl-msg-text.nl-md { white-space: normal; }
/* :where keeps this reset at class specificity, so the block spacing rule below still applies. */
.nl-md :where(p, ul, ol, pre, hr) { margin: 0; }
.nl-md > * + * { margin-top: 6px; }
.nl-md ul, .nl-md ol { padding-left: 18px; }
.nl-md li + li { margin-top: 2px; }
.nl-md .nl-md-h { font-weight: 600; }
.nl-md code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-subtle); border-radius: 4px; padding: 0 3px; }
.nl-md pre { white-space: pre-wrap; background: var(--surface-subtle); border-radius: var(--r-control); padding: 6px 8px; }
.nl-md pre code { background: none; padding: 0; }
.nl-md hr { border: 0; border-top: 1px solid var(--border); }

/* Claude-Code-style 1-line factual build/upload receipts in stream */
.nl-receipt {
  border-radius: var(--r-control);
  background: var(--surface-subtle);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 17px;
  color: var(--text-2);
}
.nl-receipt-error { color: var(--danger-text); border: 1px solid var(--danger-solid); }
.nl-receipt summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nl-receipt summary::-webkit-details-marker { display: none; }
.nl-receipt-detail {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
}

/* Quiet Empty-Thread Starter Prompts (engineering.md:67,86) */
.nl-thread-starters {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nl-starter-btn {
  font: inherit;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 18px;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-control) ease, border-color var(--dur-control) ease, color var(--dur-control) ease;
}
.nl-starter-btn:hover {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text-1);
}
.nl-starter-btn:disabled { opacity: 0.42; pointer-events: none; }

.nl-thread-setup {
  padding: 14px;
  border-radius: var(--r-surface);
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nl-thread-setup h2 { margin: 0; font-size: 14px; line-height: 20px; }
.nl-thread-setup p { margin: 0; font-size: 13px; color: var(--text-2); }
.nl-thread-setup-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* Inline Proposal Card pinned above Composer */
.nl-chat-proposal {
  padding: 0 12px 8px;
  max-height: 38dvh;
  overflow-y: auto;
  flex-shrink: 0;
}
.nl-prop-card {
  padding: 12px;
  border-radius: var(--r-surface);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nl-prop-title { margin: 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-1); }
.nl-prop-list { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--text-2); }
.nl-prop-fields {
  list-style: none;
  margin: 2px 0 6px;
  padding-left: 12px;
  font-size: 12px;
  line-height: 17px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.nl-prop-effect { padding: 6px 8px; border-radius: var(--r-control); background: var(--surface-subtle); font-size: 12px; color: var(--text-2); }
.nl-prop-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.nl-prop-error { border-color: var(--danger-solid); }
.nl-prop-error summary {
  cursor: pointer;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--danger-text);
}
.nl-prop-error-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 17px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

/* Live work receipt at tail of stream */
.nl-work-receipt {
  margin: 0 12px 8px;
  padding: 8px 10px;
  border-radius: var(--r-control);
  background: var(--surface-subtle);
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.nl-work-line { display: flex; align-items: center; gap: 8px; color: var(--text-1); font-weight: 500; }
.nl-work-tasks { margin: 4px 0 0; padding-left: 16px; color: var(--text-2); font-size: 12px; }

/* Halo .chat-composer 1:1 */
.nl-composer-wrap {
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.nl-chat-composer {
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  padding: 4px;
  transition: border-color var(--dur-control) ease;
}
.nl-chat-composer:focus-within { border-color: var(--border-strong); }
.nl-chat-composer textarea {
  border: 0;
  padding: 6px 8px;
  font-size: 13.5px;
  line-height: 20px;
  resize: none;
  background: transparent;
}
.nl-chat-composer textarea:focus-visible { border: 0; outline: none; }
.nl-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}
.nl-composer-left { display: flex; align-items: center; gap: 6px; }

/* Active build badge in Workbench header */
.nl-jobs { display: flex; align-items: center; gap: 6px; }
.nl-job-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--r-control);
  background: var(--surface-subtle);
  color: var(--text-2);
  font-size: 12px;
  max-width: 180px;
}
.nl-spin {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1.75px solid currentColor;
  border-right-color: transparent;
  animation: nlspin 800ms linear infinite;
  flex-shrink: 0;
}
@keyframes nlspin { to { transform: rotate(360deg); } }

#loadError { margin-bottom: 16px; }

/* Proposal 1-line bar inside Workbench (shown ONLY when Chat pane is hidden) */
.nl-proposal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
}
.nl-proposal-bar-text {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 13px;
}
.nl-proposal-bar-actions { display: flex; align-items: center; gap: 6px; }

/* ---------- VIEW 1: Overview (Calm Progressive Disclosure) ---------- */
.nl-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nl-hero-card { padding: 20px 24px; }
.nl-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.nl-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.nl-hero-figure {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  font-size: 32px;
  line-height: 38px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.nl-fig-from { font-size: 22px; line-height: 30px; color: var(--text-3); font-weight: 400; }
.nl-fig-arrow { font-size: 20px; color: var(--text-3); font-weight: 400; }
.nl-fig-to { color: var(--text-1); }

.nl-rangebar { margin: 16px 0 18px; }
.nl-rangebar svg, .nl-chart svg { display: block; width: 100%; }
svg text { font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
svg .range-hit { cursor: pointer; }
.nl-rangekey {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.nl-metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-control);
  background: var(--surface-subtle);
}
.nl-metric-k { font-size: 12px; line-height: 16px; color: var(--text-2); }
.nl-metric-v {
  margin-top: 2px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}

.nl-inline-details { position: relative; }
.nl-inline-details summary { list-style: none; cursor: pointer; }
.nl-inline-details summary::-webkit-details-marker { display: none; }
.nl-pop-note {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 50;
  width: min(320px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
  font-size: 12px;
  line-height: 18px;
  color: var(--text-2);
}

.nl-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nl-grid-2 > * { min-width: 0; }

.nl-fn-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font: inherit;
  width: 100%;
  transition: border-color var(--dur-control) ease, background-color var(--dur-control) ease;
}
.nl-fn-card:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.nl-fn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nl-fn-name { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-1); }
.nl-fn-nums {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.nl-fn-from { font-size: 14px; color: var(--text-3); font-weight: 400; }

.nl-disclosure { padding: 0; overflow: hidden; }
.nl-disclosure-sum {
  list-style: none;
  cursor: pointer;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background-color var(--dur-control) ease;
}
.nl-disclosure-sum::-webkit-details-marker { display: none; }
.nl-disclosure-sum:hover { background: var(--surface-raised); }
.nl-disclosure-title { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-1); }
.nl-chev { color: var(--icon); transition: transform var(--dur-control) ease; }
details[open] > summary .nl-chev, .nl-row-btn[aria-expanded="true"] .nl-chev { transform: rotate(90deg); }

.nl-disclosure-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border);
}
.nl-subpanel {
  padding: 14px 16px;
  border-radius: var(--r-control);
  background: var(--surface-subtle);
  min-width: 0;
}
.nl-subpanel-title { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-1); margin-bottom: 2px; }
.nl-chart { min-height: 206px; margin-top: 8px; }

.nl-prov-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 2px 4px;
  font-size: 12px;
  color: var(--text-3);
}
.nl-prov-links { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Progressive Disclosure Lists (Initiatives, Baseline, Diligence) ---------- */
.nl-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.nl-cal-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nl-score-inline {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nl-score-inline b { color: var(--text-1); }

.nl-list-card { padding: 0; overflow: hidden; }
.nl-group-head {
  padding: 8px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.nl-item { border-bottom: 1px solid var(--border); }
.nl-item:last-child { border-bottom: 0; }
.nl-item.is-off .nl-row-title, .nl-item.is-off .nl-row-num { color: var(--text-3); }
.nl-item.flash { background: var(--accent-soft); }

.nl-row {
  min-height: 42px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nl-row:hover { background: var(--surface-raised); }

.nl-row-btn {
  font: inherit;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.nl-row-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nl-row-meta {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.nl-row-num {
  width: 82px;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  white-space: nowrap;
  flex-shrink: 0;
}

.nl-detail {
  padding: 12px 16px 16px 60px;
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nl-detail.no-indent { padding-left: 16px; }
.nl-detail-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.nl-ov-input { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.nl-why-input { flex: 1 1 220px; max-width: 380px; }
.nl-detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.nl-detail-prose {
  margin: 0;
  font-size: 14px;
  line-height: 21px;
  color: var(--text-1);
  max-width: 720px;
}
.nl-challenge {
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: var(--surface);
  font-size: 13px;
  line-height: 19px;
  color: var(--text-2);
  max-width: 720px;
}
.nl-challenge-resp { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }

.nl-tw { overflow-x: auto; max-width: 100%; }
.nl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nl-table th { text-align: left; font-size: 12px; color: var(--text-2); padding: 6px 8px; border-bottom: 1px solid var(--border-strong); }
.nl-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.nl-table tr:last-child td { border-bottom: 0; }
.nl-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nl-table .active-col { background: var(--accent-soft); font-weight: 500; }
.nl-bar-mini { width: 72px; height: 5px; background: var(--viz-grid); border-radius: 3px; overflow: hidden; }
.nl-bar-mini > div { height: 100%; background: var(--viz-series); border-radius: 3px; }
.nl-sep-rules { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-strong); font-size: 12px; color: var(--text-2); }
.nl-sep-rules ul { margin: 4px 0 0; padding-left: 16px; }

/* Empty & Building Skeleton States inside Workbench */
.nl-empty { max-width: 480px; margin: 48px auto; padding: 24px; }
.nl-empty h2 { margin: 0 0 6px; font-size: 16px; line-height: 24px; }
.nl-empty p { margin: 0; font-size: 13px; color: var(--text-2); }
.nl-empty-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.nl-skel-bar {
  height: 14px;
  border-radius: var(--r-compact);
  background: var(--surface-subtle);
}

/* ---------- Dialogs & Toast ---------- */
dialog {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  padding: 0;
  box-shadow: var(--shadow-dialog);
}
dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(2px);
}
.nl-dialog {
  border-radius: var(--r-dialog);
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}
.nl-dialog-wide { width: min(480px, calc(100vw - 32px)); }
.nl-dialog form, .nl-dialog-panel { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.nl-dialog-head { padding: 18px 20px 10px; }
.nl-dialog-head h2 { margin: 0 0 4px; font-size: 16px; line-height: 24px; }
.nl-dialog-head p { margin: 0; font-size: 13px; color: var(--text-2); }
.nl-dialog-body { padding: 6px 20px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; min-height: 0; }
.nl-field { display: flex; flex-direction: column; gap: 4px; }
.nl-field label, .nl-field-label { font-size: 13px; color: var(--text-1); }
.nl-field-label { font-weight: 500; }
.nl-inline-error {
  padding: 8px 10px;
  border-radius: var(--r-control);
  border: 1px solid var(--danger-solid);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 12.5px;
  line-height: 18px;
  overflow-wrap: anywhere;
}
.nl-people-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-surface);
  background: var(--surface);
}
.nl-person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.nl-person-row:last-child { border-bottom: 0; }
.nl-person-id {
  flex: 1 1 160px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.nl-person-primary {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nl-person-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nl-share-form { display: flex; flex-direction: column; gap: 6px; }
.nl-share-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nl-share-email { flex: 1 1 180px; min-width: 0; }
.nl-share-role { flex: 0 0 auto; min-width: 96px; }
.nl-dialog-foot {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.nl-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--r-surface);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--shadow-menu);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease;
}
.nl-toast.show { opacity: 1; }
.nl-toast.err { border-color: var(--danger-solid); color: var(--danger-text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Responsive Gate (< 960px & < 768px) ---------- */
@media (max-width: 959px) {
  .nl-shell { flex-direction: column; }
  .nl-mobile-bar {
    display: flex;
    padding: 0 10px;
    gap: 6px;
  }
  .nl-mobile-bar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
  .nl-chat-head, .nl-resizer, .nl-desktop-only { display: none !important; }

  .nl-chat-pane, .nl-workbench-pane {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  .nl-shell[data-mobile-pane="deal"] .nl-chat-pane { display: none !important; }
  .nl-shell[data-mobile-pane="chat"] .nl-workbench-pane { display: none !important; }

  .nl-wb-head {
    box-sizing: border-box;
    height: auto;
    min-height: 44px;
    padding: 6px 10px;
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  html, body { font-size: 16px; line-height: 24px; }
  .nl-hide-mobile { display: none !important; }

  .nl-mobile-bar {
    box-sizing: border-box;
    height: auto;
    min-height: 52px;
    padding: 4px 8px;
  }
  .nl-deal-btn { max-width: 140px; font-size: 15px; padding: 0 4px; }

  /* 44px touch targets & 16px/14px mobile typography contract */
  .nl-btn, .nl-btn-sm, .nl-tab, .nl-tabs-sm .nl-tab, .nl-input, .nl-seg-btn, .nl-starter-btn {
    min-height: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 14px;
  }
  .nl-starter-btn { height: auto; padding: 10px 12px; }
  .nl-input, .nl-chat-composer textarea { font-size: 16px; line-height: 24px; }
  .nl-btn-icon, .nl-btn-icon.nl-btn-sm { min-width: 44px; width: 44px; }
  .lucide { width: 18px; height: 18px; }
  .nl-wb-btn-label { display: none; }

  .nl-page-content { padding: 16px 12px 40px; }
  .nl-hero-card { padding: 16px; }
  .nl-hero-figure { font-size: 26px; line-height: 32px; }
  .nl-metric-strip { grid-template-columns: repeat(2, 1fr); }
  .nl-grid-2 { grid-template-columns: 1fr; }
  .nl-caption, .nl-row-meta, .nl-metric-k, .nl-prov-line, .nl-prop-fields, .nl-prop-error-list { font-size: 14px; line-height: 20px; }
  .nl-prop-error summary { min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; }
  .nl-row-title { font-size: 16px; line-height: 24px; white-space: normal; }
  .nl-row { min-height: 52px; padding: 8px 12px; gap: 8px; }
  .nl-row-meta { display: none; }
  .nl-detail { padding: 12px; }
  .nl-person-primary { font-size: 15px; line-height: 22px; }
  .nl-inline-error, .nl-field label, .nl-field-label { font-size: 14px; line-height: 20px; }
  .nl-share-email { flex: 1 1 100%; }
  .nl-share-role { flex: 1 1 auto; }
}

/* Short-phone & 200% zoom vertical guard */
@media (max-width: 959px) and (max-height: 560px) {
  .nl-workbench-pane { overflow-y: auto; }
  .nl-wb-scroll { overflow-y: visible; flex: 0 0 auto; }
}
