
/* Event Medic - FA-NET v43 responsive hotfix
   Existing v43 structure/functions are intentionally 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; }

/* Prevent flex/grid children from forcing page width */
header,main,footer,section,nav,div{ min-width:0; }
.app,.app-shell,.shell,.page,.page-wrap,.content,.main,.main-content,
#app,#root,#content,#main{ max-width:100%; }

/* Header: never overlap date/time/system title */
header,.header,.app-header,.topbar,.top-bar,#header,#appHeader{
  width:100%;
  max-width:100%;
}
.header-inner,.topbar-inner,.top-bar-inner,
.app-header-inner,#headerInner{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px 14px;
  min-width:0;
}
.header-left,.header-center,.header-right,
.topbar-left,.topbar-center,.topbar-right{
  min-width:0;
}
.header-center,.topbar-center{
  flex:1 1 260px;
}
.header-right,.topbar-right{
  flex:0 1 auto;
  margin-left:auto;
}
.header-title,.system-title,.event-name,.current-event,
.header-date,.header-time,.clock,.datetime{
  position:static !important;
  transform:none !important;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
}

/* Tabs: keep directly under header, scroll instead of crushing */
.tabs,.tabbar,.tab-bar,.nav-tabs,#tabs,#eventTabs{
  display:flex;
  flex-wrap:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
  max-width:100%;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}
.tabs>*,
.tabbar>*,
.tab-bar>*,
.nav-tabs>*,
#tabs>*,
#eventTabs>*{
  flex:0 0 auto;
  white-space:nowrap;
}

/* Login */
.login-page,.login-wrap,.login-container,.login-panel,.login-card,
#login,#loginPage,#loginPanel{
  max-width:100%;
}
.login-panel,.login-card,
#loginPanel{
  width:min(92vw,560px) !important;
  margin-left:auto !important;
  margin-right:auto !important;
}
.login-panel input,.login-card input,#loginPanel input{
  width:100% !important;
  min-width:0 !important;
}
.login-form,.login-fields{
  width:100%;
  max-width:100%;
}

/* Generic forms/tables */
.form-row,.form-grid,.field-row,.input-row{
  min-width:0;
}
table{ max-width:100%; }
.table-wrap,.table-responsive{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

/* Dialogs */
.modal,.dialog,.popup{ max-width:100vw; }
.modal-content,.dialog-content,.popup-content{
  width:min(92vw,900px) !important;
  max-width:92vw !important;
  max-height:88vh;
  overflow:auto;
  margin-left:auto !important;
  margin-right:auto !important;
}

@media (max-width:1024px){
  .header-inner,.topbar-inner,.top-bar-inner,.app-header-inner,#headerInner{
    align-items:flex-start;
  }
  .header-center,.topbar-center{ flex-basis:100%; order:3; }
  .header-title,.system-title{ font-size:clamp(16px,2.2vw,24px) !important; line-height:1.25; }
  .event-name,.current-event{ font-size:clamp(14px,2vw,20px) !important; }
}

@media (max-width:700px){
  body{ font-size:15px; }
  .header-left,.header-right,.topbar-left,.topbar-right{ flex:1 1 auto; }
  .header-date,.header-time,.clock,.datetime{ font-size:13px !important; }
  .login-panel,.login-card,#loginPanel{ width:94vw !important; padding:16px !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; }
}
