/* ============================================================================
   Healers Tab — tenant application theme
   A cohesive, brand-driven design layer over Bootstrap 5. Every accent derives
   from the per-tenant --brand / --brand-ink variables set in the page <head>,
   so the whole UI re-themes to each clinic's colour automatically.
   ========================================================================== */

:root {
  --brand: #0d6efd;                /* overridden per tenant in <head> */
  --brand-ink: #ffffff;            /* readable text on the brand colour */

  /* Neutral surface system */
  --bg:        #eef1f6;
  --surface:   #ffffff;
  --surface-2: #f7f9fc;
  --line:      #e4e8f0;
  --line-soft: #eef1f6;
  --ink:       #1f2733;
  --ink-soft:  #5b6675;
  --ink-muted: #8a93a3;

  --radius:    14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.07);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.16);

  /* Brand tints derived at runtime */
  --brand-050: color-mix(in srgb, var(--brand) 8%,  #fff);
  --brand-100: color-mix(in srgb, var(--brand) 14%, #fff);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, #fff);
}

/* ---- Base ---------------------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Bootstrap's 16px default is tuned for prose. This is a working screen where
     a receptionist scans dozens of rows, so body text is 15px and tables 14px.
     The ROOT stays at 16px on purpose: Bootstrap sizes buttons, inputs and
     spacing in rem against it, and shrinking that cramps the whole interface
     instead of just making the text denser. */
  font-size: .9375rem;          /* 15px */
  line-height: 1.55;
}

/* Tables carry the density benefit. Documents are unaffected — prescriptions and
   invoices are rendered by mPDF and never load this stylesheet. */
.table { font-size: .875rem; }  /* 14px */

/* Keep the smaller helpers legible rather than letting them scale down with the
   body: .small at .875em of 15px would be 13.1px, and the dashboard labels and
   patient codes are already at the limit. */
.small, small { font-size: .8125rem; }   /* 13px */

/* Badges are sized in em, so they shrank with the body to 11.25px. The billing
   states (Not billed / Due / Part paid / Paid) have to be readable at a glance,
   which is the entire reason they are badges. */
.badge { font-size: .75rem; }            /* 12px */
h1,h2,h3,h4,h5,h6 { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
h1 { font-weight: 700; }
a { color: color-mix(in srgb, var(--brand) 78%, #000); text-decoration: none; }
a:hover { color: var(--brand); text-decoration: underline; }
.text-muted { color: var(--ink-muted) !important; }
hr { border-color: var(--line); opacity: 1; }
main.container-fluid { max-width: 1480px; }
::selection { background: color-mix(in srgb, var(--brand) 22%, #fff); }

/* Brand-coloured Bootstrap accents (links, checks, focus, pagination, etc.) */
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: color-mix(in srgb, var(--brand) 45%, #fff);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 22%, transparent); }
.form-range::-webkit-slider-thumb { background: var(--brand); }
.form-range::-moz-range-thumb { background: var(--brand); }
.page-link { color: color-mix(in srgb, var(--brand) 80%, #000); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--brand); color: var(--brand-ink); }
.list-group-item.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.spinner-border, .spinner-grow { color: var(--brand); }
.progress-bar { background-color: var(--brand); }

/* ---- Page-top notice strips ---------------------------------------------- */
/* Trial / overdue / impersonation / maintenance. These used to carry an inline
   `position:sticky; top:0; z-index:1035`, which put them in the same pinned
   slot the sticky navbar claims — and with the higher z-index they won, so once
   you scrolled, the notice sat on top of the navbar and hid it. They are
   page-top notices, not controls: they scroll away with the page and the navbar
   keeps the pinned slot. (This also freed the navbar's stacking context, which
   the phone drawer lives inside.) */
.app-strip { position: static; }

/* ---- Top navigation ------------------------------------------------------ */
.app-nav {
  background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 62%, #000), var(--brand));
  box-shadow: 0 2px 14px rgba(16,24,40,.18);
  padding-top: .55rem; padding-bottom: .55rem;
  position: sticky; top: 0; z-index: 1030;
}
.app-nav .navbar-brand { letter-spacing: .2px; margin-right: 1.25rem; }
.app-brand-logo {
  height: 36px; width: auto; max-width: 190px; object-fit: contain;
  background: #fff; padding: 4px 9px; border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.app-brand-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; font-size: 18px;
  background: color-mix(in srgb, var(--brand-ink, #fff) 16%, transparent);
  color: var(--brand-ink, #fff);
}
.app-brand-name { font-weight: 700; }

/* Navbar text/icons adapt to the brand colour: white on dark, near-black on light. */
.app-nav {
  --bs-navbar-color: color-mix(in srgb, var(--brand-ink, #fff) 80%, transparent);
  --bs-navbar-hover-color: var(--brand-ink, #fff);
  --bs-navbar-active-color: var(--brand-ink, #fff);
  --bs-navbar-brand-color: var(--brand-ink, #fff);
  --bs-navbar-brand-hover-color: var(--brand-ink, #fff);
  --bs-navbar-disabled-color: color-mix(in srgb, var(--brand-ink, #fff) 60%, transparent);
}
.app-nav .navbar-brand, .app-nav .navbar-brand:hover, .app-nav .navbar-brand:focus { color: var(--brand-ink, #fff); }
.app-nav .navbar-nav { --bs-nav-link-padding-x: .8rem; align-items: center; gap: 2px; }
.app-nav .nav-link {
  color: color-mix(in srgb, var(--brand-ink, #fff) 80%, transparent);
  border-radius: 9px; padding-top: .4rem; padding-bottom: .4rem;
  transition: background .14s ease, color .14s ease;
}
.app-nav .nav-link:hover, .app-nav .nav-link:focus {
  color: var(--brand-ink, #fff);
  background: color-mix(in srgb, var(--brand-ink, #fff) 14%, transparent);
}
.app-nav .nav-link.active, .app-nav .nav-item.show > .nav-link, .app-nav .nav-link.show {
  color: var(--brand-ink, #fff);
  background: color-mix(in srgb, var(--brand-ink, #fff) 22%, transparent);
}
.app-nav .nav-link.disabled, .app-nav .navbar-text { color: color-mix(in srgb, var(--brand-ink, #fff) 60%, transparent); }
.app-nav .navbar-toggler { color: var(--brand-ink, #fff); border-color: color-mix(in srgb, var(--brand-ink, #fff) 38%, transparent); }
.app-nav .navbar-nav .badge { font-weight: 600; }

/* ---- Dropdowns ----------------------------------------------------------- */
.dropdown-menu {
  --bs-dropdown-border-color: var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; margin-top: 8px !important; font-size: .94rem;
}
.dropdown-item { border-radius: 8px; padding: .42rem .7rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 82%, #000); }
.dropdown-item.active, .dropdown-item:active { background: var(--brand); color: var(--brand-ink); }
.dropdown-header { color: var(--ink-muted); font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; }
.dropdown-divider { border-color: var(--line-soft); }

/* ---- Cards --------------------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}
.card > .card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  font-weight: 600; color: var(--ink);
  padding: .85rem 1.1rem;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
}
.card > .card-footer { background: var(--surface-2); border-top: 1px solid var(--line-soft); }
.card-body { padding: 1.15rem; }

/* ---- Buttons ------------------------------------------------------------- */
.btn { --bs-btn-border-radius: var(--radius-sm); font-weight: 500; padding: .44rem .9rem; transition: filter .14s ease, box-shadow .14s ease, background .14s ease; }
.btn-sm { --bs-btn-border-radius: 8px; }
.btn-lg { --bs-btn-border-radius: 12px; }
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: color-mix(in srgb, var(--brand) 88%, #000);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 88%, #000);
  --bs-btn-active-bg: color-mix(in srgb, var(--brand) 82%, #000);
  --bs-btn-active-border-color: color-mix(in srgb, var(--brand) 82%, #000);
  --bs-btn-color: var(--brand-ink); --bs-btn-hover-color: var(--brand-ink); --bs-btn-active-color: var(--brand-ink);
  --bs-btn-disabled-bg: color-mix(in srgb, var(--brand) 55%, #fff); --bs-btn-disabled-border-color: color-mix(in srgb, var(--brand) 55%, #fff); --bs-btn-disabled-color: var(--brand-ink);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 32%, transparent);
}
.btn-primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent); }
.btn-outline-primary {
  --bs-btn-color: color-mix(in srgb, var(--brand) 82%, #000); --bs-btn-border-color: color-mix(in srgb, var(--brand) 45%, #fff);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-hover-color: var(--brand-ink);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); --bs-btn-active-color: var(--brand-ink);
}
.btn-link { color: color-mix(in srgb, var(--brand) 80%, #000); text-decoration: none; }
.btn-link:hover { color: var(--brand); }
.btn:focus-visible, .btn.focus { box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--brand) 28%, transparent); }

/* ---- Forms --------------------------------------------------------------- */
.form-label { font-weight: 500; color: var(--ink-soft); margin-bottom: .3rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm); border-color: var(--line);
  padding: .5rem .75rem; color: var(--ink); background-color: var(--surface);
}
.form-control:hover, .form-select:hover { border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.form-control:focus, .form-select:focus {
  border-color: color-mix(in srgb, var(--brand) 55%, #fff);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 18%, transparent);
}
.form-control::placeholder { color: var(--ink-muted); }
/* Reserve room for the dropdown caret so long selected values don't overlap it. */
.form-select { padding-right: 2.25rem; background-position: right .75rem center; }
.input-group-text { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); border-radius: var(--radius-sm); }

/* ---- Tables -------------------------------------------------------------- */
.table { --bs-table-color: var(--ink); vertical-align: middle; margin-bottom: 0; }
.table > thead th {
  background: var(--surface-2); color: var(--ink-soft);
  font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table > tbody tr { border-color: var(--line-soft); }
.table-hover > tbody > tr:hover > * { background: var(--brand-050); }
.table > :not(caption) > * > * { padding: .68rem .8rem; }
.card > .table:last-child, .card > .table-responsive:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); overflow: hidden; }

/* ---- Badges, alerts, misc ------------------------------------------------ */
.badge { font-weight: 600; border-radius: var(--radius-pill); padding: .34em .7em; }
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); }
.alert-dismissible { padding-right: 3rem; }
.modal-content { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--line-soft); }
.toast { border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.breadcrumb { --bs-breadcrumb-divider-color: var(--ink-muted); font-size: .9rem; }
.breadcrumb-item.active { color: var(--ink-soft); }

/* ---- Login --------------------------------------------------------------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--brand); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 58%, #000), var(--brand)); }
.login-card { background: #fff; padding: 2.4rem; border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.28); width: 100%; max-width: 390px; }
.login-logo { width: 64px; height: 64px; line-height: 64px; margin: 0 auto .6rem; font-size: 30px; color: var(--brand-ink, #fff); background: var(--brand); border-radius: 18px; text-align: center; box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 40%, transparent); }

/* ---- App-specific bits (preserved) -------------------------------------- */
.stat-card { border-radius: var(--radius); }
.stat-card .h3 { font-size: 1.7rem; }
.sticky-save { position: sticky; top: 5rem; z-index: 1000; }
.med-row td, .item-row td { vertical-align: middle; }
.dose-input { width: 34px; text-align: center; padding-left: .15rem; padding-right: .15rem; }

/* Prescription rows: keep every dropdown selection fully readable.
   Bootstrap's .form-select is width:100%, so in the crowded Rx table the
   selects compress and clip their selected text. Give them content-based
   widths with sane minimums; the .table-responsive wrapper scrolls
   horizontally on narrow screens instead of truncating. */
/* The column minimums used to total roughly 900px, so the Rx table scrolled
   sideways inside its card even on a wide desktop. They now total about 720px,
   which fits the consultation column without a scrollbar; the .table-responsive
   wrapper still takes over on a genuinely narrow screen, which is what it is
   for. The medicine name takes the slack, since it is the one column that
   benefits from every pixel it can get. */
/* A floor so the medicine name never collapses to a sliver: below this the
   .table-responsive wrapper scrolls, which is the right behaviour on a narrow
   screen but must not happen on a desktop. */
/* ---- Appointments list -------------------------------------------------
   Four action buttons with full-word labels plus a wrapping clinic name pushed
   each row to three lines on a 1100px laptop. Compact buttons, and no wrapping
   where a wrap serves nothing (the time, the clinic, the amount), keep the row
   to one line without introducing a sideways scroll. */
.appt-table td, .appt-table th { vertical-align: middle; }
.appt-table .cell-when,
.appt-table .cell-clinic,
.appt-table .cell-phone { white-space: nowrap; }
.appt-table .cell-visit { white-space: nowrap; }

/* Without minimums the browser starved the Patient column to ~108px and wrapped
   the name over three lines, while Phone and Clinic kept room they did not need.
   These total under the width available on a 1100px laptop, so each cell keeps
   to one line and the table still does not scroll. */
.appt-table .cell-when   { min-width: 88px; }
.appt-table .cell-patient{ min-width: 150px; }
.appt-table .cell-phone  { min-width: 96px; }
.appt-table .cell-visit  { min-width: 132px; }
.appt-table .cell-clinic { min-width: 90px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
/* The status control does not need to be as wide as its longest option. */
/* Bootstrap paints the chevron as a background image at the right edge, so the
   control needs real room for it — at 1.4rem "Completed" ran straight into it. */
.appt-table .status-select {
  max-width: 128px; font-size: .82rem;
  padding-right: 1.9rem; padding-left: .5rem;
  background-position: right .5rem center;
}
.appt-table .cell-actions .btn {
  padding: .2rem .45rem; font-size: .78rem; line-height: 1.25;
}
.appt-table .cell-actions .btn + .btn { margin-left: .2rem; }
.appt-table .badge { font-weight: 600; }
@media (max-width: 1300px) {
  /* Buttons carry their meaning in an icon once space runs short. */
  .appt-table .cell-actions .btn-label-long { display: none; }
  /* Below this the row is the constraint, not the page: shave the columns that
     can spare it rather than let the table push the page sideways. */
  .appt-table .cell-when   { min-width: 80px; }
  .appt-table .cell-patient{ min-width: 140px; }
  .appt-table .cell-phone  { min-width: 92px; }
  .appt-table .cell-visit  { min-width: 120px; }
  .appt-table .cell-clinic { min-width: 78px; max-width: 110px; }
  .appt-table .status-select { max-width: 116px; padding-right: 1.75rem; font-size: .78rem; }
  .appt-table .cell-actions .btn { padding: .18rem .38rem; font-size: .74rem; }
  .appt-table > tbody > tr > td, .appt-table > thead > tr > th { padding-left: .4rem; padding-right: .4rem; }
}

.rx-table { min-width: 820px; width: 100%; table-layout: fixed; }
.rx-table > thead > tr > th,
.rx-table > tbody > tr > td { padding: .35rem .25rem; }
/* Fixed layout does not clip on its own: without this the "+Meds" header ran
   straight into "Instructions". */
.rx-table > thead > tr > th {
  font-size: .78rem; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Fixed layout: the widths below are the whole story, and the name column
   absorbs whatever is left. */
.rx-table > thead > tr > th:nth-child(1) { width: auto; }              /* Medicine  */
.rx-table > thead > tr > th:nth-child(2),
.rx-table > thead > tr > th:nth-child(3),
.rx-table > thead > tr > th:nth-child(4) { width: 38px; }              /* B / L / D */
.rx-table > thead > tr > th:nth-child(5) { width: 112px; }             /* Timing    */
.rx-table > thead > tr > th:nth-child(6) { width: 148px; }             /* Frequency */
.rx-table > thead > tr > th:nth-child(7) { width: 96px;  }             /* Duration  */
.rx-table > thead > tr > th:nth-child(8) { width: 56px;  }             /* +Meds     */
.rx-table > thead > tr > th:nth-child(9) { width: 118px; }             /* Instructions */
.rx-table > thead > tr > th:nth-child(10){ width: 46px;  }             /* remove    */

/* The remove button was 43px inside a 38px column, which pushed the table 9px
   wider than its wrapper at every screen size — a scrollbar caused by one
   button, not by the layout. Size it to the cell. */
.rx-table > tbody > tr > td:nth-child(10) { padding-left: .1rem; padding-right: .1rem; text-align: center; }
.med-row .rm-row { padding: .15rem .35rem; line-height: 1.1; }

.rx-table > tbody > tr > td:nth-child(2),
.rx-table > tbody > tr > td:nth-child(3),
.rx-table > tbody > tr > td:nth-child(4) {
  text-align: center; padding-left: .1rem; padding-right: .1rem;
}

/* Every control fills its cell rather than demanding a minimum of its own. */
.med-row .med-name,
.med-row .med-note,
.med-row .med-timing,
.med-row .med-freq,
.med-row .med-dur { width: 100%; min-width: 0; }
.med-row .med-timing,
.med-row .med-freq,
.med-row .med-dur { font-size: .8rem; padding-left: .4rem; padding-right: 1.2rem; }
.med-row .med-name, .med-row .med-note { font-size: .85rem; }
.med-row .dose-input { width: 100%; min-width: 0; padding-left: .15rem; padding-right: .15rem; text-align: center; }

.lab-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 78%, #000); border-radius: 16px; padding: 3px 10px; margin: 0 6px 6px 0; font-size: 13px; }
.lab-chip .x { cursor: pointer; font-weight: 700; }
.lab-chip .lab-note { border: 1px solid color-mix(in srgb, var(--brand) 35%, #fff); background: #fff; border-radius: 10px; font-size: 12px; padding: 1px 8px; min-width: 120px; color: #212529; }
.lab-chip .lab-note:focus { outline: none; border-color: var(--brand); }
.ui-autocomplete { z-index: 2000 !important; max-height: 280px; overflow-y: auto; border-radius: 10px !important; box-shadow: var(--shadow-lg); }
.ui-menu .ui-menu-item-wrapper.ui-state-active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); border-radius: 6px; }

/* Month calendar grid (calendar + dashboard mini) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { margin-bottom: 4px; }
.cal-grid + .cal-grid { margin-top: 4px; }
.cal-cell { position: relative; display: block; min-height: 78px; border-radius: 8px; padding: 4px 6px; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line-soft); transition: background .12s, box-shadow .12s; }
.cal-cell:hover { background: var(--brand-050); }
.cal-cell.cal-out { background: var(--surface-2); }
.cal-cell.cal-today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day { font-weight: 600; font-size: .9rem; }
.cal-closed { color: #c0c4cc; }
.cal-count { position: absolute; left: 6px; bottom: 6px; }
@media (max-width: 575.98px) {
  .cal-cell { min-height: 52px; padding: 3px 4px; }
  .cal-day { font-size: .78rem; }
  .cal-count { font-size: .65rem; left: 4px; bottom: 4px; }
}

@media print {
  .app-nav, footer, .no-print { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff; }
}

/* ---- Responsive list tables: stack rows into cards on phones ----
   Add class "table-cards" to a <table>, give each <td> a data-label,
   and mark the actions cell with class "cell-actions". Below md the
   table collapses into one card per row (label : value pairs). */
@media (max-width: 767.98px) {
  /* iOS Safari zooms the page whenever a focused field is under 16px, so form
     controls stay at 16px on a phone whatever the body is set to. */
  .form-control, .form-select { font-size: 16px; }
  .table-responsive:has(> .table-cards) { overflow-x: visible; }
  table.table-cards { border: 0; }
  table.table-cards > thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  table.table-cards > tbody { display: block; }
  table.table-cards > tbody > tr {
    display: block; background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; padding: 4px 14px; margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(16,24,40,.05);
  }
  table.table-cards > tbody > tr:last-child { margin-bottom: 0; }
  table.table-cards.table-hover > tbody > tr:hover > * { background: transparent; }
  table.table-cards > tbody > tr > td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 0; border: 0; border-bottom: 1px solid var(--line-soft);
    text-align: right; white-space: normal;
  }
  table.table-cards > tbody > tr > td:last-child { border-bottom: 0; }
  table.table-cards > tbody > tr > td::before {
    content: attr(data-label); font-weight: 600; color: var(--ink-muted);
    text-align: left; flex: 0 0 36%; white-space: nowrap;
  }
  /* actions cell: full-width wrapping button group, no label */
  table.table-cards > tbody > tr > td.cell-actions {
    flex-wrap: wrap; justify-content: center; gap: 5px; text-align: center; padding-top: 12px;
  }
  table.table-cards > tbody > tr > td.cell-actions::before { content: none; }
  table.table-cards > tbody > tr > td.cell-actions > .btn {
    flex: 0 1 auto; padding: .2rem .5rem; font-size: .78rem; line-height: 1.35;
  }
  /* empty-state row (colspan) centres, no label */
  table.table-cards > tbody > tr > td[colspan]::before { content: none; }
  table.table-cards > tbody > tr > td[colspan] { justify-content: center; text-align: center; }
  table.table-cards > tbody > tr > td > .form-select { width: auto; }

  /* Desktop column widths must not survive into the card layout.
     .cell-clinic carries max-width:110px so the clinic column cannot blow out a
     1300px table — but the card <td> is a flex CONTAINER, so that width clamped
     the whole label-and-value row to 110px. The label takes 36% of it, leaving
     about 56px, and "Health Haven Clinic" was cut to "Health Ha" with no
     ellipsis, because text-overflow does not apply to a flex container.
     The same reset covers the other columns that carry minimums. */
  table.table-cards > tbody > tr > td.cell-clinic,
  table.table-cards > tbody > tr > td.cell-when,
  table.table-cards > tbody > tr > td.cell-patient,
  table.table-cards > tbody > tr > td.cell-phone,
  table.table-cards > tbody > tr > td.cell-visit {
    max-width: none; min-width: 0; overflow: visible; text-overflow: clip;
  }
  /* A long clinic name now wraps onto a second line rather than being cut. */
  table.table-cards > tbody > tr > td.cell-clinic { white-space: normal; word-break: break-word; }
}
