/* Shared workspace backdrop and popup surfaces.
   Loaded by the app AND IAMCapsule; this file owns background only.
   Keep light/midnight palettes and all compact capsule geometry independent. */
:root:not([data-theme="light"]):not([data-theme="midnight"]) {
  --ambient-base:#16171a;
  --ambient-image:
    radial-gradient(760px 420px at 8% 0%,rgba(255,255,255,.055) 0%,rgba(255,255,255,0) 60%),
    radial-gradient(640px 400px at 94% 12%,rgba(255,255,255,.040) 0%,rgba(255,255,255,0) 60%),
    radial-gradient(700px 460px at 55% 108%,rgba(255,255,255,.032) 0%,rgba(255,255,255,0) 62%);
  --ambient-background:var(--ambient-image),var(--ambient-base);
}
/* Workspace glow stays behind the content, never on a popup or its children. */
:root:not([data-theme="light"]):not([data-theme="midnight"]) :is(
  #app-sheet,#app-sidebar,#split-pane,.main-area,.login-box
) {
  background:var(--ambient-background)!important;
}
/* The parent owns the backdrop, so pages neither cover it nor double it. */
:root:not([data-theme="light"]):not([data-theme="midnight"]) :is(#page-home,#page-trail) {
  background:transparent!important;
}
:root:not([data-theme="light"]):not([data-theme="midnight"]) :is(.sheet-wall,.fg-wall,.cal-wall,.prof-wall) {
  display:none!important;
}
/* Canonical popup palette, shared with the isolated capsule (tokens.css is
   intentionally disabled there). Dark matches the supplied Path card #1f2024.
   Always opaque: the same color regardless of the content behind the popup. */
:root { --popup-surface:#1f2024; }
:root[data-theme="light"] { --popup-surface:#ffffff; }
:root[data-theme="midnight"] { --popup-surface:#13171f; }
/* New popup roots opt in with data-iam-popup. The explicit legacy map excludes
   scrims, fields, buttons, ordinary cards and workspace/sidebar backgrounds.
   Important is needed for legacy inline styles and the frozen capsule CSS. */
:root :is(
  [data-iam-popup],.detail-panel,.modal,.wizard-box,.ct-sheet,
  .fg-sheet,.sec-sheet,.mob-menu-sheet,.bn-submenu,
  .ctx-menu,.ai-popup,.cal-popup,.cal-task-popup,.cal-focus-popup,
  .cal-filter-pop,.dp-cal-popup,.ctp-pop,.et-alert,
  .cl-popup,.cl-task-popup,.fxp,.nf-card,#fpm-pop,.uic-box,.trail-dialog,.path-card.path-open,
  .acc-tb-popup,#ti-tb-popup,#proj-add-menu,#note-add-menu,
  .toast,#ms-toast,#ms-bar
) {
  background:var(--popup-surface)!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
}
/* Time-wheel fades must blend into their popup, not the old raised surface. */
:root .et-wheel-wrap::before { background:linear-gradient(180deg,var(--popup-surface) 30%,transparent); }
:root .et-wheel-wrap::after { background:linear-gradient(0deg,var(--popup-surface) 30%,transparent); }
