/* FCMS Module 4 — pharmacy pages. Builds on /design-system/tokens.css + /journey/static/journey.css: colours only
   through their variables (no raw colours here). */

/* sub-navigation between /pharmacy and /pharmacy/prescriptions */
.ph-subnav { display: inline-flex; border: 1.5px solid var(--border-strong); border-radius: 999px; overflow: hidden; background: var(--white); }
.ph-subnav a { padding: 8px 16px; font-weight: 700; font-size: 14px; color: var(--dept-deep); white-space: nowrap; }
.ph-subnav a.on { background: var(--dept-deep); color: var(--white); }

/* bands: allergies, warnings, notes */
.ph-band { border-radius: 6px; padding: 10px 14px; font-size: 15px; margin: 8px 0; border-left: 4px solid transparent; }
.ph-band.danger { background: var(--pill-danger-bg); color: var(--pill-danger-ink); border-left-color: var(--ruby); }
.ph-band.warn { background: var(--pill-warn-bg); color: var(--pill-warn-ink); border-left-color: var(--gold); }
.ph-band.info { background: var(--pill-info-bg); color: var(--pill-info-ink); border-left-color: var(--sapphire); }
.ph-band.ok { background: var(--pill-ok-bg); color: var(--pill-ok-ink); border-left-color: var(--emerald); }
.ph-band.muted-band { background: var(--sand); color: var(--ink-soft); border-left-color: var(--border-warm); }

/* status chips (filters) */
.ph-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ph-chips button { border: 1.5px solid var(--border-strong); background: var(--white); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--dept-deep); }
.ph-chips button.on { background: var(--dept-deep); color: var(--white); border-color: var(--dept-deep); }
.ph-chips button .n { display: inline-block; min-width: 20px; margin-left: 6px; border-radius: 999px; padding: 0 6px; background: var(--sand-deep); color: var(--ink); font-size: 12.5px; }
.ph-chips button.on .n { background: var(--on-dark-hover); color: var(--white); }

/* tables: scroll sideways inside their card on narrow screens (10-inch tablet portrait) */
.ph-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ph-scroll table.t { min-width: 900px; }
.ph-scroll .pill, .ph-scroll td.qty, .ph-scroll .btn { white-space: nowrap; }
.modal .ph-scroll table.t { min-width: 760px; }
table.t td.qty, table.t th.qty { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.dim td { opacity: .55; }
table.t tr.sel td { background: var(--sapphire-muted); }
.ph-sub { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.ph-th { font-size: 14px; color: var(--ink-soft); }
.ph-num { font-variant-numeric: tabular-nums; }
.ph-neg { color: var(--ruby-dark); font-weight: 700; }
.ph-pos { color: var(--emerald-dark); font-weight: 700; }

.nowrap { white-space: nowrap; }
.grid > .card + .card { margin-top: 0; }          /* cards side by side in a grid line up (journey.css spaces stacked cards) */

/* extra pill tones */
.pill.due { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.pill.sm { padding: 3px 9px; font-size: 12.5px; }

/* search dropdown under an input */
.ph-search { position: relative; }
.ph-chosen { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1.5px solid var(--border-strong); border-radius: 6px; padding: 7px 10px; background: var(--cream-deep); min-height: 42px; }
.ph-chosen b { flex: 1; }
.ph-drop { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--white); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow-lg); max-height: 340px; overflow: auto; margin-top: 4px; }
.ph-drop button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border-soft); background: var(--white); padding: 10px 12px; cursor: pointer; font-size: 15px; color: var(--ink-body); }
.ph-drop button:hover, .ph-drop button:focus { background: var(--sapphire-muted); outline: none; }

/* prescription writer lines */
.ph-line { border: 1px solid var(--border-soft); border-radius: 6px; padding: 12px 14px; margin-top: 12px; background: var(--cream-deep); }
.ph-line.review { border-color: var(--gold); box-shadow: 0 0 0 2px var(--pill-warn-bg); }
.ph-line.allergy { border-color: var(--ruby); }
.ph-line .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ph-line .no { font-weight: 700; color: var(--ruby); width: 22px; text-align: center; }
.ph-line .name { font-weight: 700; flex: 1; min-width: 200px; }
.ph-calc { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; }
.ph-chip-btn { border: 1px dashed var(--border-strong); background: var(--white); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); }
.ph-chip-btn:hover { border-color: var(--dept); color: var(--dept-deep); }
.ph-chip-btn.on { border-style: solid; border-color: var(--dept); background: var(--dept); color: var(--white); }

/* dispense dialog */
.ph-disp-line { border: 1px solid var(--border-soft); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
.ph-lotgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 90px 90px 110px; gap: 6px 10px; align-items: center; font-size: 14.5px; margin-top: 8px; }
.ph-lotgrid .h { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.ph-lotgrid input { width: 100%; }
@media (max-width: 760px) { .ph-lotgrid { grid-template-columns: 1fr 1fr 70px 70px 90px; font-size: 13px; } }

/* A4 prescription — on screen a sheet, in print the only thing printed. Every class is rx-* (journey.css owns .sig, .center …).
   The sheet is a column: the prescriber / signature block sits at the bottom of a short prescription and simply follows
   the lines of a long one (it never overlaps them). */
.rx-sheet { width: 210mm; min-height: 296mm; background: var(--white); padding: 18mm 20mm 12mm; color: var(--gray-900); box-shadow: var(--shadow-lg);
  margin: 0 auto; display: flex; flex-direction: column; }
.rx-head { text-align: center; }
.rx-logo { width: 22mm; height: 22mm; object-fit: contain; }
.rx-clinic { font-weight: 700; font-size: 15pt; margin-top: 2mm; }
.rx-small { font-size: 9pt; color: var(--gray-500); margin-top: 1.2mm; }
.rx-rule { border-top: 1.5pt solid var(--ruby); margin-top: 5mm; }
.rx-thin { border-top: .6pt solid var(--gray-200); margin-top: 6mm; }
.rx-title { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6mm; gap: 8mm; flex-wrap: wrap; }
.rx-title b { font-size: 17pt; font-weight: 700; }
.rx-meta { font-size: 10pt; color: var(--gray-500); text-align: right; }
.rx-pt { display: grid; grid-template-columns: 15% 35% 26% 24%; margin-top: 5mm; gap: 2mm; }
.rx-lbl { font-size: 8.5pt; color: var(--gray-400); letter-spacing: .02em; text-transform: uppercase; }
.rx-val { font-weight: 600; font-size: 10.5pt; margin-top: 1.4mm; }
.rx-val .rx-th { font-weight: 400; }
.rx-dx { font-size: 10.5pt; margin-top: 1.4mm; }
.rx-mark { font-weight: 700; font-size: 26pt; color: var(--ruby); margin: 5mm 0 3mm; line-height: 1; }
.rx-table { width: 100%; border-collapse: collapse; }
.rx-table th { font-weight: 600; font-size: 8.5pt; color: var(--gray-500); background: var(--gray-50); padding: 2.4mm 3mm; text-align: left; border-top: .6pt solid var(--gray-200); letter-spacing: .03em; }
.rx-table th.rx-q, .rx-table td.rx-q { width: 46mm; text-align: center; border-left: .6pt solid var(--gray-200); }
.rx-table td { border-bottom: .6pt solid var(--gray-200); padding: 3.5mm 3mm; vertical-align: middle; }
.rx-table tr { page-break-inside: avoid; break-inside: avoid; }
.rx-drug { font-weight: 600; font-size: 12pt; }
.rx-gen { font-size: 9.5pt; color: var(--gray-500); margin: 1.2mm 0 0 6mm; }
.rx-sig { font-size: 10.5pt; margin: 1.6mm 0 0 6mm; }
.rx-sigth { font-size: 10.5pt; color: var(--gray-700); margin: 1mm 0 0 6mm; }
.rx-qn { font-weight: 700; font-size: 13pt; }
.rx-notes { font-size: 9.5pt; color: var(--gray-700); margin-top: 6mm; }
.rx-foot { margin-top: auto; padding-top: 12mm; page-break-inside: avoid; break-inside: avoid; }
.rx-foot-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; margin-top: 9mm; }
.rx-sigline { width: 66mm; text-align: center; }
.rx-sigline .rx-line { border-bottom: .8pt solid var(--gray-900); height: 12mm; margin-bottom: 1.6mm; }
.rx-valid { text-align: center; font-size: 8pt; color: var(--gray-400); margin-top: 8mm; }
.ph-sheet-wrap { overflow-x: auto; padding: 6px 0 20px; }
/* a cancelled prescription and every copy say so on the sheet itself (watermark + state box + footer) */
.rx-sheet { position: relative; }
.rx-watermark { position: absolute; left: 0; right: 0; top: 34%; display: flex; flex-direction: column; align-items: center; transform: rotate(-28deg);
  font-weight: 700; font-size: 60pt; line-height: 1.15; letter-spacing: .06em; color: var(--gray-400); opacity: .22; pointer-events: none;
  white-space: nowrap; z-index: 0; }
.rx-cancelled .rx-watermark { color: var(--ruby); opacity: .2; }
.rx-sheet > *:not(.rx-watermark) { position: relative; z-index: 1; }
.rx-state { margin-top: 4mm; padding: 2.6mm 3.4mm; border: 1pt solid var(--gray-400); border-radius: 1.5mm; font-size: 10pt; color: var(--gray-700); }
.rx-state b { display: block; font-size: 11pt; color: var(--gray-900); margin-bottom: 1mm; }
.rx-state.cancelled { border: 1.5pt solid var(--ruby); }
.rx-state.cancelled b { color: var(--ruby); }
.rx-valid.strong { font-size: 10pt; font-weight: 700; color: var(--gray-900); }
.rx-cancelled .rx-valid.strong { color: var(--ruby); }

.print-area { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: var(--white); margin: 0; padding: 0; }
  .shell, .toast, .modal-bg, .no-print { display: none !important; }
  .print-area { display: block; }
  .print-area .rx-sheet { box-shadow: none; margin: 0; }
}

/* the large patient banner (journey-shared PatientBanner, Dr. Pat 26 Oct 2026) inside a pharmacy dialog: it stays at the top
   of the dialog's own scroll (the page's sticky offset is for the global bar) */
.modal .ptb { top: -22px; margin-top: 4px; }
html.touch .modal .ptb { top: -24px; }
.ptb-chip.ph-no-allergy { font-size: 16px; font-weight: 600; color: var(--ink-soft); border-style: dashed; }
/* a single-dose drug (regimen single_dose — Elonva "1 syringe last for 7 days") */
.tag.ph-single { text-transform: none; letter-spacing: .02em; font-size: 13px; }
.ph-single-info { font-size: 15px; color: var(--dept-deep); }

/* 10-inch tablet portrait: a narrower sidebar leaves room for the work area */
@media (max-width: 900px) and (min-width: 761px) {
  .sidebar { width: 196px; padding: 18px 12px; }
  .sidebar nav a { font-size: 14.5px; padding: 9px 10px; }
  .main { padding: 20px 16px 60px; }
}
