/* Reporting North Star — Easol design system (Moments) */
@font-face {
  font-family: "KlarheitGrotesk";
  src: url("./fonts/KlarheitGrotesk-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Neutrals */
  --neutral-50: #fffcf7;
  --neutral-75: #f7f5f0;
  --neutral-100: #f2efee;
  --neutral-200: #ebe8e4;
  --neutral-300: #d4d1cd;
  --neutral-400: #bab8b5;
  --neutral-500: #757472;
  --neutral-600: #61605e;
  --neutral-700: #403f3e;
  --neutral-800: #2e2d2d;
  --neutral-900: #1a1919;
  --neutral-950: #070707;

  /* Sea */
  --sea-75: #f2f7ff;
  --sea-100: #ebf3ff;
  --sea-200: #cce0ff;
  --sea-500: #0066ff;
  --sea-600: #005ce5;
  --sea-700: #004ec2;

  /* Status (data) */
  --jade-100: #d0fae5;
  --jade-500: #00ab61;
  --jade-600: #009152;
  --playa-100: #ffebcc;
  --playa-500: #f76700;
  --playa-600: #d95a00;
  --lava-100: #ffe2e2;
  --lava-500: #fb2c36;
  --lava-600: #e7000b;

  /* Eclipse */
  --eclipse-4: rgba(7, 7, 7, 0.04);
  --eclipse-8: rgba(7, 7, 7, 0.08);
  --eclipse-60: rgba(7, 7, 7, 0.6);

  /* Semantic aliases */
  --bg: var(--neutral-50);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: var(--neutral-200);
  --border-strong: var(--neutral-300);
  --text: var(--neutral-800);
  --text-secondary: var(--neutral-500);
  --text-tertiary: var(--neutral-600);
  --accent: var(--sea-500);
  --accent-muted: var(--sea-75);
  --accent-soft: var(--sea-100);
  --focus-ring: 0 0 0 3px rgba(0, 102, 255, 0.15);

  --radius: 8px;
  --radius-sm: 8px;
  --radius-lg: 12px;

  --font-display: "Outfit", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-ui: "KlarheitGrotesk", system-ui, -apple-system, "Helvetica Neue", sans-serif;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.14);
  --shadow-bar: 0 1px 0 rgba(7, 7, 7, 0.06);

  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-enter: 0.48s;

  /* Semantic surfaces (Easol 2.0 test — map to existing scales) */
  --surface-canvas: var(--neutral-50);
  --surface-raised: #ffffff;
  --surface-muted: var(--neutral-75);
  --hairline: var(--neutral-200);

  /* Compact chrome + type rhythm (Attio / Linear–inspired density; Easol colours) */
  --sidebar-width: 220px;
  --chrome-height: 40px;
  --title-section: 15px; /* section labels: Grotesk only, size hierarchy */
  --text-prose: 13px;
  --text-ui: 13px;
  --text-md: 14px;
  --text-meta: 11px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

@keyframes ns-easol-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-weight: 400;
  background: var(--surface-canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}

/* Easol: no italic in product type; keep semantic emphasis without slant */
.ns-main em {
  font-style: normal;
  color: var(--neutral-900);
}

a {
  color: var(--sea-500);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button:focus-visible,
.ns-content-header__menu:focus-visible,
.ns-ask-trigger:focus-visible,
.ns-job:focus-visible,
.ns-nav-item:focus-visible,
.ns-sidebar__search:focus-visible,
.ns-sidebar__label:focus-visible,
.ns-brief-card__action:focus-visible,
.ns-agent__link:focus-visible,
.ns-metric-pill:focus-visible,
.ns-recon-cta:focus-visible,
.ns-explain-btn:focus-visible,
.ns-ask-modal__input:focus-visible,
.ns-ask-modal__close:focus-visible,
.ns-drill-back:focus-visible,
.ns-drill-booking:focus-visible,
.ns-theme-card:focus-visible,
.ns-pay-analytics__pin:focus-visible,
.ns-pivot-step select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.ns-pivot-step select:focus-visible {
  border-color: var(--sea-500);
}

.ns-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 16px;
  background: var(--sea-500);
  color: #fff;
  font-size: 16px;
  line-height: 1.1;
  border-radius: var(--radius);
  z-index: 9999;
}
.ns-skip:focus {
  left: 8px;
  top: 8px;
}

/* —— Shell (sidebar-first, no global top bar) —— */
.ns-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s var(--ease-out);
}

/* —— Content wrapper —— */
.ns-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* —— Content-area header (per-section, not global) —— */
.ns-content-header {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: 0 var(--space-16);
  min-height: var(--chrome-height);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--hairline);
  box-shadow: var(--shadow-bar);
  flex-shrink: 0;
  z-index: 50;
}

.ns-content-header__menu {
  display: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--neutral-600);
}
.ns-content-header__menu:hover {
  background: var(--eclipse-4);
}

.ns-content-header__ask {
  flex: 1;
  max-width: min(440px, 42vw);
}

.ns-ask-trigger {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--neutral-50);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  line-height: 1.1;
  color: var(--neutral-500);
  text-align: left;
  transition:
    background 0.15s var(--ease-out),
    border-color 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}
.ns-ask-trigger:hover {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.ns-ask-trigger:active {
  background: var(--neutral-75);
}
.ns-ask-trigger .ns-ask-trigger__icon {
  flex-shrink: 0;
  color: var(--neutral-600);
}
.ns-ask-trigger kbd {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: var(--text-meta);
  line-height: 1.1;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--neutral-75);
  border: 1px solid var(--border);
  color: var(--neutral-600);
}

.ns-content-header__meta {
  margin-left: auto;
  font-size: var(--text-meta);
  line-height: 1.2;
  color: var(--neutral-500);
}

/* —— Sidebar (full-height, canvas background) —— */
.ns-sidebar {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
  background: var(--surface-muted);
  box-shadow: inset -1px 0 0 rgba(7, 7, 7, 0.03);
  overflow: hidden;
  height: 100vh;
  position: sticky;
  top: 0;
}

.ns-sidebar__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* Workspace header */
.ns-sidebar__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
  flex-shrink: 0;
}

.ns-sidebar__logo {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--neutral-900);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.ns-sidebar__creator {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ns-sidebar__toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--neutral-500);
  cursor: pointer;
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.ns-sidebar__toggle:hover {
  background: var(--eclipse-4);
  color: var(--neutral-700);
}

/* —— Sidebar collapsed state —— */
.ns-shell.is-sidebar-collapsed {
  grid-template-columns: 52px 1fr;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__creator,
.ns-shell.is-sidebar-collapsed .ns-sidebar__search span,
.ns-shell.is-sidebar-collapsed .ns-nav-item span,
.ns-shell.is-sidebar-collapsed .ns-sidebar__label,
.ns-shell.is-sidebar-collapsed .ns-sidebar__user span:not(.ns-sidebar__avatar),
.ns-shell.is-sidebar-collapsed .ns-sidebar__user svg,
.ns-shell.is-sidebar-collapsed .ns-badge {
  display: none;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__header {
  justify-content: center;
  padding: 12px 0 8px;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__toggle {
  margin-left: 0;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__search {
  justify-content: center;
  margin: 0 6px 4px;
  padding: 7px;
}

.ns-shell.is-sidebar-collapsed .ns-nav-item {
  justify-content: center;
  padding: 8px;
}

.ns-shell.is-sidebar-collapsed .ns-nav-item--sub {
  padding-left: 8px;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__nav {
  padding: 4px 6px;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__group {
  padding: 0 6px;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__group-items {
  padding: 4px 0;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__foot {
  padding: 12px 6px 4px;
  align-items: center;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__user {
  justify-content: center;
  padding: 8px;
}

.ns-shell.is-sidebar-collapsed .ns-sidebar__utility {
  justify-content: center;
  padding: 8px 6px;
}

/* Sidebar search */
.ns-sidebar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 4px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--neutral-400);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.ns-sidebar__search:hover {
  border-color: var(--border-strong);
}
.ns-sidebar__search svg {
  flex-shrink: 0;
  color: var(--neutral-500);
}

/* Nav items */
.ns-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px;
}

.ns-sidebar__nav--primary {
  padding-bottom: 0;
}

.ns-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--neutral-800);
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s var(--ease-out),
    color 0.15s var(--ease-out);
}
.ns-nav-item:hover {
  background: var(--eclipse-4);
  color: var(--neutral-800);
  text-decoration: none;
}
.ns-nav-item.is-active {
  background: var(--sea-100);
  color: var(--sea-500);
}
.ns-nav-item.is-active svg {
  color: var(--sea-500);
}
.ns-nav-item svg {
  flex-shrink: 0;
  color: var(--neutral-600);
}

/* Sub-navigation indent */
.ns-nav-item--sub {
  padding-left: 24px;
}

/* Badges */
.ns-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 9999px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  color: #fff;
}
.ns-badge--sea {
  background: var(--sea-500);
}
.ns-badge--playa {
  background: var(--playa-500);
}

/* Section groups */
.ns-sidebar__group {
  padding: 0 8px;
}

.ns-sidebar__label {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 16px 12px 4px;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--text-meta);
  line-height: 1.2;
  color: var(--neutral-500);
  cursor: pointer;
  text-align: left;
}
.ns-sidebar__label svg {
  color: var(--neutral-400);
  transition: transform 0.15s var(--ease-out);
}
.ns-sidebar__label[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.ns-sidebar__group-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0;
}

/* Bottom pinned section */
.ns-sidebar__foot {
  padding: 12px 8px 4px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

/* User identity */
.ns-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--neutral-800);
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.ns-sidebar__user:hover {
  background: var(--eclipse-4);
}
.ns-sidebar__user svg {
  margin-left: auto;
  color: var(--neutral-400);
}

.ns-sidebar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: var(--sea-200);
  color: var(--sea-700);
  display: grid;
  place-items: center;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  flex-shrink: 0;
}

/* Utility footer */
.ns-sidebar__utility {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
}
.ns-sidebar__utility button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--neutral-500);
  cursor: pointer;
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.ns-sidebar__utility button:hover {
  background: var(--eclipse-4);
  color: var(--neutral-700);
}

/* Main */
.ns-main {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--space-24) clamp(16px, 3vw, 28px) 64px;
  max-width: none;
}

@media (prefers-reduced-motion: no-preference) {
  .ns-main > h1.ns-page-title,
  .ns-main > p.ns-page-lede,
  .ns-main > .ns-jobs,
  .ns-main > .ns-agent,
  .ns-main > .ns-brief,
  .ns-main > .ns-trace,
  .ns-main > .ns-grid,
  .ns-main > .ns-footnote {
    animation: ns-easol-rise var(--motion-enter) var(--ease-enter) both;
  }
  .ns-main > h1.ns-page-title {
    animation-delay: 0ms;
  }
  .ns-main > p.ns-page-lede {
    animation-delay: 50ms;
  }
  .ns-main > .ns-jobs {
    animation-delay: 90ms;
  }
  .ns-main > .ns-agent {
    animation-delay: 130ms;
  }
  .ns-main > .ns-brief {
    animation-delay: 170ms;
  }
  .ns-main > .ns-trace {
    animation-delay: 210ms;
  }
  .ns-main > .ns-grid {
    animation-delay: 250ms;
  }
  .ns-main > .ns-footnote {
    animation-delay: 290ms;
  }
}

/* Only the page title uses display; one clear peak in the hierarchy */
.ns-page-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 0.6vw + 1rem, 1.375rem);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--neutral-900);
}

.ns-page-lede {
  margin: 0 0 20px;
  max-width: 56ch;
  font-size: var(--text-prose);
  line-height: 1.5;
  color: var(--neutral-600);
  text-wrap: balance;
}

/* Job lenses (tabs) */
.ns-jobs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.ns-job {
  padding: 7px 12px;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--neutral-500);
  cursor: pointer;
  min-height: 34px;
  transition:
    color 0.2s var(--ease-out),
    background 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}
.ns-job:hover {
  color: var(--neutral-800);
  background: var(--neutral-75);
}
.ns-job.is-active {
  background: var(--surface);
  color: var(--neutral-900);
  border-color: var(--border);
  border-bottom: 2px solid var(--sea-500);
  margin-bottom: -2px;
  padding-bottom: 6px;
}

/* Brief strip */
.ns-brief {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-16);
  margin-bottom: var(--space-24);
}

@media (max-width: 960px) {
  .ns-brief {
    grid-template-columns: 1fr;
  }
}

.ns-brief-card {
  padding: 12px var(--space-16);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  box-shadow: none;
  transition:
    box-shadow 0.25s var(--ease-out),
    border-color 0.2s var(--ease-out),
    transform 0.25s var(--ease-out);
}
.ns-brief-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--neutral-300);
  transform: translateY(-1px);
}

.ns-brief-card__tag {
  display: inline-block;
  font-size: var(--text-meta);
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 9999px;
  margin-bottom: 10px;
  background: var(--neutral-200);
  color: var(--neutral-700);
}
.ns-brief-card__tag--align {
  background: var(--sea-100);
  color: var(--sea-600);
}
.ns-brief-card__tag--pattern {
  background: var(--neutral-100);
  color: var(--neutral-700);
}
.ns-brief-card__tag--ops {
  background: var(--playa-100);
  color: var(--playa-600);
}

.ns-brief-card p {
  margin: 0;
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-800);
}
.ns-brief-card strong {
  color: var(--neutral-900);
  font-weight: 400;
}

.ns-brief-card__action {
  margin-top: var(--space-12);
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--sea-500);
  background: none;
  border: none;
  padding: 6px 8px;
  margin-left: -8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition:
    color 0.15s var(--ease-out),
    background 0.15s var(--ease-out);
}
.ns-brief-card__action:hover {
  text-decoration: underline;
  background: var(--sea-75);
}
.ns-brief-card__action:active {
  color: var(--sea-700);
  background: var(--sea-100);
}

/* Grid layout below brief */
.ns-grid {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 300px);
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .ns-grid {
    grid-template-columns: 1fr;
  }
}

.ns-panel {
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Section headings: Grotesk at one size — hierarchy via page title + prose, not extra display styles */
.ns-panel__title,
.ns-themes__title,
.ns-trace__title,
.ns-pay-analytics__title,
.ns-drawer h3,
.ns-drill-drawer__head h3 {
  font-family: var(--font-ui);
  font-size: var(--title-section);
  font-weight: 400;
  line-height: 1.25;
  color: var(--neutral-900);
  margin: 0;
}

.ns-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-12);
  flex-wrap: wrap;
  padding: 12px var(--space-16);
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--neutral-50) 0%, var(--surface-raised) 72%);
}

.ns-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ns-explain-btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--neutral-900);
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out);
}
.ns-explain-btn:hover {
  background: var(--neutral-50);
  border-color: var(--neutral-300);
}
.ns-explain-btn:active {
  background: var(--neutral-75);
}

.ns-panel__hint {
  font-size: var(--text-meta);
  line-height: 1.35;
  color: var(--neutral-500);
  margin: 4px 0 0;
}

.ns-panel__body {
  padding: 12px var(--space-16) var(--space-16);
}

/* Pivot explorer */
.ns-pivot-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.ns-pivot-step {
  flex: 1;
  min-width: 140px;
}

.ns-pivot-step label {
  display: block;
  font-size: var(--text-meta);
  line-height: 1.2;
  color: var(--neutral-600);
  margin-bottom: 6px;
}

.ns-pivot-step select {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  background: var(--surface);
  color: var(--neutral-900);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.ns-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-prose);
  line-height: 1.4;
}
.ns-mini-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--neutral-50);
  color: var(--neutral-600);
  font-weight: 400;
  font-size: var(--text-meta);
  line-height: 1.2;
}
.ns-mini-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--neutral-800);
}
.ns-mini-table tr:hover td {
  background: var(--eclipse-4);
}

.ns-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--sea-500);
  cursor: help;
  border: none;
  background: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  box-shadow: inset 0 -1px 0 0 var(--sea-500);
  text-decoration: none;
}
.ns-metric-pill:hover {
  background: var(--sea-75);
  box-shadow: none;
}

/* Reconciliation panel */
.ns-recon-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ns-recon-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.4;
}
.ns-recon-row:last-child {
  border-bottom: none;
}
.ns-recon-row--total {
  padding-top: 14px;
  margin-top: 4px;
  border-top: 2px solid var(--neutral-900);
  border-bottom: none;
  color: var(--neutral-900);
}

.ns-recon-row span:first-child {
  color: var(--neutral-700);
}
.ns-recon-row span:last-child {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--neutral-900);
}

.ns-recon-cta {
  margin-top: var(--space-16);
  width: 100%;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--sea-500);
  color: #fff;
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease-out);
}
.ns-recon-cta:hover {
  background: var(--sea-600);
}
.ns-recon-cta:active {
  background: var(--sea-700);
}

/* Themes / saved views */
.ns-themes {
  margin-top: var(--space-24);
}

.ns-themes__sub {
  font-size: var(--text-meta);
  line-height: 1.4;
  color: var(--neutral-500);
  margin: 4px 0 12px;
}

.ns-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

.ns-theme-card {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.ns-theme-card:hover {
  border-color: var(--neutral-300);
  box-shadow: var(--shadow-md);
}
.ns-theme-card h4 {
  font-family: var(--font-ui);
  margin: 0 0 4px;
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.25;
  color: var(--neutral-900);
}
.ns-theme-card p {
  margin: 0;
  font-size: var(--text-meta);
  line-height: 1.4;
  color: var(--neutral-500);
}

.ns-theme-card.is-highlight {
  border-color: var(--sea-500);
  background: var(--sea-100);
  box-shadow: var(--shadow-sm);
}

/* Footer note */
.ns-footnote {
  margin-top: var(--space-32);
  padding: 12px var(--space-16);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--neutral-75) 0%, var(--neutral-50) 100%);
  border: 1px solid var(--hairline);
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
}
.ns-footnote strong {
  color: var(--neutral-900);
  font-weight: 400;
}

/* —— Ask overlay —— */
.ns-overlay {
  position: fixed;
  inset: 0;
  background: var(--eclipse-60);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 20px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ns-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.ns-ask-modal {
  width: min(640px, 100%);
  max-height: min(78vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  transform: translateY(12px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.ns-overlay.is-open .ns-ask-modal {
  transform: translateY(0);
}

.ns-ask-modal__bar {
  height: 3px;
  background: var(--sea-500);
}

.ns-ask-modal__top {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.ns-ask-modal__input {
  flex: 1;
  border: none;
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.4;
  outline: none;
  color: var(--neutral-900);
  background: transparent;
}
.ns-ask-modal__input::placeholder {
  color: var(--neutral-400);
}

.ns-ask-modal__close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--neutral-600);
}
.ns-ask-modal__close:hover {
  background: var(--eclipse-4);
  color: var(--neutral-900);
}

.ns-ask-stream {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.ns-stream-step {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  opacity: 0;
  transform: translateY(6px);
  animation: nsStepIn 0.35s ease forwards;
}
@keyframes nsStepIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ns-stream-step__icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--sea-100);
  color: var(--sea-500);
  display: grid;
  place-items: center;
  font-family: var(--font-ui);
  font-size: var(--text-meta);
  font-weight: 400;
  flex-shrink: 0;
}

.ns-stream-step p {
  margin: 0;
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
}

.ns-ask-result {
  margin: 16px 18px 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--neutral-50);
  border: 1px solid var(--border);
  display: none;
}
.ns-ask-result.is-visible {
  display: block;
  animation: nsStepIn 0.4s ease;
}

.ns-ask-result__head {
  font-size: var(--text-meta);
  line-height: 1.2;
  color: var(--neutral-600);
  margin-bottom: 8px;
}

/* Metric drawer */
.ns-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--eclipse-60);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ns-drawer-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.ns-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 151;
  padding: var(--space-16) 18px;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.ns-drawer.is-open {
  transform: translateX(0);
}

.ns-drawer h3 {
  margin: 0 0 10px;
}

.ns-drawer p,
.ns-drawer li {
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
}

.ns-drawer ul {
  padding-left: 18px;
}

.ns-drawer strong {
  font-weight: 400;
  color: var(--neutral-900);
}

.ns-drawer__cta {
  margin-top: 16px;
}

.ns-btn-secondary {
  margin-top: 20px;
  width: 100%;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--neutral-900);
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  cursor: pointer;
}
.ns-btn-secondary:hover {
  background: var(--neutral-50);
}

.ns-panel__micro {
  font-size: 12px;
  line-height: 1.4;
  color: var(--neutral-500);
  margin: 0 0 14px;
}
.ns-panel__micro strong {
  color: var(--neutral-900);
  font-weight: 400;
}

.ns-text-playa {
  color: var(--playa-600);
}

.ns-ask-result__text {
  margin: 0 0 12px;
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-800);
}

/* Job-tinted sections (show/hide) */
.ns-job-section {
  display: none;
}
.ns-job-section.is-visible {
  display: block;
}

/* Mobile */
@media (max-width: 768px) {
  .ns-shell {
    grid-template-columns: 1fr;
  }
  .ns-sidebar {
    display: none;
  }
  .ns-content-header__menu {
    display: grid;
    place-items: center;
  }
  .ns-content-header__ask {
    max-width: none;
    flex: 1;
  }
  .ns-main {
    padding: 24px 16px 48px;
  }
}

/* —— Insights agent + manual fallback —— */
/* Editorial block: white surface + Sea rail — no nested card stack (Easol warmth, less noise) */
.ns-agent {
  margin-bottom: var(--space-24);
  padding: var(--space-16);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--sea-500);
  background: var(--surface-raised);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.25s var(--ease-out);
}
.ns-agent:hover {
  box-shadow: var(--shadow-sm);
}

.ns-agent__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.ns-agent__brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(520px, 100%);
}

.ns-agent__badge {
  display: inline-block;
  width: fit-content;
  font-size: var(--text-meta);
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 9999px;
  background: var(--neutral-200);
  color: var(--neutral-700);
}

.ns-agent__sub {
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-500);
}

.ns-agent__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
  cursor: pointer;
  user-select: none;
}

.ns-agent__toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--sea-500);
  border-radius: 4px;
}
.ns-agent__toggle input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.ns-agent__prose {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ns-agent__insight {
  padding: 14px 0 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--hairline);
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
  box-shadow: none;
}

.ns-agent__insight:first-child {
  border-top: none;
  padding-top: 2px;
}

.ns-agent__insight strong {
  color: var(--neutral-900);
  font-weight: 400;
}

.ns-agent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.ns-agent__link {
  border: none;
  background: none;
  padding: 4px 8px;
  margin: -4px -8px;
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--sea-500);
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  transition:
    color 0.15s var(--ease-out),
    background 0.15s var(--ease-out);
}
.ns-agent__link:hover {
  background: var(--sea-75);
}
.ns-agent__link:active {
  color: var(--sea-700);
  background: var(--sea-100);
}
.ns-agent__link--muted {
  color: var(--neutral-600);
}
.ns-agent__link--muted:hover {
  background: var(--eclipse-4);
}
.ns-agent__link--muted:active {
  color: var(--neutral-800);
  background: var(--eclipse-8);
}

.ns-agent__manual {
  padding: 4px 0;
}

.ns-agent__manual-intro {
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
  margin: 0 0 12px;
}

.ns-agent__manual-list {
  margin: 0;
  padding-left: 20px;
  font-size: var(--text-prose);
  line-height: 1.65;
  color: var(--neutral-700);
}

.ns-agent__manual-list a {
  color: var(--sea-500);
}

.ns-agent__inline-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--sea-500);
  cursor: pointer;
  text-decoration: underline;
}

/* Trace ladder */
.ns-trace {
  margin-bottom: var(--space-24);
  padding: var(--space-16) 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ns-trace__title {
  margin: 0 0 6px;
}

.ns-trace__sub {
  margin: 0 0 var(--space-12);
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-500);
  max-width: 62ch;
  text-wrap: balance;
}

/* Segmented control: one instrument, vertical dividers (pro-tool rhythm; Sea = active only) */
.ns-trace__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--neutral-50);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.ns-trace__step {
  flex: 1 1 0;
  min-width: 112px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-12) var(--space-16);
  border: none;
  border-right: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  transition:
    background 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out);
}

.ns-trace__step:last-child {
  border-right: none;
}

.ns-trace__step.is-active {
  background: var(--sea-100);
  box-shadow: inset 0 -2px 0 0 var(--sea-500);
}

.ns-trace__btn {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.25;
  color: var(--neutral-900);
  cursor: pointer;
  text-align: left;
}
.ns-trace__btn:hover {
  color: var(--sea-500);
}

.ns-trace__hint {
  font-size: var(--text-meta);
  line-height: 1.35;
  color: var(--neutral-500);
}

.ns-ia-hint {
  font-size: var(--text-prose);
  line-height: 1.45;
  margin: 0 0 var(--space-16);
  padding: var(--space-12) var(--space-16);
  border-left: 2px solid var(--sea-500);
  background: var(--sea-75);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--neutral-700);
  text-wrap: balance;
}
.ns-ia-hint strong {
  font-weight: 400;
  color: var(--neutral-900);
}

/* Payment analytics strip */
.ns-pay-analytics {
  margin-top: var(--space-24);
  margin-bottom: 8px;
  padding: 12px var(--space-16);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ns-pay-analytics__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.ns-pay-analytics__title {
  margin: 0 0 4px;
}

.ns-pay-analytics__sub {
  margin: 0;
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
  max-width: 56ch;
}
.ns-pay-analytics__sub strong {
  font-weight: 400;
  color: var(--neutral-900);
}

.ns-pay-analytics__pin {
  flex-shrink: 0;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px dashed var(--neutral-300);
  background: transparent;
  font-size: var(--text-meta);
  line-height: 1.2;
  cursor: pointer;
  font-family: inherit;
  color: var(--neutral-700);
  transition:
    border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out),
    border-style 0.1s var(--ease-out);
}
.ns-pay-analytics__pin:hover {
  border-style: solid;
  background: var(--neutral-50);
  border-color: var(--neutral-300);
}
.ns-pay-analytics__pin:active {
  background: var(--neutral-75);
}

.ns-pay-analytics__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 800px) {
  .ns-pay-analytics__grid {
    grid-template-columns: 1fr;
  }
}

.ns-pay-stat {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--neutral-50);
  border: 1px solid var(--border);
}

.ns-pay-stat__label {
  display: block;
  font-size: var(--text-meta);
  line-height: 1.2;
  color: var(--neutral-600);
  margin-bottom: 6px;
}

.ns-pay-stat__value {
  display: block;
  font-size: var(--text-md);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
  color: var(--neutral-900);
}

.ns-pay-stat__delta {
  font-size: var(--text-meta);
  line-height: 1.35;
  color: var(--neutral-500);
}

.ns-pay-analytics__foot {
  margin: 12px 0 0;
  font-size: var(--text-meta);
  line-height: 1.4;
  color: var(--neutral-500);
}

/* —— Drill drawer (orders behind reconciliation) —— */
.ns-drill-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: var(--eclipse-60);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ns-drill-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.ns-drill-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(720px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 161;
  padding: 0;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}
.ns-drill-drawer.is-open {
  transform: translateX(0);
}

.ns-drill-drawer__head {
  padding: 16px var(--space-16) 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ns-drill-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px 8px;
  margin-left: -8px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: var(--text-ui);
  line-height: 1.2;
  color: var(--sea-500);
  cursor: pointer;
  border-radius: 6px;
}
.ns-drill-back:hover {
  background: var(--sea-75);
}

.ns-drill-drawer__head h3 {
  margin: 0 0 6px;
}

.ns-drill-drawer__context {
  margin: 0;
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
}

.ns-drill-drawer__trace {
  margin: 0;
  padding: 10px var(--space-16);
  font-size: var(--text-prose);
  line-height: 1.45;
  color: var(--neutral-700);
  background: var(--sea-75);
  border-bottom: 1px solid var(--border);
}
.ns-drill-drawer__trace strong {
  font-weight: 400;
  color: var(--neutral-900);
}

.ns-drill-table-wrap {
  padding: 12px var(--space-16) var(--space-16);
  flex: 1;
}

.ns-drill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-prose);
  line-height: 1.4;
}

.ns-drill-table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-meta);
  line-height: 1.2;
  font-weight: 400;
  color: var(--neutral-600);
  background: var(--neutral-50);
}

.ns-drill-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  color: var(--neutral-800);
}

.ns-drill-table tbody tr:hover td {
  background: var(--eclipse-4);
}

.ns-drill-table .ns-drill-booking {
  color: var(--sea-500);
  cursor: pointer;
  text-decoration: none;
}
.ns-drill-table .ns-drill-booking:hover {
  text-decoration: underline;
}

.ns-drill-tfoot td {
  padding-top: 14px;
  border-top: 2px solid var(--neutral-900);
  border-bottom: none;
  color: var(--neutral-900);
  font-weight: 400;
}

.ns-drill-tfoot td:first-child {
  color: var(--neutral-600);
}

.ns-drill-drawer__hint {
  padding: 12px var(--space-16) 20px;
  margin: 0;
  font-size: var(--text-meta);
  line-height: 1.4;
  color: var(--neutral-500);
  border-top: 1px solid var(--border);
}

@media (pointer: coarse) {
  .ns-nav-item {
    min-height: 44px;
  }
}

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

  .ns-main > h1.ns-page-title,
  .ns-main > p.ns-page-lede,
  .ns-main > .ns-jobs,
  .ns-main > .ns-agent,
  .ns-main > .ns-brief,
  .ns-main > .ns-trace,
  .ns-main > .ns-grid,
  .ns-main > .ns-footnote {
    animation: none !important;
  }

  .ns-brief-card:hover {
    transform: none;
  }
}
