/* rxdesk.css — lane 1 (mod_l1_worklist.json "css": linked on every page after app.css; every rule here is scoped to the Rx screen's own ids).
   F1 Today's list in the patient drawer (28-Oct-2026) + the >= 1280 px polish of the desktop review: the save bar at 1366 px and the
   Checks / Suggestions heights at 1280–1439 px. Phones and tablets: only the Today's list rows (same .res look as the search results). */

/* ---------- F1 Today's list (app.js wlRender) ---------- */
.wlbox { margin: 10px 0 6px; }
.wlbox .wlh { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; }
.wlbox .wlsrc { margin: 0 0 4px; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
#wlist { max-height: 46vh; overflow: auto; }
#wlist .wlr { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 6px; align-items: baseline; margin: 4px 0; padding: 6px 8px; min-height: 44px; }
#wlist .wlr > .wlt { grid-row: 1 / 3; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); }
#wlist .wlr > b, #wlist .wlr > .wlk, #wlist .wlr > .wlok { grid-column: 2; }
#wlist .wlr > b { overflow-wrap: anywhere; }
#wlist .wlr > small { grid-column: 2; display: block; color: var(--muted); font-size: 12px; }
#wlist .wlr { grid-auto-flow: row dense; }
#wlist .wlk { display: inline-block; width: max-content; padding: 0 6px; border-radius: 9px; font-size: 11px; line-height: 17px; font-weight: 600; }
#wlist .wlk.new { background: #e7f5ec; color: #17603a; }
#wlist .wlk.fu { background: #eef2f7; color: #334155; }
#wlist .wlok { color: #17603a; font-weight: 700; }
#wlist .wlr.seen { background: #f7fbf8; }
#wlist .wlr.seen > b { color: #334155; }
#wlist .wlr.cur { border-color: #0b5d73; box-shadow: inset 3px 0 0 #0b5d73; }

/* fold buttons (encws.js): only where the Checks / Suggestions sit in the right column */
.encfold { display: none; }

@media (min-width: 1280px) {
  /* ---------- the save bar at laptop widths (1366 px: the language selector sat over "Missing N") ----------
     The status group keeps the width of what it shows (state, checks, Missing N); only the message line shrinks (ellipsis). The bar stays above
     the sticky Suggestions panel of the right column. */
  body.encws #work .savebar { z-index: 7; }
  body.encws .savebar .sbstat { min-width: auto; flex: 1 1 auto; }
  body.encws .savebar #status { flex: 1 1 0; min-width: 0; }

  /* ---------- Checks + Suggestions: fold buttons, a count chip when folded, fixed heights ---------- */
  body.encws .encfold { display: inline-flex; align-items: center; gap: 4px; position: absolute; top: 6px; right: 8px; z-index: 2; min-height: 28px; padding: 1px 10px; font-size: 12px; }
  body.encws .encfold .foldn { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #fff4d6; color: #8a5a00; font-weight: 700; line-height: 18px; text-align: center; }
  body.encws #advgrp > .rail { position: relative; inset: auto; }   /* relative only to hold the fold button: the drawer's top / left must not shift it */
  body.encws #advgrp > .rail .railh { padding-right: 70px; }
  body.encws #advgrp > .sugpanel h4 { padding-right: 76px; }
  body.encws.chkfold #advgrp > .rail { height: 46px; overflow: hidden; }
  body.encws.chkfold #advgrp > .rail > :not(.railh):not(.encfold) { display: none; }
  body.encws.sugfold #advgrp > .sugpanel { height: 42px; overflow: hidden; }
  body.encws.sugfold #advgrp > .sugpanel #sugbody { display: none; }
}
/* 1280–1439 px (no extra breakpoint — test_layout_rules.js allows only 600 / 1024 / 1280): 24vh + 34vh (~58% of the height) became
   16vh + 22vh. clamp() steps at 1440 px: (100vw - 1439px) * 1000 is below the floor under 1440 px and above the cap from 1440 px. */
@media (min-width: 1280px) {
  body.encws #advgrp > .rail { height: clamp(16vh, calc(16vh + (100vw - 1439px) * 1000), 24vh); }
  body.encws #advgrp > .sugpanel { height: clamp(22vh, calc(22vh + (100vw - 1439px) * 1000), 34vh); }
  body.encws .savebar .signdoc { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
  /* under 1600 px the Ctrl+S / Ctrl+P hints in the Save buttons fold away (the same step; the keys stay in the titles and the top bar's key line) */
  body.encws .savebar kbd { display: inline-block; vertical-align: 1px; overflow: hidden; white-space: nowrap; max-width: clamp(0px, calc((100vw - 1599px) * 1000), 80px);
    margin-left: clamp(0px, calc((100vw - 1599px) * 1000), 5px); padding-left: clamp(0px, calc((100vw - 1599px) * 1000), 3px); padding-right: clamp(0px, calc((100vw - 1599px) * 1000), 3px);
    border-width: clamp(0px, calc((100vw - 1599px) * 1000), 1px); }
  /* the save bar's About is its "i" only (the words are in its title; it opens the same panel) */
  body.encws .savebar .secabout .uiab-t { display: none; }
  /* under 1366 px the save-bar buttons are a little narrower (padding 11 -> 7 px), so a visit with Repeat last Rx still fits on one line */
  body.encws .savebar > button, body.encws .savebar .rxexpw > button { padding-left: clamp(7px, calc(7px + (100vw - 1365px) * 1000), 11px); padding-right: clamp(7px, calc(7px + (100vw - 1365px) * 1000), 11px); }
  body.encws .savebar { gap: clamp(5px, calc(5px + (100vw - 1599px) * 1000), 8px); }
}

/* ---------- l1 UX step 1 (29-Oct-2026, research/RESEARCH_l1_clinical-core_ux.md §7 Step 1; UX-34). Rx screen only (body.rxpage). ----------
   1 the diagnosis box gets the full width: no empty figure box beside it for a diagnosis that is not a coded cancer (G6); a figure that is
     drawn goes under the diagnosis rows (phone and desktop)
   2 phone: 44 px tap targets and 16 px text in the form, the patient search and the save bar (G8); desktop: the search box is 44 px, 16 px
   3 one Today list (app.js wlRender: the day's list; the saved-prescriptions list folds under it, one tap — G12)
   4 the save bar keeps every button in the same place in every state: Save as draft keeps its slot after a save (desktop, tablet); on a
     phone the bar is a fixed grid — status / Repeat · tele papers / language · letterhead · About · Preview / Export · Draft · Save · Save & print (G7)
   5 nothing floats over the top bar: on a phone / tablet the teal bar sticks UNDER Menu · Back · Report (a solid strip behind them);
     on a desktop Report / Suggest sits in the top bar's right end instead of over the form (G2, G9) */
.dxbox .dxanat.none { display: none; }
.dxbox:has(> .dxanat.none) > :not(.sech) { margin-right: 0; }

/* every width: a figure that is drawn goes under the diagnosis rows, so the box keeps the section's width (the >= 1280 px rule, everywhere) */
body.rxpage .dxbox { display: flex; flex-direction: column; min-height: 0; }
body.rxpage .dxbox > :not(.dxanat):not(.sech) { margin-right: 0; }
body.rxpage .dxbox .dxanat { order: 99; position: static; margin-top: 10px; }

body.rxpage .dxrow .grow { flex: 1 1 100%; }

@media (max-width: 600px) {

  /* 2: 16 px text, 44 px targets */
  body.rxpage #work, body.rxpage #ptpanel, body.rxpage #empty { font-size: 16px; }
  body.rxpage #work label, body.rxpage #work .chip, body.rxpage #work button, body.rxpage #work summary, body.rxpage #ptpanel button, body.rxpage #ptpanel h4 { font-size: 16px; }
  body.rxpage #work input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]), body.rxpage #work select, body.rxpage #q, body.rxpage #todaydate { min-height: 44px; box-sizing: border-box; }
  body.rxpage #work summary, body.rxpage #work .chip, body.rxpage #work label.chip { min-height: 44px; display: inline-flex; align-items: center; box-sizing: border-box; }
  body.rxpage #work details > summary { display: flex; }
  /* the Advice heading's buttons keep their words at 16 px: the heading wraps instead (✎ Template spilled past the screen at 360) */
  body.rxpage #advgrp > .agrph { flex-wrap: wrap; }
  body.rxpage #advgrp > .agrph > button { flex: none; width: auto; max-width: 100%; }

  /* 4: the save bar as a fixed grid — a button never moves when another one shows or hides */
  body.rxpage .savebar { display: grid !important; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1.2fr);
    grid-template-areas: "st st st st" "rp rp xa xb" "la lh ab pv" "ex dr sv sp"; align-items: stretch; column-gap: 8px; row-gap: 8px;
    width: 100vw; max-width: 100vw; right: auto; box-sizing: border-box; }   /* the screen's width, never the form's (a wide medicines table made it 377 px at 360) */
  body.rxpage .savebar > * { min-width: 0; margin: 0 !important; }
  body.rxpage .savebar .sbstat { grid-area: st; }
  body.rxpage .savebar #repeatall { grid-area: rp; }
  body.rxpage .savebar #docx { grid-area: xa; } body.rxpage .savebar #tcpdf { grid-area: xb; }
  body.rxpage .savebar .langin { grid-area: la; } body.rxpage .savebar .lhsel { grid-area: lh; }
  body.rxpage .savebar .lhsel select { width: 100%; max-width: 100%; }   /* 'Jivraj Mehta' is the longest paper name: the box takes its cell, never widens it */
  body.rxpage .savebar #preview { grid-area: pv; } body.rxpage .savebar .secabout { grid-area: ab; }
  body.rxpage .savebar .rxexpw { grid-area: ex; display: flex; } body.rxpage .savebar .rxexpw > button { flex: 1 1 auto; min-width: 0; }
  body.rxpage .savebar #savedraft { grid-area: dr; } body.rxpage .savebar #save { grid-area: sv; } body.rxpage .savebar #saveprint { grid-area: sp; }
  body.rxpage .savebar button, body.rxpage .savebar .langin select, body.rxpage .savebar .lhsel select { font-size: 16px; padding-left: 4px; padding-right: 4px; white-space: normal; line-height: 1.1; }
  body.rxpage .savebar .secabout > summary { width: 100%; height: 44px; justify-content: center; padding: 0; font-size: 16px; }
  body.rxpage .savebar .secabout .uiab-t { display: none; }
  body.rxpage .savebar .sbstat, body.rxpage .savebar #status { font-size: 14px; }
  /* the teal top bar: 44 px Patients-of box, 8 px between its buttons (UX-M1) */
  body.rxpage header.top { gap: 8px; } body.rxpage header.top .scope select { min-height: 44px; font-size: 16px; }
}
@media (min-width: 601px) {
  /* 4: Save as draft keeps its slot after a save, so Export / Preview do not slide */
  body.rxpage .savebar #savedraft[hidden] { display: inline-flex !important; visibility: hidden; }
}
@media (min-width: 1025px) {
  /* 2: the patient search box */
  body.rxpage #q { min-height: 44px; font-size: 16px; box-sizing: border-box; }
  body.rxpage .dxrow [data-f=diagnosis] { font-size: 16px; }
  /* 5: Report / Suggest in the top bar's right end (it floated over Advice · Template and the Checks) */
  body.rxpage header.top { padding-right: 176px; }
  html body.rxpage #rxbugbtn, html body.rxpage:has(.savebar) #rxbugbtn, html body.rxpage:has(.envbar):has(.savebar) #rxbugbtn { top: 9px; bottom: auto; right: 14px; z-index: 31; opacity: 1; }
}
@media (max-width: 1024px) {
  /* 5: the teal bar sticks under the fixed Menu · Back · Report row, with a solid strip behind that row */
  body.rxpage header.top { top: 62px; }
  body.rxpage::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: calc(62px + env(safe-area-inset-top, 0px)); background: var(--bg, #edf2f6); z-index: 29; pointer-events: none; }
  body.rxpage.sopen::before { display: none; }
}
@media print { body.rxpage::before { display: none !important; } }
@media (min-width: 601px) {
  /* 4: the status line shrinks (ellipsis) instead of pushing the buttons right after a save ("Saved at …" is longer than "Not saved") */
  body.rxpage .savebar .sbstat { flex: 1 1 0; min-width: 0; overflow: hidden; }
  body.rxpage .savebar #status { flex: 1 1 0; min-width: 0; }
}
/* 3: the folded saved-prescriptions list under Today — one 44 px tap opens it */
body.rxpage .wlsaved { margin: 6px 0 0; }
body.rxpage .wlsaved > summary { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; font-weight: 600; }
/* l1 (UX-56, 29-Oct-2026): desktop and tablet — every control on the Rx screen is a 44 px target too (UX-M1; the phone rules are rxdesk.css):
   157 of 168 were under 44 px at 1366. Height only: widths stay as drawn, so the two columns keep their layout */
@media (min-width: 601px) {
  body.rxpage header.top :is(button, select, a.hbtn), body.rxpage #ptnav :is(button, a),
  body.rxpage #work :is(button, select, summary, .chip), body.rxpage #work input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=range]),
  body.rxpage .savebar :is(button, select, summary) { min-height: 44px; box-sizing: border-box; }
  body.rxpage #work :is(summary, .chip), body.rxpage #ptnav a { display: inline-flex; align-items: center; }
  body.rxpage #work details > summary { display: flex; }
}
@media (min-width: 1280px) {
  /* l3 (UX-56, 29-Oct-2026): the sections under the sticky Suggestions panel scroll OVER it, never under it — the panel covered the top of section 10's
     tick row ("Disease & symptoms ▶" half hidden). The 12 px gap above each one is painted the page colour so no strip of the panel shows between them */
  #advgrp > .sec { position: relative; z-index: 7; box-shadow: 0 1px 3px #0f2a3a10, 0 -12px 0 0 var(--bg); }
}
.savebar .lhsel select { max-width: 88px; text-overflow: ellipsis; }   /* 'Jivraj Mehta' is the longest paper name: it must not widen the bar (tablet) */

/* ---------- 31-Oct-2026 Rx panel: one type scale, tighter rhythm, charts inline (Dr Shah: "relook into the design & font size so everything looks
   professional & there should not be too much of blank spaces"). Scale: body 14.5 px, labels 12.5, headings 16, the name 19; one 8 / 12 px rhythm. ---------- */
@media (min-width: 601px) {
  body.rxpage #work { font-size: 14.5px; line-height: 1.4; }
  body.rxpage #work label, body.rxpage #work .flabel { font-size: 12.5px; }
  body.rxpage #work label > input, body.rxpage #work label > select, body.rxpage #work label > textarea { font-size: 14.5px; margin-top: 2px; }
  body.rxpage main.app { gap: 12px; padding: 12px 16px; }
  body.rxpage #work { gap: 12px; }
  body.rxpage #work .sec { padding: 0 14px 10px; margin-top: 10px; }
  body.rxpage #work .sech { margin: 0 -14px 8px; padding: 6px 14px; font-size: 16px; gap: 4px 8px; }
  body.rxpage #work .sech small { font-size: 12.5px; }
  body.rxpage #work .banner { padding: 8px 14px 6px; }
  body.rxpage #work .brow { gap: 8px 12px; }
  body.rxpage #work textarea.grow { min-height: 44px; }
  body.rxpage #work [data-f=diagnosis] { font-size: 16px; }   /* the diagnosis line is what the patient reads: 16 px (test_l1_ux1.js) */
  body.rxpage #work input:not([type=checkbox]):not([type=radio]), body.rxpage #work select { min-height: 30px; }
  body.rxpage #work .sec > .muted:empty, body.rxpage #work .sec small:empty { display: none; }
}
/* the Charts block: two small cards to a row at the panel's width, one line when empty */
body.rxpage #rxcharts { padding-bottom: 8px; }
body.rxpage .chprt { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; text-transform: none; letter-spacing: 0; }
body.rxpage .chprt input { width: auto; min-height: 0; margin: 0; }
body.rxpage .rxchgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
body.rxpage .rxchgrid.empty { display: block; }
body.rxpage .rxchgrid .rxchcard { margin: 0; padding: 6px 8px 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0; }
body.rxpage .rxchgrid .rxchcard figcaption { font-size: 12.5px; margin-bottom: 2px; }
body.rxpage .rxchgrid .chsvg { width: 100%; height: auto; display: block; }
body.rxpage .rxchgrid.empty { padding: 2px 0 0; }
