
/* Event Medic - Logistics responsive hotfix
   UI-only patch. Existing JS/API/DB behavior is untouched. */
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
*,*:before,*:after{ box-sizing:border-box; }
html,body{ width:100%; max-width:100%; margin:0; overflow-x:hidden; }
img,svg,canvas{ max-width:100%; height:auto; }
input,select,textarea,button{ max-width:100%; font:inherit; }
header,main,footer,section,nav,div{ min-width:0; }

.app,.shell,.layout,.page,.page-wrap,.content,.main,.main-content,
#app,#root,#content,#main{ max-width:100%; }

/* Header */
header,.header,.app-header,.topbar,.top-bar,#header{
  width:100%;
  max-width:100%;
}
.header-inner,.topbar-inner,.top-bar-inner,.app-header-inner{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px 14px;
}
.header-title,.system-title,.event-name,.clock,.datetime{
  position:static !important;
  transform:none !important;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
}

/* Navigation */
.tabs,.tabbar,.tab-bar,.nav-tabs,.sidebar-tabs{
  max-width:100%;
}
.tabs,.tabbar,.tab-bar,.nav-tabs{
  display:flex;
  flex-wrap:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}
.tabs>*,
.tabbar>*,
.tab-bar>*,
.nav-tabs>*{ flex:0 0 auto; white-space:nowrap; }

/* Material registration and all dialogs */
.modal,.dialog,.popup,.modal-overlay{ max-width:100vw; }
.modal-content,.dialog-content,.popup-content,
.modal-box,.modal-card{
  width:min(92vw,920px) !important;
  max-width:92vw !important;
  max-height:88vh !important;
  overflow:auto !important;
  margin-left:auto !important;
  margin-right:auto !important;
}
.modal-body,.dialog-body{ overflow:auto; max-width:100%; }

.form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px 18px;
  width:100%;
}
.form-row,.field-row,.input-row,.form-group{ min-width:0; }
.form-grid input,.form-grid select,.form-grid textarea,
.form-row input,.form-row select,.form-row textarea,
.form-group input,.form-group select,.form-group textarea{
  width:100%;
  min-width:0;
}

/* Avoid giant fixed-width controls */
input[type="text"],input[type="number"],input[type="date"],input[type="password"],
select,textarea{
  min-width:0 !important;
}

/* Tables */
table{ max-width:100%; }
.table-wrap,.table-responsive,.panel{
  max-width:100%;
}
.table-wrap,.table-responsive{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

/* Modal footer buttons remain visible */
.modal-footer,.dialog-footer,.form-actions{
  display:flex;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:10px;
  position:sticky;
  bottom:0;
  z-index:2;
}

/* iPad portrait / smaller tablets */
@media (max-width:900px){
  .modal-content,.dialog-content,.popup-content,.modal-box,.modal-card{
    width:94vw !important;
    max-width:94vw !important;
  }
  .form-grid{ grid-template-columns:1fr 1fr; gap:12px; }
  .header-title,.system-title{ font-size:clamp(16px,2.4vw,24px) !important; }
}

/* Phones / narrow terminals */
@media (max-width:620px){
  body{ font-size:15px; }
  .form-grid{ grid-template-columns:1fr; }
  .modal-content,.dialog-content,.popup-content,.modal-box,.modal-card{
    width:96vw !important;
    max-width:96vw !important;
    max-height:92vh !important;
  }
  .form-row,.field-row,.input-row{ display:block; }
  .form-row>*,
  .field-row>*,
  .input-row>*{ width:100% !important; margin-left:0 !important; margin-right:0 !important; }
}
