/* ── Catalog Shell ───────────────────────────── */
.catalog-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 20px 40px;
}

/* ── Tab Navigation ─────────────────────────── */
.catalog-tabs {
  display: flex;
  gap: 2px;
  padding: 12px 0 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.catalog-tab {
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-tertiary);
  cursor: pointer;
  transition: all 120ms;
}

.catalog-tab:hover {
  color: var(--ink);
}

.catalog-tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

/* ── View Display ───────────────────────────── */
.catalog-view {
  display: none;
  padding-top: 20px;
}

.catalog-view.active {
  display: block;
}

/* ── View Header ────────────────────────────── */
.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.view-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.view-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.view-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--ink-secondary);
  white-space: nowrap;
}

/* ── Card Grid ──────────────────────────────── */
.cat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.cat-card {
  position: relative;
  padding: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 140ms, box-shadow 140ms, border-color 140ms;
}

.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.cat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: linear-gradient(90deg, var(--accent), #0891b2, #6366f1);
}

.cat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}

.cat-card-category {
  display: inline-flex;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-inset);
  color: var(--ink-secondary);
  border-radius: 99px;
}

.cat-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.2;
}

.cat-card p {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin: 0;
}

.cat-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-tertiary);
}

.cat-card-detail-link {
  color: var(--accent-text);
  font-weight: 600;
}

/* ── Detail View ────────────────────────────── */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.detail-back:hover {
  background: var(--accent-soft);
}

.detail-hero-card {
  padding: 24px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}

.detail-hero-card .view-label {
  color: rgba(255, 255, 255, 0.7);
}

.detail-hero-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 6px 0 10px;
}

.detail-hero-card .detail-summary {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  max-width: 700px;
}

.detail-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.detail-meta-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.detail-section-card {
  padding: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.detail-section-card + .detail-section-card {
  margin-top: 14px;
}

.detail-section-card h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
}

.detail-section-card h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-tertiary);
  margin: 0 0 8px;
}

.detail-section-card p,
.detail-section-card li {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.6;
}

.detail-section-card ul {
  padding-left: 16px;
  margin: 6px 0 0;
}

.detail-def-item {
  padding: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.detail-def-path {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
  word-break: break-all;
}

.detail-def-item p {
  margin: 4px 0 0;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-sidebar-card {
  padding: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.detail-sidebar-card h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-tertiary);
  margin: 0 0 8px;
}

.detail-path-chip {
  display: inline-block;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-inset);
  border-radius: var(--radius-xs);
  margin: 2px;
  word-break: break-all;
}

.detail-related-link {
  display: block;
  padding: 4px 0;
  font-size: 13px;
  color: var(--accent-text);
  cursor: pointer;
}

.detail-related-link:hover {
  text-decoration: underline;
}

/* ── Doc Flow (Info / Wiki) ─────────────────── */
.doc-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 840px;
}

.doc-section-card {
  padding: 22px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.doc-section-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}

.doc-section-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 14px 0 8px;
}

.doc-section-card h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 6px;
}

.doc-section-card p {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.7;
  margin: 6px 0;
}

.doc-section-card ul,
.doc-section-card ol {
  padding-left: 18px;
  margin: 6px 0;
}

.doc-section-card li {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.7;
  margin: 3px 0;
}

.doc-section-card code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 5px;
  background: var(--bg-inset);
  border-radius: 3px;
}

.doc-section-card strong {
  color: var(--ink);
}

/* ── Pipeline Layout ────────────────────────── */
.doc-layout-split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.doc-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 60px;
  height: fit-content;
}

.doc-sidebar-box {
  padding: 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.doc-sidebar-box h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-tertiary);
  margin: 0 0 8px;
}

.doc-sidebar-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-sidebar-box li {
  margin: 4px 0;
}

.doc-sidebar-box a {
  font-size: 12px;
  color: var(--accent-text);
  text-decoration: none;
}

.doc-sidebar-box a:hover {
  text-decoration: underline;
}

.doc-main-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Tooling Grid ───────────────────────────── */
.cat-tooling-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.cat-tool-category {
  padding: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.cat-tool-category h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
}

.cat-tool-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-tool-item {
  padding: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cat-tool-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cat-tool-img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: var(--radius-xs);
  background: white;
  border: 1px solid var(--border);
  padding: 4px;
}

.cat-tool-img-fallback {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
  color: var(--ink-secondary);
  font-weight: 700;
  font-size: 16px;
}

.cat-tool-item h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.cat-tool-item p {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ── Relationship Graph ─────────────────────── */
.cat-graph-panel {
  padding: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow-x: auto;
}

.cat-relationship-graph {
  display: block;
  width: 100%;
  min-width: 900px;
  height: auto;
}

.cat-relationship-graph .graph-bg {
  fill: var(--bg-inset);
  rx: 16;
}

.cat-relationship-graph .graph-core {
  fill: var(--accent);
}

.cat-relationship-graph .graph-core-title {
  fill: white;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.cat-relationship-graph .graph-core-subtitle {
  fill: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cat-relationship-graph .graph-edge {
  fill: none;
  stroke: var(--ink-tertiary);
  stroke-width: 1.2;
  stroke-opacity: 0.3;
}

.cat-relationship-graph .graph-node {
  stroke: var(--bg-raised);
  stroke-width: 2.5;
}

.cat-relationship-graph .graph-label {
  fill: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  font-family: "IBM Plex Sans", sans-serif;
}

.cat-relationship-graph .graph-legend-text {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

/* ── Relationship Grid ──────────────────────── */
.cat-relationship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.cat-rel-card {
  padding: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.cat-rel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
  margin-bottom: 8px;
}

.cat-rel-head h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.cat-rel-summary {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin: 0 0 12px;
}

.cat-rel-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cat-rel-col {
  padding: 10px;
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
}

.cat-rel-col h4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-tertiary);
  margin: 0 0 6px;
}

.cat-rel-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cat-rel-col li {
  font-size: 12px;
  color: var(--ink-secondary);
  padding: 2px 0;
}

.cat-rel-col .cat-rel-link {
  color: var(--accent-text);
  cursor: pointer;
}

.cat-rel-col .cat-rel-link:hover {
  text-decoration: underline;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 900px) {
  .catalog-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .doc-layout-split {
    grid-template-columns: 1fr;
  }

  .doc-sidebar-panel {
    position: static;
  }

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

@media (max-width: 600px) {
  .catalog-shell {
    padding: 0 12px 32px;
  }

  .cat-card-grid {
    grid-template-columns: 1fr;
  }

  .cat-rel-columns {
    grid-template-columns: 1fr;
  }
}

/* ── Pipeline Flow Visual Cards ────────────── */
.pipe-flow-visual {
  padding: 22px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.pipe-quadrant-card {
  background: var(--q-bg);
  border: 1px solid var(--q-border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  transition: box-shadow 0.25s, border-color 0.25s;
}
.pipe-quadrant-card:hover {
  box-shadow: 0 0 20px var(--q-bg), 0 4px 16px rgba(0,0,0,0.12);
  border-color: var(--q-accent);
}

.pipe-q-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pipe-q-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.pipe-q-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--q-accent);
  opacity: 0.8;
}
.pipe-q-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.pipe-q-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  background: var(--q-bg);
  border: 1px solid var(--q-border);
  border-radius: 20px;
  color: var(--q-accent);
}

.pipe-q-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pipe-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.pipe-step-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.pipe-step-body {
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}
.pipe-step-arrow {
  flex-shrink: 0;
  width: 40px;
  height: 24px;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.pipe-signal-arrow {
  width: 40px;
  height: 24px;
  --accent: var(--q-accent, #6366f1);
}

.pipe-signal-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  overflow: hidden;
}
.pipe-signal-line {
  width: 100%;
  height: 36px;
  max-width: 600px;
}

@media (max-width: 600px) {
  .pipe-quadrant-card { padding: 14px; }
  .pipe-step-body { min-width: 0; }
  .pipe-step-arrow { display: none; }
}
