@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@300;400;500;600;700&display=swap');

/* ============================================================
   SYNTROPY DESIGN SYSTEM — TOKENS
   Source of truth: docs/design-system-blueprint.md §3.
   Mirrors platform/app/styles/tokens.css exactly.
   Dark-first. A light theme swaps values, never names.
   ============================================================ */

:root {
  /* --- Color / neutrals (pure gray, no blue cast) --- */
  --ds-bg-page: #0a0a0a;
  --ds-bg-surface: #111113;
  --ds-bg-raised: #17171a;
  --ds-bg-inset: #0d0d0f;
  --ds-border-subtle: #1f1f23;
  --ds-border-default: #2e2e33;
  --ds-border-strong: #45454b;
  --ds-text-primary: #ededed;
  --ds-text-secondary: #a1a1a6;
  --ds-text-tertiary: #808086;

  /* --- Brand: the single signature accent --- */
  --ds-brand: #ffb000;
  --ds-brand-hover: #ffc133;
  --ds-brand-bg: rgba(255, 176, 0, 0.1);
  --ds-brand-border: rgba(255, 176, 0, 0.35);

  /* --- Semantic --- */
  --ds-success: #3dd68c;
  --ds-success-bg: rgba(61, 214, 140, 0.1);
  --ds-success-border: rgba(61, 214, 140, 0.35);
  --ds-warning: #ffb000;
  --ds-warning-bg: rgba(255, 176, 0, 0.1);
  --ds-warning-border: rgba(255, 176, 0, 0.35);
  --ds-danger: #ff5c5c;
  --ds-danger-bg: rgba(255, 92, 92, 0.1);
  --ds-danger-border: rgba(255, 92, 92, 0.35);
  --ds-info: #52a8ff;
  --ds-info-bg: rgba(82, 168, 255, 0.1);
  --ds-info-border: rgba(82, 168, 255, 0.35);

  /* --- Typography (Geist loaded via the stylesheet import above) --- */
  --ds-font-sans: 'Geist', system-ui, sans-serif;
  --ds-font-mono: 'Geist Mono', ui-monospace, monospace;

  /* --- Radius --- */
  --ds-radius-sm: 4px;
  --ds-radius-md: 6px;
  --ds-radius-lg: 10px;

  /* --- Elevation (true overlays only) --- */
  --ds-shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.4);

  /* --- Focus --- */
  --ds-focus-ring: 0 0 0 2px rgba(255, 176, 0, 0.6);

  /* --- Motion --- */
  --ds-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ds-duration-fast: 120ms;
  --ds-duration-base: 160ms;
  --ds-duration-slow: 200ms;

  /* --- Density: comfortable preset (platform + marketing) --- */
  --ds-card-padding: 20px;
  --ds-card-gap: 16px;
  --ds-grid-gap: 20px;
  --ds-row-height: 44px;
  --ds-control-height: 36px;
  --ds-control-height-sm: 32px;
  --ds-page-gutter: 32px;
  --ds-content-max: 1200px;
}

/* Compact preset: cockpit density, set via data-density on the root layout. */
[data-density='compact'] {
  --ds-card-padding: 16px;
  --ds-card-gap: 12px;
  --ds-grid-gap: 12px;
  --ds-row-height: 36px;
  --ds-control-height: 32px;
  --ds-control-height-sm: 28px;
  --ds-page-gutter: 20px;
}

/* Legacy token aliases: un-migrated inline styles keep resolving,
   but against the calibrated palette. */
:root {
  --bg-primary: var(--ds-bg-page);
  --bg-secondary: var(--ds-bg-surface);
  --bg-tertiary: var(--ds-bg-raised);
  --bg-inset: var(--ds-bg-inset);
  --accent-amber: var(--ds-brand);
  --text-primary: var(--ds-text-primary);
  --text-secondary: var(--ds-text-secondary);
  --text-tertiary: var(--ds-text-tertiary);
  --semantic-green: var(--ds-success);
  --semantic-red: var(--ds-danger);
  --border-dim: var(--ds-border-subtle);
  --border-glow: var(--ds-brand-border);
  --font-sans: var(--ds-font-sans);
  --font-mono: var(--ds-font-mono);
}

/* ------------------------------------------------------------
   Base
   ------------------------------------------------------------ */

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

html,
body {
  background-color: var(--ds-bg-page);
  color: var(--ds-text-primary);
  font-family: var(--ds-font-sans);
  font-size: 14px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--ds-font-sans);
  font-weight: 600;
  color: var(--ds-text-primary);
}

h1 {
  font-size: 24px;
  line-height: 32px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 15px;
  line-height: 22px;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--ds-font-mono);
  font-size: 12px;
  line-height: 16px;
  background: var(--ds-bg-inset);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-sm);
  padding: 1px 5px;
}

pre {
  background: var(--ds-bg-inset);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-md);
  padding: 16px;
  font-family: var(--ds-font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--ds-text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

::selection {
  background: rgba(255, 176, 0, 0.25);
}

:focus-visible {
  outline: 2px solid rgba(255, 176, 0, 0.6);
  outline-offset: 2px;
}

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

/* ------------------------------------------------------------
   Buttons (§4.5)
   ------------------------------------------------------------ */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ds-control-height);
  padding: 0 14px;
  border-radius: var(--ds-radius-md);
  border: 1px solid var(--ds-border-default);
  background: var(--ds-bg-surface);
  color: var(--ds-text-primary);
  font-family: var(--ds-font-sans);
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--ds-duration-fast) var(--ds-ease),
    border-color var(--ds-duration-fast) var(--ds-ease),
    color var(--ds-duration-fast) var(--ds-ease);
}

button:hover {
  border-color: var(--ds-border-strong);
  background: var(--ds-bg-raised);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:disabled:hover {
  border-color: var(--ds-border-default);
  background: var(--ds-bg-surface);
}

.primary-button {
  background: var(--ds-brand);
  border-color: var(--ds-brand);
  color: #0a0a0a;
}

.primary-button:hover {
  background: var(--ds-brand-hover);
  border-color: var(--ds-brand-hover);
  color: #0a0a0a;
}

.ds-button--destructive {
  background: transparent;
  border-color: var(--ds-danger-border);
  color: var(--ds-danger);
}

.ds-button--destructive:hover {
  background: var(--ds-danger-bg);
  border-color: var(--ds-danger);
  color: var(--ds-danger);
}

/* ------------------------------------------------------------
   Forms (§4.6)
   ------------------------------------------------------------ */

input,
textarea,
select {
  background: var(--ds-bg-inset);
  border: 1px solid var(--ds-border-default);
  border-radius: var(--ds-radius-md);
  color: var(--ds-text-primary);
  font-family: var(--ds-font-sans);
  font-size: 14px;
  line-height: 22px;
  padding: 4px 12px;
  transition: border-color var(--ds-duration-fast) var(--ds-ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--ds-text-tertiary);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--ds-border-strong);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--ds-brand-border);
  box-shadow: var(--ds-focus-ring);
}

textarea {
  resize: vertical;
  line-height: 1.6;
  padding: 8px 12px;
}

select {
  height: var(--ds-control-height);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23808086' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

input[type='range'] {
  padding: 0;
  height: var(--ds-control-height);
  background: transparent;
  border: none;
  accent-color: var(--ds-brand);
}

input[type='range']:focus {
  box-shadow: none;
}

.skip-link {
  background: var(--ds-brand);
  color: #0a0a0a;
  border-radius: var(--ds-radius-md);
  font-size: 13px;
  font-weight: 500;
  left: 1rem;
  opacity: 0;
  padding: 0.65rem 0.85rem;
  position: fixed;
  top: 1rem;
  transform: translateY(-0.75rem);
  transition:
    opacity var(--ds-duration-fast) var(--ds-ease),
    transform var(--ds-duration-fast) var(--ds-ease);
  z-index: 20;
}

.skip-link:focus {
  opacity: 1;
  transform: translateY(0);
}

/* ------------------------------------------------------------
   App shell & navigation (§4.1)
   ------------------------------------------------------------ */

.operator-shell {
  display: flex;
  min-height: 100vh;
}

.operator-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ds-bg-surface);
  border-right: 1px solid var(--ds-border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.operator-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard {
  overflow-y: auto;
  flex-grow: 1;
  padding: var(--ds-page-gutter);
  width: 100%;
}

.operator-brand {
  margin-bottom: 32px;
  padding: 0 10px;
}

.operator-brand h1 {
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ds-text-primary);
}

.operator-brand p {
  color: var(--ds-text-secondary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.operator-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: auto;
}

.operator-nav--primary {
  border-bottom: 1px solid var(--ds-border-subtle);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.operator-nav-link {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--ds-radius-md);
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-secondary);
  transition:
    background var(--ds-duration-fast) var(--ds-ease),
    color var(--ds-duration-fast) var(--ds-ease);
}

.operator-nav-link:hover,
.operator-nav-link:focus-visible {
  background: var(--ds-bg-raised);
  color: var(--ds-text-primary);
}

.operator-nav-link--active {
  background: var(--ds-bg-raised);
  color: var(--ds-text-primary);
  box-shadow: inset 2px 0 0 var(--ds-brand);
}

.operator-nav-link--product {
  border: 1px solid var(--ds-border-default);
  color: var(--ds-text-primary);
}

/* ------------------------------------------------------------
   Page grids
   ------------------------------------------------------------ */

.two-column-grid,
.four-column-grid,
.status-grid {
  display: grid;
  gap: var(--ds-grid-gap);
}

.two-column-grid {
  grid-template-columns: repeat(2, 1fr);
}

.four-column-grid {
  grid-template-columns: repeat(4, 1fr);
}

.status-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 1100px) {
  .two-column-grid,
  .four-column-grid {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------
   Card (§4.2)
   ------------------------------------------------------------ */

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

.detail-panel {
  padding: var(--ds-card-padding);
  display: flex;
  flex-direction: column;
  gap: var(--ds-card-gap);
}

.empty-panel {
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.empty-panel h3 {
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  color: var(--ds-text-primary);
}

.empty-panel p {
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-secondary);
  max-width: 380px;
}

.empty-panel .empty-panel-action {
  margin-top: 8px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.section-heading--flush {
  margin-bottom: 0;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--ds-card-gap);
  margin-bottom: var(--ds-grid-gap);
}

.dashboard-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-secondary);
}

.dashboard-nav a:hover {
  color: var(--ds-text-primary);
}

/* ------------------------------------------------------------
   Typography helpers (§3.2)
   ------------------------------------------------------------ */

.body-copy {
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-secondary);
}

.meta-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ds-text-secondary);
  display: block;
  margin-bottom: 4px;
}

.meta-copy {
  font-family: var(--ds-font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ds-text-tertiary);
}

.text-link {
  color: var(--ds-text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--ds-border-strong);
  transition: color var(--ds-duration-fast) var(--ds-ease);
}

.text-link:hover {
  color: var(--ds-text-primary);
}

.text-primary {
  color: var(--ds-text-primary);
}

.text-danger {
  color: var(--ds-danger);
}

.text-success {
  color: var(--ds-success);
}

/* ------------------------------------------------------------
   Badge (§4.4) — .status-chip keeps its name, gains the badge skin
   ------------------------------------------------------------ */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid var(--ds-border-default);
  background: var(--ds-bg-raised);
  color: var(--ds-text-secondary);
  font-family: var(--ds-font-mono);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.status-chip::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-text-tertiary);
}

.status-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip--ok {
  color: var(--ds-success);
  border-color: var(--ds-success-border);
  background: var(--ds-success-bg);
}

.status-chip--ok::before {
  background: var(--ds-success);
}

.status-chip--warn {
  color: var(--ds-warning);
  border-color: var(--ds-warning-border);
  background: var(--ds-warning-bg);
}

.status-chip--warn::before {
  background: var(--ds-warning);
}

.status-chip--error {
  color: var(--ds-danger);
  border-color: var(--ds-danger-border);
  background: var(--ds-danger-bg);
}

.status-chip--error::before {
  background: var(--ds-danger);
}

.status-chip--info {
  color: var(--ds-info);
  border-color: var(--ds-info-border);
  background: var(--ds-info-bg);
}

.status-chip--info::before {
  background: var(--ds-info);
}

.status-chip--muted {
  color: var(--ds-text-secondary);
  border-color: var(--ds-border-default);
  background: var(--ds-bg-raised);
}

a.status-chip {
  transition: border-color var(--ds-duration-fast) var(--ds-ease);
}

a.status-chip:hover {
  border-color: var(--ds-border-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------
   Stat wells & key-value clusters (§4.2 nested wells, §4.7)
   ------------------------------------------------------------ */

.outcome-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--ds-grid-gap);
}

.outcome-stat-grid > div {
  background: var(--ds-bg-raised);
  border-radius: var(--ds-radius-md);
  padding: 12px 16px;
  min-width: 0;
}

.outcome-stat-grid > div strong {
  font-family: var(--ds-font-mono);
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--ds-text-primary);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-context-grid,
.snapshot-agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--ds-grid-gap);
}

.run-context-card,
.agent-card,
.source-packet-card {
  padding: 12px 16px;
  background: var(--ds-bg-raised);
  border-radius: var(--ds-radius-md);
  text-decoration: none;
  display: block;
  color: inherit;
  min-width: 0;
}

.run-context-card p {
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-secondary);
  margin-top: 8px;
}

.run-context-card strong {
  display: block;
  font-family: var(--ds-font-mono);
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--ds-text-primary);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------
   Data lists (§4.3)
   ------------------------------------------------------------ */

.task-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ds-border-subtle);
}

.task-list-item {
  padding: 12px var(--ds-card-padding);
  border-bottom: 1px solid var(--ds-border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background var(--ds-duration-fast) var(--ds-ease);
  text-decoration: none;
}

.task-list-item:hover {
  background: var(--ds-bg-raised);
}

.task-list-item.is-selected {
  background: var(--ds-bg-raised);
  box-shadow: inset 2px 0 0 var(--ds-brand);
}

.task-list-item--compact {
  min-height: var(--ds-row-height);
  padding: 8px 16px;
  gap: 4px;
  justify-content: center;
}

.task-list-item--compact strong {
  white-space: nowrap;
}

.task-title {
  font-family: var(--ds-font-mono);
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-primary);
}

.task-copy {
  font-size: 13px;
  line-height: 20px;
  color: var(--ds-text-secondary);
}

.task-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.synthesis-copy {
  white-space: pre-wrap;
}

/* ------------------------------------------------------------
   Section disclosure (§4.10)
   ------------------------------------------------------------ */

.progressive-detail {
  border-top: 1px solid var(--ds-border-subtle);
}

.progressive-detail summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  cursor: pointer;
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  color: var(--ds-text-primary);
  list-style: none;
}

.progressive-detail summary::-webkit-details-marker {
  display: none;
}

.progressive-detail summary::before {
  content: '';
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
  background-size: 16px;
  transition: transform 150ms var(--ds-ease);
}

.progressive-detail[open] summary::before {
  transform: rotate(90deg);
}

.progressive-detail > div,
.progressive-detail > section {
  padding: 0 0 16px 24px;
}

/* ------------------------------------------------------------
   Selection trace table
   ------------------------------------------------------------ */

.trace-table {
  display: flex;
  flex-direction: column;
  font-family: var(--ds-font-mono);
  font-size: 12px;
  line-height: 16px;
}

.trace-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.6fr) repeat(4, minmax(64px, 1fr)) 88px;
  gap: 8px;
  align-items: center;
  min-height: var(--ds-row-height);
  padding: 4px 0;
  border-bottom: 1px solid var(--ds-border-subtle);
  transition: background var(--ds-duration-fast) var(--ds-ease);
}

.trace-row:hover {
  background: var(--ds-bg-raised);
}

.trace-row:last-child {
  border-bottom: none;
}

.trace-row strong {
  color: var(--ds-text-primary);
  font-weight: 500;
}

.trace-row span {
  color: var(--ds-text-secondary);
}

.trace-row .trace-selected {
  color: var(--ds-success);
}

.trace-row .trace-considered {
  color: var(--ds-text-tertiary);
}

/* ------------------------------------------------------------
   Flash toast (§4.9)
   ------------------------------------------------------------ */

.flash-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--ds-bg-raised);
  border: 1px solid var(--ds-border-default);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-overlay);
  color: var(--ds-text-primary);
  font-size: 13px;
  line-height: 20px;
}

.flash-toast::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-text-tertiary);
}

.flash-toast--error::before {
  background: var(--ds-danger);
}

.flash-toast--ok::before {
  background: var(--ds-success);
}

/* ------------------------------------------------------------
   Common utilities
   ------------------------------------------------------------ */

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.meta-item strong {
  font-family: var(--ds-font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--ds-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flex-wrap {
  flex-wrap: wrap;
}

.justify-between {
  justify-content: space-between;
}

.p-4 {
  padding: var(--ds-card-padding);
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.pb-4 {
  padding-bottom: 16px;
}

.border-b {
  border-bottom: 1px solid var(--ds-border-subtle);
}

/* ------------------------------------------------------------
   Graph stage (§4.12)
   ------------------------------------------------------------ */

#lattice-graph {
  background: var(--ds-bg-inset);
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  border-radius: var(--ds-radius-md);
  min-height: 34rem;
  overflow: hidden;
}

#lattice-graph svg {
  display: block;
  height: auto;
  width: 100%;
}

.graph-node {
  cursor: pointer;
}

.graph-node:focus {
  outline: none;
}

.graph-node text {
  pointer-events: none;
  font-family: var(--ds-font-mono);
  font-size: 12px;
  fill: var(--ds-text-primary);
}

.swarm-links line {
  stroke: var(--ds-border-default);
  stroke-width: 1px;
}

.swarm-node circle {
  fill: var(--ds-bg-surface);
  stroke: var(--ds-border-default);
  stroke-width: 1px;
  transition: all 0.3s ease;
}

.swarm-node:hover circle {
  fill: var(--ds-bg-raised);
  stroke: var(--ds-border-strong);
  stroke-width: 1.5px;
}

.swarm-node-initial {
  fill: var(--ds-text-primary);
  font-family: var(--ds-font-mono);
  font-size: 4px;
  pointer-events: none;
}

.swarm-node-name {
  fill: var(--ds-text-secondary);
  font-family: var(--ds-font-mono);
  font-size: 2.5px;
  pointer-events: none;
}

.swarm-node--isolated circle {
  stroke: var(--ds-border-subtle);
  fill: var(--ds-bg-surface);
}

.swarm-node--isolated .swarm-node-initial {
  fill: var(--ds-text-tertiary);
}

.swarm-node--active circle {
  stroke: var(--ds-brand);
  stroke-width: 1.5px;
}

.swarm-node--active .swarm-node-initial {
  fill: var(--ds-brand);
}

ul {
  padding-left: 20px;
}

li {
  margin-top: 4px;
}

@media (max-width: 768px) {
  .operator-shell {
    flex-direction: column;
  }

  .operator-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--ds-border-subtle);
    padding: 12px 16px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: auto;
    position: static;
    gap: 16px;
  }

  .operator-sidebar .operator-brand {
    margin-bottom: 0;
    padding: 0;
  }

  .operator-sidebar .operator-nav {
    flex-direction: row;
    overflow-x: auto;
    margin-bottom: 0;
    gap: 4px;
    scrollbar-width: none;
  }

  .operator-nav::-webkit-scrollbar {
    display: none;
  }

  .operator-nav-link {
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .operator-nav--primary {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
    border-right: 1px solid var(--ds-border-subtle);
    padding-right: 12px;
    margin-right: 12px;
  }

  .dashboard {
    padding: 16px;
  }

  .empty-panel {
    padding: 40px 20px;
  }

  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 20px;
    line-height: 28px;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-heading--flush {
    flex-direction: row;
    align-items: flex-start;
  }

  .outcome-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .trace-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .trace-row strong {
    flex-basis: 100%;
  }
}

/* ------------------------------------------------------------
   Operator login + session
   ------------------------------------------------------------ */

.operator-login-viewport {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--ds-bg-page);
}

.operator-login-panel {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.operator-login-brand {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ds-text-secondary);
}

.operator-login-hint {
  color: var(--ds-text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.operator-login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.operator-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.operator-login-field > span {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ds-text-secondary);
}

.operator-login-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.operator-login-error {
  color: var(--ds-danger);
  font-size: 12px;
  line-height: 16px;
}

.operator-session {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--ds-border-subtle);
}

.operator-signout {
  height: var(--ds-control-height-sm);
  padding: 0 10px;
  font-size: 12px;
  color: var(--ds-text-secondary);
}

.operator-signout:hover {
  color: var(--ds-text-primary);
}
