/* ═══════════════════════════════════════════════
   Seampoint Map — Design System
   Plain CSS, no preprocessor, no framework.
   Colors, typography, and components from briefing-v2 prototype.
   ═══════════════════════════════════════════════ */

:root {
  --navy: #07192E;
  --navy-light: #0d2440;
  --navy-mid: #143F68;
  --gold: #EEC21B;
  --gold-light: #F4DE82;
  --gold-faint: #fdf8e8;
  --gold-bg: #fefbf0;
  --text: #1a2a3a;
  --text-light: #4a5d70;
  --text-muted: #8196AC;
  --border: #e2e8f0;
  --bg: #ffffff;
  --bg-warm: #fdfcfa;
  --green: #2d8a6e;
  --green-light: #e8f5ef;
  --blue: #5b8fd4;
  --blue-light: #edf4fd;
  --amber: #c4882a;
  --amber-light: #fef8ee;
  --red: #b45252;
  --red-light: #fef2f2;
  --purple: #7c5cbf;
  --purple-light: #f3f0fa;
  --bg-alt: #f8f9fa;
  --coral: #e8856c;
  --coral-light: #fdf0ec;
  --slate: #7a8a9c;
  --slate-light: #f0f2f5;

  /* Agent type chart colors — derived from brand palette */
  --chart-auto: #07192E;       /* Deep Navy — autonomous */
  --chart-auto-light: #e8ecf0;
  --chart-verified: #143F68;   /* Dark Blue — verification_gated */
  --chart-verified-light: #e9eef4;
  --chart-guided: #8196AC;     /* Gray Blue — guidance */
  --chart-guided-light: #edf1f5;
  --chart-assist: #EEC21B;     /* Gold — assistant */
  --chart-assist-light: #fdf8e8;
  --chart-redesign: #F4DE82;   /* Gold Tint — redesign */
  --chart-redesign-light: #fefbf0;
}

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

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html { scroll-behavior: smooth; }

/* ═══════════════ Typography ═══════════════ */
h1, h2, h3 { font-family: 'Source Serif 4', 'Georgia', serif; }
h1 { font-size: 32px; font-weight: 700; line-height: 1.2; color: var(--navy); margin-bottom: 12px; }
h2 { font-size: 24px; font-weight: 700; line-height: 1.3; color: var(--navy); margin-bottom: 8px; }
h3 { font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.lead { font-size: 18px; line-height: 1.65; color: var(--text-light); margin-bottom: 20px; }
p { font-size: 15px; line-height: 1.7; color: var(--text); margin-bottom: 16px; }
.muted { color: var(--text-muted); }
.section-hint { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.section-microcopy {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: -4px 0 10px 0;
  max-width: 720px;
}
.entity-section > .section-microcopy {
  display: block;
  margin: 2px 0 10px 0;
  font-size: 11px;
}
.light { color: var(--text-light); }
.divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ═══════════════ App Shell ═══════════════ */
.app-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; font-size: 15px; color: var(--text-muted);
}
.app-loading-spinner {
  width: 24px; height: 24px; border: 2px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════ Engagement Picker ═══════════════ */
/* Hero header */
.picker-hero {
  background: var(--navy); padding: 40px 0 36px; margin-bottom: 32px;
}
.picker-hero-inner {
  max-width: 760px; margin: 0 auto; padding: 0 32px;
}
.picker-brand { margin-bottom: 6px; }
.picker-product {
  font-family: 'Source Serif 4', Georgia, serif; font-size: 15px; font-weight: 700;
  color: var(--gold); letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 0;
}
.picker-tagline {
  font-size: 13px; color: rgba(255,255,255,0.45); margin-top: 8px;
}

/* Content area */
.picker-page { max-width: 760px; margin: 0 auto; padding: 0 32px 60px; }
.picker-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.picker-header h2 {
  font-family: 'Source Serif 4', Georgia, serif; font-size: 22px; font-weight: 700;
  color: var(--navy); margin: 0;
}

/* Engagement list */
.picker-list { list-style: none; }
.picker-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px; cursor: pointer; transition: all 0.15s;
  text-decoration: none; color: inherit;
}
.picker-item:hover {
  border-color: var(--gold); box-shadow: 0 2px 8px rgba(238,194,27,0.12);
}
.picker-item-name {
  font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 2px;
}
.picker-item-meta {
  font-size: 12px; color: var(--text-muted);
}
.picker-item-arrow { font-size: 18px; color: var(--text-muted); }
.picker-item-status {
  display: inline-block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 3px; margin-left: 8px;
}
.picker-item-status.ready { background: var(--green-light); color: var(--green); }
.picker-item-status.running { background: var(--amber-light); color: var(--amber); }
.picker-item-status.incomplete { background: var(--slate-light); color: var(--slate); }

/* ═══════════════ Navigation Rail ═══════════════ */
.nav-rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: 260px;
  background: var(--navy); color: #fff; z-index: 100;
  display: flex; flex-direction: column; overflow-y: auto;
}
.nav-brand { padding: 24px 24px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.nav-brand-logo { margin-bottom: 4px; }
.nav-brand-logo img { height: 22px; width: auto; display: block; }
.nav-brand-product { font-family: 'Source Serif 4', Georgia, serif; font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 16px; }
.nav-back {
  display: block; font-size: 12px; color: rgba(255,255,255,0.35);
  text-decoration: none; padding: 4px 0; cursor: pointer; transition: color 0.15s;
}
.nav-back:hover { color: rgba(255,255,255,0.6); }
.nav-company { padding: 20px 24px 4px; }
.nav-company-name { font-size: 17px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.nav-company-detail { font-size: 12px; color: rgba(255,255,255,0.45); line-height: 1.5; }
.nav-mode-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px; padding: 3px 8px;
  border-radius: 3px; background: rgba(238,194,27,0.15); color: var(--gold); margin-top: 8px;
}
.nav-sections { flex: 1; padding: 8px 0; }
.nav-sections-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,0.3); padding: 0 24px; margin-bottom: 2px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: flex-start; padding: 3px 24px; cursor: pointer;
  transition: all 0.15s; text-decoration: none; color: rgba(255,255,255,0.6); gap: 12px;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(238,194,27,0.1); color: #fff; border-right: 2px solid var(--gold); }
.nav-item-num { font-size: 11px; font-weight: 700; color: var(--gold); min-width: 18px; padding-top: 2px; opacity: 0.7; }
.nav-item.active .nav-item-num { opacity: 1; }
.nav-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.nav-item-title { font-size: 13px; font-weight: 500; line-height: 1.3; display: block; }
.nav-item-hint { font-size: 11px; color: rgba(255,255,255,0.3); display: block; line-height: 1.35; }
.nav-item.active .nav-item-hint { color: rgba(255,255,255,0.45); }
.nav-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.06); }
.nav-footer-link {
  display: block; font-size: 12px; color: rgba(255,255,255,0.35);
  text-decoration: none; padding: 6px 0; cursor: pointer; transition: color 0.15s;
}
.nav-footer-link:hover { color: rgba(255,255,255,0.6); }

/* ═══════════════ Nav Run Button & Pipeline Status ═══════════════ */
.nav-run-btn {
  width: 24px; height: 24px; padding: 0; border: none; border-radius: 4px;
  background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700;
  cursor: pointer; flex-shrink: 0; line-height: 24px; text-align: center;
}
.nav-run-btn:hover { filter: brightness(1.1); }
.nav-run-btn:disabled { opacity: 0.5; cursor: default; }
#nav-pipeline-status.running {
  color: var(--gold); font-weight: 600;
}
.nav-item-active {
  border-left: 3px solid var(--gold) !important;
  background: rgba(255,255,255,0.06);
}

/* ═══════════════ Briefing Iframe Toolbar ═══════════════ */
.briefing-iframe-toolbar {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 199;
  display: flex; align-items: center; gap: 12px;
  background: var(--navy); border-radius: 6px; padding: 6px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.briefing-download-btn {
  padding: 6px 16px; font-size: 12px; font-weight: 600;
  border: none; cursor: pointer; border-radius: 4px;
  background: var(--gold); color: #fff; transition: opacity 0.15s;
}
.briefing-download-btn:hover { opacity: 0.85; }

/* ═══════════════ Main Content ═══════════════ */
.main { margin-left: 260px; min-height: 100vh; }
.section { padding: 40px 64px 48px; border-bottom: 1px solid var(--border); max-width: 960px; margin: 0 auto; }
.section:last-child { border-bottom: none; }
.section-num { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--navy-mid); margin-bottom: 8px; }

/* ═══════════════ Hero ═══════════════ */
.hero { padding: 72px 64px 56px; border-bottom: 1px solid var(--border); max-width: 960px; margin: 0 auto; }
.hero-context { font-size: 13px; color: var(--navy-mid); margin-bottom: 24px; text-transform: uppercase; letter-spacing: 0.5px; }
.hero h1 { font-size: 36px; margin-bottom: 16px; }

.epistemic-note {
  background: var(--gold-bg); border: 1px solid #e8ddd0; border-radius: 8px;
  padding: 16px 20px; margin: 24px 0; display: flex; gap: 12px; align-items: flex-start;
}
.epistemic-note-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; color: var(--gold); }
.epistemic-note p { font-size: 13px; color: var(--text-light); margin-bottom: 0; line-height: 1.5; }

/* ═══════════════ Platform Nodes ═══════════════ */
.platform-node {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 4px; font-size: 11px;
  font-weight: 600; white-space: nowrap; letter-spacing: 0.2px;
}
.platform-node .p-letter {
  font-size: 10px; font-weight: 800; width: 16px; height: 16px;
  border-radius: 3px; display: flex; align-items: center;
  justify-content: center; color: #fff;
}
.platform-node.human { background: var(--coral-light); color: #b35a42; }
.platform-node.human .p-letter { background: var(--coral); }
.platform-node.prediction { background: var(--gold-faint); color: #9a7048; }
.platform-node.prediction .p-letter { background: var(--gold); }
.platform-node.logic { background: var(--blue-light); color: #3a6db5; }
.platform-node.logic .p-letter { background: var(--blue); }
.platform-node.matter { background: var(--slate-light); color: #5a6a7c; }
.platform-node.matter .p-letter { background: var(--slate); }

/* ═══════════════ Relationship Badges ═══════════════ */
.rel-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 4px; white-space: nowrap;
}
.rel-badge.autonomous { background: var(--chart-auto-light); color: var(--chart-auto); }
.rel-badge.verified, .rel-badge.verification_gated { background: var(--chart-verified-light); color: var(--chart-verified); }
.rel-badge.guided, .rel-badge.guidance { background: var(--chart-guided-light); color: #4a5d70; }
.rel-badge.assisted, .rel-badge.assistant { background: var(--chart-assist-light); color: #8a6d00; }
.rel-badge.redesign, .rel-badge.process_elimination, .rel-badge.system_integration, .rel-badge.process_restructuring { background: var(--chart-redesign-light); color: #8a6d00; }
.rel-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ═══════════════ Seam Cards ═══════════════ */
.seam-list { margin: 24px 0; }
.seam-card {
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 20px; overflow: hidden; background: #fff;
  transition: box-shadow 0.15s;
}
.seam-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.seam-card.lead-cluster { border-left: 3px solid var(--gold, #d4a843); }
.seam-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px 16px; cursor: pointer;
}
.seam-card-title { font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.seam-card-subtitle { font-size: 13px; color: var(--text-light); line-height: 1.5; max-width: 560px; }
.seam-card-score { text-align: right; flex-shrink: 0; margin-left: 24px; display: flex; align-items: center; gap: 10px; }
.seam-card-body { padding: 0 24px 20px; }
.seam-card-body.collapsed { display: none; }

.seam-card-meta {
  display: flex; gap: 24px; padding: 12px 24px;
  background: var(--bg-warm); border-top: 1px solid var(--border); flex-wrap: wrap;
}
.seam-meta-item { display: flex; flex-direction: column; }
.seam-meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 2px; }
.seam-meta-value { font-size: 13px; font-weight: 500; color: var(--text); }

/* Score badge */
.seam-score-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 14px; font-weight: 700; padding: 3px 10px;
  border-radius: 8px; letter-spacing: -0.01em; white-space: nowrap;
}
.seam-score-badge.high { background: var(--coral-light); color: #b35a42; }
.seam-score-badge.medium { background: var(--amber-light); color: var(--amber); }
.seam-score-badge.low { background: var(--green-light); color: var(--green); }
.seam-score-badge .score-suffix { font-weight: 400; opacity: 0.5; font-size: 11px; }
.seam-score-bar { width: 36px; height: 5px; border-radius: 3px; background: #e8e5e0; position: relative; overflow: hidden; }
.seam-score-fill { height: 100%; border-radius: 3px; }
.seam-score-badge.high .seam-score-fill { background: var(--coral); }
.seam-score-badge.medium .seam-score-fill { background: var(--amber); }
.seam-score-badge.low .seam-score-fill { background: var(--green); }

/* ═══════════════ Seam Detail Grid ═══════════════ */
.seam-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.seam-detail-box { padding: 14px 16px; border-radius: 6px; background: var(--bg-warm); }
.seam-detail-box h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; }
.seam-detail-box p { font-size: 13px; line-height: 1.55; color: var(--text); margin-bottom: 0; }
.seam-detail-box ul { list-style: none; padding: 0; }
.seam-detail-box li { font-size: 13px; color: var(--text); padding: 2px 0; line-height: 1.5; }
.seam-detail-box li::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: middle; }
.seam-detail-full { grid-column: 1 / -1; }

.seam-enrichment-block { margin-bottom: 8px; }
.seam-cap-list { margin: 0.35em 0 0; padding-left: 1.15em; list-style: disc; }
.seam-cap-list li { font-size: 13px; line-height: 1.45; }
.seam-diag-detail { display: block; font-size: 12px; margin-top: 6px; line-height: 1.45; }

/* AI agent map — cards (variable-height narrative; not a wide table) */
.agent-map-list { display: flex; flex-direction: column; gap: 16px; }
.agent-map-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  background: #fff;
}
.agent-map-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 20px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.agent-map-card-heading { flex: 1; min-width: 200px; }
.agent-map-card-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 4px 0;
  line-height: 1.25;
}
.agent-map-card-roles {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
  max-width: 560px;
}
.agent-map-card-metrics {
  display: flex;
  flex-shrink: 0;
  gap: 18px;
}
.agent-map-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.agent-map-metric-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.agent-map-metric-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.agent-map-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 20px;
  margin: 0 0 4px 0;
  font-size: 13px;
}
.agent-map-dl > div { margin: 0; }
.agent-map-dl dt {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 2px 0;
}
.agent-map-dl dd {
  margin: 0;
  color: var(--text);
  line-height: 1.4;
}
.agent-map-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.agent-map-card > .agent-map-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.agent-map-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 8px 0;
}
.agent-map-ai-inner { font-size: 13px; line-height: 1.45; }
.agent-map-mission-inner { font-size: 13px; line-height: 1.55; color: var(--text); }
.agent-map-problem-shape {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.agent-map-problem-text { margin: 0 0 10px 0; }
.agent-map-cap-list { margin: 0; padding-left: 1.2em; }
.agent-map-cap-list li { margin: 5px 0; }

.agent-enrichment-mini { font-size: 11px; line-height: 1.45; margin-top: 6px; max-width: 480px; color: var(--text-muted); }
.agent-enrichment-mini .agent-problem { margin-bottom: 4px; color: var(--text); }
.agent-enrichment-mini .agent-caps ul { margin: 0; padding-left: 1.1em; }
.agent-enrichment-mini .agent-caps li { margin: 2px 0; }

/* ═══════════════ Relationship Legend ═══════════════ */
.rel-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.rel-legend-item { display: flex; gap: 10px; padding: 10px 14px; border-radius: 6px; background: var(--bg-warm); align-items: flex-start; }
.rel-legend-badge { flex-shrink: 0; margin-top: 2px; }
.rel-legend-text h4 { font-size: 13px; margin-bottom: 2px; }
.rel-legend-text p { font-size: 12px; color: var(--text-light); margin-bottom: 0; line-height: 1.4; }

/* ═══════════════ Affirmation ═══════════════ */
.affirmation {
  border-left: 3px solid var(--green); background: var(--green-light);
  padding: 16px 20px; border-radius: 0 8px 8px 0; margin: 24px 0;
}
.affirmation h4 { color: var(--green); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.affirmation p { font-size: 14px; color: var(--text); margin-bottom: 0; }

/* ═══════════════ Department Map ═══════════════ */
.seam-map { margin: 32px 0; }
.seam-map-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.seam-map-dept { width: 140px; font-size: 12px; font-weight: 500; color: var(--text-light); text-align: right; flex-shrink: 0; }
.seam-map-bar { flex: 1; height: 32px; background: #f1f5f9; border-radius: 4px; position: relative; overflow: hidden; display: flex; }
.seam-map-seg { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; white-space: nowrap; min-width: 0; transition: width 0.3s; }
.seam-map-seg:first-child { border-radius: 4px 0 0 4px; }
.seam-map-seg:last-child { border-radius: 0 4px 4px 0; }
.seam-map-seg:only-child { border-radius: 4px; }
.seam-map-label { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 500; color: var(--text-light); pointer-events: none; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; justify-content: flex-end; text-align: right; max-width: 55%; }
.seam-map-hours { font-size: 15px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.seam-map-meta { font-size: 11px; font-weight: 600; color: var(--text-light); }

/* Segment colors by relationship type */
.seam-map-seg.autonomous { background: var(--chart-auto); }
.seam-map-seg.verified, .seam-map-seg.verification_gated { background: var(--chart-verified); }
.seam-map-seg.guided, .seam-map-seg.guidance { background: var(--chart-guided); }
.seam-map-seg.assisted, .seam-map-seg.assistant { background: var(--chart-assist); color: var(--navy); }
.seam-map-seg.redesign, .seam-map-seg.process_elimination, .seam-map-seg.system_integration, .seam-map-seg.process_restructuring { background: var(--chart-redesign); color: var(--navy); }

/* ═══════════════ Flywheel ═══════════════ */
.flywheel {
  display: flex; align-items: center; justify-content: center; gap: 0;
  margin: 32px 0; padding: 24px; background: var(--bg-warm);
  border-radius: 12px; border: 1px solid var(--border); flex-wrap: wrap;
}
.flywheel-step { text-align: center; padding: 12px 16px; max-width: 160px; }
.flywheel-step-title { font-size: 13px; font-weight: 600; color: var(--navy); line-height: 1.3; margin-bottom: 2px; }
.flywheel-step-desc { font-size: 11px; color: var(--text-light); line-height: 1.4; }
.flywheel-arrow { font-size: 18px; color: var(--gold); padding: 0 4px; font-weight: 300; }
.flywheel-return { width: 100%; text-align: center; padding-top: 12px; margin-top: 8px; border-top: 1px dashed var(--border); }
.flywheel-return-text { font-size: 12px; color: var(--navy-mid); font-weight: 500; font-style: italic; }

/* ═══════════════ Grounding Bar ═══════════════ */
.grounding-bar { background: #f8f9fa; border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin: 24px 0; }
.grounding-bar-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.grounding-bar-tiers { display: flex; gap: 24px; flex-wrap: wrap; }
.grounding-tier { display: flex; align-items: baseline; gap: 6px; }
.grounding-tier-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; margin-top: 2px; }
.grounding-tier-label { font-size: 12px; color: var(--text-light); }
.grounding-tier-value { font-size: 14px; font-weight: 600; color: var(--navy); }

/* ═══════════════ Unlock Cards ═══════════════ */
.unlock-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 24px 0; }
.unlock-card { display: grid; grid-template-columns: 3fr 2fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.unlock-card-left { padding: 18px 20px; }
.unlock-card-from { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.unlock-card-to { font-size: 15px; font-weight: 600; color: var(--navy); line-height: 1.4; margin-bottom: 6px; }
.unlock-card-compound { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.unlock-card-right { padding: 18px 20px; background: var(--bg-warm); border-left: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; }
.unlock-card-seams { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.unlock-card-seam-list { font-size: 12px; color: var(--text); line-height: 1.6; }

/* ═══════════════ Innovation Cards ═══════════════ */
.innovation-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 24px 0; }
.innovation-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.innovation-card-header { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: flex-start; }
.innovation-card-title { font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.innovation-card-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; padding: 3px 8px; border-radius: 3px; background: var(--amber-light); color: var(--amber); white-space: nowrap; flex-shrink: 0; margin-left: 16px; }
.innovation-card-body { padding: 8px 22px 18px; }
.innovation-card-insight { font-size: 14px; color: var(--text); line-height: 1.6; margin-bottom: 12px; }
.innovation-card-anchors { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.innovation-anchor { font-size: 11px; padding: 3px 8px; border-radius: 4px; background: #f1f5f9; color: var(--text-light); font-weight: 500; }
.innovation-card-requires { font-size: 12px; color: var(--text-muted); line-height: 1.5; padding-top: 8px; border-top: 1px solid var(--border); }
.innovation-card-requires strong { color: var(--text-light); }

/* ═══════════════ Roadmap & Timeline ═══════════════ */
.roadmap { margin: 24px 0; }
.roadmap-tier { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.roadmap-tier:last-child { border-bottom: none; }
.roadmap-tier-num { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.roadmap-tier-content { flex: 1; }
.roadmap-tier-title { font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.roadmap-tier-audience { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.roadmap-tier-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }

.phase-timeline { margin: 24px 0; position: relative; }
.phase-timeline::before { content: ""; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.phase-item { display: flex; gap: 16px; padding: 16px 0; position: relative; }
.phase-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--gold); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--navy); flex-shrink: 0; z-index: 1; }
.phase-content { flex: 1; padding-top: 4px; }
.phase-title { font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.phase-timing { font-size: 12px; color: var(--navy-mid); font-weight: 600; margin-bottom: 4px; }
.phase-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; }

.ask-list { margin: 24px 0; }
.ask-item { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; background: #fff; align-items: flex-start; }
.ask-num { font-size: 13px; font-weight: 700; color: var(--navy-mid); min-width: 20px; padding-top: 1px; }
.ask-text { font-size: 14px; color: var(--text); line-height: 1.5; }

/* ═══════════════ Spiral Notebook Seam Diagrams ═══════════════ */
.spiral-spread { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0 12px; }
.spiral-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 0 0 6px; text-align: center; }
.spiral-label.today { color: var(--text-muted); }
.spiral-label.designed { color: var(--green); }

.spiral-notebook { display: flex; align-items: stretch; }
.spiral-page { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 140px; justify-content: center; }
.spiral-page.left { border-radius: 8px 0 0 8px; align-items: flex-end; }
.spiral-page.right { border-radius: 0 8px 8px 0; align-items: flex-start; }
.spiral-page-title { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 2px; width: 100%; }
.spiral-page.left .spiral-page-title { text-align: right; }
.spiral-page.right .spiral-page-title { text-align: left; }
.spiral-right-stack { display: flex; flex-direction: column; gap: 8px; width: 100%; align-items: flex-start; }
.spiral-page-subtitle { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 4px; width: 100%; text-align: left; }
.spiral-right-stack .spiral-gov { margin-top: 2px; }

.spiral-today .spiral-page { background: #faf8f6; box-shadow: inset 0 0 8px rgba(201,74,74,0.03); }
.spiral-today .spiral-page.left { box-shadow: -2px 1px 6px rgba(0,0,0,0.04), inset 0 0 8px rgba(201,74,74,0.03); }
.spiral-today .spiral-page.right { box-shadow: 2px 1px 6px rgba(0,0,0,0.04), inset 0 0 8px rgba(201,74,74,0.03); }
.spiral-today .spiral-actor { opacity: 0.7; border-width: 1px; }

.spiral-designed .spiral-page { background: #fff; }
.spiral-designed .spiral-page.left { box-shadow: -2px 1px 6px rgba(0,0,0,0.04); }
.spiral-designed .spiral-page.right { box-shadow: 2px 1px 6px rgba(0,0,0,0.04); }
.spiral-designed .spiral-actor { border-width: 2px; }

.spiral-spine { width: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; position: relative; z-index: 2; }
.spiral-today .spiral-spine { background: linear-gradient(to right, #ece6e0, #e0d8d0, #ece6e0); }
.spiral-designed .spiral-spine { background: linear-gradient(to right, #e6ede8, #dbe7df, #e6ede8); }

.spiral-actor { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px; border: 1.5px solid; background: #fff; max-width: 155px; width: 100%; }
.spiral-actor.h { border-color: var(--coral); background: var(--coral-light); }
.spiral-actor.p { border-color: var(--gold); background: var(--gold-faint); }
.spiral-actor.l { border-color: var(--blue); background: var(--blue-light); }
.spiral-actor.m { border-color: var(--slate); background: var(--slate-light); }
.spiral-actor.governor { border-style: dashed; opacity: 0.85; }

.spiral-actor-icon { width: 22px; height: 22px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.spiral-actor-icon.h { background: var(--coral); }
.spiral-actor-icon.p { background: var(--gold); }
.spiral-actor-icon.l { background: var(--blue); }
.spiral-actor-icon.m { background: var(--slate); }
.spiral-actor-icon svg { display: block; }

.spiral-actor-info { display: flex; flex-direction: column; gap: 0; flex: 1; }
.spiral-page.left .spiral-actor-info { text-align: right; }
.spiral-page.right .spiral-actor-info { text-align: left; }
.spiral-actor-name { font-size: 11px; font-weight: 600; color: var(--text); line-height: 1.2; }
.spiral-actor-role { font-size: 9px; color: var(--text-muted); line-height: 1.2; }

.spiral-gov {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 3px 8px; border-radius: 8px; border: 1.5px solid;
}
.spiral-gov.autonomous { background: var(--chart-auto-light); color: var(--chart-auto); border-color: #b8c4d0; }
.spiral-gov.verified, .spiral-gov.verification_gated { background: var(--chart-verified-light); color: var(--chart-verified); border-color: #a8b8cc; }
.spiral-gov.guided, .spiral-gov.guidance { background: var(--chart-guided-light); color: #4a5d70; border-color: #b8c4d0; }
.spiral-gov.assisted, .spiral-gov.assistant { background: var(--chart-assist-light); color: #8a6d00; border-color: #e4cc8a; }

/* ═══════════════ Four Platforms Grid ═══════════════ */
.platforms-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.platform-card { padding: 14px; border-radius: 8px; border: 1px solid var(--border); }
.platform-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.platform-card-label { font-size: 13px; font-weight: 600; color: var(--navy); }
.platform-card-desc { font-size: 12px; color: var(--text-light); line-height: 1.4; }

/* ═══════════════ Legend Row ═══════════════ */
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }

/* ═══════════════ Workbench ═══════════════ */
.workbench { margin-left: 260px; min-height: 100vh; }
.wb-content { flex: 1; min-width: 0; padding: 16px 24px; }

/* W17: Panel mode — show one section at a time */
.wb-content.panel-mode > .entity-section,
.wb-content.panel-mode > .pipeline-panel,
.wb-content.panel-mode > .profile-panel { display: none; }
.wb-content.panel-mode > .wb-panel-active { display: block; }
/* Keep header always visible */
.wb-content.panel-mode > .wb-header { display: block; }
/* Layout mode toggle */
.wb-layout-toggle {
  display: inline-flex; gap: 2px; background: var(--bg-alt); border-radius: 4px;
  padding: 2px; margin-left: 12px; vertical-align: middle;
}
.wb-layout-toggle button {
  font-size: 11px; padding: 3px 10px; border: none; border-radius: 3px;
  cursor: pointer; background: transparent; color: var(--text-muted);
}
.wb-layout-toggle button.active {
  background: var(--navy); color: #fff;
}

/* Detail sidebar — fixed to right edge, below view toggle */
.wb-sidebar {
  position: fixed; top: 56px; right: 0; bottom: 0;
  width: 0; overflow: hidden; transition: width 0.2s ease;
  border-left: 1px solid var(--border); background: var(--bg-warm);
  z-index: 250; box-shadow: -4px 0 16px rgba(0,0,0,0.08);
}
.wb-sidebar.open { width: 360px; overflow-y: auto; }
.wb-sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-warm); z-index: 10;
}
.wb-sidebar-header h3 { font-size: 14px; font-weight: 700; color: var(--navy); margin: 0; }
.wb-sidebar-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--text-muted); padding: 2px 6px; border-radius: 4px;
}
.wb-sidebar-close:hover { background: var(--border); }
.wb-sidebar-body { padding: 16px 20px; }

/* Clickable score cells */
.score-clickable {
  cursor: pointer; text-decoration: underline; text-decoration-style: dotted;
  text-underline-offset: 3px; text-decoration-color: var(--text-muted);
}
.score-clickable:hover { text-decoration-color: var(--navy); color: var(--navy); }
.wb-header { margin-bottom: 32px; }
.wb-header h2 { margin-bottom: 4px; }
.wb-header-meta { font-size: 13px; color: var(--text-muted); }

/* Pipeline status */
.pipeline-panel {
  background: var(--bg-warm); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px 24px; margin-bottom: 32px;
}
.pipeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pipeline-header h3 { margin-bottom: 0; }
/* Pipeline stage list — vertical compact layout */
.pipeline-list { display: flex; flex-direction: column; gap: 0; }
.pipeline-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 0; font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: all 0.15s;
}
.pipeline-row.completed { color: var(--green); }
.pipeline-row.running { color: var(--amber); font-weight: 600; }
.pipeline-row.failed { color: var(--red); }
.stage-main { display: flex; align-items: baseline; gap: 5px; min-width: 180px; flex-shrink: 0; }
.stage-icon { font-size: 10px; width: 14px; text-align: center; flex-shrink: 0; }
.stage-icon.completed { color: var(--green); }
.stage-icon.running { color: var(--amber); animation: pulse 1.5s ease-in-out infinite; }
.stage-icon.failed { color: var(--red); }
.stage-icon.pending { color: var(--border); }
.stage-num { font-size: 10px; color: inherit; opacity: 0.7; min-width: 12px; }
.stage-label { font-size: 12px; white-space: nowrap; }
.stage-detail { font-size: 12px; color: var(--text-muted); font-style: italic; margin: 0; padding: 0; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.pipeline-btn {
  padding: 8px 20px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.15s;
}
.pipeline-btn-primary { background: var(--gold); color: var(--navy); font-weight: 700; }
.pipeline-btn-primary:hover { background: var(--gold-light); }
.pipeline-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.pipeline-btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.pipeline-btn-secondary:hover { border-color: var(--gold); }

.pipeline-progress {
  font-size: 12px; color: var(--text-muted); margin-top: 10px;
  padding: 8px 12px; background: var(--bg-alt); border-radius: 6px;
  min-height: 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pipeline-progress:empty { display: none; }
.pipeline-active-detail {
  font-size: 11px; color: var(--text-muted); opacity: 0.8;
  margin-left: auto; font-style: italic;
}

/* Entity tables */
.entity-section { margin-bottom: 20px; }
.entity-section h3 { margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.entity-count { font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* Contain wide tables; Sources column wraps, rare overflow scrolls here */
#roles-table,
#processes-table,
#systems-table {
  overflow-x: auto;
  max-width: 100%;
}

.entity-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.entity-table th {
  text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); padding: 4px 6px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.entity-table td {
  padding: 3px 6px; border-bottom: 1px solid var(--border);
  font-size: 12px; line-height: 1.3; color: var(--text);
}
.entity-table td.nowrap { white-space: nowrap; }
.entity-table td.source-links-cell {
  width: 12rem;
  max-width: 12rem;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.entity-table .source-link-list {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.entity-table .source-link-list a {
  white-space: normal;
}
.entity-table tr:hover td { background: var(--bg-warm); }

/* W15: Lead cluster visual treatment */
.entity-table tr.lead-cluster td { border-left: 3px solid var(--gold, #d4a843); }
.entity-table tr.lead-cluster td:first-child { padding-left: 7px; }
.lead-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold, #d4a843); color: white;
  font-size: 10px; font-weight: 700; vertical-align: middle;
  margin-right: 4px;
}

.entity-tag {
  display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; letter-spacing: 0.3px;
}
.entity-tag.confirmed { background: var(--green-light); color: var(--green); }
.entity-tag.inferred { background: var(--amber-light); color: var(--amber); }
.entity-tag.hypothesis { background: var(--slate-light); color: var(--slate); }
.entity-tag.unknown { background: #ffebee; color: #c62828; }

/* Materiality badges — tiny inline indicators next to epistemic tags */
.mat-badge {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  font-size: 9px; font-weight: 700; text-align: center; line-height: 16px;
  margin-left: 4px; vertical-align: middle; cursor: help;
}
.mat-validated { background: var(--green-light); color: var(--green); }
.mat-acceptable { background: var(--blue-light); color: #1565c0; }
.mat-low { background: var(--purple-light); color: var(--purple); }
.mat-unknown { background: var(--amber-light); color: var(--amber); border: 1px solid var(--amber); }

.picker-delete-btn { opacity: 0; color: var(--text-muted); transition: all 0.15s; }
.picker-delete-btn:hover { color: var(--red); opacity: 1; }
.engagement-row:hover .picker-delete-btn,
li:hover > .picker-delete-btn { opacity: 0.5; }

/* ═══════════════ Profile Panel ═══════════════ */
.profile-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 24px; margin-bottom: 32px;
}
.profile-panel h3 { margin-bottom: 12px; }
.profile-textarea {
  width: 100%; min-height: 200px; padding: 12px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 13px; line-height: 1.6;
  color: var(--text); resize: vertical;
}
.profile-textarea:focus { outline: none; border-color: var(--gold); }
.profile-actions { display: flex; gap: 8px; margin-top: 12px; }


/* ═══════════════ Responsive ═══════════════ */
@media (max-width: 1024px) {
  .nav-rail { width: 220px; }
  .main, .workbench { margin-left: 220px; }
  .wb-content { padding: 16px 16px; }
  .wb-sidebar.open { width: 320px; }
  .wb-layout-toggle { display: none; } /* Force scroll mode on narrow screens */
  .section, .hero { padding: 40px 32px 48px; }
  .seam-detail-grid { grid-template-columns: 1fr; }
  .rel-legend { grid-template-columns: 1fr; }
  .unlock-card { grid-template-columns: 1fr; }
  .spiral-spread { grid-template-columns: 1fr; }
  .platforms-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-rail { display: none; }
  .main, .workbench { margin-left: 0; }
}

/* ═══════════════ SOC Typeahead ═══════════════ */
.soc-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500; display: flex; align-items: center; justify-content: center; }
.soc-picker { background: #fff; border-radius: 10px; width: 480px; max-height: 70vh; box-shadow: 0 8px 32px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden; }
.soc-picker-header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.soc-picker-header h3 { font-size: 15px; margin-bottom: 8px; }
.soc-picker-input { width: 100%; padding: 8px 12px; border: 2px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; outline: none; }
.soc-picker-input:focus { border-color: var(--gold); }
.soc-picker-results { flex: 1; overflow-y: auto; padding: 4px 0; }
.soc-picker-item { display: flex; align-items: center; gap: 12px; padding: 8px 20px; cursor: pointer; transition: background 0.1s; }
.soc-picker-item:hover, .soc-picker-item.selected { background: var(--gold-faint); }
.soc-picker-code { font-size: 13px; font-weight: 700; color: var(--navy-mid); min-width: 64px; font-family: monospace; }
.soc-picker-title { font-size: 13px; color: var(--text); }
.soc-picker-empty { padding: 24px 20px; text-align: center; font-size: 13px; color: var(--text-muted); }
.soc-picker-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.soc-picker-footer button { padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); cursor: pointer; background: #fff; color: var(--text); }
.soc-picker-footer button.primary { background: var(--gold); color: var(--navy); border-color: var(--gold); }
