/* 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: var(--card);
  background-image: linear-gradient(to right, rgb(255 255 255 / 1.7%) 1px, transparent 1px),
                    linear-gradient(to bottom, rgb(255 255 255 / 1.7%) 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 .app .leads { gap: 8px; scroll-snap-type: x proximity; padding: 2px 2px 4px; }
body.atlas-enhanced .timeline { --replay-fill: color-mix(in srgb, var(--primary) 65%, var(--card)); }
body.atlas-enhanced .scrub input::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--replay-fill) var(--p,100%), var(--border-strong) var(--p,100%)); }
body.atlas-enhanced .scrub input::-moz-range-progress { background: var(--replay-fill); }
body.atlas-enhanced .timeline .clock { color: var(--foreground); font-variant-numeric: tabular-nums; }
body.atlas-enhanced .timeline #speed { color: var(--muted-foreground); border-inline-start: 1px solid var(--border); border-radius: 0; }
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: grid; place-items: center; flex: none;
  inline-size: var(--atlas-header-target); block-size: var(--atlas-header-target);
}
body.atlas-enhanced .atlas-brand > img { display: block; width: 28px; height: 28px; }
body.atlas-enhanced .atlas-nav {
  grid-area: scope; justify-self: start; display: flex; flex: none; align-items: stretch;
  height: var(--atlas-header-target); border-radius: 8px; background: var(--background);
  box-shadow: inset 0 0 0 1px var(--border), inset 0 1px 3px rgb(0 0 0 / 20%);
}
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-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-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-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); }


/* 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 #atlasMissionClose { min-width: 34px; min-height: 34px; padding: 0; border-color: transparent; background: transparent; font-size: 20px; }
body.atlas-enhanced .atlas-mission-browser #atlasMissionCreate { margin-left: auto; min-height: 34px; padding: 4px 12px; background: var(--primary); color: #17151d; font: inherit; font-size: 12px; font-weight: 600; border-radius: 6px; }
body.atlas-enhanced .atlas-mission-browser #atlasMissionCreate:disabled { background: var(--border); color: var(--muted-foreground); }
body.atlas-enhanced .atlas-mission-create-hint { margin: 0; color: var(--muted-foreground); font-size: 12px; }
body.atlas-enhanced .atlas-mission-search { position: relative; }
body.atlas-enhanced .atlas-mission-search::before { content: ''; position: absolute; left: 13px; top: calc(50% - 6px); width: 9px; height: 9px; border: 1.5px solid var(--muted-foreground); border-radius: 50%; pointer-events: none; }
body.atlas-enhanced .atlas-mission-search::after { content: ''; position: absolute; left: 22px; top: calc(50% + 4px); width: 5px; height: 1.5px; background: var(--muted-foreground); transform: rotate(45deg); pointer-events: none; }
body.atlas-enhanced .atlas-mission-search #atlasMissionSearch { padding-left: 35px; }
body.atlas-enhanced .atlas-mission-search #atlasMissionSearch:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; box-shadow: none; }
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: 64px; padding: 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: transparent; background: #26232e; box-shadow: inset 3px 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: 14px; font-weight: 550; line-height: 1.35; }
body.atlas-enhanced .atlas-mission-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; }
body.atlas-enhanced .atlas-mission-meta { padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted-foreground); font-size: 10px; line-height: 1.35; }
body.atlas-enhanced .atlas-mission-stats, body.atlas-enhanced .atlas-mission-project { color: var(--muted-foreground); font-size: 11px; line-height: 1.45; }
body.atlas-enhanced .atlas-mission-heading .atlas-pending { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: #312a3b; color: var(--primary-hi); font-size: 11px; }
body.atlas-enhanced .atlas-request-preview { padding-top: 4px; border-top: 1px solid var(--border); color: var(--primary-hi); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
body.atlas-enhanced .atlas-mission-heading [hidden] { display: none; }
body.atlas-enhanced .atlas-mission-row[data-state="needsYou"] .atlas-mission-meta { border-color: #675b80; background: #332c3e; color: #e9dff9; }
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; }
/* Size detail cards against the map left beside the conversation rail. */
@container atlas-stage (min-width: 700px) {
  body.atlas-enhanced:not(.atlas-adaptive-mobile) #notes .manifest {

    width: clamp(252px, 32cqw, calc(440px * var(--fs, 1)));
    gap: clamp(8px, 1cqw, 14px);
  }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest :is(.hud, .plate.seat) {
    padding: clamp(12px, 1.45cqw, 22px);
  }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest .hb {
    min-height: calc(clamp(23px, 2.4cqw, 32px) * var(--fs, 1));
  }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest :is(.hb, .nt, .plate-h .rl) {
    font-size: calc(clamp(12.5px, 1.12cqw, 15px) * var(--fs, 1));
  }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest .nt { padding-block: clamp(3px, .45cqw, 7px); }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest .hb b { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-height: 960px) {
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest :is(.hud, .plate.seat) { padding: 11px 14px; }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest .hud { gap: 9px; }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest .hb { min-height: calc(23px * var(--fs, 1)); }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .manifest .nt { padding-block: 3px; }
}
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 .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 .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 :is(#atlasMissionCreate,#atlasMissionClose) { 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: 155px 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 .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: 64px; 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; }
@container atlas-stage (max-width: 480px) {
  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 > img { width: 26px; height: 26px; }
  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 { 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.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: var(--card-raised); }
.a-info { min-width: 0; overflow-wrap: anywhere; }
.a-info .a-top { align-items: flex-start; min-height: 26px; gap: 8px; }
.a-info .agent-identity { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: calc(12px * var(--fs,1) * var(--fsl,1)); }
.a-info .agent-owner b { color: var(--foreground); font-weight: 550; }
.a-info .agent-identity .id { font-size: .92em; }
.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: 0; padding-block: 2px; 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: 4px; margin: 10px 0 0; padding: 0; }
.agent-facts > div { display: grid; grid-template-columns: 3.5em 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,
    .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;
}

/* Keep identity, task previews and council allocation in the same order across the strip. */
body.atlas-enhanced .lead-card { justify-content: flex-start; gap: 5px; }
body.atlas-enhanced .lead-card .lc-top { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 7px; }
body.atlas-enhanced .lead-card .lc-seal { margin: 0; }
body.atlas-enhanced .lead-card .who { font-size: calc(14px * var(--fs,1)); font-weight: 600; text-align: start; }
body.atlas-enhanced .lead-card .n { font-size: calc(11px * var(--fs,1)); white-space: nowrap; }
body.atlas-enhanced .lc-task-names {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: calc(12px * var(--fs,1)); color: var(--muted-foreground);
}
body.atlas-enhanced .lc-task-names:empty { display: none; }
body.atlas-enhanced .lc-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; margin-top: auto; padding-top: 3px; }
body.atlas-enhanced .lc-state { color: var(--muted-foreground); display: inline-flex; align-items: center; gap: 5px; font-size: calc(11px * var(--fs,1)); font-weight: 550; }
body.atlas-enhanced .lc-state::before { content: ''; width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; }
body.atlas-enhanced .lead-card[data-state="active"] .lc-state { color: var(--primary); }
body.atlas-enhanced .lead-card[data-state="needsYou"] .lc-state { color: var(--attention); }
body.atlas-enhanced .lead-card[data-state="needsYou"] .lc-state::before { background: currentColor; }
body.atlas-enhanced .lead-card:is([data-state="stalled"],[data-state="broken"]) .lc-state { color: var(--warn); }
body.atlas-enhanced .lead-card[data-state="sealed"] .lc-state { color: var(--ok, #a7cdb9); }
body.atlas-enhanced .lead-card .council { position: static; min-width: 0; align-items: center; gap: 3px; flex-wrap: wrap; }
body.atlas-enhanced .lead-card .council .avatar { width: 16px; height: 16px; flex-shrink: 0; }
body.atlas-enhanced .lead-card .bar { width: 42px; max-width: none; height: 3px; margin-inline-start: 3px; gap: 1px; background: var(--border); }
body.atlas-enhanced .lead-card .bar:empty { display: none; }
@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;
}


/* Task ownership, activity and agents share one reading surface. */
#mission-section[aria-labelledby="mission-tab-tasks"]:has(.i-task) {
  background: #1b1a20; border: 1px solid var(--border); border-radius: 10px; padding-inline: 12px;
}
#mission-section[aria-labelledby="mission-tab-tasks"] .i-task {
  padding: 12px 0 9px; border: 0;
}
#mission-section[aria-labelledby="mission-tab-tasks"] .i-task + .i-task { border-top: 1px solid var(--border); }
.i-task-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; margin-block-start: 3px; }
.i-task-owner, .i-task-meta .i-task-summary { font-size: calc(11.5px * var(--fs,1)); margin: 0; line-height: 1.5; }
.i-task-owner { color: var(--hue); }
.i-task-meta .waiting { color: var(--foreground); }
#mission-section[aria-labelledby="mission-tab-tasks"] .dots { margin: 4px 0 0 -4px; gap: 2px; }
#mission-section[aria-labelledby="mission-tab-tasks"] button.dot { width: 28px; height: 28px; }
#mission-section[aria-labelledby="mission-tab-tasks"] button.dot i { width: 10px; height: 10px; }
#mission-section[aria-labelledby="mission-tab-tasks"] button.dot.gate i { border-radius: 3px; }
.i-task .i-agent { margin-top: 6px; background: var(--card); box-shadow: none; }
@media (pointer: coarse) {
  #mission-section[aria-labelledby="mission-tab-tasks"] button.dot { width: 44px; height: 44px; }
}

/* Three inspector rows: identity, activity/navigation, and sections. */
body.atlas-enhanced .inspect .mission-header { display: grid; gap: 5px; min-width: 0; flex: none; }
.mission-identity, .mission-path, .mission-activity { display: flex; align-items: center; min-width: 0; gap: 5px; }
.mission-path { flex: 1; gap: 6px; overflow-x: auto; scrollbar-width: thin; white-space: nowrap; }
.mission-identity > button { flex: none; }
.mission-path-separator { color: var(--subtle); }
body.atlas-enhanced .mission-path > * { flex: none; }
body.atlas-enhanced .mission-path .mission-context { color: var(--muted-foreground); }
body.atlas-enhanced .inspect .mission-path .mission-title { flex: none; white-space: nowrap; font-weight: 600; letter-spacing: -.015em; }
body.atlas-enhanced .mission-path .mission-word { max-width: none; overflow: visible; }
.mission-activity { justify-content: space-between; gap: 4px; }
body.atlas-enhanced .mission-header .i-counts { display: flex; align-items: baseline; flex-wrap: nowrap; gap: 7px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
body.atlas-enhanced .mission-header .i-counts div { flex: none; flex-direction: row-reverse; align-items: baseline; gap: 3px; padding: 0; border: 0; }
body.atlas-enhanced .mission-header .i-counts dd { font-size: calc(13px * var(--fs,1)); }
body.atlas-enhanced .mission-header .i-counts dt { font-size: calc(11px * var(--fs,1)); white-space: nowrap; color: var(--muted-foreground); }
body.atlas-enhanced .mission-header .mission-stepper { flex: none; border: 0; padding: 0; gap: 3px; }
body.atlas-enhanced .mission-header .mission-stepper button { min-width: 26px; padding: 0 5px; font-size: 17px; }
body.atlas-enhanced .mission-header .i-view { position: static; box-shadow: none; }
.council-count { margin-inline-start: 4px; color: var(--muted-foreground); font-size: .85em; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px), (pointer: coarse) {
  body.atlas-enhanced .inspect .mission-header { position: sticky; top: -14px; z-index: 4; background: #17171c; padding-block: 3px 5px; gap: 2px; }
  body.atlas-enhanced .mission-header :is(.mission-identity, .mission-stepper) button { min-width: 44px; min-height: 44px; }
}

@media (max-width: 359px) {
  body.atlas-enhanced .inspect .mission-header { margin-inline: -10px; }
  .mission-identity, .mission-path { gap: 2px; }
}
@media (max-height: 450px) and (max-width: 1100px) {
  body.atlas-enhanced .inspect .mission-header { position: static; }
  body.atlas-enhanced .inspect { scroll-padding-block: 14px; }
}

/* Details anchor the left edge. An open browser can share a desktop map. */
body.atlas-enhanced:not(.atlas-adaptive-mobile) .inspect {
  left: 0; right: auto;
  border-left: 0; border-right: 1px solid var(--border-strong);
  box-shadow: none; animation: none;
}
body.atlas-enhanced:not(.atlas-adaptive-mobile):has(#inspect:not([hidden])) :is(.atlas-mission-browser, .atlas-sidebar, #notes > .manifest, #notes > .hud) {
  left: auto; right: 16px;
}
body.atlas-enhanced.atlas-adaptive-mobile #inspect {
  left: calc(var(--viewport-left, 0px) + max(10px, env(safe-area-inset-left, 0px))); right: auto; transform: none;
  width: min(420px, calc(var(--viewport-width, 100vw) - max(10px, env(safe-area-inset-left, 0px)) - max(10px, env(safe-area-inset-right, 0px))));
}
body.atlas-enhanced .mission-header :is(.mission-identity, .mission-stepper) button {
  background: transparent; border-color: transparent; box-shadow: none; color: var(--muted-foreground);
}
body.atlas-enhanced .mission-header :is(.mission-identity, .mission-stepper) button:enabled:hover {
  color: var(--foreground); background: var(--card-raised);
}
body.atlas-enhanced .mission-header .i-view {
  gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--background);
}
body.atlas-enhanced .mission-header .i-view button {
  border: 1px solid transparent; border-radius: 5px; background: transparent; box-shadow: none;
}
body.atlas-enhanced .mission-header .i-view button[aria-selected="true"] {
  color: var(--foreground); background: #35323e; border-color: #56505f; box-shadow: inset 0 1px rgba(255,255,255,.07);
}
body.atlas-enhanced .mission-header .i-view button:hover { color: var(--foreground); }
body.atlas-enhanced .atlas-header .atlas-nav button {
  position: relative; isolation: isolate; inline-size: 5.25em; min-height: var(--atlas-header-target);
  padding: 0; border: 0; background: transparent; color: var(--muted-foreground);
}
body.atlas-enhanced .atlas-header .atlas-nav button:is(:hover, :active, [aria-pressed="true"]) { background: transparent; box-shadow: none; }
body.atlas-enhanced .atlas-header .atlas-nav button::before {
  content: ''; position: absolute; inset: 3px; z-index: -1; border-radius: 5px;
}
body.atlas-enhanced .atlas-header .atlas-nav button:hover { color: var(--foreground); }
body.atlas-enhanced .atlas-header .atlas-nav button:hover::before { background: var(--card-raised); }
body.atlas-enhanced .atlas-header .atlas-nav button[aria-pressed="true"] { color: var(--foreground); font-weight: 650; }
body.atlas-enhanced .atlas-header .atlas-nav button[aria-pressed="true"]::before {
  background: color-mix(in srgb, var(--primary) 15%, var(--card-raised));
  box-shadow: inset 0 1px rgb(255 255 255 / 12%), 0 1px 2px rgb(0 0 0 / 24%);
}
body.atlas-enhanced .atlas-header .atlas-nav button:focus-visible { outline-offset: -3px; }
body.atlas-enhanced .mission-path .mission-context { font-size: calc(11px * var(--fs,1)); }
@media (max-width: 359px) {
  .mission-path { display: grid; grid-template-columns: minmax(max-content, 1fr); align-content: center; gap: 0; }
  .mission-path-separator { display: none; }
}
@media (min-width: 760px) {
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-header .atlas-nav { display: flex; }
}
#mission-section .brief-card { border: 1px solid var(--border); background: var(--card-raised); border-radius: 9px; padding: 11px 13px; }
#mission-section .brief-card + .brief-card { margin-top: 8px; }
.brief-heading { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 1em; font-weight: 600; line-height: 1.35; }
.brief-heading svg { width: 14px; height: 14px; flex: none; color: var(--primary); }
.brief-heading small { margin-inline-start: auto; font-size: .86em; color: var(--muted-foreground); font-weight: 400; text-align: end; }
.brief-card .bfg { padding: 9px 0 0; border: 0; gap: 7px; }
.brief-card .bfg + .bfg { margin-top: 10px; border-top: 1px solid var(--border); }
.brief-card .bfg-h { margin: 0; }
.brief-card .bfl { padding: 0; align-items: baseline; }
.brief-card .limit-state { margin-inline-start: 5px; color: var(--warn); white-space: nowrap; }
#inspect #mission-section > .i-task, #inspect #mission-section > .arows {
  margin-block: 6px; padding: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-raised);
}
@media (forced-colors: active) {
  .mission-header .i-view [aria-selected="true"], .atlas-header .atlas-nav [aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
}

body.atlas-enhanced .mission-header .i-counts .gate:not(.zero) dd::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-inline-end: 4px; vertical-align: 2px; border: 1px solid currentColor; border-radius: 1px; }
body.atlas-enhanced .mission-header .i-counts .gate:not(.zero) dt { color: var(--foreground); }
body.atlas-enhanced .mission-header .i-counts .zero dd { color: var(--muted-foreground); }
body.atlas-enhanced .atlas-camera-dock :is(#atlasZoomIn, #atlasZoomOut) { font: 500 17px var(--f-body); }
body.atlas-enhanced:not(.atlas-adaptive-mobile) .atlas-camera-dock #atlasFit { border-inline-start: 1px solid var(--border); border-radius: 0; padding-inline-start: 10px; }

/* One workspace bar outside the map, shared by the Coven and Project scopes. */
body.atlas-enhanced .plan .plan-head {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  min-height: 48px; padding: 4px 10px; z-index: 16; background: var(--card);
}
body.atlas-enhanced .plan-head #atlasHeader {
  position: static; display: flex; flex: 1; align-items: center; gap: 4px;
  width: auto; min-width: 0; padding: 0; border: 0; background: transparent;
}
body.atlas-enhanced .plan-head .atlas-actions { margin-inline-start: auto; }
body.atlas-enhanced .plan-head .atlas-actions :is(button,a) { background: transparent; border-color: transparent; }
body.atlas-enhanced .plan-head .atlas-actions :is(button,a):is(:hover,[aria-expanded="true"]) { background: var(--card-raised); color: var(--foreground); }
.workspace-urgent { display: flex; align-items: center; gap: 4px; }
.workspace-tools { flex: none; }
.workspace-tools > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; color: var(--muted-foreground); }
.workspace-tools > summary::-webkit-details-marker { display: none; }
.workspace-tools[open] > summary, .workspace-tools > summary:hover { color: var(--foreground); background: var(--card-raised); }
.workspace-utilities {
  position: absolute; right: 4px; top: calc(100% + 3px); width: min(600px, calc(100% - 8px));
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 8px;
}
body.atlas-enhanced[data-atlas-scope="coven"] .plan-head :is(.workspace-tools,.workspace-urgent) { display: none; }
body.atlas-enhanced #atlasCameraDock[data-locked="true"] :is(#atlasZoomOut,#atlasZoomIn,#atlasFit,#atlasFormation) { display: none; }
body.atlas-enhanced #atlasCameraDock #atlasFormation[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-hi); }
body.atlas-enhanced #atlasCameraDock { align-items: center; gap: 2px; }
body.atlas-enhanced #atlasCameraDock #atlasLock { gap: 5px; }
#atlasLock svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; }
#atlasLock[aria-pressed="true"] .lock-open, #atlasLock[aria-pressed="false"] .lock-closed { display: none; }
body.atlas-enhanced #atlasCameraDock button:focus-visible { outline-offset: -2px; }
body.atlas-enhanced:not(.atlas-adaptive-mobile) :is(.atlas-sidebar,.atlas-mission-browser,.inspect,.manifest,.hud) { top: 12px; }
body.atlas-enhanced:not(.atlas-adaptive-mobile) :is(.atlas-sidebar,.atlas-mission-browser) { max-height: calc(100% - 24px); }
body.atlas-enhanced.atlas-adaptive-mobile .plan .plan-head { padding: 2px 5px; gap: 2px; }
body.atlas-enhanced.atlas-adaptive-mobile .workspace-tools > summary { min-width: 44px; height: 44px; }
@media (max-width: 600px) {
  body.atlas-enhanced .plan-head #atlasHeader { gap: 2px; }
  body.atlas-enhanced .plan-head .atlas-actions > :is(a,button) > span { display: none; }
  body.atlas-enhanced .plan-head .atlas-actions > :is(a,button):not(#atlasMissions) { display: inline-flex; width: 44px; padding-inline: 0; }
}

@media (min-width: 380px) and (max-width: 600px) {
  body.atlas-enhanced .plan-head .atlas-actions > #atlasBrowse { width: auto; gap: 5px; }
  body.atlas-enhanced .plan-head #atlasBrowse > span { display: inline; }
}
body.atlas-enhanced.atlas-adaptive-mobile .workspace-urgent .ctl { min-height: 44px; }

body.atlas-enhanced.atlas-adaptive-mobile .plan-head #atlasHandoff { display: inline-flex; }
@container left (max-width: 860px) {
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .plan-head :is(#atlasHandoff,#atlasLab) { padding-inline: 6px; }
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .plan-head :is(#atlasHandoff,#atlasLab) > span { display: none; }
}
@container left (max-width: 720px) {
  body.atlas-enhanced:not(.atlas-adaptive-mobile) .plan-head #atlasHeader { gap: 4px; }
}

body.atlas-enhanced { --workspace-title-height: calc(44px * var(--fs, 1)); }
body.atlas-enhanced.atlas-adaptive-mobile { --workspace-title-height: max(49px, calc(44px * var(--fs, 1))); }
body.atlas-enhanced .plan #workspaceBar, body.atlas-enhanced .psyche .p-h {
  min-height: var(--workspace-title-height); padding-block: 0; flex-shrink: 0;
}
body.atlas-enhanced .inspect { scroll-padding-bottom: 82px; }
.inspect-actions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(calc(94px * var(--fs, 1)), 100%), 1fr));
  gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border);
  background: var(--card);
}
.inspect-action-item { display: grid; gap: 4px; min-width: 0; text-align: center; }
body.atlas-enhanced .inspect :is(.inspect-action,.agent-review) {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 6px 10px; border-radius: 7px;
  font-weight: 550; line-height: 1.3; box-shadow: none;
}
body.atlas-enhanced .inspect .inspect-action { background: var(--card-raised); border: 1px solid var(--border-strong); color: var(--foreground); }
body.atlas-enhanced .inspect [data-focus="edit-brief"] { background: #332b42; color: #eee6ff; border-color: #635271; }
.inspect-action svg { flex: none; width: 15px; height: 15px; color: var(--primary); }
body.atlas-enhanced .inspect .inspect-action:hover { background: #36303e; border-color: var(--primary); }
body.atlas-enhanced .inspect .inspect-action:active { background: #28232f; }
body.atlas-enhanced .inspect .inspect-action { padding-inline: 5px; gap: 4px; }
#mission-section .brief-at-limit { border-inline-start: 3px solid var(--warn); }
.brief-at-limit .brief-heading svg, .brief-at-limit .bfl.over .limit-state { color: var(--warn); }
#mission-section .brief-card .bfl.near .meter i { background: var(--primary); }
#mission-section .brief-card .bfl.near .limit-state { color: var(--primary-hi); }
body.atlas-enhanced .inspect .agent-review { background: var(--attention); color: var(--background); }
@media (min-height: 550px) {
  .inspect-actions { position: sticky; bottom: -16px; z-index: 2; margin-inline: -2px; padding: 9px 2px 5px; }
}
@media (max-width: 1100px), (pointer: coarse) {
  body.atlas-enhanced .inspect :is(.inspect-action, .agent-review) { min-height: 44px; }
}
body.atlas-enhanced:not(.atlas-adaptive-mobile) .plan-body:has(.stage.composing) > #inspect { display: none; }

.atlas-map-footer { display: contents; }
body.atlas-enhanced #atlasCameraDock button svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
@media (min-width: 1101px) and (pointer: fine) {
  .atlas-map-footer {
    position: absolute; z-index: 9; inset: auto 14px 14px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch;
    gap: 10px; pointer-events: none;
  }
  .plan-body:has(> #inspect:not([hidden])) .atlas-map-footer { left: min(364px, 50%); }
  body.atlas-enhanced .atlas-map-footer :is(#atlasFamiliars, #atlasCameraDock) {
    position: static; transform: none; max-width: 100%; min-width: 0;
    padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 9px; pointer-events: auto;
  }
  body.atlas-enhanced .atlas-map-footer #atlasFamiliars { justify-self: center; }
  body.atlas-enhanced .atlas-map-footer #atlasCameraDock { gap: 1px; }
  body.atlas-enhanced .atlas-map-footer #atlasCameraDock button {
    width: 35px; min-width: 35px; min-height: 35px; align-self: stretch; padding: 0; border: 0; border-radius: 5px;
  }
}
body.atlas-enhanced #atlasCameraDock[hidden] { display: none; }
body.atlas-enhanced.atlas-adaptive-mobile .atlas-map-footer:has(#atlasCameraDock:not([hidden])) {
  position: absolute; z-index: 9; inset: auto 8px 10px; display: flex; align-items: stretch;
  justify-content: space-between; gap: 4px; pointer-events: none;
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-map-footer:has(#atlasCameraDock:not([hidden])) :is(#atlasFamiliars, #atlasCameraDock) {
  position: static; transform: none; width: max-content; min-width: 0; max-width: 100%; margin: 0;
  padding: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; pointer-events: auto;
}
body.atlas-enhanced.atlas-adaptive-mobile .atlas-map-footer #atlasCameraDock:not([hidden]) {
  display: flex; flex: none; margin-left: auto; gap: 0;
}
body.atlas-enhanced.atlas-adaptive-mobile #atlasCameraDock button {
  width: 44px; min-width: 44px; height: 44px; padding: 0; border: 0;
}
@media (max-width: 480px) {
  body.atlas-enhanced.atlas-adaptive-mobile .atlas-map-footer:has(#atlasCameraDock:not([hidden])) .atlas-familiar-name { display: none; }
}

/* Keep collection actions next to their results at every sheet size. */
body.atlas-enhanced .atlas-result-summary { display: flex; flex: none; align-items: center; justify-content: space-between; flex-wrap: wrap; column-gap: 8px; min-height: 32px; }
body.atlas-enhanced .atlas-result-summary :is(#atlasProjectClear, #atlasMissionReset) { min-height: 32px; padding: 4px 8px; color: var(--primary-hi); border-color: var(--border); background: var(--card); font-size: 11px; }
body.atlas-enhanced .atlas-result-summary [hidden], body.atlas-enhanced .atlas-pending[hidden] { display: none; }
body.atlas-enhanced .atlas-empty-result, body.atlas-enhanced #atlasMissionEmpty { margin: 0 3px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 7px; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
body.atlas-enhanced .atlas-drawer-heading #atlasNewProject { flex: none; width: auto; min-height: 32px; margin: 0 0 0 auto; color: var(--primary-hi); }
body.atlas-enhanced .atlas-project-copy b { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; font-size: 13px; }
body.atlas-enhanced .atlas-project-copy > span { color: var(--muted-foreground); font-size: 11px; }
body.atlas-enhanced .atlas-project-state[data-state="attention"], body.atlas-enhanced .atlas-pending { color: var(--primary-hi); font-size: 11px; font-variant-numeric: tabular-nums; }
body.atlas-enhanced .atlas-mission-row:is([data-state="broken"], [data-state="stalled"]) .atlas-mission-meta { border-style: dashed; color: var(--foreground); }
body.atlas-enhanced .atlas-mission-row[data-state="broken"] .atlas-mission-meta { border-color: var(--warn); }
body.atlas-enhanced .atlas-mission-row[data-state="sealed"] .atlas-mission-meta { border-style: double; border-width: 3px; }
.brief-card .target-met, .brief-card .limit-state { display: inline-block; margin-inline-start: 5px; font-size: 10px; font-weight: 600; }
.brief-card .target-met { color: var(--primary-hi); }
body.atlas-enhanced #mission-section .bfl > b { white-space: normal; text-align: end; overflow-wrap: anywhere; }
@media (max-width: 1100px), (pointer: coarse) {
  body.atlas-enhanced .atlas-result-summary :is(#atlasProjectClear, #atlasMissionReset), body.atlas-enhanced .atlas-drawer-heading #atlasNewProject { min-height: 44px; }
}

#recordingPrompt {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0;
  box-sizing: border-box; border: 1px solid var(--border-strong); border-radius: 14px;
  color: var(--foreground); background: var(--card); font: inherit; overflow: auto;
}
#recordingPrompt::backdrop { background: rgb(0 0 0 / .72); }
#missionHistory {
  box-sizing: border-box; width: min(46rem, calc(100% - 20px)); max-height: calc(100dvh - 24px);
  margin: auto; padding: 0; border: 1px solid var(--border-strong); border-radius: 14px;
  background: var(--card); color: var(--foreground); font: inherit; overflow: hidden;
}
#missionHistory[open] { display: flex; flex-direction: column; }
#missionHistory::backdrop { background: rgb(0 0 0 / .72); }
.history-heading { flex: none; display: flex; gap: 12px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding: 14px 20px; }
#historyLabel { color: var(--primary-hi); font-size: .84em; }
#historyTitle { margin: 2px 0 0; font-size: 1.45em; line-height: 1.2; overflow-wrap: anywhere; max-height: 2.5em; overflow: auto; }
.history-content { min-height: 0; overflow: auto; padding: 0 16px 16px; overscroll-behavior: contain; }
#missionHistory p { margin: 0; }
.history-context, .history-toolbar, .history-actions, .history-bounds, #historyPages { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.history-context { padding: 8px 2px; border-bottom: 1px solid var(--border); }
#historySource { min-width: 0; flex: 1; overflow-wrap: anywhere; color: var(--muted-foreground); font-size: .87em; }
.history-import summary, .history-source-event summary { cursor: pointer; }
.history-import summary { color: var(--muted-foreground); padding: 6px; }
.history-import[open] { flex-basis: 100%; }
.history-import .btn { margin: 4px 0 6px; }
#historyWarning, #historyError { padding: 8px; border-inline-start: 2px solid var(--primary); background: var(--primary-soft); }
.history-toolbar { padding: 9px 2px; }
#historyCount { font-weight: 600; font-variant-numeric: tabular-nums; }
#historyRange { background: var(--card-raised); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
#historyRange p, .history-range small { color: var(--muted-foreground); }
.history-range { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(13rem,100%),1fr)); gap: 14px; margin-top: 10px; }
.history-range > div { display: grid; align-content: start; gap: 5px; min-width: 0; }
.history-range small { overflow-wrap: anywhere; }
.history-range input { width: 100%; box-sizing: border-box; background: var(--well); color: inherit; border: 1px solid var(--border-strong); border-radius: 6px; padding: 8px; }
.history-workspace { background: var(--well); border-radius: 10px; }
.history-workspace:has(#historyRows:empty) { display: none; }
#historyRows { list-style: none; margin: 0; padding: 4px; }
#historyRows li { position: relative; }
#historyRows li:not(:last-child)::before { content: ""; position: absolute; inset: 28px auto -28px 21px; width: 1px; background: var(--border-strong); pointer-events: none; }
.history-event { position: relative; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 8px; min-height: 54px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.history-event:hover { background: var(--card); }
.history-event[aria-expanded="true"] { background: var(--card-raised); border-inline-start: 2px solid var(--primary); padding-inline-start: 7px; }
.history-mark { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--card); color: var(--primary); }
.history-mark svg { width: 15px; height: 15px; }
.history-mark .avatar { width: 24px; height: 24px; }
.history-limit { color: var(--warn); }
.history-event-copy { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.history-event-copy strong { font-weight: 560; }
.history-event-meta, .history-detail-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .84em; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
#historyDetail { position: relative; min-width: 0; padding: 15px; margin: 0 4px 8px 20px; background: var(--card-raised); border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
#historyEventTitle { margin: 6px 0 12px; font-size: 1.18em; line-height: 1.35; }
.history-changes { margin: 0; }
.history-changes dt { margin-top: 9px; color: var(--muted-foreground); font-size: .87em; }
.history-changes dd { margin: 2px 0 0; }
.history-changes dd span { color: var(--muted-foreground); }
.history-changes b { font-weight: 550; }
.history-notice { color: var(--primary-hi); }
.history-actions, .history-bounds { justify-content: start; padding-top: 10px; }
#historyDetail .history-map-action { background: var(--primary-soft); border-color: var(--ring); color: var(--primary-hi); }
.history-source-event { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 8px; color: var(--muted-foreground); }
.history-source-event pre { white-space: pre-wrap; font-size: .9em; }
#historyPages { padding: 8px; }
#missionHistory :is(button,summary,input):focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (min-width: 860px) and (min-height: 520px) {
  #missionHistory { width: min(55rem,calc(100% - 40px)); }
  .history-workspace { display: grid; grid-template-columns: 1.1fr 1fr; align-items: start; }
  .history-feed, #historyDetail { max-height: min(54dvh,36rem); box-sizing: border-box; overflow: auto; }
  #historyDetail { margin: 4px; }
}
@media (pointer: coarse), (max-width: 500px) {
  #missionHistory :is(.btn,summary) { min-height: 44px; box-sizing: border-box; }
  #missionHistory summary { align-content: center; }
  .history-heading { padding: 10px 14px; }
  .history-content { padding-inline: 10px; }
}
@media (max-height: 519px) {
  .history-heading { padding-block: 6px; }
  .history-heading > div { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  #historyTitle { font-size: 1.15em; margin: 0; }
}
#historyReturn { position: fixed; z-index: 45; bottom: max(76px, 12dvh); left: 50%; transform: translateX(-50%); width: max-content; max-width: 88vw; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 8px 12px; border: 1px solid var(--border-strong); background: var(--card); border-radius: 8px; }
body.atlas-adaptive-mobile #historyReturn { bottom: calc(var(--mobile-chrome-height, 108px) + env(safe-area-inset-bottom, 0px) + 8px); }
@media (max-width: 500px) { #historyResume { min-height: 44px; } }
#historyMapNote { flex: 1 0 100%; overflow-wrap: anywhere; max-height: 3.5em; overflow: auto; }

/* The closed channel is attached to the map edge. The compact crown clears the map footer. */
.psyche-launcher {
  position: absolute; z-index: 7; inset: clamp(8px, 3%, 24px) 0 auto auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 32px; min-height: 86px; padding: 9px 0; cursor: pointer;
  border: 1px solid var(--border-strong); border-right: 0; border-radius: 9px 0 0 9px;
  background: var(--card); color: var(--muted-foreground);
}
.psyche-launcher[hidden] { display: none; }
.psyche-launcher svg { width: 19px; height: 19px; color: var(--primary); }
.psyche-launcher span { writing-mode: vertical-rl; font-size: .72rem; font-weight: 550; }
.psyche-launcher:hover, .psyche-launcher:focus-visible { color: var(--foreground); background: var(--card-raised); }
.psyche-launcher:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
.psyche-launcher[data-placement="corner"] { top: auto; bottom: 64px; min-height: 36px; width: 36px; padding: 0; }
.psyche-launcher[data-placement="corner"] span { display: none; }
@media (pointer: coarse) {
  .psyche-launcher, .psyche-launcher[data-placement="corner"] { min-width: 44px; min-height: 44px; }
  .psyche .p-h .btn.icon { min-width: 44px; min-height: 44px; }
}
body.atlas-enhanced[data-atlas-scope="coven"] .plan-head .workspace-urgent { display: flex; }
body.atlas-enhanced[data-atlas-scope="coven"] .workspace-urgent .stop-ctl { display: none; }
#reviewQueue { box-sizing: border-box; width: min(28rem, calc(100vw - 20px)); max-height: calc(100dvh - 24px); margin: auto; padding: 16px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--foreground); background: var(--card); }
#reviewQueue[open] { display: flex; flex-direction: column; gap: 10px; }
#reviewQueue::backdrop { background: rgb(8 8 12 / 72%); }
#reviewQueue header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
#reviewQueue h2 { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; margin: 3px 0 0; }
#reviewQueue small, #queueTools label, #queueStatus, .queue-row span { color: var(--muted-foreground); font-size: 12px; }
#queueTools label { display: block; margin-bottom: 4px; }
#queueFilter { width: 100%; padding: 8px; background: var(--well); border: 1px solid var(--border); border-radius: 6px; color: var(--foreground); }
#queueStatus { margin: 0; overflow-wrap: anywhere; }
#queueList, #queueDetail { min-height: 0; overflow: auto; overscroll-behavior: contain; }
#queueList h3 { font-size: 12px; color: var(--primary-hi); margin: 12px 0 4px; }
.queue-row { display: grid; gap: 2px; text-align: start; width: 100%; min-height: 44px; padding: 8px; border-radius: 4px; overflow-wrap: anywhere; }
.queue-row b { font-weight: 550; }
.queue-row:hover, .queue-row:focus-visible { background: var(--card-raised); }
#queueDetail .cf { position: static; margin-top: 10px; border: 0; background: var(--well); box-shadow: none; }
#queueDetail .cf-l, #queueDetail .cf-r { padding-inline: 12px; }
#reviewQueue :focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (max-width: 600px) {
  #queueFilter { min-height: 44px; font-size: 16px; }
  #reviewQueue .btn { min-height: 44px; }
  body[data-atlas-scope="coven"] #needTxt .w { display: none; }
}
@container left (min-width: 720px) {
  body[data-atlas-scope="coven"] .need-ctl .attn .w { display: inline; position: static; width: auto; height: auto; opacity: 1; margin-inline-end: 5px; }
}

.mission-review { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; width: 100%; padding: 9px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--card-raised); text-align: left; }
.mission-review .an-t { min-width: 0; overflow-wrap: anywhere; }
.mission-review .an-go { padding-inline: 7px; }

#recordingPrompt { width: min(25rem, calc(100vw - 24px)); padding: 20px; }
#recordingPrompt > span, #bookmarkStatus { color: var(--primary); font-size: .85em; }
#recordingPrompt h2 { margin: 4px 0 8px; }
#recordingPrompt p { color: var(--muted-foreground); line-height: 1.5; }
#recordingPrompt #recordingPromptError { margin-top: 10px; color: var(--attention); }
#recordingPrompt .history-actions { margin-top: 16px; justify-content: flex-end; gap: 8px; }
#bookmarkStatus, #historySubject { flex-basis: 100%; }
#historySubject { overflow-wrap: anywhere; font-weight: 550; }
#historySubject:not([hidden]) + #historyMapNote { color: var(--muted-foreground); font-size: .9em; }
/* Mission creation keeps the outcome and lead in view while the brief stays editable. */
#empty .hd { background: var(--card); padding-block: 9px; }
#empty .hd-t { font-size: 1.08em; font-weight: 600; }
#empty #emptyName { margin-inline-start: auto; }
#empty .nm-l { color: var(--foreground); font-weight: 580; }
#empty .nm-f:focus-within { border-color: var(--primary); box-shadow: none; }
#empty .nm-f input:focus-visible { outline: none; }
#empty .nm-leads { grid-template-columns: repeat(2,minmax(0,1fr)); }
#empty .nm-lead { display: flex; flex-direction: row; gap: 7px; padding: 8px; text-align: start; min-height: 44px; background: var(--card); }
#empty .nm-lead[aria-checked=true] { border-color: var(--hue); background: color-mix(in srgb,var(--hue) 9%,var(--card)); }
#empty .nm-lead .avatar { flex: none; }
#empty .nm-lead-copy { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
#empty .nm-lead-copy b { font-weight: 550; color: var(--foreground); }
#empty .nm-lead-copy small, #nmLimits, #nmPermissions summary { color: var(--muted-foreground); font-size: .9em; }
#nmPermissions summary { cursor: pointer; padding-block: 5px; }
#empty .nm-terms { padding: 8px; border-radius: 6px; background: var(--card-raised); }
#empty .nm-terms li { grid-template-columns: 14px 4.4em 1fr; align-items: baseline; }
#empty .nm-terms svg { align-self: center; }
.nm-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#nmPreview { display: grid; gap: 4px; padding: 10px 12px; background: var(--card-raised); border-inline-start: 2px solid var(--primary); border-radius: 5px; overflow-wrap: anywhere; }
#nmOutput { font-weight: 550; }
#empty .dr-v { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
#empty .em-act { justify-content: space-between; flex-wrap: nowrap; }
#empty .em-act .nm-foot { flex: 1; line-height: 1.35; }
#empty .btn.pri { color: var(--primary-foreground); background: var(--primary); }
#empty .btn.pri:disabled { opacity: .55; }
@media (pointer:coarse), (max-width: 500px) {
  #empty :is(#nmCustomize, #nmPermissions summary) { min-height: 44px; align-content: center; }
}

.hud-group-summary { color: var(--muted-foreground); font-size: .85em; order: -1; }
body.atlas-enhanced.atlas-adaptive-mobile[data-mobile-overlay="psyche"]:has(#plan.atlas-group-selected) {
  --group-chat-height: min(46dvh, 26rem);
}
body.atlas-adaptive-mobile[data-mobile-overlay="psyche"]:has(#plan.atlas-group-selected) #psyche {
  height: var(--group-chat-height); min-height: 0; box-shadow: none;
}
body.atlas-adaptive-mobile[data-mobile-overlay="psyche"]:has(#plan.atlas-group-selected) #stage {
  height: min(var(--mobile-stage-height), calc(var(--app-height, 100dvh) - var(--group-chat-height) - 84px));
}
body.atlas-adaptive-mobile[data-mobile-layout="landscape"][data-mobile-overlay="psyche"]:has(#plan.atlas-group-selected) #psyche {
  inset-inline: auto 10px; transform: none; width: 46vw; height: calc(var(--app-height, 100dvh) - 20px);
}
body.atlas-adaptive-mobile[data-mobile-layout="landscape"][data-mobile-overlay="psyche"]:has(#plan.atlas-group-selected) #stage {
  width: min(100%, calc(54vw - 24px)); height: var(--mobile-stage-height);
}

/* Project directory and sample sizing share one panel and one navigation header. */
body.atlas-enhanced #atlasSidebar {
  --drawer-target: 36px;
  width: min(368px, calc(100% - 28px)); gap: 0; padding: 0;
  overflow: hidden; color: var(--foreground); background: var(--card);
}
#atlasSidebar [hidden] { display: none !important; }
#atlasSidebar .atlas-drawer-heading {
  position: static; flex: none; gap: 6px; min-width: 0; padding: 9px 12px;
  background: transparent; border-bottom: 1px solid var(--border);
}
#atlasSidebar .atlas-directory-title { display: flex; flex: 1; min-width: 0; align-items: center; gap: 7px; }
#atlasSidebar h2 { font-size: calc(15px * var(--fs, 1)); font-weight: 600; }
.atlas-project-count-badge {
  min-width: 22px; padding: 2px 5px; border-radius: 5px; background: var(--card-raised);
  color: var(--muted-foreground); font-size: .8em; text-align: center; font-variant-numeric: tabular-nums;
}
#atlasSidebar :is(#atlasNewProject, #atlasBrowseClose, #atlasLayoutBack, #atlasProjectClear) { min-height: var(--drawer-target); }
#atlasSidebar #atlasNewProject { width: auto; margin: 0; background: var(--primary); color: var(--primary-foreground, #17151e); font-weight: 600; }
#atlasSidebar :is(#atlasBrowseClose, #atlasLayoutBack, #atlasProjectClear) {
  min-width: var(--drawer-target); padding: 0; border-color: transparent; background: transparent; color: var(--muted-foreground);
}
#atlasSidebar :is(#atlasBrowseClose, #atlasLayoutBack, #atlasProjectClear):hover { background: var(--card-raised); color: var(--foreground); }
#atlasSidebar svg { flex: none; }
#atlasLayoutBack svg, .atlas-project-tools svg, .atlas-search-mark svg { display: block; width: 16px; height: 16px; }
.atlas-directory { display: flex; flex: 0 1 auto; flex-direction: column; min-height: 0; }
.atlas-project-search {
  display: flex; flex: none; align-items: center; gap: 7px; min-width: 0; margin: 12px 12px 6px;
  padding-inline: 10px 3px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--well);
}
.atlas-project-search:focus-within { border-color: var(--primary); }
.atlas-search-mark { color: var(--muted-foreground); }
#atlasSidebar input { color: var(--foreground); font: inherit; }
.atlas-project-search input {
  flex: 1; width: 0; min-width: 0; min-height: max(38px, var(--drawer-target)); padding: 0; border: 0; border-radius: 0; background: transparent;
}
.atlas-project-search input:focus { outline: 0; }
.atlas-project-search input::-webkit-search-cancel-button { appearance: none; }
.atlas-directory-results, .atlas-layout-simulation { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.atlas-directory-results { padding: 3px 10px 10px; }
body.atlas-enhanced #atlasProjects { display: grid; gap: 2px; max-height: none; overflow: visible; }
#atlasSidebar .atlas-project { align-items: start; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 4px 9px; border-radius: 7px; }
#atlasSidebar .atlas-project-icon { align-self: start; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 7px; background: var(--card-raised); }
#atlasSidebar .atlas-project[data-active="true"] .atlas-project-icon { color: var(--primary-hi); border-color: var(--border-strong); }
#atlasSidebar .atlas-project-copy b { font-size: calc(14px * var(--fs, 1)); font-weight: 600; line-height: 1.35; }
#atlasSidebar :is(.atlas-project-copy > span, .atlas-project-preview-names) { font-size: calc(12px * var(--fs, 1)); white-space: normal; line-height: 1.4; }
#atlasSidebar .atlas-project-preview-names { color: var(--muted-foreground); overflow-wrap: anywhere; }
#atlasSidebar .atlas-project-state { align-self: start; padding: 2px 5px; font-size: calc(11px * var(--fs, 1)); }
#atlasSidebar .atlas-project-state[data-state="attention"] { border-radius: 5px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary-hi); }
.atlas-project-tools { display: flex; flex: none; justify-content: space-between; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border); }
#atlasSidebar .atlas-project-tools button { min-height: var(--drawer-target); padding-inline: 8px; border-color: transparent; background: transparent; color: var(--muted-foreground); }
#atlasSidebar .atlas-project-tools button:hover { background: var(--card-raised); color: var(--foreground); }
.atlas-layout-simulation { padding: 16px; }
.atlas-layout-simulation h3, .atlas-layout-custom label { margin: 0; font-size: calc(12px * var(--fs, 1)); font-weight: 600; }
.atlas-layout-facts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-variant-numeric: tabular-nums; }
.atlas-layout-facts strong { font-size: calc(16px * var(--fs, 1)); font-weight: 600; }
#atlasSampleCount { font-size: .85em; color: var(--primary-hi); }
#atlasCountMinimum { grid-column: 1 / -1; color: var(--muted-foreground); font-size: calc(11px * var(--fs, 1)); }
.atlas-layout-help, #atlasLayoutStatus { color: var(--muted-foreground); font-size: calc(12px * var(--fs, 1)); line-height: 1.5; }
.atlas-layout-help { margin: 5px 0 18px; }
.atlas-layout-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(44px, 100%), 1fr)); gap: 4px; margin: 6px 0 16px; }
#atlasSidebar .atlas-layout-presets button { min-width: 0; min-height: var(--drawer-target); padding-inline: 2px; font-variant-numeric: tabular-nums; }
#atlasSidebar .atlas-layout-presets [aria-pressed="true"] { border-color: var(--primary); background: var(--card-raised); color: var(--primary-hi); }
.atlas-layout-custom { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.atlas-layout-custom label { grid-column: 1 / -1; }
#atlasSidebar .atlas-layout-custom input { min-width: 0; width: 100%; min-height: var(--drawer-target); padding-inline: 10px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--well); }
#atlasSidebar :is(.atlas-layout-custom button, #atlasResetLayout) { min-height: var(--drawer-target); }
#atlasResetLayout { margin-top: 12px; }
#atlasLayoutStatus:empty { display: none; }
@media (max-width: 1100px), (pointer: coarse) {
  #atlasSidebar input { font-size: max(16px, 1em); }
  body.atlas-enhanced #atlasSidebar { --drawer-target: 44px; width: min(480px, calc(var(--viewport-width, 100vw) - 24px)); }
}
@media (max-height: 500px) {
  #atlasSidebar .atlas-drawer-heading, .atlas-project-tools { padding-block: 3px; }
  .atlas-project-search { margin-block: 5px; }
}
@media (max-height: 300px) {
  body.atlas-enhanced #atlasSidebar { display: block; overflow-y: auto; }
  body.atlas-enhanced #atlasSidebar[hidden] { display: none; }
  .atlas-directory-results, .atlas-layout-simulation { overflow: visible; }
}

/* Trace keeps the switcher in reach while each view owns its scroll area. */
#traceBody {
  --trace-type: calc(13px * var(--fs, 1) * var(--fsl, 1));
  font-size: var(--trace-type); background: var(--card); border: 1px solid var(--border-strong);
  overflow: hidden; gap: 0; padding: 0; border-radius: 10px;
}
.trace-heading, .trace-nav { flex: none; }
.trace-heading { display: flex; align-items: center; gap: 8px; padding: 13px 14px 9px; }
.trace-heading svg, .trace-kind svg, #traceDrop svg { display: block; width: 16px; height: 16px; color: var(--primary-hi); }
.trace-heading h2 { font-size: 1.15em; font-weight: 600; }
#traceChip { margin-inline-start: auto; color: var(--muted-foreground); background: var(--card-raised); border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; font-size: .9em; }
.trace-nav { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 2px; padding: 3px; margin: 0 12px 9px; background: var(--well); border: 1px solid var(--border); border-radius: 8px; }
.trace-nav button { min-height: 32px; min-width: 0; color: var(--muted-foreground); border-radius: 5px; }
.trace-nav button[aria-pressed="true"] { color: var(--primary-hi); background: var(--primary-soft); font-weight: 600; }
.trace-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; border-top: 1px solid var(--border); }
.trace-page { display: grid; gap: 10px; padding: 14px; min-width: 0; }
.trace-page h3, .trace-caption label { font-size: 1em; font-weight: 600; }
.trace-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 8px; }
.trace-chart { padding: 10px; background: var(--well); border: 1px solid var(--border); border-radius: 8px; }
.trace-chart .density { margin: 10px 0 5px; height: 40px; }
#traceSaved:empty { display: none; }
#traceInfo, .trace-hint, #traceEmpty { color: var(--muted-foreground); font-size: .94em; }
#traceLegend { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(120px,100%),1fr)); gap: 6px; margin-top: 8px; }
#traceLegend .trace-kind { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; padding: 8px 9px; text-align: start; border: 1px solid var(--border); background: var(--card-raised); border-radius: 7px; }
#traceLegend .trace-kind:hover, #traceDrop:hover { border-color: var(--primary); }
.trace-kind strong { font-variant-numeric: tabular-nums; }
.trace-meter { grid-column: 1 / -1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.trace-meter::before { content: ""; display: block; width: var(--share); height: 100%; background: var(--primary); }
.trace-kind[data-kind="Gates"] .trace-meter::before { background: var(--attention); }
#traceFilter { min-height: 34px; max-width: 100%; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 6px; font: inherit; color: var(--foreground); background: var(--card-raised); }
#traceEv .ev + .ev { border-top: 1px solid var(--border); }
#traceEv summary { min-height: 44px; margin: 0; padding: 4px; gap: 8px; }
.trace-event-copy { min-width: 0; flex: 1; display: grid; overflow-wrap: anywhere; }
.trace-event-copy strong { font-weight: 500; }
.trace-event-copy > span, #traceEv time { color: var(--muted-foreground); font-size: .88em; }
#traceEv .q .trace-event-copy strong { color: var(--attention); }
#traceDrop { min-height: 60px; gap: 6px; flex-wrap: wrap; background: var(--primary-soft); border-color: var(--border-strong); }
#traceDrop strong { color: var(--primary-hi); }
#traceDrop:focus-within { outline: 2px solid var(--ring); outline-offset: 1px; }
#traceDrop.over { border-color: var(--primary); }
#traceSample { max-width: 100%; min-width: 0; margin: 0; }
#traceReset { justify-self: start; }
@media (pointer: coarse), (max-width: 600px) {
  .trace-nav button, .trace-kind, #traceFilter, #traceLoad button { min-height: 44px; }
}
@media (max-height: 450px) {
  #traceBody { display: block; overflow: auto; }
  .trace-scroll { overflow: visible; }
}

#traceBody:popover-open { position: fixed; inset: auto; margin: 0; color: var(--foreground); }
#traceBody:not(:popover-open)[popover] { display: none; }
#traceClose { flex: none; width: 32px; height: 32px; border-radius: 6px; font: inherit; font-size: 1.3em; color: var(--muted-foreground); }
#traceBody button + button::before { display: none; }
@media (pointer: coarse) { #traceClose { width: 44px; height: 44px; } }
