/*
 * bs5-compat.css - Bootstrap 3 class shims for Bootstrap 5
 * =========================================================
 *
 * This application has ~139 Blade templates carrying roughly 2,000 Bootstrap 3
 * class names, a large share of them emitted from PHP by Form::/Html:: helper
 * calls rather than written as literal HTML. Rewriting every one of them by hand
 * as part of the framework migration would have been the single riskiest change
 * in this codebase, and most of those classes only ever affected appearance.
 *
 * So the migration splits in two:
 *
 *   - Classes that are purely presentational (panel, well, label, pull-right,
 *     control-label, help-block, col-xs-*, hidden-*, btn-default, ...) are
 *     re-implemented here in terms of Bootstrap 5, so existing markup keeps
 *     rendering correctly and untouched.
 *
 *   - Anything Bootstrap 5's JavaScript actually reads was migrated in the
 *     templates, because no stylesheet can fix it: data-toggle -> data-bs-toggle,
 *     data-target -> data-bs-target, data-dismiss -> data-bs-dismiss, and the
 *     modal close button markup.
 *
 * Everything below is expressed with Bootstrap 5 variables where possible so it
 * follows the active theme, and it is written to work in both LTR and RTL (the
 * Arabic UI loads bootstrap.rtl.min.css).
 *
 * This file is NOT loaded by the PDF/print path - see
 * resources/views/layouts/partials/print_styles.blade.php, which stays on
 * Bootstrap 3 because wkhtmltopdf cannot resolve CSS custom properties.
 *
 * Retiring this file means converting the markup for real, template by template.
 * It is a deliberate, documented shim, not an accident.
 */

/* ---------------------------------------------------------------------------
 * Forms
 * BS5 removed .form-group, renamed .control-label and .help-block, and needs
 * .form-select on select elements (this app emits .form-control on them).
 * ------------------------------------------------------------------------- */

.form-group {
    margin-bottom: 1rem;
}


.control-label {
    margin-bottom: 0.5rem;
    font-weight: 400;
}

/* In a horizontal form BS3 right-aligned the label against its control. */
.form-horizontal .control-label {
    padding-top: calc(0.375rem + 1px);
    margin-bottom: 0;
    text-align: end;
}

.help-block {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--bs-secondary-color, #6c757d);
}

/* BS3 validation state wrappers. BS5 uses .is-invalid on the control itself. */
.has-error .control-label,
.has-error .help-block {
    color: var(--bs-danger, #dc3545);
}

.has-error .form-control,
.has-error .form-select {
    border-color: var(--bs-danger, #dc3545);
}

.has-success .control-label {
    color: var(--bs-success, #198754);
}

.has-success .form-control,
.has-success .form-select {
    border-color: var(--bs-success, #198754);
}

/* BS3's input feedback icon. BS5 has no equivalent: it dropped .has-feedback and
 * .form-control-feedback entirely, so the icon lost its positioning and rendered
 * as a plain inline element next to the field instead of sitting inside it. The
 * company registration date and VAT effective date in Settings are the visible
 * case - their calendar icon detached from the date input.
 *
 * Two deliberate departures from the BS3 original, which hard-coded the icon box
 * to BS3's fixed 34px control height:
 *   - height follows the control (BS5 inputs are taller, and .input-lg / .input-sm
 *     no longer exist), with flex centring instead of a matching line-height;
 *   - the padding that keeps text from running under the icon is set in rem, off
 *     the same 0.75rem gutter BS5 uses for form controls.
 *
 * Note the icon is only reachable while the wrapper carries .has-feedback, which
 * is what makes it position relative; pointer-events are off so it never steals a
 * click from the field (these date inputs open a picker on click). */
.has-feedback {
    position: relative;
}

.has-feedback .form-control {
    padding-right: 2.625rem;
}

.form-control-feedback {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 100%;
    text-align: center;
    pointer-events: none;
}

[dir="rtl"] .has-feedback .form-control {
    padding-right: 0.75rem;
    padding-left: 2.625rem;
}

[dir="rtl"] .form-control-feedback {
    right: auto;
    left: 0;
}

/* BS3's .input-sm / .input-lg became .form-control-sm / .form-control-lg. Only the
 * small variant is still used here (account and transaction filter selects), which
 * were rendering at the default size. Scoped to controls so it cannot catch the
 * unrelated .input-group-sm markup. */
.form-control.input-sm,
select.input-sm,
textarea.input-sm,
input.input-sm {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: var(--bs-border-radius-sm, 0.25rem);
}

/* A <select class="form-control"> is styled as a plain input by BS5 and loses its
 * caret. Give it the .form-select treatment without touching the markup. */
select.form-control:not([size]):not([multiple]) {
    -moz-padding-start: calc(0.75rem - 3px);
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
}

[dir="rtl"] select.form-control:not([size]):not([multiple]) {
    padding-right: 0.75rem;
    padding-left: 2.25rem;
    background-position: left 0.75rem center;
}

/* BS3 checkbox / radio wrappers. */
.checkbox,
.radio {
    position: relative;
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox label,
.radio label {
    padding-left: 1.25rem;
    margin-bottom: 0;
    font-weight: 400;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
    margin-top: 0.25rem;
    margin-right: 0.35rem;
}

.checkbox-inline,
.radio-inline {
    display: inline-block;
    margin-right: 0.75rem;
    font-weight: 400;
}

.input-group-addon {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-secondary-color, #212529);
    text-align: center;
    white-space: nowrap;
    background-color: var(--bs-tertiary-bg, #e9ecef);
    border: var(--bs-border-width, 1px) solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
}

/* ---------------------------------------------------------------------------
 * Panels -> cards
 * ------------------------------------------------------------------------- */

.panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    background-color: var(--bs-card-bg, var(--bs-body-bg, #fff));
    background-clip: border-box;
    border: var(--bs-border-width, 1px) solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
    border-radius: var(--bs-border-radius, 0.375rem);
}

.panel-heading {
    padding: 0.5rem 1rem;
    margin-bottom: 0;
    background-color: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.03));
    border-bottom: var(--bs-border-width, 1px) solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
    border-radius: var(--bs-border-radius, 0.375rem) var(--bs-border-radius, 0.375rem) 0 0;
}

.panel-body {
    flex: 1 1 auto;
    padding: 1rem;
}

.panel-footer {
    padding: 0.5rem 1rem;
    background-color: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.03));
    border-top: var(--bs-border-width, 1px) solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
    border-radius: 0 0 var(--bs-border-radius, 0.375rem) var(--bs-border-radius, 0.375rem);
}

.panel-title {
    margin-bottom: 0;
    font-size: 1rem;
}

.panel-default > .panel-heading { color: inherit; }
.panel-primary { border-color: var(--bs-primary, #0d6efd); }
.panel-primary > .panel-heading { color: #fff; background-color: var(--bs-primary, #0d6efd); }
.panel-success > .panel-heading { color: #fff; background-color: var(--bs-success, #198754); }
.panel-info    > .panel-heading { color: #fff; background-color: var(--bs-info, #0dcaf0); }
.panel-warning > .panel-heading { color: #fff; background-color: var(--bs-warning, #ffc107); }
.panel-danger  > .panel-heading { color: #fff; background-color: var(--bs-danger, #dc3545); }

.well {
    padding: 1rem;
    margin-bottom: 1.25rem;
    background-color: var(--bs-secondary-bg, #f5f5f5);
    border: var(--bs-border-width, 1px) solid var(--bs-border-color, #e3e3e3);
    border-radius: var(--bs-border-radius, 0.375rem);
}

/* ---------------------------------------------------------------------------
 * Buttons and labels
 * BS5 dropped .btn-default, and .label became .badge.
 * ------------------------------------------------------------------------- */

.btn-default {
    --bs-btn-color: #212529;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #ced4da;
    --bs-btn-hover-color: #212529;
    --bs-btn-hover-bg: #e9ecef;
    --bs-btn-hover-border-color: #adb5bd;
    --bs-btn-active-color: #212529;
    --bs-btn-active-bg: #dee2e6;
    --bs-btn-active-border-color: #adb5bd;
    --bs-btn-disabled-color: #6c757d;
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-border-color: #ced4da;
}

/* BS3 sizing aliases that BS5 renamed. */
.btn-xs {
    --bs-btn-padding-y: 0.05rem;
    --bs-btn-padding-x: 0.35rem;
    --bs-btn-font-size: 0.75rem;
}

.btn-flat {
    border-radius: 0;
}

/* .label survives as a badge, but must not hijack <label class="control-label">. */
span.label,
a.label,
small.label {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--bs-border-radius, 0.375rem);
}

.label-default { background-color: var(--bs-secondary, #6c757d); }
.label-primary { background-color: var(--bs-primary, #0d6efd); }
.label-success { background-color: var(--bs-success, #198754); }
.label-info    { background-color: var(--bs-info, #0dcaf0); }
.label-warning { background-color: var(--bs-warning, #ffc107); }
.label-danger  { background-color: var(--bs-danger, #dc3545); }

/* ---------------------------------------------------------------------------
 * Utilities BS5 renamed or removed
 * ------------------------------------------------------------------------- */

/* .pull-left / .pull-right are deliberately NOT defined here.
 *
 * This application ships its own direction conventions in assets/css/cssfix.css,
 * which SWAPS them for the LTR build (.pull-left => float:right) and leaves them
 * normal for RTL. The markup was authored around that, so every "top right" button
 * group in the app is written as .pull-left. Defining them here overrode cssfix and
 * moved those buttons - invoice lists, transaction toolbars, the invoice header -
 * to the wrong side across the whole system. cssfix.css is still loaded for both
 * directions, so it remains the single source of truth for these two classes. */

/* BS5 replaced these with the logical text-start / text-end. The physical
 * meaning is kept here, which is what the existing markup assumes. */
.text-right { text-align: right !important; }
.text-left  { text-align: left !important; }

.img-responsive {
    max-width: 100%;
    height: auto;
}

.img-circle { border-radius: 50%; }

.hidden { display: none !important; }

/* BS3 responsive visibility helpers. */
.hidden-xs { }
.visible-xs, .visible-sm, .visible-md, .visible-lg { display: none !important; }

@media (max-width: 767.98px) {
    .hidden-xs { display: none !important; }
    .visible-xs { display: block !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .hidden-sm { display: none !important; }
    .visible-sm { display: block !important; }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .hidden-md { display: none !important; }
    .visible-md { display: block !important; }
}

@media (min-width: 1200px) {
    .hidden-lg { display: none !important; }
    .visible-lg { display: block !important; }
}

/* ---------------------------------------------------------------------------
 * Grid: .col-xs-* was renamed to .col-* in BS4/5.
 * ------------------------------------------------------------------------- */

.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6,
.col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
    position: relative;
    width: 100%;
    padding-right: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    padding-left: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    flex: 0 0 auto;
}

.col-xs-1  { width: 8.33333333%; }
.col-xs-2  { width: 16.66666667%; }
.col-xs-3  { width: 25%; }
.col-xs-4  { width: 33.33333333%; }
.col-xs-5  { width: 41.66666667%; }
.col-xs-6  { width: 50%; }
.col-xs-7  { width: 58.33333333%; }
.col-xs-8  { width: 66.66666667%; }
.col-xs-9  { width: 75%; }
.col-xs-10 { width: 83.33333333%; }
.col-xs-11 { width: 91.66666667%; }
.col-xs-12 { width: 100%; }

/* ---------------------------------------------------------------------------
 * Tables
 * ------------------------------------------------------------------------- */

/* BS5 opts tables out of styling unless .table is present; these BS3 modifiers
 * still need to mean something where they appear on their own. */
.table-bordered > :not(caption) > * > * {
    border-width: var(--bs-border-width, 1px);
}

/* AdminLTE 2 components (box-*, info-box, small-box, callout) and the AdminLTE
 * colour helpers live in v4g-theme.css, so the original palette and metrics stay
 * together in one file. */

/* ---------------------------------------------------------------------------
 * Training Mode badge
 * Lifted out of an inline <style> block in partials/header.blade.php. The stripe
 * animation is declared here rather than borrowed from Bootstrap's progress bar,
 * so it does not depend on a framework keyframe name.
 * ------------------------------------------------------------------------- */

.training-badge {
    display: inline-block;
    min-width: 420px;
    padding: 6px 28px;
    font-weight: bold;
    line-height: normal;
    color: #fff;
    text-align: center;
    background-color: var(--bs-danger, #dd4b39);
    background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
    background-size: 40px 40px;
    border-radius: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    animation: v4g-training-stripes 2s linear infinite;
}

@keyframes v4g-training-stripes {
    from { background-position: 40px 0; }
    to   { background-position: 0 0; }
}

/* BS3's .table-condensed became .table-sm. daterangepicker's calendar markup uses
 * the old name, and so do a few report tables. */
.table-condensed > :not(caption) > * > * {
    padding: 0.25rem 0.25rem;
}

/* ---------------------------------------------------------------------------
 * Grid: restore Bootstrap 3 float semantics for legacy column markup
 *
 * This is the single most important rule in this file. In Bootstrap 3 .col-*-N
 * floated, so columns laid out side by side inside ANY container. In Bootstrap 5
 * they are flex items, which only works inside a .row - outside one they stack at
 * full width. This app nests columns inside .form-group, .col-lg-12, <span> and
 * plain <div>s all over the place (settings/index.blade.php is the worst case), so
 * on Bootstrap 5 every one of those forms collapsed into a single stacked column.
 *
 * Adding float back fixes all of it without touching the markup. Inside a real .row
 * the float is simply ignored, because floats do not apply to flex items - so this
 * cannot disturb any container that is already a proper Bootstrap 5 row.
 * Bootstrap 5 already sets the widths, so only the float is needed.
 *
 * Each tier floats only from its own breakpoint up, which is what Bootstrap 3 did
 * and is not optional. A tier's *width* lives in a media query, so below that
 * breakpoint a floated column has no width at all and falls back to shrink-to-fit
 * - it takes whatever the float context has left rather than a full line. On
 * Settings that produced the two symptoms reported from a phone: fields and their
 * labels scattered at unrelated indents instead of one per line, and, where the
 * leftover space was only a few characters wide, checkbox labels in the Invoice
 * Templates tab rendered one letter per line down the page. Floating from the
 * breakpoint up means these columns are ordinary full-width blocks on a narrow
 * screen and only lay out side by side once they actually have a width to do it
 * with. Verified: at >= lg the rendered geometry of every column on the settings,
 * dashboard, clients, suppliers, users and roles pages is byte-identical to what
 * the unconditional float produced, so this changes nothing on the desktop the
 * app was designed against.
 * ------------------------------------------------------------------------- */

[class*="col-xs-"] { float: left; }
[dir="rtl"] [class*="col-xs-"] { float: right; }

@media (min-width: 576px) {
    [class*="col-sm-"] { float: left; }
    [dir="rtl"] [class*="col-sm-"] { float: right; }
}

@media (min-width: 768px) {
    [class*="col-md-"] { float: left; }
    [dir="rtl"] [class*="col-md-"] { float: right; }
}

@media (min-width: 992px) {
    [class*="col-lg-"] { float: left; }
    [dir="rtl"] [class*="col-lg-"] { float: right; }
}

@media (min-width: 1200px) {
    [class*="col-xl-"] { float: left; }
    [dir="rtl"] [class*="col-xl-"] { float: right; }
}

/* Legacy columns also clear their own floated children, so a wrapper like
 * <div class="col-lg-12"> can stand in for a row. That rule already lives with
 * the other clearfixes further down this file - see ".box-header::after". */

/* Containers that used to clear those floats via Bootstrap 3's clearfix.
 *
 * .content-header is on this list because of what happens when it is missing.
 * A float that escapes its parent still pushes anything below it that forms a
 * block formatting context - and every .row is display:flex, so every row is
 * one. The dashboard's page title and clock were bare col-sm-6 floats directly
 * inside .content-header, so they escaped it, and the first widget row below
 * either dropped past them (a tall empty gap under the title) or squeezed into
 * whatever sliver of width was left beside them, turning the User/System
 * Details boxes into narrow vertical strips. It tracked the viewport width and
 * the wrapped height of the date text, so it looked intermittent. */
.form-group::after, .panel-body::after, .box-body::after, .tab-pane::after,
.well::after, .modal-body::after, .modal-footer::after, .content-header::after {
    display: block;
    clear: both;
    content: "";
}

/* AdminLTE 2's tab wrapper: .nav-tabs-custom is now also a .card, so it just needs
 * its inner padding back. */
.nav-tabs-custom > .tab-content {
    padding: 1rem;
}

.nav-tabs-custom > .nav-tabs {
    padding-top: 0.25rem;
    margin: 0;
    border-bottom-color: var(--bs-border-color, #dee2e6);
}

/* ---------------------------------------------------------------------------
 * Bootstrap 3 grid offsets
 *
 * BS3 wrote .col-md-offset-3; Bootstrap 5 renamed it to .offset-md-3, so all 53
 * uses across 28 views silently stopped doing anything. That is why centred forms
 * (the "Create Accounting Note" dialog, the transaction forms) drifted to the left
 * edge and why several right-aligned button groups moved.
 * ------------------------------------------------------------------------- */

.col-xs-offset-0 { margin-left: 0.00000000%; }
[dir="rtl"] .col-xs-offset-0 { margin-left: 0; margin-right: 0.00000000%; }
.col-xs-offset-1 { margin-left: 8.33333333%; }
[dir="rtl"] .col-xs-offset-1 { margin-left: 0; margin-right: 8.33333333%; }
.col-xs-offset-2 { margin-left: 16.66666667%; }
[dir="rtl"] .col-xs-offset-2 { margin-left: 0; margin-right: 16.66666667%; }
.col-xs-offset-3 { margin-left: 25.00000000%; }
[dir="rtl"] .col-xs-offset-3 { margin-left: 0; margin-right: 25.00000000%; }
.col-xs-offset-4 { margin-left: 33.33333333%; }
[dir="rtl"] .col-xs-offset-4 { margin-left: 0; margin-right: 33.33333333%; }
.col-xs-offset-5 { margin-left: 41.66666667%; }
[dir="rtl"] .col-xs-offset-5 { margin-left: 0; margin-right: 41.66666667%; }
.col-xs-offset-6 { margin-left: 50.00000000%; }
[dir="rtl"] .col-xs-offset-6 { margin-left: 0; margin-right: 50.00000000%; }
.col-xs-offset-7 { margin-left: 58.33333333%; }
[dir="rtl"] .col-xs-offset-7 { margin-left: 0; margin-right: 58.33333333%; }
.col-xs-offset-8 { margin-left: 66.66666667%; }
[dir="rtl"] .col-xs-offset-8 { margin-left: 0; margin-right: 66.66666667%; }
.col-xs-offset-9 { margin-left: 75.00000000%; }
[dir="rtl"] .col-xs-offset-9 { margin-left: 0; margin-right: 75.00000000%; }
.col-xs-offset-10 { margin-left: 83.33333333%; }
[dir="rtl"] .col-xs-offset-10 { margin-left: 0; margin-right: 83.33333333%; }
.col-xs-offset-11 { margin-left: 91.66666667%; }
[dir="rtl"] .col-xs-offset-11 { margin-left: 0; margin-right: 91.66666667%; }
.col-xs-offset-12 { margin-left: 100.00000000%; }
[dir="rtl"] .col-xs-offset-12 { margin-left: 0; margin-right: 100.00000000%; }

@media (min-width: 576px) {
    .col-sm-offset-0 { margin-left: 0.00000000%; }
    [dir="rtl"] .col-sm-offset-0 { margin-left: 0; margin-right: 0.00000000%; }
    .col-sm-offset-1 { margin-left: 8.33333333%; }
    [dir="rtl"] .col-sm-offset-1 { margin-left: 0; margin-right: 8.33333333%; }
    .col-sm-offset-2 { margin-left: 16.66666667%; }
    [dir="rtl"] .col-sm-offset-2 { margin-left: 0; margin-right: 16.66666667%; }
    .col-sm-offset-3 { margin-left: 25.00000000%; }
    [dir="rtl"] .col-sm-offset-3 { margin-left: 0; margin-right: 25.00000000%; }
    .col-sm-offset-4 { margin-left: 33.33333333%; }
    [dir="rtl"] .col-sm-offset-4 { margin-left: 0; margin-right: 33.33333333%; }
    .col-sm-offset-5 { margin-left: 41.66666667%; }
    [dir="rtl"] .col-sm-offset-5 { margin-left: 0; margin-right: 41.66666667%; }
    .col-sm-offset-6 { margin-left: 50.00000000%; }
    [dir="rtl"] .col-sm-offset-6 { margin-left: 0; margin-right: 50.00000000%; }
    .col-sm-offset-7 { margin-left: 58.33333333%; }
    [dir="rtl"] .col-sm-offset-7 { margin-left: 0; margin-right: 58.33333333%; }
    .col-sm-offset-8 { margin-left: 66.66666667%; }
    [dir="rtl"] .col-sm-offset-8 { margin-left: 0; margin-right: 66.66666667%; }
    .col-sm-offset-9 { margin-left: 75.00000000%; }
    [dir="rtl"] .col-sm-offset-9 { margin-left: 0; margin-right: 75.00000000%; }
    .col-sm-offset-10 { margin-left: 83.33333333%; }
    [dir="rtl"] .col-sm-offset-10 { margin-left: 0; margin-right: 83.33333333%; }
    .col-sm-offset-11 { margin-left: 91.66666667%; }
    [dir="rtl"] .col-sm-offset-11 { margin-left: 0; margin-right: 91.66666667%; }
    .col-sm-offset-12 { margin-left: 100.00000000%; }
    [dir="rtl"] .col-sm-offset-12 { margin-left: 0; margin-right: 100.00000000%; }
}

@media (min-width: 768px) {
    .col-md-offset-0 { margin-left: 0.00000000%; }
    [dir="rtl"] .col-md-offset-0 { margin-left: 0; margin-right: 0.00000000%; }
    .col-md-offset-1 { margin-left: 8.33333333%; }
    [dir="rtl"] .col-md-offset-1 { margin-left: 0; margin-right: 8.33333333%; }
    .col-md-offset-2 { margin-left: 16.66666667%; }
    [dir="rtl"] .col-md-offset-2 { margin-left: 0; margin-right: 16.66666667%; }
    .col-md-offset-3 { margin-left: 25.00000000%; }
    [dir="rtl"] .col-md-offset-3 { margin-left: 0; margin-right: 25.00000000%; }
    .col-md-offset-4 { margin-left: 33.33333333%; }
    [dir="rtl"] .col-md-offset-4 { margin-left: 0; margin-right: 33.33333333%; }
    .col-md-offset-5 { margin-left: 41.66666667%; }
    [dir="rtl"] .col-md-offset-5 { margin-left: 0; margin-right: 41.66666667%; }
    .col-md-offset-6 { margin-left: 50.00000000%; }
    [dir="rtl"] .col-md-offset-6 { margin-left: 0; margin-right: 50.00000000%; }
    .col-md-offset-7 { margin-left: 58.33333333%; }
    [dir="rtl"] .col-md-offset-7 { margin-left: 0; margin-right: 58.33333333%; }
    .col-md-offset-8 { margin-left: 66.66666667%; }
    [dir="rtl"] .col-md-offset-8 { margin-left: 0; margin-right: 66.66666667%; }
    .col-md-offset-9 { margin-left: 75.00000000%; }
    [dir="rtl"] .col-md-offset-9 { margin-left: 0; margin-right: 75.00000000%; }
    .col-md-offset-10 { margin-left: 83.33333333%; }
    [dir="rtl"] .col-md-offset-10 { margin-left: 0; margin-right: 83.33333333%; }
    .col-md-offset-11 { margin-left: 91.66666667%; }
    [dir="rtl"] .col-md-offset-11 { margin-left: 0; margin-right: 91.66666667%; }
    .col-md-offset-12 { margin-left: 100.00000000%; }
    [dir="rtl"] .col-md-offset-12 { margin-left: 0; margin-right: 100.00000000%; }
}

@media (min-width: 992px) {
    .col-lg-offset-0 { margin-left: 0.00000000%; }
    [dir="rtl"] .col-lg-offset-0 { margin-left: 0; margin-right: 0.00000000%; }
    .col-lg-offset-1 { margin-left: 8.33333333%; }
    [dir="rtl"] .col-lg-offset-1 { margin-left: 0; margin-right: 8.33333333%; }
    .col-lg-offset-2 { margin-left: 16.66666667%; }
    [dir="rtl"] .col-lg-offset-2 { margin-left: 0; margin-right: 16.66666667%; }
    .col-lg-offset-3 { margin-left: 25.00000000%; }
    [dir="rtl"] .col-lg-offset-3 { margin-left: 0; margin-right: 25.00000000%; }
    .col-lg-offset-4 { margin-left: 33.33333333%; }
    [dir="rtl"] .col-lg-offset-4 { margin-left: 0; margin-right: 33.33333333%; }
    .col-lg-offset-5 { margin-left: 41.66666667%; }
    [dir="rtl"] .col-lg-offset-5 { margin-left: 0; margin-right: 41.66666667%; }
    .col-lg-offset-6 { margin-left: 50.00000000%; }
    [dir="rtl"] .col-lg-offset-6 { margin-left: 0; margin-right: 50.00000000%; }
    .col-lg-offset-7 { margin-left: 58.33333333%; }
    [dir="rtl"] .col-lg-offset-7 { margin-left: 0; margin-right: 58.33333333%; }
    .col-lg-offset-8 { margin-left: 66.66666667%; }
    [dir="rtl"] .col-lg-offset-8 { margin-left: 0; margin-right: 66.66666667%; }
    .col-lg-offset-9 { margin-left: 75.00000000%; }
    [dir="rtl"] .col-lg-offset-9 { margin-left: 0; margin-right: 75.00000000%; }
    .col-lg-offset-10 { margin-left: 83.33333333%; }
    [dir="rtl"] .col-lg-offset-10 { margin-left: 0; margin-right: 83.33333333%; }
    .col-lg-offset-11 { margin-left: 91.66666667%; }
    [dir="rtl"] .col-lg-offset-11 { margin-left: 0; margin-right: 91.66666667%; }
    .col-lg-offset-12 { margin-left: 100.00000000%; }
    [dir="rtl"] .col-lg-offset-12 { margin-left: 0; margin-right: 100.00000000%; }
}

/* ---------------------------------------------------------------------------
 * Grid gutters and block spacing
 *
 * Bootstrap 5 puts the gutter padding on `.row > *`, so the float-based columns
 * restored above get no gutter when their parent is not a real .row - and
 * AdminLTE 2's boxes carried their own bottom margin, which AdminLTE 4 does not.
 * Together those two gaps made the dashboard panels sit flush against each other
 * with no separation at all.
 * ------------------------------------------------------------------------- */

[class*="col-xs-"], [class*="col-sm-"], [class*="col-md-"], [class*="col-lg-"], [class*="col-xl-"] {
    padding-right: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    padding-left: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
}

.box, .info-box, .small-box, .panel, .nav-tabs-custom {
    margin-bottom: 20px;
}

.app-main .card { margin-bottom: 20px; }

/* Rows themselves need to clear their floated children. */
.row::after { display: block; clear: both; content: ""; }

/* ---------------------------------------------------------------------------
 * User menu footer
 * AdminLTE 2 laid the three buttons out in one row (Profile / Settings left,
 * Sign Out right). Under BS5 the float-based version wrapped onto two lines.
 * ------------------------------------------------------------------------- */

.dropdown-menu .user-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem;
    background-color: var(--bs-tertiary-bg, #f9f9f9);
}

.dropdown-menu .user-footer .btn { float: none; }
.dropdown-menu .user-header { padding: 0.85rem; text-align: center; }
.dropdown-menu .user-header p { margin: 0; }
.dropdown-menu .user-header small { display: block; margin-top: 0.25rem; }

/* ---------------------------------------------------------------------------
 * .table-responsive next to a floated column
 *
 * Bootstrap 3 only made .table-responsive scrollable below 768px; Bootstrap 5
 * applies overflow-x:auto at every width. An element with overflow:auto forms a
 * block formatting context, and a BFC *avoids* floats rather than flowing under
 * them - so wherever the markup puts a .table-responsive after a floated .col-*
 * (the invoice views do exactly this: a full-width col holding the currency rate,
 * then the line-items table), the wrapper collapsed to width:0. The table was
 * still in the DOM and still occupied its height, which is why those screens
 * showed a tall blank band where the items should be.
 *
 * Clearing the float restores the full width, matching Bootstrap 3's behaviour.
 * ------------------------------------------------------------------------- */

.table-responsive {
    clear: both;
    width: 100%;
}

/* Containers must clear the floated columns they hold, or the floats escape and
 * overlap whatever follows. The VAT return report shows this: its
 * .box-header > .col-md-12 > .col-md-6 header boxes spilled over the section
 * below. Bootstrap 3 relied on .row/.clearfix for this; the markup here nests
 * columns directly inside .box-header and bare .col-* wrappers, so every column
 * and box section clears its own children. A zero-height ::after cannot affect
 * sibling layout. */
.box-header::after, .box-footer::after, .box::after,
[class*="col-xs-"]::after, [class*="col-sm-"]::after,
[class*="col-md-"]::after, [class*="col-lg-"]::after, [class*="col-xl-"]::after {
    display: block;
    clear: both;
    content: "";
}

/* ---------------------------------------------------------------------------
   .modal-header: back to the Bootstrap 3 box model

   BS3's modal header was a plain block with .close floated into the corner, so a
   header could stack an <h4> above a <small> subtitle and centre both. BS5 makes
   it `display: flex; justify-content: space-between`, which strings those
   siblings out on one line - the Add/Edit Client and Supplier dialogs rendered as
   "xAdd New Client Please fill in all the details below" with the close button
   sitting on top of the title.

   Nine of this app's 66 modal headers carry such a subtitle, and none of the 66
   puts anything but the close button beside the title, so no header needs flex.
   Pinning the close button also makes child order irrelevant, which is sturdier
   than reordering the markup dialog by dialog.
   --------------------------------------------------------------------------- */
.modal-header {
    display: block;
    position: relative;
}

.modal-header .btn-close,
.modal-header .close {
    position: absolute;
    top: 0.9rem;
    margin: 0;
    z-index: 1;
}

/* Corner follows the writing direction, so Arabic gets it on the left. */
html[dir="rtl"] .modal-header .btn-close,
html[dir="rtl"] .modal-header .close {
    left: 1rem;
    right: auto;
}

html:not([dir="rtl"]) .modal-header .btn-close,
html:not([dir="rtl"]) .modal-header .close {
    right: 1rem;
    left: auto;
}

/* Keep the title clear of the pinned button. */
.modal-header .modal-title,
.modal-header > h4 {
    padding-inline-end: 2rem;
}

/* A subtitle sits on its own line under the title, as it did under BS3. */
.modal-header > small {
    display: block;
}

/* ---------------------------------------------------------------------------
 * Grid: give the responsive tiers their precedence back
 *
 * The .col-xs-* shim above declares its widths unconditionally, exactly as
 * Bootstrap 3 did. But this file loads *after* bootstrap.min.css, and Bootstrap 5
 * declares .col-md-4 and friends inside @media blocks - which add no specificity.
 * So for equal specificity the later rule won, and `class="col-md-4 col-sm-6
 * col-xs-12"` was 100% wide at every viewport instead of a third.
 *
 * Bootstrap 3 did not have this problem because it declared col-xs first and the
 * larger tiers later in the same file, so the tiers won. Re-asserting Bootstrap 5's
 * own tier widths here, after the shim, restores that order.
 *
 * 98 elements across 14 views carry a col-xs-* alongside a larger tier - the
 * invoice/e-invoice template cards were the visible case, laying out as full-width
 * bars one per row instead of three across.
 * ------------------------------------------------------------------------- */

@media (min-width: 576px) {
    .col-sm-1 { width: 8.33333333%; }
    .col-sm-2 { width: 16.66666667%; }
    .col-sm-3 { width: 25%; }
    .col-sm-4 { width: 33.33333333%; }
    .col-sm-5 { width: 41.66666667%; }
    .col-sm-6 { width: 50%; }
    .col-sm-7 { width: 58.33333333%; }
    .col-sm-8 { width: 66.66666667%; }
    .col-sm-9 { width: 75%; }
    .col-sm-10 { width: 83.33333333%; }
    .col-sm-11 { width: 91.66666667%; }
    .col-sm-12 { width: 100%; }
}

@media (min-width: 768px) {
    .col-md-1 { width: 8.33333333%; }
    .col-md-2 { width: 16.66666667%; }
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.33333333%; }
    .col-md-5 { width: 41.66666667%; }
    .col-md-6 { width: 50%; }
    .col-md-7 { width: 58.33333333%; }
    .col-md-8 { width: 66.66666667%; }
    .col-md-9 { width: 75%; }
    .col-md-10 { width: 83.33333333%; }
    .col-md-11 { width: 91.66666667%; }
    .col-md-12 { width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-1 { width: 8.33333333%; }
    .col-lg-2 { width: 16.66666667%; }
    .col-lg-3 { width: 25%; }
    .col-lg-4 { width: 33.33333333%; }
    .col-lg-5 { width: 41.66666667%; }
    .col-lg-6 { width: 50%; }
    .col-lg-7 { width: 58.33333333%; }
    .col-lg-8 { width: 66.66666667%; }
    .col-lg-9 { width: 75%; }
    .col-lg-10 { width: 83.33333333%; }
    .col-lg-11 { width: 91.66666667%; }
    .col-lg-12 { width: 100%; }
}

@media (min-width: 1200px) {
    .col-xl-1 { width: 8.33333333%; }
    .col-xl-2 { width: 16.66666667%; }
    .col-xl-3 { width: 25%; }
    .col-xl-4 { width: 33.33333333%; }
    .col-xl-5 { width: 41.66666667%; }
    .col-xl-6 { width: 50%; }
    .col-xl-7 { width: 58.33333333%; }
    .col-xl-8 { width: 66.66666667%; }
    .col-xl-9 { width: 75%; }
    .col-xl-10 { width: 83.33333333%; }
    .col-xl-11 { width: 91.66666667%; }
    .col-xl-12 { width: 100%; }
}

@media (min-width: 1400px) {
    .col-xxl-1 { width: 8.33333333%; }
    .col-xxl-2 { width: 16.66666667%; }
    .col-xxl-3 { width: 25%; }
    .col-xxl-4 { width: 33.33333333%; }
    .col-xxl-5 { width: 41.66666667%; }
    .col-xxl-6 { width: 50%; }
    .col-xxl-7 { width: 58.33333333%; }
    .col-xxl-8 { width: 66.66666667%; }
    .col-xxl-9 { width: 75%; }
    .col-xxl-10 { width: 83.33333333%; }
    .col-xxl-11 { width: 91.66666667%; }
    .col-xxl-12 { width: 100%; }
}


/* ---------------------------------------------------------------------------
 * Links: no underline on interface chrome, underline on prose
 *
 * Bootstrap 5 underlines every <a>. AdminLTE 4 does not override that globally -
 * it clears the underline per component instead (breadcrumb, dropdowns, tab
 * headers, timeline, contacts list). So "AdminLTE 4 styling" means chrome is not
 * underlined while a link in body text still is.
 *
 * This file used to carry a blanket `a:hover { text-decoration: underline }` to
 * emulate Bootstrap 3. That selector is (0,1,1) and so outranked every component
 * rule Bootstrap and AdminLTE set at (0,1,0) - `.nav-link`, `.dropdown-item` and
 * friends - which is why hovering anything clickable underlined it, sidebar
 * entries and menu items included. Measured before the change: .app-sidebar
 * .nav-link and .dropdown-item both computed text-decoration-line: underline on
 * hover.
 *
 * The hover underline is therefore scoped to prose containers only. Note this
 * relies on the app's own nesting: in the sidebar the <a> wraps the <p>, so
 * `p a` does not match it, and the card widgets put the <a> outside the box.
 * ------------------------------------------------------------------------- */
a {
    text-decoration: none;
}

/* Links sitting in body text keep the affordance. */
p a:hover,
p a:focus,
.alert a:hover,
.alert a:focus,
.callout a:hover,
.callout a:focus,
.help-block a:hover,
.help-block a:focus {
    text-decoration: underline;
}

/* -------------------------------------------------------------------------
 * A read-only field must LOOK read-only.
 *
 * Bootstrap 3 and 4 both greyed one out (`.form-control[readonly]`,
 * background #eee); Bootstrap 5 dropped the rule and styles only :disabled, so
 * every readonly box in this application has been rendering as though it could
 * be typed into.
 *
 * That is not only cosmetic. The locked item name on the inventory edit dialogs
 * was `disabled` rather than readonly precisely because that is what looked
 * right - and a disabled field is NOT SUBMITTED, so `name` arrived empty and
 * every edit of an item that had ever moved was refused with "Name is
 * required". The field is readonly now, which posts, and this restores the
 * appearance it was relying on.
 *
 * :disabled's own colour is reused rather than BS3's #eee, so the two match in
 * both themes - the variable is redefined for dark mode.
 * ------------------------------------------------------------------------- */
.form-control[readonly],
.form-select[readonly] {
    background-color: var(--bs-secondary-bg);
    opacity: 1;
}
