/* MAT112 V23 – zentrale Responsive-Schicht
   Wird auf jeder normalen HTML-Seite geladen. Sie ändert Desktop-Layouts nur
   dort, wo Inhalte sonst überlaufen, und sorgt auf Touch-Geräten für
   konsistente Bediengrößen. PDFs bleiben davon unberührt. */

*,*::before,*::after{box-sizing:border-box}
html,body{max-width:100%}
body{overflow-x:hidden}
img,svg,video,canvas,iframe{max-width:100%}
pre,code{max-width:100%;overflow-wrap:anywhere}
fieldset{min-width:0}
form,.container,.page,.page-container,.content,.content-wrapper,.card,.panel{min-width:0}
input,select,textarea{min-width:0}
.actions,.page-actions,.toolbar,.inline-actions{min-width:0;max-width:100%;flex-wrap:wrap}
.table-wrapper,.table-scroll,.responsive-table-wrap,.customer-table-wrap,.ui-table-scroll,.service-table-wrap,.kalender-scroll{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain}

/* Der alte globale Mobile-Block in style.css setzt jedes beliebige <button>
   auf 100% Breite. Das zerstört kleine Editor-/Tabellen-/Dialogbuttons.
   V23 macht Buttons wieder kontextabhängig. */
@media(max-width:768px){
  body.mat112-global-shell :where(button,.button,input[type="submit"],input[type="button"]):not(.ui-modal-actions *):not(.actions *):not(.page-actions *):not(.button-grid *):not(.filter-box *):not(.entry-actions *):not(.customer-hero-actions *):not(.mail-toolbar *):not(.navigation *):not(.global-activity-bar *):not(.activity-popover *):not(.global-user-popover *):not(.chat-window *):not(.mail-editor-toolbar *):not(.signature-editor-toolbar *){width:auto}
}

@media(max-width:1024px){
  .container,.page,.page-container,.content,.content-wrapper{max-width:100%!important}
  .settings-grid,.locked-grid,.mail-admin-layout{min-width:0}
  .customer-layout{grid-template-columns:1fr!important}
}

@media(max-width:900px){
  .container{width:100%!important;margin-left:auto!important;margin-right:auto!important}
  .grid,.form-grid,.filter-grid,.entry-grid,.settings-grid,.locked-grid,.mail-compose-grid{min-width:0}
  table{max-width:100%}
  .ui-table-scroll>table,.table-wrapper>table,.table-scroll>table,.service-table-wrap>table,.customer-table-wrap>table{margin-left:0!important;margin-right:0!important}
  .mail-layout,.mail-admin-layout{grid-template-columns:1fr!important;min-height:0!important}
  .mail-sidebar{border-right:0!important;border-bottom:1px solid var(--ui-border,#333)!important}
  .mail-account-list{max-height:240px;overflow:auto}
  .mail-search{grid-template-columns:minmax(0,1fr) auto!important}
  .mail-search select{grid-column:1/-1}
}

@media(max-width:700px){
  body{padding-left:max(8px,env(safe-area-inset-left))!important;padding-right:max(8px,env(safe-area-inset-right))!important}
  body.mat112-global-shell{padding-bottom:max(14px,env(safe-area-inset-bottom))!important}
  .container,.page,.page-container,.content,.content-wrapper{padding-left:6px!important;padding-right:6px!important}
  h1{font-size:clamp(1.55rem,8vw,2rem)!important;line-height:1.12;overflow-wrap:anywhere}
  h2{font-size:clamp(1.2rem,6vw,1.55rem)!important;line-height:1.2;overflow-wrap:anywhere}
  h3{overflow-wrap:anywhere}
  .card,.panel,.filters,.filter-box,.settings-card,.customer-panel{max-width:100%;padding-left:14px!important;padding-right:14px!important}
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea{width:100%!important;max-width:100%!important;font-size:16px!important}
  textarea{resize:vertical}
  .grid,.form-grid,.filter-grid,.settings-grid,.locked-grid,.mail-compose-grid,.entry-grid{grid-template-columns:1fr!important}
  .span2,.full-width{grid-column:auto!important}
  .actions,.page-actions{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;width:100%}
  .actions>a.button,.actions>button,.actions>input[type="submit"],.page-actions>a.button,.page-actions>button{width:100%!important;min-width:0!important;min-height:44px!important;margin-left:0!important;margin-right:0!important;text-align:center!important}
  .button-grid{grid-template-columns:1fr!important}
  .button-grid>.button,.button-grid>button{width:100%!important}
  .filter-box form{display:grid!important;grid-template-columns:1fr!important;align-items:stretch!important}
  .filter-box :where(input,select,button,.button,.reset-link){width:100%!important;min-width:0!important;margin-left:0!important}
  .ui-modal-dialog{width:calc(100vw - 20px)!important;max-height:calc(100dvh - 20px)!important;overflow:auto!important;padding:20px 16px!important}
  .ui-modal-actions{display:grid!important;grid-template-columns:1fr!important;width:100%}
  .ui-modal-actions>*{width:100%!important;min-height:44px!important}
  .toast,.ui-toast-container{max-width:calc(100vw - 20px)!important}
  .mail-compose-page{width:100%!important;max-width:100%!important;padding:0!important}
  .mail-compose.card{padding:14px!important}
  .mail-toolbar>div{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .mail-toolbar h1{margin:0!important}
  .mail-toolbar .button{width:100%!important}
  .mail-search{grid-template-columns:1fr!important}.mail-search>*{grid-column:auto!important;width:100%!important}
  .mail-row{grid-template-columns:18px minmax(0,1fr) auto!important;min-height:70px!important;padding:10px!important}.mail-row-content{grid-column:2/4}.mail-row-meta{grid-column:3;grid-row:1;align-self:start}.mail-row-sender{grid-column:2;grid-row:1}
  .mail-message-actions{display:grid!important;grid-template-columns:1fr!important}.mail-message-actions>*{width:100%!important}
  .customer-table-wrap,.service-table-wrap,.table-wrapper,.table-scroll,.ui-table-scroll{border-radius:10px}
  .kalender-scroll{padding-bottom:6px}.kalender-kopf,.kalender{min-width:700px!important}.tag{min-height:105px!important}
  .signature-editor-shell,.mail-editor-field{max-width:100%;min-width:0}
}

@media(max-width:480px){
  body{padding-left:max(6px,env(safe-area-inset-left))!important;padding-right:max(6px,env(safe-area-inset-right))!important}
  .card,.panel,.filters,.filter-box,.settings-card,.customer-panel{padding:12px!important;border-radius:13px!important}
  .status-grid,.summary-grid,.stats-grid,.customer-stats,.entry-stats,.license-grid{grid-template-columns:1fr!important}
  .customer-hero{grid-template-columns:1fr!important}.customer-hero-actions{grid-column:auto!important}
  .mail-recipient-suggestions{left:6px!important;right:6px!important;bottom:max(8px,env(safe-area-inset-bottom))!important}
}

@media(pointer:coarse){
  a.button,button,input[type="submit"],input[type="button"],select{min-height:44px}
  input[type="checkbox"],input[type="radio"]{min-width:22px;min-height:22px}
}

/* =====================================================
   V28 – Mobile-First Abschlusskorrekturen
   Die seitenbezogene Kalender-CSS darf auf Mobil nicht durch die alte
   horizontale 700px-Mindestbreite überschrieben werden.
===================================================== */
@media(max-width:760px){
  body.mat112-global-shell{width:100%;max-width:100vw;overflow-x:hidden!important}
  body.mat112-global-shell :where(.container,.page,.page-container,.content,.content-wrapper,.card,.panel,main,section,article){max-width:100%!important;min-width:0!important}
  body.mat112-global-shell :where(.grid,.form-grid,.filter-grid,.settings-grid,.locked-grid,.entry-grid,.stats-grid,.status-grid){min-width:0!important}
  body.mat112-global-shell .kalender-scroll{width:100%!important;max-width:100%!important;min-width:0!important;overflow:visible!important}
  body.mat112-global-shell .kalender{min-width:0!important;width:100%!important;max-width:100%!important}
  body.mat112-global-shell .kalender-kopf{min-width:0!important;max-width:100%!important}
  body.mat112-global-shell table{max-width:100%}
  body.mat112-global-shell .table-wrapper{width:100%;max-width:100%;min-width:0}
}
@media(max-width:480px){
  body.mat112-global-shell{padding-left:max(5px,env(safe-area-inset-left))!important;padding-right:max(5px,env(safe-area-inset-right))!important}
  body.mat112-global-shell :where(.card,.panel){border-radius:12px}
}
