/* RTL direction is layout only; preserve filename, preview, canvas, numerical and document semantics */
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .hm-header, html[dir="rtl"] .hm-head-inner, html[dir="rtl"] .footer, html[dir="rtl"] main { direction: rtl; }
html[dir="rtl"] input[type="file"],html[dir="rtl"] #office-preview,html[dir="rtl"] .office-download,html[dir="rtl"] .office-progress-fill { direction: ltr; }
html[dir="rtl"] #office-selected strong,html[dir="rtl"] #office-preview-info { unicode-bidi: plaintext; }
html[dir="rtl"] .hm-mega { text-align: start; }
html[dir="rtl"] .hm-chevron { transform: scaleX(-1); }

/* Workspace RTL layout and document semantics preservation */
html[dir="rtl"] canvas,
html[dir="rtl"] .pc-viewer-canvas,
html[dir="rtl"] .pc-viewer-sheet,
html[dir="rtl"] #pc-viewer-canvas,
html[dir="rtl"] #pc-viewer-overlays,
html[dir="rtl"] .pc-canvas-wrap {
  direction: ltr !important;
}
html[dir="rtl"] .pc-v5-jump,
html[dir="rtl"] #pc-viewer-zoom,
html[dir="rtl"] .pc-range-field input,
html[dir="rtl"] .pc-range-row {
  direction: ltr !important;
  unicode-bidi: isolate;
}
html[dir="rtl"] .pc-tool {
  text-align: right !important;
}
html[dir="rtl"] .pc-toolbar {
  direction: rtl !important;
}
html[dir="rtl"] .pc-toolbar .pc-count {
  margin-left: 0 !important;
  margin-right: auto !important;
}
html[dir="rtl"] .pc-v5-settings-title {
  direction: rtl !important;
}



/* Prevent input overflow on narrow or RTL panels */
.pc-panel,
.pc-panel * {
  min-width: 0 !important;
  box-sizing: border-box !important;
}
.pc-panel select,
.pc-panel input,
.pc-panel textarea {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
