/* Donburg Control legacy bridge (one-dashboard design §8 styles/legacy-bridge; step 4 PR 5b).
   On the live documents shell/live.js frames a legacy page: html[data-df-document=frame].
   The chrome is a fixed layer over the page, so its container is the viewport and the
   chrome.css width rules, popovers and drawer behave as on the preview; clicks pass
   through the layer except on the chrome itself. The legacy page moves beside the rail
   and below the top bar and loses only what the chrome replaces: its sidebar (menu,
   identity, theme, sign out), skip link, store select and data-mode filter.
   html[data-df-width] and html[data-df-rail] mirror the frame's width and the collapsed
   rail. Legacy pages keep their own styles inside main until their module is rebuilt.
   Nothing here applies on the PC page (8792), which never loads this sheet. */

/* Control's document waits for live.js's choice rather than flashing the legacy screen,
   and shows none of it on the way to a shell page or another address ('page');
   control.js marks the document 'legacy' when live.js could not load. */
html[data-df-live]:not([data-df-document]) body>*,
html[data-df-live][data-df-document=page] body>:not(.df-app){visibility:hidden}

.df-app.df-shell[data-df-frame]{position:fixed;inset:0;z-index:var(--df-z-topbar);min-height:0;background:none;pointer-events:none}
.df-app[data-df-frame]>:not(.df-frame),.df-app[data-df-frame] .df-rail{pointer-events:auto}

/* The legacy element rules (the old dashboard stylesheet, removed in D18: nav, nav a, svg, button, fields)
   stop at the chrome. Each reset has the weight of the legacy selector it answers and comes
   later, so it wins over that rule and never over a .df-app rule: the chrome computes as it
   does on the preview, where no legacy sheet loads. */
:where(.df-app[data-df-frame]) nav,
:where(.df-app[data-df-frame]) nav a,
:where(.df-app[data-df-frame]) :is(input,select,textarea){all:revert}
:where(.df-app[data-df-frame]) svg{display:revert}
:where(.df-app[data-df-frame]) button{min-height:revert}
:where(.df-app[data-df-frame]) button:disabled{opacity:revert}

html[data-df-document=frame] body>.skip-link,
html[data-df-document=frame] .shell>.sidebar,
html[data-df-document=frame] #brand-wrap,
html[data-df-document=frame] .header-actions>label:has(#mode-filter){display:none}

/* Top bar 56px, the band (4px at most), and below 960px the store and mode row (55px). */
html[data-df-document=frame] .shell{display:block;min-height:100vh;padding:calc(var(--df-topbar-h) + 4px) 0 0 var(--df-rail-w)}
html[data-df-document=frame][data-df-rail=collapsed] .shell,
html[data-df-document=frame][data-df-width=narrow] .shell{padding-left:var(--df-rail-w-collapsed)}
html[data-df-document=frame][data-df-width=phone] .shell{padding-left:0;padding-top:calc(var(--df-topbar-h) + 59px)}
html[data-df-document=frame][data-df-width=phone][data-df-context=none] .shell{padding-top:calc(var(--df-topbar-h) + 4px)}

/* Sticky parts of legacy pages stop below the top bar. */
html[data-df-document=frame] .mk-toolbar{top:calc(var(--df-topbar-h) + 20px)}
html[data-df-document=frame][data-df-width=phone] .mk-toolbar,
html[data-df-document=frame][data-df-width=phone] .jump-links{top:calc(var(--df-topbar-h) + 59px)}
html[data-df-document=frame][data-df-width=phone][data-df-context=none] .mk-toolbar,
html[data-df-document=frame][data-df-width=phone][data-df-context=none] .jump-links{top:calc(var(--df-topbar-h) + 4px)}
