/* SRD OS | ONE FRAME, MANY WORKROOMS | 2026-10-17
   Desktop shell remains fixed; all vertical work scroll happens inside the
   existing workroom frame. Colour/geometry still plug into the THEMA box.
   Nothing below this rule changes business routes, tables, forms or permissions. */
@media (min-width: 801px) and (min-height: 620px) {
  html:has(body.srd-os-workspace[data-srd-frame-scroll="1"]) {
    height:100%; overflow:hidden!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] {
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] > .srd-os-shell-topbar {
    position:relative!important;
    top:auto!important;
    flex:none;
    z-index:90;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell {
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
    place-items:unset!important;
    height:calc(100dvh - var(--srd-frame-topbar-height, 70px))!important;
    min-height:0!important;
    max-height:calc(100dvh - var(--srd-frame-topbar-height, 70px))!important;
    overflow:hidden!important;
    padding-bottom:var(--srd-frame-outer-padding-bottom, 18px)!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > .srd-frontdoor-card--wide {
    box-sizing:border-box!important;
    /* A padded SCROLLPORT exposes content in front of the pinned header.
       Put padding after the pinned header: no bleed-through at its top. */
    padding-block-start:0!important;
    flex:1 1 auto;
    min-height:0!important;
    max-height:100%!important;
    overflow-y:auto!important;
    overflow-x:hidden;
    overscroll-behavior-y:contain;
    scrollbar-gutter:stable;
    scroll-behavior:auto;
    align-content:start;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > .srd-frontdoor-card--wide > .srd-frame-pin-head {
    position:sticky!important;
    top:0!important;
    z-index:51!important;
    margin-top:0;
    isolation:isolate;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > .srd-frontdoor-card--wide > .srd-frame-pin-nav {
    position:sticky!important;
    top:var(--srd-frame-pin-height, 0px)!important;
    z-index:50!important;
    isolation:isolate;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > .srd-frontdoor-card--wide > [data-srd-pin-transparent="1"] {
    background:var(--wash-panel)!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > .srd-frontdoor-card--wide table {
    max-width:100%;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > .srd-frontdoor-card--wide :is(.srd-k03-table-wrap,.srd-k06-table-wrap,.tr-table-wrap,[data-srd-part="list-body"]) {
    overscroll-behavior-y:contain;
  }
}
/* Touch/soft keyboard mode: do not trap document scroll or cover editors. */
@media (max-width: 800px), (max-height: 619px) {
  body.srd-os-workspace[data-srd-frame-scroll="1"] .srd-frame-pin-head,
  body.srd-os-workspace[data-srd-frame-scroll="1"] .srd-frame-pin-nav {
    position:static;
  }
}

/* WASSTRAAT | WORKROOM FRAME 1
   Alternative/legacy room shells connect using two semantic plugs:
   :is(main,section)[data-srd-ui="workroom-frame-1"] = fixed cockpit scaffold;
   child[data-srd-ui="workroom-scroll-1"] = sole vertically scrolling list.
   No per-page CSS, selector or repeated paint definitions. */
@media (min-width: 801px) and (min-height: 620px) {
  body.srd-os-workspace[data-srd-frame-scroll="1"] :is(main,section)[data-srd-ui="workroom-frame-1"] {
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
    flex-wrap:nowrap!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
    height:calc(100dvh - var(--srd-frame-topbar-height, 70px))!important;
    min-height:0!important;
    max-height:calc(100dvh - var(--srd-frame-topbar-height, 70px))!important;
    padding-block-end:var(--srd-frame-outer-padding-bottom, 18px)!important;
    overflow:hidden!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] :is(main,section)[data-srd-ui="workroom-frame-1"] > :not([data-srd-ui="workroom-scroll-1"]) {
    flex-shrink:0;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] :is(main,section)[data-srd-ui="workroom-frame-1"] > [data-srd-ui="workroom-scroll-1"] {
    box-sizing:border-box;
    display:block;
    flex:1 1 auto!important;
    min-width:0;
    min-height:0!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:auto!important;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] [data-srd-ui="workroom-scroll-1"] thead th {
    position:sticky!important;
    top:0!important;
    z-index:5;
    background:var(--wash-head)!important;
    color:var(--wash-text)!important;
  }
}


/* WORKROOM FRAME 1 | nested workroom inside the ordinary shell.
   Overrides generic main>card scrollport: never place V4 menu above its table. */
@media (min-width:801px) and (min-height:620px) {
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > section[data-srd-ui="workroom-frame-1"] {
    flex:1 1 auto!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
    overflow:hidden!important;
    padding:clamp(16px,1.6vw,25px)!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > section[data-srd-ui="workroom-frame-1"] > nav {
    position:relative;
    z-index:2;
    margin-block:12px 14px!important;
    flex-shrink:0!important;
  }
  body.srd-os-workspace[data-srd-frame-scroll="1"] main.srd-frontdoor-shell > section[data-srd-ui="workroom-frame-1"] > [data-srd-ui="workroom-scroll-1"] {
    position:relative;
    z-index:1;
  }
}
