/* ============================================================================================
   AdminLTE 2's structural classes, made to look right under AdminLTE 4.

   WHY THIS EXISTS. Ninety-odd screens are built from box / box-header / box-body /
   nav-tabs-custom and Bootstrap 3's grid. Rewriting that markup screen by screen is where the
   bugs come from - the nesting is four deep, every file is slightly different, and a misplaced
   closing div is invisible until someone opens the page. Those classes simply have no styles in
   AdminLTE 4, so the markup still renders; it just renders unstyled.

   So instead of moving the markup to the new classes, the old classes are given the new look.
   A screen then moves to AdminLTE 4 by changing ONE line - its Layout - and nothing else, which
   is a change that cannot break the page's structure.

   This is a transition, not a destination. When a screen is reworked properly its box-* markup
   should become real cards; when the last one has been, this file goes. Until then it is what
   makes converting a screen a one-line job instead of an afternoon.
   ============================================================================================ */

/* ---- the tabbed container: AdminLTE 2's nav-tabs-custom was effectively a card ---- */
.nav-tabs-custom {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bs-card-bg, #fff);
  border: var(--bs-card-border-width, 1px) solid var(--bs-card-border-color, rgba(0,0,0,.125));
  border-radius: var(--bs-card-border-radius, .5rem);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.nav-tabs-custom > .tab-content { padding: 1rem; }

/* its tab strip: the markup puts .active on the <li> and no .nav-link on the <a>, which is
   Bootstrap 3's shape. Rather than edit every file, give that shape the Bootstrap 5 look. */
.nav-tabs-custom > .nav-tabs {
  padding: 0 .5rem;
  margin: 0;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.nav-tabs-custom > .nav-tabs > li { margin-bottom: -1px; list-style: none; }
.nav-tabs-custom > .nav-tabs > li > a {
  display: block;
  padding: .6rem 1rem;
  color: var(--bs-secondary-color, #6c757d);
  text-decoration: none;
  border: 1px solid transparent;
  border-top-left-radius: .375rem;
  border-top-right-radius: .375rem;
}
.nav-tabs-custom > .nav-tabs > li > a:hover { color: var(--lma-brand); border-color: #e9ecef #e9ecef transparent; }
/* The shim in the layout moves .active from the <li> to the <a>, so both are matched: the
   anchor form for after it has run, the li form for the instant before. */
.nav-tabs-custom > .nav-tabs > li.active > a,
.nav-tabs-custom > .nav-tabs > li > a.active {
  color: var(--lma-brand);
  font-weight: 600;
  background: var(--bs-card-bg, #fff);
  border-color: var(--bs-border-color, #dee2e6) var(--bs-border-color, #dee2e6) transparent;
}

/* ---- box ----
   On the list screens the box sits INSIDE nav-tabs-custom, which is already the card, so there it
   has to be transparent. On the report screens there is no nav-tabs-custom and the box is the only
   container they have - so the box is the card by default and is stripped back only when nested.
   Getting this the wrong way round renders a report as text on a grey page with no panel at all. */
.box {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-bottom: 1rem;
  background: var(--bs-card-bg, #fff);
  border: var(--bs-card-border-width, 1px) solid var(--bs-card-border-color, rgba(0,0,0,.125));
  border-radius: var(--bs-card-border-radius, .5rem);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.nav-tabs-custom .box { border: 0; background: transparent; box-shadow: none; margin: 0; }

.box-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
}
.nav-tabs-custom .box-header { padding: 0 0 .75rem; }
/* these screens position their toolbars with floats and a hard-coded margin-left:150px, which
   overlaps once the window is narrow. Inside a flex header neither is needed. */
.box-header > .pull-left,
.box-header > .pull-right,
.box-header > div[style*="margin-left"] {
  float: none !important;
  margin-left: 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .375rem;
}
/* Prod puts the filter buttons (Show all / Uncovered) 150px from the left edge, after + and -.
   Reserve that width for the +/- group instead of a margin, so the filters start at the same
   place whether or not the role can see + and -, and still wrap on a narrow window. */
.box-header > .pull-left:has(+ div[style*="margin-left"]) { min-width: calc(150px - .5rem); }
.box-body { padding: 1rem; }
.nav-tabs-custom .box-body { padding: 0; }

/* ---- Bootstrap 3 form markup, which the report screens are built from ----
   input-group-addon became input-group-text, form-horizontal and form-group were dropped, and
   the grid classes still work but carry Bootstrap 3's gutters. Styled rather than rewritten, for
   the same reason as everything else here. */
.input-group-addon {
  display: flex;
  align-items: center;
  padding: .375rem .75rem;
  color: var(--bs-secondary-color, #6c757d);
  background: var(--bs-tertiary-bg, #e9ecef);
  border: 1px solid var(--bs-border-color, #ced4da);
  border-inline-end: 0;
  border-start-start-radius: .375rem;
  border-end-start-radius: .375rem;
}
.input-group-addon + .form-control { border-start-start-radius: 0; border-end-start-radius: 0; }
.form-group { margin-bottom: .75rem; }
.form-horizontal { margin: 0; }
.box label { margin-bottom: .25rem; font-weight: 500; }
/* a datepicker's input-group must not be stretched to the column's full width by the grid */
.box .input-group.date { max-width: 16rem; }
/* AdminLTE 2's collapse widget: v4 has no equivalent and it collapsed a box that is the page */
.box-tools { display: none !important; }

/* ---- Bootstrap 3 leftovers that still appear in this markup ---- */
/* Only the WRAPPER column, never the grid inside a screen. The list screens wrap their whole
   content in col-sm-11, which leaves an eleven-twelfths-wide table with a gap down the right;
   that one should be full width. Written as [class*="col-sm-"] it also caught the loan card's
   col-sm-3 fields and stacked a four-column card into one column - a layout bug introduced by a
   fix for a different screen, which is the hazard of a shared compatibility sheet. */
.nav-tabs-custom > .tab-content > .tab-pane > .row > .col-sm-11,
.nav-tabs-custom > .tab-content > .tab-pane > .row > .col-sm-12,
.nav-tabs-custom > .row > .col-sm-11,
.nav-tabs-custom > .row > .col-sm-12 { flex: 0 0 100%; max-width: 100%; width: 100%; }
/* Gutters are zeroed for the WRAPPER only. This used to be written for every column inside a
   tab - which took the gutter out of every form too, so the loan card's four columns of fields
   ran edge to edge with no space between one column's inputs and the next. */
.nav-tabs-custom > .tab-content > .tab-pane > .row,
.nav-tabs-custom > .row { margin-inline: 0; }
.nav-tabs-custom > .tab-content > .tab-pane > .row > .col-sm-11,
.nav-tabs-custom > .tab-content > .tab-pane > .row > .col-sm-12,
.nav-tabs-custom > .row > .col-sm-11,
.nav-tabs-custom > .row > .col-sm-12 { padding-inline: 0; }
.btn-default { --bs-btn-bg: #f8f9fa; --bs-btn-border-color: #ced4da; --bs-btn-color: #212529; }

/* a tab pane with .active but without .show still displays in Bootstrap 5 as long as it is not
   .fade - none of these are, so nothing more is needed here. Stated so it is not re-investigated. */

/* ---- fit to the window, as card-fill does for screens already rewritten ----
   These screens are one big table too, so the page should not scroll - the table should. Same
   reasoning and the same caveat as the card-fill rule in adminlte-overlay.css: the constant is
   the header, the padding and the card's chrome, erring small on purpose because a little space
   under the table is harmless where a page scrollbar is the thing being removed. */
/* The height is set by fitTables() in the layout, measured per screen. A constant cannot work
   here: payment/list carries a date-range form above its table and needs 173px less than the
   loan list, and any single number is wrong for one of them. Only the cap is lifted here. */
.dataTables_scrollBody { max-height: none !important; }
.app-content > .container-fluid > .nav-tabs-custom { margin-bottom: 0; }

/* ---- Font Awesome class names, drawn with Bootstrap Icons ----
   The old markup uses fa fa-* in 255 places across 26 distinct names, and this layout does not
   load Font Awesome - so every one of them rendered as an empty box, the calendar on every date
   field included. Reinstating Font Awesome would put the account-bound kit back on every page,
   which is the coupling being removed, so they are drawn with the Bootstrap Icons font that is
   already shipped. The codepoints are read out of that font's own stylesheet by
   tools/map_icons.py rather than typed, so a wrong glyph is not possible.

   Only the names actually in use are mapped. A new one renders as nothing, visibly - a missing
   icon should be noticed rather than silently approximated. */
.fa {
  font-family: "bootstrap-icons" !important;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  display: inline-block;
  vertical-align: -.125em;
}
.fa.fa-calendar::before { content: "\f1f6"; }   /* bi-calendar */
.fa.fa-minus-circle::before { content: "\f2e6"; }   /* bi-dash-circle */
.fa.fa-minus::before { content: "\f63b"; }   /* bi-dash-lg */
.fa.fa-plus-circle::before { content: "\f4fa"; }   /* bi-plus-circle */
.fa.fa-check::before { content: "\f633"; }   /* bi-check-lg */
.fa.fa-list::before { content: "\f478"; }   /* bi-list-ul */
.fa.fa-file-text-o::before { content: "\f3b9"; }   /* bi-file-text */
.fa.fa-file-text::before { content: "\f38b"; }   /* bi-file-earmark-text */
.fa.fa-file-o::before { content: "\f392"; }   /* bi-file-earmark */
.fa.fa-file::before { content: "\f392"; }   /* bi-file-earmark */
.fa.fa-angle-left::before { content: "\f284"; }   /* bi-chevron-left */
.fa.fa-table::before { content: "\f5aa"; }   /* bi-table */
.fa.fa-upload::before { content: "\f603"; }   /* bi-upload */
.fa.fa-users::before { content: "\f4d0"; }   /* bi-people */
.fa.fa-user::before { content: "\f4e1"; }   /* bi-person */
.fa.fa-sync::before { content: "\f116"; }   /* bi-arrow-clockwise */
.fa.fa-money::before { content: "\f632"; }   /* bi-cash-coin */
.fa.fa-home::before { content: "\f425"; }   /* bi-house */
.fa.fa-history::before { content: "\f292"; }   /* bi-clock-history */
.fa.fa-euro::before { content: "\f637"; }   /* bi-currency-euro */
.fa.fa-cogs::before { content: "\f3e5"; }   /* bi-gear */
.fa.fa-car::before { content: "\f7e1"; }   /* bi-car-front */
.fa.fa-bar-chart::before { content: "\f17e"; }   /* bi-bar-chart */
.fa.fa-bank::before { content: "\f62e"; }   /* bi-bank */
.fa.fa-arrow-circle-up::before { content: "\f13a"; }   /* bi-arrow-up-circle */
.fa.fa-arrow-circle-down::before { content: "\f119"; }   /* bi-arrow-down-circle */

/* ---- the detail modals ----
   Site.css sizes these dialogs with .card-item { width: 90% } and .card-item-item { width: 50% },
   which Bootstrap 3 honoured. Bootstrap 5 caps every .modal-dialog at --bs-modal-width, 500px by
   default, so the width was silently ignored and a loan card - thirteen tabs and two columns of
   fields - was squeezed into 500px with its tab strip wrapped across five rows.

   Set through Bootstrap 5's own variable rather than fighting it, so the dialog keeps the rest of
   its behaviour. vw rather than % because the percentage is of the dialog's container, which in
   Bootstrap 5 is the modal itself and already full width. */
.modal-dialog.card-item { --bs-modal-width: 90vw; max-width: 90vw; }
.modal-dialog.card-item-item { --bs-modal-width: 50vw; max-width: 50vw; }

/* The card modals carry their own tab strip and panels. They are inside a dialog, not the page,
   so give them room without the page's outer padding. */
.modal-body > .nav-tabs-custom,
.modal-body > .box { margin-bottom: 0; border: 0; box-shadow: none; }
.modal-body > .nav-tabs-custom > .tab-content { padding: 1rem 0 0; }

/* A tab strip of thirteen items should wrap tidily rather than stretch each item. */
.modal-body .nav-tabs { flex-wrap: wrap; row-gap: .125rem; }

/* ============================================================================================
   DIALOGS AND FORMS - the deliberate part.

   Everything above makes old markup render; this makes it read well. Written after looking at a
   loan card properly rather than at a measurement of one.
   ============================================================================================ */

/* ---- one card, not three ----
   The markup nests .modal-content > .box > .nav-tabs-custom, and the rules further up turn the
   last two into cards, so a loan card was a panel inside a panel inside a panel, each with its
   own border, shadow and padding. Inside a dialog those two are structure, not panels. */
.modal-content {
  border: 0;
  border-radius: .75rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .35);
}
.modal-body .box,
.modal-body .nav-tabs-custom {
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.modal-body .box-body { padding: 0; }
.modal-body .nav-tabs-custom > .nav-tabs { padding: 0; }
.modal-body .nav-tabs-custom > .tab-content { padding: 1rem 0 0; }

/* The dialog's real title - "Кредит - 1021220130" - lives in a .box-title inside the body, while
   .modal-header holds an empty <h4>. Rather than move it in the markup of nine modals, the empty
   header collapses to just its close button and the title reads as the heading under it. */
/* A REAL header band.

   The markup's .modal-header holds only a close button - the actual title lives in a .box-title
   inside the body, bound to the record. Styled naively that leaves a bare x floating at the top
   right of the window with the title stranded below it and nothing joining them, which is what
   it looked like: a dialog with no header at all.

   The title cannot simply be moved: it sits inside data-bind="with: selectedFullItem", and
   taking it out of that element would break the binding context it reads the record from. So the
   BAND is built around the title where it is, and the close button is positioned into it.
   No JavaScript, no binding touched. */
.modal-content { position: relative; }
.modal-header {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  z-index: 3;
  padding: .75rem 1rem;
  background: transparent;
  border: 0;
}
.modal-header > .modal-title:empty { display: none; }

/* ---- the close button: a circle with an x, top right ----
   Two shapes in the markup: Bootstrap 5's .btn-close (an SVG cross as a background image) and
   Bootstrap 3's .close holding a &times; glyph. Both become the same round button at the right
   end of the title band, with the x always drawn (21.11.2026: moved back to the right where
   prod has it, and given a visible x rather than the macOS dot that showed one only on hover). */
.modal-header { inset-inline-start: auto; inset-inline-end: 0; padding: .65rem .9rem 0 0; }
.modal-header .btn-close,
.modal-header .close {
  position: relative;
  box-sizing: border-box;   /* .btn-close is content-box: 30px against .close's 28 */
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  float: none;
  opacity: 1;
  font-size: 0;
  line-height: 0;
  text-shadow: none;
  background: #fff;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.modal-header .btn-close > *,
.modal-header .close > * { display: none; }
.modal-header .btn-close::after,
.modal-header .close::after {
  content: "";
  position: absolute;
  inset: 0;
  background: no-repeat center / 10px 10px url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3e%3cpath d='M1.5 1.5l7 7M8.5 1.5l-7 7' stroke='%23495057' stroke-width='1.6' stroke-linecap='round'/%3e%3c/svg%3e");
}
.modal-header .btn-close:hover,
.modal-header .close:hover { background-color: #dc3545; border-color: #dc3545; }
.modal-header .btn-close:hover::after,
.modal-header .close:hover::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3e%3cpath d='M1.5 1.5l7 7M8.5 1.5l-7 7' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3e%3c/svg%3e");
}
.modal-header .btn-close:focus,
.modal-header .close:focus { outline: 0; }
.modal-header .btn-close:focus-visible,
/* the dialog focuses this button on open, so a coloured ring showed on every dialog; a darker
   border still says where keyboard focus is without looking like an alert */
.modal-header .close:focus-visible { border-color: #6c757d; }

.modal-body { padding: 0; }
.modal-body > div > .box > .box-header {
  padding: .75rem 3.5rem .75rem 1.25rem;   /* room on the right for the close button */
  margin: 0 0 1rem;
  background: var(--bs-tertiary-bg, #f6f8fa);
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  border-start-start-radius: .75rem;
  border-start-end-radius: .75rem;
}
.modal-body > div > .box > .box-body { padding: 0 1.25rem; }
.modal-body .box-title { margin: 0; font-size: 1.0625rem; font-weight: 600; }

/* the tab strip belongs under the band, not floating in the body */
.modal-body .nav-tabs-custom > .nav-tabs { padding-inline: 0; }
.modal-body .nav-tabs-custom > .nav-tabs > li > a { padding: .45rem .75rem; font-size: .875rem; }
/* the panel keeps the old screens' faint brand tint, so its fields need room off its edges */
.modal-body .nav-tabs-custom > .tab-content { padding: 1rem 1rem 0; background: transparent; }
/* The big cards keep one size whatever tab is open - the window no longer jumps between a 300px
   Comments tab and a 900px Files tab - and use the whole height of the screen. On white, since a
   fixed-height dialog with a tinted panel ending halfway down it looks unfinished. */
.modal-dialog.card-item:has(.nav-tabs) .modal-content { height: calc(100vh - 2rem); }
/* With the height fixed, a short tab would leave Save floating halfway down the window. Every
   container between the body and the card's footer becomes a growing flex column, so the footer
   can take margin-top:auto and sit on the bottom edge. Grids (.row, col-*) and hidden tab panes
   are left alone - making those flex columns would stack a form or show every pane at once. */
.modal-dialog.card-item:has(.nav-tabs) .modal-body,
.modal-dialog.card-item:has(.nav-tabs) .modal-body :is(div, form):not(.row):not([class*="col-"]):not(.tab-pane:not(.active)):has(.box-footer:not([class*="col-"] .box-footer)) {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}
.modal-dialog.card-item:has(.nav-tabs) .modal-body .box-footer:not([class*="col-"] .box-footer) { margin-top: auto; }
/* a notes field must not be taller than the screen it is on */
/* also on the screens themselves: the client card's two 14-row notes fields (other material
   information, payment-discipline breaches) were 326px each and pushed the form 98px past the
   window. Longer text scrolls inside the field. */
.modal-body textarea.form-control { max-height: 12rem; }
/* 8rem (about five lines) rather than 12: the legal-person card has four of them, two stacked in
   one column, and at 12rem that column still ran 9px past a 959px window. */
.app-content textarea.form-control:not(.modal-body textarea) { max-height: 8rem; }

/* ---- buttons in a .row ----
   Bootstrap 5 gives every direct child of .row width:100%, so a button placed straight into one -
   which this markup does for Save and Cancel - becomes a full-width bar, and two of them stack
   into the slab at the bottom of every card. */
.row > .btn,
.box-footer .row > .btn { flex: 0 0 auto; width: auto; padding-inline: 1.25rem; }
.box-footer {
  padding: .875rem 0 0;
  margin-top: 1rem;
  background: transparent;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}
/* Left, lined up with the first column of fields - where prod has them (decided 21.11.2026). */
.box-footer > .row { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-start; margin: 0; }

/* In a dialog, Save and Cancel are the dialog's footer: pinned to its bottom edge, left-aligned,
   on white, always visible however far the card scrolls. They sit inside the tab pane in the
   markup (and inside a Knockout binding), so the bar is made by position:sticky rather than by
   moving them into .modal-footer - which is empty in all nine dialogs and is hidden.
   Only the card's own footer: a footer inside a column (the schedule form's Save, the CSV upload)
   belongs to that column and stays where it is. */
.modal-body .box-footer:not([class*="col-"] .box-footer) {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 1rem -1.25rem 0;   /* out to the dialog's edges through the body's padding */
  padding: .75rem 1.25rem;
  background: var(--bs-body-bg, #fff);
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}
/* ...and, inside a tab panel, through the panel's padding as well */
.modal-body .tab-content .box-footer:not([class*="col-"] .box-footer) { margin-inline: -2.25rem; padding-inline: 2.25rem; }
.modal-footer:not(:has(*)) { display: none; }

/* ---- forms: denser, and with a rhythm ----
   These cards carry forty fields. At Bootstrap's default sizing a third of them are below the
   fold, and the labels compete with the values for attention. */
.modal-body .form-control,
.modal-body .form-select,
.box .form-control,
.box .form-select { padding: .3rem .6rem; font-size: .9375rem; min-height: calc(1.5em + .6rem + 2px); }
.modal-body label,
.box label {
  margin-bottom: .2rem;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--bs-secondary-color, #6c757d);
}
.form-group { margin-bottom: .625rem; }
/* The forms colour a field's group red while it is empty - data-bind="style: { color: x() !== ''
   ? 'black' : 'red' }" - and that red is the only "this is missing" signal they have. The grey
   above must not swallow it, so a red group's label is red. Knockout writes it as rgb(). */
.form-group[style*="255, 0, 0"] label,
.form-group[style*="red"] label { color: #dc3545; }
.modal-body .row { --bs-gutter-x: 1.5rem; }
.modal-body .input-group.date { max-width: none; }
/* a read-only value should look settled, not like an input waiting for a change */
.modal-body .form-control[readonly],
.box .form-control[readonly] { background: var(--bs-tertiary-bg, #f1f3f5); border-color: transparent; }

/* ---- the selected row ----
   DataTables Select paints it rgba(13,110,253,.9) - Bootstrap's default blue, which belongs to
   nothing else on the page. The brand colour, and white text so it stays readable. */
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected > *,
table.dataTable tbody tr > .selected {
  background-color: var(--lma-brand) !important;
  box-shadow: none !important;
  color: #fff !important;
}
table.dataTable tbody tr.selected a { color: #fff; }
table.dataTable tbody tr.selected:hover > * { background-color: var(--lma-brand-dark) !important; }

/* ---- a tall dialog scrolls inside itself ----
   These cards are long - forty fields, or a payment schedule of a hundred rows - and the markup
   puts overflow:auto on the .modal element inline. Under Bootstrap 5 that lets the content escape
   the dialog instead of scrolling within it, which is how a schedule table ended up drawn over
   the list behind it. Cap the dialog at the window and let the body scroll. */
.modal .modal-dialog { --bs-modal-margin: 1rem; max-height: calc(100vh - 2rem); }
.modal .modal-content { max-height: calc(100vh - 2rem); }
.modal .modal-body { overflow-y: auto; overscroll-behavior: contain; }

/* a table inside a dialog keeps a sensible height of its own rather than the window's */
.modal .dataTables_scrollBody { height: auto !important; max-height: calc(100vh - 30rem) !important; }

/* the panel the schedule tab puts under its table carries a hard-coded margin-top:50px, which was
   clearing AdminLTE 2 chrome that no longer exists */
.modal [style*="margin-top:50px"] { margin-top: 1rem !important; }

/* ---- columns with no .row around them ----
   Bootstrap 3 floated every col-* left, so the report headers could put col-sm-4 straight inside
   another column or a <form> and get the fields side by side. Bootstrap 5 lays columns out only
   inside a .row (a flex container); anywhere else a col-sm-4 is just a block a third wide, so
   "period start" and "period end" stacked one under the other. Every element holding columns
   directly is made the flex row Bootstrap 3 implied. Anything in it that is not a column - a
   label, a hint - keeps a line of its own, as it did when the columns floated beside it. */
.app-content :not(.row):has(> [class*="col-"]:not(.btn)) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}
.app-content :not(.row):has(> [class*="col-"]:not(.btn)) > [class*="col-"]:not(.btn) {
  padding-inline: 0 .75rem;
}
.app-content :not(.row):has(> [class*="col-"]:not(.btn)) > :not([class*="col-"]):not(.btn):not(script):not(template) {
  flex: 0 0 100%;
}
/* a checkbox column beside a date: centred on the input, not on the label above it */
.app-content .checkbox { align-self: center; }
.app-content .checkbox > label { display: inline-flex; align-items: center; gap: .375rem; margin: 0; }
/* a button in a narrow column overflows it on one line, as it did when the column floated */
.app-content [class*="col-"] > .btn { white-space: nowrap; }

/* buttons given col-sm-3 to make them equal: a gap between them, as margin-r-5 gave */
.app-content form:has(> .btn[class*="col-"]) { display: flex; flex-wrap: wrap; gap: .375rem; }
.app-content form > .btn[class*="col-"] { flex: 0 0 auto; width: auto; min-width: 11rem; }

/* the report's own title reads as one */
.app-content .box > .box-header > .box-title { font-size: 1.0625rem; font-weight: 600; margin: 0; }

/* ---- a .row inside a box-header ----
   The header is a flex line (for the +/- and filter groups), and a .row inside it became a
   flex item sized to its content - so the columns of the logs filter shrank to nothing: date
   fields showing one digit, "delete older than" broken over five lines. A row takes the whole
   line, as it did under Bootstrap 3. */
.box-header > .row { flex: 0 0 100%; min-width: 0; }
/* col-3 on an input-group (logs, "delete older than") meant nothing in Bootstrap 3; in 5 it cuts
   the date field to a quarter of its column. */
.input-group.date[class*="col-"] { width: auto; flex: 1 1 auto; padding: 0; }

/* ---- select.form-control ----
   Bootstrap 3 drew the browser's own drop-down arrow on a select.form-control. Bootstrap 5
   strips the arrow from .form-control and draws it only on .form-select, so 17 old selects
   looked like plain text boxes - nothing said they open. Drawn the way .form-select draws it. */
select.form-control:not([multiple]):not([size]) {
  appearance: none;
  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 .6rem center;
  background-size: 14px 10px;
  padding-right: 2rem;
}
select.form-control:disabled { background-image: none; }
/* a one-column date filter (logs: From / To) is narrower than a date once the calendar addon
   takes its share; prod's smaller type just fitted. Never narrower than a whole date. */
.box-header .row > [class*="col-"]:has(> .input-group.date) { min-width: 10.5rem; }

/* ---- a .row with no columns in it ----
   Some forms wrap a lone button in <div class="row"> (settings: Save). Bootstrap 5's row pulls
   itself out by half a gutter for the columns it expects, and gives each child the gutter as
   padding - with no columns, that shifted the button 12px left of the inputs above it and padded
   it out. With nothing to align, the row keeps to its parent's edge and a button keeps its own
   size. */
/* footer rows have their own rules above (right-aligned, wider buttons) and are left to them */
.row:not(.box-footer .row):not(:has(> [class*="col-"])) { margin-inline: 0; }
.row:not(.box-footer .row):not(:has(> [class*="col-"])) > .btn { width: auto; padding-inline: var(--bs-btn-padding-x); }

/* ---- a date and its "Form" button on one line (loan card: schedule, debts) ----
   <form> holds a col-sm-6 date and a col-sm-6 button. With the button at its 11rem minimum the
   two halves came to 2px more than the column, so the button dropped under the date; on prod
   they share the line. The date gives way instead - its input is capped at 100px anyway. */
.app-content form:has(> .btn[class*="col-"]) > [class*="col-"]:not(.btn) { flex: 1 1 8rem; width: auto; min-width: 0; }

/* ---- rows stacked inside a box-header's pull-left (loan card: borrowers, guarantors) ----
   The pull-left became a flex line for its buttons; when what it holds is rows - the personal-ID
   field, then the "legal person" checkbox under it - each row keeps a line of its own, as on prod. */
.box-header > :is(.pull-left, .pull-right):has(> .row) { flex-direction: column; align-items: stretch; }

/* ---- order / payment-request details beside the list (loan card: Требования, Счета) ----
   The details were laid out for 9/12 of the card: a 2/12 column of fields beside the items.
   With the list now taking 7/12 (it needs ~800px), that column came to 85px - dates cut to
   47px. In this narrower place the fields become a two-column grid across the top and the
   items go full width under them. The orders/payreqs pages' own dialogs are untouched. */
.lma-side-details .row > .col-lg-2:first-child {
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1rem;
}
.lma-side-details .row > .col-lg-10,
.lma-side-details .row > .col-lg-2:first-child + .col-lg-10 { flex: 0 0 100%; width: 100%; max-width: 100%; }
/* the items list under them: all the width its (usually hidden) item editor does not take, and
   long explanations wrap instead of scrolling the list sideways */
.lma-side-details .col-lg-10 .col-sm-9 { flex: 1 1 0; width: auto; max-width: none; min-width: 0; }
.lma-side-details .col-lg-10 .col-sm-3 { flex: 0 0 14rem; width: 14rem; max-width: 14rem; }
.lma-side-details table.dataTable td,
.lma-side-details table.dataTable td.dt-body-nowrap { white-space: normal; }

/* ---- a table is never shorter than about five rows ----
   Tables follow their row count (scrollCollapse in the view models, and the layout's fitting
   never makes one taller than its rows) - which left a one-row list 31px high, a sliver under
   its header that read as broken. A floor of about five rows; the small items list inside the
   order / payment-request details keeps a lower one. */
.dataTables_scrollBody { min-height: 10rem; }
.lma-side-details .dataTables_scrollBody { min-height: 5rem; }
