/* Mensings Werkstatt V021.7 – Scroll-Fix fuer beide Preislisten.
 * Nur CSS, keine Daten-/Preis-/Rechnungslogik und keine Logo-Aenderung.
 */
/* Die Webseite darf bei geoeffnetem Preislistenfenster nicht weiterrollen.
   Chrome/Edge: :has() reagiert automatisch auch auf Schliessen/Entfernen. */
html:has(#maV215MaterialOverlay),
html:has(#maHourlyFloating:not([hidden])) {
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
body:has(#maV215MaterialOverlay),
body:has(#maHourlyFloating:not([hidden])) {
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
/* Schalter im Arbeitsstundenfenster bleibt kompakt wie bei Material. */
#maHourlyFloating #maManageRates { align-self:flex-start!important; width:auto!important; max-width:100%!important; }
/* MATERIAL: Suche und Trefferzahl bleiben stehen, nur die Treffer scrollen. */
#maV215MaterialOverlay .ma-v215-material-dialog {
  min-height:0!important;
  max-height:calc(100dvh - 24px)!important;
  overflow:hidden!important;
}
#maV215MaterialOverlay .ma-v215-material-layout {
  min-height:0!important;
  overflow:hidden!important;
}
#maV215MaterialOverlay .ma-v215-material-list {
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
  max-height:100%!important;
  overflow:hidden!important;
}
#maV215MaterialOverlay .ma-v215-material-items {
  display:block!important;
  flex:1 1 0!important;
  min-height:0!important;
  max-height:100%!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  scrollbar-width:thin;
  scrollbar-color:#8fcbed #193f61;
  touch-action:pan-y;
}
#maV215MaterialOverlay .ma-v215-material-list> :not(.ma-v215-material-items) {
  flex-shrink:0!important;
}
/* ARBEITSSTUNDEN: altes verschobenes Popup zentrieren und korrekt begrenzen.
   Die spaeter eingefuegte .ma-v11-price-layout ist der echte 2-Spalten-Container,
   nicht die alten direkten Kinder von .ma-hourly-content. */
#maHourlyFloating.ma-hourly-panel {
  position:fixed!important;
  left:50%!important;
  top:50%!important;
  right:auto!important;
  bottom:auto!important;
  transform:translate(-50%,-50%)!important;
  display:flex!important;
  flex-direction:column!important;
  width:min(1160px,calc(100vw - 24px))!important;
  max-width:calc(100vw - 24px)!important;
  height:min(820px,calc(100dvh - 24px))!important;
  max-height:calc(100dvh - 24px)!important;
  min-width:0!important;
  min-height:0!important;
  overflow:hidden!important;
  resize:none!important;
  overscroll-behavior:contain!important;
}
#maHourlyFloating.ma-hourly-panel[hidden] {display:none!important}
#maHourlyFloating .ma-hourly-header {flex:0 0 auto!important;position:relative!important;cursor:default!important}
#maHourlyFloating .ma-hourly-content {
  display:flex!important;
  flex-direction:column!important;
  flex:1 1 auto!important;
  gap:10px!important;
  min-height:0!important;
  overflow:hidden!important;
}
#maHourlyFloating .ma-hourly-content>p,
#maHourlyFloating .ma-hourly-content>#maManageRates {
  flex:0 0 auto!important;
  min-height:0!important;
}
#maHourlyFloating .ma-hourly-content>.ma-v11-price-layout {
  display:grid!important;
  grid-template-columns:minmax(0,1.38fr) minmax(320px,.95fr)!important;
  grid-template-rows:minmax(0,1fr)!important;
  gap:16px!important;
  align-items:stretch!important;
  flex:1 1 auto!important;
  min-height:0!important;
  height:100%!important;
  margin:0!important;
  overflow:hidden!important;
}
#maHourlyFloating .ma-v11-price-left {
  display:flex!important;
  flex-direction:column!important;
  min-width:0!important;
  min-height:0!important;
  max-height:100%!important;
  overflow:hidden!important;
}
#maHourlyFloating .ma-v11-price-left>.ma-v11-price-search,
#maHourlyFloating .ma-v11-price-left>small {flex:0 0 auto!important}
#maHourlyFloating .ma-v11-price-left #maHourlyRateRows {
  display:block!important;
  flex:1 1 0!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  scrollbar-width:thin;
  scrollbar-color:#8fcbed #102c46;
  touch-action:pan-y;
}
#maHourlyFloating .ma-v11-price-editor {
  display:flex!important;
  flex-direction:column!important;
  align-self:stretch!important;
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  max-height:100%!important;
  overflow:hidden!important;
}
#maHourlyFloating #maV11RateEditor {
  flex:1 1 auto;
  min-height:0;
  overflow:visible;
}
/* Auf engen Fenstern bleibt der Hintergrund gesperrt; innerhalb des Popups
   kann der Formularinhalt ggf. gescrollt werden statt abgeschnitten zu sein. */
@media(max-width:900px) {
  #maV215MaterialOverlay .ma-v215-material-layout {overflow-y:auto!important;overscroll-behavior:contain!important}
  #maV215MaterialOverlay .ma-v215-material-list {height:min(45vh,420px)!important;min-height:260px!important;flex:0 0 auto!important}
}
@media(max-width:790px) {
  #maHourlyFloating .ma-hourly-content {
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
  }
  #maHourlyFloating .ma-hourly-content>.ma-v11-price-layout {
    display:flex!important;
    flex-direction:column!important;
    flex:0 0 auto!important;
    height:auto!important;
    overflow:visible!important;
  }
  #maHourlyFloating .ma-v11-price-left {height:min(44vh,390px)!important;flex:0 0 auto!important}
  #maHourlyFloating .ma-v11-price-editor {height:auto!important;max-height:none!important;overflow:visible!important}
}
@media print {
  html:has(#maV215MaterialOverlay),html:has(#maHourlyFloating) {overflow:visible!important}
}
