
:root {
  --ink: var(--seed-ink);
  --muted: var(--seed-muted);
  --soft-muted: #9a9ea4;
  --paper: var(--seed-canvas);
  --panel: var(--seed-surface);
  --white: var(--seed-surface);
  --line: var(--seed-line);
  --line-strong: var(--seed-line-strong);
  --olive: var(--seed-olive);
  --blue: var(--seed-blue);
  --orange: var(--seed-orange);
  --red: var(--seed-red);
  --deep: var(--seed-ink);
  --shadow: var(--seed-shadow);
  --panel-width: 390px;
  --radius: 24px;
  --font: var(--seed-font);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body { font-family: var(--font); color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(153, 203, 229, .42);
  outline-offset: 2px;
}

.archive-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 140;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 18px;
  border-bottom: 1px solid #cfcec7;
  background: #f7f4e9;
  box-shadow: 0 4px 14px rgba(42, 43, 41, .06);
}
.archive-banner-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.archive-banner-copy strong {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
}
.archive-banner-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.archive-back-link {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}
.archive-back-link:hover { color: var(--red); }
.archive-banner.error {
  border-bottom-color: #d7b5ae;
  background: #f8ece9;
}
.archive-banner.error .archive-banner-copy strong,
.archive-banner.error .archive-banner-copy span { color: #7a2f2f; }
body.archive-mode .app-shell {
  inset: 52px 0 0;
  height: calc(100dvh - 52px);
}
body.archive-mode .panel-toggle-button { top: 83px; }
body.archive-mode .field input[readonly],
body.archive-mode .field textarea[readonly],
body.archive-mode .chat-composer textarea[readonly] {
  background: #f6f5f0;
  color: #555650;
  cursor: default;
}
body.archive-mode .map-node { cursor: pointer; }
body.archive-mode .conversation-composer-shell { display: none; }
body.archive-mode .form-note { margin-bottom: 0; }

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: var(--panel-width) minmax(0, 1fr);
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 240ms ease;
}
.app-shell.panel-collapsed { grid-template-columns: 0 minmax(0, 1fr); }

.control-panel {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid var(--line);
  transition: transform 240ms ease, opacity 160ms ease;
}
.panel-collapsed .control-panel { transform: translateX(-100%); opacity: 0; pointer-events: none; }

.brand-header {
  flex: 0 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  padding: 15px 52px 15px 22px;
  border-bottom: 1px solid var(--line);
}
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-symbol { width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; display: block; }
.brand-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.brand-copy strong { color: var(--ink); font-size: 20px; font-weight: 700; letter-spacing: 0em; white-space: nowrap; }
.brand-copy span { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.icon-button { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 24px; line-height: 1; }
.icon-button:hover { background: #efeee8; }

.panel-tabs {
  flex: 0 0 54px;
  height: 54px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.panel-tab {
  min-width: 0;
  height: 54px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 2px 4px 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.panel-tab.active { color: var(--ink); border-color: var(--red); }

.panel-scroll {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-section {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 22px 72px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-gutter: stable;
}
.panel-section::-webkit-scrollbar,
.chat-log::-webkit-scrollbar { width: 9px; }
.panel-section::-webkit-scrollbar-thumb,
.chat-log::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; }
.panel-section.active { display: block; }
.panel-section.conversation-panel.active { display: flex; }
.section-intro { margin-bottom: 22px; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: .13em; font-size: 9px; font-weight: 700; color: var(--red); margin-bottom: 8px; }
.section-intro h1, .section-intro h2, .map-overview h2, .selected-heading h2 { margin: 0 0 9px; line-height: 1.12; font-weight: 600; }
.section-intro h1 { font-size: 21px; }
.section-intro h2, .map-overview h2, .selected-heading h2 { font-size: 21px; }
.section-intro p, .map-overview > p { margin: 0; color: var(--muted); line-height: 1.52; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.field > span { font-size: 11px; font-weight: 600; color: #54544f; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field textarea { resize: vertical; min-height: 44px; }
.field input:hover, .field textarea:hover { border-color: #aaa99f; }
.field input:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(153,203,229,.18); outline: 0; }
.additional-context { margin: 1px 0 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.additional-context summary { cursor: pointer; padding: 13px 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.additional-context summary span { float: right; color: var(--soft-muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.additional-context[open] summary { margin-bottom: 8px; }

.primary-button, .secondary-button, .tool-button { border-radius: 10px; cursor: pointer; transition: transform 120ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease; }
.primary-button { width: 100%; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--deep); background: var(--deep); color: var(--white); padding: 12px 14px; font-size: 13px; font-weight: 600; }
.primary-button:hover { background: #373737; transform: translateY(-1px); }
.primary-button.compact-full { margin-top: 14px; }
.delete-node-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 9px;
  padding: 10px 13px;
  border: 1px solid #d9b8c2;
  border-radius: 10px;
  background: transparent;
  color: var(--red);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.delete-node-button:hover { background: #fff1f4; border-color: #c98b9e; }
.delete-node-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.secondary-button { width: 100%; border: 1px solid var(--line-strong); background: var(--white); padding: 10px 13px; font-size: 12px; font-weight: 600; margin-top: 8px; }
.secondary-button:hover { border-color: var(--olive); background: #fafaf7; }
.secondary-button.inline { width: auto; padding: 10px 18px; }
button:disabled { opacity: .46; cursor: not-allowed; transform: none !important; }
.form-note { color: var(--soft-muted); font-size: 10px; line-height: 1.45; text-align: center; margin: 12px 15px 0; }
.api-notice { padding: 10px 11px; margin: 0 0 12px; border-radius: 9px; background: #fff6e8; border: 1px solid #ead5b1; color: #765a24; font-size: 11px; line-height: 1.45; }

.panel-footer { flex: 0 0 43px; min-height: 43px; display: flex; align-items: center; gap: 8px; padding: 0 22px; border-top: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #aaa; }
.status-dot.ready { background: #5a8b68; box-shadow: 0 0 0 4px rgba(90,139,104,.12); }
.status-dot.offline { background: #c2755f; }
.status-separator { opacity: .48; }
.footer-credit { color: inherit; text-decoration: none; white-space: nowrap; transition: color 150ms ease; }
.footer-credit:hover, .footer-credit:focus-visible { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

.panel-toggle-button {
  position: fixed;
  left: calc(var(--panel-width) - 21px);
  top: 31px;
  z-index: 32;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 5px 20px rgba(0,0,0,.09);
  cursor: pointer;
  transition: left 240ms ease, background 150ms ease, box-shadow 150ms ease;
}
.panel-toggle-button:hover { background: #f2f1eb; box-shadow: 0 7px 24px rgba(0,0,0,.12); }
.panel-toggle-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 240ms ease;
}
.panel-collapsed .panel-toggle-button { left: 18px; }
.panel-collapsed .panel-toggle-button svg { transform: rotate(180deg); }

.map-overview { margin-bottom: 17px; }
.reflection-card, .seed-question { margin-top: 15px; border-left: 3px solid var(--orange); background: #fff8ea; padding: 11px 12px; border-radius: 0 10px 10px 0; }
.reflection-card small, .seed-question small { display: block; color: #82622a; text-transform: uppercase; letter-spacing: .11em; font-size: 8px; font-weight: 700; margin-bottom: 5px; }
.reflection-card p, .seed-question p { margin: 0; font-size: 12px; line-height: 1.48; }

.selected-panel { margin-bottom: 18px; }
.selected-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.selected-heading h2 { margin-bottom: 0; }
.selected-description { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 11px 0 10px; }
.node-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.node-tag { display: inline-flex; align-items: center; border: 0; border-radius: 999px; background: var(--tag-colour, #e8e7e1); padding: 6px 10px; color: #555650; font-size: 9px; font-weight: 600; }
.node-source { color: var(--soft-muted); font-size: 9px; }
.node-details { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.node-details > div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.node-details dt { color: var(--soft-muted); text-transform: uppercase; letter-spacing: .09em; font-size: 8px; font-weight: 700; margin-bottom: 4px; }
.node-details dd { margin: 0; color: #555550; font-size: 11.5px; line-height: 1.45; }

.conversation-panel {
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.conversation-header {
  flex: 0 0 auto;
  padding: 24px 22px 13px;
  border-bottom: 1px solid var(--line);
}
.conversation-header .eyebrow { margin-bottom: 8px; }
.conversation-header h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.12;
  font-weight: 600;
}

.chat-log {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 18px 22px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.chat-message { border-radius: 11px; padding: 11px 12px; font-size: 12px; line-height: 1.48; }
.chat-message p { margin: 0; white-space: pre-wrap; }
.chat-message.assistant { background: #f0f1ed; border: 1px solid #dedfd9; }
.chat-message.user { background: #fff; border: 1px solid var(--line); margin-left: 22px; }
.chat-role { display: block; margin-bottom: 5px; color: var(--red); text-transform: uppercase; letter-spacing: .1em; font-size: 8px; font-weight: 700; }
.chat-message.user .chat-role { color: var(--muted); }
.chat-reflection { margin-top: 8px !important; color: #6f623f; font-style: italic; }

.conversation-composer-shell {
  flex: 0 0 auto;
  padding: 12px 22px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.prompt-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.prompt-shortcuts button {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 9.5px;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.prompt-shortcuts button:hover { border-color: var(--blue); color: var(--ink); }
.chat-composer textarea {
  width: 100%;
  min-height: 88px;
  max-height: 180px;
  margin-bottom: 8px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.45;
}

.visualisation {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr) 43px;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
}
.canvas-header {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0 18px 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(243,242,237,.97);
  backdrop-filter: blur(10px);
  transition: padding-left 220ms ease;
}
.panel-collapsed .canvas-header { padding-left: 72px; }
.canvas-title-group { min-width: 0; }
.canvas-header h2 { margin: 0; max-width: min(52vw, 680px); font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.canvas-actions { position: relative; display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.tool-button { border: 1px solid transparent; background: transparent; padding: 7px 9px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tool-button:hover, .tool-button[aria-expanded="true"] { background: rgba(255,255,255,.78); border-color: var(--line); color: var(--ink); }
.danger { color: #9d4d3a !important; }
.layer-control { position: relative; }
.layer-button span { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; margin-left: 4px; padding: 2px 6px; border-radius: 999px; background: #e8e7e1; color: #686862; font-size: 9px; }
.layers-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 278px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(251,250,247,.98);
  box-shadow: 0 14px 38px rgba(40,40,38,.16);
  backdrop-filter: blur(10px);
}
.layers-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 9px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.layers-popover-heading strong { font-size: 11px; }
.layers-popover-heading button { border: 0; padding: 0; background: transparent; color: var(--red); font-size: 9px; font-weight: 600; cursor: pointer; }
.layers-help { margin: 0 0 11px; color: var(--soft-muted); font-size: 8.8px; line-height: 1.4; }
.layer-options { display: block; }
.layer-chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.layer-options-divider { height: 1px; margin: 13px 0 9px; background: var(--line); }
.layer-option.layer-chip { position: relative; display: block; cursor: pointer; }
.layer-option.layer-chip input { position: absolute; opacity: 0; pointer-events: none; }
.layer-option.layer-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--layer-colour);
  color: #51524d;
  font-size: 9.5px;
  font-weight: 600;
  text-align: center;
  transition: opacity 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.layer-option.layer-chip:hover span { box-shadow: inset 0 0 0 1px rgba(66,66,66,.14); }
.layer-option.layer-chip input:not(:checked) + span { opacity: .34; background: #efeee9; border-color: #d9d8d1; color: #73736e; }
.layer-option.layer-chip input:focus-visible + span { outline: 3px solid rgba(153,203,229,.42); outline-offset: 2px; }
.relationship-controls { display: grid; gap: 2px; }
.relationship-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 3px; cursor: pointer; }
.relationship-option > span { display: grid; gap: 2px; }
.relationship-option strong { color: #555650; font-size: 10px; font-weight: 600; }
.relationship-option small { color: var(--soft-muted); font-size: 8.5px; }
.relationship-option input { position: absolute; opacity: 0; pointer-events: none; }
.relationship-option.disabled { opacity: .42; cursor: not-allowed; }
.toggle-switch { position: relative; display: block; width: 34px; height: 20px; border-radius: 999px; background: #cfcec7; transition: background 150ms ease; }
.toggle-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: transform 150ms ease; }
.relationship-option input:checked + .toggle-switch { background: var(--red); }
.relationship-option input:checked + .toggle-switch::after { transform: translateX(14px); }
.relationship-option input:focus-visible + .toggle-switch { outline: 3px solid rgba(153,203,229,.42); outline-offset: 2px; }

.canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
  background: #f5f4ef;
}
#mapSvg { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 220ms ease; touch-action: none; }
#mapSvg.visible { opacity: 1; }
.empty-state { position: absolute; z-index: 4; left: 50%; top: 48%; transform: translate(-50%, -50%); width: min(450px, calc(100% - 50px)); text-align: center; }
.empty-state.hidden { display: none; }
.empty-logo { width: 112px; height: 112px; max-width: 34%; object-fit: contain; margin-bottom: 18px; opacity: .94; }
.empty-product-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 0 0 11px;
}
.empty-product-lockup strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.02em;
}
.empty-product-lockup span {
  color: var(--red);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.empty-state h2 { margin: 7px auto 12px; max-width: 620px; font-size: 32px; line-height: 1.13; font-weight: 600; }
.empty-state p { margin: 0 auto 22px; max-width: 610px; color: var(--muted); line-height: 1.55; font-size: 14px; }
.canvas-footer { min-height: 43px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 15px; min-width: 0; padding: 0 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; background: var(--paper); }
.footer-warning { text-align: right; color: #7d7568; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.loading-overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; text-align: center; background: rgba(245,244,239,.86); backdrop-filter: blur(5px); }
.loading-overlay strong { font-size: 18px; font-weight: 600; margin-top: 17px; }
.loading-overlay p { max-width: 390px; margin: 7px 24px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.loading-seed-icon { width: 78px; height: 78px; object-fit: contain; animation: seed-spin 1.7s linear infinite; filter: drop-shadow(0 8px 14px rgba(55,55,50,.10)); }
@keyframes seed-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading-seed-icon { animation: seed-breathe 1.5s ease-in-out infinite alternate; }
  @keyframes seed-breathe { from { opacity: .72; transform: scale(.96); } to { opacity: 1; transform: scale(1.02); } }
}

.toast { position: fixed; z-index: 100; left: 50%; bottom: 44px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; background: #424242; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 11px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: 180ms ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-height: 720px) {
  .chat-log { padding-top: 14px; padding-bottom: 14px; }
  .conversation-composer-shell { padding-top: 10px; padding-bottom: 12px; }
  .chat-composer textarea { min-height: 72px; }
}

/* D3 map */
.map-edge { fill: none; stroke: #858782; stroke-width: 1.25; opacity: .62; pointer-events: none; }
.map-edge.highlighted { stroke: #454541; stroke-width: 2; opacity: .92; }
.edge-label-layer { pointer-events: none; }
.edge-label-bg { fill: rgba(247,246,241,.96); stroke: #deddd7; stroke-width: .75; }
.edge-label-text { fill: #666762; font-size: 10.5px; font-weight: 400; letter-spacing: 0; pointer-events: none; }
.edge-label-group.dimmed { opacity: .08; }
.map-node { cursor: pointer; }
.node-card { stroke-width: 1.25; filter: drop-shadow(0 6px 12px rgba(52,53,50,.08)); }
.map-node.selected .node-card { stroke: #424242 !important; stroke-width: 2.25; filter: drop-shadow(0 8px 16px rgba(40,40,38,.16)); }
.map-node.dimmed { opacity: .18; }
.map-edge.dimmed { opacity: .08; }
.node-label { fill: #454541; font-size: 13.2px; font-weight: 600; pointer-events: none; }
.node-lens-pill { pointer-events: none; }
.node-lens-label { fill: #555650; font-size: 8px; font-weight: 650; letter-spacing: .055em; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map-node.starting-point .node-lens-label { fill: var(--red); }
.canvas-wrap { cursor: grab; }
.canvas-wrap:active { cursor: grabbing; }

@media (max-width: 1080px) {
  .canvas-actions .tool-button:nth-last-child(2) { display: none; }
}
@media (max-width: 920px) {
  :root { --panel-width: 350px; }
  .canvas-actions .tool-button:nth-last-child(3) { display: none; }
  .canvas-header h2 { max-width: 38vw; }
}
@media (max-width: 680px) {
  .app-shell { grid-template-columns: 1fr; }
  .control-panel { position: fixed; width: min(390px, 94vw); left: 0; top: 0; box-shadow: var(--shadow); }
  .app-shell.panel-collapsed .control-panel { transform: translateX(-100%); }
  .visualisation { grid-column: 1; }
  .canvas-header { padding-left: 60px; }
  .canvas-header h2 { max-width: 36vw; font-size: 15px; }
  .canvas-actions .tool-button:not(.layer-button):not(#fitButton) { display: none; }
    .footer-warning { display: none; }
  .canvas-footer { grid-template-columns: 1fr; }
  .canvas-footer .footer-warning { display: none; }
  .layers-popover { position: fixed; top: 66px; right: 12px; }
}

/* Temporal canvas scaffold */
.temporal-zone-layer { pointer-events: none; }
.temporal-zone,
.temporal-transition { stroke: none; }
.temporal-zone.zone-current,
.temporal-zone.zone-immediate,
.temporal-zone.zone-long_term { fill: #f3f2ed; }
.temporal-transition { display: none; }
.temporal-divider {
  stroke: #9b9d96;
  stroke-width: 1.5;
  stroke-dasharray: 1 7;
  stroke-linecap: round;
  opacity: .72;
  vector-effect: non-scaling-stroke;
}
.temporal-label {
  fill: #858680;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-anchor: middle;
}

/* Safer optional relationship labels */
.edge-label-bg {
  fill: rgba(247,246,241,.94);
  stroke: none;
}
.edge-label-text {
  fill: #696a65;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0;
}

.zoom-controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 18;
  display: grid;
  grid-template-columns: 30px minmax(96px, 150px) 30px 44px;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(251,250,247,.94);
  box-shadow: 0 8px 24px rgba(42,43,41,.12);
  backdrop-filter: blur(9px);
}
.zoom-controls button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.zoom-controls button:hover { border-color: #aaa99f; background: #f7f6f1; }
.zoom-controls input[type="range"] {
  width: 100%;
  accent-color: var(--red);
  cursor: pointer;
}
.zoom-controls output {
  display: block;
  min-width: 38px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}

@media (max-width: 760px) {
  .zoom-controls { grid-template-columns: 30px 86px 30px; right: 10px; bottom: 10px; }
  .zoom-controls output { display: none; }
}

/* v2.8 — fixed temporal scaffold */
.temporal-zone-layer { pointer-events: none; }
#loadJsonInput { display: none !important; }

@media (min-width: 681px) and (max-width: 720px) {
  .panel-toggle-button { left: calc(var(--panel-width) - 21px); }
}
@media (max-width: 680px) {
  .panel-toggle-button { left: calc(min(390px, 94vw) - 21px); }
  .panel-collapsed .panel-toggle-button { left: 14px; }
}


/* Privacy consent gate */
body.privacy-gated { overflow: hidden; }
body.privacy-gated #app { user-select: none; }
.privacy-dialog {
  width: min(610px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: #fbfaf7;
  color: var(--text, #454541);
  box-shadow: 0 28px 90px rgba(48, 48, 44, .24);
  overflow: hidden;
}
.privacy-dialog::backdrop {
  background: rgba(44, 45, 42, .48);
  backdrop-filter: blur(8px);
}
.privacy-dialog-card {
  max-height: calc(100vh - 32px);
  padding: 32px 34px 26px;
  overflow-y: auto;
}
.privacy-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 26px;
}
.privacy-brand img { width: 46px; height: 46px; object-fit: contain; }
.privacy-brand div { display: grid; gap: 3px; }
.privacy-brand strong { font-size: 21px; line-height: 1; letter-spacing: -.025em; }
.privacy-brand span { font-size: 10px; font-weight: 600; letter-spacing: .17em; text-transform: uppercase; color: #777873; }
.privacy-dialog h2 {
  margin: 8px 0 13px;
  font-size: clamp(29px, 5vw, 39px);
  line-height: 1.05;
  letter-spacing: -.035em;
}
.privacy-copy { color: #676863; font-size: 14px; line-height: 1.58; }
.privacy-copy p { margin: 0 0 12px; }
.privacy-intro { color: #51524e; font-size: 15px; line-height: 1.55; }
.privacy-summary-card {
  margin: 17px 0;
  padding: 14px 15px;
  border: 1px solid #dfded7;
  border-radius: 12px;
  background: #f4f2eb;
}
.privacy-summary-card h3 {
  margin: 0 0 6px;
  color: #4e4f4b;
  font-size: 12px;
  letter-spacing: -.01em;
}
.privacy-summary-card p { margin: 0; font-size: 13px; line-height: 1.5; }
.privacy-consent-check {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid #d9d8d1;
  border-radius: 11px;
  background: #fffefa;
  color: #52534f;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.privacy-consent-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #a70c37;
}
.privacy-consent-check:has(input:focus-visible) {
  outline: 3px solid rgba(153,203,229,.42);
  outline-offset: 2px;
}
.privacy-policy-line {
  margin: 13px 0 0;
  color: #747570;
  font-size: 12px;
  line-height: 1.5;
}
.privacy-policy-line a,
.privacy-copy a {
  color: #a70c37;
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 3px;
  outline: none;
}
.privacy-policy-line a:focus-visible,
.privacy-copy a:focus-visible {
  border-radius: 3px;
  outline: 3px solid rgba(153,203,229,.42);
  outline-offset: 2px;
}
.privacy-actions { display: grid; gap: 9px; margin-top: 20px; }
.privacy-actions .primary-button { margin: 0; }
.privacy-actions .primary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.privacy-decline {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  color: #686964;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.privacy-decline:hover,
.privacy-decline:focus-visible { color: #a70c37; text-decoration: underline; text-underline-offset: 3px; }
.privacy-version { margin: 14px 0 0; text-align: center; color: #9a9a95; font-size: 10px; letter-spacing: .04em; }
.privacy-footer-link { white-space: nowrap; }

/* Keep initial dialog focus visually quiet while preserving keyboard focus elsewhere. */
.privacy-dialog h2:focus { outline: none; }

@media (max-width: 620px) {
  .privacy-dialog-card { padding: 25px 21px 22px; }
  .privacy-brand { margin-bottom: 22px; }
  .privacy-summary-card { padding: 13px; }
}

@media (max-width: 680px) {
  .archive-banner { min-height: 58px; padding: 8px 12px; }
  .archive-banner-copy { display: grid; gap: 2px; }
  .archive-banner-copy span { max-width: 62vw; }
  body.archive-mode .app-shell { inset: 58px 0 0; height: calc(100dvh - 58px); }
  body.archive-mode .control-panel { top: 58px; height: calc(100dvh - 58px); }
  body.archive-mode .panel-toggle-button { top: 89px; }
}

/* =========================================================
   v4.7.0 — SEED AI platform visual alignment
   Front-end only. Existing map, session and archive behaviour is preserved.
   ========================================================= */

html,
body {
  background:
    radial-gradient(circle at 4% 8%, rgba(167, 201, 226, .20), transparent 28%),
    radial-gradient(circle at 92% 92%, rgba(235, 161, 41, .08), transparent 24%),
    var(--seed-canvas);
}

body { color: var(--seed-ink); }

.app-shell {
  grid-template-columns: var(--panel-width) minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: transparent;
}

.app-shell.panel-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

.control-panel,
.visualisation {
  border: 1px solid rgba(24, 26, 29, .07);
  border-radius: 24px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--seed-shadow);
}

.control-panel {
  border-right: 1px solid rgba(24, 26, 29, .07);
}

.brand-header {
  min-height: 72px;
  padding: 0 22px;
  border-bottom: 0;
  background: rgba(255, 255, 255, .88);
}

.brand-lockup { gap: 11px; }
.brand-symbol {
  width: 43px;
  height: 43px;
  flex-basis: 43px;
}
.brand-copy { gap: 2px; }
.brand-copy strong {
  color: var(--seed-ink);
  font-size: 16px;
  font-weight: 780;
  letter-spacing: -.025em;
}
.brand-copy span {
  color: var(--seed-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
}

.panel-tabs {
  flex-basis: 58px;
  height: 58px;
  gap: 4px;
  margin: 0 14px;
  padding: 7px 0 8px;
  border-top: 1px solid rgba(229, 230, 228, .82);
  border-bottom: 1px solid rgba(229, 230, 228, .82);
}

.panel-tab {
  height: 42px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  color: #7d8289;
  font-size: 11.5px;
  font-weight: 740;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.panel-tab:hover { color: var(--seed-ink); background: var(--seed-surface-soft); }
.panel-tab.active {
  color: var(--seed-red);
  border-color: transparent;
  background: var(--seed-red-soft);
  box-shadow: inset 0 0 0 1px rgba(170, 0, 61, .045);
}

.panel-section {
  padding: 28px 22px 78px;
  scrollbar-color: #d2d4d2 transparent;
}
.panel-section::-webkit-scrollbar,
.chat-log::-webkit-scrollbar { width: 9px; }
.panel-section::-webkit-scrollbar-thumb,
.chat-log::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #d2d4d2;
  background-clip: padding-box;
}

.section-intro { margin-bottom: 25px; }
.eyebrow {
  color: var(--seed-red);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .13em;
}
.section-intro h1,
.section-intro h2,
.map-overview h2,
.selected-heading h2 {
  color: var(--seed-ink);
  letter-spacing: -.035em;
}
.section-intro h1 { margin-bottom: 11px; font-size: 27px; line-height: 1.06; }
.section-intro h2,
.map-overview h2,
.selected-heading h2 { font-size: 23px; }
.section-intro p,
.map-overview > p {
  color: var(--seed-muted);
  font-size: 12.5px;
  line-height: 1.58;
}

.field { gap: 7px; margin-bottom: 16px; }
.field > span {
  color: #555a61;
  font-size: 11px;
  font-weight: 730;
}
.field input,
.field textarea,
.chat-composer textarea {
  border: 1px solid var(--seed-line-strong);
  border-radius: 14px;
  color: var(--seed-ink);
  background: #fff;
  box-shadow: 0 5px 15px rgba(24, 26, 29, .025);
}
.field input,
.field textarea { padding: 12px 13px; font-size: 13px; }
.field input::placeholder,
.field textarea::placeholder,
.chat-composer textarea::placeholder { color: #a0a4aa; }
.field input:hover,
.field textarea:hover,
.chat-composer textarea:hover { border-color: #c6c9c6; }
.field input:focus,
.field textarea:focus,
.chat-composer textarea:focus {
  border-color: rgba(170, 0, 61, .36);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(170, 0, 61, .06), 0 7px 18px rgba(24, 26, 29, .035);
}

.additional-context {
  margin: 5px 0 18px;
  border-color: var(--seed-line);
}
.additional-context summary {
  padding: 14px 1px;
  color: #6e747c;
  font-size: 11.5px;
  font-weight: 730;
}
.additional-context summary span { color: #a0a4aa; }

.primary-button,
.secondary-button,
.tool-button,
.delete-node-button {
  transition: transform .14s ease, background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--seed-red);
  box-shadow: 0 9px 24px rgba(170, 0, 61, .17);
  font-size: 12.5px;
  font-weight: 760;
}
.primary-button:hover {
  background: var(--seed-red-deep);
  transform: translateY(-1px);
}
.secondary-button {
  min-height: 43px;
  border: 1px solid var(--seed-line);
  border-radius: 14px;
  color: var(--seed-ink-2);
  background: #fff;
  font-size: 12px;
  font-weight: 730;
}
.secondary-button:hover {
  border-color: #cfd1cf;
  background: var(--seed-surface-soft);
  transform: translateY(-1px);
}
.delete-node-button {
  min-height: 42px;
  border-color: #ead2dc;
  border-radius: 13px;
  color: var(--seed-red);
  background: #fff;
}
.delete-node-button:hover {
  border-color: #d9aabd;
  background: var(--seed-red-soft);
}
.form-note { color: #989ca2; font-size: 9.5px; line-height: 1.5; }
.api-notice {
  border-color: #eadcc1;
  border-radius: 13px;
  background: #fff8e9;
}

.panel-footer {
  flex-basis: 46px;
  min-height: 46px;
  padding: 0 22px;
  border-top-color: rgba(229, 230, 228, .88);
  color: #8f949b;
  background: rgba(255, 255, 255, .92);
  font-size: 9px;
}
.status-dot.ready { background: #5a8b68; }
.footer-credit:hover,
.footer-credit:focus-visible { color: var(--seed-red); }

.panel-toggle-button {
  left: calc(14px + var(--panel-width) - 21px);
  top: 31px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--seed-line);
  border-radius: 13px;
  color: var(--seed-ink-2);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 7px 18px rgba(24, 26, 29, .10);
}
.panel-toggle-button:hover {
  color: var(--seed-red);
  background: #fff;
  box-shadow: 0 9px 22px rgba(24, 26, 29, .13);
}
.panel-collapsed .panel-toggle-button { left: 27px; }
.panel-toggle-button svg { width: 17px; height: 17px; stroke-width: 1.8; }

.reflection-card,
.seed-question {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #eadfca;
  border-left: 1px solid #eadfca;
  border-radius: 14px;
  background: #fff9ed;
}
.reflection-card small,
.seed-question small { color: #8a6621; }
.selected-description { color: var(--seed-muted); }
.node-details { border-top-color: var(--seed-line); }
.node-details > div { border-bottom-color: var(--seed-line); }
.node-details dd { color: #555a61; }
.node-tag {
  padding: 6px 10px;
  color: #52575e;
  font-size: 9px;
  font-weight: 700;
}
.icon-button { color: #787d84; border-radius: 12px; }
.icon-button:hover { color: var(--seed-red); background: var(--seed-red-soft); }

.conversation-header {
  padding: 27px 22px 15px;
  border-bottom-color: var(--seed-line);
}
.conversation-header h2 { color: var(--seed-ink); font-size: 23px; letter-spacing: -.035em; }
.chat-log { gap: 12px; padding: 19px 22px; }
.chat-message {
  padding: 12px 13px;
  border-radius: 14px;
  color: var(--seed-ink-2);
  font-size: 12px;
  line-height: 1.55;
}
.chat-message.assistant {
  border: 1px solid var(--seed-line);
  background: var(--seed-surface-soft);
}
.chat-message.user {
  margin-left: 24px;
  border: 0;
  color: #fff;
  background: var(--seed-red);
  box-shadow: 0 7px 18px rgba(170, 0, 61, .10);
}
.chat-role { color: var(--seed-red); font-weight: 850; }
.chat-message.user .chat-role { color: rgba(255, 255, 255, .72); }
.chat-reflection { color: #786332; }
.conversation-composer-shell {
  padding: 12px 22px 18px;
  border-top-color: var(--seed-line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}
.prompt-shortcuts { gap: 7px; margin-bottom: 11px; }
.prompt-shortcuts button {
  min-height: 30px;
  padding: 7px 11px;
  border-color: var(--seed-line);
  color: #686e76;
  background: #fff;
  font-size: 9.5px;
  font-weight: 650;
}
.prompt-shortcuts button:hover {
  border-color: #d9aabd;
  color: var(--seed-red);
  background: var(--seed-red-soft);
}
.chat-composer textarea {
  min-height: 96px;
  padding: 13px;
  font-size: 12.5px;
  line-height: 1.5;
}

.visualisation {
  grid-template-rows: 64px minmax(0, 1fr) 44px;
  background: rgba(255, 255, 255, .96);
}
.canvas-header {
  padding: 0 14px 0 24px;
  border-bottom-color: rgba(229, 230, 228, .88);
  background: rgba(255, 255, 255, .91);
  backdrop-filter: blur(14px);
}
.panel-collapsed .canvas-header { padding-left: 72px; }
.canvas-header h2 {
  color: var(--seed-ink);
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.025em;
}
.canvas-actions { gap: 5px; }
.tool-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #747a83;
  background: transparent;
  font-size: 10.5px;
  font-weight: 730;
  cursor: pointer;
}
.tool-button svg { width: 16px; height: 16px; flex: 0 0 16px; }
.tool-button:hover,
.tool-button[aria-expanded="true"] {
  border-color: var(--seed-line);
  color: var(--seed-ink);
  background: rgba(246, 246, 243, .95);
}
.compact-tool { padding-inline: 9px; }
.layer-button span {
  margin-left: 1px;
  color: #6a7078;
  background: var(--seed-surface-soft);
}
.new-map-button {
  min-height: 42px;
  padding: 0 14px 0 16px;
  border: 0;
  color: #fff;
  background: var(--seed-red);
  box-shadow: 0 8px 20px rgba(170, 0, 61, .16);
  font-size: 11px;
  font-weight: 760;
}
.new-map-button:hover {
  border-color: transparent;
  color: #fff;
  background: var(--seed-red-deep);
}
.new-map-button svg { width: 17px; height: 17px; }

.layers-popover {
  width: 292px;
  padding: 15px;
  border-color: var(--seed-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 48px rgba(24, 26, 29, .16);
}
.layers-popover-heading { border-bottom-color: var(--seed-line); }
.layers-popover-heading button { color: var(--seed-red); }
.layers-help { color: #90959b; }
.layer-option.layer-chip span { min-height: 34px; font-weight: 700; }
.relationship-option input:checked + .toggle-switch { background: var(--seed-red); }

.canvas-wrap {
  background:
    radial-gradient(circle at 10% 12%, rgba(167, 201, 226, .11), transparent 24%),
    radial-gradient(circle at 88% 84%, rgba(235, 161, 41, .045), transparent 22%),
    var(--seed-surface-soft);
}
.empty-state {
  top: 50%;
  width: min(760px, calc(100% - 72px));
}
.hero-mark {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  margin: 0 auto 21px;
  border-radius: 28px;
  background: linear-gradient(145deg, #fff, #f2f2ee);
  box-shadow: 0 17px 42px rgba(24, 26, 29, .11), inset 0 0 0 1px rgba(24, 26, 29, .04);
}
.empty-logo {
  width: 72px;
  height: 72px;
  max-width: none;
  margin: 0;
  opacity: 1;
}
.empty-state .eyebrow { margin: 0 0 10px; }
.empty-state h2 {
  max-width: 720px;
  margin: 0 auto;
  color: var(--seed-ink);
  font-size: clamp(36px, 4.1vw, 58px);
  font-weight: 780;
  line-height: 1.03;
  letter-spacing: -.055em;
}
.empty-state > p:not(.eyebrow):not(.empty-note) {
  max-width: 660px;
  margin: 19px auto 25px;
  color: var(--seed-muted);
  font-size: 15px;
  line-height: 1.64;
}
.empty-demo-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  margin: 0;
  padding: 0 18px 0 20px;
  border: 0;
  color: #fff;
  background: var(--seed-red);
  box-shadow: 0 9px 24px rgba(170, 0, 61, .17);
  font-size: 12.5px;
  font-weight: 760;
}
.empty-demo-button:hover { color: #fff; background: var(--seed-red-deep); }
.empty-demo-button svg { width: 17px; height: 17px; }
.empty-note {
  margin: 10px 0 0 !important;
  color: #989ca2 !important;
  font-size: 10.5px !important;
  line-height: 1.4 !important;
}
.canvas-footer {
  min-height: 44px;
  padding: 0 20px;
  border-top-color: rgba(229, 230, 228, .88);
  color: #8b9097;
  background: rgba(255, 255, 255, .92);
  font-size: 9.5px;
}
.footer-warning { color: #8b8580; }
.loading-overlay {
  background: rgba(246, 246, 243, .88);
  backdrop-filter: blur(8px);
}
.loading-overlay strong { color: var(--seed-ink); }
.loading-seed-icon { filter: drop-shadow(0 9px 18px rgba(24, 26, 29, .10)); }

.zoom-controls {
  right: 18px;
  bottom: 18px;
  padding: 8px;
  border-color: var(--seed-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(24, 26, 29, .10);
}
.zoom-controls button {
  border-color: var(--seed-line);
  border-radius: 10px;
  color: var(--seed-ink-2);
}
.zoom-controls button:hover {
  border-color: #cfd1cf;
  color: var(--seed-red);
  background: var(--seed-red-soft);
}
.zoom-controls input[type="range"] { accent-color: var(--seed-red); }
.zoom-controls output { color: var(--seed-muted); }

.temporal-zone.zone-current,
.temporal-zone.zone-immediate,
.temporal-zone.zone-long_term { fill: var(--seed-surface-soft); }
.temporal-divider { stroke: #969a96; opacity: .56; }
.temporal-label { fill: #858a91; font-weight: 720; }
.map-edge { stroke: #858a87; opacity: .57; }
.map-edge.highlighted { stroke: var(--seed-ink-2); }
.edge-label-bg { fill: rgba(255, 255, 255, .94); }
.edge-label-text { fill: #666c73; }
.node-card { filter: drop-shadow(0 6px 12px rgba(24, 26, 29, .075)); }
.map-node.selected .node-card {
  stroke: var(--seed-red) !important;
  stroke-width: 2.25;
  filter: drop-shadow(0 9px 18px rgba(170, 0, 61, .14));
}
.node-label { fill: var(--seed-ink-2); font-weight: 680; }
.node-lens-label { fill: #596068; font-weight: 720; }
.map-node.starting-point .node-lens-label { fill: var(--seed-red); }

.toast {
  bottom: 30px;
  border-radius: 13px;
  background: var(--seed-ink);
  box-shadow: 0 10px 30px rgba(24, 26, 29, .20);
}

.privacy-dialog {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid rgba(24, 26, 29, .08);
  border-radius: 28px;
  color: var(--seed-ink);
  background: #fff;
  box-shadow: 0 30px 90px rgba(20, 22, 26, .25);
}
.privacy-dialog::backdrop {
  background: rgba(28, 30, 34, .38);
  backdrop-filter: blur(8px);
}
.privacy-dialog-card { padding: 34px; }
.privacy-brand { gap: 11px; margin-bottom: 24px; }
.privacy-brand img {
  width: 64px;
  height: 64px;
  padding: 6px;
  border-radius: 20px;
  background: var(--seed-surface-soft);
}
.privacy-brand div { gap: 2px; }
.privacy-brand strong { font-size: 18px; letter-spacing: -.025em; }
.privacy-brand span {
  color: var(--seed-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
}
.privacy-dialog h2 {
  margin: 8px 0 14px;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.privacy-copy { color: #62676d; font-size: 11px; line-height: 1.62; }
.privacy-intro { color: #555a61; font-size: 13px; line-height: 1.58; }
.privacy-summary-card {
  margin: 17px 0;
  padding: 15px 16px;
  border-color: var(--seed-line);
  border-radius: 14px;
  background: var(--seed-surface-warm);
}
.privacy-summary-card h3 { color: var(--seed-ink-2); font-size: 11.5px; }
.privacy-summary-card p { font-size: 10.8px; line-height: 1.58; }
.privacy-policy-line { color: #62676d; font-size: 10.8px; line-height: 1.62; }
.privacy-policy-line a,
.privacy-copy a { color: var(--seed-red); font-weight: 750; }
.privacy-consent-check {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  margin-top: 20px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  color: #555a61;
  background: var(--seed-surface-soft);
  font-size: 11.5px;
  line-height: 1.5;
}
.privacy-consent-check input { accent-color: var(--seed-red); }
.privacy-actions { gap: 7px; }
.privacy-decline { border-radius: 12px; color: #686e76; }
.privacy-decline:hover,
.privacy-decline:focus-visible { color: var(--seed-red); background: var(--seed-surface-soft); text-decoration: none; }
.privacy-version { color: #999da2; font-size: 9px; font-weight: 650; }

.archive-banner {
  border-bottom-color: var(--seed-line);
  color: var(--seed-ink-2);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 5px 18px rgba(24, 26, 29, .08);
}
.archive-back-link:hover { color: var(--seed-red); }

@media (max-width: 1220px) {
  .tool-button { padding-inline: 8px; }
  .tool-button span:not(#layersCount) { display: none; }
  .new-map-button span { display: inline !important; }
  .compact-tool { width: 38px; padding: 0; }
}

@media (max-width: 1080px) {
  .canvas-actions .tool-button:nth-last-child(2) { display: inline-flex; }
  .canvas-actions #exportJsonButton { display: none; }
}

@media (max-width: 920px) {
  :root { --panel-width: 350px; }
  .canvas-actions #exportPngButton,
  .canvas-actions #loadJsonButton { display: none; }
}

@media (max-width: 680px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 8px;
  }
  .control-panel {
    top: 8px;
    left: 8px;
    width: min(390px, calc(100vw - 16px));
    height: calc(100dvh - 16px);
    border-radius: 22px;
  }
  .visualisation { border-radius: 22px; }
  .panel-toggle-button {
    left: calc(min(390px, calc(100vw - 16px)) - 13px);
    top: 27px;
  }
  .panel-collapsed .panel-toggle-button { left: 21px; }
  .canvas-header { padding-left: 60px; }
  .panel-collapsed .canvas-header { padding-left: 60px; }
  .canvas-header h2 { max-width: 42vw; font-size: 14px; }
  .canvas-actions .tool-button:not(.layer-button):not(#fitButton):not(.new-map-button) { display: none; }
  .new-map-button { width: 38px; padding: 0; }
  .new-map-button span { display: none !important; }
  .empty-state { width: min(620px, calc(100% - 34px)); }
  .hero-mark { width: 76px; height: 76px; border-radius: 24px; }
  .empty-logo { width: 62px; height: 62px; }
  .empty-state h2 { font-size: clamp(31px, 9vw, 45px); }
  .empty-state > p:not(.eyebrow):not(.empty-note) { font-size: 13px; }
  .footer-warning { display: none; }
  .canvas-footer { grid-template-columns: 1fr; }
  .privacy-dialog-card { padding: 27px 22px 23px; }
}

@media (max-height: 720px) and (min-width: 681px) {
  .brand-header { min-height: 64px; }
  .brand-symbol { width: 39px; height: 39px; flex-basis: 39px; }
  .panel-tabs { flex-basis: 54px; height: 54px; }
  .panel-section { padding-top: 21px; }
  .empty-state { transform: translate(-50%, -47%) scale(.9); }
}

@media (prefers-reduced-motion: reduce) {
  .control-panel,
  .panel-toggle-button,
  .tool-button,
  .primary-button,
  .secondary-button,
  #mapSvg { transition: none !important; }
}


/* =========================================================
   v4.7.1 — refinement pass
   Tab consistency, header alignment, clearer map typography,
   darker lens contrast, balanced landing layout, and custom warnings.
   ========================================================= */
:root {
  --seed-top-height: 74px;
  --seed-panel-gutter: 22px;
  --seed-canvas-gutter: 22px;
  --seed-tab-height: 62px;
}

.brand-header,
.canvas-header {
  min-height: var(--seed-top-height);
  height: var(--seed-top-height);
}

.brand-header {
  padding: 0 var(--seed-panel-gutter);
  border-bottom: 1px solid rgba(229, 230, 228, .88);
}

.brand-copy strong {
  font-size: 17px;
  font-weight: 790;
}

.brand-copy span {
  color: #6f7480;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.panel-tabs {
  flex-basis: var(--seed-tab-height);
  height: var(--seed-tab-height);
  gap: 8px;
  margin: 0 var(--seed-panel-gutter);
  padding: 10px 0;
}

.panel-tab {
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 11.75px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -.015em;
}

.panel-tab.active {
  color: var(--seed-red);
  background: linear-gradient(180deg, rgba(170, 0, 61, .09), rgba(170, 0, 61, .08));
  box-shadow: inset 0 0 0 1px rgba(170, 0, 61, .08);
}

.conversation-header,
.panel-section {
  padding-left: var(--seed-panel-gutter);
  padding-right: var(--seed-panel-gutter);
}

.conversation-header {
  padding-top: 26px;
  padding-bottom: 16px;
}

.chat-log,
.conversation-composer-shell {
  padding-left: var(--seed-panel-gutter);
  padding-right: var(--seed-panel-gutter);
}

.visualisation {
  grid-template-rows: var(--seed-top-height) minmax(0, 1fr) 44px;
}

.canvas-header,
.canvas-footer {
  padding-left: var(--seed-canvas-gutter);
  padding-right: var(--seed-canvas-gutter);
}

.panel-collapsed .canvas-header {
  padding-left: 72px;
}

.panel-toggle-button {
  top: calc(14px + (var(--seed-top-height) - 42px) / 2);
}

.mapSvg text,
#mapSvg text,
#mapSvg tspan,
.node-label,
.node-lens-label,
.temporal-label,
.edge-label-text {
  stroke: none !important;
  paint-order: normal;
  text-shadow: none;
}

.edge-label-text {
  fill: #5f6670;
  font-weight: 500;
}

.temporal-label {
  fill: #757c86;
  font-size: 9.5px;
  font-weight: 740;
  letter-spacing: .11em;
}

.temporal-divider {
  stroke: #a4a8a8;
  opacity: .62;
}

.node-label {
  fill: #30343a;
  font-weight: 640;
}

.node-lens-label {
  fill: #4f5660;
  font-weight: 760;
}

.empty-state {
  top: 49%;
  width: min(720px, calc(100% - 80px));
}

.hero-mark {
  width: 82px;
  height: 82px;
  margin-bottom: 18px;
}

.empty-state .eyebrow {
  margin-bottom: 12px;
  color: #7f858e;
  letter-spacing: .17em;
}

.empty-state h2 {
  max-width: 700px;
  font-size: clamp(32px, 3.7vw, 52px);
  font-weight: 755;
  line-height: 1.06;
  letter-spacing: -.045em;
}

.empty-state > p:not(.eyebrow):not(.empty-note) {
  max-width: 700px;
  margin: 18px auto 26px;
  color: #707780;
  font-size: 14px;
  line-height: 1.66;
}

.empty-note {
  margin-top: 12px !important;
}

.seed-modal {
  width: min(540px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(24, 26, 29, .08);
  border-radius: 24px;
  background: #fff;
  color: var(--seed-ink);
  box-shadow: 0 28px 86px rgba(20, 22, 26, .25);
  overflow: hidden;
}

.seed-modal::backdrop {
  background: rgba(28, 30, 34, .34);
  backdrop-filter: blur(8px);
}

.seed-modal-card {
  margin: 0;
  padding: 26px 28px 24px;
}

.seed-modal-header {
  margin-bottom: 18px;
}

.seed-modal-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.seed-modal-icon {
  width: 52px;
  height: 52px;
  padding: 5px;
  border-radius: 16px;
  background: var(--seed-surface-soft);
}

.seed-modal-brand div {
  display: grid;
  gap: 2px;
}

.seed-modal-brand strong {
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -.025em;
}

.seed-modal-brand span {
  color: #6f7480;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.seed-modal-copy h2 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -.04em;
}

.seed-modal-copy p {
  margin: 0;
  color: #5f6670;
  font-size: 13px;
  line-height: 1.62;
}

.seed-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.seed-modal-actions .secondary-button.inline,
.seed-modal-actions .seed-modal-accept {
  width: auto;
  min-width: 126px;
}

.seed-modal-accept {
  justify-content: center;
  gap: 0;
}

@media (max-width: 680px) {
  .panel-tabs {
    margin: 0 18px;
  }

  .conversation-header,
  .panel-section,
  .chat-log,
  .conversation-composer-shell {
    padding-left: 18px;
    padding-right: 18px;
  }

  .canvas-header,
  .canvas-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .panel-collapsed .canvas-header {
    padding-left: 60px;
  }

  .seed-modal-card {
    padding: 22px 20px 20px;
  }

  .seed-modal-copy h2 {
    font-size: 24px;
  }

  .seed-modal-actions {
    flex-direction: column-reverse;
  }

  .seed-modal-actions .secondary-button.inline,
  .seed-modal-actions .seed-modal-accept {
    width: 100%;
  }
}


/* =========================================================
   v4.7.2 — contained alignment correction
   Full-width tab rule, consistent tab geometry and aligned footers.
   ========================================================= */
:root {
  --seed-footer-height: 46px;
}

/* The header rules now terminate at the same vertical coordinate. */
.brand-header,
.canvas-header {
  box-sizing: border-box;
  flex-shrink: 0;
  height: var(--seed-top-height);
  min-height: var(--seed-top-height);
}

/* Use full-width navigation with internal gutters, rather than an inset nav
   carrying its own borders. This removes the stray top rule and lets the
   lower divider extend to both panel edges. */
.panel-tabs {
  width: 100%;
  margin: 0;
  padding: 10px var(--seed-panel-gutter);
  border-top: 0;
  border-bottom: 1px solid rgba(229, 230, 228, .88);
  column-gap: 8px;
}

.panel-tab {
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0 10px;
  display: grid;
  place-items: center;
  line-height: 1;
  text-align: center;
}

/* Keep the keyboard focus treatment inside the same button geometry so the
   Conversation tab cannot appear larger than Brief or Explore. */
.panel-tab:focus-visible {
  outline: 0;
  box-shadow:
    inset 0 0 0 2px rgba(170, 0, 61, .18),
    inset 0 0 0 1px rgba(170, 0, 61, .08);
}

.panel-tab.active:focus-visible {
  box-shadow:
    inset 0 0 0 2px rgba(170, 0, 61, .18),
    inset 0 0 0 1px rgba(170, 0, 61, .08);
}

/* Match the lower interface rules exactly. */
.panel-footer {
  flex: 0 0 var(--seed-footer-height);
  min-height: var(--seed-footer-height);
  height: var(--seed-footer-height);
}

.visualisation {
  grid-template-rows: var(--seed-top-height) minmax(0, 1fr) var(--seed-footer-height);
}

.canvas-footer {
  min-height: var(--seed-footer-height);
  height: var(--seed-footer-height);
}

.node-source {
  font-weight: bold;
}

@media (max-width: 680px) {
  .panel-tabs {
    margin: 0;
    padding-left: 18px;
    padding-right: 18px;
  }
}


/* =========================================================
   v4.7.3 — conversation panel geometry correction
   Removes inherited panel padding from the flex-based conversation view,
   aligns all panel headings and allows the conversation to use full width.
   ========================================================= */

/* Brief and Explore use .panel-section padding directly. Conversation has
   its own header, log and composer, so inherited panel padding created a
   second internal gutter and pushed its content noticeably lower. */
.panel-section.conversation-panel {
  padding: 0;
  overflow: hidden;
}

/* Match the first content baseline used by Brief and Explore. */
.conversation-header {
  padding: 28px var(--seed-panel-gutter) 16px;
  border-bottom: 1px solid var(--seed-line);
}

/* One consistent heading scale across the three principal panel views. */
.section-intro h1,
.map-overview h2,
.selected-heading h2,
.conversation-header h2 {
  margin: 0 0 11px;
  color: var(--seed-ink);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.04em;
}

.selected-heading h2,
.conversation-header h2 {
  margin-bottom: 0;
}

/* Use the same single gutter as the other tabs rather than the previous
   outer panel gutter plus a second nested gutter. */
.chat-log,
.conversation-composer-shell {
  width: 100%;
  padding-left: var(--seed-panel-gutter);
  padding-right: var(--seed-panel-gutter);
}

.chat-log {
  flex: 1 1 0;
  padding-top: 18px;
  padding-bottom: 18px;
}

.conversation-composer-shell {
  flex: 0 0 auto;
  padding-top: 12px;
  padding-bottom: 18px;
}

.chat-composer,
.chat-composer textarea,
.chat-composer .primary-button {
  width: 100%;
}

@media (max-width: 680px) {
  .conversation-header {
    padding: 28px 18px 16px;
  }

  .chat-log,
  .conversation-composer-shell {
    padding-left: 18px;
    padding-right: 18px;
  }
}


/* =========================================================
   v4.7.4 — heading weight and source-status refinement
   ========================================================= */
.section-intro h1,
.map-overview h2,
.selected-heading h2,
.conversation-header h2 {
  font-weight: 700;
}

.node-source {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--seed-line-strong);
  border-radius: 999px;
  color: #777d85;
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}


/* =========================================================
   v4.7.5 — landing alignment refinement
   Removes residual margins that offset the centred landing hierarchy.
   ========================================================= */
.empty-state .eyebrow {
  margin: 0;
}

.empty-state h2 {
  max-width: 710px;
  margin: 0 auto;
}

.empty-note {
  margin: 0 !important;
}

/* =========================================================
   v4.7.6 — selected-node pill alignment
   Keeps the v4.7.5 landing refinements and gives the lens and
   source-status pills one shared vertical size and alignment.
   ========================================================= */
.node-tag,
.node-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* =========================================================
   v4.7.7 — landing vertical rhythm
   Replaces mixed inherited margins with one balanced, centred stack.
   ========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(760px, calc(100% - 80px));
}

.hero-mark {
  margin: 0 0 20px;
}

.empty-state .eyebrow {
  margin: 0 0 10px;
  line-height: 1.2;
}

.empty-state h2 {
  max-width: 710px;
  margin: 0;
  line-height: 1.04;
}

.empty-state > p:not(.eyebrow):not(.empty-note) {
  max-width: 690px;
  margin: 20px auto 26px;
}

.empty-demo-button {
  margin: 0;
}

.empty-note {
  margin: 10px 0 0 !important;
}

.node-source {
  padding: 0 12px;
}

@media (max-width: 680px) {
  .empty-state {
    width: min(620px, calc(100% - 34px));
  }

  .hero-mark {
    margin-bottom: 17px;
  }

  .empty-state .eyebrow {
    margin-bottom: 8px;
  }

  .empty-state > p:not(.eyebrow):not(.empty-note) {
    margin-top: 17px;
    margin-bottom: 22px;
  }
}


/* =========================================================
   v4.7.8 — fixed selected-node close control
   Anchors the control independently of title length and replaces the
   font glyph with a geometrically centred CSS cross.
   ========================================================= */
.selected-panel {
  position: relative;
}

.selected-heading {
  position: relative;
  display: block;
  min-height: 36px;
  padding-right: 50px;
}

.selected-heading > div {
  width: 100%;
  min-width: 0;
}

#deselectNode {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: #777d85;
  background: transparent;
  font-size: 0;
  line-height: 0;
  flex: 0 0 36px;
  transform: none;
}

#deselectNode::before,
#deselectNode::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

#deselectNode::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

#deselectNode::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

#deselectNode:hover {
  color: var(--seed-red);
  background: var(--seed-red-soft);
}

#deselectNode:active {
  transform: none;
}
