:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #222b37;
  --line: #2e3a48;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #4fd1c5;
  --synergy: #4ade80;
  --dependency: #60a5fa;
  --tension: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body { display: flex; flex-direction: column; height: 100vh; }

header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
header h1 { font-size: 17px; margin: 0; font-weight: 600; }
header h1 span { color: var(--muted); font-weight: 400; margin-left: 6px; }

.views { margin-left: auto; margin-right: auto; flex: none; }
.views button {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
}
.views button:first-child { border-radius: 6px 0 0 6px; }
.views button:last-child  { border-radius: 0 6px 6px 0; }
.views button:not(:first-child) { border-left: none; }
.views button:not(:first-child):not(:last-child) { border-radius: 0; }
.views button.active { background: var(--accent); color: #06201d; font-weight: 600; }

.suggest-btn {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.suggest-btn:hover { border-color: var(--accent); color: var(--accent); }

main { display: flex; flex: 1 1 auto; min-height: 0; }

#sidebar {
  width: 280px;
  flex: 0 0 auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px;
}
#sidebar section { margin-bottom: 22px; }
#sidebar h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}
#sidebar h2 em { color: var(--accent); font-style: normal; float: right; }

#theme-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.chip.on { background: var(--accent); color: #06201d; border-color: var(--accent); font-weight: 600; }

#layer-filters { display: flex; flex-direction: column; gap: 4px; }
.layer-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--muted);
  border: 1px solid transparent;
}
.layer-toggle:hover { background: var(--panel-2); }
.layer-toggle.on { color: var(--text); }
.layer-toggle .swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; opacity: 0.35; }
.layer-toggle.on .swatch { opacity: 1; }
.layer-toggle .lt-label { flex: 1; }

.footprint { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 4px; }
.feat-chip {
  font-size: 11px; padding: 3px 9px; border-radius: 12px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
}
.feat-chip:hover { border-color: var(--accent); color: var(--accent); }
.kind-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; color: #06201d; font-weight: 600; }
.flag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; margin-top: 4px; }
.flag.indicative { background: #3a341d; color: #fbbf24; }
.flag.water { background: #14323f; color: #38bdf8; }
.flag.greenbelt { background: #1d3a2a; color: #4ade80; }

.auth-badge {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 600; letter-spacing: .03em; white-space: nowrap;
}
.auth-badge.statutory      { background: #3a2a10; color: #fbbf24; }
.auth-badge.national-policy { background: #2a1e3a; color: #c084fc; }
.auth-badge.funded-programme { background: #1a2a3a; color: #60a5fa; }
.auth-badge.voluntary      { background: #1e2630; color: #8b9bb0; }
.auth-badge.regulatory     { background: #3a1d22; color: #f87171; }


#strategy-list { list-style: none; padding: 0; margin: 0; }
#strategy-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  border: 1px solid transparent;
}
#strategy-list li:hover { background: var(--panel-2); }
#strategy-list li.dim { opacity: 0.3; }
#strategy-list li .owner { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
#strategy-list li .tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); float: right;
}

#stage { flex: 1 1 auto; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

#claims-view {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--bg);
}

#timeline-view {
  position: absolute; inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}
.tl-item { cursor: pointer; transition: opacity 0.1s; }
.tl-item:hover { opacity: 0.7; }

.tl-period-bar { display: flex; padding: 12px 16px 0; }
.tl-period-btn {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 5px 14px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
  line-height: 1.25;
}
.tl-period-btn:first-child { border-radius: 6px 0 0 6px; }
.tl-period-btn:last-child  { border-radius: 0 6px 6px 0; }
.tl-period-btn + .tl-period-btn { border-left: none; }
.tl-period-btn.active { background: var(--accent); color: #06201d; font-weight: 600; }
.tl-period-sub { display: block; font-size: 10px; opacity: 0.7; font-weight: 400; }

.claims-header { margin-bottom: 18px; }
.claims-header h2 { margin: 0 0 5px; font-size: 15px; }
.claims-subtitle { color: var(--muted); font-size: 12px; margin: 0 0 10px; line-height: 1.45; max-width: 600px; }
.claims-summary { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cs-amber { color: #f59e0b; }
.cs-red   { color: #f87171; }

/* ---------- sub-view tabs (Timeline: Events|Delivery · Frameworks: Doughnut|Rewiring) ---------- */
.tl-mode-bar {
  display: flex; gap: 2px; align-items: flex-end;
  padding: 12px 16px 0; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
#flows-view .tl-mode-bar, #doughnut-view .tl-mode-bar, #rewiring-view .tl-mode-bar { padding: 0; }
.tl-mode-btn {
  font-size: 13px; padding: 8px 20px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-bottom: none;
  border-radius: 8px 8px 0 0;
  position: relative; top: 1px;
}
.tl-mode-btn:hover { color: var(--text); }
.tl-mode-btn.active {
  color: var(--accent); font-weight: 600;
  background: var(--panel); border-color: var(--line);
  border-bottom: 1px solid var(--panel);
}

/* ---------- flows panel ---------- */
#flows-view { position: absolute; inset: 0; overflow-y: auto; padding: 20px 24px 32px; background: var(--bg); }
.flow-switch { padding: 0 0 16px; }

.flow-chart { position: relative; max-width: 860px; padding: 6px 0 30px; margin-bottom: 8px; }
.flow-row { margin-bottom: 18px; }
.flow-row:last-of-type { margin-bottom: 0; }
.flow-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.flow-row-label { font-size: 12px; font-weight: 600; color: var(--text); }
.flow-row-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.flow-row-gaps { font-style: normal; font-size: 10px; color: #f59e0b; }
.flow-track { display: flex; height: 30px; background: rgba(46, 58, 72, 0.35); border-radius: 3px; overflow: hidden; }
.flow-seg { height: 100%; margin-right: 1px; opacity: 0.92; transition: opacity 0.12s; flex: none; }
.flow-seg:last-child { margin-right: 0; }
.flow-seg.hot { opacity: 1; outline: 2px solid #fff; outline-offset: -2px; }
.flow-seg-gap {
  width: 34px;
  background: repeating-linear-gradient(45deg, rgba(245,158,11,0.35) 0 6px, rgba(245,158,11,0.07) 6px 12px);
  border: 1px dashed #f59e0b;
  border-radius: 2px;
}
.flow-limit {
  position: absolute; top: 0; bottom: 0;
  border-left: 2px dashed #f87171;
  pointer-events: none;
}
.flow-limit-label {
  position: absolute; bottom: 2px; left: 6px;
  font-size: 10px; color: #f87171; white-space: nowrap; font-weight: 600;
}
.flow-over {
  position: absolute; top: 0; bottom: 0; right: 0;
  background: linear-gradient(90deg, rgba(248,113,113,0.10), rgba(248,113,113,0.05));
  pointer-events: none;
}

.flow-tchart { width: 100%; max-width: 940px; height: auto; display: block; margin-bottom: 10px; }
.flow-ax { fill: var(--muted); font-size: 10px; }
.flow-target-label { fill: #f87171; font-size: 10px; font-weight: 600; }
.flow-area { transition: opacity 0.12s; }
.flow-area.hot { opacity: 1 !important; stroke: #fff; stroke-width: 1.2; }

.flow-cols { display: flex; gap: 44px; flex-wrap: wrap; max-width: 980px; }
.flow-col { flex: 1; min-width: 300px; max-width: 480px; }
.flow-col-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.flow-list { list-style: none; margin: 0; padding: 0; font-size: 11px; }
.flow-li { display: flex; gap: 7px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid rgba(46, 58, 72, 0.5); }
.flow-li:last-child { border-bottom: none; }
.flow-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; position: relative; top: 1px; }
.flow-swatch.hatch {
  background: repeating-linear-gradient(45deg, rgba(245,158,11,0.5) 0 3px, transparent 3px 6px);
  border: 1px dashed #f59e0b;
}
.flow-li-label { flex: 1; color: var(--text); }
.flow-li.gap .flow-li-label { color: var(--muted); }
.flow-li-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.flow-suggest { color: #f59e0b; text-decoration: none; font-size: 10px; }
.flow-suggest:hover { text-decoration: underline; }
.flow-footnote { margin-top: 20px; font-size: 11px; color: var(--muted); max-width: 660px; line-height: 1.5; }

/* ---------- doughnut panel ---------- */
#doughnut-view { position: absolute; inset: 0; overflow-y: auto; padding: 20px 24px 32px; background: var(--bg); }
.dough-wrap { display: flex; gap: 36px; flex-wrap: wrap; align-items: flex-start; }
.dough-left { flex: 1 1 380px; max-width: 520px; }
.dough-svg { width: 100%; height: auto; display: block; }
.dough-seg { cursor: pointer; transition: opacity 0.12s; }
.dough-seg.hot { opacity: 1 !important; stroke: #fff; stroke-width: 1.5; }
.dough-center-num { fill: var(--text); font-size: 26px; font-weight: 700; }
.dough-center-sub { fill: var(--muted); font-size: 12px; }
.dough-ring-cap { fill: rgba(74, 222, 128, 0.75); font-size: 11px; font-style: italic; }
.dough-cols { flex: 1 1 300px; display: flex; flex-direction: column; gap: 20px; min-width: 280px; max-width: 420px; }
.dough-col-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dough-col-blurb { font-size: 10px; color: var(--muted); margin: 3px 0 6px; line-height: 1.4; }
.dough-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.dough-li { display: flex; gap: 8px; align-items: center; padding: 5px 4px; border-bottom: 1px solid rgba(46, 58, 72, 0.5); cursor: pointer; border-radius: 3px; }
.dough-li:hover { background: rgba(46, 58, 72, 0.35); }
.dough-swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dough-swatch.breach { background: #f87171; }
.dough-swatch.within { background: #4ade80; }
.dough-swatch.unquantified {
  background: repeating-linear-gradient(45deg, rgba(245,158,11,0.5) 0 3px, transparent 3px 6px);
  border: 1px dashed #f59e0b; border-radius: 2px;
}
.dough-li-label { flex: 1; color: var(--text); }
.dough-status { font-size: 10px; padding: 1px 7px; border-radius: 8px; white-space: nowrap; }
.dough-status.breach { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.dough-status.within { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.dough-status.unquantified { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.dough-status.examples { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }

/* ---------- rewiring the economy panel ---------- */
#rewiring-view { position: absolute; inset: 0; overflow-y: auto; padding: 20px 24px 32px; background: var(--bg); }
.rw-wrap { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.rw-col-tasks { flex: 1.2 1 380px; min-width: 340px; max-width: 640px; }
.rw-col-amb { flex: 1 1 300px; min-width: 280px; max-width: 440px; }
.rw-actor { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; margin: 12px 0 18px; }
.rw-actor-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.rw-task { display: flex; gap: 10px; align-items: flex-start; padding: 7px 6px; border-radius: 4px; cursor: pointer; }
.rw-task:hover { background: rgba(46, 58, 72, 0.35); }
.rw-task-n {
  width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 1px;
  color: #0f1419; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rw-task-label { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.rw-task-head { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.rw-ambition { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel); }
.rw-amb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rw-amb-label { font-size: 13px; font-weight: 600; color: var(--text); }
.rw-amb-blurb { font-size: 11px; color: var(--muted); margin: 4px 0 8px; line-height: 1.45; }
.rw-amb-dims { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.rw-amb-group-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 8px; }
.rw-sdgs { display: flex; flex-wrap: wrap; gap: 4px; }
.rw-sdg { font-size: 9.5px; padding: 1px 6px; border-radius: 3px; background: rgba(139, 155, 176, 0.15); color: var(--muted); }
.rw-originals { display: flex; gap: 24px; flex-wrap: wrap; margin: 0 0 24px; }
.rw-fig { flex: 1 1 280px; max-width: 400px; margin: 0; }
.rw-fig img { width: 100%; height: auto; border-radius: 8px; background: #fff; padding: 8px; box-sizing: border-box; }
.rw-fig figcaption { font-size: 10px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.dough-ref { max-width: none; margin-top: 10px; }

/* ---------- ask panel (curated Q&A) ---------- */
#ask-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 260;
  padding: 10px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent); color: #06201d; font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
#ask-fab:hover { filter: brightness(1.08); }
#ask-fab.open { background: var(--panel-2); color: var(--accent); border: 1px solid var(--accent); }
#suggest-fab {
  position: fixed; right: 18px; bottom: 64px; z-index: 258;
  padding: 8px 18px; border-radius: 999px;
  background: var(--panel-2); color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 12px; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
#suggest-fab:hover { background: var(--panel); }
#ask-panel[hidden] { display: none; }
#ask-panel {
  position: fixed; right: 18px; bottom: 112px; z-index: 259;
  width: 420px; max-width: calc(100vw - 24px); max-height: 72vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.ask-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.ask-title { font-size: 14px; font-weight: 700; color: var(--text); }
.ask-sub { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
#ask-close { background: transparent; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 0 2px; }
#ask-close:hover { color: var(--text); }
.ask-body { overflow-y: auto; padding: 4px 16px 16px; }
.ask-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); margin: 16px 0 2px; }
.ask-q {
  width: 100%; text-align: left; background: transparent; border: none; cursor: pointer;
  color: var(--text); font-size: 12.5px; font-family: inherit; line-height: 1.4;
  padding: 8px 2px; display: flex; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid rgba(46, 58, 72, 0.45);
}
.ask-q:hover { color: var(--accent); }
.ask-caret { color: var(--muted); flex: none; transition: transform 0.15s; }
.ask-q.open .ask-caret { transform: rotate(90deg); }
.ask-a { font-size: 12px; line-height: 1.55; padding: 8px 2px 12px; border-bottom: 1px solid rgba(46, 58, 72, 0.45); }
.ask-a p { margin: 0 0 8px; color: var(--text); }
.ask-foot { font-size: 10.5px; color: var(--muted); margin: 16px 0 0; line-height: 1.5; }
.ask-about { color: var(--accent); text-decoration: none; }
.ask-about:hover { text-decoration: underline; }
@media (max-width: 767px) {
  #ask-panel { right: 0; left: 0; bottom: 0; width: auto; max-width: none; max-height: 78vh; border-radius: 14px 14px 0 0; }
  #ask-fab { bottom: 14px; right: 14px; }
}

/* ---------- first-time tour ---------- */
.about-link { color: var(--muted); text-decoration: none; font-size: 12px; flex: none; }
.about-link:hover { color: var(--accent); }

.tour-btn {
  width: 24px; height: 24px; border-radius: 50%;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px; line-height: 1; cursor: pointer;
  flex: none;
}
.tour-btn:hover { color: var(--accent); border-color: var(--accent); }

#tour-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(4, 8, 14, 0.55);
  pointer-events: none;
  animation: tour-fade 0.25s ease;
}
@keyframes tour-fade { from { opacity: 0; } to { opacity: 1; } }
.tour-hl {
  position: fixed; z-index: 301; pointer-events: none;
  border: 2px solid var(--accent); border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(79, 209, 197, 0.22), 0 0 24px rgba(79, 209, 197, 0.25);
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}
.tour-card {
  position: fixed; z-index: 302; pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55);
  transition: left 0.3s ease, top 0.3s ease;
}
.tour-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--accent); }
.tour-text  { font-size: 12px; line-height: 1.5; color: var(--text); }
.tour-foot  { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 10px; }
.tour-dots i {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--line); margin-right: 5px;
}
.tour-dots i.on { background: var(--accent); }
.tour-actions { display: flex; gap: 8px; }
.tour-actions button {
  font-family: inherit; font-size: 11px; cursor: pointer;
  border-radius: 5px; padding: 4px 12px;
}
.tour-skip { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tour-skip:hover { color: var(--text); }
.tour-next { background: var(--accent); color: #06201d; border: none; font-weight: 600; }
.tour-next:hover { filter: brightness(1.1); }

/* ---------- strategies register ---------- */
#strategies-view {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--bg);
}
.reg-header { margin-bottom: 18px; }
.reg-header h2 { margin: 0 0 5px; font-size: 15px; }
.reg-subtitle { color: var(--muted); font-size: 12px; margin: 0 0 10px; line-height: 1.45; max-width: 640px; }
.reg-summary { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.reg-summary .rs-stat { color: var(--muted); }

.reg-group {
  border-left: 3px solid #8b9bb0;
  padding: 2px 0 2px 14px;
  margin: 0 0 20px;
}
.reg-group-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.reg-group-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.reg-group-count {
  font-size: 11px; color: var(--muted);
  background: var(--panel-2); border-radius: 10px; padding: 1px 8px;
}
.reg-group-blurb { font-size: 11px; color: var(--muted); font-style: italic; }

.reg-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.reg-row:hover { border-color: var(--accent); background: var(--panel-2); }
.reg-row-main { display: flex; align-items: center; gap: 7px; }
.reg-title { font-size: 13px; font-weight: 500; }
.reg-sourced { color: var(--accent); font-size: 11px; }
.reg-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 11px; color: var(--muted); }
.reg-scope { color: #9db4c0; }
.reg-scope::before { content: "· "; color: var(--muted); }
.reg-horizon::before { content: "· "; color: var(--muted); }
.reg-themes { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }
.reg-theme {
  font-size: 10px; color: var(--muted);
  background: var(--panel-2); border-radius: 3px; padding: 1px 6px;
}

.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.domain-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.domain-card:hover { border-color: var(--accent); background: var(--panel-2); }
.domain-card.domain-gap { opacity: 0.55; cursor: default; }
.domain-card.domain-gap:hover { border-color: var(--line); background: var(--panel); }
.domain-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.domain-label { font-size: 13px; font-weight: 600; }

.td { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.td-green { background: #4ade80; }
.td-amber { background: #f59e0b; }
.td-red   { background: #f87171; }

.domain-count { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.domain-breakdown { font-size: 11px; color: #6b7b8b; }
.bd-constraint { color: #f59e0b; }
.domain-gap-note { font-size: 11px; color: #f87171; margin-top: 4px; }

/* Claim rows — used in both Claims detail and feature detail */
.claim-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.claim-row:last-child { border-bottom: none; }
.claim-metric { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.claim-value-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; margin-bottom: 3px;
}
.claim-horizon { font-size: 10px; color: var(--muted); }
.claim-overlap { font-size: 10px; color: #f59e0b; margin-top: 3px; }
.claim-discrepancy { font-size: 10px; color: #fbbf24; margin-top: 4px; line-height: 1.45; padding: 4px 6px; background: rgba(251,191,36,0.08); border-left: 2px solid #fbbf24; border-radius: 2px; }
.claim-source  { font-size: 10px; color: #6b7b8b; margin-top: 4px; line-height: 1.4; }
.claim-note    { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.45; font-style: italic; }

.dir-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.dir-promise    { background: #1a3a2a; color: #4ade80; }
.dir-target     { background: #1a2a3a; color: #60a5fa; }
.dir-constraint { background: #3a1d22; color: #f87171; }
.dir-gap        { background: #3a2a10; color: #f59e0b; }

.ungrounded {
  font-size: 9px; color: #f59e0b;
  display: inline-block; padding: 1px 6px; border-radius: 4px; background: #3a2a10;
}

/* Feature detail additions */
.planning-ref-badge {
  display: inline-block; margin-left: 8px;
  padding: 1px 8px; border-radius: 10px; font-size: 11px;
  background: #2a1e3a; color: #c084fc; font-family: monospace;
}
.source-item {
  font-size: 12px; color: var(--muted); margin-bottom: 6px; line-height: 1.4;
}
.source-item a { color: var(--accent); text-decoration: none; }
.source-item a:hover { text-decoration: underline; }

.marker {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0,0,0,.4);
}

#detail {
  width: 340px;
  flex: 0 0 auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 20px;
  position: relative;
}
#detail-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
#detail h3 { margin: 0 24px 4px 0; font-size: 16px; }
#detail .meta { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
#detail .status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; }
#detail .status.published { background: #1d3a2a; color: var(--synergy); }
#detail .status.emerging { background: #3a341d; color: #fbbf24; }
#detail p.summary { font-size: 13px; line-height: 1.5; }
#detail .themes { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 16px; }
#detail .themes span { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--panel-2); color: var(--muted); }
#detail h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; }
.rel { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; margin-bottom: 10px; font-size: 12px; }
.rel.synergy { border-color: var(--synergy); }
.rel.dependency { border-color: var(--dependency); }
.rel.tension { border-color: var(--tension); }
.rel .rel-target { font-weight: 600; cursor: pointer; }
.rel .rel-target:hover { color: var(--accent); }
.rel .rel-note { color: var(--muted); margin-top: 3px; line-height: 1.45; }
#detail .grounded { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: #14323f; color: var(--accent); }
#detail ul.facts { margin: 0; padding-left: 16px; }
#detail ul.facts li { font-size: 12px; line-height: 1.45; color: var(--text); margin-bottom: 6px; }
#detail a.source { display: block; color: var(--accent); font-size: 12px; text-decoration: none; margin-bottom: 5px; }
#detail a.source:hover { text-decoration: underline; }

.maplibregl-popup-content { background: var(--panel-2); color: var(--text); font-size: 12px; border-radius: 6px; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--panel-2); }

/* ── Mobile ──────────────────────────────────────────────────── */
.mob-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 18px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  flex: 0 0 auto;
}

#mob-scrim {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.45);
}
#mob-scrim.visible { display: block; }

@media (max-width: 767px) {
  .mob-menu-btn { display: block; }

  header { padding: 10px 14px; gap: 10px; }
  header h1 { font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header h1 span { display: none; }
  .views { display: flex; flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; margin: 0; }
  .views button { padding: 5px 10px; font-size: 12px; }
  .about-link { display: none; }
  #suggest-fab { bottom: 58px; right: 14px; }

  main { position: relative; }

  /* Sidebar slides in from the left as an overlay */
  #sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.6);
  }

  /* Detail panel slides up from the bottom */
  #detail {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    max-height: 60vh;
    border-left: none;
    border-top: 1px solid var(--line);
    z-index: 20;
  }

  /* Stage fills the full width */
  #stage { width: 100%; }
}
