/* ICODE R258: Arabic RTL across ERP Enterprise, Flow, demo and production.
 * Keep English/French unaffected. References/codes remain left-to-right.
 */
html[lang^="ar"],html[dir="rtl"]{direction:rtl}
html[dir="rtl"] body,html[lang^="ar"] body{
 direction:rtl;text-align:start;font-family:Tahoma,"Segoe UI",Arial,sans-serif;
}
html[dir="rtl"] :is(.workspace-content,.workspace-main,.main,.r73-ent-main,.r73-flow-main,.panel,.card,.module-grid,.r154-outlook,.r89-command-center){
 direction:rtl;text-align:start;min-width:0;
}
html[dir="rtl"] :is(.enterprise-sidebar,.r73-ent-side,.r73-flow-side,.side,.r111-side-nav,.r111-nav-items,.enterprise-nav,.nav){
 direction:rtl;text-align:start;
}
html[dir="rtl"] :is(.enterprise-sidebar,.r73-ent-side,.r73-flow-side,.side) :is(a,button,summary,label,small,span){text-align:start}
html[dir="rtl"] :is(input,textarea,select,.field,.form-field,.search-field,.flow-record-search){text-align:start}
html[dir="rtl"] :is(input[type="email"],input[type="tel"],input[type="url"],input[type="number"],input[type="date"],input[type="time"],input[name*="email"],input[name*="phone"],input[name*="url"],input[name*="code"],.sku,.iban,.technical-id,.currency-code){
 direction:ltr;text-align:left;unicode-bidi:plaintext;
}
html[dir="rtl"] :is(.table,.data-table,.r73-table,.r86-table,table){direction:rtl}
html[dir="rtl"] :is(th,td){text-align:start}
html[dir="rtl"] :is(.scroll,.table-scroll,.r73-table-wrap,.r90-scroll,.overflow-auto){max-width:100%;overflow-x:auto}
html[dir="rtl"] :is(.module-grid,.workspace-grid,.kpi-grid,.grid,.cards,.r89-core-grid,.r89-dashboard-grid){direction:rtl}
/* Desktop: RTL Grid's first column is physically right.
 * Legacy rules swapped template + column numbers twice: correct here. */
@media(min-width:1101px){
 html[dir="rtl"] body .workspace-shell:not(.flow-shell){
  grid-template-columns:250px minmax(0,1fr)
 }
 html[dir="rtl"] body .workspace-shell:not(.flow-shell)>.enterprise-sidebar{grid-column:1!important;grid-row:1}
 html[dir="rtl"] body .workspace-shell:not(.flow-shell)>.workspace-main{grid-column:2!important;grid-row:1;min-width:0}
 html[dir="rtl"] body .r73-ent-shell,
 html[dir="rtl"] body.r71-enterprise-business .shell{
  grid-template-columns:246px minmax(0,1fr)!important;
 }
 html[dir="rtl"] body .r73-ent-shell>.r73-ent-side,
 html[dir="rtl"] body.r71-enterprise-business .shell>.side{grid-column:1!important;grid-row:1!important}
 html[dir="rtl"] body .r73-ent-shell>.r73-ent-main,
 html[dir="rtl"] body.r71-enterprise-business .shell>.main{grid-column:2!important;grid-row:1!important;min-width:0}
 html[dir="rtl"] body.r131-sidebar-enabled .workspace-shell:not(.flow-shell),
 html[dir="rtl"] body.r131-sidebar-enabled .r73-ent-shell,
 html[dir="rtl"] body.r131-sidebar-enabled.r71-enterprise-business .shell{
  grid-template-columns:264px minmax(0,1fr)!important;
 }
 html[dir="rtl"] body.r131-sidebar-enabled.r131-sidebar-compact .workspace-shell:not(.flow-shell),
 html[dir="rtl"] body.r131-sidebar-enabled.r131-sidebar-compact .r73-ent-shell,
 html[dir="rtl"] body.r131-sidebar-enabled.r131-sidebar-compact.r71-enterprise-business .shell{
  grid-template-columns:76px minmax(0,1fr)!important;
 }
 html[dir="rtl"] body .r73-flow-body{grid-template-columns:215px minmax(0,1fr)!important}
 html[dir="rtl"] body .r73-flow-body>.r73-flow-side{grid-column:1!important;grid-row:1!important;border-right:0;border-left:1px solid #e5eaef}
 html[dir="rtl"] body .r73-flow-body>.r73-flow-main{grid-column:2!important;grid-row:1!important;min-width:0}
}
/* Mobile / tablet: native drawer must originate from the right for Arabic. */
@media(max-width:1100px){
 html[dir="rtl"] body .workspace-shell:not(.flow-shell),
 html[dir="rtl"] body .r73-ent-shell,
 html[dir="rtl"] body .r73-flow-body,
 html[dir="rtl"] body.r71-enterprise-business .shell {display:block!important;}
 html[dir="rtl"] body.r135-drawer-enabled>aside.r131-premium-ready,
 html[dir="rtl"] body.r143-navigation-ready>aside.r131-premium-ready,
 html[dir="rtl"] body.r135-drawer-enabled .workspace-shell>aside.r131-premium-ready{
  position:fixed!important;left:auto!important;right:0!important;
  inset-inline-start:0!important;inset-inline-end:auto!important;
  transform:translateX(110%)!important;
 }
 html[dir="rtl"] body.r135-drawer-enabled>aside.r131-premium-ready.r135-drawer-open,
 html[dir="rtl"] body.r143-navigation-ready.r143-navigation-open>aside.r131-premium-ready,
 html[dir="rtl"] body.r135-drawer-enabled .workspace-shell>aside.r131-premium-ready.r135-drawer-open{
  transform:translateX(0)!important;
 }
 html[dir="rtl"] body>.r135-menu-open,
 html[dir="rtl"] body>.r135-menu-backdrop{direction:rtl;}
 html[dir="rtl"] body>.r135-menu-open{left:auto!important;right:12px!important}
 html[dir="rtl"] body .r73-ent-side,
 html[dir="rtl"] body .r73-flow-side{border-right:0;border-left:0}
 html[dir="rtl"] body :is(.r73-ent-main,.r73-flow-main,.workspace-main,.main){
  min-width:0;max-width:100%;
 }
}
/* Small controls, cards, forms and scrollable records do not overflow viewport. */
@media(max-width:640px){
 html[dir="rtl"] body :is(.workspace-content,.workspace-main,.main,.r73-ent-main,.r73-flow-main,.panel,.card){min-width:0;max-width:100%}
 html[dir="rtl"] body :is(.r73-flow-content-grid,.r89-dashboard-grid,.r89-core-grid,.primary-grid,.secondary-grid){grid-template-columns:minmax(0,1fr)}
 html[dir="rtl"] body :is(input,select,textarea){max-width:100%}
}
html[dir="rtl"] body .help-drawer{inset-inline-start:auto;inset-inline-end:0;transform:translateX(-105%);}
html[dir="rtl"] body .help-drawer.open{transform:translateX(0);}
html[dir="rtl"] body :is(.r73-quick-panel,.r89-quick-panel){right:auto;left:12px;max-width:calc(100vw - 24px)}
