/* ---------- Dr Shah 06-Nov-2026 (Slack): History taking, Examination, Treatment plan & Advice each get a page of their own inside the Prescription tab.
   rxsub.js sets #tab-rx[data-sub] = h | e | p; the DOM (ids, order, data-f fields) is unchanged, so save / print / drafts read every page. ---------- */
.rxsubbar { display: flex; gap: 6px; margin: 0 0 10px; padding: 6px 0; }
.rxsubbar button { flex: 1 1 0; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line); border-bottom: 3px solid transparent; border-radius: 10px 10px 4px 4px; background: var(--card); color: #0b3d4f; font-size: 15px; font-weight: 600; cursor: pointer; }
.rxsubbar button[aria-selected="true"] { background: #e8f4f8; border-bottom-color: #0b5d73; color: #0b5d73; }
.rxsubbar button.rxall { flex: 0 0 auto; font-weight: 500; font-size: 13px; color: #475569; }
.rxsubbar button .rxdot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #1b9e5a; vertical-align: middle; }
.rxsubbar button .rxdot[hidden] { display: none; }
#work:not(.mode-simple) #tab-rx[data-sub="h"] .rxp-e, #work:not(.mode-simple) #tab-rx[data-sub="h"] .rxp-p,
#work:not(.mode-simple) #tab-rx[data-sub="e"] .rxp-h, #work:not(.mode-simple) #tab-rx[data-sub="e"] .rxp-p,
#work:not(.mode-simple) #tab-rx[data-sub="p"] .rxp-h, #work:not(.mode-simple) #tab-rx[data-sub="p"] .rxp-e, #work:not(.mode-simple) #tab-rx[data-sub="p"] .rxp-hx { display: none !important; }
#work:not(.mode-simple) #tab-rx[data-sub="h"] #advgrp > .agrph, #work:not(.mode-simple) #tab-rx[data-sub="h"] #advgrp > .sec,
#work:not(.mode-simple) #tab-rx[data-sub="e"] #advgrp > .agrph, #work:not(.mode-simple) #tab-rx[data-sub="e"] #advgrp > .sec { display: none !important; }   /* 12-Nov-2026: Simple shows its four boxes on one page, whatever page was open */   /* the right column keeps Checks + Suggestions on every page */

.rxstep { display: flex; flex-wrap: wrap; justify-content: flex-start; padding-right: 150px; align-items: center; gap: 8px; margin: 14px 0 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.rxstep[hidden] { display: none; }
.rxstep button { min-height: 44px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: #0b5d73; font-size: 15px; font-weight: 600; cursor: pointer; }
.rxstep button.rxnext { background: #0b5d73; border-color: #0b5d73; color: #fff; }
.rxstep .rxstepn { font-size: 13px; color: #475569; }

/* ---------- 11-Nov-2026: the one letterhead (Dr Harsh J Shah, Jivraj Mehta) — moved here from app.css (core gate: l1-only styles live in the module's css) ---------- */
.sheet { background: #fff url(letterhead_jmh.jpg) top left / 210mm 297mm no-repeat; }
.content .date { text-align: right; padding: 0; font-size: 9pt; }               /* the JMH paper has no pre-printed "Date:" line: the date prints at top right */
.content .date .dlbl { display: inline; font-weight: 400; color: var(--mute); }
.content .handouts.only { padding-top: 0; }                                      /* page 1 already starts below the header */
@media screen {
  .lh-jmh .pages .pg.lh { background: #fff url(letterhead_jmh.jpg) top left / 210mm 297mm no-repeat; }   /* pre-printed paper: shown as a guide on screen only */
}
@media print {
  body.lh-jmhhf .flow { display: none !important; }   /* with header & footer: the paged sheets (letterhead drawn in on every page) are what prints */
  body.pdf .pages, body.lh-jmhhf .pages { display: block !important; }
  body.lh-jmhhf .pages .pg { position: relative; width: 210mm; height: 297mm; margin: 0; overflow: hidden; break-after: page; }
  body.lh-jmhhf .pages .pg:last-child { break-after: auto; }
  body.lh-jmhhf .pages .pgend, body.lh-jmhhf .pages .pgtag { display: none; }
}

/* ---------- 12-Nov-2026 Rx core overhaul phase 1 (app.js RxCore): box chrome, Simple | Full, the hidden-but-printing guard ---------- */
.rxmode { display: inline-flex; margin: 8px 0 4px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.rxmode button { min-height: 44px; min-width: 88px; padding: 6px 16px; border: 0; background: transparent; color: #0b3d4f; font-size: 15px; font-weight: 600; cursor: pointer; }
.rxmode button + button { border-left: 1px solid var(--line); }
.rxmode button[aria-pressed="true"] { background: #0b5d73; color: #fff; }
.sech .bxc { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.sech > .sechact > select { flex-shrink: 0; } #setpick { min-width: 172px; }   /* the box buttons never squeeze a header picker (Load a saved set…) below its text — UX-21 */
.sech .bxc button { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #0b3d4f; font-size: 18px; line-height: 1; cursor: pointer; }
.sech .bxc .bxclear { color: #8a1c12; }
.sech .bxc .proftag[hidden] { display: none; }
.sech .bxc .bxclear[hidden] { display: inline-block !important; visibility: hidden; }   /* an empty box keeps the ✕'s place: typing the first letter never moves the header (UX: nothing jumps) */
.sech .bxc .proftag { font-size: 12px; font-weight: 600; color: #7a4b00; background: #fff4dc; border-radius: 8px; padding: 2px 8px; }
#work .sec.proff { border-style: dashed; border-top-style: dashed; }
#work .sec.proff .bxprint { color: #64748B; text-decoration: line-through; filter: grayscale(1); background: #f1f5f9; }
.bxundo { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-radius: 12px; background: #1d2b36; color: #fff; font-size: 14px; box-shadow: 0 4px 16px #0004; }
.bxundo[hidden] { display: none; }
.bxundo button { min-height: 44px; min-width: 64px; border: 0; border-radius: 9px; background: #fff; color: #0b5d73; font-weight: 700; cursor: pointer; }
/* chips inside the box, always shown (the right-hand panel no longer hides them); the first 8, then "+N more" */
@media (min-width: 1025px) { #work #tab-rx .sec .pchips:not(:empty) { display: flex !important; } }
.pchips:not(.pall) .pxtra { display: none !important; }
.pchips .pmore { font-weight: 600; border-style: dashed; }
/* Simple: the patient band and the four boxes; nothing is removed from the page, so every field still saves, drafts and prints */
#work.mode-simple .encrail, #work.mode-simple #sugpanel, #work.mode-simple #rxsubbar, #work.mode-simple #rxstep, #work.mode-simple .xext,
#work.mode-simple .s-hide, #work.mode-simple .s-opt:not(.sfill), #work.mode-simple .exhint,
#work.mode-simple .sec[data-sec="visit"]:not(.sshow), #work.mode-simple #rxcharts:not(.sshow),
#work.mode-simple #rxinf, #work.mode-simple #reqmiss, #work.mode-simple .rxorg label:has(#lifecycle), #work.mode-simple .rxorg label:has(#consult),
#work.mode-simple .sec[data-sec="surgery"]:not(.sshow), #work.mode-simple .sec[data-sec="protocol"]:not(.sshow), #work.mode-simple .sec[data-sec="explain"]:not(.sshow),
#work.mode-simple .sec[data-sec="private"]:not(.sshow) { display: none !important; }
@media (min-width: 1025px) { #work.mode-simple .formcol { margin-right: 0; } #work.mode-simple #gpechips { display: flex !important; } }
.rxalso { margin: 12px 0 0; padding: 8px 12px; border: 1px solid #f0c36d; border-left: 4px solid #d99a1e; border-radius: 10px; background: #fff8e8; color: #4a3500; font-size: 14px; line-height: 1.9; }
.rxalso[hidden], #work.mode-full .rxalso { display: none; }
.rxalso .linkbtn { min-height: 44px; padding: 0 6px; }
/* >= 1280 px: Simple hides the left rail, so the form takes the whole width (the 250 px rail column would squeeze it — UX-34 diagnosis full width) */
@media (min-width: 1280px) { body.haspt #work.mode-simple:not([hidden]) { grid-template-columns: minmax(0, 1fr); } }
/* 12-Nov-2026 corrections: Simple's own comorbidity list, under the row (the right-hand panel is hidden in Simple) */
#comoinline { margin: 8px 0 4px; padding: 8px 10px; border: 1px solid #d9c8f2; border-radius: 10px; background: #faf7ff; }
#comoinline[hidden], #work:not(.mode-simple) #comoinline { display: none !important; }
#comoinline .sugstrip { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
#comoinline .chip, #comoinline .btn { min-height: 44px; }
@media print { #comoinline { display: none !important; } }
@media print { .bxc, .rxmode, .rxalso, .bxundo { display: none !important; } }

/* Rx core overhaul phase 2 (12-Nov-2026): the "After saving" connections sheet — a panel by the save bar; 44 px targets; phone 360 px */
.rxconn { position: fixed; right: 12px; bottom: 76px; z-index: 60; width: 360px; max-width: calc(100vw - 24px); box-sizing: border-box; padding: 10px 12px; border-radius: 12px; background: #fff; color: #1d2b36; border: 1px solid #c9d2da; box-shadow: 0 4px 16px #0003; font-size: 14px; }
.rxconn[hidden] { display: none; }
.rxconn ul { list-style: none; margin: 6px 0; padding: 0; }
.rxconn li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.rxconn .rxc-l { display: flex; align-items: center; gap: 8px; flex: 1; min-height: 44px; cursor: pointer; }
.rxconn .rxc-l input { width: 22px; height: 22px; flex: none; }
.rxconn .rxc-h { display: flex; align-items: center; gap: 8px; }
.rxconn .rxc-h b { flex: none; }
.rxconn .rxc-x, .rxconn .rxc-i { min-width: 44px; min-height: 44px; border: 0; background: none; cursor: pointer; font-size: 16px; }
.rxconn .rxc-i { margin-left: auto; font-style: italic; font-weight: 700; color: #0b5d73; }
.rxconn .rxc-send { width: 100%; min-height: 44px; }
.rxconn .linkbtn { min-height: 44px; padding: 0 6px; }
.rxconn .rxc-ok { color: #0d7a71; font-weight: 700; }
.rxconn .rxc-bad { color: #b3261e; font-weight: 700; }
@media print { .rxconn { display: none !important; } }
/* Phase 3 (Dr Shah 12-Nov-2026, research D): Full, leaner — one entry path per thing; every field still saves and prints as before.
   Complaints: one box (#cnote); the symptom rows fold behind "+ Add symptom rows" unless they hold something. */
.sxopen { display: none; }
#work.mode-full #sxbox:not(.sxon) #sxrows, #work.mode-full #sxbox:not(.sxon) #sxadd { display: none; }
#work.mode-full #sxbox:not(.sxon) .sxopen { display: inline-flex; min-height: 44px; }
/* HPI and "Additional history notes" duplicate the complaints box: shown only when an earlier visit filled them (so what prints is visible) */
#work.mode-full .xcard[data-card="hpi"]:not(.xhas), #work.mode-full .xcard[data-card="hxn"]:not(.xhas) { display: none; }
/* "Come back urgently if" and "Rest & return to work" live inside the Advice box */
.xadv { margin-top: 8px; } .xadv .xcard { margin: 6px 0; }
/* template offers inside Tests advised / Medicines / Follow-up: tap to add, nothing written by itself */
.tploff { margin: 6px 0; align-items: center; gap: 6px; flex-wrap: wrap; } .tploff[hidden] { display: none !important; }
.tploff .chip, .tploff .linkbtn { min-height: 44px; }
@media print { .tploff, .sxopen { display: none !important; } }

/* B60 (28-Nov-2026, Dr Shah: "The prescription final print can have slightly smaller fonts, so we can accommodate more content"): the
   prescription paper only (body.rxpaper = print_page() in pages_l1.php; here in rxsub.css, lane 1, linked on every page after app.css; letters, explain sheets and handout pages keep their sizes). About 1 pt
   (~10 %) off the body, the medicine table, the band, diagnosis, follow-up and signature; the small capitals headings 0.5 pt, so they stay in
   proportion; line height 1.45 -> 1.4. The letterhead is the pre-printed paper / background image and is not touched. */
body.rxpaper .content { font-size: 9pt; line-height: 1.4; }
body.rxpaper .content .date { font-size: 9.5pt; }
body.rxpaper .content .lbl { font-size: 6pt; }
body.rxpaper .content .band .val { font-size: 8.5pt; }
body.rxpaper .content .band .big { font-size: 11pt; }
body.rxpaper .content h3 { font-size: 7pt; }
body.rxpaper .content section { margin-bottom: 3.2mm; }
body.rxpaper .content section.dx .dxl { font-size: 10pt; } body.rxpaper .content section.dx .dxs { font-size: 8.5pt; }
body.rxpaper table.meds { font-size: 9pt; } body.rxpaper table.meds th { font-size: 6pt; }
body.rxpaper table.meds td { padding-top: 1.2mm; padding-bottom: 1.2mm; }
body.rxpaper table.meds .nm { font-size: 9.5pt; } body.rxpaper table.meds .how { font-size: 8.5pt; line-height: 1.45; }
body.rxpaper .content small.gen { font-size: 7.5pt; } body.rxpaper .content td .stx { font-size: 7.5pt; }
body.rxpaper .content .fu .big { font-size: 10.5pt; } body.rxpaper .content .fu .note { font-size: 8.5pt; }
body.rxpaper .content .sign { font-size: 9pt; } body.rxpaper .content .sign small { font-size: 7pt; }

/* 30-Nov-2026 (Dr Shah, phone): "Visit & vitals" comes before Complaints — on the History taking page too (it stays on Examination as well) */
#work:not(.mode-simple) #tab-rx[data-sub="h"] .rxp-e.rxp-hv { display: block !important; }
