:root {
  color-scheme: light dark;
  --detail-width: 440px;
  --bg: #ffffff;
  --paper: #f7f7f7;
  --panel: #f3f3f3;
  --control: #f4f4f4;
  --control-hover: #eeeeee;
  --ink: #202124;
  --muted: #6f6f6f;
  --line: rgba(0, 0, 0, 0.1);
  --soft-line: rgba(0, 0, 0, 0.07);
  --accent: #339cff;
  --accent-2: #5c9466;
  --on-accent: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --focus: #339cff;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181818;
  --paper: #202020;
  --panel: #242424;
  --control: #242424;
  --control-hover: #2b2b2b;
  --ink: #f5f5f5;
  --muted: #a8a8a8;
  --line: rgba(255, 255, 255, 0.1);
  --soft-line: rgba(255, 255, 255, 0.07);
  --accent: #339cff;
  --accent-2: #75aa7e;
  --on-accent: #ffffff;
  --shadow: rgba(0, 0, 0, 0.45);
  --focus: #339cff;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 46%, var(--line)) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body {
  height: 100%;
  min-height: 100%;
  max-width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) var(--detail-width);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
}

.app-shell.left-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) var(--detail-width);
}

.app-shell.right-collapsed {
  grid-template-columns: 280px minmax(0, 1fr) 0;
}

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

.left-rail,
.detail-panel {
  background: var(--paper);
  border-color: var(--line);
  min-width: 0;
}

.left-rail {
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: padding 160ms ease;
}

.detail-panel {
  border-left: 1px solid var(--line);
  overflow: hidden;
  position: relative;
  min-width: 400px;
  max-width: 720px;
  min-height: 0;
}

.pane-toggle {
  position: absolute;
  z-index: 12;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 92%, var(--bg));
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 10px var(--shadow);
}

.pane-toggle:hover,
.pane-toggle:focus-visible {
  background: var(--control-hover);
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

/* edge tabs on the centre stage — at the TOP of its left/right inner edges */
.pane-toggle-left {
  top: 10px;
  left: 8px;
}

.pane-toggle-right {
  top: 10px;
  right: 8px;
}

/* collapsed = the pane is GONE completely (no leftover handle). The toggle lives on the stage
   edge, so it stays reachable to bring the pane back. */
.app-shell.left-collapsed .left-rail {
  width: 0;
  padding: 0;
  border-right: 0;
  overflow: hidden;
}

.app-shell.right-collapsed .detail-panel {
  width: 0;
  min-width: 0;
  max-width: none;
  padding: 0;
  border-left: 0;
  overflow: hidden;
}

.detail-resizer {
  position: absolute;
  inset: 0 auto 0 0;
  width: 18px;
  z-index: 8;
  cursor: ew-resize;
  touch-action: none;
}

.detail-resizer::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 46%, var(--line));
  opacity: 0.55;
  transition: opacity 140ms ease;
}

.detail-resizer::after {
  content: "resize";
  position: absolute;
  left: 12px;
  top: 18px;
  writing-mode: vertical-rl;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  opacity: 0;
  transition: opacity 140ms ease;
}

.detail-resizer:hover::before,
.detail-panel.resizing .detail-resizer::before {
  opacity: 1;
}

.detail-resizer:hover::after,
.detail-panel.resizing .detail-resizer::after {
  opacity: 0.85;
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-logo-block {
  display: grid;
  grid-template-columns: auto 1fr;   /* logo | Memory */
  align-items: center;
  column-gap: 11px;
  row-gap: 2px;
}
.brand-logo-block .brand-logo-mark { grid-column: 1; grid-row: 1; }
.brand-logo-block h1 { grid-column: 2; grid-row: 1; align-self: center; }
.brand-logo-block p { grid-column: 1 / -1; grid-row: 2; }   /* tagline under the logo + Memory */

.brand-logo-mark {
  width: 92px;
  min-width: 92px;
  height: 32px;
  display: grid;
  align-items: center;
}

.brand-logo-img {
  width: 92px;
  height: auto;
  display: block;
}

.brand-logo-img-dark {
  display: none;
}

html[data-theme="dark"] .brand-logo-img-light {
  display: none;
}

html[data-theme="dark"] .brand-logo-img-dark {
  display: block;
}

.brand-logo-block h1 {
  font-size: 18px;
  line-height: 1.1;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
  line-height: 1.15;
}

.brand-block p,
.eyebrow,
.group-title,
.tiny-stats,
.muted {
  color: var(--muted);
}

.brand-block p {
  font-size: 13px;
  margin-top: 3px;
}

.control-group {
  border-top: 1px solid var(--soft-line);
  padding: 18px 0;
}

.rail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* breathing room between a section's +/- header and its body (gg 2026-07-07:
   the Layers "-" nearly touched the People chip; same for the View buttons) */
#viewSectionBody, #modeSectionBody, #layersSectionBody {
  margin-top: 14px;
}

.layer-autopilot {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.layer-mode-controls {
  width: 100%;
}

.active-layer-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 9px;
  min-height: 17px;
}

.active-layer-token {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
}

.active-layer-token > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-layer-swatch {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border: 1px solid color-mix(in srgb, var(--layer-rim) 84%, var(--paper));
  border-radius: 50%;
  background: var(--layer-fill);
  box-shadow: 0 0 4px color-mix(in srgb, var(--layer-echo) 18%, transparent);
}

.active-layer-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10.5px;
}

.auto-layer-reason {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

/* separator line under the LAST visible rail section too (gg 2026-07-07) —
   normally the hidden media rail is last, so the domain-health group carries it */
.left-rail .control-group:not([hidden]):last-of-type {
  border-bottom: 1px solid var(--soft-line);
}
.left-rail .control-group:has(+ .control-group[hidden]) {
  border-bottom: 1px solid var(--soft-line);
}

.rail-section-title-wrap {
  min-width: 0;
}

.rail-section-header .group-title {
  margin-bottom: 0;
}

.rail-section-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-section-toggle {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}

.rail-section-toggle:hover {
  background: var(--control-hover);
}

.domain-health {
  margin-top: 10px;
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
  max-height: min(280px, 34vh);
  overflow: auto;
  padding-right: 2px;
}

.domain-health[hidden] {
  display: none !important;
}

.domain-health-summary {
  color: var(--ink);
  font-weight: 720;
}

.domain-health-list {
  display: grid;
  gap: 5px;
}

.domain-health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: baseline;
  padding: 7px 8px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.domain-health-row.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--soft-line));
}

.domain-health-row.source-only {
  border-color: color-mix(in srgb, #b5853a 38%, var(--soft-line));
}

.domain-health-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-health-layer,
.domain-health-count {
  color: var(--muted);
}

.domain-health-layer {
  text-align: right;
}

.domain-health-count {
  grid-column: 1 / -1;
  font-size: 10.5px;
}

.domain-health-error {
  color: #b0443a;
}

.group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.segmented,
.source-roots,
.chips,
.quick-spans,
.frame-mode-controls,
.lens-controls,
.manual-range-controls,
.search-mode-controls,
.center-mode-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.seg,
.root,
.chip,
.frame-mode,
.lens,
.search-mode,
.center-mode,
.quick-spans button,
#corpusButton,
#frameSummaryButton,
#refreshButton,
#clearFocusButton,
#mapModeToggle {
  min-height: 32px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--ink);
  border-radius: 7px;
  padding: 6px 10px;
}

.seg:hover,
.root:hover,
.chip:hover,
.frame-mode:hover,
.lens:hover,
.search-mode:hover,
.quick-spans button:hover,
#corpusButton:hover,
#frameSummaryButton:hover,
#refreshButton:hover,
#clearFocusButton:hover,
#mapModeToggle:hover {
  background: var(--control-hover);
}

.seg.active,
.seg[aria-pressed="true"],
.root.active,
.search-mode.active,
.search-mode[aria-pressed="true"],
.center-mode.active,
.center-mode[aria-pressed="true"],
.frame-mode.active,
.frame-mode[aria-pressed="true"],
.lens.active,
.quick-spans button.active,
.quick-spans button[aria-pressed="true"],
#mapModeToggle.active,
#mapModeToggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
}

.control-label {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-right: 1px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  border-color: color-mix(in srgb, var(--layer-rim, var(--line)) 44%, var(--line));
  background: color-mix(in srgb, var(--layer-fill, var(--control)) 8%, var(--control));
  box-shadow: none;
}

.chip:hover,
.chip:focus-visible {
  background: color-mix(in srgb, var(--layer-fill, var(--control-hover)) 10%, var(--control-hover));
  border-color: color-mix(in srgb, var(--layer-rim, var(--line)) 56%, var(--line));
}

.chip.active {
  background: color-mix(in srgb, var(--layer-fill, var(--paper)) 14%, var(--paper));
  border-color: color-mix(in srgb, var(--layer-rim, var(--accent)) 62%, var(--line));
  color: var(--ink);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--layer-highlight, #fff) 8%, transparent);
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--layer-fill, currentColor) 74%, var(--layer-rim, currentColor));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--paper) 24%, transparent),
    0 0 4px color-mix(in srgb, var(--layer-echo, currentColor) 8%, transparent);
  flex: 0 0 auto;
}

.search-row {
  display: flex;
  gap: 8px;
}

input[type="search"] {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--ink);
  border-radius: 7px;
  min-height: 36px;
  padding: 8px 10px;
}

input:focus,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.source-roots {
  margin-top: 10px;
}

.media-rail {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.media-rail[hidden] {
  display: none !important;
}

.media-rail.is-collapsed {
  flex: 0 0 auto;
  min-height: 0;
}

.media-rail .rail-section-header {
  margin-bottom: 8px;
}

.media-rail-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.media-rail-body[hidden] {
  display: none !important;
}

.media-rail-status {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.media-tile {
  position: relative;
  display: block;
  min-height: 86px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  text-decoration: none;
  color: var(--ink);
}

.media-tile img,
.media-tile video {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: color-mix(in srgb, var(--line) 36%, transparent);
}

.media-tile b,
.media-tile strong {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  padding: 3px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--ink);
  font-size: 10px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-tile b {
  top: 5px;
  right: auto;
  bottom: auto;
  font-weight: 700;
}

.media-tile strong {
  font-weight: 700;
}

.media-tile.missing {
  display: grid;
  place-items: center;
  min-height: 86px;
}

.media-missing {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 0 8px;
}

.tiny-stats {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 12px;
}

.stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.stage-top {
  grid-row: 1;
}

.expert-console {
  grid-row: 2;
}

.map-wrap {
  grid-row: 3;
}

.timeline-band {
  grid-row: 4;
}

.app-shell.ready .stage-top,
.app-shell.ready .left-rail,
.app-shell.ready .detail-panel {
  animation: panelIn 520ms ease both;
}

.app-shell.ready .timeline-band {
  animation: timelineIn 620ms ease both;
}

.loading-indicator {
  position: absolute;
  right: 26px;
  top: 72px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  box-shadow: 0 6px 18px var(--shadow);
  padding: 8px 12px;
  font-size: 13px;
}

.loading-indicator[hidden] {
  display: none !important;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--soft-line);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.stage-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: flex-start;
  gap: 8px;
  padding: 18px 44px 10px;  /* extra side room so the edge pane-toggles never overlap the header */
  min-height: 160px;
  overflow: visible;
}

.stage-top > div:first-child {
  min-width: 0;
  overflow: visible;
  position: relative;
  padding-bottom: 31px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

#rangeTitle {
  display: block;
  max-width: min(100%, 760px);
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  padding: 0;
  font-size: 24px;
  line-height: 1.15;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.current-frame {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.view-summary,
.change-feedback {
  max-width: 760px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.view-summary {
  overflow-wrap: anywhere;
}

.layer-summary {
  max-width: 880px;
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.layer-summary[hidden] {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, #000 38%, transparent);
  backdrop-filter: blur(2px);
  animation: modalFade 120ms ease-out;
}

.modal-card {
  width: min(380px, calc(100vw - 40px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalRise 140ms ease-out;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 750;
  color: var(--ink);
}

.modal-body {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.modal-body strong {
  color: var(--ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.modal-btn.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.modal-btn.ghost:hover {
  background: var(--control-hover);
}

.modal-btn.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.modal-btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, #000);
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.summary-pill {
  border: 1px solid color-mix(in srgb, var(--layer-color, var(--accent)) 42%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--layer-color, var(--accent)) 12%, var(--paper));
  color: var(--ink);
  padding: 4px 8px;
  font-weight: 750;
  white-space: nowrap;
}

.summary-pill.empty,
.summary-pill.neutral {
  border-color: var(--soft-line);
  background: var(--paper);
  color: var(--muted);
}

.summary-note {
  color: var(--muted);
}

.layer-gap-notice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.layer-gap-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.layer-gap-action {
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 52%, transparent);
  border-radius: 0;
  padding: 1px 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.layer-gap-action:hover {
  border-bottom-color: var(--accent);
}

.change-feedback {
  display: inline-block;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--accent);
  padding: 5px 9px;
  font-weight: 700;
}

.stage-top .change-feedback {
  position: absolute;
  left: 0;
  bottom: 0;
  margin: 0;
  max-width: min(760px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-feedback[hidden] {
  display: none;
}

.stage-search {
  width: 100%;
  align-self: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto;
  align-items: center;
  gap: 6px;
}

.stage-search input[type="search"],
.stage-search #clearFocusButton,
.stage-search #frameSummaryButton,
.stage-search #refreshButton,
.stage-search #mapModeToggle,
.stage-search .center-mode {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 84%, var(--bg));
  color: var(--ink);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

.stage-search input[type="search"] {
  min-width: 0;
}

.stage-search #frameSummaryButton:hover,
.stage-search #refreshButton:hover,
.stage-search #clearFocusButton:hover,
.stage-search #mapModeToggle:hover,
.stage-search .center-mode:hover {
  background: var(--control-hover);
  border-color: var(--line);
  color: var(--ink);
}

.center-mode-controls {
  display: grid;
  grid-template-columns: auto repeat(2, minmax(0, 1fr));
  gap: 3px;
  min-width: 180px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  background: color-mix(in srgb, var(--paper) 72%, var(--bg));
}

.center-mode-label {
  padding: 0 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-search .center-mode.active,
.stage-search .center-mode[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 78%, var(--line));
  background: color-mix(in srgb, var(--accent) 28%, var(--paper));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.center-mode:disabled {
  cursor: default;
  opacity: 0.42;
}

.map-wrap {
  position: relative;
  min-height: 0;
  padding: 8px 18px 0;
  overflow: hidden;
  transition: min-height 180ms ease, opacity 180ms ease;
}

.map-zoom-controls {
  position: absolute;
  top: 16px;
  right: 26px;
  z-index: 5;
  display: grid;
  gap: 6px;
  pointer-events: auto;
}

.map-zoom-button {
  position: relative;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 84%, var(--bg));
  box-shadow: 0 2px 8px var(--shadow);
  color: var(--ink);
  font-size: 0;
  cursor: pointer;
}

/* Draw the +/- as geometric bars so they sit dead-centre regardless of font glyph metrics. */
.map-zoom-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

#mapZoomIn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.map-zoom-button:hover,
.map-zoom-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.map-zoom-button:disabled {
  cursor: default;
  opacity: 0.44;
}

.map-empty-state {
  position: absolute;
  left: 50%;
  top: calc(50% + 64px);
  width: min(420px, calc(100% - 56px));
  transform: translate(-50%, 0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 12px 30px var(--shadow);
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  pointer-events: auto;
}

.map-empty-state strong {
  display: block;
  color: var(--ink);
  margin-bottom: 5px;
}

.empty-state-action {
  margin-top: 10px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
}

.people-context-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 7px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 72%, var(--paper));
}

.people-context-controls[hidden] {
  display: none;
}

.people-context-controls .control-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.people-context-buttons {
  display: flex;
  gap: 4px;
}

.people-context {
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: var(--control);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.people-context.active,
.people-context[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--paper));
  color: var(--accent);
}

#lifeMap {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  cursor: grab;
  touch-action: none;
}

.map-wrap.panning #lifeMap {
  cursor: grabbing;
}

#lifeMap .node {
  cursor: pointer;
}

/* Timeline-band cluster extracted to timeline.css (Cut 2(e), 2026-05-26). */

@media (max-height: 1200px) {
  .stage-top {
    padding: 12px 44px 7px;
    gap: 7px;
    min-height: 160px;
  }

  #rangeTitle {
    font-size: 24px;
    padding: 0;
  }

  .view-summary,
  .change-feedback,
  .layer-summary {
    margin-top: 5px;
    line-height: 1.25;
  }

  .map-wrap {
    padding-top: 4px;
  }
}

@media (min-width: 761px) {
  .stage-top {
    box-sizing: border-box;
    height: 160px;
    min-height: 160px;
    max-height: 160px;
  }
}

.detail-content {
  padding: 22px 22px 22px 42px;
  height: 100%;
  overflow: auto;
  min-width: 0;
  overflow-wrap: break-word;
}

.empty-detail {
  min-height: 520px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
  gap: 12px;
}

.detail-orbit {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 18px transparent, 0 0 0 19px var(--soft-line), 0 0 0 36px transparent, 0 0 0 37px var(--soft-line);
  margin-bottom: 18px;
}

.detail-content h2 {
  font-size: 21px;
  line-height: 1.25;
}

.detail-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.frame-summary-meta {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.detail-section {
  border-top: 1px solid var(--soft-line);
  padding-top: 14px;
  margin-top: 16px;
}

.detail-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}

.reason-section {
  border-top-color: color-mix(in srgb, var(--accent) 34%, var(--soft-line));
}

.reason-list {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.reason-list p {
  margin: 0;
}

.memory-story {
  border-top-color: color-mix(in srgb, var(--accent-2) 38%, var(--soft-line));
}

.memory-lead {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.memory-story-grid {
  display: grid;
  gap: 8px;
}

.episode-story-section {
  border-top-color: color-mix(in srgb, var(--accent) 38%, var(--soft-line));
}

.episode-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.episode-section-heading h3 {
  margin: 0;
}

.episode-section-heading > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.episode-story-lead,
.episode-detail-narrative {
  line-height: 1.55;
}

.episode-story-list {
  border-top: 1px solid var(--soft-line);
}

.episode-story-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.episode-story-row:hover,
.episode-story-row:focus-visible {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.connection-insights-section {
  border-top-color: color-mix(in srgb, var(--accent-2) 34%, var(--soft-line));
}

.connection-insight-list {
  border-top: 1px solid var(--soft-line);
}

.connection-insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.connection-insight-row:hover,
.connection-insight-row:focus-visible {
  background: color-mix(in srgb, var(--accent-2) 6%, transparent);
}

.connection-insight-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.connection-insight-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.connection-insight-heading > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.connection-insight-layers {
  display: flex;
  align-items: center;
  gap: 3px;
}

.connection-insight-layers i {
  width: 7px;
  height: 7px;
  border: 1px solid color-mix(in srgb, var(--layer-rim, var(--layer-color)) 78%, var(--paper));
  border-radius: 50%;
  background: var(--layer-fill, var(--layer-color));
}

.connection-insight-copy {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.episode-story-order {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 50%;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.episode-story-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.episode-story-copy strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.episode-story-copy > span {
  color: var(--muted);
  font-size: 11px;
}

.episode-grounding {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.episode-grounding.recorded {
  border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line));
  color: var(--accent-2);
}

.episode-grounding.inferred {
  border-style: dashed;
}

.episode-detail-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.episode-layer-proof-list,
.episode-evidence-list {
  display: grid;
}

.episode-layer-proof-row,
.episode-evidence-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft-line);
  font-size: 12px;
}

.episode-evidence-row > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.episode-evidence-row strong {
  overflow-wrap: anywhere;
}

.episode-evidence-row small {
  color: var(--muted);
  line-height: 1.35;
}

.memory-story-card,
.node-memory-card {
  border: 1px solid color-mix(in srgb, var(--story-color, var(--node-color, var(--accent))) 34%, var(--line));
  border-left: 4px solid var(--story-color, var(--node-color, var(--accent)));
  border-radius: 7px;
  background: color-mix(in srgb, var(--story-color, var(--node-color, var(--accent))) 8%, var(--paper));
  padding: 10px 11px;
}

.memory-story-card span,
.node-memory-facts span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.memory-story-card strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.memory-story-card p,
.node-memory-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.node-memory-card {
  --story-color: var(--node-color);
}

.node-memory-facts {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.node-memory-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--soft-line);
  padding-top: 6px;
}

.node-memory-facts strong {
  color: var(--ink);
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.search-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.pinned-detail-banner {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
  font-size: 12px;
  line-height: 1.35;
}

.summary-table {
  display: grid;
  gap: 6px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--soft-line);
  font-size: 13px;
}

.layer-summary-row {
  border-left: 2px solid color-mix(in srgb, var(--layer-rim, var(--line)) 44%, var(--line));
  padding-left: 9px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--layer-fill, var(--paper)) 4%, transparent), transparent 68%);
  box-shadow: none;
}

.summary-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}

.summary-row.is-quiet {
  color: var(--muted);
  opacity: 0.66;
}

.frame-layer-section {
  border-top-color: var(--soft-line);
}

.layer-signal-grid {
  display: grid;
  gap: 9px;
}

.layer-signal-card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--layer-rim, var(--layer-color, var(--accent))) 34%, var(--line));
  border-left: 2px solid color-mix(in srgb, var(--layer-rim, var(--layer-color, var(--accent))) 54%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--layer-fill, var(--layer-color, var(--accent))) 5%, var(--paper));
  box-shadow: none;
  overflow: hidden;
}

.layer-signal-card.is-empty {
  opacity: 0.68;
}

.layer-signal-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 8px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  line-height: 1.2;
}

.layer-signal-card > summary::-webkit-details-marker {
  display: none;
}

.layer-signal-card > summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 900;
  inline-size: 14px;
  text-align: center;
  justify-self: end;
}

.layer-signal-card[open] > summary::after {
  content: "-";
}

.layer-card-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--layer-fill, var(--layer-color, var(--accent))) 74%, var(--layer-rim, var(--layer-color, var(--accent))));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--paper) 24%, transparent),
    0 0 4px color-mix(in srgb, var(--layer-echo, var(--layer-color, var(--accent))) 8%, transparent);
  flex: 0 0 auto;
}

.layer-card-title {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-signal-card > summary strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.layer-card-lead {
  margin: 0;
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.layer-card-lead strong {
  color: var(--ink);
  font-size: 11px;
}

.layer-signal-items {
  display: grid;
  gap: 7px;
  padding: 0 8px 8px;
}

.layer-evidence-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.layer-evidence-row:last-child {
  border-bottom: 0;
}

.layer-evidence-row.is-action {
  cursor: pointer;
}

.layer-evidence-row.is-action:hover,
.layer-evidence-row.is-action:focus-visible {
  background: color-mix(in srgb, var(--layer-fill, var(--accent)) 5%, transparent);
}

.layer-evidence-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.layer-evidence-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.25;
}

.layer-evidence-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.layer-evidence-metric {
  max-width: 105px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
  overflow-wrap: anywhere;
}

.layer-signal-item-card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--layer-rim, var(--line)) 18%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--layer-fill, var(--paper)) 2.5%, color-mix(in srgb, var(--paper) 86%, var(--bg)));
  overflow: hidden;
}

.layer-signal-item-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 8px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  list-style: none;
}

.layer-signal-item-card > summary::-webkit-details-marker {
  display: none;
}

.layer-signal-item-card > summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 900;
  inline-size: 14px;
  text-align: center;
  justify-self: end;
}

.layer-signal-item-card[open] > summary::after {
  content: "-";
}

.layer-signal-item-card:hover,
.layer-signal-item-card:focus-within {
  border-color: color-mix(in srgb, var(--layer-rim, var(--layer-color, var(--accent))) 36%, var(--line));
  background: color-mix(in srgb, var(--layer-fill, var(--accent)) 5%, var(--control-hover));
}

.signal-row-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.signal-row-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.signal-row-main span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  max-width: 42%;
}

.signal-item-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-row-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.layer-signal-item-body {
  min-width: 0;
  border-top: 1px solid color-mix(in srgb, var(--layer-color, var(--accent)) 18%, var(--soft-line));
  padding: 8px;
  overflow-wrap: anywhere;
}

.layer-signal-item-body .source-reader-card,
.layer-signal-item-body .excerpt-text,
.layer-signal-item-body .raw-source-text {
  min-width: 0;
  max-width: 100%;
}

.layer-signal-card .layer-signal-item-card {
  border: 0;
  border-top: 1px solid var(--soft-line);
  border-radius: 0;
  background: transparent;
}

.layer-signal-card .layer-signal-item-card:first-child {
  border-top: 0;
}

.layer-signal-card .layer-signal-item-card > summary {
  min-height: 42px;
  padding: 7px 2px;
}

.layer-signal-card .layer-signal-item-card:hover,
.layer-signal-card .layer-signal-item-card:focus-within {
  border-color: var(--soft-line);
  background: color-mix(in srgb, var(--layer-fill, var(--accent)) 4%, transparent);
}

.layer-signal-card .layer-signal-item-body {
  border-top: 0;
  padding: 0 2px 9px 20px;
}

.layer-item-narrative,
.layer-item-provenance {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.layer-source-disclosure {
  margin-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--layer-rim, var(--layer-color, var(--accent))) 18%, var(--soft-line));
}

.layer-source-disclosure > summary {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) 14px;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  list-style: none;
}

.layer-source-disclosure > summary::-webkit-details-marker {
  display: none;
}

.layer-source-disclosure > summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-source-disclosure > summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 900;
  inline-size: 14px;
  text-align: center;
}

.layer-source-disclosure[open] > summary::after {
  content: "-";
}

.layer-source-body {
  display: grid;
  gap: 8px;
  padding: 3px 0 4px;
}

.layer-source-body p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.human-source-button {
  justify-self: start;
  min-height: 28px;
  border: 1px solid color-mix(in srgb, var(--layer-rim, var(--layer-color, var(--accent))) 34%, var(--line));
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.human-source-button:hover,
.human-source-button:focus-visible {
  border-color: var(--layer-rim, var(--layer-color, var(--accent)));
  background: color-mix(in srgb, var(--layer-fill, var(--accent)) 7%, var(--paper));
}

.badge-legend {
  display: none !important;
}

.badge-legend span,
.bundle-badges {
  display: none !important;
}

.badge-legend b {
  color: var(--ink);
}

.bundle-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--soft-line);
  border-left: 3px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  color: var(--muted);
  padding: 10px;
  cursor: pointer;
}

.bundle-row:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
}

.bundle-row.active,
.bundle-row:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.bundle-action {
  display: block;
  margin-top: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.bundle-evidence-item {
  border-left-color: var(--accent);
}

.journal-groups {
  display: grid;
  gap: 8px;
}

.journal-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.search-mode-controls {
  margin-top: 8px;
}

.search-mode.expert-mode {
  min-width: 88px;
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  font-weight: 850;
}

.search-mode.expert-mode.active,
.search-mode.expert-mode[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.advanced-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

input.advanced-query-input {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 84%, var(--bg));
  color: var(--ink);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

.advanced-query-button {
  min-height: 28px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 84%, var(--bg));
  color: var(--ink);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

.advanced-query-button:hover,
.advanced-query-button:focus-visible {
  background: var(--control-hover);
  border-color: var(--line);
  color: var(--ink);
}

.advanced-result-count {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.advanced-match {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.35;
}

.advanced-line {
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.journal-chip {
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: var(--control);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.unpin-bubbles {
  margin-top: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--control);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.unpin-bubbles:hover,
.unpin-bubbles:focus-visible {
  border-color: var(--accent);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 11%, var(--paper));
}

.anon-toggle {
  margin-top: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--control);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.anon-toggle:hover,
.anon-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 11%, var(--paper));
}

.anon-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Share mode: blur real photos/media previews so faces aren't shown either. */
body.anon #mediaGrid img,
body.anon .media-grid img,
body.anon #detailContent img,
body.anon img[src*="/api/media"] {
  filter: blur(16px);
}

body.anon #manualRangeStart,
body.anon #manualRangeEnd,
body.anon #nodeSearch,
body.anon #expertCommandInput,
body.anon #corpusSearch {
  -webkit-text-security: disc;
}

.journal-chip:hover,
.journal-chip:focus-visible {
  border-color: var(--accent);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 11%, var(--paper));
}

.left-rail .segmented,
.left-rail .source-roots,
.left-rail .search-mode-controls,
.left-rail .people-context-buttons {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
}

.left-rail .journal-samples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.left-rail .search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.left-rail .chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.left-rail .seg,
.left-rail .root,
.left-rail .chip,
.left-rail .search-mode,
.left-rail .people-context,
.left-rail .journal-chip,
.left-rail .unpin-bubbles,
.left-rail #corpusButton {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 84%, var(--bg));
  color: var(--ink);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  box-shadow: none;
}

.left-rail input[type="search"] {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 84%, var(--bg));
  color: var(--ink);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

.left-rail .seg:hover,
.left-rail .root:hover,
.left-rail .chip:hover,
.left-rail .search-mode:hover,
.left-rail .people-context:hover,
.left-rail .journal-chip:hover,
.left-rail .unpin-bubbles:hover,
.left-rail #corpusButton:hover {
  background: var(--control-hover);
  border-color: var(--line);
  color: var(--ink);
}

.left-rail .chip {
  border-color: color-mix(in srgb, var(--layer-rim, var(--line)) 42%, var(--line));
  background: color-mix(in srgb, var(--layer-fill, var(--paper)) 8%, color-mix(in srgb, var(--paper) 86%, var(--bg)));
  box-shadow: none;
}

.left-rail .chip:hover,
.left-rail .chip:focus-visible {
  border-color: color-mix(in srgb, var(--layer-rim, var(--line)) 54%, var(--line));
  background: color-mix(in srgb, var(--layer-fill, var(--control-hover)) 10%, var(--control-hover));
}

.left-rail .seg.active,
.left-rail .seg[aria-pressed="true"],
.left-rail .root.active,
.left-rail .root[aria-pressed="true"],
.left-rail .chip.active,
.left-rail .search-mode.active,
.left-rail .search-mode[aria-pressed="true"],
.left-rail .people-context.active,
.left-rail .people-context[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  color: var(--ink);
  font-weight: 800;
}

.left-rail .chip.active {
  background: color-mix(in srgb, var(--layer-fill, var(--paper)) 14%, var(--paper));
  border-color: color-mix(in srgb, var(--layer-rim, var(--accent)) 62%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--layer-highlight, #fff) 8%, transparent);
}

.left-rail .chip.active .chip-dot {
  background: color-mix(in srgb, var(--layer-fill, currentColor) 86%, var(--paper));
  border-color: color-mix(in srgb, var(--layer-rim, currentColor) 82%, var(--layer-fill, currentColor));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--layer-highlight, #fff) 10%, transparent),
    0 0 4px color-mix(in srgb, var(--layer-echo, currentColor) 8%, transparent);
}

.left-rail .chip {
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
}

.left-rail .chip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.left-rail .chip.active span:last-child {
  font-weight: 800;
}

.left-rail .search-mode.expert-mode {
  min-width: 0;
  border-color: var(--line);
  font-weight: 600;
}

.left-rail .search-mode.expert-mode.active,
.left-rail .search-mode.expert-mode[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  color: var(--ink);
  font-weight: 800;
}

.journal-status,
.journal-context {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--soft-line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.journal-context {
  display: grid;
  gap: 2px;
}

.journal-context strong {
  color: var(--ink);
}

.journal-more {
  margin-top: 10px;
}

.journal-more summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.journal-more .journal-groups {
  margin-top: 8px;
}

.journal-group-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--soft-line);
  border-left: 3px solid var(--accent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  color: var(--muted);
  padding: 10px;
}

.journal-group-row:hover,
.journal-group-row.active,
.journal-group-row:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent);
}

.journal-group-row strong {
  color: var(--ink);
}

.journal-group-meta {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.journal-evidence {
  display: grid;
  gap: 4px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.summary-collapse {
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
  margin-top: 14px;
}

.summary-collapse summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-collapse summary span {
  float: right;
  color: var(--accent);
  font-size: 11px;
  text-transform: none;
}

.summary-home {
  margin-top: 10px;
}

.link-inline {
  justify-self: start;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.link-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
  padding: 10px;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.source-link {
  display: grid;
  gap: 4px;
}

.source-label {
  font-weight: 700;
}

.source-path {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.source-count {
  display: inline-block;
  margin: 3px 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.source-path-details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-path-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.source-path-details div {
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.source-summary-card {
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  padding: 12px;
}

.source-summary-kind {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.source-summary-card p {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.48;
}

.source-memory-overview {
  margin-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 28%, var(--soft-line));
  border-bottom: 1px solid var(--soft-line);
  padding: 12px 0;
}

.source-human-lead {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.source-memory-sections {
  margin-top: 16px;
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
}

.source-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.source-section-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.source-section-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.source-memory-section-list {
  display: grid;
}

.source-memory-section {
  border-bottom: 1px solid var(--soft-line);
}

.source-memory-section > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  list-style: none;
}

.source-memory-section > summary::-webkit-details-marker,
.source-technical-details > summary::-webkit-details-marker,
.source-raw-record > summary::-webkit-details-marker {
  display: none;
}

.source-memory-section > summary::after,
.source-raw-record > summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.source-memory-section[open] > summary::after,
.source-raw-record[open] > summary::after {
  content: "-";
}

.source-memory-section.source-level-3 > summary,
.source-memory-section.source-level-4 > summary {
  padding-left: 10px;
  color: color-mix(in srgb, var(--ink) 86%, var(--muted));
  font-weight: 700;
}

.source-memory-section-body {
  padding: 2px 0 12px;
}

.source-memory-section-body .excerpt-text {
  gap: 7px;
  font-size: 12px;
  line-height: 1.5;
}

.source-section-truncation {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.source-technical-details {
  margin-top: 16px;
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
}

.source-technical-details > summary {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.source-technical-details > summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-technical-details > summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.source-technical-details[open] > summary::after {
  content: "-";
}

.source-technical-body {
  display: grid;
  gap: 14px;
  padding: 4px 0 12px;
}

.source-technical-record + .source-technical-record {
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
}

.source-technical-record h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 12px;
}

.source-technical-record dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.source-technical-record dl div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  font-size: 10px;
  line-height: 1.4;
}

.source-technical-record dt {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.source-technical-record dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.source-raw-record {
  margin-top: 9px;
  border-top: 1px solid var(--soft-line);
}

.source-raw-record > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  list-style: none;
}

.source-raw-record > .raw-source-text {
  margin-bottom: 4px;
}

.book-context-secondary {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 72%, var(--bg));
}

.book-context-primary {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.book-context-note {
  margin: 9px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.book-context-collapse {
  margin-top: 10px;
}

.inline-source-reader {
  margin-top: 10px;
}

.source-reader-body {
  display: grid;
  gap: 10px;
}

.source-reader-card {
  display: grid;
  gap: 4px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.source-reader-card strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.source-reader-card span {
  color: var(--muted);
  font-size: 12px;
}

.source-reader-section .source-link {
  margin-top: 8px;
}

.source-linked-md {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
}

.linked-source-card {
  border-left-color: var(--accent-2);
}

.live-index-overlay {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  padding: 10px;
}

.live-index-overlay p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.live-index-rows {
  display: grid;
  gap: 5px;
}

.live-index-rows div {
  display: grid;
  grid-template-columns: minmax(80px, 0.45fr) minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.live-index-rows span {
  color: var(--muted);
}

.source-facts {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.source-fact {
  display: grid;
  grid-template-columns: minmax(82px, 0.45fr) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.35;
}

.source-fact span {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 750;
}

.source-fact strong {
  overflow-wrap: anywhere;
}

.excerpt-text {
  display: grid;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.excerpt-text h4 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.excerpt-line {
  margin: 0;
  overflow-wrap: anywhere;
}

.excerpt-bullet {
  padding-left: 16px;
  position: relative;
}

.excerpt-bullet::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.excerpt-meta {
  color: var(--muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.markdown-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
  font-size: 12px;
  line-height: 1.35;
}

.markdown-table th,
.markdown-table td {
  border-bottom: 1px solid var(--soft-line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.markdown-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
}

.markdown-table td {
  overflow-wrap: anywhere;
}

.markdown-table tr:last-child td {
  border-bottom: 0;
}

.table-truncation {
  margin: 0;
  border-top: 1px solid var(--soft-line);
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.markdown-collapse {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  padding: 9px 10px;
}

.markdown-collapse summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.markdown-collapse:not([open]) > :not(summary),
.markdown-collapse:not([open]) > .markdown-collapse-body,
.markdown-collapse > .markdown-collapse-body[hidden] {
  display: none !important;
}

.markdown-collapse > .excerpt-text,
.markdown-collapse > .markdown-collapse-body {
  margin-top: 10px;
}

.related-context-body {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.source-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  max-height: 460px;
  overflow: auto;
}

.raw-source-text {
  max-height: min(62vh, 720px);
}

.raw-source-details {
  border-top: 1px solid var(--soft-line);
}

.raw-source-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  border-left: 3px solid var(--line);
  padding-left: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.list-item strong {
  color: var(--ink);
}

.node {
  cursor: pointer;
  transition: opacity 150ms ease;
  touch-action: none;
  animation: bubbleIn 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.node.stable {
  animation: none;
}

.node.organic-reveal {
  animation: organicBubbleReveal 620ms cubic-bezier(0.18, 0.9, 0.22, 1) both;
}

.people-cluster {
  pointer-events: none;
  transition: opacity 180ms ease;
}

.people-cluster-halo {
  fill: color-mix(in srgb, var(--accent-2) 16%, transparent);
  stroke: color-mix(in srgb, var(--accent-2) 34%, transparent);
  stroke-width: 1.1;
  stroke-dasharray: 10 8;
}

.people-cluster-label {
  fill: color-mix(in srgb, var(--accent-2) 72%, var(--ink));
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.people-cluster.active .people-cluster-halo {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
  stroke: color-mix(in srgb, var(--accent) 54%, transparent);
  stroke-width: 1.7;
  stroke-dasharray: none;
}

.people-cluster.neighbor .people-cluster-halo {
  fill: color-mix(in srgb, var(--accent-2) 12%, transparent);
  stroke: color-mix(in srgb, var(--accent-2) 46%, transparent);
}

.people-cluster.muted {
  opacity: 0.18;
}

.node:hover {
  opacity: 0.86;
}

.node:hover .memory-bubble-core {
  opacity: 1;
  filter: drop-shadow(0 4px 10px var(--shadow));
}

.node:hover .memory-bubble-rim {
  stroke-opacity: 0.34;
}

.node.node-active .memory-bubble-core,
.node.relation-active .memory-bubble-core,
.node.bundle-match .memory-bubble-core,
.node.journal-match .memory-bubble-core {
  filter:
    drop-shadow(0 0 9px color-mix(in srgb, var(--accent) 48%, transparent))
    drop-shadow(0 9px 18px color-mix(in srgb, var(--accent) 34%, transparent));
}

.node.relation-neighbor .memory-bubble-core {
  filter:
    drop-shadow(0 0 6px color-mix(in srgb, var(--focus) 34%, transparent))
    drop-shadow(0 6px 13px color-mix(in srgb, var(--ink) 22%, transparent));
}

.memory-bubble-highlight,
.memory-bubble-shadow-edge,
.memory-bubble-rim,
.memory-bubble-rim-arc,
.memory-bubble-inner-crescent,
.memory-bubble-inner-edge,
.memory-bubble-echo,
.memory-bubble-base,
.bubble-line-occluder,
.memory-bubble-selection-echo,
.memory-bubble-selection-ring {
  pointer-events: none;
}

.bubble-line-occluder {
  fill: color-mix(in srgb, var(--paper) 86%, var(--bg));
  opacity: 0.98;
}

.node.node-active .bubble-depth-ring,
.node.relation-active .bubble-depth-ring,
.node.bundle-match .bubble-depth-ring,
.node.journal-match .bubble-depth-ring {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--focus) 42%, transparent));
}

.node.relation-neighbor .bubble-depth-ring {
  filter: none;
}

.node.relation-muted {
  opacity: 0.34;
}

.node.relation-muted .person-label,
.node.relation-muted .place-label,
.node.relation-muted .node-badge {
  opacity: 0.24;
}

.node.relation-active .person-label,
.node.relation-active .place-label,
.node.relation-neighbor .person-label,
.node.relation-neighbor .place-label {
  font-weight: 800;
  opacity: 1;
}

.world-map-bg {
  fill: color-mix(in srgb, var(--paper) 82%, var(--bg));
  stroke: var(--line);
  stroke-width: 1.2;
}

.world-map-land {
  fill: color-mix(in srgb, var(--ink) 9%, var(--paper));
  stroke: color-mix(in srgb, var(--ink) 22%, var(--line));
  stroke-width: 0.5;
  stroke-linejoin: round;
}

.world-map-graticule {
  stroke: color-mix(in srgb, var(--line) 40%, transparent);
  stroke-width: 0.8;
  fill: none;
}

.world-map-equator {
  stroke: color-mix(in srgb, var(--accent) 45%, var(--line));
  stroke-width: 1;
  stroke-dasharray: 5 6;
}

.world-map-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.zone-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  pointer-events: none;
}

.world-city {
  pointer-events: none;
}

.world-city-dot {
  fill: color-mix(in srgb, var(--ink) 35%, transparent);
}

.world-city-label {
  fill: var(--muted);
  font-size: 8px;
  font-weight: 600;
  opacity: 0.75;
}

.world-pin-count {
  fill: #ffffff;
  font-size: 9px;
  font-weight: 800;
  pointer-events: none;
}

.world-pin-label {
  fill: var(--ink);
  font-size: 9.5px;
  font-weight: 700;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 2.4px;
}

.world-pin { cursor: pointer; }

.world-thumb-frame {
  fill: var(--paper);
  stroke: color-mix(in srgb, var(--ink) 18%, var(--line));
  stroke-width: 1;
}

.world-pin-thumb {
  pointer-events: none;
}

.world-thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.world-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--control);
}


.node.dragging {
  opacity: 0.92;
}

.evidence-badges {
  display: none !important;
}

.evidence-badge-pill {
  display: none !important;
}

.evidence-badge-text {
  display: none !important;
}

.node-badge {
  pointer-events: none;
}

.node-badge rect {
  fill: color-mix(in srgb, var(--paper) 88%, transparent);
  stroke: color-mix(in srgb, var(--ink) 22%, transparent);
  stroke-width: 0.7;
}

.node-badge text {
  fill: var(--ink);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}

.node-badge.summary rect {
  fill: color-mix(in srgb, var(--ink) 78%, var(--paper));
  stroke: var(--paper);
}

.node-badge.summary text {
  fill: var(--paper);
}

.connection {
  --line-opacity: 0.08;
  stroke-width: 1;
  stroke-opacity: 0.08;
  pointer-events: none;
  stroke-dasharray: 8 10;
  vector-effect: non-scaling-stroke;
  animation: connectionIn 520ms ease-out both;
}

html[data-theme="dark"] .connection,
html[data-theme="dark"] .person-link {
  filter: drop-shadow(0 0 2px color-mix(in srgb, var(--paper) 20%, transparent));
}

.connection.person-radial {
  --line-opacity: 0.12;
  stroke-width: 1.35;
  stroke-opacity: 0.12;
  stroke-dasharray: none;
}

.connection.connection-child-spoke {
  display: none;
}

.person-link.connection-anchor {
  stroke-linecap: round;
  stroke-dasharray: none;
}

.connection-anchor-layer-segment,
.connection-anchor-layer-port {
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.connection-anchor-layer-port {
  filter: drop-shadow(0 0 3px currentColor);
}

.connection-child-label.hover-only {
  opacity: 0 !important;
  transition: opacity 100ms ease;
}

.node:hover .connection-child-label.hover-only,
.node.node-active .connection-child-label.hover-only {
  opacity: 1 !important;
}

.diary-road-path {
  fill: none;
  stroke: color-mix(in srgb, var(--accent-2) 64%, var(--ink));
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.28;
  stroke-dasharray: 2 12;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

html[data-theme="dark"] .diary-road-path {
  stroke-opacity: 0.42;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent-2) 28%, transparent));
}

.connection.relation-focus-spoke {
  stroke-dasharray: none;
}

.connection.relation-muted-spoke {
  stroke-dasharray: 4 12;
}

.person-link {
  --line-opacity: 0.1;
  pointer-events: none;
  stroke: var(--ink);
  stroke-linecap: round;
  animation: connectionIn 520ms ease-out both;
}

.person-link.relationship {
  --line-opacity: 0.18;
  stroke-opacity: 0.18;
}

.person-link.co-appearance,
.person-link.peer {
  --line-opacity: 0.08;
  stroke-opacity: 0.08;
  stroke-dasharray: 4 8;
}

.person-link.peer {
  --line-opacity: 0.1;
  stroke-opacity: 0.1;
  stroke-dasharray: 2 7;
}

.person-link.photo-appearance {
  --line-opacity: 0.34;
  stroke: color-mix(in srgb, var(--accent) 42%, #B86A4E);
  stroke-opacity: 0.34;
  stroke-dasharray: none;
  filter: drop-shadow(0 2px 4px color-mix(in srgb, #9A3F24 10%, transparent));
}

.person-link.photo-place {
  --line-opacity: 0.16;
  stroke: color-mix(in srgb, var(--accent) 38%, var(--places-color, #36A6A8));
  stroke-opacity: 0.16;
}

.person-link.person-place {
  --line-opacity: 0.5;
  stroke: color-mix(in srgb, var(--accent-2) 68%, var(--accent));
  stroke-opacity: 0.5;
  stroke-linecap: round;
}

.person-link.relation-focus-link {
  filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--accent) 28%, transparent));
}

.person-link.relation-muted-link {
  stroke-opacity: 0.035;
}

.legend-line {
  display: inline-block;
  width: 22px;
  height: 0;
  margin-right: 4px;
  vertical-align: middle;
  border-top: 2px solid var(--muted);
}

.legend-line.legend-dotted {
  border-top-style: dotted;
}

.map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  border: 1px solid var(--soft-line);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.map-legend .legend-row {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.map-legend .legend-line {
  width: 16px;
}

.person-link.stay-place {
  --line-opacity: 0.16;
  stroke: color-mix(in srgb, var(--accent) 28%, #6F9F91);
  stroke-opacity: 0.16;
  stroke-dasharray: 7 5;
}

.person-link.stay-companion {
  --line-opacity: 0.16;
  stroke: color-mix(in srgb, var(--accent) 36%, #6F9F91);
  stroke-opacity: 0.16;
  stroke-dasharray: 3 5;
}

.person-link.diary-person,
.person-link.diary-place {
  --line-opacity: 0.13;
  stroke: color-mix(in srgb, var(--accent) 32%, #665BC0);
  stroke-opacity: 0.13;
  stroke-dasharray: 2 6;
}

.person-link.mail-person,
.person-link.mail-place,
.person-link.mail-stay {
  --line-opacity: 0.14;
  stroke: color-mix(in srgb, var(--accent) 52%, #7a7a7a);
  stroke-opacity: 0.14;
  stroke-dasharray: 1 7;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes organicBubbleReveal {
  from {
    opacity: 0;
    filter: blur(1.8px);
  }
  62% {
    opacity: 0.96;
    filter: blur(0.3px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes connectionIn {
  from {
    stroke-opacity: 0;
    stroke-dashoffset: 28;
  }
  to {
    stroke-opacity: var(--line-opacity, 0.22);
    stroke-dashoffset: 0;
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes timelineIn {
  from {
    opacity: 0;
    filter: blur(2px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

.bubble-tooltip {
  position: fixed;
  z-index: 20;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  color: var(--ink);
  box-shadow: 0 10px 28px var(--shadow);
  padding: 12px 14px;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tip-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.tip-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.tip-body,
.tip-path,
.tip-reason {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 5px;
}

.tip-reason {
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

.tip-facts {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border-top: 1px solid var(--soft-line);
  padding-top: 7px;
}

.tip-facts div {
  display: grid;
  grid-template-columns: minmax(58px, 0.42fr) minmax(0, 1fr);
  gap: 8px;
  font-size: 11px;
  line-height: 1.25;
}

.tip-facts span {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
}

.tip-facts strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.tip-path {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.node-label {
  fill: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.person-label {
  pointer-events: none;
  fill: var(--ink);
  font-weight: 500;
  letter-spacing: 0;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.person-label.inside,
.place-label.inside {
  fill: var(--paper);
  font-weight: 800;
  stroke: color-mix(in srgb, var(--ink) 36%, transparent);
  stroke-width: 2px;
  font-size: 9px;
}

.connection-anchor-label {
  pointer-events: none;
  fill: var(--paper);
  font-weight: 800;
  letter-spacing: 0;
  text-anchor: middle;
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--ink) 44%, transparent);
  stroke-width: 1.8px;
  stroke-linejoin: round;
}

.episode-anchor-label {
  pointer-events: none;
  fill: var(--ink);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
  text-anchor: middle;
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--paper) 92%, transparent);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.episode-date-stamp {
  pointer-events: none;
  fill: var(--paper);
  font-weight: 800;
  letter-spacing: 0;
  text-anchor: middle;
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--ink) 42%, transparent);
  stroke-width: 1.6px;
}

.person-link.episode-sequence {
  stroke-dasharray: 3 7;
  stroke-opacity: 0.24;
}

.person-label.outside {
  font-size: 11px;
}

.person-label.label-hidden,
.place-label.label-hidden {
  opacity: 0;
}

.person-label.inner {
  font-weight: 800;
}

.place-label {
  pointer-events: none;
  fill: var(--ink);
  font-size: 10px;
  font-weight: 650;
  text-transform: none;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.place-label.inside {
  font-size: 8.5px;
}

.place-label.outside {
  fill: #ffffff;
  font-size: 10px;
  font-weight: 750;
  stroke: color-mix(in srgb, #000000 68%, transparent);
  stroke-width: 3.2px;
}

.connection-child-label.outside {
  font-size: 9.5px;
  font-weight: 700;
}

.center-dot {
  fill: color-mix(in srgb, var(--bg) 78%, #0b1d2a);
  stroke: color-mix(in srgb, #90d0f0 84%, transparent);
  stroke-width: 1.25;
  filter: drop-shadow(0 0 10px color-mix(in srgb, #60d0f0 14%, transparent));
}

.center-aperture,
.center-aperture-glow,
.center-aperture-echo,
.center-aperture-rim,
.center-aperture-inner-lip,
.center-aperture-layer-arc,
.center-aperture-layer-segment,
.center-aperture-highlight {
  pointer-events: none;
}

.center-aperture-layer-segment {
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.center-label {
  fill: color-mix(in srgb, var(--ink) 94%, #d8f5ff);
  font-weight: 760;
  font-size: 16px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: color-mix(in srgb, #000000 50%, transparent);
  stroke-width: 2.2px;
}

.center-sub {
  fill: color-mix(in srgb, var(--muted) 72%, #9bd8f0);
  font-size: 12px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: color-mix(in srgb, #000000 44%, transparent);
  stroke-width: 1.8px;
}

.evidence-hierarchy-ring,
.evidence-hierarchy-label {
  pointer-events: none;
}

.evidence-hierarchy-ring {
  vector-effect: non-scaling-stroke;
}

.evidence-hierarchy-label {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--bg) 92%, transparent);
  stroke-width: 2.5px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

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

  .app-shell.right-collapsed {
    grid-template-columns: 240px minmax(0, 1fr);
  }

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

  .detail-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    min-width: 0;
    max-width: none;
    max-height: 42vh;
  }

  .detail-resizer {
    display: none;
  }

  .app-shell.right-collapsed .detail-panel {
    max-height: 42px;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    grid-template-rows: minmax(720px, 100dvh) minmax(420px, 70dvh);
  }

  .left-rail {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    overflow-y: auto;
  }

  .stage {
    grid-column: 2;
    grid-row: 1;
    height: 100%;
    min-height: 720px;
  }

  .stage-top {
    height: auto;
    min-height: 180px;
    max-height: none;
  }

  .detail-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 70dvh;
    min-height: 420px;
    max-height: none;
  }

  .app-shell.right-collapsed {
    grid-template-rows: minmax(720px, 100dvh) 42px;
  }

  .app-shell.right-collapsed .detail-panel {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  html,
  body {
    overflow: auto;
  }

  .left-rail,
  .detail-panel {
    border: 0;
  }

  .stage {
    order: 1;
    min-height: 720px;
    grid-template-rows: auto auto minmax(420px, 56vh) auto;
  }

  .left-rail {
    order: 2;
    border-top: 1px solid var(--line);
    display: block;
    overflow: visible;
  }

  .detail-panel {
    order: 3;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .detail-content {
    height: auto;
    overflow: visible;
  }

  .app-shell.left-collapsed .left-rail,
  .app-shell.right-collapsed .detail-panel {
    min-height: 42px;
    max-height: 42px;
  }

  .stage-top {
    display: block;
  }

  .stage-search {
    width: 100%;
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
  }

  .stage-search input[type="search"] {
    flex: 1 0 100%;
  }

  .stage-search .center-mode-controls {
    flex: 1 0 100%;
    min-width: 0;
  }

  .stage-search .center-mode {
    width: 100%;
  }

  .stage-search button {
    flex: 1 1 auto;
  }
}

/* Banking detail fact list (20260605) */
.fact-list { list-style: none; margin: 8px 0 0; padding: 0; }
.fact-list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--hairline, #e7e3da); font-size: 13px; }
.fact-list li:last-child { border-bottom: none; }
.fact-list li span { color: var(--muted, #8a8377); }
.fact-list li strong { font-variant-numeric: tabular-nums; }

/* Banking right-panel when/where (20260605) */
.banking-sub { font-weight: 600; color: var(--muted, #8a8377); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; margin: 12px 0 4px; }
.byyear-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.byyear-label { color: var(--muted, #8a8377); font-variant-numeric: tabular-nums; font-size: 12px; }
.byyear-bar { background: var(--hairline, #e7e3da); border-radius: 3px; height: 8px; overflow: hidden; }
.byyear-bar span { display: block; height: 100%; border-radius: 3px; }
.byyear-val { font-variant-numeric: tabular-nums; font-size: 12px; }

/* Income card (year frame — authoritative gross income, distinct from bank tx) */
.income-card {
  display: grid;
  gap: 8px;
  margin: 4px 0 12px;
  border: 1px solid color-mix(in srgb, #2e9e6b 40%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, #2e9e6b 10%, var(--panel));
  padding: 10px;
}
.income-card .source-summary-kind { font-weight: 600; }
.income-rows {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.income-rows > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, #2e9e6b 8%, var(--paper));
}
.income-rows strong { font-size: 11px; color: var(--muted); font-weight: 600; }
.income-rows span { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
