/* =========================================================================
   VGG x Hyphen demo — Linear/Stripe/Level-inspired design system
   Drop-in replacement for the prior stylesheet; HTML class hooks unchanged.
   ========================================================================= */

@import url("https://rsms.me/inter/inter.css");

:root {
  color-scheme: light;

  /* ---------- Neutral palette ---------- */
  --bg:            #ffffff;
  --bg-subtle:     #fafafa;
  --bg-muted:      #f5f5f5;
  --panel:         #ffffff;
  --panel-soft:    #fafafa;

  --ink:           #0a0a0a;
  --ink-2:         #18181b;
  --ink-soft:      #3f3f46;
  --muted:         #71717a;
  --muted-2:       #a1a1aa;

  --line:          #e4e4e7;
  --line-strong:   #d4d4d8;
  --line-subtle:   #f1f1f3;

  /* ---------- Single accent (Linear purple) ---------- */
  --accent:        #5e6ad2;
  --accent-hover:  #4f5bc4;
  --accent-soft:   rgba(94, 106, 210, 0.08);
  --accent-ring:   rgba(94, 106, 210, 0.18);

  /* ---------- Status (muted) ---------- */
  --success:       #059669;
  --success-soft:  rgba(5, 150, 105, 0.08);
  --warning:       #b45309;
  --warning-soft:  rgba(180, 83, 9, 0.08);
  --danger:        #dc2626;
  --danger-soft:   rgba(220, 38, 38, 0.08);

  /* ---------- Sidebar (light, Stripe-style) ---------- */
  --sidebar-bg:        #fafafa;
  --sidebar-fg:        #18181b;
  --sidebar-muted:     #71717a;
  --sidebar-line:      #ececef;
  --sidebar-hover:     #f1f1f3;
  --sidebar-active:    #ffffff;

  /* ---------- Geometry ---------- */
  --radius-sm:  6px;
  --radius:     8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow:    0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.04);

  --sidebar-width: 248px;

  --font-ui:      "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-ui);
  --font-mono:    ui-monospace, "SF Mono", Menlo, Monaco, "JetBrains Mono", Consolas, monospace;
}

@supports (font-variation-settings: normal) {
  :root { --font-ui: "Inter var", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a       { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button  { cursor: pointer; }
strong  { color: var(--ink); font-weight: 600; }
code, .kbd { font-family: var(--font-mono); }

/* =========================================================================
   App shell
   ========================================================================= */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  border-right: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.brand-copy   { display: grid; gap: 1px; }
.brand-kicker {
  font-size: 11px;
  font-weight: 500;
  color: var(--sidebar-muted);
  letter-spacing: 0;
  text-transform: none;
}
.brand-title  {
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-fg);
  letter-spacing: -0.01em;
}

.sidebar-group { display: grid; gap: 6px; }

.sidebar-label {
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--sidebar-muted);
  text-transform: none;
  letter-spacing: 0;
}

.sidebar-nav { display: grid; gap: 1px; }

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-link span:last-child {
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 500;
}
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}
.sidebar-link.active {
  background: var(--sidebar-active);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.sidebar-link.active span:last-child { color: var(--muted); }

.sidebar-card {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}
.sidebar-card .info-label,
.sidebar-card .meta-label { color: var(--muted); }
.sidebar-card .info-value,
.sidebar-card .meta-value { color: var(--ink); }

.meta-stack,
.sidebar-note-list { display: grid; gap: 10px; }

.sidebar-note-item { display: grid; gap: 2px; }
.sidebar-note-item strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.sidebar-note-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* =========================================================================
   Main column
   ========================================================================= */

.app-main {
  min-width: 0;
  padding: 16px 28px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.topbar-title  { display: grid; gap: 2px; }
.topbar-kicker {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}
.topbar-title strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.topbar-actions,
.pill-row,
.action-row,
.metric-strip,
.surface-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.workspace { display: grid; gap: 20px; }

/* =========================================================================
   Page header & surfaces
   ========================================================================= */

.page-header,
.surface,
.metric-card,
.hero-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: none;
}

.page-header {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.page-header h1,
.surface-title h2,
.surface h3,
.metric-card h3,
.hero-card h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
}

.page-header h1 {
  margin-top: 8px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
}

.sub,
.body-copy,
.surface-note,
.helper-copy {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.page-header--narrow { grid-template-columns: 1fr; }
.page-header--narrow .sub { max-width: 72ch; }

/* Surface */
.surface,
.hero-card,
.metric-card { padding: 20px; }

.surface-tight { padding: 16px; }

.surface-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.surface-title { display: grid; gap: 4px; }

.surface-kicker {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.surface-title h2 { font-size: 16px; font-weight: 600; }
.surface h3        { font-size: 14px; font-weight: 600; }

/* =========================================================================
   Metric cards, summary cards
   ========================================================================= */

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
  padding: 16px;
  background: var(--panel);
}

.metric-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 8px;
}

.metric-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.metric-copy {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.summary-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.summary-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.summary-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

/* =========================================================================
   Pills, badges, eyebrows
   ========================================================================= */

.pill,
.badge,
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.badge {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}

.badge.rust,
.eyebrow.rust {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.purple {
  background: var(--accent-soft);
  color: var(--accent);
}

/* =========================================================================
   Layout grids
   ========================================================================= */

.panel-grid,
.info-grid,
.workflow-grid {
  display: grid;
  gap: 12px;
}

.panel-grid   { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.info-grid    { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.workflow-grid{ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* =========================================================================
   Forms
   ========================================================================= */

.field { display: grid; gap: 6px; }

.field label,
.field-legend {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
}

.input,
.select,
.textarea,
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input::placeholder,
.textarea::placeholder { color: var(--muted-2); }

.input:focus,
.select:focus,
.textarea:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.textarea,
.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

.readonly { background: var(--bg-subtle); color: var(--muted); }

/* =========================================================================
   Buttons
   ========================================================================= */

.button-primary,
.button-secondary,
.button-ghost,
button {
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button-primary,
button.button-primary,
button:not(.button-secondary):not(.button-ghost):not(.link-button):not(.tab-button) {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.button-primary:hover,
button.button-primary:hover,
button:not(.button-secondary):not(.button-ghost):not(.link-button):not(.tab-button):hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  transform: none;
}

.button-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.button-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--line-strong);
  transform: none;
}

.button-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}
.button-ghost:hover {
  background: var(--bg-subtle);
  color: var(--ink);
  transform: none;
}

.button-small { padding: 5px 9px; font-size: 12px; }

.link-button {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 0;
  font-weight: 500;
}
.link-button:hover { color: var(--accent-hover); }

/* =========================================================================
   Status / result / helper boxes
   ========================================================================= */

.status-box,
.result-box,
.helper-box,
.timeline-box {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--ink-soft);
  font-size: 13px;
}

.status-box.success,
.result-box.success {
  border-color: rgba(5, 150, 105, 0.24);
  background: var(--success-soft);
  color: var(--success);
}

.status-box.warn,
.result-box.warn {
  border-color: rgba(180, 83, 9, 0.24);
  background: var(--warning-soft);
  color: var(--warning);
}

.status-box.error,
.result-box.error {
  border-color: rgba(220, 38, 38, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

/* =========================================================================
   Workspace grids
   ========================================================================= */

.workspace-grid {
  display: grid;
  gap: 20px;
}

.workspace-grid--intake     { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); }
.workspace-grid--dashboard  { grid-template-columns: 340px minmax(0, 1fr); }
.workspace-grid--evaluation { grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); }

.stack { display: grid; gap: 20px; }

/* =========================================================================
   Cards (workflow / lens) + info tiles
   ========================================================================= */

.workflow-card,
.lens-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
}

.workflow-card header,
.lens-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.workflow-card h3,
.lens-card h3 { font-size: 15px; font-weight: 600; }

.info-tile,
.log-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}

.info-label,
.meta-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.info-value,
.meta-value {
  display: block;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}

/* =========================================================================
   Lists
   ========================================================================= */

.log-list,
.checklist,
.flow-list { display: grid; gap: 8px; }

.checklist,
.flow-list { list-style: none; padding: 0; margin: 0; }

.checklist li,
.flow-list li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 13px;
}

.checklist li::before,
.flow-list li::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.footer-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* SDK custom-element shims */
hyphen-task-sidebar,
hyphen-agent-console,
hyphen-doc-feed,
hyphen-data-grid {
  display: block;
  width: 100%;
}

/* =========================================================================
   DAG / diagram pieces
   ========================================================================= */

.diagram-surface { display: grid; gap: 16px; }
.dag-board       { display: grid; gap: 14px; }

.dag-lane {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
}

.lane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.lane-header h3 { font-size: 14px; font-weight: 600; }

.lane-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.dag-path {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.dag-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  color: var(--muted-2);
  font-weight: 400;
  font-size: 14px;
}

.dag-node {
  min-width: 180px;
  max-width: 240px;
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}

.dag-node .node-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.dag-node h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.dag-node p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
}

.dag-node.surface-node  .node-label { background: var(--accent-soft);  color: var(--accent); }
.dag-node.table-node    .node-label { background: var(--success-soft); color: var(--success); }
.dag-node.approval-node .node-label { background: var(--warning-soft); color: var(--warning); }
.dag-node.logic-node    .node-label { background: var(--bg-muted);     color: var(--ink-soft); }

.dag-branch-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.dag-branch {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: var(--bg-subtle);
  display: grid;
  gap: 8px;
}

.branch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.branch-head strong {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.branch-head .branch-pill {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.branch-pill.success { background: var(--success-soft); color: var(--success); }
.branch-pill.warn    { background: var(--warning-soft); color: var(--warning); }

/* =========================================================================
   Tables (data-style lists)
   ========================================================================= */

.table-list { display: grid; gap: 10px; }

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 180px) 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}

.table-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.table-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.connection-compact      { display: grid; gap: 10px; margin-bottom: 12px; }
.connection-body.is-collapsed { display: none; }

/* =========================================================================
   Progress
   ========================================================================= */

.progress-grid { display: grid; gap: 14px; }

.progress-stat-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.progress-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.progress-stat strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.progress-stat span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
  border: none;
}

.progress-bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.progress-checklist,
.timeline-list { display: grid; gap: 8px; }

.check-item,
.timeline-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.check-item {
  grid-template-columns: 20px 1fr;
  align-items: start;
}

.check-item.is-complete {
  border-color: rgba(5, 150, 105, 0.2);
  background: var(--success-soft);
}

.check-indicator {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  margin-top: 1px;
}

.check-item.is-complete .check-indicator {
  background: var(--success);
  color: #fff;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline-head strong { font-size: 13px; font-weight: 600; }
.timeline-head span,
.timeline-meta,
.timeline-item p     { color: var(--muted); font-size: 12px; }
.timeline-meta,
.timeline-item p     { margin: 0; line-height: 1.5; }

/* =========================================================================
   Tabs
   ========================================================================= */

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  width: fit-content;
}

.tab-button {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.tab-button:hover { color: var(--ink); background: rgba(0,0,0,0.025); }

.tab-button.active {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

/* =========================================================================
   Table shell + app table
   ========================================================================= */

.table-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: auto;
  background: #fff;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13px;
}

.app-table th,
.app-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-subtle);
  vertical-align: top;
}

.app-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
}

.app-table td {
  color: var(--ink-soft);
  line-height: 1.5;
}

.app-table tbody tr:last-child td { border-bottom: none; }
.app-table tbody tr:hover td      { background: var(--bg-subtle); }

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

/* =========================================================================
   Process strip
   ========================================================================= */

.process-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.process-step {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.process-step strong {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.process-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.process-step code { width: fit-content; }

code {
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  font-size: 0.92em;
  color: var(--ink-soft);
}

/* =========================================================================
   Markdown view (used on map page)
   ========================================================================= */

.markdown-view { display: grid; gap: 16px; }

.markdown-view > *:first-child { margin-top: 0; }

.markdown-view h1,
.markdown-view h2,
.markdown-view h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
}

.markdown-view h1 { font-size: clamp(24px, 3vw, 32px); }
.markdown-view h2 { margin-top: 8px; font-size: 20px; }
.markdown-view h3 { font-size: 16px; }

.markdown-view p,
.markdown-view li {
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 14px;
}

.markdown-view ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.markdown-view code {
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  font-size: 0.92em;
}

.markdown-view pre code {
  padding: 0;
  border: none;
  background: transparent;
}

.markdown-view blockquote {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0;
  background: var(--accent-soft);
  color: var(--ink-soft);
}

.markdown-view hr {
  width: 100%;
  height: 1px;
  border: none;
  background: var(--line);
  margin: 4px 0;
}

/* =========================================================================
   Mermaid container + diagram toolbar + modal
   ========================================================================= */

.mermaid-shell {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
}

.mermaid { min-width: 760px; }

.diagram-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.diagram-toolbar-copy { font-size: 13px; color: var(--muted); }

.diagram-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.diagram-toolbar button {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
}

.diagram-toolbar button:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.diagram-toolbar button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.mermaid-shell svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.mermaid-shell.is-panning svg { cursor: grabbing; }

.mermaid-shell.is-interactive svg .node,
.mermaid-shell.is-interactive svg .cluster,
.mermaid-shell.is-interactive svg .cluster-label { cursor: pointer; }

.mermaid-shell.is-interactive svg .node > rect,
.mermaid-shell.is-interactive svg .node > polygon,
.mermaid-shell.is-interactive svg .node > path,
.mermaid-shell.is-interactive svg .cluster > rect {
  transition: transform 160ms ease, filter 160ms ease, stroke-width 160ms ease, fill 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.mermaid-shell.is-interactive svg .node:hover > rect,
.mermaid-shell.is-interactive svg .node:hover > polygon,
.mermaid-shell.is-interactive svg .node:hover > path,
.mermaid-shell.is-interactive svg .cluster:hover > rect {
  filter: drop-shadow(0 4px 8px rgba(16, 24, 40, 0.08));
  stroke-width: 2px;
}

.mermaid-shell.is-interactive svg .node.is-focused > rect,
.mermaid-shell.is-interactive svg .node.is-focused > polygon,
.mermaid-shell.is-interactive svg .node.is-focused > path,
.mermaid-shell.is-interactive svg .cluster.is-focused > rect {
  stroke-width: 2.2px;
  filter: drop-shadow(0 6px 14px rgba(16, 24, 40, 0.10));
}

.mermaid-shell.is-interactive svg .node.is-dimmed,
.mermaid-shell.is-interactive svg .cluster.is-dimmed,
.mermaid-shell.is-interactive svg .edgePath.is-dimmed,
.mermaid-shell.is-interactive svg .edgeLabel.is-dimmed { opacity: 0.28; }

body.modal-open { overflow: hidden; }

.diagram-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.diagram-modal.is-open { display: flex; }

.diagram-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.5);
}

.diagram-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(96vw, 1680px);
  height: min(92vh, 1040px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 48px -8px rgba(16, 24, 40, 0.18);
}

.diagram-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.diagram-modal-body { min-height: 0; }

.diagram-modal-body .mermaid-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.diagram-modal-body .mermaid {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.diagram-modal-body .mermaid svg {
  width: 100%;
  height: 100%;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 1220px) {
  .workspace-grid--dashboard,
  .workspace-grid--evaluation,
  .workspace-grid--intake,
  .page-header { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }

  .app-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-line);
  }

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

  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .app-main { padding: 12px 16px 32px; }

  .page-header,
  .surface,
  .metric-card,
  .hero-card { padding: 16px; }

  .metric-grid,
  .dag-branch-grid,
  .progress-stat-row,
  .process-strip,
  .summary-grid { grid-template-columns: 1fr; }

  .table-row { grid-template-columns: 1fr; }
}
