/* Retter-Portal v1.2.72 – isolated tablet layout. Mobile <=760px and desktop >1180px stay untouched. */
html body .topbar .topbar-tablet-menu{display:none!important;}

@media (min-width:761px) and (max-width:1180px){
  html,body{max-width:100%!important;overflow-x:hidden!important;}
  html body .app-shell{min-width:0!important;max-width:100%!important;}
  html body .main,
  html body .content{min-width:0!important;max-width:100%!important;overflow-x:clip!important;}
  html body .content{padding:clamp(15px,2vw,22px)!important;}
  html body .content > *,
  html body .content :is(.page-head,.page-hero,.card,.toolbar,.grid,.stat-grid,.form-grid,.detail-grid,.info-grid,.table-wrap,.data-table-card,.checks-table-wrap){
    min-width:0!important;
    max-width:100%!important;
  }

  /* Header: stable two-row desktop-like tablet arrangement. */
  html body .topbar .topbar-desktop-shell{
    display:grid!important;
    grid-template-columns:minmax(136px,1fr) minmax(0,auto)!important;
    grid-template-areas:"brand actions" "context context"!important;
    align-items:center!important;
    gap:8px 12px!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:0!important;
    padding:8px 12px 10px!important;
    overflow:visible!important;
  }
  html body .topbar .topbar-desktop-shell > *{min-width:0!important;max-width:100%!important;}
  html body .topbar .topbar-title{
    grid-area:brand!important;
    display:flex!important;
    align-items:center!important;
    gap:7px!important;
    width:100%!important;
    min-width:0!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-logo-pair{
    width:31px!important;
    min-width:31px!important;
    height:31px!important;
    flex:0 0 31px!important;
  }
  html body .topbar .topbar-logo-pair .topbar-logo{width:31px!important;height:31px!important;}
  html body .topbar .topbar-product{min-width:0!important;max-width:100%!important;overflow:hidden!important;}
  html body .topbar .topbar-eyebrow{
    display:flex!important;
    align-items:center!important;
    gap:5px!important;
    min-width:0!important;
    max-width:100%!important;
    font-size:clamp(.58rem,1vw,.68rem)!important;
    letter-spacing:.065em!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-eyebrow > span:first-child{
    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;
    min-width:0!important;
    max-width:62px!important;
    min-height:24px!important;
    padding:3px 6px!important;
    font-size:.59rem!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  html body .topbar .topbar-context{
    grid-area:context!important;
    display:block!important;
    width:100%!important;
    min-width:0!important;
    overflow:hidden!important;
  }
  html body .topbar .department-context-switch,
  html body .topbar .department-context-static{
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    align-items:center!important;
    gap:8px!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:43px!important;
    padding:4px 5px 4px 10px!important;
    border-radius:14px!important;
    overflow:hidden!important;
  }
  html body .topbar .department-context-switch > span,
  html body .topbar .department-context-static > span{
    min-width:max-content!important;
    max-width:82px!important;
    font-size:clamp(.54rem,.9vw,.62rem)!important;
    letter-spacing:.08em!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  html body .topbar .department-context-switch select,
  html body .topbar .department-context-static strong{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:34px!important;
    min-height:34px!important;
    margin:0!important;
    padding:0 31px 0 10px!important;
    border-radius:11px!important;
    font-size:clamp(.76rem,1.35vw,.88rem)!important;
    line-height:34px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  html body .topbar .department-context-static strong{padding-right:10px!important;}

  html body .topbar .topbar-actions{
    grid-area:actions!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:6px!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
  }
  html body .topbar .theme-switch{
    display:flex!important;
    flex:0 0 auto!important;
    width:auto!important;
    height:36px!important;
    min-height:36px!important;
    padding:2px!important;
    gap:1px!important;
  }
  html body .topbar .theme-switch .theme-dot{
    width:27px!important;
    min-width:27px!important;
    height:30px!important;
    min-height:30px!important;
    padding:0!important;
    font-size:.65rem!important;
  }
  html body .topbar .theme-switch .theme-dot.auto{
    width:auto!important;
    min-width:41px!important;
    padding:0 6px!important;
  }
  html body .topbar .topbar-user-cluster{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:6px!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-account-info{
    display:flex!important;
    align-items:center!important;
    gap:5px!important;
    min-width:0!important;
    max-width:clamp(145px,25vw,220px)!important;
    padding:3px 4px!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-role-badge{
    flex:0 1 auto!important;
    min-width:0!important;
    max-width:78px!important;
    min-height:27px!important;
    padding:4px 7px!important;
    font-size:.55rem!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  html body .topbar .user-chip,
  html body .topbar .user-chip.has-role-badge{
    display:block!important;
    min-width:0!important;
    max-width:clamp(72px,11vw,118px)!important;
    padding:0 3px!important;
    font-size:clamp(.7rem,1.2vw,.8rem)!important;
    line-height:1.1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  html body .topbar .topbar-logout{flex:0 0 auto!important;min-width:0!important;}
  html body .topbar .topbar-logout .btn{
    min-width:64px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0 9px!important;
    border-radius:12px!important;
    font-size:.72rem!important;
    white-space:nowrap!important;
  }

  /* Tablet content: no overlap or page-wide horizontal overflow. */
  html body .content :is(.page-head,.page-hero,.card-head,.hero-actions,.actions,.toolbar){
    min-width:0!important;
  }
  html body .content :is(.page-head,.page-hero,.card-head){
    gap:clamp(12px,2vw,18px)!important;
  }
  html body .content :is(.hero-actions,.actions,.toolbar){
    flex-wrap:wrap!important;
  }
  html body .content :is(.btn,.pill,.status,.role,.badge,.secure-pill){
    max-width:100%!important;
    min-width:0!important;
    white-space:nowrap!important;
    line-height:1.1!important;
  }
  html body .content :is(.pill,.status,.role,.badge,.secure-pill){
    padding:clamp(5px,.8vw,7px) clamp(8px,1vw,11px)!important;
    font-size:clamp(.64rem,1vw,.77rem)!important;
  }
  html body .content .table-wrap{
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:visible!important;
    overscroll-behavior-inline:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }
  html body .content .table-wrap table{
    width:max(100%,760px)!important;
    min-width:760px!important;
    table-layout:auto!important;
  }
  html body .content .table-wrap :is(th,td){
    word-break:normal!important;
    overflow-wrap:break-word!important;
    hyphens:none!important;
  }
}

/* Wider tablet landscape: keep the header in one clean row when there is enough room. */
@media (min-width:1041px) and (max-width:1180px){
  html body .topbar .topbar-desktop-shell{
    grid-template-columns:minmax(132px,170px) minmax(210px,1fr) minmax(340px,auto)!important;
    grid-template-areas:"brand context actions"!important;
    gap:8px 10px!important;
    padding:8px 12px!important;
  }
  html body .topbar .topbar-context{align-self:center!important;}
  html body .topbar .department-context-switch,
  html body .topbar .department-context-static{min-height:40px!important;}
}

/* Small tablets: sidebar becomes an overlay and the menu button appears. */
@media (min-width:761px) and (max-width:860px){
  html body .app-shell{display:block!important;min-height:100dvh!important;}
  html body .main{width:100%!important;max-width:100%!important;}
  html body .sidebar{
    position:fixed!important;
    inset:0 auto 0 0!important;
    width:min(82vw,290px)!important;
    max-width:min(82vw,290px)!important;
    z-index:2400!important;
    transform:translateX(-105%)!important;
    transition:transform .2s ease!important;
  }
  html body.sidebar-open .sidebar{transform:translateX(0)!important;}
  html body .topbar .topbar-desktop-shell{
    grid-template-columns:42px minmax(108px,1fr) minmax(0,auto)!important;
    grid-template-areas:"menu brand actions" "context context context"!important;
    gap:8px!important;
    padding:8px 10px 10px!important;
  }
  html body .topbar .topbar-tablet-menu{
    grid-area:menu!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:42px!important;
    min-width:42px!important;
    max-width:42px!important;
    height:42px!important;
    min-height:42px!important;
    max-height:42px!important;
    margin:0!important;
    padding:0!important;
    border:1px solid var(--line)!important;
    border-radius:13px!important;
    background:var(--surface)!important;
    color:var(--text)!important;
    box-shadow:var(--shadow-sm)!important;
    font-size:.95rem!important;
    line-height:1!important;
  }
  html body .topbar .topbar-actions{gap:4px!important;}
  html body .topbar .topbar-account-info{max-width:150px!important;}
  html body .topbar .topbar-role-badge{max-width:68px!important;font-size:.5rem!important;padding-inline:5px!important;}
  html body .topbar .user-chip,
  html body .topbar .user-chip.has-role-badge{max-width:72px!important;font-size:.67rem!important;}
  html body .topbar .topbar-logout .btn{min-width:58px!important;padding-inline:7px!important;font-size:.68rem!important;}
  html body .content{padding:14px 12px 22px!important;}
}

/* Medium tablets with visible sidebar: make the sidebar narrower to protect content width. */
@media (min-width:861px) and (max-width:1039px){
  html body .app-shell{grid-template-columns:clamp(196px,23vw,220px) minmax(0,1fr)!important;}
  html body .sidebar{width:auto!important;min-width:0!important;padding-inline:10px!important;}
  html body .sidebar .brand{padding-inline:5px!important;}
  html body .sidebar nav a{gap:8px!important;padding-inline:8px!important;font-size:clamp(.76rem,1.15vw,.9rem)!important;}
  html body .sidebar nav a span{flex:0 0 28px!important;}
  html body .topbar .topbar-account-info{max-width:175px!important;}
  html body .topbar .user-chip,
  html body .topbar .user-chip.has-role-badge{max-width:82px!important;}
}

/* v1.2.74: header logo remains intentionally removed from markup. */
html body .topbar .topbar-title{gap:0!important;}

/* Large iPad/tablet landscape only. Desktop with mouse/trackpad remains untouched. */
@media (min-width:1181px) and (max-width:1366px) and (hover:none) and (pointer:coarse){
  html,body{max-width:100%!important;overflow-x:hidden!important;}
  html body .app-shell{grid-template-columns:220px minmax(0,1fr)!important;min-width:0!important;max-width:100%!important;}
  html body .sidebar{width:220px!important;min-width:220px!important;max-width:220px!important;}
  html body .main,html body .content{min-width:0!important;max-width:100%!important;}
  html body .topbar .topbar-tablet-menu{display:none!important;}
  html body .topbar .topbar-desktop-shell{
    display:grid!important;
    grid-template-columns:minmax(125px,155px) minmax(250px,1fr) minmax(330px,auto)!important;
    grid-template-areas:"brand context actions"!important;
    align-items:center!important;
    gap:8px!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:66px!important;
    padding:8px 12px!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-title{grid-area:brand!important;min-width:0!important;overflow:hidden!important;}
  html body .topbar .topbar-eyebrow{font-size:.62rem!important;letter-spacing:.06em!important;gap:4px!important;white-space:nowrap!important;overflow:hidden!important;}
  html body .topbar .topbar-eyebrow>span:first-child{min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;}
  html body .topbar .topbar-version{flex:0 0 auto!important;min-height:24px!important;padding:3px 6px!important;font-size:.58rem!important;}
  html body .topbar .topbar-context{grid-area:context!important;min-width:0!important;}
  html body .topbar .department-context-switch,html body .topbar .department-context-static{
    width:100%!important;max-width:100%!important;min-width:0!important;min-height:42px!important;padding:4px 5px 4px 9px!important;gap:7px!important;border-radius:14px!important;overflow:hidden!important;
  }
  html body .topbar .department-context-switch>span,html body .topbar .department-context-static>span{font-size:.58rem!important;letter-spacing:.07em!important;white-space:nowrap!important;}
  html body .topbar .department-context-switch select,html body .topbar .department-context-static strong{height:33px!important;min-height:33px!important;padding:0 30px 0 10px!important;font-size:.8rem!important;line-height:33px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
  html body .topbar .topbar-actions{grid-area:actions!important;display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:6px!important;min-width:0!important;overflow:hidden!important;}
  html body .topbar .theme-switch{height:36px!important;min-height:36px!important;padding:2px!important;gap:1px!important;}
  html body .topbar .theme-switch .theme-dot{width:27px!important;min-width:27px!important;height:30px!important;min-height:30px!important;font-size:.64rem!important;}
  html body .topbar .theme-switch .theme-dot.auto{min-width:41px!important;padding:0 6px!important;}
  html body .topbar .topbar-user-cluster{display:flex!important;align-items:center!important;gap:5px!important;min-width:0!important;overflow:hidden!important;}
  html body .topbar .topbar-account-info{display:flex!important;align-items:center!important;gap:5px!important;min-width:0!important;max-width:190px!important;padding:3px 4px!important;overflow:hidden!important;}
  html body .topbar .topbar-role-badge{max-width:72px!important;min-height:27px!important;padding:4px 6px!important;font-size:.52rem!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
  html body .topbar .user-chip,html body .topbar .user-chip.has-role-badge{min-width:0!important;max-width:92px!important;padding:0 3px!important;font-size:.72rem!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
  html body .topbar .topbar-logout .btn{min-width:64px!important;height:36px!important;min-height:36px!important;padding:0 8px!important;font-size:.7rem!important;white-space:nowrap!important;}
  html body .content{padding:18px!important;overflow-x:hidden!important;}
  html body .content .table-wrap,html body .content .data-table-card,html body .content .checks-table-wrap{max-width:100%!important;overflow-x:auto!important;overflow-y:visible!important;-webkit-overflow-scrolling:touch!important;}
  html body .content :is(th,td){word-break:normal!important;overflow-wrap:break-word!important;hyphens:none!important;}
}

/* v1.2.75 – tablet-only polish. Mobile <=760px and desktop with mouse remain unchanged. */
@media (min-width:761px) and (max-width:1180px),
       (min-width:1181px) and (max-width:1366px) and (hover:none) and (pointer:coarse){
  html body .topbar .topbar-desktop-shell{
    align-items:center!important;
    column-gap:10px!important;
  }
  html body .topbar .topbar-title,
  html body .topbar .topbar-context,
  html body .topbar .topbar-actions{align-self:center!important;}

  /* Keep the fire-department label inside its field instead of letting it float into the row above. */
  html body .topbar .department-context-switch,
  html body .topbar .department-context-static{
    grid-template-columns:74px minmax(0,1fr)!important;
    align-items:center!important;
    gap:8px!important;
    min-height:42px!important;
    padding:4px 5px 4px 10px!important;
    overflow:hidden!important;
  }
  html body .topbar .department-context-switch>span,
  html body .topbar .department-context-static>span{
    position:static!important;
    inset:auto!important;
    align-self:center!important;
    width:auto!important;
    min-width:0!important;
    max-width:74px!important;
    margin:0!important;
    padding:0!important;
    line-height:1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  html body .topbar .department-context-switch select,
  html body .topbar .department-context-static strong{
    min-width:0!important;
    max-width:100%!important;
    height:34px!important;
    min-height:34px!important;
    line-height:34px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  html body .topbar .topbar-actions,
  html body .topbar .topbar-user-cluster,
  html body .topbar .topbar-account-info{
    min-width:0!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-actions{gap:7px!important;}
  html body .topbar .topbar-user-cluster{gap:7px!important;}
  html body .topbar .topbar-account-info{gap:6px!important;}
  html body .topbar .topbar-role-badge,
  html body .topbar .user-chip,
  html body .topbar .user-chip.has-role-badge{
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  /* General tablet content sizing: desktop-like, but without squeezing. */
  html body .content{padding:clamp(16px,1.7vw,20px)!important;}
  html body .content .rp55-dash-hero{
    grid-template-columns:minmax(0,1.12fr) minmax(285px,.88fr)!important;
    align-items:center!important;
    gap:clamp(22px,2.5vw,32px)!important;
    padding:clamp(28px,3vw,34px)!important;
  }
  html body .content .rp55-dash-copy{min-width:0!important;max-width:760px!important;}
  html body .content .rp55-dash-copy h1{
    max-width:720px!important;
    font-size:clamp(2.55rem,4.2vw,3.55rem)!important;
    line-height:.98!important;
    text-wrap:balance!important;
    overflow-wrap:normal!important;
  }
  html body .content .rp55-dash-copy .muted{
    max-width:700px!important;
    font-size:clamp(.92rem,1.35vw,1.02rem)!important;
  }
  html body .content .rp55-dash-tags{gap:8px!important;margin-top:16px!important;}
  html body .content .rp55-dash-tags span{
    min-width:0!important;
    padding:8px 10px!important;
    font-size:clamp(.72rem,1vw,.82rem)!important;
    white-space:nowrap!important;
  }
  html body .content .rp55-dash-actions{
    width:100%!important;
    min-width:0!important;
    max-width:360px!important;
    justify-self:end!important;
    align-self:center!important;
    gap:9px!important;
  }
  html body .content .rp55-dash-actions .btn{
    width:100%!important;
    min-width:0!important;
    min-height:42px!important;
    padding:8px 12px!important;
    white-space:nowrap!important;
  }

  html body .content :is(.pill,.status,.role,.badge,.secure-pill){
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:max-content!important;
    max-width:100%!important;
    min-height:30px!important;
    line-height:1.1!important;
    white-space:nowrap!important;
  }
  html body .content .table-wrap :is(th,td){
    writing-mode:horizontal-tb!important;
    word-break:normal!important;
    overflow-wrap:break-word!important;
    hyphens:none!important;
  }
  html body .content .table-wrap th{white-space:normal!important;line-height:1.15!important;}
}

/* Compact tablets: stack only the dashboard hero, rather than compressing both columns. */
@media (min-width:761px) and (max-width:1040px){
  html body .content .rp55-dash-hero{
    grid-template-columns:1fr!important;
    gap:20px!important;
  }
  html body .content .rp55-dash-actions{
    max-width:none!important;
    justify-self:stretch!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html body .content .rp55-kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
}

/* iPad/large touch landscape: preserve one clean header row with predictable proportions. */
@media (min-width:1181px) and (max-width:1366px) and (hover:none) and (pointer:coarse){
  html body .app-shell{grid-template-columns:210px minmax(0,1fr)!important;}
  html body .sidebar{width:210px!important;min-width:210px!important;max-width:210px!important;}
  html body .topbar .topbar-desktop-shell{
    grid-template-columns:minmax(170px,190px) minmax(290px,1fr) minmax(365px,auto)!important;
    grid-template-areas:"brand context actions"!important;
    min-height:64px!important;
    padding:8px 14px!important;
    gap:10px!important;
    overflow:hidden!important;
  }
  html body .topbar .topbar-eyebrow{font-size:.64rem!important;letter-spacing:.065em!important;}
  html body .topbar .topbar-version{font-size:.59rem!important;}
  html body .topbar .topbar-context{display:flex!important;justify-content:center!important;}
  html body .topbar .department-context-switch,
  html body .topbar .department-context-static{max-width:430px!important;}
  html body .topbar .topbar-actions{justify-content:flex-end!important;}
  html body .topbar .topbar-account-info{max-width:205px!important;}
  html body .topbar .user-chip,
  html body .topbar .user-chip.has-role-badge{max-width:108px!important;font-size:.74rem!important;}
  html body .topbar .topbar-role-badge{max-width:76px!important;font-size:.54rem!important;}
  html body .topbar .topbar-logout .btn{min-width:70px!important;padding-inline:10px!important;}
}
