/* OrthoPlan Pro — My cases + money (6 Nov 2026, package DSH).
 *
 * Layout and meaning only; the look comes from the shared containers
 * (.op-card, .op-pay-card, .op-chip, .op-tabs-nav, .op-table) and package S's
 * design layer, which loads after this file (op-zz-design.css). Logical
 * properties throughout: every page is also drawn right to left.
 */

/* ---- My cases: the status filter (R-DSH-02) ---- */
.op-frontend .op-case-filter { margin: calc(-1 * var(--op-sp-2)) 0 var(--op-sp-4); }
.op-frontend .op-case-filter .op-case-filter-chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.op-frontend .op-case-filter-count {
    font-size: 11px; font-weight: 700; min-width: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--op-bg-alt); color: var(--op-text-muted); text-align: center;
}
.op-frontend .op-chip.is-active .op-case-filter-count { background: rgba(255, 255, 255, .25); color: inherit; }
/* The "N active cases" chip is a way into All clinics + Active. */
.op-frontend a.op-usage-link { text-decoration: none; color: inherit; cursor: pointer; display: inline-flex; align-items: center; min-height: 32px; }
.op-frontend a.op-usage-link:hover { border-color: var(--op-primary); color: var(--op-primary-dark); }
.op-frontend .op-money-link { white-space: nowrap; }

/* ---- My cases: the card's badges (R-DSH-05, R-DSH-07) ---- */
.op-frontend .op-case-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; min-width: 0; }
.op-frontend .op-case-badge {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
    font-size: 11.5px; font-weight: 600; line-height: 1.3; padding: 2px 8px;
    border-radius: var(--op-radius-pill, 999px); border: 1px solid var(--op-border);
    background: var(--op-bg-alt); color: var(--op-text-muted);
    overflow-wrap: anywhere;   /* a long reminder wraps on a phone rather than losing its end */
}
.op-frontend .op-case-badge.is-lab     { background: var(--op-info-bg); color: var(--op-info-text); border-color: transparent; }
.op-frontend .op-case-badge.is-pending { background: var(--op-warning-bg); color: var(--op-warning-text); border-color: transparent; }
.op-frontend .op-case-badge.is-overdue { background: var(--op-late-bg, var(--op-danger-bg)); color: var(--op-late-text, var(--op-danger-text)); border-color: var(--op-late, var(--op-danger)); }
.op-frontend .op-case-badge.is-info    { background: var(--op-bg-alt); }
.op-frontend .op-case-badge.is-more    { background: transparent; }
.op-frontend .op-case-badge-pending .op-case-badge-teeth,
.op-frontend .op-case-badge-teeth { color: var(--op-mark-extract, var(--op-danger)); font-weight: 700; }
.op-frontend .op-case-badge-lab { letter-spacing: 0; }

/* ---- Appointments: what the page is, and where the money went (R-DSH-10/11) ---- */
.op-frontend .op-agenda-what { max-width: 70ch; }
.op-frontend .op-agenda-scope { display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-2) var(--op-sp-4); margin-top: var(--op-sp-2); font-size: 13px; }
.op-frontend .op-agenda-money-link { font-weight: 600; display: inline-flex; align-items: center; min-height: 32px; }
.op-frontend .op-front-desk-anchor { scroll-margin-top: 96px; }

/* ---- The revenue split box (R-DSH-18), under Total treatment cost ----
 * It spans the row of the 2-column Payment plan grid; "dense" lets the down
 * payment take the cell beside Total, so the four boxes keep their pairs. */
.op-frontend .op-terms { grid-auto-flow: row dense; }
.op-frontend .op-split-box {
    grid-column: 1 / -1; min-width: 0;
    border: 1px dashed var(--op-border-strong); border-radius: var(--op-radius-md);
    padding: var(--op-sp-3) var(--op-sp-4); background: var(--op-bg-alt);
}
.op-frontend .op-split-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--op-sp-3); margin-bottom: var(--op-sp-2); }
.op-frontend .op-split-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--op-sp-3); }
.op-frontend .op-split-out { margin: var(--op-sp-2) 0 0; font-weight: 700; color: var(--op-text); overflow-wrap: anywhere; }
.op-frontend .op-split-is-default { margin: 4px 0 0; }
.op-frontend .op-split-default { margin: var(--op-sp-2) 0 0; }
.op-frontend .op-split-make-default { white-space: normal; text-align: start; }

/* ---- The case's Money step: the split and punctuality (R-DSH-19/20) ---- */
.op-frontend .op-money-case-split .op-pay-summary { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.op-frontend .op-money-punctuality { margin: 0 0 var(--op-sp-3); font-size: 13px; font-weight: 600; color: var(--op-text-muted); }
.op-frontend .op-money-punctuality.has-late { color: var(--op-late-text, var(--op-danger-text)); }
.op-frontend .op-money-late-sep { margin-inline: 2px; color: var(--op-text-soft); }
.op-frontend .op-money-unknown { color: var(--op-warning-text); font-style: italic; }

/* ---- The Money screen (R-DSH-12 … R-DSH-17) ---- */
.op-frontend .op-money-totals { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.op-frontend .op-money-totals .op-pay-card.is-overdue .op-pay-amount { color: var(--op-late-text, var(--op-danger-text)); }
.op-frontend .op-money-tabs { margin-top: var(--op-sp-4); }
.op-frontend .op-money-tabs .op-tab-link { display: inline-flex; align-items: center; gap: 6px; }
.op-frontend .op-money-panel { min-width: 0; }
.op-frontend .op-money-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--op-sp-2); margin: 0 0 var(--op-sp-3); }
.op-frontend .op-money-total strong { font-family: var(--op-font-display); font-size: 22px; font-weight: 800; }
.op-frontend .op-money-table td, .op-frontend .op-money-table th { white-space: nowrap; }
.op-frontend .op-money-table tfoot th, .op-frontend .op-money-table tfoot td { font-weight: 700; border-top: 2px solid var(--op-border-strong); }
.op-frontend .op-money-who { display: inline-flex; flex-direction: column; gap: 1px; text-decoration: none; color: inherit; }
.op-frontend .op-money-who:hover strong { color: var(--op-primary); text-decoration: underline; }
.op-frontend .op-money-who code { font-size: 11px; color: var(--op-text-muted); background: none; padding: 0; }
.op-frontend .op-money-pct { display: block; font-size: 11.5px; color: var(--op-text-muted); margin-top: 2px; }
.op-frontend .op-money-default { font-size: 11px; margin-inline-start: 4px; }
.op-frontend .op-money-split td[data-col="net"],
.op-frontend .op-money-split td[data-col="next"] { color: var(--op-text); }
.op-frontend .op-money-late td, .op-frontend .op-money-ontime td,
.op-frontend .op-money-coming td, .op-frontend .op-money-collected td,
.op-frontend .op-money-pending td, .op-frontend .op-money-orders td { vertical-align: top; }

/* The Lab tab: one account per lab. */
.op-frontend .op-money-lab-filter { margin-bottom: var(--op-sp-3); }
.op-frontend .op-money-lab-filter .op-chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.op-frontend .op-money-lab-rule { font-size: 13px; }
.op-frontend .op-money-lab > summary { cursor: pointer; list-style: none; }
.op-frontend .op-money-lab > summary::-webkit-details-marker { display: none; }
.op-frontend .op-money-lab-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--op-sp-2) var(--op-sp-4); }
.op-frontend .op-money-lab-name { font-weight: 800; font-size: 16px; }
.op-frontend .op-money-lab-figs { display: flex; flex-wrap: wrap; gap: 4px var(--op-sp-4); font-size: 13px; color: var(--op-text-muted); }
.op-frontend .op-money-lab-figs strong { color: var(--op-text); }
.op-frontend .op-money-lab-due strong { color: var(--op-warning-text); }
.op-frontend .op-money-lab-sentence { font-weight: 700; margin: var(--op-sp-3) 0 0; }
.op-frontend .op-money-lab-history { list-style: none; margin: 0; padding: 0; }
.op-frontend .op-money-lab-history li {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--op-sp-2);
    padding: 6px 0; border-bottom: 1px solid var(--op-border);
}
.op-frontend .op-lab-pay-form { margin-top: var(--op-sp-3); }
.op-frontend .op-lab-pay-delete { flex: 0 0 auto; }
.op-frontend .op-money-covers { border: 1px solid var(--op-border); border-radius: var(--op-radius-md); padding: var(--op-sp-2) var(--op-sp-3); }
.op-frontend .op-money-cover { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.op-frontend .op-money-order-not_sent { background: var(--op-bg-alt); color: var(--op-text-muted); }
.op-frontend .op-money-order-sent     { background: var(--op-info-bg); color: var(--op-info-text); }

/* The Collected tab's month. */
.op-frontend .op-money-month { display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-2); margin-bottom: var(--op-sp-3); }
.op-frontend .op-money-month input[type="month"] { min-height: 36px; }

/* "Owed to us", under the tabs: a different debt, its own card. */
.op-frontend .op-money-owed-us { margin-top: var(--op-sp-4); }

@media (max-width: 640px) {
    .op-frontend .op-split-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .op-frontend .op-money-tabs { flex-wrap: wrap; }
    .op-frontend .op-money-total strong { font-size: 19px; }
}

/* The screen's head wraps its back link under the title on a phone. */
.op-frontend.op-money-page .op-page-head { flex-wrap: wrap; gap: var(--op-sp-3); }

/* ==================================================================
 * fix/money (M11-01, M11-02, M11-03)
 * ================================================================== */

/* ---- One collection in three: Doctor · Clinic · Lab (collect-split.php) ----
 * Each party keeps one colour everywhere it appears — the dialog, the
 * collected row, Money › Collected, the front desk — as a dot beside its
 * name, never as a fill: the figures stay ink. */
.op-frontend .op-cs { min-width: 0; }
.op-frontend .op-cs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--op-text-soft); flex: 0 0 auto; vertical-align: middle; }
.op-frontend .is-doctor .op-cs-dot { background: var(--op-primary); }
.op-frontend .is-clinic .op-cs-dot { background: var(--op-info); }
.op-frontend .is-lab .op-cs-dot { background: var(--op-warning); }
.op-frontend .op-cs-amt { white-space: normal; font-variant-numeric: tabular-nums; }
.op-frontend .op-cs-n { white-space: nowrap; }
.op-frontend .op-cs-c { white-space: nowrap; font-size: .9em; color: var(--op-text-muted); }

/* The full form: a small table, the parties across, now / still to come down. */
.op-frontend .op-cs-full { margin: var(--op-sp-3) 0 0; border: 1px solid var(--op-border); border-radius: var(--op-radius-md); padding: var(--op-sp-2) var(--op-sp-3); background: var(--op-surface); }
.op-frontend .op-cs-title { margin: 0 0 var(--op-sp-1); font-size: 12px; font-weight: 700; color: var(--op-text-muted); }
.op-frontend .op-cs-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.op-frontend .op-cs-table th, .op-frontend .op-cs-table td { padding: 6px 4px; text-align: start; vertical-align: top; border: 0; background: none; }
.op-frontend .op-cs-table thead th { font-size: 12.5px; font-weight: 700; color: var(--op-text); white-space: nowrap; }
.op-frontend .op-cs-table .op-cs-corner { width: 26%; }
.op-frontend .op-cs-table tbody th { font-size: 12.5px; font-weight: 600; color: var(--op-text-muted); }
.op-frontend .op-cs-table .op-cs-now td { font-weight: 700; color: var(--op-text); }
.op-frontend .op-cs-table .op-cs-later { border-top: 1px dashed var(--op-border); }
.op-frontend .op-cs-sub { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 400; color: var(--op-text-muted); }

/* The compact form: two short lines under a collected row. */
.op-frontend .op-cs-compact { font-size: 12.5px; }
.op-frontend .op-cs-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--op-sp-3); margin: 0; }
.op-frontend .op-cs-line + .op-cs-line { margin-top: 2px; }
.op-frontend .op-cs-part { display: inline-flex; align-items: center; gap: 5px; }
.op-frontend .op-cs-part .op-cs-k { color: var(--op-text-muted); }
.op-frontend .op-cs-part .op-cs-amt { font-weight: 700; color: var(--op-text); }
.op-frontend .op-cs-after { color: var(--op-text-muted); gap: 2px 6px; }
.op-frontend .op-cs-after > .op-cs-k { font-weight: 700; }
.op-frontend .op-cs-sep { color: var(--op-text-soft); }
/* One party's figure stays on its line: "Clinic 1,050.00 EGP" never breaks after "Clinic". */
.op-frontend .op-cs-owed { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; }
.op-frontend .op-cs-note { font-size: .92em; font-style: italic; }

/* The collected row's two lines, under the row they belong to. */
.op-frontend .op-instalments .op-instalment-split td { padding-top: 0; padding-bottom: var(--op-sp-2); border-top: 0; white-space: normal; }
.op-frontend .op-instalments tr.op-instalment:has(+ .op-instalment-split) td { border-bottom: 0; }

/* ---- The case's Money step: the plan as it stands now, under the terms ---- */
.op-frontend .op-money-left { font-weight: 600; margin-top: calc(-1 * var(--op-sp-2)); }

/* ---- The case's Money step: the parties side by side ---- */
.op-frontend .op-money-case-split .op-cs-full { margin-top: var(--op-sp-4); }

/* ---- Money › Doctor: the figure after the lab, under the one before ---- */
.op-frontend .op-money-sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--op-text-muted); margin-top: 1px; }

/* ---- Money › Collected: three columns and the line under each payment ---- */
.op-frontend .op-money-collected .op-cs-col { text-align: end; font-variant-numeric: tabular-nums; }
.op-frontend .op-money-collected th.op-cs-col { white-space: nowrap; }
.op-frontend .op-money-collected .op-money-collected-after td { white-space: normal; padding-top: 0; color: var(--op-text-muted); }
.op-frontend .op-money-collected tr:has(+ .op-money-collected-after) td { border-bottom: 0; }

/* ---- A case in another currency (Payment plan, Money) ---- */
.op-frontend .op-currency-note {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--op-sp-2) var(--op-sp-3);
    margin: 0 0 var(--op-sp-3); padding: var(--op-sp-2) var(--op-sp-3);
    border: 1px solid var(--op-warning); border-radius: var(--op-radius-md);
    background: var(--op-warning-bg); color: var(--op-warning-text); font-size: 13.5px;
}
.op-frontend .op-currency-note p { margin: 0; min-width: 0; }
.op-frontend .op-money-mixed { margin-top: var(--op-sp-2); }
/* The Money step of a case holding money collected in another currency. */
.op-frontend .op-money-mixed-case { margin-top: var(--op-sp-3); }

/* ---- The Collect dialog ---- */
.op-collect-modal .op-collect-box { max-width: 560px; padding: var(--op-sp-6); }
.op-frontend .op-collect { min-width: 0; margin: 0; }
.op-frontend .op-collect-done .op-collect-title { color: var(--op-success-text); }
.op-frontend .op-collect-name { font-weight: 600; }
.op-frontend .op-collect-title { margin: 0 0 var(--op-sp-1); display: flex; align-items: center; gap: 8px; }
.op-frontend .op-collect-loading { margin: 0; color: var(--op-text-muted); }
.op-frontend .op-collect-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--op-sp-2); margin: 0 0 var(--op-sp-4); font-size: 14px; }
.op-frontend .op-collect-who { font-weight: 700; }
.op-frontend .op-collect-fields { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--op-sp-3); }
.op-frontend .op-collect-fields .op-field { min-width: 0; }
.op-frontend .op-collect-fields .op-input { width: 100%; }
.op-frontend .op-collect-fields input[name="amount"] { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.op-frontend .op-collect-live { margin-top: var(--op-sp-3); min-height: 24px; }
.op-frontend .op-collect-error { margin: 0; padding: var(--op-sp-2) var(--op-sp-3); border-radius: var(--op-radius-md); background: var(--op-danger-bg, #fdecec); color: var(--op-danger-text, #8a1c1c); font-weight: 600; font-size: 13.5px; }
.op-frontend .op-collect-extra { margin: 0 0 4px; font-weight: 600; font-size: 13.5px; }
.op-frontend .op-collect-changes { list-style: none; margin: 0 0 var(--op-sp-2); padding: 0; font-size: 13.5px; }
.op-frontend .op-collect-changes li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--op-sp-3); padding: 4px 0; border-bottom: 1px dashed var(--op-border); }
.op-frontend .op-collect-changes li.is-removed .op-collect-change-to { color: var(--op-text-muted); }
.op-frontend .op-collect-change-name { font-weight: 600; }
.op-frontend .op-collect-count { margin: 0; font-size: 13px; color: var(--op-text-muted); }
.op-frontend .op-collect-count bdi { white-space: nowrap; }
.op-frontend .op-collect-paid { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--op-sp-2); margin: 0 0 var(--op-sp-3); }
.op-frontend .op-collect-paid-amt { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.op-frontend .op-collect-actions { margin-top: var(--op-sp-4); }
.op-frontend .op-collect-form.is-refused .op-cs-full { display: none; }

/* ---- The doctor's Settings: his currency ---- */
.op-frontend.op-settings-page .op-page-head { flex-wrap: wrap; gap: var(--op-sp-3); }
.op-frontend .op-settings-card { max-width: 860px; }
.op-frontend .op-currency-form { margin: 0; min-width: 0; }
.op-frontend .op-currency-choices { border: 0; margin: 0 0 var(--op-sp-3); padding: 0; min-width: 0; }
.op-frontend .op-currency-choices legend { margin-bottom: var(--op-sp-2); }
.op-frontend .op-currency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--op-sp-2); }
.op-frontend .op-currency-choice {
    position: relative; display: flex; align-items: stretch; min-width: 0;
    border: 1px solid var(--op-border-strong); border-radius: var(--op-radius-md); background: var(--op-surface);
}
.op-frontend .op-currency-choice:has(input:checked) { border-color: var(--op-primary); box-shadow: 0 0 0 1px var(--op-primary); background: var(--op-primary-light); }
.op-frontend .op-currency-pick {
    flex: 1 1 auto; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "radio code" "radio name";
    column-gap: 8px; align-items: center; padding: 8px 10px; min-height: 44px; cursor: pointer; min-width: 0;
}
.op-frontend .op-currency-pick input { grid-area: radio; margin: 0; width: 18px; height: 18px; }
.op-frontend .op-currency-code { grid-area: code; font-weight: 800; letter-spacing: .02em; }
.op-frontend .op-currency-name { grid-area: name; font-size: 12px; color: var(--op-text-muted); overflow-wrap: anywhere; }
.op-frontend .op-currency-remove {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px;
    border: 0; border-inline-start: 1px solid var(--op-border); background: none; color: var(--op-text-muted); cursor: pointer; font-size: 18px;
    border-start-end-radius: var(--op-radius-md); border-end-end-radius: var(--op-radius-md);
}
.op-frontend .op-currency-remove:hover { color: var(--op-danger, #c0392b); background: var(--op-bg-alt); }
.op-frontend .op-currency-add { margin: 0 0 var(--op-sp-3); }
.op-frontend .op-currency-add > summary { list-style: none; display: inline-flex; align-items: center; min-height: 36px; cursor: pointer; }
.op-frontend .op-currency-add > summary::-webkit-details-marker { display: none; }
.op-frontend .op-currency-add[open] > summary { margin-bottom: var(--op-sp-2); }
.op-frontend .op-currency-add .op-field { max-width: 320px; }
.op-frontend .op-currency-apply { display: flex; align-items: flex-start; gap: 10px; min-height: 36px; margin: 0 0 var(--op-sp-2); font-size: 14px; }
.op-frontend .op-currency-apply input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; }
/* Offered only when a case would move; the names it would move under it. */
.op-frontend .op-currency-apply-wrap[hidden] { display: none; }
.op-frontend .op-currency-apply-wrap .op-currency-apply { margin-bottom: 2px; }
.op-frontend .op-currency-apply-names { margin: 0 0 var(--op-sp-3); padding-inline-start: 28px; overflow-wrap: anywhere; }
.op-frontend .op-currency-apply-names bdi:not(:empty)::after { content: " ·"; }
.op-frontend .op-currency-cases { list-style: none; margin: 0; padding: 0; }
.op-frontend .op-currency-case { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--op-sp-2) var(--op-sp-3); padding: var(--op-sp-2) 0; border-bottom: 1px solid var(--op-border); }
.op-frontend .op-currency-case:last-child { border-bottom: 0; }
.op-frontend .op-currency-case-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--op-sp-2); min-width: 0; }
.op-frontend .op-currency-case-who code { font-size: 11.5px; background: none; padding: 0; color: var(--op-text-muted); }
.op-frontend .op-settings-link { white-space: nowrap; }

/* ---- The front desk: what she took today, in three ---- */
.op-frontend .op-desk-collected-head { margin-top: var(--op-sp-4); }
.op-frontend .op-desk-collected .op-desk-collected-item { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.op-frontend .op-desk-collected .op-agenda-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--op-sp-2); }

@media (max-width: 640px) {
    /*
     * An overdue instalment's card: "2026-03-02 · Overdue 8 months" on one
     * line made the first column wider than the card, and the amount and
     * "Collect now" slid past its edge (worst in Arabic). The column may
     * shrink, and the chip goes under the date.
     */
    .op-frontend .op-instalments .op-instalment { grid-template-columns: minmax(0, 1fr) auto; }
    .op-frontend .op-instalments .op-instalment td:first-child { white-space: normal; min-width: 0; }
    .op-frontend .op-instalments .op-instalment td:first-child .op-late { display: flex; width: fit-content; margin-top: 4px; }
    /* One card, one tint: no white cell or rule left over from the table's desktop look. */
    .op-frontend .op-table-wrap .op-instalments tr.op-instalment td { background: transparent; border: 0; box-shadow: none; }
    /* The collected row's lines: a card under the instalment's card. */
    .op-frontend .op-instalments .op-instalment-split { display: block; padding: 0 12px 10px; border-bottom: 1px solid var(--op-border); }
    .op-frontend .op-instalments .op-instalment-split td { display: block; padding: 0; }
    .op-frontend .op-instalments .op-instalment:has(+ .op-instalment-split) { border-bottom: 0; }
    /* Money › Collected as cards: the parties' figures under the payment. */
    .op-frontend .op-money-collected .op-cs-col { text-align: start; }
    .op-frontend .op-money-collected .op-money-collected-after { padding-top: 0; }
    .op-frontend .op-money-collected tr:has(+ .op-money-collected-after) { border-bottom: 0; padding-bottom: var(--op-sp-1); }
    .op-frontend .op-money-collected .op-money-collected-after td { display: block; padding: 0; }
    .op-frontend .op-money-collected tfoot { display: block; }
    .op-frontend .op-money-collected tfoot tr { display: flex; flex-direction: column; padding: var(--op-sp-3) var(--op-sp-4); border-top: 2px solid var(--op-border-strong); }
    .op-frontend .op-money-collected tfoot th,
    .op-frontend .op-money-collected tfoot td { display: grid; grid-template-columns: 34% minmax(0, 1fr); column-gap: var(--op-sp-2); border: 0; padding: 3px 0; white-space: normal; }
    .op-frontend .op-money-collected tfoot td[data-label]::before { content: attr(data-label); font-size: 11.5px; font-weight: 700; color: var(--op-text-muted); }
    /* The dialog: the amount and the method one above the other; the split's labels above its row. */
    .op-collect-modal .op-collect-box { padding: var(--op-sp-4); }
    .op-frontend .op-collect-fields { grid-template-columns: minmax(0, 1fr); }
    .op-frontend .op-cs-table .op-cs-corner { display: none; }
    .op-frontend .op-cs-table thead tr,
    .op-frontend .op-cs-table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 6px; }
    .op-frontend .op-cs-table tbody th { grid-column: 1 / -1; padding-bottom: 0; }
    .op-frontend .op-cs-table th,
    .op-frontend .op-cs-table td { padding: 4px 2px; font-size: 13px; }
    .op-frontend .op-collect-actions .op-btn { flex: 1 1 auto; justify-content: center; }
    .op-frontend .op-currency-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Touch screens: every control this package adds is at least 44 px. */
@media (pointer: coarse) {
    .op-frontend .op-collect-instalment,
    .op-frontend .op-case-currency,
    .op-frontend .op-currency-remove,
    .op-frontend .op-currency-add > summary,
    .op-frontend .op-collect-actions .op-btn,
    .op-frontend .op-collect-fields .op-input,
    .op-frontend .op-settings-link,
    .op-frontend .op-currency-apply { min-height: 44px; }
    .op-frontend .op-currency-remove { min-width: 44px; }
}

/* =============================================================== * fix/clinic18 (17 Nov 2026 call): All clinics as a summary per clinic
 * (C17-MON-01), the doctors who treat at a clinic (C17-CLI-01).
 * Existing tokens only: the summary is a table like the others.
 * ====================================================================== */
.op-frontend .op-money-summary { margin-bottom: var(--op-sp-4); }
.op-frontend .op-money-summary-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--op-sp-2) var(--op-sp-4); }
.op-frontend .op-money-summary-head > :first-child { flex: 1 1 280px; min-width: 0; }
.op-frontend .op-money-print { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
/* Whose and when: on paper only. */
.op-frontend .op-money-summary-paper { display: none; }
.op-frontend .op-money-sum-table tbody.op-money-sum-clinic + tbody.op-money-sum-clinic > tr:first-child > * { border-top: 1px solid var(--op-border-strong); }
.op-frontend .op-money-sum-row > th { text-align: start; font-weight: 700; }
.op-frontend .op-money-sum-name { display: inline-flex; align-items: center; min-height: 32px; color: inherit; font-weight: 700; }
.op-frontend .op-money-sum-name:hover { color: var(--op-primary); }
.op-frontend .op-money-sum-row .op-money-sub,
.op-frontend .op-money-doc-table .op-money-sub { display: block; font-size: 12px; font-weight: 500; color: var(--op-text-muted); white-space: normal; }
.op-frontend .op-money-sum-doc > td { white-space: normal; padding-top: 2px; font-size: 13px; color: var(--op-text-muted); padding-inline-start: var(--op-sp-6, 24px); }
/* A clinic's doctors' line belongs to its block: no rule between them. */
.op-frontend .op-money-sum-table tr.op-money-sum-row:has(+ .op-money-sum-doc) > * { border-bottom: 0; }
.op-frontend .op-money-sum-table tr.op-money-sum-doc > td { border-top: 0; }
.op-frontend .op-money-sum-total > th { text-align: start; font-weight: 700; }
.op-frontend .op-money-sum-labs { margin: var(--op-sp-2) 0 0; }
.op-frontend .op-money-doctors { margin-bottom: var(--op-sp-4); }
.op-frontend .op-money-doc-share { display: inline-flex; flex-direction: column; gap: 2px; }
/* A tablet in portrait reads both tables whole: headings wrap, names wrap, the amounts never do. */
.op-frontend :is(.op-money-sum-table, .op-money-doc-table) thead th { white-space: normal; vertical-align: bottom; }
.op-frontend :is(.op-money-sum-table, .op-money-doc-table) tbody th { white-space: normal; min-width: 7.5em; }
@media (min-width: 641px) and (max-width: 1023px) {
    .op-frontend :is(.op-money-sum-table, .op-money-doc-table) :is(th, td) { padding-inline: 8px; font-size: 13.5px; }
}
.op-frontend .op-money-doc-table th[scope="row"] { text-align: start; }
.op-frontend .op-money-doc-table tr.is-owner th strong { font-weight: 700; }
/* The row's name cell follows its row: the last row has no rule under it (as its cells, public.css), so no line stops after the first column. */
.op-frontend .op-money-doc-table tbody tr:last-child > th[scope="row"] { border-bottom: 0; }
.op-frontend .op-money-doc-former { font-style: italic; }
.op-frontend .op-money-table .op-money-treating { display: flex; width: fit-content; max-width: 100%; margin: 4px 0 0; white-space: normal; overflow-wrap: anywhere; text-align: start; }
.op-frontend .op-split-treating { margin: 4px 0 0; }

@media (max-width: 640px) {
    /* The clinic's name heads its card; the doctors' line under it, full width. */
    .op-frontend .op-money-sum-table tbody.op-money-sum-clinic { border-bottom: 1px solid var(--op-border-strong); }
    .op-frontend .op-money-sum-table tbody.op-money-sum-clinic + tbody.op-money-sum-clinic > tr:first-child > * { border-top: 0; }
    .op-frontend .op-money-sum-table tr.op-money-sum-row { border-bottom: 0; }
    .op-frontend .op-table-cards :is(.op-money-sum-row, .op-money-sum-total, .op-money-doc-table tbody tr) > th { display: block; padding: 0 0 4px; border: 0; white-space: normal; }
    .op-frontend .op-table-cards :is(.op-money-sum-row, .op-money-sum-total, .op-money-doc-table tbody tr) > th[data-label]::before { content: none; }
    .op-frontend .op-money-sum-doc { padding-top: 0; }
    .op-frontend .op-money-sum-doc > td { display: block; padding: 0 0 var(--op-sp-1); }
    .op-frontend .op-money-sum-table tfoot { display: block; }
    .op-frontend .op-money-sum-table tfoot tr { display: flex; flex-direction: column; padding: var(--op-sp-3) var(--op-sp-4); border-top: 2px solid var(--op-border-strong); }
    .op-frontend .op-money-sum-table tfoot td { display: grid; grid-template-columns: 34% minmax(0, 1fr); column-gap: var(--op-sp-2); border: 0; padding: 3px 0; white-space: normal; }
    .op-frontend .op-money-sum-table tfoot td[data-label]::before { content: attr(data-label); font-size: 11.5px; font-weight: 700; color: var(--op-text-muted); }
    .op-frontend .op-table-cards.op-money-sum-table td,
    .op-frontend .op-table-cards.op-money-doc-table td { white-space: normal; }
}

@media (pointer: coarse) {
    .op-frontend .op-money-print,
    .op-frontend .op-money-sum-name { min-height: 44px; }
}

/* Print: the summary, and nothing else on the page — wherever the theme puts it.
   Taken out of the flow, not only hidden: a hidden page still fills the paper
   (a long Money page printed blank pages after the table). op-money.js marks
   the summary's ancestors .op-print-path, so only that path stays. */
@media print {
    html.op-printing-summary body :not(.op-print-path, .op-money-summary, .op-money-summary *, .op-print-target, .op-print-target *) { display: none !important; }
    /* fix/money24 (M24-53): a lab's month statement, alone on the paper. */
    html.op-printing-summary .op-money-statement.op-print-target { display: block !important; }
    html.op-printing-summary .op-print-target .op-table { width: 100%; font-size: 11pt; }
    html.op-printing-summary .op-print-path { margin: 0 !important; padding: 0 !important; border: 0 !important; min-height: 0 !important; box-shadow: none !important; }
    html.op-printing-summary .op-money-summary {
        width: 100%; margin: 0; border: 0; box-shadow: none; padding: 0; background: var(--op-surface);
    }
    html.op-printing-summary .op-money-print { display: none !important; }
    html.op-printing-summary .op-money-summary-paper { display: block; margin: 0 0 8px; font-weight: 700; }
    html.op-printing-summary .op-money-summary .op-table-wrap { overflow: visible; }
    html.op-printing-summary .op-money-sum-table { width: 100%; font-size: 11pt; }
    html.op-printing-summary .op-money-sum-name { color: var(--op-text); text-decoration: none; min-height: 0; }
    html.op-printing-summary .op-money-sum-table tbody { break-inside: avoid; }
}
/* fix/files18 (W22-08): Money's tabs in two headed groups (the calm look's own
   rules are in op-zz-design.css, "fix/files18"). */
.op-frontend .op-money-tabgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--op-sp-3); }
.op-frontend .op-money-tabgroup-name { font-size: 12px; font-weight: 600; color: var(--op-text-muted); }

/* ---- fix/money-ar (25 Nov 2026): the Money module's own language ----
 * «عربي / English»: a small two-word switch in the Money screen's head and
 * on the case's Money step. Each word in its own language; the one in use is
 * the chosen one (the brand tint, as a pressed chip). 44 px touch targets.
 * The tokens are the design layer's (op-zz-design.css), with the old
 * look's as the fallback; no new hue.
 */
.op-frontend .op-money-root { min-width: 0; }
.op-frontend .op-money-head-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--op-sp-2); }
.op-frontend .op-money-step-head { display: flex; justify-content: flex-end; margin: 0 0 var(--op-sp-3); }
.op-frontend .op-money-lang { display: inline-flex; margin: 0; }
.op-frontend .op-money-lang-choices {
    display: inline-flex; align-items: stretch; overflow: hidden;
    border: 1px solid var(--ds-line-strong, var(--op-border-strong, #c9d1d6));
    border-radius: var(--ds-r-md, 8px); background: var(--ds-surface, var(--op-surface, #fff));
}
.op-frontend .op-money-lang-btn {
    min-height: 44px; min-width: 64px; margin: 0; padding: 0 var(--op-sp-3);
    border: 0; border-radius: 0; background: transparent; cursor: pointer;
    font: 500 var(--ds-fs-sm, 14px)/1 var(--ds-font, inherit); color: var(--ds-ink-2, var(--op-text-muted));
}
.op-frontend .op-money-lang-btn + .op-money-lang-btn { border-inline-start: 1px solid var(--ds-line-strong, var(--op-border-strong, #c9d1d6)); }
.op-frontend .op-money-lang-btn:hover { background: var(--ds-n-50, var(--op-bg-alt)); color: var(--ds-ink, var(--op-text)); }
.op-frontend .op-money-lang-btn.is-active {
    background: var(--ds-brand-50, var(--op-primary-light)); color: var(--ds-brand-700, var(--op-primary-dark)); font-weight: 600; cursor: default;
}
.op-frontend .op-money-lang-btn:focus-visible { outline: 2px solid var(--ds-focus, var(--op-primary-dark)); outline-offset: -2px; }
@media (max-width: 480px) {
    .op-frontend .op-money-head-acts { inline-size: 100%; justify-content: space-between; }
}

/* ------------------------------------------------------------------
 * fix/money24 (M24-53 … M24-59): Money › Lab, one account per lab — each
 * order green (paid) or red (not paid), its label kept beside the colour
 * for paper and for colour-blind eyes (apart from the delivery colours of
 * the Lab step); the filters; the patient groups; the month's statement
 * (paper only); the Expenses tab; the Doctor summary; the patient search.
 * ------------------------------------------------------------------ */
.op-frontend .op-money-lab-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ds-sp-3); margin: var(--ds-sp-3) 0; }
.op-frontend .op-money-lab-show { margin: 0; }
.op-frontend .op-money-lab-show .op-chip { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.op-frontend .op-money-lab-narrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ds-sp-2); margin: 0; }
.op-frontend .op-money-lab-narrow label { display: flex; flex-direction: column; gap: 2px; font-size: var(--ds-fs-sm); color: var(--ds-ink-2); min-width: 0; }
.op-frontend .op-money-lab-narrow .op-input { min-height: 44px; max-width: 100%; }
.op-frontend .op-money-lab-narrow .op-btn,
.op-frontend .op-money-lab-tools .op-money-print { min-height: 44px; }
.op-frontend .op-money-lab-shown { font-size: var(--ds-fs-sm); color: var(--ds-ink-2); margin: 0 0 var(--ds-sp-2); }
.op-frontend .op-money-lab-credit strong { color: var(--ds-success-text); }
.op-frontend .op-money-lab-row.is-paid > td { background: var(--ds-success-wash); }
.op-frontend .op-money-lab-row.is-unpaid > td { background: var(--ds-danger-wash); }
.op-frontend .op-money-lab-row.is-paid > td:first-child { border-inline-start: 3px solid var(--ds-success-line); }
.op-frontend .op-money-lab-row.is-unpaid > td:first-child { border-inline-start: 3px solid var(--ds-danger-line); }
.op-frontend .op-money-paidmark { font-weight: var(--ds-fw-semibold); }
.op-frontend .op-money-paidmark.is-paid { color: var(--ds-success-text); }
.op-frontend .op-money-paidmark.is-not_paid,
.op-frontend .op-money-paidmark.is-part { color: var(--ds-danger-text); }
.op-frontend .op-money-lab-ghead th { background: var(--ds-sunken); padding: 0; }
.op-frontend .op-money-lab-gtoggle {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--ds-sp-3); width: 100%; min-height: 44px;
    padding: var(--ds-sp-2) var(--ds-sp-3); border: 0; background: transparent; color: var(--ds-ink); font: inherit; text-align: start; cursor: pointer;
}
.op-frontend .op-money-lab-subtotal { margin-inline-start: auto; font-weight: var(--ds-fw-semibold); }
.op-frontend .op-money-lab-group.is-folded > tr:not(.op-money-lab-ghead) { display: none; }
.op-frontend .op-money-statement { display: none; }
.op-frontend .op-money-lab-history .op-money-sub { flex-basis: 100%; }
/* fix/money24 review (M24-56 at 390 px): the stacked orders table wraps its text — the Appliance
   («MARPE — Expansion appliance») and the patient's name and file no. were cut off at 390 and 360. */
@media (max-width: 640px) {
    .op-frontend .op-table-cards.op-money-orders td { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
    .op-frontend .op-table-cards.op-money-orders td > *,
    .op-frontend .op-table-cards.op-money-orders .op-money-who { min-width: 0; max-width: 100%; }
}
@media (max-width: 600px) {
    .op-frontend .op-money-lab-narrow { width: 100%; }
    .op-frontend .op-money-lab-narrow label { flex: 1 1 140px; }
    .op-frontend .op-money-lab-row.is-paid { border-inline-start: 3px solid var(--ds-success-line); background: var(--ds-success-wash); }
    .op-frontend .op-money-lab-row.is-unpaid { border-inline-start: 3px solid var(--ds-danger-line); background: var(--ds-danger-wash); }
}
@media print {
    .op-frontend .op-money-lab-row.is-paid > td,
    .op-frontend .op-money-lab-row.is-unpaid > td { background: none; }
}
.op-frontend .op-money-search { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-sp-2); margin: var(--ds-sp-3) 0; }
.op-frontend .op-money-search-field { flex: 1 1 260px; min-width: 0; margin: 0; }
.op-frontend .op-money-search-field .op-input { width: 100%; min-height: 44px; }
.op-frontend .op-money-search .op-btn { min-height: 44px; }
.op-frontend .op-money-tab-figs { margin: var(--ds-sp-3) 0; }
.op-frontend .op-money-net { font-size: var(--ds-fs-sm); color: var(--ds-ink-2); margin: 0 0 var(--ds-sp-3); }
.op-frontend .op-money-net strong { color: var(--ds-ink); }
.op-frontend .op-money-expenses .op-money-lab-narrow { margin: var(--ds-sp-3) 0; }
.op-frontend .op-expense-form { margin-top: var(--ds-sp-4); }
.op-frontend .op-expense-form input,
.op-frontend .op-expense-form select { min-height: 44px; }

/* fix/money24 (M24-06): the Payment plan card heads with the Money switch at its corner. */
.op-frontend .op-ci-payment-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--ds-sp-2) var(--ds-sp-3); }
.op-frontend .op-ci-payment-head > :first-child { flex: 1 1 240px; min-width: 0; }

/* fix/money24: the small pieces named for the checks and the paper. */
.op-frontend .op-ci-payment { position: relative; }
.op-frontend .op-money-adjust-what,
.op-frontend .op-money-adjust-left { margin: var(--ds-sp-2) 0; }
.op-frontend .op-money-adjust-left { font-weight: var(--ds-fw-semibold); }
.op-frontend .op-money-adjust-preview ol { margin: 0; padding-inline-start: var(--ds-sp-5); }
.op-frontend .op-money-expense-table td { vertical-align: top; }
.op-frontend .op-money-lab-month .op-input,
.op-frontend .op-money-lab-patient .op-input { min-width: 0; }
.op-frontend .op-money-lab-patient { max-width: 100%; }
.op-money-lang-form { display: none; }

/* fix/money24: 44 px touch targets on the two forms of the Lab and Expenses tabs. */
.op-frontend .op-money-panel .op-expense-form :is(input, select, .op-btn),
.op-frontend .op-money-panel .op-lab-pay-form :is(input, select, .op-btn) { min-height: 44px; }
