/* Patch 7.2: consistent RTL/LTR rules for tables, dialogs and receipts. */
html[dir="rtl"] body {
    text-align: right;
}

html[dir="ltr"] body {
    text-align: left;
}

html[dir="rtl"] .modal,
html[dir="rtl"] .modal-dialog,
html[dir="rtl"] .modal-content,
html[dir="rtl"] [role="dialog"],
html[dir="rtl"] .offcanvas,
html[dir="rtl"] .dropdown-menu {
    direction: rtl;
    text-align: right;
}

html[dir="ltr"] .modal,
html[dir="ltr"] .modal-dialog,
html[dir="ltr"] .modal-content,
html[dir="ltr"] [role="dialog"],
html[dir="ltr"] .offcanvas,
html[dir="ltr"] .dropdown-menu {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] table,
html[dir="rtl"] thead,
html[dir="rtl"] tbody,
html[dir="rtl"] tfoot {
    direction: rtl;
}

html[dir="ltr"] table,
html[dir="ltr"] thead,
html[dir="ltr"] tbody,
html[dir="ltr"] tfoot {
    direction: ltr;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
    text-align: right;
}

html[dir="ltr"] th,
html[dir="ltr"] td {
    text-align: left;
}

html[dir] th.text-center,
html[dir] td.text-center,
html[dir] .text-center {
    text-align: center !important;
}

html[dir] th.text-end,
html[dir] td.text-end,
html[dir] .text-end {
    text-align: end !important;
}

html[dir] th.text-start,
html[dir] td.text-start,
html[dir] .text-start {
    text-align: start !important;
}

input[type="number"],
input[type="tel"],
input[type="time"],
input[type="date"],
input[type="datetime-local"],
.money,
.amount,
.currency,
[data-numeric] {
    direction: ltr !important;
    unicode-bidi: isolate;
}

.receipt-doc,
.receipt-copy,
#receipt-print-area,
.invoice,
.invoice-print {
    unicode-bidi: plaintext;
}

html[dir="rtl"] .receipt-meta-row,
html[dir="rtl"] .receipt-total-box {
    direction: rtl;
}

html[dir="ltr"] .receipt-meta-row,
html[dir="ltr"] .receipt-total-box {
    direction: ltr;
}

.receipt-meta-value,
.receipt-items .item-qty,
.receipt-items .item-total {
    unicode-bidi: isolate;
}

.erp-client-safe-message {
    direction: inherit !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif !important;
}

pre.erp-client-safe-message,
code.erp-client-safe-message {
    display: block;
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
}

@media print {
    .receipt-doc,
    .receipt-copy,
    #receipt-print-area,
    .invoice,
    .invoice-print {
        text-align: start;
    }
}
