/* Optional detail-depth styling. Do not replace the existing spatial world. */
.swb-workbench {
  --swb-glass: rgba(74, 50, 30, .48);
  --swb-line: rgba(215, 183, 127, .32);
  color: inherit;
  max-width: 100%;
  min-width: 0;
  padding: clamp(.8rem, 2.5vw, 1.6rem);
  overflow-wrap: anywhere;
}
.swb-workbench nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .8rem 0 1.1rem;
}
.swb-workbench button {
  touch-action: manipulation;
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid var(--swb-line);
  border-radius: 1.2rem;
  background: var(--swb-glass);
  color: inherit;
  cursor: pointer;
}
.swb-workbench button:focus-visible, .swb-workbench textarea:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}
.swb-workbench .swb-artifact, .swb-workbench .swb-compare {
  border-inline-start: 2px solid var(--swb-line);
  padding: .6rem 1rem;
  margin-block: .8rem;
  background: linear-gradient(90deg, var(--swb-glass), transparent);
  border-radius: 0 .8rem .8rem 0;
}
.swb-workbench pre {
  max-height: min(35vh, 340px);
  padding: .7rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  border-inline-start: 2px solid var(--swb-line);
  font-size: .9em;
}
.swb-workbench textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 10rem;
  max-height: 55vh;
  resize: vertical;
  color: inherit;
  background: var(--swb-glass);
  border: 1px solid var(--swb-line);
  border-radius: .85rem;
  padding: .8rem;
}
.swb-workbench .swb-kicker {letter-spacing:.09em; text-transform: uppercase; font-size:.78em;}
.swb-workbench .swb-boundary {opacity:.86; font-size:.9em;}
@media (min-width: 800px) {
 .swb-workbench nav {gap: 1rem}
 .swb-workbench .swb-compare {display:inline-block;width:29%;vertical-align:top;box-sizing:border-box;margin-right:1%;}
}
@media (prefers-reduced-motion: reduce) {
 .swb-workbench * {scroll-behavior:auto!important;transition:none!important;}
}

/* Optional R128 depth-only overlay. No new global app destination. */
.sd-workbench-launch{position:absolute;right:clamp(16px,3vw,44px);top:86px;z-index:65;min-height:44px;padding:10px 16px;border:1px solid #d7b77f80;border-radius:28px;background:#37291be8;color:#f2e8d8;font:inherit;pointer-events:auto;}
.sd-workbench-launch[hidden], .swb-workbench[hidden]{display:none!important;}
:is(#shadow-shared-spatial-world,#shadow-matter-world) .swb-workbench:not([hidden]){position:absolute;inset:76px 12px 74px;z-index:66;pointer-events:auto;overflow:auto;overscroll-behavior:contain;max-width:none;background:radial-gradient(ellipse at 70% 15%,#503a26bb,transparent 60%),#1b150ff5;color:#f2e8d8;border-radius:28px;backdrop-filter:blur(22px);font:400 15px/1.6 system-ui,sans-serif;padding:18px clamp(16px,4vw,46px);}
:is(#shadow-shared-spatial-world,#shadow-matter-world) .swb-workbench h2{font-weight:400;font-size:clamp(25px,5vw,42px);line-height:1.2;letter-spacing:-.03em;}
:is(#shadow-shared-spatial-world,#shadow-matter-world) .swb-workbench pre{font:inherit;line-height:1.6;}
@media (prefers-reduced-motion:reduce){.sd-workbench-launch,.swb-workbench,.swb-workbench *{animation:none!important;transition:none!important}}

#shadow-matter-world .sd-workbench-launch{
 top:calc(var(--ss-header-clearance,68px) + 8px);
 left:16px;right:auto;max-width:calc(100% - 32px);
}
:is(#shadow-shared-spatial-world,#shadow-matter-world) .swb-workbench:not([hidden]){
 top:calc(var(--ss-header-clearance,68px) + 8px);
 bottom:calc(var(--ss-controls-clearance,66px) + 8px);
 min-height:0;
}

/* R138: user-visible native authentication feedback above the account actions.
   The status remains in the same Matter instead of hiding in legacy panels. */
.mw-recovery .mw-native-account-status-r138 {
  display:block; margin:10px 0 12px; padding:10px 0;
  font-size:clamp(13px,1.45rem,17px); line-height:1.45;
  color:#f2dfc0; font-weight:550; overflow-wrap:anywhere;
  border-bottom:1px solid rgba(201,164,102,.32);
}
.mw-recovery .mw-native-account-status-r138:empty{display:none}

/* R13: one existing workbench unfolds over the current Matter; chat remains its sibling. */
#shadow-matter-world .ls-instruments .sd-workbench-launch{position:static;inset:auto;max-width:none;min-height:44px;margin:0;padding:9px 12px;font-size:12px;line-height:1.2;border-radius:12px;white-space:normal}
#shadow-matter-world[data-workbench-surface="living"] .ls-world{filter:blur(2px);opacity:.38;pointer-events:none}
#shadow-matter-world[data-workbench-surface="living"] .swb-workbench:not([hidden]){inset:76px 14px 85px;z-index:66;max-width:calc(100% - 28px);background:linear-gradient(135deg,#203c43e8,#151e29f5);border:1px solid #9cb8bd48;box-shadow:0 18px 60px #0005}
#shadow-matter-world[data-workbench-surface="living"]:has(.ls-chat[data-mode="split"]) .swb-workbench:not([hidden]){right:39%;max-width:none}
@media(max-width:980px) and (min-width:641px){#shadow-matter-world[data-workbench-surface="living"]:has(.ls-chat[data-mode="split"]) .swb-workbench:not([hidden]){right:47%}}
@media(max-width:640px){#shadow-matter-world[data-workbench-surface="living"]:has(.ls-chat[data-mode="split"]) .swb-workbench:not([hidden]){right:12px;bottom:49%;max-width:calc(100% - 24px);padding:12px}}
