/* The actual module stays mounted. Only its visual pose becomes a miniature. */
body:is(:not(.mobile-stack),.spatial-workspace) .win-module.minimized.spatial-mini {
  display:flex !important; position:absolute !important;
  left:var(--mini-x) !important; top:var(--mini-y) !important;
  width:var(--mini-width) !important; height:var(--mini-height) !important;
  min-width:0 !important; min-height:0 !important;
  transform:scale(var(--mini-scale)) !important; transform-origin:0 0;
  z-index:var(--mini-z,3) !important; pointer-events:none !important;
  opacity:1; transition:none !important; overflow:hidden;
}
body:is(:not(.mobile-stack),.spatial-workspace) .spatial-mini .win-header,
body:is(:not(.mobile-stack),.spatial-workspace) .spatial-mini .resize-handle { visibility:hidden; }
body:is(:not(.mobile-stack),.spatial-workspace) .spatial-mini.privacy-blurred .win-body { visibility:hidden; }
body:is(:not(.mobile-stack),.spatial-workspace) .spatial-mini.spatial-concealed { visibility:hidden !important; }
.spatial-ui { position:absolute; inset:0; pointer-events:none; }
body.mobile-stack:not(.spatial-workspace) .spatial-ui { display:none; }
.spatial-bubble,.spatial-stack,.spatial-edge { position:absolute; box-sizing:border-box; pointer-events:auto; color:var(--text-main); }
.spatial-bubble { width:148px; height:112px; border:1px solid var(--accent-cyan); border-radius:12px;
  background:transparent; box-shadow:0 5px 20px #0005; z-index:4; overflow:hidden; }
.spatial-bubble:hover,.spatial-bubble:focus-within { border-color:var(--accent-gold); }
.spatial-bubble button,.spatial-stack button,.spatial-edge { font:600 12px Inter,sans-serif; border:0;
  cursor:pointer; touch-action:none; color:inherit; min-width:0; min-height:0; }
.spatial-bubble .spatial-restore { position:absolute; inset:0; width:100%; background:transparent; text-align:left;
  padding:0; display:flex; align-items:flex-start; }
.spatial-restore span { display:block; width:100%; padding:6px 27px 6px 7px; overflow:hidden; white-space:nowrap;
  text-overflow:ellipsis; background:var(--surface-raise,#101b2b); }
.spatial-bubble .spatial-close { position:absolute; right:0; top:0; width:26px; height:26px;
  background:var(--surface-raise,#101b2b); }
.spatial-stack { z-index:5; pointer-events:none; }
.spatial-stack button { pointer-events:auto; height:26px; border:1px solid var(--accent-cyan);
  border-radius:7px; background:var(--surface-raise,#101b2b); padding:3px 8px; }
.spatial-stack .spatial-ungroup { margin-left:4px; }
.spatial-page-nav { display:flex; align-items:center; justify-content:center; gap:9px; margin-top:4px; height:28px; color:var(--text-main); font:500 12px Inter,sans-serif; }
.spatial-page-nav button { min-width:32px; padding:2px 8px; }
.spatial-page-nav button:disabled { opacity:.4; cursor:default; }
.spatial-edge { z-index:12000; border:1px solid var(--accent-cyan); border-radius:8px;
  background:var(--surface-raise,#101b2b); padding:6px 8px; max-width:170px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.spatial-bubble.spatial-dragging { z-index:22000; }
.spatial-drop-target { outline:2px solid var(--accent-gold); outline-offset:3px; }
.spatial-ui button:focus-visible { outline:2px solid var(--accent-gold); outline-offset:2px; }
@media (prefers-reduced-motion:no-preference) {
  .spatial-bubble { transition:box-shadow .15s ease; }
}
/* One workspace; phone styles only adapt content and touch geometry. The dock
   plane belongs to the full-height body, never iOS's shorter fixed viewport. */
body.spatial-workspace { position:relative; height:100vh; height:100dvh; }
body.spatial-workspace #desktop-canvas { display:block; flex:1 1 auto; min-height:0; overflow:clip; scroll-snap-type:none; }
body.spatial-workspace #pager-current-label { display:none !important; }
body.spatial-workspace .win-header,body.spatial-workspace .resize-handle { touch-action:none; }
.scan-dock-plane { position:absolute; inset:0; pointer-events:none; z-index:2500; }
body.spatial-workspace .mac-dock-wrapper.spatial-dock {
  position:absolute !important; bottom:auto !important; right:auto !important;
  transform:none !important; width:max-content !important;
  max-width:var(--dock-max-width); max-height:var(--dock-max-height);
  display:flex; flex-direction:row; align-items:center; gap:4px;
  padding:5px; margin:0; border:1px solid var(--border-color,#ffffff25);
  border-radius:14px; background:var(--surface-raise,#101b2b);
  box-shadow:0 8px 28px #0005; pointer-events:auto; box-sizing:border-box;
}
.spatial-dock[hidden],.dock-edge-handle[hidden] { display:none !important; }
.spatial-dock .mac-dock { display:flex; min-width:0; min-height:0; max-width:100%; overflow:auto; scrollbar-width:none; flex:1 1 auto; }
.spatial-dock .mac-dock::-webkit-scrollbar { display:none; }
.dock-placement-controls { display:flex; flex-direction:column; flex:0 0 auto; gap:2px; }
.dock-placement-controls button,.dock-edge-handle { color:var(--text-main,#edf6ff); background:var(--surface-raise,#101b2b); border:1px solid var(--border-color,#ffffff25); border-radius:7px; cursor:pointer; font:600 12px Inter,sans-serif; }
.dock-placement-controls button { width:30px; height:26px; padding:0; touch-action:none; }
.dock-edge-handle { position:absolute; pointer-events:auto; padding:9px 12px; }
body.spatial-workspace .spatial-dock:is([data-edge="left"],[data-edge="right"]) { flex-direction:column; }
.spatial-dock:is([data-edge="left"],[data-edge="right"]) .dock-placement-controls { flex-direction:row; }
.spatial-dock:is([data-edge="left"],[data-edge="right"]) .mac-dock { flex-direction:column; overflow-x:hidden; max-height:calc(var(--dock-max-height) - 48px); }
.spatial-dock:is([data-edge="left"],[data-edge="right"]) .dock-separator { width:26px; height:1px; margin:4px auto; }
.scan-dock-plane button:focus-visible { outline:2px solid var(--accent-gold,#ffd166); outline-offset:2px; }
@media (pointer:coarse) {
  .dock-placement-controls button { width:40px; height:32px; }
  .dock-edge-handle { min-height:44px; }
}

.search-toolbar-plane { position:absolute; inset:0; pointer-events:none; z-index:2502; }
.workspace-chrome-panel { position:relative; flex:0 0 auto; min-width:0; }
.chrome-toolbar-plane { position:fixed; inset:0; pointer-events:none; z-index:2503; }
.workspace-chrome-panel[hidden],.chrome-edge-handle[hidden],.chrome-placement-controls button[hidden] { display:none !important; }
.chrome-placement-controls { position:absolute; left:1px; top:50%; right:auto; bottom:auto; transform:translateY(-50%); display:flex; align-items:center; gap:2px; z-index:2001; border-radius:5px; pointer-events:auto; }
.chrome-placement-controls button,.chrome-edge-handle { box-sizing:border-box; color:var(--text-main); background:var(--surface-raise,#101b2b); border:1px solid var(--card-border); border-radius:5px; font:600 11px Inter,sans-serif; cursor:pointer; }
.chrome-placement-controls button { flex:0 0 auto; width:24px; height:24px; padding:2px; }
.chrome-placement-controls button:first-child { cursor:grab; width:16px; opacity:.6; touch-action:none; }
.chrome-placement-controls button:not(:first-child) { display:none; }
.chrome-placement-controls:hover,.chrome-placement-controls:focus-within { padding:2px; background:var(--surface-raise,#101b2b); box-shadow:0 3px 12px #0008; }
.chrome-placement-controls:hover button,.chrome-placement-controls:focus-within button { display:block; opacity:1; }
.chrome-edge-handle { position:absolute; pointer-events:auto; padding:7px 10px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chrome-floating { position:absolute; box-sizing:border-box; pointer-events:auto; overflow:auto; border:1px solid var(--accent-cyan); border-radius:9px; background:var(--bg-panel,#0b111c); box-shadow:0 8px 28px #0008; padding-top:30px; }
.chrome-floating .chrome-placement-controls { top:2px; left:3px; transform:none; }
.chrome-floating .chrome-placement-controls button { display:block; opacity:1; }
.chrome-floating > .top-os-bar { min-width:0; padding-top:6px !important; }
.chrome-floating > .top-os-bar .omnibox-wrap { flex:1 1 100%; }
.chrome-floating > .top-os-bar { flex-wrap:wrap; }
.chrome-floating > :is(.ticker-bar,.mini-favs-watchlist-bar,.top-os-dock) { max-width:100%; }
.chrome-placement-controls button:focus-visible,.chrome-edge-handle:focus-visible { outline:2px solid var(--accent-gold); outline-offset:2px; }
@media (pointer:coarse) {
  .chrome-placement-controls button { height:32px; width:30px; }
  .chrome-placement-controls button:first-child { width:18px; }
  .chrome-floating { padding-top:36px; }
  .chrome-edge-handle { min-height:36px; }
}
.search-placement-controls { display:flex; flex:0 0 auto; align-items:center; gap:2px; }
.search-placement-controls button,.search-edge-handle { color:var(--text-main); background:var(--surface-raise,#101b2b); border:1px solid var(--card-border); border-radius:6px; font:600 12px Inter,sans-serif; cursor:pointer; }
.search-placement-controls button { padding:3px; width:24px; height:26px; touch-action:none; }
.search-placement-controls button[hidden],.search-edge-handle[hidden],.omnibox-wrap[hidden] { display:none !important; }
.search-edge-handle { position:absolute; pointer-events:auto; padding:9px 12px; }
body .omnibox-wrap.floating-search { position:absolute; box-sizing:border-box; width:var(--search-width); max-width:100%; margin:0; padding:6px; gap:3px; flex-wrap:wrap; background:var(--surface-raise,#101b2b); border:1px solid var(--accent-cyan); border-radius:10px; box-shadow:0 8px 28px #0005; pointer-events:auto; }
body .floating-search #scan-omnibox { flex:1 1 180px; width:0; min-width:0; max-width:100%; }
.search-placement-controls button:focus-visible,.search-edge-handle:focus-visible,.resize-handle:focus-visible { outline:2px solid var(--accent-gold); outline-offset:2px; }
@media (pointer:coarse) {
  .search-placement-controls button { height:32px; width:30px; }
  .search-edge-handle { min-height:44px; }
}

/* Layers preserve window DOM; concealed content is not a separate identity or
   storage boundary. These rules also cover the actual minimized live preview. */
body.spatial-workspace .win-module.layer-hidden,
body.spatial-workspace .win-module.minimized.spatial-mini.layer-hidden { display:none !important; }
body.spatial-workspace .win-module.layer-concealed .win-body { visibility:hidden !important; }
body.spatial-workspace .win-module.layer-concealed .win-title { visibility:hidden; }
body.spatial-workspace .win-module.layer-concealed .win-title::after { content:'Concealed window'; visibility:visible; position:absolute; left:12px; }
body.spatial-workspace .win-module.spatial-mini.layer-concealed .win-title::after,
body.spatial-workspace .win-module.spatial-mini.layer-concealed .layer-conceal-cover { visibility:hidden; }
body.spatial-workspace .win-module.layer-pinned:not(.minimized) { z-index:1800 !important; }
body.spatial-workspace .win-module.layer-pinned.active-win:not(.minimized) { z-index:1801 !important; }
.layer-conceal-cover { position:absolute; inset:46px 0 0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:20px; text-align:center; background:var(--surface-raise,#101b2b); color:var(--text-muted); }
.layer-conceal-cover button { padding:8px 12px; border:1px solid var(--accent-cyan); border-radius:8px; background:transparent; color:var(--text-main); cursor:pointer; }
.workspace-layer-controls { position:absolute; display:flex; gap:4px; width:max-content; right:calc(8px + var(--sar,0px)); bottom:calc(8px + var(--sab,0px)); z-index:12003; max-width:calc(100% - 16px); font:500 13px Inter,sans-serif; color:var(--text-main,#edf6ff); }
.workspace-layer-grip { touch-action:none; cursor:grab !important; }
.workspace-layer-controls button,.workspace-layer-controls input,.workspace-layer-controls select { font:inherit; color:inherit; border:1px solid var(--border-color,#ffffff25); border-radius:8px; background:var(--surface-raise,#101b2b); padding:7px 9px; min-width:0; min-height:0; box-sizing:border-box; }
.workspace-layer-controls button { cursor:pointer; }
.workspace-layer-controls button:disabled { opacity:.45; cursor:default; }
.workspace-layer-controls :is(button,input,select):focus-visible { outline:2px solid var(--accent-gold,#ffd166); outline-offset:2px; }
.workspace-layer-trigger { max-width:220px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; box-shadow:0 4px 18px #0005; }
#workspace-layer-panel { position:absolute; right:0; bottom:calc(100% + 8px); width:min(380px,calc(100vw - 16px - var(--sal,0px) - var(--sar,0px))); max-height:calc(100dvh - 90px - var(--sat,0px) - var(--sab,0px)); overflow:auto; overscroll-behavior:none; box-sizing:border-box; padding:12px; border:1px solid var(--accent-cyan); border-radius:14px; background:var(--surface-raise,#101b2b); box-shadow:0 16px 60px #0008; }
#workspace-layer-panel[hidden] { display:none; }
#workspace-layer-panel header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.workspace-layer-wheel { display:flex; flex-wrap:wrap; gap:5px; padding-bottom:12px; }
.workspace-layer-wheel [aria-pressed=true] { color:var(--accent-cyan); border-color:var(--accent-cyan); }
.workspace-layer-edit,.workspace-layer-create { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:12px; }
.workspace-layer-edit > input,.workspace-layer-create > input { flex:1 1 160px; width:0; }
.workspace-layer-edit label { display:flex; align-items:center; gap:7px; flex:1 1 100%; }
.workspace-layer-edit input[type=checkbox] { flex:0 0 16px; width:16px; height:16px; padding:0; margin:0; accent-color:var(--accent-cyan); }
.workspace-layer-window-list { border-top:1px solid var(--border-color,#ffffff25); padding-top:10px; }
.workspace-layer-window { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px; padding-bottom:10px; }
.workspace-layer-window > button:first-child { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; text-align:left; }
.workspace-layer-window > select { grid-column:1 / -1; width:100%; }
.workspace-layer-note { font-size:11px; line-height:1.5; color:var(--text-muted); margin:10px 0 0; }

/* Inactive layers use their original mounted windows as previews. The preview
   transform never writes their saved left/top/width/height or reparents content. */
body.spatial-workspace #desktop-canvas .win-module.layer-preview {
  display:flex !important; position:absolute !important; visibility:visible !important;
  left:var(--layer-preview-x) !important; top:var(--layer-preview-y) !important; right:auto !important; bottom:auto !important;
  width:var(--layer-preview-width) !important; height:var(--layer-preview-height) !important;
  min-width:0 !important; min-height:0 !important; max-width:none !important; max-height:none !important;
  transform:scale(var(--layer-preview-scale)) rotate(var(--layer-preview-angle)) !important; transform-origin:0 0 !important;
  z-index:var(--layer-preview-z,2) !important; pointer-events:none !important; opacity:.8;
  overflow:hidden !important; transition:none !important;
}
body.spatial-workspace #desktop-canvas .win-module.layer-preview .win-header,
body.spatial-workspace #desktop-canvas .win-module.layer-preview .resize-handle { visibility:hidden !important; }
body.spatial-workspace #desktop-canvas .win-module.layer-preview.privacy-blurred .win-body { visibility:hidden !important; }
.workspace-layer-bundles { position:absolute; inset:0; pointer-events:none; --bundle-handle-height:34px; --bundle-control-size:26px; }
:root[data-scale-tier="large"] .workspace-layer-bundles { --bundle-handle-height:44px; --bundle-control-size:44px; }
:root[data-scale-tier="xl"] .workspace-layer-bundles { --bundle-handle-height:48px; --bundle-control-size:48px; }
#desktop-empty-hint[hidden] { display:none !important; }
.workspace-layer-bundle { position:absolute; z-index:5; pointer-events:none; }
.workspace-layer-bundle[hidden] { display:none; }
/* Docked controls and their revealed original previews must clear working
   windows. Free bundles retain their background placement. */
.workspace-layer-bundle:not([data-edge="free"]) { z-index:12004; }
.workspace-layer-bundle[data-moving=true] { z-index:22004; }
.workspace-layer-bundle button { color:var(--text-main,#edf6ff); font:600 .875rem Inter,sans-serif; border:1px solid var(--border-color,#ffffff25); border-radius:10px; cursor:pointer; touch-action:none; pointer-events:auto; }
/* This component owns measured 44/48px comfort targets. A second rem-based
   global floor must not make its buttons taller than their calculated frames. */
body.spatial-workspace .workspace-layer-bundle button { min-height:0 !important; }
.workspace-layer-bundle button[hidden] { display:none !important; }
.workspace-bundle-open { position:absolute; inset:0; background:transparent; padding:0; overflow:hidden; }
.workspace-bundle-open:hover,.workspace-bundle-open:focus-visible { border-color:var(--accent-cyan); }
.workspace-bundle-caption { position:absolute; bottom:0; left:0; right:0; min-height:calc(var(--bundle-control-size) + 8px); box-sizing:border-box; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; background:var(--surface-raise,#101b2b); padding:8px calc(var(--bundle-control-size) + 8px) 8px 10px; text-align:left; }
.workspace-bundle-placeholder { position:absolute; inset:24px 10px 38px; display:grid; place-items:center; color:var(--text-muted); }
.workspace-bundle-grip,.workspace-bundle-tuck { position:absolute; right:4px; width:var(--bundle-control-size); height:var(--bundle-control-size); padding:0; background:var(--surface-raise,#101b2b); }
.workspace-bundle-grip { bottom:4px; cursor:grab !important; }
.workspace-bundle-tuck { top:4px; }
.workspace-bundle-peek { position:absolute; inset:0; width:100%; padding:6px 9px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; background:var(--surface-raise,#101b2b); }
.workspace-layer-bundle[data-concealed=true] .workspace-bundle-open { background:var(--surface-raise,#101b2b); border-style:dashed; }
.workspace-layer-bundle button:focus-visible { outline:2px solid var(--accent-gold,#ffd166); outline-offset:2px; }
