:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --atlas-canvas: #171916;
  --atlas-graph-canvas: #171916;
  --atlas-card: #252823;
  --atlas-frame: #11130f;
  --atlas-foreground: #f0f2e8;
  --atlas-muted: #adb3a6;
  --atlas-quiet: #838a7d;
  --atlas-border: #41483b;
  --atlas-grid: #34392f;
  --atlas-accent: #deef52;
  --atlas-accent-ink: #272b1b;
  --atlas-danger: #e3a5a0;
  --graph-accent: var(--atlas-accent);
  --bg: var(--atlas-canvas);
  --panel: var(--atlas-card);
  --line: var(--atlas-border);
  --text: var(--atlas-foreground);
  --muted: var(--atlas-muted);
  --quiet: var(--atlas-quiet);
  --teal: var(--atlas-accent);
  --teal-deep: var(--atlas-accent);
  --blue: var(--atlas-muted);
  --purple: var(--atlas-muted);
  --amber: var(--atlas-muted);
  --rose: var(--atlas-muted);
  --shadow: 0 18px 50px #0004;
}
html[data-theme="light"] {
  color-scheme: light;
  --atlas-canvas: #dedfd7;
  --atlas-graph-canvas: #d4d5cd;
  --atlas-card: #f4f5ee;
  --atlas-frame: #30332e;
  --atlas-foreground: #242721;
  --atlas-muted: #62665c;
  --atlas-quiet: #777d71;
  --atlas-border: #bfc3b7;
  --atlas-grid: #c4c8bc;
  --atlas-accent: #c3d32c;
  --atlas-accent-ink: #272b1b;
  --atlas-danger: #9d4f4b;
  --graph-accent: var(--atlas-accent);
  --bg: var(--atlas-canvas);
  --panel: var(--atlas-card);
  --line: var(--atlas-border);
  --text: var(--atlas-foreground);
  --muted: var(--atlas-muted);
  --quiet: var(--atlas-quiet);
  --teal: var(--atlas-accent);
  --teal-deep: var(--atlas-accent);
  --blue: var(--atlas-muted);
  --purple: var(--atlas-muted);
  --amber: var(--atlas-muted);
  --rose: var(--atlas-muted);
  --shadow: 0 18px 50px #2223;
}
html,
body { background: var(--atlas-canvas); color: var(--atlas-foreground); }
body { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
svg:focus-visible { outline-color: var(--atlas-accent); }

/* The sidebar is the quiet charcoal frame in both appearances. */
.sidebar { background: var(--atlas-frame); border-color: color-mix(in srgb, var(--atlas-frame), white 12%); color: #f0f2e8; }
.brand-lockup { color: #f0f2e8; }
.brand-mark { align-content: center; }
.brand-mark i { background: var(--atlas-accent); box-shadow: none; }
.eyebrow,
.sidebar-label-row .eyebrow { color: var(--atlas-muted); }
.sidebar .eyebrow { color: #b0b5a9; }
.sidebar .icon-button { color: #d3d7cc; }
.sidebar .icon-button:hover,
.sidebar .project-row:hover { background: #ffffff12; border-color: #ffffff18; color: #fff; }
.project-row { color: #d2d5cb; }
.project-row.active { color: #f5f6ed; background: #ffffff13; border-color: #ffffff24; }
.project-monogram,
.project-row:nth-child(3n+2) .project-monogram,
.project-row:nth-child(3n) .project-monogram { color: var(--atlas-accent); background: #ffffff0c; border-color: #ffffff20; }
.project-meta,
.project-count { color: #b0b5a9; }
.sidebar-import { border-color: #ffffff40; color: #eceee5; border-radius: 999px; }
.sidebar-import:hover { border-color: var(--atlas-accent); background: #ffffff12; color: #fff; }
.import-glyph { color: var(--atlas-accent); }
.sidebar-import kbd { color: #b0b5a9; }
.local-status,
.quiet-link { border-color: #ffffff24; }
.local-status strong { color: #f0f2e8; }
.local-status small,
.sidebar-link,
.version { color: #b0b5a9; }
.sidebar-link:hover { color: #fff; }
.sidebar .status-dot { background: var(--atlas-accent); box-shadow: none; }

.main-area { background: var(--atlas-canvas); }
.topbar { background: var(--atlas-canvas); border-color: var(--atlas-border); }
.breadcrumbs,
.saved-indicator { color: var(--atlas-muted); }
.breadcrumbs strong { color: var(--atlas-foreground); }
.crumb-sep,
.status-separator { color: var(--atlas-quiet); }
.avatar-button { color: var(--atlas-foreground); background: var(--atlas-card); border-color: var(--atlas-border); }
.page-heading .heading-copy .eyebrow { color: var(--atlas-muted); }
h1,
.heading-copy h1 { color: var(--atlas-foreground); font-weight: 520; }
.heading-copy p { color: var(--atlas-muted); }
.heading-actions { align-items: center; }
.button { border-radius: 999px; }
.button.primary { color: var(--atlas-accent-ink); border-color: var(--atlas-accent); background: var(--atlas-accent); box-shadow: none; }
.button.primary:hover { background: color-mix(in srgb, var(--atlas-accent), white 10%); }
.button.secondary { color: var(--atlas-foreground); border-color: var(--atlas-border); background: var(--atlas-card); }
.button.secondary:hover { border-color: var(--atlas-muted); background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 5%); }
.button.danger { color: var(--atlas-danger); border-color: color-mix(in srgb, var(--atlas-danger), transparent 55%); background: var(--atlas-card); }
.export-menu { border-color: var(--atlas-border); border-radius: 14px; background: var(--atlas-card); }
.export-menu button { color: var(--atlas-foreground); border-radius: 999px; }
.export-menu button:hover { color: var(--atlas-foreground); background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 7%); }

.theme-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 11px; border: 1px solid var(--atlas-border); border-radius: 999px; color: var(--atlas-foreground); background: var(--atlas-card); font-size: 10px; }
.theme-toggle:hover { border-color: var(--atlas-muted); }
.theme-toggle[aria-pressed="true"] .theme-icon { color: var(--atlas-accent); }
.theme-icon { width: 13px; height: 13px; border: 1px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, var(--atlas-accent) 50%, transparent 50%); }

.toolbar { color: var(--atlas-foreground); }
.search-field { border-color: var(--atlas-border); border-radius: 999px; background: var(--atlas-card); color: var(--atlas-muted); }
.search-field input { color: var(--atlas-foreground); }
.search-field input::placeholder,
.search-field kbd { color: var(--atlas-quiet); }
.search-field kbd { border-color: var(--atlas-border); border-radius: 999px; }
.toolbar-divider { border-color: var(--atlas-border); }
.filter-chip { border-radius: 999px; color: var(--atlas-muted); }
.filter-chip:hover { background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 5%); color: var(--atlas-foreground); }
.filter-chip.active { border-color: var(--atlas-border); background: var(--atlas-card); color: var(--atlas-foreground); }
.filter-chip .chip-count { color: var(--atlas-quiet); }
.type-dot { background: var(--atlas-accent); }
.toolbar-button { border-radius: 999px; color: var(--atlas-muted); }
.toolbar-button:hover,
.toolbar-button#pause-motion[aria-pressed="true"] { border-color: var(--atlas-border); background: var(--atlas-card); color: var(--atlas-foreground); }
.toolbar-button span,
.text-button { color: var(--atlas-foreground); }
.toolbar-button.add-node { border-color: var(--atlas-border); background: var(--atlas-card); color: var(--atlas-foreground); }
.toolbar-button.add-node:hover { border-color: var(--atlas-muted); background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 6%); }

.graph-workspace { gap: 14px; }
.graph-stage { border-color: var(--atlas-border); border-radius: 22px; background-color: var(--atlas-graph-canvas); background-image: radial-gradient(var(--atlas-grid) .7px, transparent .7px); box-shadow: none; }
.canvas-caption { color: var(--atlas-muted); }
.live-dot,
.status-dot,
.status-pulse { background: var(--atlas-accent); box-shadow: none; }
.caption-sep,
.canvas-help { color: var(--atlas-muted); }
.canvas-help i { background: var(--atlas-border); }
.graph-controls { border-color: var(--atlas-border); border-radius: 999px; background: var(--atlas-card); box-shadow: 0 4px 14px #0002; }
.graph-controls button { border-radius: 999px; color: var(--atlas-foreground); }
.graph-controls button:hover { background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 8%); color: var(--atlas-foreground); }
.graph-controls span { border-color: var(--atlas-border); }
.empty-state { background: color-mix(in srgb, var(--atlas-graph-canvas), transparent 13%); }
.empty-icon { border-color: var(--atlas-border); border-radius: 50%; color: var(--atlas-accent-ink); background: var(--atlas-accent); }
.drop-overlay { border-color: var(--atlas-accent); border-radius: 18px; background: color-mix(in srgb, var(--atlas-card), transparent 8%); }
.drop-overlay strong,
.drop-overlay span { color: var(--atlas-foreground); }

.inspector { border-color: var(--atlas-border); border-radius: 22px; background: var(--atlas-card); }
.inspector-head,
.inspector-footer { border-color: var(--atlas-border); }
.inspector-head h2,
.inspector-empty strong,
.detail-title { color: var(--atlas-foreground); }
.inspector-empty,
.inspector-empty p { color: var(--atlas-muted); }
.inspector-empty-icon { border-color: var(--atlas-border); color: var(--atlas-muted); }
.inspector-empty p { color: var(--atlas-muted); }
.text-button { color: var(--atlas-muted); }
.text-button:hover { color: var(--atlas-foreground); }
.statusbar { border-color: var(--atlas-border); background: var(--atlas-canvas); color: var(--atlas-muted); }
.status-right { color: var(--atlas-muted); }

/* Keep graph components monochrome; reserve yellow for selection and focus. */
.node-card .card-bg { fill: var(--atlas-card); stroke: var(--atlas-border); }
.node-card:hover .card-bg { fill: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 5%); stroke: var(--atlas-muted); }
.node-card.selected .card-bg { fill: color-mix(in srgb, var(--atlas-card), var(--atlas-accent) 9%); stroke: var(--atlas-accent); filter: none; }
.node-card.search-hit .card-bg { stroke: var(--atlas-accent); }
.node-card .card-accent { fill: var(--atlas-accent); }
.node-card .card-type { fill: var(--atlas-muted); }
.node-card .card-title { fill: var(--atlas-foreground); }
.node-card .card-desc,
.node-card .card-source { fill: var(--atlas-muted); }
.node-card .card-port { fill: var(--atlas-graph-canvas); stroke: var(--atlas-muted); }
.edge-path { stroke: color-mix(in srgb, var(--atlas-muted), transparent 35%); }
.edge-path.connected,
.edge-path.highlight { stroke: var(--atlas-accent); }
.edge-label-bg { fill: var(--atlas-card); stroke: var(--atlas-border); }
.edge-label { fill: var(--atlas-muted); }
.edge-arrow { stroke: var(--atlas-muted); }
.edge-arrow.connected { stroke: var(--atlas-accent); }
.edge-beam { filter: none; }
.node-card.arrival .card-bg { animation: atlas-arrival .32s ease-out; }
@keyframes atlas-arrival { 0% { stroke: var(--atlas-accent); } 45% { stroke: var(--atlas-accent); } 100% { stroke: var(--atlas-border); } }

.inspector-body { color: var(--atlas-foreground); }
.detail-type { border-color: var(--atlas-border); border-radius: 999px; color: var(--atlas-foreground); background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 4%); }
.detail-description,
.connection-item { color: var(--atlas-muted); }
.detail-section h3 { color: var(--atlas-muted); }
.source-pill { border-color: var(--atlas-border); border-radius: 10px; background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 4%); color: var(--atlas-muted); }
.connection-item button { color: var(--atlas-foreground); }
.connection-item button:hover,
.connection-arrow { color: var(--atlas-muted); }
.connection-label { color: var(--atlas-muted); }
.inspector-actions button { border-color: var(--atlas-border); border-radius: 999px; background: var(--atlas-card); color: var(--atlas-foreground); }
.inspector-actions button:hover { background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 7%); color: var(--atlas-foreground); }
.inspector-actions .delete-action,
.danger-button { color: var(--atlas-danger); }

.modal { border-color: var(--atlas-border); border-radius: 20px; background: var(--atlas-card); color: var(--atlas-foreground); }
.modal::backdrop { background: #11130fcc; backdrop-filter: blur(4px); }
.modal-head p,
.field-hint { color: var(--atlas-muted); }
.import-tabs { border-color: var(--atlas-border); }
.tab { color: var(--atlas-muted); }
.tab.active { color: var(--atlas-foreground); }
.tab.active:after { background: var(--atlas-accent); }
.field-label,
.field > span { color: var(--atlas-muted); }
textarea,
input,
select { color: var(--atlas-foreground); }
#json-input,
#prompt-text,
.field input,
.field textarea,
.field select,
.share-url-input { border-color: var(--atlas-border); border-radius: 11px; background: var(--atlas-canvas); color: var(--atlas-foreground); }
#json-input::placeholder,
.field input::placeholder,
.field textarea::placeholder { color: var(--atlas-quiet); }
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--atlas-accent); }
.file-picker { border-color: var(--atlas-border); border-radius: 16px; color: var(--atlas-muted); background: var(--atlas-canvas); }
.file-picker:hover { border-color: var(--atlas-accent); background: var(--atlas-card); }
.file-picker strong { color: var(--atlas-foreground); }
.file-picker > span:last-of-type { color: var(--atlas-muted); }
.file-icon { border-radius: 50%; color: var(--atlas-accent-ink); background: var(--atlas-accent); }
.form-error { border-color: color-mix(in srgb, var(--atlas-danger), transparent 50%); color: var(--atlas-danger); background: color-mix(in srgb, var(--atlas-danger), var(--atlas-card) 90%); }
.modal-foot { border-color: var(--atlas-border); }
.danger-button:hover { color: var(--atlas-danger); }
.toast { border-color: var(--atlas-border); border-radius: 14px; color: var(--atlas-foreground); background: var(--atlas-card); }
.toast.error { border-color: color-mix(in srgb, var(--atlas-danger), transparent 40%); color: var(--atlas-danger); background: var(--atlas-card); }

@media (max-width: 820px) {
  .graph-stage { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .node-card.arrival .card-bg { animation: none; }
}



.timeline-surface { position: absolute; inset: 43px 0 0; z-index: 2; display: flex; min-width: 0; flex-direction: column; overflow: hidden; padding: 0 18px 48px; background: var(--atlas-graph-canvas); }
.timeline-intro { display: flex; align-items: baseline; gap: 12px; min-height: 26px; }
.timeline-kicker { color: var(--atlas-muted); font-size: 8px; font-weight: 720; letter-spacing: 1.15px; }
.timeline-note { margin: 0; color: var(--atlas-muted); font-size: 10px; }
.timeline-overview { display: flex; min-height: 32px; gap: 5px; overflow-x: auto; padding: 3px 0 5px; scrollbar-width: thin; }
.timeline-step-button { flex: 0 0 auto; padding: 5px 10px; border: 1px solid var(--atlas-border); border-radius: 999px; color: var(--atlas-muted); background: var(--atlas-card); font-size: 9px; }
.timeline-step-button:hover,
.timeline-step-button:focus-visible { border-color: var(--atlas-accent); color: var(--atlas-foreground); }
.timeline-scroller { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--atlas-border) transparent; }
.timeline-rail { position: relative; display: flex; align-items: flex-start; gap: 34px; width: max-content; min-width: 100%; padding: 14px 10px 20px; }
.timeline-rail::before { position: absolute; top: 20px; right: 20px; left: 10px; height: 1px; background: var(--atlas-border); content: ""; }
.timeline-stage { position: relative; z-index: 1; flex: 0 0 min(290px, 78vw); width: min(290px, 78vw); scroll-margin-inline: 12px; }
.timeline-stage-head { display: flex; align-items: flex-start; gap: 10px; min-height: 43px; padding: 0 0 10px; }
.timeline-stage-dot { flex: 0 0 13px; width: 13px; height: 13px; margin-top: 1px; border: 2px solid var(--atlas-border); border-radius: 50%; background: var(--atlas-graph-canvas); box-shadow: 0 0 0 4px var(--atlas-graph-canvas); }
.timeline-stage:first-child .timeline-stage-dot { border-color: var(--atlas-accent); background: var(--atlas-accent); }
.timeline-stage-title { margin: 0; color: var(--atlas-foreground); font-size: 10px; font-weight: 760; letter-spacing: .7px; text-transform: uppercase; }
.timeline-stage-count { margin: 3px 0 0; color: var(--atlas-muted); font-size: 9px; }
.timeline-node-card { display: grid; gap: 7px; margin: 0 0 9px; padding: 12px 13px; border: 1px solid var(--atlas-border); border-radius: 18px; background: var(--atlas-card); color: var(--atlas-foreground); }
.timeline-node-card.selected { border-color: var(--atlas-accent); box-shadow: inset 0 0 0 1px var(--atlas-accent); }
.timeline-node-select { display: grid; justify-items: start; gap: 5px; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.timeline-node-select:focus-visible { outline-offset: 4px; }
.timeline-node-type { color: var(--atlas-muted); font-size: 8px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.timeline-node-title { color: var(--atlas-foreground); font-size: 12px; font-weight: 630; line-height: 1.35; }
.timeline-node-description { margin: 0; color: var(--atlas-muted); font-size: 10px; line-height: 1.5; }
.timeline-node-source { width: 100%; overflow-wrap: anywhere; color: var(--atlas-muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; }
.architecture-chart { min-width: 0; margin: 2px 0 0; padding-top: 8px; border-top: 1px solid var(--atlas-border); }
.chart-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chart-title { color: var(--atlas-foreground); font-size: 9px; font-weight: 620; }
.chart-kind { flex: 0 0 auto; color: var(--atlas-muted); font-size: 8px; text-transform: uppercase; letter-spacing: .6px; }
.chart-svg { display: block; width: 100%; height: 56px; overflow: visible; }
.chart-baseline { fill: none; stroke: var(--atlas-border); stroke-width: .8; }
.chart-area { fill: var(--atlas-accent); fill-opacity: .2; }
.chart-line { fill: none; stroke: var(--atlas-accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.chart-marker { fill: var(--atlas-card); stroke: var(--atlas-accent); stroke-width: 1.5; }
.chart-marker:hover,
.chart-marker:focus { fill: var(--atlas-accent); outline: none; }
.chart-evidence { margin: 0; color: var(--atlas-muted); font-size: 8px; line-height: 1.45; overflow-wrap: anywhere; }
.chart-readout { color: var(--atlas-muted); font-size: 8px; }
.chart-readout summary { width: fit-content; color: var(--atlas-muted); cursor: pointer; }
.chart-readout summary:hover,
.chart-readout summary:focus-visible { color: var(--atlas-foreground); }
.chart-readout ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 10px; max-height: 92px; overflow: auto; margin: 7px 0 0; padding-left: 16px; }
.timeline-empty { margin: 30px 4px; color: var(--atlas-muted); font-size: 11px; }
.graph-stage.timeline-mode .graph-svg,
.graph-stage.timeline-mode .graph-controls,
.graph-stage.timeline-mode .canvas-help,
.graph-stage.timeline-mode .empty-state { display: none; }
@media (max-width: 560px) {
  .timeline-surface { inset: 43px 0 0; padding: 0 12px 45px; }
  .timeline-intro { align-items: flex-start; flex-direction: column; gap: 3px; padding-top: 2px; }
  .timeline-note { font-size: 9px; }
  .timeline-rail { gap: 24px; padding-right: 7px; padding-left: 5px; }
  .timeline-stage { flex-basis: min(280px, 82vw); width: min(280px, 82vw); }
}
.timeline-connection-list { display: grid; gap: 4px; margin: 1px 0 0; padding: 0; list-style: none; }
.timeline-connection { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; min-width: 0; padding: 5px 7px; border: 1px solid var(--atlas-border); border-radius: 10px; color: var(--atlas-muted); font-size: 8px; line-height: 1.35; }
.timeline-direction { flex: 0 0 auto; color: var(--atlas-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.timeline-neighbor { max-width: 100%; overflow-wrap: anywhere; padding: 0; border: 0; color: var(--atlas-foreground); background: transparent; font-size: 8px; font-weight: 620; text-align: left; }
.timeline-neighbor:hover { color: var(--atlas-foreground); text-decoration: underline; text-decoration-color: var(--atlas-accent); }
.timeline-relation { color: var(--atlas-muted); }
.timeline-connection-more { color: var(--atlas-muted); font-size: 8px; }
#graph defs linearGradient[id^="edge-beam-gradient-"] stop { stop-color: var(--graph-accent, var(--atlas-accent)); }
#graph .node-card .card-arrival,
#graph .node-card .agent-beam { stroke: var(--graph-accent, var(--atlas-accent)) !important; }
.type-dot { background: var(--atlas-muted) !important; }
.filter-chip.spotlight-active .type-dot { background: var(--atlas-accent) !important; }
.node-card .card-accent { fill: var(--atlas-border); }
.node-card.selected .card-accent,
.node-card:focus .card-accent { fill: var(--atlas-accent); }
.chart-unit { flex: 0 0 auto; padding: 2px 6px; border: 1px solid var(--atlas-border); border-radius: 999px; color: var(--atlas-muted); font-size: 8px; }

/* Owner-selected reference cards have no side stripe; color belongs to focus and chart marks. */
.node-card .card-accent { display: none !important; }

/* The card header uses a small connected-component glyph instead of a colored stripe. */
.node-card .card-icon-bg { fill: var(--atlas-graph-canvas); stroke: var(--atlas-border); }
.node-card .card-icon-glyph { fill: none; stroke: var(--atlas-muted); stroke-width: .8; stroke-linecap: round; stroke-linejoin: round; }
.node-card .card-icon-node { fill: var(--atlas-muted); }
.node-card .card-chart-title { fill: var(--atlas-muted); font-size: 8px; font-weight: 620; }
.node-card .card-chart-svg { overflow: visible; }
.node-card .card-chart-baseline { fill: none; stroke: var(--atlas-border); stroke-width: .8; }
.node-card .card-chart-area { fill: var(--atlas-accent); fill-opacity: .19; }
.node-card .card-chart-line { fill: none; stroke: var(--atlas-accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.node-card .card-chart-marker { fill: var(--atlas-card); stroke: var(--atlas-accent); stroke-width: 1.3; }
.node-card .card-chart-marker:hover,
.node-card .card-chart-marker:focus { fill: var(--atlas-accent); outline: none; }
.node-card .card-chart-evidence { fill: var(--atlas-muted); font-size: 7px; }
.graph-view-tabs { position: absolute; top: 9px; right: 12px; z-index: 6; display: flex; gap: 3px; padding: 3px; border: 1px solid var(--atlas-border); border-radius: 999px; background: var(--atlas-card); }
.graph-view-tabs button { min-width: 54px; padding: 5px 10px; border: 0; border-radius: 999px; color: var(--atlas-muted); background: transparent; font-size: 9px; font-weight: 650; }
.graph-view-tabs button[aria-pressed="true"] { color: var(--atlas-accent-ink); background: var(--atlas-accent); }
.graph-view-tabs button:focus-visible { outline: 2px solid var(--atlas-accent); outline-offset: 2px; }
.timeline-host { position: absolute; inset: 0; z-index: 2; }
.timeline-host[hidden] { display: none; }
.sidebar-example { display: flex; align-items: center; gap: 8px; margin: 4px 12px 7px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--atlas-accent), transparent 60%); border-radius: 999px; color: #f0f2e8; background: color-mix(in srgb, var(--atlas-accent), transparent 90%); font-size: 10px; text-align: left; }
.sidebar-example:hover { border-color: var(--atlas-accent); background: color-mix(in srgb, var(--atlas-accent), transparent 84%); }
.example-mark { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--atlas-accent-ink); background: var(--atlas-accent); }
.timeline-node-card { transition: opacity .3s ease, border-color .2s ease; }
.timeline-node-card.focus-dimmed { opacity: .25; }
.timeline-node-title { font-size: 14px; }
.timeline-node-description { font-size: 11px; }
.timeline-node-type { font-size: 9px; }
.timeline-connection { font-size: 10px; }
.timeline-direction { font-size: 8px; }
.timeline-neighbor,
.timeline-relation { font-size: 10px; }
.timeline-connection-more { font-size: 9px; }
.chart-title { font-size: 10px; }
.chart-readout { font-size: 9px; }
@media (max-width: 820px) {
  .graph-view-tabs { top: 8px; right: 8px; }
  .canvas-caption { max-width: calc(100% - 170px); }
}

@media (min-width: 821px) and (max-width: 1320px) {
  .toolbar { min-height: 76px; flex-wrap: wrap; align-content: center; row-gap: 4px; }
  .toolbar .search-field { order: 0; flex: 0 0 190px; width: 190px; }
  .toolbar .toolbar-divider,
  .toolbar .toolbar-spacer { display: none; }
  .toolbar .toolbar-button { order: 1; }
  .toolbar .filter-group { order: 2; flex: 0 0 100%; flex-wrap: wrap; overflow: visible; }
}
.timeline-node-heading { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.timeline-node-icon { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; border: 1px solid var(--atlas-border); border-radius: 50%; color: var(--atlas-muted); background: var(--atlas-graph-canvas); }
.timeline-node-icon svg { width: 14px; height: 14px; overflow: visible; }
.timeline-node-icon path { fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.timeline-node-icon circle { fill: var(--atlas-card); stroke: currentColor; stroke-width: .9; }

/* Dialog dismissal bypasses validation; its close icon matches both palettes. */
.modal .modal-close { flex: 0 0 32px; width: 32px; min-width: 32px; height: 32px; padding: 0; border: 1px solid var(--atlas-border); border-radius: 50%; color: var(--atlas-muted); background: transparent; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
.modal .modal-close svg { display: block; pointer-events: none; }
.modal .modal-close:hover { border-color: var(--atlas-muted); color: var(--atlas-foreground); background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 7%); }
.modal .modal-close:focus-visible { color: var(--atlas-foreground); outline: 2px solid var(--atlas-accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .modal .modal-close { transition: none; } }


/* Meaningful charts, evidence details, and complete inspector relationships. */
.chart-bar,
.card-chart-bar { fill: var(--atlas-accent); }
.chart-context { margin: 0; color: var(--atlas-muted); font-size: 8px; line-height: 1.4; overflow-wrap: anywhere; }
.card-chart-context { fill: var(--atlas-muted); font-size: 6.5px; }
.detail-list { display: grid; gap: 5px; margin: 0; padding-left: 17px; color: var(--atlas-muted); font-size: 10px; line-height: 1.5; }
.detail-list li { padding-left: 2px; overflow-wrap: anywhere; }
.node-detail-section { margin-top: 15px; }
.connection-list { display: grid; gap: 8px; }
.connection-item { display: grid; gap: 5px; min-width: 0; padding: 9px 10px; border: 1px solid var(--atlas-border); border-radius: 13px; color: var(--atlas-muted); }
.connection-item-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: start; gap: 8px; min-width: 0; }
.connection-arrow { color: var(--atlas-muted); font-size: 8px; font-weight: 750; letter-spacing: .45px; text-transform: uppercase; }
.connection-item .connection-name { min-width: 0; padding: 0; border: 0; color: var(--atlas-foreground); background: transparent; font-size: 11px; font-weight: 650; line-height: 1.4; text-align: left; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.connection-item .connection-name:hover { color: var(--atlas-accent); }
.connection-item .connection-label { width: fit-content; max-width: 100%; margin-left: 64px; padding: 0; border: 0; color: var(--atlas-muted); background: transparent; font-size: 10px; line-height: 1.45; text-align: left; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.connection-item .connection-label:hover { color: var(--atlas-foreground); text-decoration: underline; text-decoration-color: var(--atlas-accent); }
.connection-kind { margin-left: 64px; color: var(--atlas-muted); font-size: 8px; }
.optional-details { margin-top: 16px; border-top: 1px solid var(--atlas-border); border-bottom: 1px solid var(--atlas-border); }
.optional-details summary { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 1px; color: var(--atlas-foreground); font-size: 10px; font-weight: 650; cursor: pointer; }
.optional-details summary span { color: var(--atlas-muted); font-size: 8px; font-weight: 400; }
.details-form-grid { margin: 8px 0 15px; }
.details-form-grid textarea { min-height: 68px; }
@media (max-width: 560px) {
  .connection-item-head { grid-template-columns: 52px minmax(0, 1fr); }
  .connection-item .connection-label,
  .connection-kind { margin-left: 60px; }
  .chart-context { font-size: 8px; }
}

.node-card .card-chart-category { fill: var(--atlas-muted); font-size: 6px; font-weight: 560; }

/* Native SVG group outlines are rectangular in Chromium; use graph geometry for focus. */
.node-card:focus,
.edge-group:focus { outline: none; }
.node-card:focus-visible,
.edge-group:focus-visible { opacity: 1 !important; }
.node-card:focus-visible .card-bg {
  stroke: var(--atlas-accent);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}
.edge-group:focus-visible .edge-path {
  stroke: var(--atlas-accent);
  stroke-width: 2.5;
}
.edge-group:focus-visible .edge-label-bg {
  stroke: var(--atlas-accent);
  stroke-width: 1.5;
}
.edge-group:focus-visible .edge-path { opacity: 1; }


/* A stable, keyboard-operable divider keeps the graph and inspector readable. */
.graph-workspace { gap: 0; grid-template-columns: minmax(0, 1fr) 8px minmax(320px, var(--inspector-width, 360px)); }
.inspector-resize { position: relative; z-index: 2; display: grid; place-items: center; min-width: 8px; cursor: col-resize; touch-action: none; user-select: none; }
.inspector-resize::before { width: 2px; height: 58px; border-radius: 999px; background: var(--atlas-border); content: ""; transition: width .12s ease, background-color .12s ease; }
.inspector-resize:hover::before,
.inspector-resize:focus-visible::before { width: 4px; background: var(--atlas-accent); }
.inspector-resize:focus-visible { border-radius: 6px; outline: 2px solid var(--atlas-accent); outline-offset: -2px; }
.inspector-head-actions { display: flex; align-items: center; gap: 4px; }
.inspector-head-actions .icon-button { flex: 0 0 30px; }
.share-modal-foot > div { display: flex; gap: 8px; }
.share-named-fallback { width: 100%; min-height: 58px; margin-top: 12px; padding: 9px 10px; border: 1px solid var(--atlas-border); border-radius: 10px; background: var(--atlas-canvas); color: var(--atlas-foreground); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; line-height: 1.5; resize: vertical; }
@media (max-width: 820px) {
  .graph-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(390px, 1fr) auto; gap: 10px 0; }
  .inspector-resize,
  #expand-inspector { display: none; }
  .inspector { width: 100%; max-height: min(65vh, 520px); }
}


/* Direct Map editing keeps gesture previews transient and context actions local. */
.graph-context-menu { position: absolute; z-index: 15; display: grid; min-width: 190px; max-width: min(270px, calc(100% - 12px)); gap: 2px; padding: 5px; border: 1px solid var(--atlas-border); border-radius: 12px; background: var(--atlas-card); box-shadow: 0 10px 28px rgb(0 0 0 / .24); }
.graph-context-menu[hidden],
.graph-context-menu [hidden] { display: none; }
.graph-context-menu button { width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; color: var(--atlas-foreground); background: transparent; font-size: 10px; text-align: left; }
.graph-context-menu button:hover,
.graph-context-menu button:focus-visible { color: var(--atlas-accent-ink); background: var(--atlas-accent); outline: none; }
.graph-context-menu button[data-graph-action="delete-edge"] { color: var(--atlas-danger, #b96c5d); }
.graph-context-menu button[data-graph-action="delete-node"] { color: var(--atlas-danger, #b96c5d); }
#graph .edge-hit-target { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
#graph .edge-group { cursor: pointer; }
#graph .edge-group.selected .edge-path { stroke: var(--atlas-accent); stroke-width: 2.2; opacity: 1; }
#graph .edge-group.selected .edge-label-bg { stroke: var(--atlas-accent); stroke-width: 1.5; }
#graph .card-port.port-output { cursor: crosshair; touch-action: none; }
#graph .card-port.port-input { pointer-events: all; }
#graph .card-port.port-output:hover,
#graph .card-port.port-input.port-drop-target { fill: var(--atlas-accent); stroke: var(--atlas-accent); }
#graph .node-card.port-drop-target .card-bg { stroke: var(--atlas-accent); stroke-width: 1.8; }
#graph .connection-preview { fill: none; stroke: var(--atlas-muted); stroke-width: 1.8; stroke-dasharray: 6 4; stroke-linecap: round; pointer-events: none; opacity: .85; }
#graph .connection-preview.valid-target { stroke: var(--atlas-accent); stroke-width: 2.2; }
#graph .connection-preview[hidden] { display: none; }
#graph.is-connecting { cursor: crosshair; }
.branch-connection-summary { margin: 0 0 13px; padding: 9px 11px; border: 1px solid var(--atlas-border); border-radius: 10px; color: var(--atlas-muted); font-size: 10px; overflow-wrap: anywhere; }

/* Prevent native text selection only inside the interactive SVG map. */
#graph,
#graph * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Keep the desktop map fixed to the available viewport; long details scroll inside Inspector. */
@media (min-width: 821px) {
  .app-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  .main-area {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  .topbar,
  .page-heading,
  .toolbar,
  .statusbar { flex-shrink: 0; }
  .graph-workspace {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }
  .graph-stage,
  .inspector {
    height: 100%;
    min-height: 0;
  }
  .inspector-content {
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .inspector-body { min-height: 0; }
}

/* Keep Inspector controls circular, visible, and palette-aware on hover/focus. */
.inspector-head-actions .icon-button {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 1px solid var(--atlas-border);
  border-radius: 50%;
  color: var(--atlas-muted);
  background: var(--atlas-card);
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.inspector-head-actions .icon-button:hover {
  border-color: var(--atlas-muted);
  color: var(--atlas-foreground);
  background: color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 8%);
}
.inspector-head-actions .icon-button:focus-visible {
  border-color: var(--atlas-accent);
  color: var(--atlas-foreground);
  background: var(--atlas-card);
  outline: 2px solid var(--atlas-accent);
  outline-offset: 2px;
}
.inspector-head-actions .icon-button svg {
  display: block;
  width: 14px;
  height: 14px;
  overflow: visible;
  pointer-events: none;
}
.inspector-head-actions .icon-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#expand-inspector .restore-glyph { display: none; }
#expand-inspector[aria-expanded="true"] .expand-glyph { display: none; }
#expand-inspector[aria-expanded="true"] .restore-glyph { display: block; }
@media (prefers-reduced-motion: reduce) {
  .inspector-head-actions .icon-button { transition: none; }
}
/* Keep workspace backup guidance readable inside the fixed charcoal sidebar in both themes. */
.sidebar .workspace-guidance {
  color: #f0f2e8;
  border-color: #ffffff24;
}
.sidebar .workspace-guidance > summary {
  color: #f0f2e8;
  border-radius: 8px;
}
.sidebar .workspace-guidance > summary span { color: #b0b5a9; }
.sidebar .workspace-guidance > summary:hover {
  color: #fff;
  background: #ffffff0c;
}
.sidebar .workspace-guidance > summary:focus-visible {
  color: #fff;
  background: #ffffff08;
  outline: 2px solid var(--atlas-accent);
  outline-offset: 2px;
}
.sidebar .workspace-guidance .field-hint {
  color: #c4c8be;
  line-height: 1.5;
}
.sidebar .workspace-guidance a:link,
.sidebar .workspace-guidance a:visited {
  color: var(--atlas-accent);
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
}
.sidebar .workspace-guidance a:hover {
  color: #fff;
}
.sidebar .workspace-guidance a:focus-visible {
  color: #fff;
  outline: 2px solid var(--atlas-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Shared, local line icons for actions with labels or accessible names. */
.ui-icon { display: inline-block; flex: 0 0 auto; width: 14px; height: 14px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; pointer-events: none; }
.icon-button .ui-icon { width: 14px; height: 14px; }
.import-glyph .ui-icon { display: block; width: 16px; height: 16px; }
.button-caret.ui-icon { width: 12px; height: 12px; margin-left: 3px; opacity: .72; }
.graph-controls .ui-icon { width: 14px; height: 14px; }
.file-icon .ui-icon { width: 18px; height: 18px; }
.inspector-empty-icon .ui-icon { width: 17px; height: 17px; }
.inspector-actions .delete-action { display: grid; place-items: center; }
.inspector-actions .delete-action .ui-icon { width: 14px; height: 14px; }
.cta-icon { width: 14px; height: 14px; }
.example-mark.ui-icon { display: block; width: 16px; height: 16px; }
#add-edge { display: inline-flex; align-items: center; gap: 5px; }
/* Progress stays inside the existing button, preserving its original dimensions. */
.is-action-pending{position:relative;cursor:progress!important;opacity:1!important}
.action-original{display:inline-flex;align-items:center;gap:inherit;visibility:hidden}
.action-progress{position:absolute;inset:0 6px;display:flex;align-items:center;justify-content:center;gap:6px;pointer-events:none;animation:action-appear .12s ease-out}
.action-progress>span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.action-spinner{display:inline-block;flex:0 0 12px;width:12px;height:12px;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:action-spin .8s linear infinite}
#save-status[aria-busy="true"]::before{content:"";display:inline-block;width:10px;height:10px;margin-right:6px;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;vertical-align:-2px;animation:action-spin .8s linear infinite}
.toast-region[popover]{inset:auto auto 43px 50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);height:auto;margin:0;padding:0;border:0;background:transparent;overflow:visible;pointer-events:none}
.toast-region[popover]:not(:popover-open){display:none}
.toast-region::backdrop{background:transparent;pointer-events:none}
.map-settings-actions{min-height:34px;align-items:flex-start;align-content:start}
@media(min-width:561px) and (max-width:700px){.map-settings-actions{min-height:76px}}
@keyframes action-spin{to{transform:rotate(360deg)}}
@keyframes action-appear{from{opacity:0}to{opacity:1}}
html[data-action-page-hidden="true"] .action-spinner,html[data-action-page-hidden="true"] #save-status[aria-busy="true"]::before{animation-play-state:paused}
@media(max-width:560px){.map-settings-actions{min-height:252px}.toast-region[popover]{bottom:18px}}
@media(prefers-reduced-motion:reduce){.action-spinner,.action-progress,#save-status[aria-busy="true"]::before{animation:none}.toast{animation:none}}

.action-progress.is-compact>span:last-child{display:none}
#account-status[aria-busy="true"]::before,#cloud-workspace-state[aria-busy="true"]::before{content:"";display:inline-block;width:10px;height:10px;margin-right:6px;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;vertical-align:-2px;animation:action-spin .8s linear infinite}
html[data-action-page-hidden="true"] #account-status[aria-busy="true"]::before,html[data-action-page-hidden="true"] #cloud-workspace-state[aria-busy="true"]::before{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){#account-status[aria-busy="true"]::before,#cloud-workspace-state[aria-busy="true"]::before{animation:none}}

/* Edit history shares the existing toolbar palette and keeps fixed button sizes. */
.edit-history-controls { display: inline-flex; flex: 0 0 auto; gap: 2px; align-items: center; }
.edit-history-controls .history-button { width: 31px; height: 31px; padding: 6px; justify-content: center; }
.history-button:disabled { opacity: .4; cursor: default; }
@media (max-width: 820px) { .toolbar .edit-history-controls { order: 1; } }
/* Fast clipboard actions keep their label; slower copies reveal progress in place. */
.is-progress-delayed .action-original { visibility:visible; }
.is-progress-delayed .action-progress { opacity:0; animation:none; }
/* The narrow-screen sidebar is a dismissible drawer with themed navigation controls. */
.sidebar-brand-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 40px; }
.sidebar-brand-row .brand-lockup { margin:0 0 0 7px; }
.sidebar-close, .sidebar-backdrop { display:none; }
#mobile-menu { position:relative; width:32px; height:32px; min-width:32px; flex:0 0 32px; padding:0; border:1px solid color-mix(in srgb,var(--atlas-border),transparent 40%); border-radius:8px; color:var(--atlas-foreground); background:transparent; transition:background .16s, border-color .16s; }
/* Invisible padding preserves a comfortable touch target around the compact icon. */
#mobile-menu::before { content:""; position:absolute; inset:-6px; border-radius:10px; }
#mobile-menu:hover { color:var(--atlas-foreground); border-color:var(--atlas-muted); background:color-mix(in srgb, var(--atlas-card), var(--atlas-foreground) 5%); }
#mobile-menu .ui-icon { display:block; width:18px; height:18px; }
@media(max-width:820px) {
  html { scrollbar-gutter:stable; }
  html.sidebar-drawer-open, html.sidebar-drawer-open body { overflow:hidden; }
  .sidebar { z-index:80; width:min(280px,calc(100vw - 56px)); max-height:100vh; max-height:100dvh; overflow-y:auto; overscroll-behavior:contain; visibility:hidden; transition:transform .2s ease, visibility 0s linear .2s; }
  .sidebar.open { visibility:visible; transition:transform .2s ease, visibility 0s; }
  .sidebar-brand-row { flex-shrink:0; margin-bottom:28px; }
  .sidebar-close { display:inline-grid; width:44px; height:44px; min-width:44px; flex:0 0 44px; padding:0; border-color:#ffffff26; border-radius:50%; }
  .sidebar-close .ui-icon { width:18px; height:18px; }
  .sidebar-backdrop { display:block; position:fixed; z-index:70; inset:0; visibility:hidden; opacity:0; pointer-events:none; background:#0005; touch-action:none; transition:opacity .2s ease, visibility 0s linear .2s; }
  .sidebar-backdrop.is-visible { visibility:visible; opacity:1; pointer-events:auto; transition:opacity .2s ease, visibility 0s; }
  html.sidebar-drawer-open .local-map-tip { z-index:85; }
}
@media(prefers-reduced-motion:reduce) { #mobile-menu, .sidebar, .sidebar.open, .sidebar-backdrop, .sidebar-backdrop.is-visible { transition:none; } }
