:root {
  /* Brand */
  --pmd-blue:       #1565C0;
  --pmd-blue-light: #E3F2FD;

  /* Dataspaces */
  --catx-blue:    #1E40AF;
  --catx-bg:      #EFF6FF;
  --mfgx-purple:  #6D28D9;
  --mfgx-bg:      #F5F3FF;

  /* Pipeline stages */
  --pmdco-green:  #065F46;
  --pmdco-bg:     #ECFDF5;
  --fuseki-amber: #92400E;
  --fuseki-bg:    #FFFBEB;
  --query-teal:   #0E7490;
  --query-bg:     #F0F9FF;

  /* Neutrals */
  --surface:      #FFFFFF;
  --surface-2:    #F8FAFC;
  --border:       #E2E8F0;
  --text-primary: #0F172A;
  --text-muted:   #64748B;

  /* Code */
  --code-bg:      #0F172A;
  --code-fg:      #E2E8F0;
  --code-comment: #64748B;
  --code-keyword: #93C5FD;
  --code-string:  #86EFAC;
  --code-number:  #FCA5A5;

  /* Layout */
  --max-width:    1200px;
  --radius:       8px;
  --radius-lg:    16px;
}

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

body {
  margin: 0;
  font-family: system-ui, 'Segoe UI', -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.625;
  color: var(--text-primary);
  background: var(--surface);
}

h1 { font-size: 2.5rem; margin: 0 0 0.5rem; line-height: 1.15; }
h2 { font-size: 1.75rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.5rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--pmd-blue); }
a:hover { text-decoration: none; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Navigation ── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav .container {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--pmd-blue);
}

/* ── Badges ── */
.badge-catx,
.badge-mfgx,
.badge-live,
.badge-cached {
  display: inline-block;
  border-radius: 9999px;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-catx    { background: var(--catx-blue);    color: #fff; }
.badge-mfgx    { background: var(--mfgx-purple);  color: #fff; }
.badge-live    { background: var(--query-teal);   color: #fff; }
.badge-cached  { background: var(--fuseki-amber); color: #fff; }

.assert-pass { color: #16a34a; font-weight: 600; }
.assert-fail { color: #dc2626; font-weight: 600; }
#source-json-assert ul { margin: 0.4rem 0 0 1.2rem; color: #dc2626; font-size: 0.85rem; }
#source-json-assert li { margin: 0.1rem 0; }

/* ── Hero ── */
#hero {
  padding: 5rem 0 4rem;
  text-align: center;
  background: linear-gradient(135deg, var(--pmd-blue-light) 0%, var(--mfgx-bg) 100%);
}
#hero .badges {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 1rem 0 2rem;
}
#hero img {
  max-width: 640px;
  width: 100%;
  margin: 1.5rem auto;
  display: block;
}
.cta-btn {
  display: inline-block;
  background: var(--pmd-blue);
  color: #fff;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s;
}
.cta-btn:hover { background: var(--catx-blue); color: #fff; }

/* ── Problem statement ── */
#problem {
  padding: 4rem 0;
  max-width: 800px;
  margin: 0 auto;
}
#problem .container { max-width: 800px; }
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.comparison-grid pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1.25rem;
  border-radius: var(--radius);
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 0;
}
.comparison-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Pipeline simulator ── */
#pipeline {
  padding: 4rem 0;
  background: var(--surface-2);
}
#pipeline h2 { text-align: center; margin-bottom: 2rem; }

.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 1rem;
  max-width: 720px;
  margin: 0 auto 2rem;
}
.pipeline-grid .row-span-merge {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}
.pipeline-grid .row-merge-arrow {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
}
.pipeline-grid .full-width {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.step-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  border: none;
  border-radius: var(--radius-lg);
  border-left: 4px solid currentColor;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: box-shadow 0.15s, transform 0.15s;
  width: 100%;
}
.step-btn:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}
.step-btn .step-sub {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 0.25rem;
}

/* Step colors */
.step-catx  { color: var(--catx-blue);    background: var(--catx-bg); }
.step-mfgx  { color: var(--mfgx-purple);  background: var(--mfgx-bg); }
.step-pmdco { color: var(--pmdco-green);  background: var(--pmdco-bg); }
.step-fuseki{ color: var(--fuseki-amber); background: var(--fuseki-bg); }
.step-query { color: var(--query-teal);   background: var(--query-bg); }
.step-assembly { color: var(--pmdco-green); background: var(--surface-2); border-left-color: var(--border); }

/* Step states */
.step-btn.step-active {
  box-shadow: 0 0 0 3px currentColor;
  transform: scale(1.02);
}
.step-btn.step-completed {
  opacity: 0.7;
  border-left-width: 6px;
}
.step-btn.step-completed::after {
  content: ' ✓';
  font-size: 0.85rem;
}

/* Pipeline arrows */
.pipeline-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 0.25rem;
}
.pipeline-merge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 720px;
}
.run-btn-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}
#run-btn {
  background: var(--pmd-blue);
  color: #fff;
  border: none;
  padding: 0.75rem 2.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
#run-btn:hover { background: var(--catx-blue); }
#run-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Result section ── */
#result {
  padding: 4rem 0;
}
.result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.result-header h2 { margin: 0; }
#result-badge { font-size: 0.8rem; }
#result-spinner { display: none; color: var(--text-muted); font-size: 0.9rem; }
#result-spinner.visible { display: inline; }

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.result-table th {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.result-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.875rem;
}
.result-table tr:nth-child(even) td { background: var(--surface-2); }
.result-table tr.row-catx td { border-left: 3px solid var(--catx-blue); }
.result-table tr.row-mfgx td { border-left: 3px solid var(--mfgx-purple); }

#rerun-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  margin-top: 1rem;
  display: block;
  transition: border-color 0.15s, color 0.15s;
}
#rerun-btn:hover { border-color: var(--pmd-blue); color: var(--pmd-blue); }

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: calc(100% - 2rem);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; color: #fff; }
.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  opacity: 0.8;
}
.modal-close:hover { opacity: 1; }
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 60vh;
  flex: 1;
}
.modal-body p { color: var(--text-primary); }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 1rem;
}
.modal-footer a,
.modal-footer button {
  font-size: 0.9rem;
}
.modal-footer button.modal-close-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
}
.modal-footer button.modal-close-btn:hover { background: var(--border); }

/* Modal header colors */
.modal-catx   .modal-header { background: var(--catx-blue); }
.modal-mfgx   .modal-header { background: var(--mfgx-purple); }
.modal-pmdco  .modal-header { background: var(--pmdco-green); }
.modal-fuseki .modal-header { background: var(--fuseki-amber); }
.modal-query  .modal-header { background: linear-gradient(90deg, var(--catx-blue), var(--mfgx-purple)); }
.modal-assembly .modal-header { background: var(--pmdco-green); }

/* ── Code blocks ── */
pre.code-block {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1.25rem;
  border-radius: var(--radius);
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  margin: 1rem 0;
  white-space: pre;
}
pre.code-block .kw  { color: var(--code-keyword); }
pre.code-block .str { color: var(--code-string); }
pre.code-block .num { color: var(--code-number); }
pre.code-block .cm  { color: var(--code-comment); font-style: italic; }

/* ── Tabs (Step C modal) ── */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}
.tab-btn {
  background: none;
  border: none;
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: var(--pmdco-bg);
  color: var(--pmdco-green);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Info box ── */
.info-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 1rem 0;
  color: var(--text-primary);
}

/* ── Section note ── */
.section-note {
  background: var(--pmd-blue-light);
  border-left: 4px solid var(--pmd-blue);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.875rem;
  margin: 1rem 0;
  color: var(--text-primary);
}

/* ── Detail pages ── */
.detail-content {
  padding: 3rem 0 5rem;
}
.back-link {
  display: inline-block;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.back-link:hover { color: var(--pmd-blue); }
.detail-section {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
}
.detail-section:first-of-type { border-top: none; }
.source-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ── Footer ── */
footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: 3rem 0;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.footer-links a { font-size: 0.9rem; }
.footer-built {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Scroll-reveal result highlight ── */
#result.highlighted {
  animation: highlight-flash 1.5s ease-out;
}
@keyframes highlight-flash {
  0%   { background: var(--pmd-blue-light); }
  100% { background: transparent; }
}

/* ══════════════════════════════════════════
   WORKFLOW DAG
══════════════════════════════════════════ */
.workflow-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

/* ── DAG canvas ── */
.dag-canvas {
  position: relative;
  width: 100%;
}
.dag-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}

/* ── Node rows ── */
.dag-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 0;
}
/* extra top margin only on the Fuseki row so the funnel stem has space */
#dag-conn-top + .dag-row {
  margin-top: 28px;
}
.dag-spacer { height: 56px; }

/* ── Workflow node card ── */
.wf-node {
  flex: 1;
  max-width: 220px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--border);
  padding: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.wf-node.catx    { border-left-color: var(--catx-blue); }
.wf-node.mfgx    { border-left-color: var(--mfgx-purple); }
.wf-node.pmdco   { border-left-color: var(--pmdco-green); }
.wf-node.assembly{ border-left-color: var(--text-muted); }
.wf-node.fuseki  { border-left-color: var(--fuseki-amber); }
.wf-node.query   { border-left-color: var(--query-teal); }

.wf-node.done {
  border-color: #22c55e;
  border-left-color: #22c55e;
  background: #f0fdf4;
}
.wf-node.running {
  box-shadow: 0 0 0 3px var(--pmd-blue);
}
.wf-node.error {
  border-color: #ef4444;
  border-left-color: #ef4444;
  background: #fef2f2;
}

.wf-node-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.wf-node-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.wf-node-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.wf-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 3px;
  transition: background 0.2s;
}
.wf-node.done .wf-status-dot { background: #22c55e; }
.wf-node.running .wf-status-dot {
  background: var(--pmd-blue);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.wf-checkmark {
  display: none;
  position: absolute;
  top: -8px; right: -8px;
  background: #22c55e;
  color: #fff;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 13px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.wf-node.done .wf-checkmark { display: flex; }

.wf-run-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.wf-run-btn:hover {
  background: var(--pmd-blue);
  border-color: var(--pmd-blue);
  color: #fff;
}
.wf-node.done .wf-run-btn {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}
.wf-run-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Fuseki pool node (wide, centered) */
.wf-node.fuseki-pool {
  max-width: 320px;
  text-align: center;
  margin: 0 auto;
}

/* ── CSS connectors ── */
@keyframes flow-down {
  from { background-position: 0 0; }
  to   { background-position: 0 10px; }
}
@keyframes flow-right {
  from { background-position: 0 0; }
  to   { background-position: 10px 0; }
}

/* Shared dashed line helper */
.dag-conn-line::before,
.dag-vert-line,
.dag-conn-stem {
  background-image: linear-gradient(to bottom, var(--border) 60%, transparent 60%);
  background-size: 2px 10px;
  background-repeat: repeat-y;
  transition: background-image 0.3s;
}

/* Three-line funnel: source nodes → merge bar → Fuseki */
.dag-connector-row {
  position: relative;
  height: 40px;            /* lines go down 40px to merge bar */
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  overflow: visible;       /* stem extends below */
}
.dag-conn-line {
  flex: 1;
  position: relative;
}
.dag-conn-line::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 2px;             /* stop just above the merge bar */
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
}
.dag-conn-line.line-active::before {
  background-image: linear-gradient(to bottom, #22c55e 60%, transparent 60%);
  animation: flow-down 0.5s linear infinite;
}

/* Horizontal merge bar — split into left half (catx→center) and right half (center→asm) */
.dag-conn-merge-l,
.dag-conn-merge-r {
  position: absolute;
  bottom: 0;
  height: 2px;
  background-image: linear-gradient(to right, var(--border) 60%, transparent 60%);
  background-size: 10px 2px;
  background-repeat: repeat-x;
  transition: background-image 0.3s;
}
.dag-conn-merge-l {
  left: calc(100% / 6);   /* catx-line center (space-around: 1/6) */
  right: 50%;
}
.dag-conn-merge-r {
  left: 50%;
  right: calc(100% / 6);  /* asm-line center (space-around: 5/6) */
}
.dag-conn-merge-l.line-active {
  background-image: linear-gradient(to right, #22c55e 60%, transparent 60%);
  animation: flow-right 0.5s linear infinite;
}
.dag-conn-merge-r.line-active {
  background-image: linear-gradient(to right, #22c55e 60%, transparent 60%);
  animation: flow-left 0.5s linear infinite;
}
@keyframes flow-left {
  from { background-position: 0 0; }
  to   { background-position: -10px 0; }
}

/* Center stem: from merge bar down to Fuseki node */
.dag-conn-stem {
  position: absolute;
  bottom: -28px;           /* extends 28px below the connector row */
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 28px;
}
.dag-conn-stem.line-active {
  background-image: linear-gradient(to bottom, #22c55e 60%, transparent 60%);
  animation: flow-down 0.5s linear infinite;
}

/* Simple vertical connector between single nodes */
.dag-simple-conn {
  display: flex;
  justify-content: center;
  height: 36px;
}
.dag-vert-line {
  width: 2px;
  height: 100%;
}
.dag-vert-line.line-active {
  background-image: linear-gradient(to bottom, #22c55e 60%, transparent 60%);
  animation: flow-down 0.5s linear infinite;
}

/* Downward arrow tip on simple connectors */
.dag-simple-conn::after {
  content: '▾';
  display: block;
  position: absolute;
  margin-top: -4px;
  font-size: 0.75rem;
  color: var(--border);
  line-height: 1;
}

/* ── Reset + controls row ── */
.workflow-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
}
#reset-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
#reset-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
#run-all-btn {
  background: var(--pmd-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s;
}
#run-all-btn:hover { background: #1a56c4; }
#run-all-btn:disabled { background: var(--text-muted); cursor: not-allowed; }

/* ── KG Inspector ── */
.kg-inspector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 80px;
}
.kg-inspector h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.kg-inspector-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.kg-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.kg-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.kg-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.kg-stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kg-stat-value {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-width: 2.5rem;
  text-align: right;
}
.kg-stat-value.loading { color: var(--text-muted); font-weight: 400; }
.kg-stat-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.kg-refresh-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: border-color 0.15s, color 0.15s;
}
.kg-refresh-btn:hover { border-color: var(--pmd-blue); color: var(--pmd-blue); }

.kg-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.kg-query-section h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kg-query-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.kg-query-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.kg-run-query-btn {
  flex-shrink: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--pmd-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.kg-run-query-btn:hover { background: #1a56c4; }
.kg-latest-result {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.kg-latest-result.has-data {
  color: var(--text-primary);
  font-style: normal;
}

/* Dependency warning */
.wf-dep-badge {
  display: none;
  font-size: 0.7rem;
  color: var(--fuseki-amber);
  background: var(--fuseki-bg);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  margin-top: 0.4rem;
}
.wf-node.dep-missing .wf-dep-badge { display: block; }

/* Mark complete button inside modal */
.modal-complete-btn,
.step-complete-btn {
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.modal-complete-btn:hover,
.step-complete-btn:hover { background: #16a34a; }

/* ── Step-modal UI ── */
.step-header {
  margin-bottom: 1rem;
}
.step-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  margin-bottom: 0.35rem;
}
.step-timer-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.step-timer-fill {
  height: 100%;
  width: 0%;
  background: #22c55e;
  transition: width 0.35s ease;
}
.step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.6rem;
}
.step-body-text {
  color: var(--text-primary);
  margin: 0 0 0.75rem;
  line-height: 1.55;
}
.step-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  width: 100%;
}
.step-skip-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.step-skip-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  transition: background 0.15s;
}
.step-skip-btn:hover { background: var(--surface-hover); }

