/* A small visual vocabulary, shared by the Coven and the project map. */
body.atlas-enhanced #plan:not(.far) .atlas-overview,
body.atlas-enhanced #plan.far .atlas-project-detail {
  display: none;
}

body.atlas-enhanced #plan .wall.base {
  display: inline;
  stroke: #6b6478;
  stroke-width: 1;
  stroke-opacity: 1;
  vector-effect: non-scaling-stroke;
}
body.atlas-enhanced #plan .gfloor {
  fill: #1d1c24;
  fill-opacity: .25;
  stroke: none;
}
body.atlas-enhanced #plan.far .ghostfort { opacity: 1; }
body.atlas-enhanced #plan.far .ghostfort.dormant .wall.base { stroke-dasharray: 2 4; }
body.atlas-enhanced #plan.far .ghostfort:hover .wall.base,
body.atlas-enhanced #plan.far .ghostfort:focus-visible .wall.base {
  stroke: var(--primary);
  stroke-opacity: 1;
}
body.atlas-enhanced #plan .gname {
  fill: #d8d4e1;
  font-size: calc(14px * var(--u, 1) * var(--fs, 1));
  font-weight: 500;
}
body.atlas-enhanced #plan .gsub {
  fill: #928c9f;
  font-size: calc(10.5px * var(--u, 1) * var(--fs, 1));
}
body.atlas-enhanced #plan .gname,
body.atlas-enhanced #plan .gsub { stroke-width: calc(3px * var(--u, 1)); }

/* Connections mean coordination. Familiar color is introduced only by a filter. */
body.atlas-enhanced #plan .road {
  stroke: #726d80;
  stroke-width: 1.2;
  stroke-opacity: .34;
  stroke-dasharray: none;
}
body.atlas-enhanced #plan .road.dormant { stroke-dasharray: 2 7; stroke-opacity: .24; }
body.atlas-enhanced #plan .road.off { opacity: .82; }
body.atlas-enhanced #plan .lane {
  stroke-width: 1.8;
  stroke-opacity: .85;
  vector-effect: non-scaling-stroke;
}
/* A white square at a boundary is a pending human decision, never a completed action. */
body.atlas-enhanced #plan .atlas-decision { cursor: pointer; }
body.atlas-enhanced #plan .atlas-decision rect:not(.atlas-map-hit) {
  fill: #23212a;
  stroke: var(--attention);
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}
body.atlas-enhanced #plan .atlas-decision text {
  fill: var(--attention);
  font-family: var(--f-body);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
body.atlas-enhanced #plan .atlas-decision:hover rect:not(.atlas-map-hit),
body.atlas-enhanced #plan .atlas-decision:focus-visible rect:not(.atlas-map-hit) { fill: #3b354c; stroke-width: 1.8; }

/* The glyph and outline both carry the familiar's identity. */
body.atlas-enhanced #plan .seat > .sig { display: inline; pointer-events: none; }
body.atlas-enhanced #plan .atlas-glyph-hit { fill: transparent; stroke: none; pointer-events: all; }
body.atlas-enhanced #plan .familiar-disc {
  fill: #1b1b22;
  stroke: var(--hue);
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
}
body.atlas-enhanced #plan .seat:is(:hover, :focus-visible, .sel) .familiar-disc {
  fill: color-mix(in srgb, var(--hue) 18%, #19191f);
  stroke-width: 2;
}
body.atlas-enhanced #plan .atlas-local-psyche { cursor: pointer; }
body.atlas-enhanced #plan .atlas-squad > .task-l {
  fill: #e6e3ec;
  font-size: calc(12px * var(--u, 1) * var(--fs, 1));
  font-weight: 500;
}

body.atlas-enhanced #plan.compact-familiars .atlas-squad > .task-l { opacity: 0; }
body.atlas-enhanced #plan.compact-familiars .atlas-squad:has(.seat:is(:hover, :focus-visible, .sel)) > .task-l { opacity: 1; }
body.atlas-enhanced #plan .atlas-mission-group.dim { opacity: .84; }
body.atlas-enhanced #plan .atlas-squad.dim { opacity: .68; }
body.atlas-enhanced #plan .colink { display: none; }
body.atlas-enhanced #plan.atlas-selected .colink:not(.dim) { display: inline; opacity: .4; }

/* Dots are agents. Selection controls their visibility in applySel(). */
body.atlas-enhanced #plan .agent .core { filter: none; }
body.atlas-enhanced #plan .agent .hot { pointer-events: all; }
body.atlas-enhanced #plan .agent.idle .o { fill: #151418; stroke-opacity: .7; }
body.atlas-enhanced #plan .agent.work .o { animation: none; }
body.atlas-enhanced #plan .cell-ghost { stroke-opacity: .35; }
body.atlas-enhanced #plan .pk { filter: none; }

/* One shared opacity keeps overlapping coordination corridors equally quiet. */
body.atlas-enhanced #plan .atlas-roads { opacity: 1; }
body.atlas-enhanced #plan .atlas-lanes { opacity: .85; }
body.atlas-enhanced #plan .road,
body.atlas-enhanced #plan .lane {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-opacity: 1;
  vector-effect: non-scaling-stroke;
}
body.atlas-enhanced #plan .road.dormant { stroke-opacity: 1; }

/* A Project preview shares the rings and familiar colors of the open map. */
.project-preview { pointer-events: none; }
.preview-links line { stroke: #ad98cf; stroke-width: 7; }
.preview-hub { fill: #a899cc; stroke: #393144; stroke-width: 5; }
.preview-compact-ring { fill: color-mix(in srgb, var(--hue) 52%, #302c38); stroke: var(--hue); stroke-width: 12; }
.preview-group { fill: #2b2830; stroke: #423c4b; stroke-width: 2; }
.preview-member { fill: #211f27; stroke: var(--hue); stroke-width: 6; stroke-linecap: round; }
.preview-task { fill: var(--hue); }
.preview-mission .se-status { stroke-width: 3; }
.preview-mission .se-track, .preview-mission .se-progress { stroke-width: 8; }
.preview-overflow circle { fill: #292631; stroke: #8f839f; stroke-width: 3; }
.preview-overflow text, .preview-empty {
  fill: #cfc8d9;
  text-anchor: middle;
  font: 500 27px var(--f-body);
}
.preview-empty { fill: #c4bccb; font-size: 48px; }
.preview-empty-mark { display: none; stroke: #aca6b6; stroke-width: 13; stroke-linecap: round; }
.ghostfort:is([data-preview-size="mini"], [data-preview-size="map"]) .preview-empty-mark { display: inline; }
.ghostfort:is([data-preview-size="mini"], [data-preview-size="map"]) .preview-empty { display: none; }
.preview-name { display: none; fill: #eeeaf2; text-anchor: middle; font: 500 4.333px var(--f-body); }
.ghostfort[data-preview-names="true"] .preview-name { display: inline; }
.ghostfort:not([data-preview-size="detail"]) :is(.preview-task, .preview-group) { display: none; }
.ghostfort[data-preview-size="mini"] .preview-members { display: none; }
.ghostfort[data-preview-size="number"] .project-preview { display: none; }
.ghostfort:not([data-preview-size="number"]) .atlas-aggregate { display: none; }
.ghostfort[data-density="tiny"]:not(:hover, :focus-visible) .atlas-aggregate { display: inline; }
.ghostfort[data-density="tiny"][data-preview-size="number"] .atlas-aggregate { display: inline; }

/* Overview detail follows available pixels; counts and drill-down remain exact. */
body.atlas-enhanced #plan .atlas-aggregate {
  fill: #b9b0cf;
  font-family: var(--f-body);
  font-size: 110px;
  font-weight: 500;
  text-anchor: middle;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
body.atlas-enhanced #plan .ghostfort[data-density="tiny"] .gsub { display: none; }
body.atlas-enhanced #plan .ghostfort[data-density="tiny"] .gname { visibility: hidden; }
body.atlas-enhanced #plan .ghostfort[data-density="tiny"]:hover .gname,
body.atlas-enhanced #plan .ghostfort[data-density="tiny"]:focus-visible .gname { visibility: visible; }

@media (prefers-contrast: more) {
  body.atlas-enhanced #plan .wall.base { stroke-opacity: .9; }
  body.atlas-enhanced #plan .gsub { fill: #c0b9ce; }
  body.atlas-enhanced #plan .road { stroke-opacity: .6; }
}

/* The same flat circular mark is used at every scale. */
.se-face { fill: #393541; }
.se-track, .se-progress { fill: none; stroke-width: 5; }
.se-track { stroke: #36333f; }
.se-share { fill: none; stroke: color-mix(in srgb, var(--hue) 52%, #302c38); }
.se-progress { stroke: var(--hue); }
.se-status, .se-status-inner, .se-selection, .se-limit { fill: none; stroke-width: 1.6; }
.se-status { stroke: #847687; }
.seal.st-planned .se-status { stroke-dasharray: 3 3; }
.seal.st-active .se-status { stroke: #9e8cb6; }
.seal.st-stalled .se-status { stroke: #bc8976; stroke-dasharray: 7 2; }
.seal.st-broken .se-status { stroke: var(--warn); stroke-dasharray: 2 3 7 3; }
.se-status-inner, .se-selection, .se-limit { display: none; }
.seal2 .se-status, .seal2 .se-limit { stroke-width: 2.5; }
.seal.st-needsYou .se-status, .seal.st-needsYou .se-status-inner { stroke: var(--attention); }
.seal.st-sealed .se-status, .seal.st-sealed .se-status-inner { stroke: #a4c6ac; }
.seal.st-sealed .se-status-inner { stroke-dasharray: 1 3; }
.seal.st-needsYou .se-status-inner, .seal.st-sealed .se-status-inner { display: inline; stroke-width: 1; }
.seal.warn .se-limit { display: inline; stroke: var(--warn); }
.se-selection { stroke: #ba9de8; stroke-width: 2.4; }
.lead-node.sel .se-selection, .lead-node:hover .se-selection, .lead-node:focus-visible .se-selection { display: inline; }
.lead-node:focus-visible .se-selection { stroke: #fff; }
.mission-face { transform: scale(var(--mission-size, 1)); }
body.atlas-enhanced #plan .mission-face .lead-name { font: 500 4.333px var(--f-body); text-anchor: middle; stroke: none; fill: #d3cfdb; pointer-events: none; }
body.atlas-enhanced #plan .lead-node:is(:focus-visible, :hover, .sel) .mission-face .lead-name { fill: #f5f3f8; }
body.atlas-enhanced #plan .atlas-compact-seal .lead-name { visibility: hidden; }
body.atlas-enhanced #plan .atlas-compact-seal .lead-node:is(:hover, .sel) .lead-name,
body.atlas-enhanced #plan .atlas-compact-seal .lead-node:focus-visible .lead-name { visibility: visible; }
body.atlas-enhanced #plan .atlas-compact-seal .lead-node:is(:hover, .sel, :focus-visible) .mission-face { transform: scale(var(--mission-reveal)); }

body.atlas-enhanced #plan .atlas-map-hit { fill: transparent; stroke: none; pointer-events: all; }
body.atlas-enhanced #plan .atlas-mission-state {
  display: none;
  fill: #ccc8d6;
  stroke: var(--card);
  stroke-width: calc(3px * var(--u, 1));
  paint-order: stroke;
  text-anchor: middle;
  font: 500 calc(10.5px * var(--u, 1)) var(--f-body);
  pointer-events: none;
}
body.atlas-enhanced #plan .atlas-mission-current .atlas-mission-state { display: inline; }
body.atlas-enhanced #plan:not(.atlas-agent-detail) .agent,
body.atlas-enhanced #plan:not(.atlas-agent-detail) .cell-ghost { display: none; }
body.atlas-enhanced #plan .agent.idle .o { stroke-opacity: 1; }
body.atlas-enhanced #plan .agent.gate .o { stroke-width: 1.4; }
body.atlas-enhanced .plate.ask-note {
  color: var(--foreground);
  background: #23222b;
  border: 1px solid #797487;
  box-shadow: 0 6px 16px #0006;
  min-height: 44px;
  z-index: 3;
}
body.atlas-enhanced .plate.ask-note::before { display: none; }
body.atlas-enhanced .plate.ask-note:hover,
body.atlas-enhanced .plate.ask-note:focus-visible { border-color: var(--attention); box-shadow: 0 6px 16px #0006; }
body.atlas-enhanced .plate.ask-note:focus-visible { outline: 2px solid var(--attention); outline-offset: 2px; }
body.atlas-enhanced .atlas-request-leader { pointer-events: none; }
body.atlas-enhanced .atlas-request-leader line { stroke: var(--attention); stroke-opacity: .8; stroke-width: 1.15; }

body.atlas-enhanced.atlas-adaptive-mobile #notes > .ask-note { display: grid; }
body.atlas-enhanced.atlas-adaptive-mobile #notes > .atlas-request-leader { display: block; }

body.atlas-enhanced #plan .atlas-compact-decision { pointer-events: none; }
body.atlas-enhanced #plan .atlas-compact-decision .atlas-map-hit,
body.atlas-enhanced #plan .atlas-compact-decision text { display: none; }



/* Both scopes use the same circular Psyche badge. */
body.atlas-enhanced #plan .coord-face {
  fill: #22212a;
  stroke: #9790a8;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
body.atlas-enhanced #plan .coord-name { letter-spacing: 0; fill: #f1edf6; font-family: var(--f-body); font-weight: 500; }
body.atlas-enhanced #plan :is(.hub, .atlas-local-psyche):is(:hover, :focus-visible) .coord-face { stroke: var(--primary); }

body.atlas-enhanced #plan .atlas-mission-lines .thread,
body.atlas-enhanced #plan .atlas-squad-lines .link {
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-opacity: .85;
  vector-effect: non-scaling-stroke;
}
body.atlas-enhanced #plan .atlas-mission-lines .thread { stroke: #a18bbf; stroke-dasharray: none; }
body.atlas-enhanced #plan .atlas-squad-lines .link { stroke: var(--hue); }
@media (prefers-reduced-motion: no-preference) {
  body.atlas-enhanced #plan.map-running .atlas-mission-lines.working:not(.dim) .out,
  body.atlas-enhanced #plan.map-running .atlas-squad-lines.working:not(.dim) .task-flow {
    display: inline; stroke: color-mix(in srgb, var(--hue, var(--primary)) 45%, white);
    stroke-width: 2; stroke-dasharray: 3 12; vector-effect: non-scaling-stroke; animation: flow 2s linear infinite;
  }
}
#keyModal .modal-card { width: min(420px, 100%); }
#keyModal .hd-t { flex: 1; }
.key-reader { padding: 10px 18px 14px; overflow-y: auto; overscroll-behavior: contain; }
.key-reader > .kz-r { align-items: center; padding: 8px 0; }
.key-reader .kz-m svg { height: 18px; }
.key-topic { border-top: 1px solid var(--border); }
.key-topic:first-of-type { margin-top: 12px; }
.key-topic summary { cursor: pointer; padding: 12px 2px; min-height: 44px; font-weight: 500; }
.key-topic > div { padding-bottom: 12px; }
.key-topic .kz-fams { margin: 0 0 10px; padding: 0; border: 0; }

.key-context { margin: 2px 0 8px; color: var(--muted-foreground); font-size: .85em; }


body.atlas-enhanced #plan .agent-mark .o { stroke-width: .16; }
body.atlas-enhanced #plan .agent-task { fill: var(--card); }
body.atlas-enhanced #plan .agent:not(.assigned) .agent-task { display: none; }
body.atlas-enhanced #plan .agent.idle .agent-task { fill: var(--hue); }
body.atlas-enhanced #plan .agent.gate .agent-task { fill: var(--attention); }
body.atlas-enhanced #plan .agent.co .agent-task { fill: var(--hue2); }

/* A shared capsule groups each mission’s recorded tasks at rest and during replay. */
.mission-tasks { cursor: pointer; }
.task-tray-hit { fill: transparent; pointer-events: all; }
.task-tray-bg { fill: #282631; stroke: #585464; stroke-width: 1; }
.task-cog { fill: var(--hue); }
.task-caption { fill: #c6c1cf; font: 500 9px var(--f-body); }
.task-overflow { fill: #dfdbe6; font: 500 9px var(--f-body); text-anchor: end; }
.mission-tasks:is(:hover, :focus-visible) .task-tray-bg { stroke: var(--attention); stroke-width: 1.6; }

.seal-reference { display: none; fill: #fff; stroke: #27242d; stroke-width: 2.5; paint-order: stroke; text-anchor: middle; font: 500 13px var(--f-body); }
.atlas-compact-seal .lead-node:not(:hover, :focus-visible, .sel) .seal-reference { display: inline; }
