/* DIAR-6B.3-R3.1 — physical RTL placement hotfix.
 * Root cause: the R5 stability layer had higher specificity and used logical
 * inset-inline-end:0 on an RTL sidebar. Because the sidebar itself has
 * direction:rtl, that logical end maps to the physical LEFT. The shell still
 * reserved 296px on the right, producing a blank right rail and left overlay.
 * This layer uses a higher-specificity selector and makes logical + physical
 * insets agree on the same edge.
 */

@media (min-width:761px){
  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  .elite-shell[data-native-shell-contract="R4"]{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 296px!important;
    grid-template-areas:"native-main native-sidebar"!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
    direction:ltr!important;
    overflow:visible!important;
  }

  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  .elite-shell[data-native-shell-contract="R4"] >
  .elite-sidebar[data-native-sidebar-contract="R4"]{
    grid-area:native-sidebar!important;
    position:fixed!important;
    top:0!important;
    bottom:0!important;
    right:0!important;
    left:auto!important;
    inset-block-start:0!important;
    inset-block-end:0!important;
    inset-inline-start:0!important; /* RTL inline-start = physical right */
    inset-inline-end:auto!important;
    width:296px!important;
    min-width:296px!important;
    max-width:296px!important;
    height:100dvh!important;
    margin:0!important;
    transform:none!important;
    translate:none!important;
    direction:rtl!important;
    z-index:90!important;
  }

  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  .elite-shell[data-native-shell-contract="R4"] >
  .elite-main[data-native-main-contract="R4"]{
    grid-area:native-main!important;
    position:relative!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding-inline:32px!important;
    transform:none!important;
    translate:none!important;
    direction:rtl!important;
    overflow-x:clip!important;
  }

  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  .elite-topbar--diar-premium{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    left:auto!important;
    right:auto!important;
    direction:rtl!important;
    box-sizing:border-box!important;
  }

  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  :is(.diar-premium-page,.diar-cases-page,.frozen-evidence-page,
      .executive-dashboard-page,.diar-context-nav){
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin-inline:0!important;
    box-sizing:border-box!important;
  }
}

@media (min-width:761px) and (max-width:1280px){
  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  .elite-shell[data-native-shell-contract="R4"] >
  .elite-main[data-native-main-contract="R4"]{
    padding-inline:20px!important;
  }
}

@media (max-width:760px){
  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body[data-native-sidebar-page^="diar-"]
  .elite-shell[data-native-shell-contract="R4"] >
  .elite-sidebar[data-native-sidebar-contract="R4"]{
    right:0!important;
    left:auto!important;
    inset-inline-start:0!important;
    inset-inline-end:auto!important;
    transform:translateX(105%)!important;
  }
  html[dir="rtl"].native-sidebar-enhanced.diar-sidebar-r5-stable
  body.sidebar-open[data-native-sidebar-page^="diar-"]
  .elite-shell[data-native-shell-contract="R4"] >
  .elite-sidebar[data-native-sidebar-contract="R4"]{
    transform:none!important;
  }
}
