/* Responsive safeguards for browser zoom and intermediate viewport widths. */
*,*::before,*::after{min-width:0}
img,video,iframe,svg{max-width:100%}
button,a,input,textarea,select{max-width:100%}
.portal-topbar,.page-head,.panel-head{flex-wrap:wrap}
.portal-account,.portal-account>div,.page-head>div,.panel-head>div{min-width:0;max-width:100%}
.portal-account strong,.portal-account span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.page-head h1,.panel-head h2,.service-copy strong,.service-copy span{overflow-wrap:anywhere}
.toolbar{flex-wrap:wrap}.toolbar select{width:min(210px,100%);max-width:100%}
.dialog-head>div,.dialog-body{min-width:0}
.dialog-actions{flex-wrap:wrap}

@media (max-width: 700px), (max-width: 900px) and (pointer: coarse) {
  .portal-account .scan-qr-login {
    display: inline-grid;
  }
}

@media (max-width: 430px) {
  .portal-topbar {
    gap: 12px;
  }
}

@media(max-width:1100px){
  .portal-shell{width:min(100% - 40px,1490px)}
  .portal-intro{grid-template-columns:minmax(0,1fr) 250px;gap:20px}
  .main{padding-inline:32px}
  .ticket-row{grid-template-columns:100px minmax(0,1fr) 120px 32px;gap:10px}
  .ticket-row .priority-cell{display:none}
}

@media(max-width:900px){
  .portal-intro{grid-template-columns:1fr}
  .portal-search{width:100%}
  .admin-module-grid,.directory-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  #personalWorkspacePage.active{grid-template-columns:repeat(2,minmax(0,1fr))}
  .page-head{align-items:flex-start}

  #usersList .user-row,
  #deactivatedUsersList .user-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  #usersList .user-row > .badge,
  #deactivatedUsersList .user-row > .badge {
    display: inline-flex;
    justify-self: start;
  }

  #usersList .user-row > div:last-child,
  #deactivatedUsersList .user-row > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  #adminEmployeesPage .admin-employee-actions .button {
    white-space: normal;
  }
}

@media(max-width:700px){
  .portal-shell{width:calc(100% - 32px)}
  .main{padding-inline:14px}
  .admin-module-grid,.directory-grid,#personalWorkspacePage.active{grid-template-columns:minmax(0,1fr)}
  .page-head .button,.panel-head .button{width:auto;max-width:100%}
  .dialog-actions{justify-content:stretch}.dialog-actions .button{flex:1 1 140px}
  .service-request-card .service-request-admin {
    grid-template-columns: minmax(0, 1fr);
  }

  #adminEmployeesPage .admin-employee-actions,
  #adminEmployeesPage .toolbar > * {
    width: 100%;
  }

  #adminEmployeesPage .admin-cabinet-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminEmployeesPage .admin-cabinet-stats article {
    overflow-wrap: anywhere;
  }
}

.compact-label,.compact-scroll-hint{display:none}

@media screen and (max-width:1200px){
  .compact-scroll-hint{
    display:block;
    position:sticky;
    left:0;
    margin:0;
    padding:9px 12px;
    background:#f2f5fb;
    color:var(--muted);
    font-size:.77rem;
  }
}

@media screen and (max-width:700px){
  .page.active .compact-table,#scudPage .scud-table-wrap.compact-table{
    position:relative;
    overflow:visible;
    max-height:none;
    border:0;
  }
  .page.active .compact-table .compact-scroll-hint{display:none}
  .page.active .compact-table table,#scudPage .scud-table-wrap.compact-table table{display:block;min-width:0}
  .page.active .compact-table thead{
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip-path:inset(50%);
    white-space:nowrap;
  }
  .page.active .compact-table tbody{display:grid;gap:10px}
  .page.active .compact-table tbody tr{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px 12px;
    padding:13px;
    background:#fff;
    border:1px solid var(--line);
    border-radius:14px;
  }
  .page.active .compact-table tbody :is(td,th),
  #scudPage .scud-table-wrap.compact-table tbody :is(td,th){
    display:block;
    min-width:0;
    max-width:none;
    padding:0;
    border:0;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  .compact-title,.compact-wide,.compact-group>th,.compact-group>td:first-child{grid-column:1/-1}
  .compact-title{grid-row:1;font-size:1rem;font-weight:700}
  .compact-label{
    display:block;
    color:var(--muted);
    font-size:.75rem;
    font-weight:600;
    margin-bottom:3px;
  }
  .protocol-text .compact-label{white-space:normal}
  .page.active .compact-table .compact-group{
    grid-template-columns:minmax(0,1fr);
    padding:9px 13px;
    background:#e8efff;
    color:#244678;
  }
  .page.active .compact-table .compact-group th{background:transparent}
  .page.active .compact-table .scud-employee-division,
  .page.active .compact-table .scud-division-row td:not(:first-child){display:none}
  .protocol-row-actions .button{margin-right:6px}
  .protocol-link{min-height:44px}
  #scudPage .scud-stats strong{font-size:clamp(1rem,5.1vw,1.45rem);overflow-wrap:anywhere}
  #scudPage .scud-table-wrap.compact-table .scud-reason{min-width:0;max-width:none}
  .scud-table-wrap.compact-table .scud-reasons-body,
  .scud-table-wrap.compact-table .scud-admin-reason-form{min-width:0}
  .scud-table-wrap.compact-table .scud-reasons>summary{min-height:44px;min-width:44px}
  #scudPage #scudTable.compact-table td[class*="scud-hours-"],
  #teamScudTable.compact-table td[class*="scud-hours-"]{padding:6px 8px;border-radius:8px}
  #adminEmployeesPage .admin-employee-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #adminEmployeesPage .admin-employee-actions .button{padding-inline:8px}
  #adminEmployeesPage #openUser{grid-column:1/-1}
  #usersList .user-row .person,
  #deactivatedUsersList .user-row .person{align-items:flex-start;overflow-wrap:anywhere}
  .page #employeeCompanyToolbar label,.page #deactivatedCompanyToolbar label,
  .page #orgCompanyToolbar label{width:100%}
  #portalHome .market-quote strong{white-space:normal}
  #portalHome .market-quote .quote-unit{white-space:nowrap}
}

@media screen and (max-width:480px){
  #portalHome .market-quote strong{font-size:clamp(1rem,4.8vw,1.18rem)}
  #portalHome .market-quote .quote-unit{display:block}
}

@media screen and (max-width:700px), screen and (max-width:1100px) and (pointer:coarse){
  #workspace .page :is(input:not([type=checkbox],[type=radio],[type=range]),select,textarea),
  dialog :is(input:not([type=checkbox],[type=radio],[type=range]),select,textarea){
    font-size:16px;
  }
  dialog[open]{
    max-height:calc(100dvh - 24px);
    overflow:auto;
    overscroll-behavior:contain;
  }
  dialog .dialog-head .icon-button,dialog .modal-head .icon-button{
    flex-shrink:0;
    min-width:44px;
    min-height:44px;
  }
  .audit-row p{overflow-wrap:anywhere}
}
