:root {
  --bg: #f4f5f6; --panel: #fff; --panel2: #fafbfc;
  --ink: #14181e; --muted: #5e6874; --line: #e1e6eb; --dot: #d6dbe0;
  --supplier: #0f766e; --commodity: #8a6b26; --customer: #c2410c;
  --macro: #9a6b06; --focus: #1d4ed8; --focus-soft: #dbeafe;
  --driver: #15803d; --hindrance: #b42318; --mixed: #9a6b06;
  --shadow: 0 18px 50px rgba(16, 24, 40, .13);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --serif: "Newsreader", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114; --panel: #171b21; --panel2: #1c2129; --ink: #e9edf2;
    --muted: #a4aeba; --line: #333b47; --dot: #262c36; --supplier: #2dd4bf;
    --commodity: #d9b45b; --customer: #fb923c; --macro: #facc15;
    --focus: #93c5fd; --focus-soft: #20324b; --driver: #4ade80; --hindrance: #f87171; --mixed: #facc15;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--supplier); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.mono, .eyebrow, .badge { font-family: var(--mono); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.app-header { min-height: 58px; padding: 10px 20px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }
.brand-mark { border: 1px solid var(--line); border-radius: 5px; font: 10px var(--mono); padding: 5px 7px; letter-spacing: .08em; }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 13px; }
.header-nav form { margin: 0; }
.text-button { background: none; border: 0; color: var(--muted); padding: 4px; }
.page { max-width: 1160px; margin: 0 auto; padding: 48px 24px; }
.intro { margin-bottom: 30px; }
h1, h2, h3, p { margin-top: 0; }
.intro h1 { font: 500 clamp(28px, 4vw, 42px)/1.15 var(--serif); margin: 9px 0 12px; }
.intro p { color: var(--muted); max-width: 68ch; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--ink); font-size: 13px; font-weight: 600; gap: 6px; text-decoration: none; }
.button:hover { background: var(--panel); border-color: var(--muted); text-decoration: none; }
.button.primary { background: var(--supplier); color: var(--panel); border-color: var(--supplier); }
.button.icon { width: 36px; padding: 0; font-size: 20px; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
.search-form { margin-bottom: 22px; }
.search-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.search-form div { display: flex; gap: 8px; }
.search-form input { width: min(340px, 70%); }
.map-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 18px; }
.map-card { display: block; color: var(--ink); padding: 23px; transition: border-color .15s; }
.map-card:hover { border-color: var(--supplier); text-decoration: none; }
.map-card h2 { font: 500 25px/1.2 var(--serif); margin: 14px 0 8px; }
.map-card p { color: var(--muted); font-size: 13px; }
.card-action { display: block; color: var(--supplier); font-size: 13px; padding-top: 16px; }
.empty { padding: 34px; grid-column: 1 / -1; }
.empty h2 { font: 500 26px var(--serif); }
.empty p { color: var(--muted); max-width: 72ch; }
.empty .button { margin: 8px 7px 0 0; }
.login-page { max-width: 530px; }
.login-form { padding: 26px; }
.login-form label { display: block; margin-bottom: 5px; }
.login-form input { width: 100%; }
.errorlist { color: var(--hindrance); }
.map-app { display: flex; flex-direction: column; height: calc(100dvh - 58px); min-height: 500px; }
.map-heading { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.map-heading h1 { font: 500 24px/1.2 var(--serif); margin: 3px 0 0; }
.map-switch { margin-left: auto; font-size: 11px; color: var(--muted); }
.map-switch select { margin-left: 8px; font-size: 12px; max-width: 260px; }
.map-menu { width: 216px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.map-menu.collapsed { width: 56px; }
.menu-toggle { flex-shrink: 0; margin: 10px; min-height: 44px; }
.map-menu.collapsed .menu-toggle { margin: 6px; padding: 4px; }
.map-toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 12px 16px; overflow-y: auto; }
.map-toolbar .button { min-height: 44px; }
.map-toolbar > .button { justify-content: flex-start; text-align: left; white-space: normal; }
.map-toolbar .tool-group { flex-wrap: wrap; }
.map-toolbar .tool-group > .button:not(.icon) { width: 100%; justify-content: flex-start; }
.map-toolbar .map-switch { margin: 4px 0 0; font-size: 11px; }
.map-toolbar .map-switch select { display: block; width: 100%; max-width: 100%; margin: 5px 0 0; }
.map-toolbar .toolbar-count { margin: 0; font-size: 10px; }
.fullscreen-shortcut { position: absolute; left: 14px; bottom: 14px; z-index: 5; box-shadow: var(--shadow); min-width: 44px; min-height: 44px; }
.fullscreen-shortcut svg { width: 22px; height: 22px; }
.fullscreen-contract, .fullscreen-shortcut[aria-pressed="true"] .fullscreen-expand { display: none; }
.fullscreen-shortcut[aria-pressed="true"] .fullscreen-contract { display: block; }
.tool-group { display: flex; align-items: center; gap: 6px; }
#zoom-value { color: var(--muted); font-size: 11px; min-width: 43px; text-align: center; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { background: var(--panel2); border: 0; padding: 7px 15px; font-size: 13px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.toolbar-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.map-workspace { display: flex; flex: 1; min-height: 0; overflow: hidden; position: relative; }
.map-canvas { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; cursor: grab; background: var(--bg) radial-gradient(circle, var(--dot) 1px, transparent 1.1px) 0 0/26px 26px; }
.map-canvas.panning { cursor: grabbing; }
.map-world { user-select: none; -webkit-user-select: none; }
.map-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#edges { position: absolute; top: 0; left: 0; overflow: visible; }
.column-caption { position: absolute; font: 600 11px var(--mono); letter-spacing: .08em; color: var(--muted); }
.column-caption[data-role="commodity"] { color: var(--commodity); }
.column-caption[data-role="supplier"] { color: var(--supplier); }
.column-caption[data-role="customer"] { color: var(--customer); }
.column-caption[data-role="macro"] { color: var(--macro); }
.node { position: absolute; width: 254px; height: 145px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 12px; text-align: left; box-shadow: 0 1px 3px rgba(16, 24, 40, .07); overflow: hidden; }
.node:hover { box-shadow: 0 7px 22px rgba(16, 24, 40, .13); }
.node[data-role="commodity"] { border-left-color: var(--commodity); }
.node[data-role="supplier"] { border-left-color: var(--supplier); }
.node[data-role="customer"] { border-left-color: var(--customer); }
.node[data-role="macro"] { border-left-color: var(--macro); }
.node[data-role="focus"] { width: 290px; height: 190px; border-left-color: var(--ink); border-left-width: 5px; }
.node[aria-pressed="true"] { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-soft); }
.node-name { font-size: 14px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.node[data-role="focus"] .node-name { font: 500 23px/1.15 var(--serif); }
.node-summary { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.node-meta { font: 10px/1.4 var(--mono); color: var(--muted); }
.node-badges { margin-top: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 9px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; }
.badge.driver { color: var(--driver); border-color: var(--driver); }
.badge.hindrance { color: var(--hindrance); border-color: var(--hindrance); }
.badge.mixed, .badge.warning { color: var(--mixed); border-color: var(--mixed); }
.map-edge { fill: none; stroke: var(--supplier); stroke-width: 2; opacity: .65; }
.map-edge.unconfirmed, .map-edge.historical { stroke-dasharray: 6 5; stroke: var(--muted); opacity: .6; }
.legend { margin: 16px 20px; padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; cursor: default; font-size: 11px; line-height: 1.5; }
.legend h2, .legend p:last-child { grid-column: 1 / -1; }
.legend h2 { font: 600 10px var(--mono); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; margin-bottom: 9px; }
.legend p { margin-bottom: 5px; }
.legend p:last-child { margin-bottom: 0; color: var(--muted); }
.swatch { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 2px; background: var(--muted); }
.swatch.commodity { background: var(--commodity); }.swatch.supplier { background: var(--supplier); }.swatch.customer { background: var(--customer); }.swatch.macro { background: var(--macro); }
.edge-key { border-top: 1px solid var(--line); padding-top: 7px; margin-top: 8px; }
.detail-panel { width: min(420px, 40vw); flex-shrink: 0; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px 20px 30px; }
.detail-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.detail-panel h2 { font: 500 27px/1.2 var(--serif); margin-bottom: 10px; overflow-wrap: anywhere; }
.detail-panel h3 { font: 600 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 24px 0 10px; }
.detail-panel p { font-size: 13px; overflow-wrap: anywhere; }
.detail-meta { color: var(--muted); font: 11px/1.7 var(--mono); }
.fact { padding: 12px 0; border-top: 1px solid var(--line); }
.fact .badge { margin-right: 5px; margin-bottom: 7px; }
.fact p { margin-bottom: 7px; }
.source-list { padding-left: 18px; font-size: 12px; color: var(--muted); }
.source-list li { padding: 5px 0; overflow-wrap: anywhere; }
.downloads { display: flex; flex-wrap: wrap; gap: 7px; }
.list-view { flex: 1; overflow-y: auto; padding: 22px; }
.list-group { margin-bottom: 28px; }
.list-group h2 { font: 600 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.list-node { width: 100%; display: block; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; margin-bottom: 8px; color: var(--ink); }
.list-node strong { display: block; margin-bottom: 5px; }.list-node span { color: var(--muted); font-size: 12px; }
.list-node[aria-pressed="true"] { border-color: var(--focus); }
.map-foot { margin: 0; padding: 6px 20px; background: var(--panel); border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
@media (max-width: 760px) {
  .app-header { padding: 10px 12px; }.brand-mark { display: none; }.brand { font-size: 13px; }.header-nav { gap: 10px; font-size: 12px; }
  .map-heading { padding: 10px 12px; align-items: flex-start; }.map-heading h1 { font-size: 21px; }.map-switch { font-size: 0; }.map-switch select { margin-left: 0; max-width: 130px; }
  .map-toolbar { padding: 4px 12px 12px; gap: 8px; }.segmented button { padding: 7px 10px; }
  .detail-panel { position: absolute; inset: 0; width: 100%; border: 0; z-index: 20; }
  .legend { margin: 12px; padding: 14px; }.map-foot { padding: 5px 12px; }
  .page { padding: 30px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }


.node:hover, .list-node:hover { text-decoration: none; }
a.node, a.list-node { color: var(--ink); cursor: pointer; }
.demo-banner { padding: 16px 20px; margin: 18px 0; border: 1px solid var(--macro); border-radius: 9px; background: var(--panel2); color: var(--ink); }
.map-app > .demo-banner { margin: 12px 20px; }
.dossier-page { max-width: 1400px; margin: auto; padding: 40px 24px; }
.dossier-actions { display: flex; gap: 12px; margin: 20px 0; }
.dossier-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.dossier-nav { padding: 16px; position: sticky; top: 20px; }
.dossier-nav a { display: block; padding: 8px 4px; font-size: 13px; }
.dossier-section { padding: 28px; margin-bottom: 20px; scroll-margin-top: 20px; }
.dossier-section h2 { font: 500 28px/1.2 var(--serif); margin: 10px 0 20px; }
.dossier-section p, .dossier-section li { max-width: 85ch; }
.section-summary { color: var(--muted); }
.table-scroll { overflow-x: auto; }
.dossier-table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13px; }
.dossier-table th, .dossier-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dossier-table thead { background: var(--panel2); }
.dossier-source { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dossier-source p { color: var(--muted); margin: 8px 0; font-size: 13px; }
@media (max-width: 850px) { .dossier-layout { grid-template-columns: 1fr; } .dossier-nav { position: static; } .dossier-section { padding: 20px; } .dossier-page { padding: 28px 16px; } }

.node-wrap { position: absolute; width: 254px; height: 145px; }
.node-wrap:has(.node[data-role="focus"]) { width: 290px; height: 190px; }
.node-wrap .node-name { padding-right: 30px; }
.node-ai-action { position: absolute; top: 8px; right: 8px; z-index: 2; background: var(--panel2); color: var(--focus); border: 1px solid var(--line); border-radius: 6px; font: 600 10px var(--mono); min-width: 30px; min-height: 26px; padding: 4px 6px; }
.node-ai-action:hover { border-color: var(--focus); }
.node-ai-action:disabled { opacity: .55; cursor: progress; }
.list-node-wrap { position: relative; }
.list-node-wrap .list-node { padding-right: 50px; }
.ai-tag { display: inline-block; font: 600 9px var(--mono); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; color: var(--muted); }
.ai-tag.completed { color: var(--driver); border-color: var(--driver); }
.ai-tag.queued, .ai-tag.running { color: var(--focus); border-color: var(--focus); }
.ai-tag.outdated { color: var(--macro); border-color: var(--macro); }
.ai-tag.failed { color: var(--hindrance); border-color: var(--hindrance); }
.ai-hover { position: fixed; z-index: 100; width: min(380px, calc(100vw - 16px)); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); padding: 16px; box-shadow: var(--shadow); pointer-events: none; font-size: 13px; max-height: 45vh; overflow: hidden; }
.ai-hover p { margin: 9px 0 0; }
.ai-notice { padding: 12px 20px; margin: 0; border-bottom: 1px solid var(--line); background: var(--panel2); font-size: 13px; }
.evidence-link { display: block; font-size: 12px; margin: 8px 0; }
.ai-finding h4 { margin: 12px 0 8px; }
.list-node .ai-tag { margin-top: 10px; }

/* Research freshness remains independent from AI status. */
.freshness-summary { margin: 0; padding: 9px 20px; background: var(--panel2); color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.freshness.recent { color: var(--driver); border: 1px solid currentColor; }
.freshness.stale, .freshness.undated, .freshness.future { color: var(--hindrance); border: 1px solid currentColor; }
.freshness.missing { color: var(--muted); border: 1px dashed currentColor; }
.node, .node-wrap { height: 168px; }
.node[data-role="focus"], .node-wrap:has(.node[data-role="focus"]) { height: 210px; }
.assessment-page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.assessment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.assessment-section { padding: 22px; margin: 18px 0; overflow-wrap: anywhere; }
.assessment-grid .assessment-section { margin: 0; }
.assessment-section h2 { margin: 0 0 12px; font: 500 28px/1.2 var(--serif); }
.assessment-entry { padding: 16px 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.assessment-entry h3 { margin-top: 0; }
.assessment-takeaway { font-size: 19px; line-height: 1.6; }
.assessment-evidence { border-left: 2px solid var(--line); padding-left: 14px; margin: 14px 0; }
.evidence-item + .evidence-item { margin-top: 14px; }
@media (max-width: 760px) {
  .assessment-page { padding: 18px 12px 40px; }
  .assessment-grid { grid-template-columns: 1fr; }
  .assessment-section { padding: 16px; }
}
:root { --competitor: #7c3aed; --competitor-supplier: #6d5b91; --technology: #0369a1; }
.node[data-role="competitor"] { border-left-color: var(--competitor); }
.node[data-role="competitor_supplier"] { border-left-color: var(--competitor-supplier); }
.node[data-role="technology"] { border-left-color: var(--technology); }
.swatch.competitor { background: var(--competitor); }
.swatch.competitor_supplier { background: var(--competitor-supplier); }
.swatch.technology { background: var(--technology); }
.column-caption[data-role="competitor"] { color: var(--competitor); }
.column-caption[data-role="competitor_supplier"] { color: var(--competitor-supplier); }
.column-caption[data-role="technology"] { color: var(--technology); }
.node-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  :root { --competitor: #c4b5fd; --competitor-supplier: #c7b8dd; --technology: #7dd3fc; }
}

/* The map keeps its toolbar and result panel in fullscreen. Devices without
   element fullscreen use the same layout within the browser viewport. */
.map-app:fullscreen { width: 100%; height: 100dvh; min-height: 0; background: var(--bg); }
.map-app.is-expanded { position: fixed; inset: 0; z-index: 2000; width: 100%; height: 100dvh; min-height: 0; background: var(--bg); }
.map-app:fullscreen .map-heading, .map-app:fullscreen .freshness-summary,
.map-app:fullscreen > .demo-banner, .map-app:fullscreen > .map-foot,
.map-app:fullscreen #legend-toggle, .map-app.is-expanded #legend-toggle,
.map-app.is-expanded .map-heading, .map-app.is-expanded .freshness-summary,
.map-app.is-expanded > .demo-banner, .map-app.is-expanded > .map-foot { display: none; }
