/* Retter-Portal v1.2.80 – tablet-only polish.
   Smartphone <=760px and normal desktop >1366px remain untouched. */
@media (min-width:761px) and (max-width:1180px),
       (min-width:1181px) and (max-width:1366px) and (hover:none) and (pointer:coarse){
  /* Exactly one sidebar logo is visible. The generic tablet rule in v1.2.79
     must not override the theme-specific logo visibility. */
  html body .sidebar .brand-logo.logo-light,
  html body .sidebar .brand-logo.logo-dark{display:none!important;}
  html body[data-theme="light"] .sidebar .brand-logo.logo-light{display:block!important;}
  html body[data-theme="dark"] .sidebar .brand-logo.logo-dark{display:block!important;}

  html body .sidebar .brand-logo-wrap{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    width:100%!important;
    min-width:0!important;
    min-height:64px!important;
    overflow:hidden!important;
  }
  html body .sidebar .brand-logo{
    width:min(204px,100%)!important;
    max-width:100%!important;
    height:auto!important;
    object-fit:contain!important;
    object-position:left center!important;
  }

  /* Stable one-row header for landscape tablets. */
  html body .topbar .topbar-desktop-shell{
    grid-template-columns:minmax(188px,210px) minmax(250px,1fr) minmax(360px,max-content)!important;
    grid-template-areas:"brand context actions"!important;
    align-items:center!important;
    column-gap:16px!important;
    row-gap:0!important;
    min-height:66px!important;
    padding:9px 16px!important;
  }
  html body .topbar .topbar-title,
  html body .topbar .topbar-context,
  html body .topbar .topbar-actions{
    min-width:0!important;
    height:44px!important;
    min-height:44px!important;
    align-self:center!important;
  }
  html body .topbar .topbar-title{overflow:hidden!important;}
  html body .topbar .topbar-eyebrow{
    gap:7px!important;
    width:100%!important;
    min-width:0!important;
    height:44px!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-eyebrow>span:first-child{
    flex:1 1 auto!important;
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  html body .topbar .topbar-version{
    flex:0 0 auto!important;
    margin-left:2px!important;
  }

  html body .topbar .topbar-context{
    display:flex!important;
    align-items:center!important;
    justify-content:stretch!important;
    padding-left:2px!important;
  }
  html body .topbar .department-context-switch,
  html body .topbar .department-context-static{
    grid-template-columns:72px minmax(0,1fr)!important;
    align-items:center!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:44px!important;
    min-height:44px!important;
    max-height:44px!important;
    margin:0!important;
    padding:4px 5px 4px 10px!important;
    overflow:hidden!important;
  }
  html body .topbar .department-context-switch>span,
  html body .topbar .department-context-static>span{
    display:flex!important;
    align-items:center!important;
    width:72px!important;
    min-width:72px!important;
    max-width:72px!important;
    height:34px!important;
    line-height:1!important;
  }
  html body .topbar .department-context-switch select,
  html body .topbar .department-context-static strong{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:34px!important;
    min-height:34px!important;
    line-height:34px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  html body .topbar .topbar-actions{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:8px!important;
    overflow:hidden!important;
  }
  html body .topbar .theme-switch,
  html body .topbar .topbar-user-cluster,
  html body .topbar .topbar-account-info,
  html body .topbar .topbar-logout,
  html body .topbar .topbar-logout .btn{
    align-self:center!important;
    margin-top:0!important;
    margin-bottom:0!important;
  }
  html body .topbar .topbar-account-info{
    max-width:210px!important;
    min-width:0!important;
    overflow:hidden!important;
  }
  html body .topbar .user-chip,
  html body .topbar .user-chip.has-role-badge{
    max-width:112px!important;
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  /* Tablet content: readable pills, stable table cells, no character-by-character breaks. */
  html body .content :is(.pill,.status,.role,.badge,.secure-pill,.incident-status-pill,.topbar-role-badge){
    min-width:0!important;
    width:auto!important;
    max-width:100%!important;
    min-height:34px!important;
    padding:7px 10px!important;
    line-height:1.05!important;
    white-space:nowrap!important;
    word-break:keep-all!important;
    overflow-wrap:normal!important;
    hyphens:none!important;
  }
  html body .content :is(th,td){
    word-break:normal!important;
    overflow-wrap:normal!important;
    hyphens:none!important;
  }
  html body .content :is(th,td) :is(.pill,.status,.role,.badge,.incident-status-pill){
    font-size:clamp(.68rem,1.1vw,.78rem)!important;
  }
  html body .content :is(.table-wrap,.data-table-card,.checks-table-wrap){
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:visible!important;
  }
}

/* Medium/portrait tablets: use two clean rows instead of forcing overlaps. */
@media (min-width:761px) and (max-width:1100px){
  html body .topbar .topbar-desktop-shell{
    grid-template-columns:minmax(170px,1fr) max-content!important;
    grid-template-areas:"brand actions" "context context"!important;
    column-gap:12px!important;
    row-gap:8px!important;
    min-height:108px!important;
    padding:9px 14px 10px!important;
  }
  html body .topbar .topbar-context{padding-left:0!important;}
  html body .topbar .department-context-switch,
  html body .topbar .department-context-static{max-width:100%!important;}
}
