/* Scoped native dialogs only. Closed windows stay closed; no document-wide form rules. */
/* Native top layer escapes sidebar/header stacking contexts; the shared viewport
   anchor also replaces legacy absolute/translated offsets after navigation. */
body.xsorx-button-colors dialog.xsorx-popup-layer[open]{
  position:fixed!important;inset:0!important;margin:auto!important;
  transform:none!important;translate:none!important;z-index:2147483000!important;
  max-width:calc(100vw - 24px)!important;max-height:calc(100vh - 24px)!important;max-height:calc(100dvh - 24px)!important;
}
body.xsorx-button-colors dialog.xsorx-popup-layer::backdrop{background:rgba(15,23,42,.58)}
@media(max-width:600px){body.xsorx-button-colors dialog.xsorx-popup-layer[open]{max-width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important}}
body.xsorx-button-colors .ekol-itf-form-actions{
  display:flex!important;align-items:stretch;flex-wrap:nowrap!important;gap:10px;
}
body.xsorx-button-colors .ekol-itf-form-actions>:is(button,.ekol-itf-cancel-button){
  flex:1 1 0;min-width:0;min-height:44px;display:flex;align-items:center;justify-content:center;
  padding:10px 12px;white-space:nowrap!important;
}
body.xsorx-button-colors dialog.xsorx-popup-frame[open]{
  display:flex!important;flex-direction:column!important;box-sizing:border-box;
  height:fit-content!important;max-height:calc(100vh - 24px)!important;max-height:calc(100dvh - 24px)!important;
  overflow:hidden!important;padding:0!important;
}
body.xsorx-button-colors dialog.xsorx-popup-frame>.xsorx-popup-head{
  flex:0 0 auto!important;position:relative!important;top:auto!important;margin:0!important;
  padding:14px 18px;box-sizing:border-box;background:var(--xsorx-style-soft,#f4f6f9)!important;
  color:var(--xsorx-style-text,#172b4d)!important;border-bottom:1px solid var(--xsorx-style-border,#d9dee7);
}
body.xsorx-button-colors dialog.xsorx-popup-frame>.xsorx-popup-body{
  flex:0 1 auto!important;min-height:0!important;max-height:none!important;height:auto!important;
  box-sizing:border-box;overflow:auto!important;padding:14px 18px;
  overscroll-behavior:contain;
}
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-form-path{
  display:flex!important;flex-direction:column!important;flex:0 1 auto!important;min-height:0!important;
  overflow:hidden!important;max-height:none!important;
}
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-form,
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-direct-actions{
  display:grid!important;grid-template-rows:minmax(0,auto) auto!important;flex:0 1 auto!important;
  min-height:0!important;max-height:none!important;overflow:hidden!important;
  width:100%;margin:0!important;row-gap:0!important;
}
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-fields{
  grid-column:1/-1;min-height:0!important;min-width:0;overflow:auto!important;
  display:grid;grid-template-columns:inherit;align-content:start;gap:inherit;
  padding:2px 3px 12px;overscroll-behavior:contain;
}
/* Legacy overtime styles target :last-child; after wrapping that can be the
   description or the hidden error, not the action row. Only the real footer is fixed. */
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-fields>.xsorx-overtime-wide:last-child{
  position:static!important;bottom:auto!important;padding:0!important;border-top:0!important;
  background:transparent!important;box-shadow:none!important;
}
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-fields>[hidden]{display:none!important}
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-footer{
  grid-column:1/-1;flex:0 0 auto!important;position:relative!important;bottom:auto!important;
  display:flex!important;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;
  margin:0!important;padding:12px 0 max(4px,env(safe-area-inset-bottom))!important;
  background:var(--xsorx-style-solid,#fff)!important;color:var(--xsorx-style-text,#172b4d)!important;
  border-top:1px solid var(--xsorx-style-border,#d9dee7);box-shadow:none!important;
}
body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-footer>:is(button,input[type=submit],a){margin:0!important;min-height:40px;max-width:100%;white-space:normal!important}
@media(max-width:600px){
  body.xsorx-button-colors dialog.xsorx-popup-frame[open]{max-width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important}
  body.xsorx-button-colors dialog.xsorx-popup-frame>.xsorx-popup-head{padding:12px 14px}
  body.xsorx-button-colors dialog.xsorx-popup-frame>.xsorx-popup-body{padding:10px 12px}
  body.xsorx-button-colors dialog.xsorx-popup-frame .xsorx-popup-footer>:is(button,input[type=submit],a){min-height:44px}
}
