/* RTL layout — scoped to Hebrew locale only. Desktop-first overrides in min-width block per project rules. */

html[dir="rtl"] body {
  text-align: right;
}

/* Top bar: same chrome as English — logo left, account / ⋯ right */
html[dir="rtl"] .topbar__inner,
html[dir="rtl"] .topbar__primary,
html[dir="rtl"] .top-actions {
  direction: ltr;
}

html[dir="rtl"] .brand,
html[dir="rtl"] .brand-text {
  direction: ltr;
  text-align: left;
}

/* Nav row: search left, back right — same physical layout as English */
html[dir="rtl"] .topbar__navrow {
  direction: ltr;
}

html[dir="rtl"] .form-actions,
html[dir="rtl"] .portiva-flow-page__footer-actions {
  direction: rtl;
}

/* Label left, arrow right — string is `text →` */
html[dir="rtl"] #btnBack,
html[dir="rtl"] .portiva-nav-back {
  direction: ltr;
}

html[dir="rtl"] .topbar-locale-select {
  margin-inline-start: 0.5rem;
}

/* Addresses / bank values: keep Latin/number-first order in Hebrew UI */
.portiva-address-text,
.portiva-ltr-value,
html[dir="rtl"] input[dir="ltr"],
html[dir="rtl"] textarea[dir="ltr"] {
  unicode-bidi: isolate;
}

html[dir="rtl"] .portiva-address-text[dir="ltr"],
html[dir="rtl"] .portiva-ltr-value[dir="ltr"],
html[dir="rtl"] input[dir="ltr"],
html[dir="rtl"] textarea[dir="ltr"] {
  text-align: left;
}

html[dir="rtl"] .portiva-address-text[dir="rtl"],
html[dir="rtl"] input[dir="rtl"],
html[dir="rtl"] textarea[dir="rtl"] {
  text-align: right;
}

/* Bank details: Hebrew labels on the right, English values (routing, account, etc.) on the left */
html[dir="rtl"] .entityDetailsReadonlySection .entityDetailsDl--pairInline:not(.entityDetailsDl--entityCopy),
html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl,
html[dir="rtl"] .summaries-entity-block__bank .summaries-entity-block__dl,
html[dir="rtl"] .summaries-entity-block__access .summaries-entity-block__dl {
  direction: rtl;
}

html[dir="rtl"] .entityDetailsReadonlySection .entityDetailsDl--pairInline:not(.entityDetailsDl--entityCopy) dt,
html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl dt,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl dt,
html[dir="rtl"] .summaries-entity-block__bank .summaries-entity-block__dl dt,
html[dir="rtl"] .summaries-entity-block__access .summaries-entity-block__dl dt {
  text-align: right;
}

html[dir="rtl"] .entityDetailsReadonlySection .entityDetailsDl--pairInline:not(.entityDetailsDl--entityCopy) dd,
html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl dd,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl dd,
html[dir="rtl"] .summaries-entity-block__bank .summaries-entity-block__dl dd,
html[dir="rtl"] .summaries-entity-block__access .summaries-entity-block__dl dd,
html[dir="rtl"] .entityDetailsReadonlySection .entityDetailsDl--pairInline:not(.entityDetailsDl--entityCopy) dd.entityDetailsDd--num,
html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl dd.entityDetailsDd--num,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl dd.entityDetailsDd--num,
html[dir="rtl"] .summaries-entity-block__bank .summaries-entity-block__dl dd.entityDetailsDd--num,
html[dir="rtl"] .summaries-entity-block__access .summaries-entity-block__dl dd.entityDetailsDd--num,
html[dir="rtl"] .entityDetailsReadonlySection .entityDetailsDl--pairInline:not(.entityDetailsDl--entityCopy) dd.entityDetailsDd--text,
html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl dd.entityDetailsDd--text,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl dd.entityDetailsDd--text,
html[dir="rtl"] .summaries-entity-block__bank .summaries-entity-block__dl dd.entityDetailsDd--text,
html[dir="rtl"] .summaries-entity-block__access .summaries-entity-block__dl dd.entityDetailsDd--text {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  justify-self: end;
}

html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl dd .entityDetailsDdVal,
html[dir="rtl"] .summaries-entity-block__bank .entityDetailsDl dd .portiva-ltr-value,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl dd .entityDetailsDdVal,
html[dir="rtl"] .summaries-entity-block__access .entityDetailsDl dd .portiva-ltr-value {
  display: block;
  width: 100%;
  text-align: left;
}

/* Asset page: Hebrew labels right; shared value column; dots right of values. */
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl {
  direction: rtl;
  grid-template-columns: auto minmax(10rem, 1fr);
  column-gap: 16px;
  row-gap: 6px;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dt,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dt {
  text-align: right;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDd--text,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDd--num,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd.entityDetailsDd--text,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd.entityDetailsDd--num {
  direction: ltr;
  unicode-bidi: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11px;
  column-gap: 6px;
  align-items: baseline;
  justify-self: stretch;
  width: 100%;
  text-align: right;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd > :not(.formula-field-dd__row):not(.loan-field-help-panel),
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd > :not(.formula-field-dd__row):not(.loan-field-help-panel) {
  grid-column: 1;
  min-width: 0;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .entityDetailsDdVal,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .portiva-address-text,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .portiva-ltr-value,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .asset-readonly-link,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd .entityDetailsDdVal {
  text-align: right;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDdWithCopy {
  grid-template-columns: minmax(0, 1fr) auto 11px;
  column-gap: 8px;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDdWithCopy > :not(.btn-icon-copy) {
  grid-column: 1;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDdWithCopy > .btn-icon-copy {
  grid-column: 2;
  justify-self: end;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.formula-field-dd .formula-field-dd__row,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd.formula-field-dd .formula-field-dd__row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11px;
  column-gap: 6px;
  align-items: center;
  width: 100%;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.formula-field-dd .formula-field-dd__val,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd.formula-field-dd .formula-field-dd__val {
  grid-column: 1;
  text-align: right;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.formula-field-dd .formula-field-dot--readonly,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .required-field-dot,
html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-lender-readonly__dl dd.formula-field-dd .formula-field-dot--readonly {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  margin: 0;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.formula-field-dd .formula-field-dd__val:has(.entityDetailsDd__value-help-row) {
  display: contents;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .entityDetailsDd__value-help-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11px;
  column-gap: 6px;
  align-items: center;
  width: 100%;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .entityDetailsDd__value-help-row .loan-field-help-toggle {
  grid-column: 2;
  justify-self: center;
  margin: 0;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .loan-field-help-panel {
  grid-column: 1 / -1;
}

html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .loan-update-status {
  text-align: right;
}

/* Folder / entity / asset name bar: edit on physical left, name on physical right */
html[dir="rtl"] .home-overview-chart-tab.home-overview-chart-tab--folder-name,
html[dir="rtl"] .home-overview-chart-tab.home-overview-chart-tab--entity-name,
html[dir="rtl"] .home-overview-chart-tab.home-overview-chart-tab--asset-name {
  direction: rtl;
  padding: 0 14px 0 10px;
}

html[dir="rtl"] .home-overview-chart-tab--folder-name__text {
  text-align: right;
}

html[dir="rtl"] .home-overview-chart-tab--folder-name__rename,
html[dir="rtl"] .home-overview-chart-tab--entity-name__actions,
html[dir="rtl"] .asset-page .home-overview-chart-tab--asset-name__edit {
  margin-left: auto;
  margin-right: 0;
}

html[dir="rtl"] .entityDetailsBubbleTitle,
html[dir="rtl"] .add-asset-section__title,
html[dir="rtl"] .summaries-entity-block__subtitle {
  text-transform: none;
  letter-spacing: normal;
  text-align: right;
}

html[dir="rtl"] .modal-field,
html[dir="rtl"] .welcome-page__label,
html[dir="rtl"] .portiva-flow-page__title,
html[dir="rtl"] .portiva-flow-page__lead {
  text-align: right;
}

html[dir="rtl"] .topbar-overflow-panel {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .topbar-overflow-item {
  text-align: right;
}

html[dir="rtl"] .welcome-page__copy-block,
html[dir="rtl"] .welcome-page__copy-block h1,
html[dir="rtl"] .welcome-page__list,
html[dir="rtl"] .welcome-page__list li,
html[dir="rtl"] .welcome-page__intro,
html[dir="rtl"] .welcome-data-note,
html[dir="rtl"] .welcome-overview-bubbles,
html[dir="rtl"] .welcome-overview-bubble,
html[dir="rtl"] .welcome-manager-plan,
html[dir="rtl"] .welcome-page__structure-copy,
html[dir="rtl"] .welcome-page__structure-footnote {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .welcome-page__list {
  padding-inline-start: 0;
  padding-inline-end: 1.25rem;
  list-style-position: outside;
}

/* Structure maps: always LTR layout (node positions, arrows, tiers) — same as English */
html[dir="rtl"] .home-hier-tree,
html[dir="rtl"] .home-hier-tree-page,
html[dir="rtl"] #homeHierTreeModal,
html[dir="rtl"] .folder-page-map-bubble,
html[dir="rtl"] .entity-page-map-bubble,
html[dir="rtl"] .home-page-map-bubble,
html[dir="rtl"] .welcome-structure-demo,
html[dir="rtl"] .detailsHierarchyGraph,
html[dir="rtl"] .detailsHierarchyGraphWrap {
  direction: ltr;
  text-align: left;
}

/* Welcome structure demo: Hebrew tier labels on the right, arrows point into the diagram */
html[dir="rtl"] .welcome-structure-demo__layout {
  flex-direction: column;
}
html[dir="rtl"] .welcome-structure-demo__type-label {
  justify-self: end;
  padding-left: 2px;
  padding-right: 0;
}
html[dir="rtl"] .welcome-structure-demo__type-label--folders {
  grid-column: 2;
  grid-row: 1;
}
html[dir="rtl"] .welcome-structure-demo__row--folders {
  grid-column: 1;
  grid-row: 1;
}
html[dir="rtl"] .welcome-structure-demo__type-label--entities {
  grid-column: 2;
  grid-row: 2 / 4;
}
html[dir="rtl"] .welcome-structure-demo__row--entities {
  grid-column: 1;
  grid-row: 2;
}
html[dir="rtl"] .welcome-structure-demo__row--entity-sub {
  grid-column: 1;
  grid-row: 3;
}
html[dir="rtl"] .welcome-structure-demo__type-label--assets {
  grid-column: 2;
  grid-row: 4;
}
html[dir="rtl"] .welcome-structure-demo__row--assets {
  grid-column: 1;
  grid-row: 4;
}

html[dir="rtl"] .formula-field-help-entry,
html[dir="rtl"] .formula-field-help-entry__title,
html[dir="rtl"] .formula-field-help-entry__purpose,
html[dir="rtl"] .formula-field-help-entry__empty,
html[dir="rtl"] .formula-help-page .portiva-flow-page__hero {
  text-align: right;
}

/* Hebrew pie legends (mobile + desktop): swatch · % · name — value on the left */
html[dir="rtl"] .pieLegend {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .pieLegendRollupRow {
  direction: rtl;
}

html[dir="rtl"] .pieLegendRollupRow > .pieLegendRowMain {
  direction: rtl;
  justify-content: flex-start;
}

html[dir="rtl"] .pieLegendRollupName {
  justify-content: flex-end;
  text-align: right;
}

html[dir="rtl"] .pieLegendRollupNameText {
  text-align: right;
  direction: rtl;
  unicode-bidi: isolate;
}

html[dir="rtl"] .pieLegendRollupPct {
  unicode-bidi: isolate;
}

html[dir="rtl"] .pieLegendRollupEq {
  margin-left: 0;
  margin-right: auto;
  text-align: left;
  direction: ltr;
  unicode-bidi: isolate;
}

html[dir="rtl"] .pieLegendRow.pieLegendRow--otherMerge,
html[dir="rtl"] .pieLegendRow.pieLegendRow--cashflow {
  direction: rtl;
}

html[dir="rtl"] .pieLegendMerged {
  text-align: right;
}

html[dir="rtl"] .pieOtherAssetList {
  padding: 0 14px 0 0;
  direction: rtl;
}

html[dir="rtl"] .pieOtherAssetList .pieLegendRollupEq {
  margin-left: 0;
  margin-right: auto;
  text-align: left;
}

/* Mobile HE: שווי + equity amount on physical left; Add entity on physical right */
@media (max-width: 900px) {
  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split {
    direction: ltr;
    justify-content: space-between;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    transform: translateY(-4px);
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left .label,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left .label {
    text-align: left;
    align-self: flex-start;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left .value,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left .value,
  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left [data-home-beneficial-total],
  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left [data-folder-beneficial-total],
  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left [data-entity-beneficial-total],
  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left [data-asset-beneficial-total],
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left [data-home-beneficial-total],
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left [data-folder-beneficial-total],
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left [data-entity-beneficial-total],
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left [data-asset-beneficial-total] {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
    align-self: flex-start;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__left .stat-card-total-fx,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__left .stat-card-total-fx {
    align-items: flex-start;
    text-align: left;
    align-self: flex-start;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-split__right,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-split__right {
    align-self: flex-end;
    flex: 0 0 auto;
    margin-left: auto;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-action-stack,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-action-stack {
    align-items: stretch;
    width: 6.875rem;
    max-width: 6.875rem;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-action-stack .home-equity-spot-label,
  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-action-stack .home-usd-spot-rate,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-action-stack .home-equity-spot-label,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-action-stack .home-usd-spot-rate {
    text-align: center;
    transform: none;
    align-self: stretch;
  }

  html[dir="rtl"] #view > main .home-summary--in-main .home-equity-action-stack .home-equity-add-entity-btn,
  html[dir="rtl"] .home-main .home-summary--in-main .home-equity-action-stack .home-equity-add-entity-btn {
    align-self: stretch;
  }

  html[dir="rtl"] .home-equity-action-row {
    flex-direction: row-reverse;
  }
}

@media (min-width: 901px) {
  html[dir="rtl"] .topbar--home .topbar__primary,
  html[dir="rtl"] .topbar--home .topbar__home-summary-slot {
    direction: ltr;
  }

  /* Name bars stay RTL (edit left, title right) even when chart tabs are LTR */
  html[dir="rtl"] .home-overview-chart-tabs--folder-name .home-overview-chart-tab--folder-name,
  html[dir="rtl"] .home-overview-chart-tabs--entity-name .home-overview-chart-tab--entity-name,
  html[dir="rtl"] .home-overview-chart-tabs--asset-name .home-overview-chart-tab--asset-name {
    direction: rtl;
  }

  /* Overview pies: legend left, chart right — same grid as English */
  html[dir="rtl"] .portiva-overview-pie-layout,
  html[dir="rtl"] .home-overview-chart-tabs,
  html[dir="rtl"] .home-folder-pie-wrap,
  html[dir="rtl"] .folder-page-pie-wrap,
  html[dir="rtl"] .entity-page-pie-wrap,
  html[dir="rtl"] .detailsChartSection--overview-tabs,
  html[dir="rtl"] .detailsChartSection .home-overview-pie-analyst {
    direction: ltr;
  }

  html[dir="rtl"] .portiva-overview-pie-layout .home-overview-pie-analyst .pieChartBlockHeading,
  html[dir="rtl"] .portiva-overview-pie-layout .home-overview-pie-analyst .pieChartBlockTitle {
    text-align: left;
  }

  html[dir="rtl"] .hero-title-row,
  html[dir="rtl"] .welcome-overview-grid {
    direction: rtl;
  }

  /* Portfolio hero (home / folder / entity / asset): nudge row down without shifting the pie */
  html[dir="rtl"] .home-main > .home-hero .hero-title-row--home,
  html[dir="rtl"] .folder-page > .hero--folder-page .hero-title-row--home,
  html[dir="rtl"] .entity-page > .hero--folder-page .hero-title-row--home,
  html[dir="rtl"] .asset-page > .hero--folder-page .hero-title-row--home {
    transform: translateY(6px);
  }

  html[dir="rtl"] .welcome-page__list {
    padding-inline-start: 0;
    padding-inline-end: 1.25rem;
  }

  /* Asset page equity row: beneficial share line under the amount */
  html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDd--num:has(.asset-beneficial-share-status) {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd.entityDetailsDd--num:has(.asset-beneficial-share-status) > :not(.formula-field-dd__row):not(.loan-field-help-panel) {
    grid-column: auto;
    width: 100%;
  }

  html[dir="rtl"] .asset-page #assetReadonlyWrap .asset-readonly-panel .entityDetailsDl dd .asset-beneficial-share-status {
    margin-top: 0;
    max-width: 100%;
    text-align: right;
    align-self: flex-end;
  }
}

/* Summaries search: Hebrew — pills on the right, labels right-aligned */
html[dir="rtl"] .summaries-search-recent,
html[dir="rtl"] .summaries-search-recent__list,
html[dir="rtl"] .summaries-search-results {
  direction: rtl;
}

html[dir="rtl"] .summaries-search-recent__title {
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

html[dir="rtl"] .summaries-search-row {
  direction: rtl;
  justify-content: flex-start;
  text-align: right;
}

html[dir="rtl"] .summaries-search-row__label {
  text-align: right;
}

html[dir="rtl"] .summaries-search-row__pill {
  order: -1;
}

/* Form-flow desktop topbars: title in center column; back stays on the physical right */
@media (min-width: 900px) {
  html[dir="rtl"] .topbar__navrow--rename-folder #btnBack,
  html[dir="rtl"] .topbar__navrow--add-asset #btnBack,
  html[dir="rtl"] .topbar__navrow--asset-edit #btnBack {
    grid-column: 3;
    justify-self: end;
  }

  html[dir="rtl"] .topbar__navrow--rename-folder .rename-folder-page__nav-grid,
  html[dir="rtl"] .topbar__navrow--add-asset .add-asset-page__nav-grid,
  html[dir="rtl"] .topbar__navrow--asset-edit .asset-edit-page__nav-grid {
    grid-column: 2;
    direction: rtl;
  }

  html[dir="rtl"] .topbar__navrow--rename-folder .rename-folder-page__nav-title,
  html[dir="rtl"] .topbar__navrow--add-asset .add-asset-page__nav-title,
  html[dir="rtl"] .topbar__navrow--asset-edit .asset-edit-page__nav-title {
    text-align: right;
  }

  html[dir="rtl"] .topbar__navrow--rename-folder .rename-folder-page__nav-actions,
  html[dir="rtl"] .topbar__navrow--add-asset .add-asset-page__nav-actions,
  html[dir="rtl"] .topbar__navrow--asset-edit .asset-edit-page__nav-actions {
    direction: ltr;
    justify-content: flex-end;
  }
}

/* Add / edit asset (Hebrew): lender hints + loan estimates disclaimer right-aligned */
html[dir="rtl"] .add-asset-page .entityDetailsBubbleTitleHint,
html[dir="rtl"] .add-asset-page .entityDetailsBubbleTitleHint--disclaimer,
html[dir="rtl"] #addAssetModal .entityDetailsBubbleTitleHint,
html[dir="rtl"] #addAssetModal .entityDetailsBubbleTitleHint--disclaimer,
html[dir="rtl"] .asset-edit-page .entityDetailsBubbleTitleHint,
html[dir="rtl"] .asset-edit-page .entityDetailsBubbleTitleHint--disclaimer,
html[dir="rtl"] #assetEditForm .entityDetailsBubbleTitleHint--disclaimer,
html[dir="rtl"] #assetEditModal .entityDetailsBubbleTitleHint--disclaimer,
html[dir="rtl"] .modern-mortgages-bubble .modern-mortgages-disclaimer,
html[dir="rtl"] .modern-mortgages-bubble .modern-mortgages-hint {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .add-asset-page #addAssetAddress,
html[dir="rtl"] .add-asset-page #addAssetFinInsuranceNotes,
html[dir="rtl"] #addAssetModal #addAssetAddress,
html[dir="rtl"] #addAssetModal #addAssetFinInsuranceNotes {
  text-align: right;
}

html[dir="rtl"] .add-asset-page #formAddAsset .modal-field input::placeholder,
html[dir="rtl"] .add-asset-page #formAddAsset .modal-field textarea::placeholder,
html[dir="rtl"] #addAssetModal .modal-field input::placeholder,
html[dir="rtl"] #addAssetModal .modal-field textarea::placeholder {
  text-align: right;
}

html[dir="rtl"] .add-asset-page #addAssetComments,
html[dir="rtl"] #addAssetModal #addAssetComments {
  direction: rtl;
  text-align: right;
}

/* Edit pages (Hebrew): address field hints / placeholders right-aligned */
html[dir="rtl"] .asset-edit-page input[name="Address"],
html[dir="rtl"] #assetEditForm input[name="Address"],
html[dir="rtl"] #assetEditModal input[name="Address"],
html[dir="rtl"] .edit-entity-page #newEntityDetail_entityAddress,
html[dir="rtl"] .edit-entity-page #newEntityDetail_bankAddress,
html[dir="rtl"] .edit-entity-page #newEntityDetail_beneficiaryAddress {
  text-align: right;
}

html[dir="rtl"] .asset-edit-page input[name="Address"]::placeholder,
html[dir="rtl"] #assetEditForm input[name="Address"]::placeholder,
html[dir="rtl"] #assetEditModal input[name="Address"]::placeholder,
html[dir="rtl"] .edit-entity-page #newEntityDetail_entityAddress::placeholder,
html[dir="rtl"] .edit-entity-page #newEntityDetail_bankAddress::placeholder,
html[dir="rtl"] .edit-entity-page #newEntityDetail_beneficiaryAddress::placeholder {
  text-align: right;
}

/* Entity forms (Hebrew): red dots visible inline on the left */
html[dir="rtl"] #formAddEntity .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] #addEntityModal .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] .add-entity-page .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] .edit-entity-page .required-input-wrap:has(> .required-field-dot) {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

html[dir="rtl"] #formAddEntity .required-input-wrap > .required-field-dot,
html[dir="rtl"] #addEntityModal .required-input-wrap > .required-field-dot,
html[dir="rtl"] .add-entity-page .required-input-wrap > .required-field-dot,
html[dir="rtl"] .edit-entity-page .required-input-wrap > .required-field-dot {
  position: static;
  left: auto;
  right: auto;
  top: auto;
  transform: none;
  flex: 0 0 auto;
}

html[dir="rtl"] #formAddEntity .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] #formAddEntity .required-input-wrap:has(> .required-field-dot) > select,
html[dir="rtl"] #addEntityModal .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] #addEntityModal .required-input-wrap:has(> .required-field-dot) > select,
html[dir="rtl"] .add-entity-page .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] .add-entity-page .required-input-wrap:has(> .required-field-dot) > select,
html[dir="rtl"] .edit-entity-page .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] .edit-entity-page .required-input-wrap:has(> .required-field-dot) > select {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: 100%;
}

/* Asset forms (Hebrew): full-width inputs + 5px gutter dots — do not use entity flex */
html[dir="rtl"] #formAddAsset .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] #addAssetModal .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] .add-asset-page .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] #assetEditForm .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] #assetEditModal .required-input-wrap:has(> .required-field-dot),
html[dir="rtl"] .asset-edit-page .required-input-wrap:has(> .required-field-dot) {
  display: block;
  width: 100%;
  min-width: 0;
}

html[dir="rtl"] #formAddAsset .required-input-wrap > .required-field-dot,
html[dir="rtl"] #addAssetModal .required-input-wrap > .required-field-dot,
html[dir="rtl"] .add-asset-page .required-input-wrap > .required-field-dot,
html[dir="rtl"] #assetEditForm .required-input-wrap > .required-field-dot,
html[dir="rtl"] #assetEditModal .required-input-wrap > .required-field-dot,
html[dir="rtl"] .asset-edit-page .required-input-wrap > .required-field-dot {
  position: absolute;
  left: auto;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  flex: none;
}

html[dir="rtl"] #formAddAsset .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] #addAssetModal .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] .add-asset-page .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] #assetEditForm .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] #assetEditForm .required-input-wrap:has(> .required-field-dot) > select,
html[dir="rtl"] #assetEditModal .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] #assetEditModal .required-input-wrap:has(> .required-field-dot) > select,
html[dir="rtl"] .asset-edit-page .required-input-wrap:has(> .required-field-dot) > input,
html[dir="rtl"] .asset-edit-page .required-input-wrap:has(> .required-field-dot) > select {
  width: 100%;
  max-width: 100%;
  display: block;
  flex: none;
}

/* Blue formula dots on the right (entity flex; asset gutter mirror) */
html[dir="rtl"] #formAddEntity .formula-control-wrap,
html[dir="rtl"] #addEntityModal .formula-control-wrap,
html[dir="rtl"] .add-entity-page .formula-control-wrap,
html[dir="rtl"] .edit-entity-page .formula-control-wrap,
html[dir="rtl"] #formAddEntity .required-input-wrap:has(> .formula-field-dot),
html[dir="rtl"] #addEntityModal .required-input-wrap:has(> .formula-field-dot),
html[dir="rtl"] .add-entity-page .required-input-wrap:has(> .formula-field-dot),
html[dir="rtl"] .edit-entity-page .required-input-wrap:has(> .formula-field-dot) {
  flex-direction: row-reverse;
}

html[dir="rtl"] #formAddAsset .formula-control-wrap > .formula-field-dot,
html[dir="rtl"] #addAssetModal .formula-control-wrap > .formula-field-dot,
html[dir="rtl"] .add-asset-page .formula-control-wrap > .formula-field-dot,
html[dir="rtl"] #assetEditForm .formula-control-wrap > .formula-field-dot,
html[dir="rtl"] #assetEditModal .formula-control-wrap > .formula-field-dot,
html[dir="rtl"] .asset-edit-page .formula-control-wrap > .formula-field-dot,
html[dir="rtl"] #formAddAsset .required-input-wrap > .formula-field-dot,
html[dir="rtl"] #addAssetModal .required-input-wrap > .formula-field-dot,
html[dir="rtl"] .add-asset-page .required-input-wrap > .formula-field-dot,
html[dir="rtl"] #assetEditForm .required-input-wrap > .formula-field-dot,
html[dir="rtl"] #assetEditModal .required-input-wrap > .formula-field-dot,
html[dir="rtl"] .asset-edit-page .required-input-wrap > .formula-field-dot {
  left: auto;
  right: -10px;
}

/* Stock holdings (Hebrew): table, add-position, hints — right-aligned */
html[dir="rtl"] .asset-stock-holdings-panel,
html[dir="rtl"] .modern-stock-holdings-panel,
html[dir="rtl"] .asset-stock-readonly__body {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .modern-holdings-table,
html[dir="rtl"] .modern-holdings-readonly-table {
  direction: rtl;
}

html[dir="rtl"] .modern-holdings-table th,
html[dir="rtl"] .modern-holdings-table td,
html[dir="rtl"] .modern-holdings-readonly-table th,
html[dir="rtl"] .modern-holdings-readonly-table td {
  text-align: right;
}

html[dir="rtl"] .modern-holdings-caption {
  text-align: right;
}

html[dir="rtl"] .modern-holding-input {
  text-align: right;
}

html[dir="rtl"] .modern-holding-input--num {
  text-align: right;
}

html[dir="rtl"] .asset-stock-holdings-panel #btnAssetStockAddPosition,
html[dir="rtl"] .modern-stock-table-actions {
  direction: rtl;
}

html[dir="rtl"] .asset-stock-holdings-panel #btnAssetStockAddPosition {
  display: block;
  margin-inline-start: auto;
  margin-inline-end: 0;
  width: fit-content;
}

html[dir="rtl"] .modern-stock-holdings-hint,
html[dir="rtl"] .asset-stock-readonly .modern-stock-holdings-hint {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .modern-holdings-foot {
  direction: rtl;
}

html[dir="rtl"] .asset-stock-readonly__actions {
  direction: rtl;
  justify-content: flex-start;
}
