/* Coven Compass — compact chrome around the existing semantic scene. */
body.atlas-enhanced {
  --background: #0b0b0e;
  --card: #141417;
  --card-raised: #1c1c21;
  --popover: rgba(24, 24, 29, .97);
  --foreground: #edecf2;
  --muted-foreground: #aaa9b6;
  --subtle: #92909f;
  --border: rgba(210, 205, 230, .095);
  --border-strong: rgba(210, 205, 230, .18);
  --radius: 8px;
  background: #0b0b0e;
  overflow-x: hidden;
}
html:has(body.atlas-enhanced) { padding: 0; }
body.atlas-enhanced .sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
body.atlas-enhanced .mobile-form-body { display: contents; }
body.atlas-enhanced .mobile-form-body > .nm-sec:first-child { border-top: 0; }
body.atlas-enhanced.atlas-missions-modal,
body.atlas-enhanced.atlas-inspect-modal,
body.atlas-enhanced.atlas-mobile-overlay { overflow: hidden; overscroll-behavior: none; }
body.atlas-enhanced .app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: var(--app-height, 100dvh);
  min-height: min(600px, var(--app-height, 100dvh));
  max-width: 1900px;
  gap: 0;
  padding: 12px 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
body.atlas-enhanced .main { flex: 1; min-height: 0; gap: 14px; }
body.atlas-enhanced .left { gap: 10px; }
body.atlas-enhanced .plan { border-color: rgba(210, 205, 230, .11); box-shadow: none; }
body.atlas-enhanced .plan-body { min-height: 0; isolation: isolate; container-type: inline-size; container-name: atlas-body; }
body.atlas-enhanced .plan-head { min-height: 49px; padding: 8px 10px; background: #131316; }
body.atlas-enhanced .stage {
  isolation: isolate;
  container-type: inline-size;
  container-name: atlas-stage;
  background-color: #15151a;
  background-image: linear-gradient(to right, rgba(192, 186, 212, .028) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(192, 186, 212, .028) 1px, transparent 1px);
  background-size: 36px 36px;
}
body.atlas-enhanced[data-atlas-scope="coven"] .plan-head,
body.atlas-enhanced[data-atlas-scope="coven"] .timeline,
body.atlas-enhanced[data-atlas-scope="coven"] .leads,
body.atlas-enhanced #atlasFocus,
body.atlas-enhanced #atlasSceneNote { display: none; }
body.atlas-enhanced .plan-head #wardCtl,
body.atlas-enhanced .plan-head .ctl:has(> #traceBox),
body.atlas-enhanced .plan-head .ctl:has(> #lock) { opacity: .65; box-shadow: none; background: transparent; }
body.atlas-enhanced .plan-head #wardCtl:hover,
body.atlas-enhanced .plan-head #wardCtl:focus-within,
body.atlas-enhanced .plan-head .ctl:has(> #traceBox):hover,
body.atlas-enhanced .plan-head .ctl:has(> #traceBox):focus-within,
body.atlas-enhanced .plan-head .ctl:has(> #lock):hover,
body.atlas-enhanced .plan-head .ctl:has(> #lock):focus-within { opacity: 1; }
body.atlas-enhanced .timeline { padding: 8px 12px; background: #131316; }
body.atlas-enhanced .leads { gap: 9px; scroll-snap-type: x proximity; padding: 2px 2px 4px; }
body.atlas-enhanced .lead-card { min-height: 82px; padding: 11px 13px; scroll-snap-align: start; background: #151518; }
body.atlas-enhanced .lead-card[aria-pressed="true"] { border-color: var(--primary); background: #1b1922; box-shadow: inset 0 0 0 1px rgba(179, 170, 235, .08); }
body.atlas-enhanced .lead-card .who { font-size: 13px; }
body.atlas-enhanced .lead-card .n { font-size: 12px; }

/* All map chrome is overlaid: opening the browser never changes scene width. */
body.atlas-enhanced .atlas-header {
  --atlas-header-target: 36px;
  position: absolute;
  z-index: 10;
  top: 14px;
  inset-inline: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand scope actions";
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 5px 7px 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #19181e;
  box-shadow: none;
}
body.atlas-enhanced .atlas-brand { grid-area: brand; display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--foreground); }
body.atlas-enhanced .atlas-brand > svg { flex: none; width: 23px; height: 23px; color: var(--primary); fill: currentColor; }
body.atlas-enhanced .atlas-brand > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; line-height: 1.15; font-weight: 650; white-space: nowrap; letter-spacing: -.025em; }
body.atlas-enhanced .atlas-nav { grid-area: scope; justify-self: start; display: flex; gap: 2px; min-width: 0; max-width: 100%; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: #121217; }
body.atlas-enhanced .atlas-actions { grid-area: actions; display: flex; justify-content: flex-end; gap: 4px; }
body.atlas-enhanced .atlas-header :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--atlas-header-target);
  min-height: var(--atlas-header-target);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #222128;
  color: #d0cdd9;
  font-size: 13px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  touch-action: manipulation;
}
body.atlas-enhanced .atlas-header .atlas-nav button { display: block; min-width: 64px; text-align: center; border-color: transparent; background: transparent; }
body.atlas-enhanced #atlasOverview { flex: none; }
body.atlas-enhanced #atlasProject { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
body.atlas-enhanced .atlas-header .atlas-actions svg { width: 16px; height: 16px; flex: none; color: #b8b0cd; }
body.atlas-enhanced .atlas-header :is(button, a):hover { border-color: var(--border-strong); background: #2b2933; color: var(--foreground); }
body.atlas-enhanced .atlas-header :is(button, a):active { border-color: rgba(179, 170, 235, .38); background: #342e42; color: #f4edff; box-shadow: none; }
body.atlas-enhanced .atlas-header :is(button, a):focus-visible { outline: 2px solid var(--primary-hi); outline-offset: 2px; }
body.atlas-enhanced .atlas-header button:is([aria-pressed="true"], [aria-expanded="true"]),
body.atlas-enhanced:has(#covenSealLab[open]) #atlasLab { border-color: rgba(179, 170, 235, .32); background: #322a43; color: #eee5ff; }
body.atlas-enhanced .atlas-header button:is([aria-pressed="true"], [aria-expanded="true"]):hover { border-color: rgba(179, 170, 235, .48); background: #3b3250; }
body.atlas-enhanced .atlas-header button[aria-expanded="true"] svg { color: var(--primary-hi); }

body.atlas-enhanced .atlas-project-search { display: grid; gap: 6px; margin: 6px 4px; color: #b9b2c6; font-size: 11px; }
body.atlas-enhanced .atlas-project-search input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #494252; border-radius: 7px; outline-offset: 3px; background: #100f14; color: #e5dfed; font: inherit; font-size: 14px; }
body.atlas-enhanced .atlas-project-count { margin: 4px 6px; color: #9e97ac; font-size: 11px; }
body.atlas-enhanced .atlas-project[hidden] { display: none; }
body.atlas-enhanced .atlas-layout-simulation { padding: 11px 7px; border-top: 1px solid #302b37; margin-top: 5px; color: #b8b0c6; font-size: 11px; }
body.atlas-enhanced .atlas-layout-simulation summary { cursor: pointer; padding: 4px 0; }
body.atlas-enhanced .atlas-layout-simulation p { color: #a39aaf; line-height: 1.5; margin: 9px 0; }
body.atlas-enhanced .atlas-layout-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 8px 0; }
body.atlas-enhanced .atlas-layout-presets button { min-height: 44px; padding: 0 4px; }
body.atlas-enhanced .atlas-layout-custom { display: grid; grid-template-columns: 1fr auto; gap: 5px; margin: 8px 0; }
body.atlas-enhanced .atlas-layout-custom label { grid-column: 1 / -1; }
body.atlas-enhanced .atlas-layout-custom input { min-width: 0; min-height: 44px; padding-inline: 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card); color: var(--foreground); }
body.atlas-enhanced #atlasLayoutStatus:empty { display: none; }
body.atlas-enhanced #atlasResetLayout { width: 100%; min-height: 40px; font-size: 10px; }
body.atlas-enhanced #atlasNewProject { width: 100%; min-height: 44px; margin-top: 8px; }
body.atlas-enhanced .atlas-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 7px; background: rgba(21, 21, 26, .9); color: var(--muted-foreground); font-size: 11px; font-weight: 500; white-space: nowrap; text-decoration: none; }
body.atlas-enhanced .atlas-handoff-link { display: flex; min-height: 44px; margin-top: 8px; white-space: normal; text-align: center; }
body.atlas-enhanced .atlas-button:hover { border-color: rgba(179, 170, 235, .3); background: rgba(31, 28, 39, .94); color: var(--foreground); }
body.atlas-enhanced .atlas-button svg { width: 17px; height: 17px; flex: none; }
body.atlas-enhanced .atlas-sidebar {
  position: absolute;
  z-index: 14;
  top: 76px;
  left: 16px;
  width: min(320px, calc(100% - 32px));
  max-height: calc(100% - 136px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid rgba(210, 205, 230, .19);
  border-radius: 10px;
  background: rgba(23, 23, 28, .98);
  box-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: #3b3748 transparent;
  overscroll-behavior: contain;
}
body.atlas-enhanced .atlas-sidebar[hidden] { display: none; }
body.atlas-enhanced .atlas-drawer-heading { position: sticky; top: -8px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 8px 9px; background: #17171c; }
body.atlas-enhanced .atlas-drawer-heading h2 { margin: 0; color: var(--foreground); font-size: 14px; font-weight: 500; }
body.atlas-enhanced #atlasBrowseClose { min-width: 32px; min-height: 32px; padding: 0; border-color: transparent; background: transparent; color: var(--subtle); font-size: 20px; font-weight: 400; }
body.atlas-enhanced #atlasProjects { display: flex; flex: none; flex-direction: column; gap: 4px; }
body.atlas-enhanced .atlas-project { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; align-items: center; gap: 4px 9px; width: 100%; min-width: 0; min-height: 62px; padding: 10px; border: 1px solid transparent; border-radius: 7px; color: var(--foreground); text-align: left; transition: border-color .15s, background-color .15s; }
body.atlas-enhanced .atlas-project:hover { border-color: var(--border); background: rgba(255, 255, 255, .025); }
body.atlas-enhanced .atlas-project[data-active="true"] { border-color: rgba(179, 170, 235, .24); background: rgba(179, 170, 235, .06); box-shadow: inset 2px 0 0 var(--primary); }
body.atlas-enhanced .atlas-project-icon { grid-column: 1; grid-row: 1 / 3; display: grid; place-items: center; width: 27px; height: 31px; color: #a59cbf; }
body.atlas-enhanced .atlas-project-icon svg { display: block; width: 24px; height: 24px; }
body.atlas-enhanced .atlas-project-copy { display: contents; }
body.atlas-enhanced .atlas-project-copy b { grid-column: 2; grid-row: 1; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 500; line-height: 1.25; white-space: nowrap; }
body.atlas-enhanced .atlas-project-copy span { grid-column: 2 / -1; grid-row: 2; overflow: hidden; text-overflow: ellipsis; color: var(--subtle); font-size: 10px; line-height: 1.3; white-space: nowrap; }
body.atlas-enhanced .atlas-project-state { grid-column: 3; grid-row: 1; color: var(--attention); font-size: 10px; text-align: right; line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.atlas-enhanced .atlas-project-state[data-state="active"],
body.atlas-enhanced .atlas-project-state[data-state="dormant"] { color: var(--subtle); }
body.atlas-enhanced #atlasLegend { flex: none; margin-top: 4px; border-color: transparent; background: transparent; justify-content: flex-start; color: #a49ab8; }

/* Find a mission without losing the map or the last place in the list. */
body.atlas-enhanced .atlas-mission-browser {
  position: absolute;
  z-index: 14;
  top: 76px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100% - 32px));
  max-height: calc(100% - 80px);
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #17171c;
  box-shadow: none;
  pointer-events: auto;
}
body.atlas-enhanced .atlas-mission-browser[hidden] { display: none; }
body.atlas-enhanced .atlas-mission-browser .atlas-drawer-heading { position: static; flex: none; padding: 0 0 0 4px; }
body.atlas-enhanced .atlas-mission-browser .atlas-drawer-heading button { min-width: 34px; min-height: 34px; padding: 0; border-color: transparent; background: transparent; font-size: 20px; }
body.atlas-enhanced .atlas-mission-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; flex: none; min-width: 0; }
body.atlas-enhanced .atlas-mission-tools label { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--muted-foreground); font-size: 10px; line-height: 1.4; }
body.atlas-enhanced .atlas-mission-tools label:has(#atlasMissionSearch) { grid-column: 1 / -1; }
body.atlas-enhanced .atlas-mission-tools input,
body.atlas-enhanced .atlas-mission-tools select { width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: #101013; color: var(--foreground); font: inherit; font-size: 12px; line-height: 1.4; }
body.atlas-enhanced .atlas-mission-tools input::placeholder { color: var(--subtle); }
body.atlas-enhanced .atlas-mission-tools input:focus-visible,
body.atlas-enhanced .atlas-mission-tools select:focus-visible { outline-offset: 1px; }
body.atlas-enhanced #atlasMissionCount { flex: none; margin: 0; padding: 0 4px; color: var(--subtle); font-size: 11px; line-height: 1.5; font-variant-numeric: tabular-nums; }
body.atlas-enhanced #atlasMissionList { display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #4a425b transparent; padding: 3px; scroll-padding-block: 6px; }
body.atlas-enhanced .atlas-mission-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 4px 10px; flex: none; width: 100%; min-width: 0; min-height: 88px; padding: 11px 10px; border: 1px solid transparent; border-radius: 7px; background: #1a191f; color: var(--foreground); text-align: left; }
body.atlas-enhanced .atlas-mission-row:hover { border-color: var(--border-strong); background: #211f28; }
body.atlas-enhanced .atlas-mission-row[aria-current="true"] { border-color: rgba(179, 170, 235, .4); background: #24212e; box-shadow: inset 2px 0 0 var(--primary); }
body.atlas-enhanced .atlas-mission-row .atlas-mission-seal { grid-column: 1; grid-row: 1 / 4; display: grid; place-items: center; }
body.atlas-enhanced .atlas-mission-seal svg { display: block; width: 30px; height: 30px; }
body.atlas-enhanced .atlas-mission-copy { display: flex; flex-direction: column; gap: 4px; grid-column: 2; grid-row: 1 / 4; min-width: 0; }
body.atlas-enhanced .atlas-mission-meta,
body.atlas-enhanced .atlas-mission-stats { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
body.atlas-enhanced .mission-word { display: inline-block; max-width: 100%; text-overflow: clip; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; white-space: nowrap; word-break: normal; hyphens: none; vertical-align: bottom; }
.lc-also button, .rowlink > span:has(.mission-word), .tname em:has(.mission-word), .cf-r .rf:has(.mission-word) { min-width: 0; max-width: 100%; }
[data-agent-field="mission"] { min-width: 0; white-space: normal; }
body.atlas-enhanced .atlas-mission-title { min-width: 0; font-size: 13px; font-weight: 500; line-height: 1.35; }
body.atlas-enhanced .atlas-mission-meta { color: var(--muted-foreground); font-size: 11px; line-height: 1.4; }
body.atlas-enhanced .atlas-mission-stats { color: var(--subtle); font-size: 10px; line-height: 1.5; font-variant-numeric: tabular-nums; }
body.atlas-enhanced .atlas-mission-row[data-state="needsYou"] .atlas-mission-meta { color: #ded8ed; }
body.atlas-enhanced #atlasMissionReset { align-self: flex-start; flex: none; min-height: 34px; padding: 5px 8px; border: 1px solid transparent; border-radius: 5px; color: #c7bee4; font-size: 11px; }
body.atlas-enhanced #atlasMissionReset:hover { border-color: var(--border-strong); background: #211f28; }
body.atlas-enhanced .atlas-mission-empty { margin: 0; padding: 20px 10px; color: var(--muted-foreground); font-size: 12px; line-height: 1.65; }

/* A visible copy of an invalid-link announcement (#45): below the header, under the drawers (z 14) and phone sheets.
   It reuses the drawer surface and the attention accent; it is not a live region (#atlasNavigationStatus is). */
body.atlas-enhanced .atlas-notice {
  position: absolute;
  z-index: 12;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(460px, calc(100% - 32px));
  padding: 4px 4px 4px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #17171c;
  box-shadow: inset 2px 0 0 var(--attention), 0 18px 44px -10px rgba(0, 0, 0, .65);
  animation: atlas-notice-in .18s ease-out;
}
body.atlas-enhanced .atlas-notice[hidden] { display: none; }
body.atlas-enhanced .atlas-notice p { margin: 0; color: var(--foreground); font-size: 12px; line-height: 1.45; }
body.atlas-enhanced #atlasNavigationNoticeDismiss { flex: none; min-width: 36px; min-height: 36px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--subtle); font-size: 20px; font-weight: 400; }
body.atlas-enhanced #atlasNavigationNoticeDismiss:hover { border-color: var(--border); background: #2b2933; color: var(--foreground); }
body.atlas-enhanced #atlasNavigationNoticeDismiss:focus-visible { outline: 2px solid var(--primary-hi); outline-offset: 1px; }
@keyframes atlas-notice-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { body.atlas-enhanced .atlas-notice { animation: none; } }

/* A single identity key. Numeric detail lives in each chip's title and label. */
body.atlas-enhanced #atlasFamiliars {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 4px;
  overflow-x: auto;
  border: 1px solid rgba(210, 205, 230, .1);
  border-radius: 10px;
  background: rgba(17, 17, 21, .92);
  scrollbar-width: thin;
  scrollbar-color: #3b3748 transparent;
  overscroll-behavior: contain;
}
body.atlas-enhanced .atlas-familiar { display: flex; flex: none; align-items: center; gap: 6px; min-height: 35px; padding: 5px 10px; border: 1px solid transparent; border-radius: 6px; color: #a9a2b4; font-size: 11px; text-align: left; white-space: nowrap; }
body.atlas-enhanced .atlas-familiar:hover { color: var(--foreground); background: rgba(255, 255, 255, .035); }
body.atlas-enhanced .atlas-familiar[aria-pressed="true"] { border-color: color-mix(in srgb, var(--hue, var(--primary)) 40%, transparent); background: color-mix(in srgb, var(--hue, var(--primary)) 8%, transparent); color: var(--hue, var(--foreground)); }
body.atlas-enhanced .atlas-familiar-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; color: var(--hue, var(--primary)); }
body.atlas-enhanced .atlas-familiar-mark .avatar { width: 21px; height: 21px; }
body.atlas-enhanced .atlas-familiar-name { max-width: 13ch; overflow: hidden; text-overflow: ellipsis; }
body.atlas-enhanced .atlas-camera-dock { display: none; }

body.atlas-enhanced #plan.far .ghostfort { opacity: .9; }
body.atlas-enhanced #plan.far .ghostfort:hover { opacity: 1; }
body.atlas-enhanced #plan.far .ghostfort.dormant { opacity: .57; }
body.atlas-enhanced #plan .gname { fill: #e4e0ef; font-weight: 500; }
body.atlas-enhanced #plan .gsub { fill: #aaa5b8; }
body.atlas-enhanced #plan .gneed { fill: var(--attention); }
body.atlas-enhanced #plan .hub-l { letter-spacing: calc(3px * var(--u, 1)); }
body.atlas-enhanced #plan .lane { stroke-opacity: .68; }
body.atlas-enhanced #plan .lane.off { opacity: .14; }
body.atlas-enhanced .thread.ask { stroke: var(--attention); stroke-dasharray: 4 4; }
body.atlas-enhanced .hud { top: 76px; }
body.atlas-enhanced .manifest { top: 76px; bottom: 72px; scrollbar-width: thin; scrollbar-color: #4a425b transparent; scroll-padding-block: 8px; overscroll-behavior: contain; padding: 2px 4px 4px 0; }
body.atlas-enhanced .manifest::-webkit-scrollbar { display: block; width: 5px; }
body.atlas-enhanced .manifest::-webkit-scrollbar-thumb { background: #4a425b; border-radius: 5px; }
body.atlas-enhanced .inspect { top: 76px; width: min(350px, 100%); gap: 14px; padding: 16px; background: rgba(23, 23, 28, .98); border-color: var(--border-strong); overscroll-behavior: contain; scrollbar-color: #4a425b transparent; scroll-padding-block: 16px; }
body.atlas-enhanced .inspect .who { min-width: 0; }
body.atlas-enhanced .inspect .mission-title { margin: 0; font-family: var(--f-body); font-size: 16px; font-weight: 500; line-height: 1.3; letter-spacing: -.01em; }
body.atlas-enhanced .inspect .i-head { align-items: flex-start; }
body.atlas-enhanced .inspect .i-head .btn { flex: none; }
body.atlas-enhanced .mission-context { margin: 0; color: var(--subtle); font-size: 11px; line-height: 1.5; }
body.atlas-enhanced .mission-return,
body.atlas-enhanced .mission-stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
body.atlas-enhanced .mission-return { flex-wrap: wrap; }
body.atlas-enhanced .mission-return button,
body.atlas-enhanced .mission-stepper button { min-height: 34px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: #1d1b23; color: #d2cae4; font-size: 11px; line-height: 1.35; }
body.atlas-enhanced .mission-return button:hover,
body.atlas-enhanced .mission-stepper button:hover { border-color: rgba(179, 170, 235, .35); background: #272230; }
body.atlas-enhanced .mission-stepper { border-top: 1px solid var(--border); padding-top: 12px; }
body.atlas-enhanced .mission-stepper > span,
body.atlas-enhanced .mission-stepper > small { color: var(--subtle); font-size: 10px; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
body.atlas-enhanced .mission-stepper button:disabled { opacity: .38; cursor: default; }
body.atlas-enhanced .inspect .i-view { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-self: stretch; flex: none; }
body.atlas-enhanced .inspect .i-view button { min-width: 0; min-height: 36px; padding: 5px 4px; font-size: 12px; }
body.atlas-enhanced .inspect .i-view button[aria-selected="true"] { border-color: rgba(179, 170, 235, .3); background: #2c2637; color: #e7e0f5; box-shadow: none; }
body.atlas-enhanced .inspect [role="tabpanel"] { min-width: 0; }
body.atlas-enhanced .inspect [role="tabpanel"]:focus-visible { outline-offset: 5px; }
body.atlas-enhanced .empty { top: 76px; max-height: calc(100% - 152px); }
body.atlas-enhanced :focus-visible { outline: 2px solid #c7bff4; outline-offset: 3px; }

/* Narrow desktop stages make room for the scope controls on a second row. */
@container atlas-stage (max-width: 960px) {
  body.atlas-enhanced .atlas-header { gap: 8px; }
  body.atlas-enhanced .atlas-header :is(button, a) { padding-inline: 8px; }
}
@container atlas-body (max-width: 760px) {
  body.atlas-enhanced .inspect { top: 116px; }
}
@container atlas-stage (max-width: 760px) {
  body.atlas-enhanced .atlas-header { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand actions" "scope actions"; gap: 6px 8px; top: 12px; inset-inline: 12px; }
  body.atlas-enhanced #atlasHandoff { display: none; }
  body.atlas-enhanced .atlas-sidebar { top: 116px; left: 12px; width: min(320px, calc(100% - 24px)); max-height: calc(100% - 184px); }
  body.atlas-enhanced .atlas-mission-browser { top: 116px; left: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 130px); }
  body.atlas-enhanced .hud,
  body.atlas-enhanced .manifest,
  body.atlas-enhanced .empty { top: 116px; }
}
@container atlas-stage (max-width: 480px) {
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .atlas-actions .atlas-button { width: var(--atlas-header-target); padding: 0; }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .atlas-actions .atlas-button > span { display: none; }
  body.atlas-enhanced .atlas-familiar { padding-inline: 5px; font-size: 10px; gap: 5px; }
  body.atlas-enhanced #atlasFamiliars { left: 12px; transform: none; max-width: calc(100% - 88px); flex-wrap: wrap; gap: 2px; overflow-x: visible; }
}

/* Touch traversal keeps the same map modes within reach on tablets and phones. */
@media (max-width: 1100px), (pointer: coarse) {
  body.atlas-enhanced .atlas-header { --atlas-header-target: 44px; }
  body.atlas-enhanced #atlasHandoff { display: none; }
  body.atlas-enhanced .atlas-button,
  body.atlas-enhanced .atlas-familiar,
  body.atlas-enhanced .btn,
  body.atlas-enhanced .arow,
  body.atlas-enhanced .p-tab,
  body.atlas-enhanced .rowlink,
  body.atlas-enhanced .plate-h { min-height: 44px; }
  body.atlas-enhanced .btn.icon,
  body.atlas-enhanced .btn.x,
  body.atlas-enhanced .x { min-width: 44px; width: 44px; height: 44px; }
  body.atlas-enhanced .inspect button.dot { min-width: 44px; width: 44px; min-height: 44px; height: 44px; }
  body.atlas-enhanced .atlas-camera-dock { position: absolute; z-index: 9; right: 14px; bottom: 76px; display: grid; grid-template-columns: repeat(4, max-content); gap: 3px; max-width: calc(100% - 28px); padding: 5px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #4a425b transparent; border: 1px solid rgba(210, 205, 230, .2); border-radius: 10px; background: rgba(21, 20, 26, .97); box-shadow: 0 8px 24px -12px #000, inset 0 1px 0 rgba(255, 255, 255, .035); touch-action: pan-x; }
  body.atlas-enhanced .atlas-camera-dock button { display: inline-flex; align-items: center; justify-content: center; grid-row: 1; min-width: 44px; min-height: 44px; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; color: var(--muted-foreground); font-size: 11px; font-weight: 500; white-space: nowrap; touch-action: manipulation; }
  body.atlas-enhanced .atlas-camera-dock button[aria-pressed="true"] { border-color: rgba(179, 170, 235, .28); background: #2a2435; color: #e0d6f2; }
  body.atlas-enhanced .atlas-camera-dock button:disabled { opacity: .4; }
  body.atlas-enhanced #atlasZoomOut,
  body.atlas-enhanced #atlasZoomIn { font-size: 20px; font-weight: 400; }
  body.atlas-enhanced #atlasZoomIn { margin-right: 3px; }
  body.atlas-enhanced .inspect .i-view button { min-height: 44px; }
}

@media (max-width: 1100px), (pointer: coarse) {
  body.atlas-enhanced { min-height: var(--app-height, 100dvh); height: auto; overflow-y: auto; }
  body.atlas-enhanced .app { height: auto; min-height: var(--app-height, 100dvh); padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  body.atlas-enhanced .main,
  body.atlas-enhanced .app.docked .main { display: flex; flex-direction: column; min-height: 0; }
  body.atlas-enhanced .plan { flex: none; overflow: hidden; }
  body.atlas-enhanced .plan-body { display: flex; flex-direction: column; }
  body.atlas-enhanced .plan-head { gap: 6px; padding: 6px; }
  body.atlas-enhanced .view { margin-left: 0; width: 100%; min-width: 0; flex-wrap: nowrap; gap: 5px; padding-bottom: 3px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #4a425b transparent; }
  body.atlas-enhanced .view > .ctl { flex: none; }
  body.atlas-enhanced:has(#atlasCameraDock) .view > .ctl[aria-label="Camera"],
  body.atlas-enhanced:has(#atlasCameraDock) .view > .ctl[aria-label="Zoom"] { display: none; }
  body.atlas-enhanced .stage { flex: none; aspect-ratio: auto; width: 100%; height: clamp(360px, calc(var(--app-height, 100dvh) - 264px), 760px); min-height: 360px; }
  body.atlas-enhanced[data-atlas-scope="coven"] .stage { height: calc(var(--app-height, 100dvh) - max(8px, env(safe-area-inset-top, 0px)) - max(8px, env(safe-area-inset-bottom, 0px)) - 2px); min-height: 280px; }
  body.atlas-enhanced .stage.composing { height: clamp(360px, calc(var(--app-height, 100dvh) - 264px), 760px); }
  body.atlas-enhanced #atlasBrowseClose,
  body.atlas-enhanced .atlas-mission-browser .atlas-drawer-heading button { min-height: 44px; min-width: 44px; }
  body.atlas-enhanced #atlasSidebar { position: fixed; z-index: 60; top: auto; right: auto; bottom: calc(var(--keyboard-inset, 0px) + max(10px, env(safe-area-inset-bottom, 0px))); transform: translateX(-50%); width: min(480px, calc(var(--viewport-width, 100vw) - max(10px, env(safe-area-inset-left, 0px)) - max(10px, env(safe-area-inset-right, 0px)))); max-height: calc(var(--app-height, 100dvh) - max(10px, env(safe-area-inset-top, 0px)) - max(10px, env(safe-area-inset-bottom, 0px))); padding: 10px; border-radius: 14px; background: #17171c; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 62px 16px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), 0 18px 44px -10px rgba(0, 0, 0, .65); }
  /* Portalled sheets use the visual viewport, including the on-screen keyboard. */
  body.atlas-enhanced .atlas-mission-browser { position: fixed; z-index: 60; top: auto; left: 50%; right: auto; bottom: calc(var(--keyboard-inset, 0px) + max(10px, env(safe-area-inset-bottom, 0px))); transform: translateX(-50%); width: min(600px, calc(var(--viewport-width, 100vw) - max(10px, env(safe-area-inset-left, 0px)) - max(10px, env(safe-area-inset-right, 0px)))); height: calc(var(--app-height, 100dvh) - max(10px, env(safe-area-inset-top, 0px)) - max(10px, env(safe-area-inset-bottom, 0px))); max-height: 880px; margin: 0; padding: 14px; gap: 10px; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .48), 0 18px 44px -10px rgba(0, 0, 0, .65); }
  body.atlas-enhanced .atlas-mission-browser #atlasMissionList { flex: 1; }
  body.atlas-enhanced .atlas-mission-browser { container-type: size; container-name: mission-sheet; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 66px 16px; }
  body.atlas-enhanced .atlas-mission-browser .atlas-drawer-heading { position: sticky; top: -14px; z-index: 3; background: #17171c; box-shadow: 0 6px 0 #17171c; }
  body.atlas-enhanced .atlas-mission-tools input,
  body.atlas-enhanced .atlas-mission-tools select { min-height: 44px; font-size: 16px; }
  body.atlas-enhanced .atlas-mission-tools label { font-size: 11px; }
  body.atlas-enhanced #atlasMissionReset { min-height: 44px; }
  body.atlas-enhanced #atlasFamiliars { left: 10px; bottom: 10px; max-width: calc(100% - 80px); transform: none; flex-wrap: nowrap; gap: 2px; padding: 3px; overflow-x: auto; scrollbar-width: thin; }
  body.atlas-enhanced .atlas-camera-dock { left: 10px; right: auto; bottom: 72px; width: calc(100% - 20px); max-width: 480px; }
  body.atlas-enhanced .hud { top: 128px; left: 10px; width: min(320px, calc(100% - 20px)); }
  body.atlas-enhanced .manifest { top: 128px; bottom: 158px; }
  body.atlas-enhanced .inspect { position: fixed; z-index: 50; top: auto; left: 50%; right: auto; bottom: calc(var(--keyboard-inset, 0px) + max(10px, env(safe-area-inset-bottom, 0px))); transform: translateX(-50%); width: min(760px, calc(var(--viewport-width, 100vw) - max(10px, env(safe-area-inset-left, 0px)) - max(10px, env(safe-area-inset-right, 0px)))); max-height: min(780px, calc(var(--app-height, 100dvh) - max(10px, env(safe-area-inset-top, 0px)) - max(10px, env(safe-area-inset-bottom, 0px)))); padding: 14px 16px 18px; border: 1px solid var(--border-strong); border-radius: 14px; overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), 0 18px 44px -10px rgba(0, 0, 0, .65); }
  body.atlas-enhanced .inspect .i-view button,
  body.atlas-enhanced .mission-return button,
  body.atlas-enhanced .mission-stepper button { min-height: 44px; }
  body.atlas-enhanced .inspect .i-view { position: sticky; top: 56px; z-index: 3; background: #17171c; box-shadow: 0 5px 0 #17171c; }
  body.atlas-enhanced .inspect .i-head { position: sticky; top: -14px; z-index: 4; flex: none; min-height: 70px; height: 70px; margin: -1px -4px 0; padding: 5px 4px; background: #17171c; box-shadow: 0 5px 0 #17171c; }
  body.atlas-enhanced .inspect .i-head .who { align-self: center; }
  body.atlas-enhanced .inspect .mission-title { display: block; white-space: normal; }
  body.atlas-enhanced .inspect .i-head .role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.atlas-enhanced .inspect { scroll-padding-block: 130px 20px; }
  body.atlas-enhanced .inspect .i-agent { position: static; margin-top: 0; }
  body.atlas-enhanced .leads { padding: 2px 66px 6px 2px; gap: 8px; scroll-snap-type: x mandatory; }
  body.atlas-enhanced .lead-card { flex: 0 0 min(280px, 79vw); min-height: 82px; }
  body.atlas-enhanced .timeline { gap: 6px; padding: 4px 8px; flex-wrap: nowrap; }
  body.atlas-enhanced .scrub { flex: 1; flex-basis: auto; order: 0; min-width: 36px; height: 44px; }
  body.atlas-enhanced .clock { font-size: 10px; }
  body.atlas-enhanced .timeline #speed { min-width: 44px; min-height: 44px; font-size: 11px; }
  body.atlas-enhanced .psyche { position: fixed; z-index: 40; top: auto; left: 50%; right: auto; bottom: calc(var(--keyboard-inset, 0px) + max(10px, env(safe-area-inset-bottom, 0px))); transform: translateX(-50%); width: min(620px, calc(var(--viewport-width, 100vw) - max(10px, env(safe-area-inset-left, 0px)) - max(10px, env(safe-area-inset-right, 0px)))); height: min(760px, calc(var(--app-height, 100dvh) - max(10px, env(safe-area-inset-top, 0px)) - max(10px, env(safe-area-inset-bottom, 0px)))); max-height: none; background: #17171c; border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), 0 12px 50px #000; }
  body.atlas-enhanced .psyche .stream,
  body.atlas-enhanced .psyche .notif,
  body.atlas-enhanced .psyche .cast-pane { min-height: 0; overscroll-behavior: contain; scroll-padding-block: 16px; }
  body.atlas-enhanced .p-tabs { flex: none; min-height: 50px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  body.atlas-enhanced .p-tab { flex: none; }
  body.atlas-enhanced .comp { flex: none; padding: 10px; }
  body.atlas-enhanced .comp .field > .route { min-height: 52px; padding: 3px 6px 3px 10px; gap: 5px 6px; }
  body.atlas-enhanced .comp .field > .route .rt-b { flex: none; min-width: 44px; min-height: 44px; padding: 0 10px; }
  body.atlas-enhanced .comp .field > .route .rt-c:has(.rt-x) { position: relative; display: block; min-height: 44px; padding-right: 47px; line-height: 42px; text-overflow: ellipsis; white-space: nowrap; }
  body.atlas-enhanced .comp .field > .route .rt-c:has(.rt-x) > i { display: inline-block; margin-right: 5px; vertical-align: middle; }
  body.atlas-enhanced .comp .rt-x { position: absolute; top: 0; right: 0; flex: none; width: 44px; min-width: 44px; height: 44px; margin: 0; border-radius: 8px; background: #211e29; }
  body.atlas-enhanced .comp .field > .say-w { flex: 1 1 0; min-width: 0; }
  body.atlas-enhanced .comp .sug-key { flex: none; min-width: 44px; min-height: 44px; }
  body.atlas-enhanced .msg .m-acts { position: static; inset: auto; z-index: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 7px 0 0; padding: 0; border: 0; background: none; box-shadow: none; opacity: 1; pointer-events: auto; transform: none; }
  body.atlas-enhanced .msg .m-act { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted-foreground); background: rgba(255, 255, 255, .025); }
  body.atlas-enhanced .msg .m-act svg { width: 15px; height: 15px; }
  body.atlas-enhanced .msg .m-act[aria-pressed="true"],
  body.atlas-enhanced .msg .m-act.done { border-color: rgba(179, 170, 235, .3); color: var(--primary); background: #272230; }
  body.atlas-enhanced .field input,
  body.atlas-enhanced .nm-f input.mono,
  body.atlas-enhanced input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  body.atlas-enhanced textarea,
  body.atlas-enhanced select { min-height: 44px; font-size: 16px; }
  body.atlas-enhanced #empty,
  body.atlas-enhanced #projectForm { position: fixed; z-index: 55; top: auto; left: 50%; right: auto; bottom: calc(var(--keyboard-inset, 0px) + max(10px, env(safe-area-inset-bottom, 0px))); transform: translateX(-50%); width: min(600px, calc(var(--viewport-width, 100vw) - max(10px, env(safe-area-inset-left, 0px)) - max(10px, env(safe-area-inset-right, 0px)))); max-height: calc(var(--app-height, 100dvh) - max(10px, env(safe-area-inset-top, 0px)) - max(10px, env(safe-area-inset-bottom, 0px))); border: 1px solid var(--border-strong); border-radius: 14px; overflow-y: auto; overscroll-behavior: contain; background: #17171c; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), 0 18px 44px -10px rgba(0, 0, 0, .65); -webkit-user-select: text; user-select: text; scroll-padding-block: 66px 90px; }
  body.atlas-enhanced .empty .hd,
  body.atlas-enhanced .empty .em-act { flex: none; }
  body.atlas-enhanced #empty,
  body.atlas-enhanced #projectForm { overflow: hidden; }
  body.atlas-enhanced .mobile-form-body { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 16px; }
  body.atlas-enhanced #empty > .hd,
  body.atlas-enhanced #projectForm > .hd,
  body.atlas-enhanced #empty > .em-act,
  body.atlas-enhanced #projectForm > .em-act { position: relative; top: auto; bottom: auto; }
  body.atlas-enhanced .empty .em-act { flex-wrap: wrap; }
  body.atlas-enhanced .empty .em-act .nm-foot { flex-basis: 100%; }
  body.atlas-enhanced .empty .dr > summary { min-height: 44px; }
  body.atlas-enhanced .empty .rf { min-width: 44px; min-height: 44px; padding-block: 10px; text-align: left; }
  body.atlas-enhanced .empty .tgs { gap: 6px; }
  body.atlas-enhanced .empty .tg { min-width: 44px; min-height: 44px; max-width: 100%; padding: 7px 10px; white-space: normal; overflow-wrap: anywhere; }
  body.atlas-enhanced .empty .stp { min-width: 0; grid-template-columns: minmax(0, 1fr) 44px minmax(48px, 62px) 44px; gap: 6px; }
  body.atlas-enhanced .empty .stp > span { min-width: 0; overflow-wrap: anywhere; }
  body.atlas-enhanced .empty .stp button { min-width: 44px; min-height: 44px; height: 44px; }
  body.atlas-enhanced .empty .tp-save { flex-wrap: wrap; }
  body.atlas-enhanced .empty .tp-save input { flex: 1 1 140px; }
  body.atlas-enhanced .empty .tp-save button { flex: 0 0 auto; min-height: 44px; }
  body.atlas-enhanced #atlasSidebar,
  body.atlas-enhanced #atlasMissionBrowser,
  body.atlas-enhanced #inspect,
  body.atlas-enhanced .psyche,
  body.atlas-enhanced #empty,
  body.atlas-enhanced #projectForm { left: calc(var(--viewport-left, 0px) + var(--viewport-width, 100vw) / 2); }
  body.atlas-enhanced .grip,
  body.atlas-enhanced .grip-t,
  body.atlas-enhanced .grip-c { display: none; }
  body.atlas-enhanced .launcher { right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(var(--keyboard-inset, 0px) + max(12px, env(safe-area-inset-bottom, 0px))); width: 52px; height: 52px; border-radius: 12px; }
  body.atlas-enhanced .btn,
  body.atlas-enhanced .arow,
  body.atlas-enhanced .p-tab { min-height: 44px; }
  body.atlas-enhanced .ctl { height: 48px; }
  body.atlas-enhanced .ctl button { min-width: 44px; min-height: 44px; }
  body.atlas-enhanced .btn.icon { width: 44px; }
  body.atlas-enhanced .ctl .pill > summary.btn { min-height: 44px; }
  body.atlas-enhanced .modal { padding: 10px; }
  body.atlas-enhanced .modal-card { max-height: calc(var(--app-height, 100dvh) - 20px); }
}
@media (max-width: 560px) {
  body.atlas-enhanced .ctl.crumb { max-width: 100%; }
  body.atlas-enhanced .ctl.crumb .pill { min-width: 0; }
  body.atlas-enhanced .pill > summary .nm { max-width: 10ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.atlas-enhanced .view { margin-left: 0; width: 100%; justify-content: flex-start; }
  body.atlas-enhanced .hud-act .btn { font-size: 12px; }
  body.atlas-enhanced .p-tab { padding-inline: 10px; font-size: 11px; }
}

/* When a keyboard leaves little height, the sheet itself can scroll to results. */
@container mission-sheet (max-height: 440px) {
  body.atlas-enhanced #atlasMissionList { flex: none; overflow-y: visible; }
  body.atlas-enhanced .atlas-mission-tools { gap: 6px; }
  body.atlas-enhanced .atlas-mission-tools label { gap: 3px; }
  body.atlas-enhanced .atlas-mission-row { min-height: 76px; padding-block: 8px; }
}

/* A short viewport keeps the map useful without a portrait-sized canvas. */
@media (max-width: 1100px) and (max-height: 500px), (pointer: coarse) and (max-height: 500px) {
  body.atlas-enhanced .app { padding-block: max(5px, env(safe-area-inset-top, 0px)) max(5px, env(safe-area-inset-bottom, 0px)); }
  body.atlas-enhanced .plan-head { gap: 4px; padding: 4px 6px; }
  body.atlas-enhanced .view { gap: 4px; }
  body.atlas-enhanced .stage,
  body.atlas-enhanced .stage.composing { height: clamp(250px, calc(var(--app-height, 100dvh) - 148px), 440px); min-height: 250px; }
  body.atlas-enhanced[data-atlas-scope="coven"] .stage { height: calc(var(--app-height, 100dvh) - max(5px, env(safe-area-inset-top, 0px)) - max(5px, env(safe-area-inset-bottom, 0px)) - 2px); min-height: 240px; }
  body.atlas-enhanced .lead-card { position: relative; min-height: 60px; padding: 7px 10px; }
  body.atlas-enhanced .lead-card .council { position: absolute; right: 10px; bottom: 9px; gap: 3px; }
  body.atlas-enhanced .lead-card .council .avatar { width: 14px; height: 14px; }
  body.atlas-enhanced .lead-card .bar { max-width: 55%; }
  body.atlas-enhanced .timeline { padding-block: 2px; }
  body.atlas-enhanced .inspect { max-height: calc(var(--app-height, 100dvh) - 20px); }
  body.atlas-enhanced .atlas-sidebar { max-height: calc(100% - 74px); }
}
@media (min-width: 560px) and (max-width: 1100px) and (max-height: 500px), (min-width: 560px) and (pointer: coarse) and (max-height: 500px) {
  body.atlas-enhanced .atlas-sidebar,
  body.atlas-enhanced .hud,
  body.atlas-enhanced .manifest { top: 70px; }
  body.atlas-enhanced .manifest { bottom: 94px; }
  body.atlas-enhanced .atlas-camera-dock { left: auto; right: 70px; bottom: 10px; width: calc(58% - 70px); max-width: none; }
  body.atlas-enhanced #atlasFamiliars { left: 10px; bottom: 10px; max-width: calc(42% - 20px); }
}
/* Compact screens expose every traversal action without horizontal searching. */
@media (max-width: 560px), (max-width: 760px) and (max-height: 500px) {
  body.atlas-enhanced .atlas-camera-dock { grid-template-columns: repeat(4, minmax(44px, 1fr)); overflow-x: visible; }
  body.atlas-enhanced .atlas-camera-dock button { grid-row: auto; margin-right: 0; }
  body.atlas-enhanced #atlasZoomIn { margin-right: 0; }
}
@media (max-width: 560px) {
  body.atlas-enhanced .manifest { bottom: 186px; }
}
@media (min-width: 560px) and (max-width: 760px) and (max-height: 500px) {
  body.atlas-enhanced .manifest { bottom: 126px; }
}
@media (prefers-contrast: more) {
  body.atlas-enhanced { --subtle: #bdb8c9; --border: rgba(210, 205, 230, .25); --border-strong: rgba(210, 205, 230, .4); }
  body.atlas-enhanced #plan .gsub { fill: #ccc7d8; }
  body.atlas-enhanced .atlas-contour { stroke-opacity: .25; }
  body.atlas-enhanced #plan.far .ghostfort.dormant { opacity: .8; }
}
@media (prefers-reduced-motion: reduce) {
  body.atlas-enhanced .atlas-project,
  body.atlas-enhanced .atlas-familiar { transition: none; }
  body.atlas-enhanced #atlasProjects,
  body.atlas-enhanced .leads { scroll-behavior: auto; }
}

/* Desktop uses the same explicit camera controls as the mobile map. */
@media (min-width: 1101px) and (pointer: fine) {
  body.atlas-enhanced .atlas-camera-dock { position: absolute; z-index: 9; right: 16px; bottom: 76px; display: flex; gap: 3px; max-width: calc(100% - 32px); padding: 5px; overflow-x: auto; border: 1px solid #39323f; border-radius: 9px; background: #15131a; }
  body.atlas-enhanced .atlas-camera-dock button { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 34px; padding: 5px 9px; border: 1px solid transparent; border-radius: 5px; color: #a79db5; font-size: 11px; white-space: nowrap; }
  body.atlas-enhanced .atlas-camera-dock button[aria-pressed="true"] { border-color: #4f425f; background: #292131; color: #e1d4f2; }
  body.atlas-enhanced .atlas-camera-dock button:disabled { opacity: .4; }
}
@media (max-width: 1100px), (pointer: coarse) {
  body.atlas-enhanced .atlas-project-search input { min-height: 44px; font-size: 16px; }
}
/* One responsive mobile workspace: the same replay controls, within thumb reach.
   Map/Missions/Activity are entry points into existing surfaces. Camera controls
   stay folded until requested, leaving the canvas available for the mission. */
body.atlas-enhanced .atlas-mobile-chrome { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile .app {
  height: auto;
  min-height: var(--app-height, 100dvh);
  padding-bottom: calc(var(--mobile-chrome-height, 108px) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body.atlas-enhanced.atlas-adaptive-mobile .main { flex: 0 0 auto; }
body.atlas-enhanced.atlas-adaptive-mobile #wardCtl summary { min-width: 44px; }
/* The dock owns overview and mission entry points; the map header keeps Project
   browsing and the lab in one reachable row. */
body.atlas-enhanced.atlas-adaptive-mobile .atlas-header {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand actions";
  gap: 8px;
  top: 8px;
  inset-inline: 10px;
  padding-inline: 8px 6px;
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-header .atlas-nav,
body.atlas-enhanced.atlas-adaptive-mobile #atlasMissions { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile .atlas-brand > b { font-size: clamp(13px, 2vw, 15px); }
@container atlas-stage (max-width: 480px) {
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-brand { gap: 6px; }
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-brand > b { white-space: normal; }
  body.atlas-enhanced.atlas-adaptive-mobile #atlasLab { width: var(--atlas-header-target); padding: 0; }
  body.atlas-enhanced.atlas-adaptive-mobile #atlasLab > span { display: none; }
}
@container atlas-stage (max-width: 360px) {
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-header { gap: 6px; padding-inline: 6px 5px; }
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-brand { gap: 5px; }
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-brand > svg { width: 21px; height: 21px; }
  body.atlas-enhanced.atlas-adaptive-mobile #atlasBrowse { width: var(--atlas-header-target); padding: 0; }
  body.atlas-enhanced.atlas-adaptive-mobile #atlasBrowse > span { display: none; }
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-notice { top: 70px; width: auto; max-width: none; inset-inline: 10px; transform: none; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasNavigationNoticeDismiss { min-width: 44px; min-height: 44px; }
body.atlas-enhanced.atlas-adaptive-mobile .hud,
body.atlas-enhanced.atlas-adaptive-mobile .manifest { top: 70px; }
body.atlas-enhanced.atlas-adaptive-mobile .stage,
body.atlas-enhanced.atlas-adaptive-mobile .stage.composing {
  height: var(--mobile-stage-height, calc(100dvh - 220px));
  min-height: 160px;
  max-height: none;
}
body.atlas-enhanced.atlas-adaptive-mobile .leads { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile #footBtn,
body.atlas-enhanced.atlas-adaptive-mobile #footHide,
body.atlas-enhanced.atlas-adaptive-mobile .live-ctl,
body.atlas-enhanced.atlas-adaptive-mobile .launcher { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile .atlas-mobile-chrome {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 36;
  left: calc(var(--viewport-left, 0px) + max(8px, env(safe-area-inset-left, 0px)));
  bottom: calc(var(--keyboard-inset, 0px) + max(8px, env(safe-area-inset-bottom, 0px)));
  width: calc(var(--viewport-width, 100vw) - max(8px, env(safe-area-inset-left, 0px)) - max(8px, env(safe-area-inset-right, 0px)));
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(20, 20, 25, .98);
  box-shadow: none;
  isolation: isolate;
}
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome[hidden] { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #timeline {
  display: flex;
  position: relative;
  z-index: auto;
  min-width: 0;
  min-height: 52px;
  padding: 3px 7px;
  gap: 3px 6px;
  flex-wrap: wrap;
  container-type: inline-size;
  container-name: mobile-replay;
  border: 0;
  border-radius: 0 0 12px 12px;
  background: transparent;
  box-shadow: none;
}
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome .scrub { flex: 1 1 0; min-width: 44px; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome .scrub input { height: 44px; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome .clock { flex: none; font-variant-numeric: tabular-nums; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #speed { padding-inline: 6px; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #live {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--foreground);
  font-size: 11px;
  white-space: nowrap;
  touch-action: manipulation;
}
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #live[aria-pressed="false"] { color: var(--attention); border-color: var(--border-strong); }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #live .sr { position: static; width: auto; height: auto; opacity: 1; overflow: visible; }
@container mobile-replay (max-width: 290px) {
  body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome .clock { flex-basis: 100%; order: 5; text-align: center; }
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-mobile-views {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  border-bottom: 1px solid var(--border);
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-mobile-views button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 7px;
  touch-action: manipulation;
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-mobile-views button:hover,
body.atlas-enhanced.atlas-adaptive-mobile .atlas-mobile-views button[aria-expanded="true"] {
  color: #e0d6f2;
  border-color: rgba(179, 170, 235, .25);
  background: rgba(179, 170, 235, .09);
}
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #atlasCameraDock {
  position: absolute;
  left: auto;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(540px, 100%);
  max-width: none;
  max-height: calc(var(--app-height, 100dvh) - var(--mobile-chrome-height, 108px) - 24px);
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome[data-camera-open="false"] #atlasCameraDock { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasMobileChrome #atlasCameraDock button { grid-row: 1; margin: 0; padding-inline: 4px; }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="compact"] #atlasMobileChrome #atlasCameraDock { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="compact"] #atlasMobileChrome #atlasCameraDock button { grid-row: auto; }
body.atlas-enhanced.atlas-adaptive-mobile.atlas-mobile-overlay #atlasMobileChrome,
body.atlas-enhanced.atlas-adaptive-mobile.atlas-keyboard-open #atlasMobileChrome { visibility: hidden; pointer-events: none; }
body.atlas-enhanced.atlas-adaptive-mobile #atlasFamiliars { max-width: calc(100% - 20px); }
body.atlas-enhanced.atlas-adaptive-mobile .manifest { bottom: 70px; }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="landscape"] #atlasFamiliars { max-width: calc(100% - 20px); }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="landscape"][data-atlas-scope="project"] #atlasHeader {
  inset-inline-end: auto;
  width: min(330px, 45%);
}
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="landscape"][data-atlas-scope="project"] #atlasFamiliars { max-width: 45%; }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="landscape"] .atlas-mobile-chrome {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(240px, 1fr);
}
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="landscape"] .atlas-mobile-views { border-bottom: 0; border-right: 1px solid var(--border); }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-layout="tablet"] .atlas-mobile-chrome {
  left: calc(var(--viewport-left, 0px) + var(--viewport-width, 100vw) / 2);
  transform: translateX(-50%);
  width: min(760px, calc(var(--viewport-width, 100vw) - 24px));
}

/* Card mode retains one selected-mission summary. Floating squad/request notes
   remain available in full details and Activity without covering its actions. */
body.atlas-enhanced.atlas-adaptive-mobile #notes .plate,
body.atlas-enhanced.atlas-adaptive-mobile #notes .leaders { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile #notes > .manifest { display: contents; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud {
  position: absolute;
  top: auto;
  left: 10px;
  bottom: 10px;
  width: min(520px, calc(100% - 20px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  gap: 6px;
  padding: 8px;
  pointer-events: auto;
}
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-top,
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-act { display: contents; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-top > div { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud h2 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  white-space: normal;
  text-wrap: wrap;
}
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-top > .x { grid-column: 3; grid-row: 2; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-act > .btn { grid-row: 2; min-width: 0; min-height: 44px; padding-inline: 6px; font-size: 12px; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-act > .btn:first-child { grid-column: 1; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-act > .btn:last-child { grid-column: 2; }
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud .avatar,
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud p,
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-stats,
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud > .bar,
body.atlas-enhanced.atlas-adaptive-mobile #notes .hud-brief,
body.atlas-enhanced.atlas-adaptive-mobile .stage:has(#notes .hud) #atlasFamiliars { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile:has(#atlasMobileChrome[data-camera-open="true"]) #notes .hud { visibility: hidden; pointer-events: none; }

/* Ward keeps the review action above the policy disclosures. */
body.atlas-enhanced .plan-head #wardCtl:has(#ward[open]) { opacity: 1; }
#wardBody .hd { gap: 10px; }
#wardBody .hd-m { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wardBody .ward-queue { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 8px 14px; background: var(--card-raised); }
#wardBody .ward-status { color: var(--muted-foreground); font-size: .875em; }
#wardBody .ward-queue:has(.ward-review:not([hidden])) .ward-status { color: var(--foreground); font-weight: 550; }
#wardBody .ward-review { min-height: 36px; padding-inline: 16px; color: var(--primary-foreground); background: var(--primary); }
#wardBody .ward-review[hidden] { display: none; }
#wardBody .dr > summary { min-height: 44px; background: transparent; }
#wardBody .dr > summary:hover { background: var(--card-raised); }
#wardBody .dr-v { color: var(--muted-foreground); }
#wardBody .dr-b ul { gap: 4px; }
#wardBody .dr[data-k="may"] ul { flex-direction: row; flex-wrap: wrap; }
#wardBody .dr[data-k="may"] li { padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; }
#wardBody .dr[data-k="may"] li::before, #wardBody .dr[data-k="paths"] li::before { display: none; }
#wardBody .dr-b .mono { overflow-wrap: anywhere; color: var(--foreground); }
#wardBody :is(button, summary):focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (max-width: 700px), (pointer: coarse) {
  #wardBody .ward-review { min-height: 44px; }
}

#castPane .cs-summary { margin: -3px 14px 12px; color: var(--muted-foreground); font-size: .875em; }
#castPane .cs-review { display: flex; justify-content: space-between; gap: 8px; align-items: center; width: calc(100% - 28px); margin: 0 14px 12px; padding: 8px 12px; min-height: 44px; color: var(--foreground); background: #282532; border: 1px solid #575064; border-radius: var(--radius); }
#castPane .cs-review span { color: var(--primary-hi); }
#castPane .cs-h { background: var(--card); box-shadow: none; }
#castPane .cs-m { min-height: 44px; }
#castPane .cs-m .opt-q { font-size: .85em; }
#castPane .cs-location { border-block: 1px solid var(--border); }
#castPane .cs-location summary { padding: 12px 14px; cursor: pointer; min-height: 44px; }
#castPane .bfl.near > span { color: var(--warn); }
#castPane :is(summary,button):focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Agent details share a hierarchy in the map popover and mission inspector. */
#pop { width: min(calc(284px * var(--fs,1)), calc(100% - 16px)); max-height: calc(100% - 16px); overflow: auto; }
:is(#pop,.i-agent):has(.a-info) { padding: 12px 14px 14px; background: linear-gradient(155deg,#222128,#19181e 66%); }
.a-info { min-width: 0; overflow-wrap: anywhere; }
.a-info .a-top { min-height: 26px; gap: 8px; }
.a-info .a-top .id { margin: 0; color: var(--muted-foreground); font-weight: 500; }
.a-info .btn.agent-close { display: grid; place-items: center; margin: -4px -5px -4px 0; width: 32px; height: 32px; padding: 0; background: transparent; border-color: transparent; box-shadow: none; }
.a-info .agent-close::after { content: "×"; font: 20px/1 var(--f-body); }
.a-info .btn.agent-close:hover { background: var(--card-raised); }
.a-info .agent-activity { margin: 6px 0 4px; color: var(--foreground); font-size: calc(18px * var(--fs,1) * var(--fsl,1)); font-weight: 600; line-height: 1.25; }
.agent-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.agent-elapsed { font-size: calc(12px * var(--fs,1) * var(--fsl,1)); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.a-info .agent-facts { display: grid; gap: 5px; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--border); }
.agent-facts > div { display: grid; grid-template-columns: 4.2em minmax(0,1fr); gap: 8px; align-items: baseline; font-size: calc(12px * var(--fs,1) * var(--fsl,1)); line-height: 1.45; }
.agent-facts dt { color: var(--muted-foreground); }
.agent-facts dd { margin: 0; color: var(--foreground); }
.a-info .btn.agent-review { min-height: 36px; background: var(--primary); color: var(--primary-foreground); }
.a-info button:focus-visible { outline: 2px solid var(--primary-hi); outline-offset: 1px; }
@media (max-width: 700px), (pointer: coarse) {
  .a-info .btn.agent-close, .a-info .btn.agent-review { min-width: 44px; min-height: 44px; }
}


/* The workspace uses solid surfaces and visible borders on the same plane as the map. */
body.atlas-enhanced :is(.atlas-header, .atlas-sidebar, .atlas-mission-browser, .atlas-camera-dock,
    .atlas-familiars, .atlas-mobile-chrome, .inspect, .pill-body, .hud, .ask-pop, .notif, .modal-card,
    .manifest, .psyche, .plate, .plan-head, .comp, .p-h) {
  background-color: var(--card);
  background-image: none;
  border-color: var(--border-strong);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* The header owns workspace scope and the map dock owns camera controls. */
body.atlas-enhanced .plan-head :is(.vsw, .ctl[aria-label="Zoom"], .ctl:has(> #lock)),
body.atlas-enhanced .plan-head .ctl:has(> button[hidden]),
body.atlas-enhanced.atlas-adaptive-mobile .plan-head .live-ctl {
  display: none;
}

body.atlas-enhanced .atlas-project-preview-names {
  grid-column: 2 / -1;
  color: #c2bbc9;
  font-size: 11px;
  line-height: 1.4;
  min-width: 0;
  white-space: normal;
}

body.atlas-enhanced .lead-card .council { min-width: 0; max-width: 100%; align-items: center; }
body.atlas-enhanced .lead-card .council .avatar { flex-shrink: 0; }
body.atlas-enhanced .lc-task-names {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #bcb6c6;
  font-size: 11px;
  margin-inline-start: 3px;
}
@media (max-height: 500px) {
  body.atlas-enhanced .lead-card .lc-task-names { display: none; }
}

body.atlas-enhanced :is(.lead-card .who, .cs-mt > b, .msg .src:has(.mission-word), .comp .field > .route .rt-c:has(.mission-word), .n-m:has(.mission-word), #mis .opt-n, .inspect .role:has(.mission-word), #misName) {
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
body.atlas-enhanced #misName { overflow-x: auto; }
.mission-captions:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-height: 20vh;
  overflow: auto;
  padding: 6px 12px;
  background: var(--card);
}
.mission-caption {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  text-align: start;
  font: 400 13px/1.5 var(--f-body);
  color: var(--foreground);
}
.mission-caption b { color: var(--primary); font-variant-numeric: tabular-nums; }

body.atlas-enhanced.atlas-adaptive-mobile:not([data-mobile-layout="landscape"]) .app:has(.mission-captions:not([hidden])) .stage {
  height: max(120px, calc(var(--mobile-stage-height) - min(18vh, 80px)));
  min-height: 120px;
}
body.atlas-enhanced.atlas-adaptive-mobile .mission-captions:not([hidden]) {
  max-height: min(18vh, 80px);
}

body.atlas-adaptive-mobile[data-mobile-layout="landscape"] .plan:has(> .mission-captions:not([hidden])) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 24%);
}
body.atlas-adaptive-mobile[data-mobile-layout="landscape"] .plan-head { grid-column: 1 / -1; }
body.atlas-adaptive-mobile[data-mobile-layout="landscape"] .mission-captions:not([hidden]) {
  flex-direction: column;
  flex-wrap: nowrap;
  max-height: var(--mobile-stage-height);
  align-items: start;
}
