/* S3 clinic fixes (ClinicS3). Logical properties only; tokens come from base.css. */

/* F20: English name fields stay LTR inside an Arabic dialog. */
#stage-en, #label-en { direction: ltr; text-align: start; }

/* F29: medical alert chips wrap on the phone instead of being cut at the screen edge. */
:root[data-device="phone"] .md-appt .md-sub { white-space: normal; flex-wrap: wrap; overflow: visible; }
:root[data-device="phone"] .md-appt .alert-inline { white-space: normal; }
@media (max-width: 639px) {
  .md-appt .md-sub { white-space: normal; flex-wrap: wrap; overflow: visible; }
}

/* Payment cap and patient credit (F23). */
.pay-cap:empty { display: none; }
.pay-cap { display: flex; flex-direction: column; gap: var(--sp-1-5); }

/* Multi-drug prescription editor (F4). */
.fd-rx [hidden] { display: none !important; }
.rx-form { display: flex; flex-direction: column; gap: var(--sp-2); }
.rx-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.rx-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; gap: var(--sp-1-5); align-items: end; }
.rx-row label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--ink-2); min-inline-size: 0; }
.rx-row .rx-row-warn { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--danger); }
.rx-row .input[aria-invalid="true"] { border-color: var(--danger); }
.rx-form .wide-field { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--ink-2); }
.rx-form [data-rx-add] { align-self: flex-start; }
.rx-alerts { display: flex; align-items: center; gap: var(--sp-1); color: var(--danger); font-size: var(--fs-sm); margin-block-end: var(--sp-2); }
:root[data-device="phone"] .rx-row { grid-template-columns: 1fr 1fr; }
:root[data-device="phone"] .rx-row .rx-drug { grid-column: 1 / -1; }

/* Hub prescriptions list and external mentions. */
.rx-hub-row { display: flex; align-items: center; gap: var(--sp-2); }
.mention-ext { color: var(--ink-2); }

/* R6: warnings (day off), drag to move (N1), read-only lab cost, money forms. */
.banner.warn { background: var(--attention-soft); color: var(--attn); border: 1px solid var(--attention-line); }
.bk-warn:empty, .rs-msg:empty, .mo-msg:empty { display: none; }
.rs-note { font-size: var(--fs-xs); margin-block-start: var(--sp-2); }
.wk-col .appt { touch-action: none; }
.wk-col .appt.dragging { z-index: 5; box-shadow: var(--shadow-pop); opacity: .92; cursor: grabbing; }
.wk-col .appt.drop-bad { outline: 2px solid var(--danger); }
.wk-col .appt.drop-warn { outline: 2px dashed var(--attn); }
.chip.lab-cost { font-variant-numeric: tabular-nums; }
.mo-form { display: flex; flex-direction: column; gap: var(--sp-2-5); }
.mo-form .input[aria-invalid="true"] { border-color: var(--danger); }
.mo-btns { display: inline-flex; gap: var(--sp-1); }

/* N7: Accounts on the phone. Tabs wrap (nothing hidden off screen); table rows become labelled cards. */
:root[data-device="phone"] .mo-tabs { flex-wrap: wrap; overflow: visible; row-gap: var(--sp-1); }
:root[data-device="phone"] .mo-tab-sep { display: none; }
:root[data-device="phone"] .mo-tr:not(.mo-th) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-inline-size: 0; gap: var(--sp-1-5) var(--sp-3); padding-block: var(--sp-2-5); align-items: start; }
:root[data-device="phone"] .mo-tr > * { white-space: normal; overflow: visible; text-overflow: clip; }
:root[data-device="phone"] .mo-tr > :first-child { grid-column: 1 / -1; }
:root[data-device="phone"] .mo-tr > [data-k]::before { content: attr(data-k); display: block; font-size: var(--fs-2xs); color: var(--ink-3); font-weight: 400; }
:root[data-device="phone"] .mo-tr .amt { text-align: start; }

/* N12: on the phone the toast sits above the bottom bar and never takes a tap meant for Create. */
:root[data-device="phone"] .toast { inset-block-end: calc(72px + env(safe-area-inset-bottom)); pointer-events: none; }
