/* responsive-tables.css */

/* Bootstrap 5 text-alignment utilities on a Bootstrap 4 site: templates use
   the BS5 names (.text-end/.text-start) but the loaded framework is BS4
   (which only knows .text-right/.text-left), so without these aliases the
   classes silently do nothing and amount columns render left-aligned.
   !important mirrors how Bootstrap defines its own utility classes. */
.text-end {
    text-align: right !important;
}
.text-start {
    text-align: left !important;
}

/* Phone layout for tables built on the generic list scaffold (templates/
   generic.html), which stamps .datatable and fills each cell's data-label from
   its column header.

   The label sits ABOVE the value rather than in an absolutely-positioned left
   column. The old two-column version pinned the label at width:45% and pushed
   the value into the right half with padding-left:50%, so any value wider than
   its half — a description, a row of action buttons — ran back underneath the
   label and the two rendered on top of each other. Stacking cannot collide, and
   it gives these rows the same bold-label-then-value shape as the hand-written
   card lists elsewhere in the app (e.g. the patient list). */
@media (max-width: 768px) {
    .datatable thead {
        display: none;
    }
    /* Each row becomes a card. */
    .datatable tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: #fff;
        border: 1px solid rgba(0, 0, 0, .125);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        border-radius: 5px;
        padding: .5rem .25rem;
    }
    /* Striping alternates the row background, which the card background above
       would otherwise override on every second row. */
    .datatable.table-striped tbody tr:nth-of-type(odd) {
        background: #fcfcfd;
    }
    .datatable td {
        display: block;
        width: auto;
        text-align: left;
        border: 0;
        padding: .25rem .75rem;
    }
    .datatable td::before {
        content: attr(data-label);
        display: block;
        font-weight: 700;
        font-size: .8rem;
        line-height: 1.3;
        color: #6c757d;
    }
    /* An empty data-label (a cell with no matching header) would still reserve
       a line; collapse it. */
    .datatable td[data-label=""]::before {
        display: none;
    }
}
/* The BADGE palette used to live here. It is now core/static/core/badges.css,
   because this file is a TABLE stylesheet and three Bootstrap-loading bases
   that render badges never load it — see that file's header for the bug that
   moved it. Nothing else changed; the rules are byte-identical. */
