/* Nexware ERP v0.33.2 — Responsive Form Containment & Stable Shell Polish */

/* Global containment: wide forms/tables must scroll inside their own panel rather than
   forcing the authenticated page outside the viewport. */
.main,.content,.panel,.form-section,.form-grid,.table-wrap{min-width:0;max-width:100%}
.content{overflow-x:clip}
.panel,.tx-form-panel{overflow:visible}
.table-wrap{width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain}
.table-wrap>table{max-width:none}
.tx-table{width:100%;min-width:980px}

/* Professional transaction forms: use responsive columns based on the real browser width.
   Every field is allowed to shrink; long option labels no longer expand the grid. */
.professional-doc-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;align-items:start}
.professional-doc-grid>*{min-width:0;max-width:100%}
.professional-doc-grid input,
.professional-doc-grid select,
.professional-doc-grid textarea{width:100%;max-width:100%;min-width:0;box-sizing:border-box}
.professional-doc-grid select{overflow:hidden;text-overflow:ellipsis}
.professional-doc-grid .full{grid-column:1/-1!important}

/* Item/header/summary controls should wrap within the card instead of widening the page. */
.tx-form-panel .section-head{min-width:0;gap:12px;flex-wrap:wrap}
.tx-form-panel .section-head>div{min-width:0;flex:1 1 520px}
.tx-form-panel .section-head>.button{flex:0 0 auto}
.tx-summary{min-width:0;max-width:100%;grid-template-columns:repeat(5,minmax(0,1fr))}
.tx-summary>div{min-width:0}
.form-actions{max-width:100%;flex-wrap:wrap}

/* Step down earlier on ordinary laptops because the fixed sidebar reduces usable form width. */
@media(max-width:1700px){
  .professional-doc-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:1450px){
  .professional-doc-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .tx-summary{grid-template-columns:repeat(3,minmax(0,1fr))}
  .tx-summary .grand{grid-column:span 1}
}
@media(max-width:980px){
  .content{overflow-x:hidden}
  .professional-doc-grid{grid-template-columns:1fr!important}
  .tx-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tx-form-panel .section-head>div{flex-basis:100%}
}
@media(max-width:620px){
  .tx-summary{grid-template-columns:1fr}
  .form-actions{justify-content:stretch}
  .form-actions .button{flex:1 1 auto;text-align:center}
}

/* Header collision guard. Move to two rows before the centre clock/Utilities can fight
   Search/Create/user actions for the same horizontal space. */
.topbar,.topbar-left,.topbar-center,.top-actions{min-width:0}
@media(max-width:1450px) and (min-width:981px){
  .topbar{grid-template-columns:minmax(0,1fr) max-content!important;grid-template-rows:auto auto!important;height:auto!important;min-height:70px;gap:7px 10px;padding-top:7px;padding-bottom:7px}
  .topbar-left{grid-column:1!important;grid-row:1!important}
  .top-actions{grid-column:2!important;grid-row:1!important;min-width:0!important}
  .topbar-center{grid-column:1/-1!important;grid-row:2!important;justify-self:stretch!important;justify-content:center!important;width:100%}
  .company-switch-link{max-width:min(360px,42vw)!important}
}
@media(max-width:1180px) and (min-width:981px){
  .top-actions{gap:6px!important}
  .top-actions kbd,.topbar-user{display:none!important}
}

/* Runtime anti-jitter support. The critical visibility rule is also inlined in layout.php
   so it applies before external stylesheets finish loading. */
html.nexware-ui-boot,html.nexware-ui-boot body{overflow-anchor:none!important}
html.nexware-ui-boot #erp-app{visibility:hidden!important}
html.nexware-ui-boot #erp-app *,html.nexware-ui-boot #erp-app *::before,html.nexware-ui-boot #erp-app *::after{
  transition:none!important;animation:none!important;scroll-behavior:auto!important
}
html.nexware-ui-ready #erp-app{visibility:visible}
