/* @ekm-tags: style, misc, patient, clinical */
/* @ekm-tags+: patient, clinical */
/* EKM OS — Medication picker (js/ekm-med-picker.js): the drug list under the patient chart's medication name field.
   Uses the chart's own tokens (--pch-*, defined on .pch-root, light + dark) with plain fallbacks. Calm, flat rows:
   44px targets, name / strength + form on one line, no pills and no schedule markers. */
.ekm-mp { position: relative; max-width: 640px; }
.ekm-mp .pch-care-input { max-width: 100%; }
.ekm-mp-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  max-height: min(360px, 50vh); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  box-sizing: border-box; margin: 0; padding: 4px 0;
  background: var(--pch-card, #FAF6EF); color: var(--pch-ink, #1C1814);
  border: 1px solid var(--pch-border, #D9D0C4); border-radius: 8px;
  box-shadow: var(--pch-shadow-card, 0 6px 18px rgba(28, 24, 20, 0.12));
}
.ekm-mp-list[hidden] { display: none; }
/* js/ekm-med-picker.js floats the open list (position: fixed, inline left / top / width / max-height) so no modal or card clips it and it
   is never narrower than the field; this only raises it above the host's own layers. */
.ekm-mp-list.is-floating { z-index: 10050; }
.ekm-mp-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; box-sizing: border-box; padding: 8px 12px 8px 14px;
  border-left: 3px solid transparent; cursor: pointer; line-height: 1.3;
}
.ekm-mp-opt + .ekm-mp-opt { border-top: 1px solid var(--pch-overlay-soft, rgba(28, 24, 20, 0.04)); }
.ekm-mp-opt:hover { background: var(--pch-overlay-soft, rgba(28, 24, 20, 0.04)); }
.ekm-mp-opt.is-active { background: var(--pch-gold-wash, rgba(0, 0, 0, 0.08)); border-left-color: var(--pch-ink, #1C1814); }
.ekm-mp-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; max-width: 100%; flex: 1 1 auto; }
/* Names wrap at word boundaries (a single token longer than the row breaks only as a last resort); a multi-number strength stays whole. */
.ekm-mp-name { font-size: 14px; font-weight: 600; color: var(--pch-ink, #1C1814); min-width: 0; max-width: 100%; overflow-wrap: break-word; }
.ekm-mp-detail { font-size: 13px; color: var(--pch-muted, #5A5248); min-width: 0; max-width: 100%; overflow-wrap: break-word; }
.ekm-mp-num { white-space: nowrap; }
/* The picked product (read-only, not saved) and the "product strength is not the dose" hint under Dose. */
.ekm-mp-product {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; max-width: 640px; box-sizing: border-box;
  margin: 8px 0 0; padding: 0 0 0 12px; min-height: 44px;
  border-left: 3px solid var(--pch-border, #D9D0C4); font-size: 13px; color: var(--pch-ink, #1C1814);
}
.ekm-mp-product-k { font-size: 12px; font-weight: 600; color: var(--pch-ink-soft, #3D3830); }
.ekm-mp-product-v { font-weight: 600; overflow-wrap: anywhere; }
.ekm-mp-change {
  min-height: 44px; min-width: 44px; padding: 0 8px; margin-left: auto;
  background: none; border: 0; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--pch-link, #7A5A22); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.ekm-mp-change:focus-visible { outline: 2px solid var(--pch-ink, #1C1814); outline-offset: 2px; border-radius: 4px; }
.ekm-mp-hint { margin: 4px 0 0; font-size: 12px; color: var(--pch-ink-soft, #3D3830); }
/* Tap-to-fill choices under Dose / Frequency: flat, squared buttons (no pills), 44px targets, the chosen one marked. */
.ekm-mp-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.ekm-mp-choice {
  min-height: 44px; min-width: 44px; padding: 0 12px; box-sizing: border-box;
  background: var(--pch-card, #FAF6EF); color: var(--pch-ink, #1C1814);
  border: 1px solid var(--pch-border, #D9D0C4); border-radius: 6px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ekm-mp-choice:hover { background: var(--pch-overlay-soft, rgba(28, 24, 20, 0.04)); }
.ekm-mp-choice.is-on { border-color: var(--pch-ink, #1C1814); box-shadow: inset 0 0 0 1px var(--pch-ink, #1C1814); }
.ekm-mp-choice:focus-visible { outline: 2px solid var(--pch-ink, #1C1814); outline-offset: 2px; }
.ekm-mp-choice:disabled { opacity: 0.6; cursor: default; }
.ekm-mp-note {
  margin: 6px 0 0; padding: 6px 10px; font-size: 12px; color: var(--pch-ink-soft, #3D3830);
  border-left: 3px solid var(--pch-amber, #B8752E); background: var(--pch-amber-wash, rgba(217, 166, 92, 0.18)); border-radius: 0 6px 6px 0;
}
.ekm-mp-note[hidden] { display: none; }
/* Provenance (medication safety Step A): "Names and forms are shown as listed by NLM RxTerms; product identity verification is
   pending." Quiet plain text, no box: ink-soft (#3D3830 on #FAF6EF ≈ 10:1; --c-ink2 in every portal theme) keeps AA. */
.ekm-mp-src { margin: 4px 0 0; max-width: 640px; font-size: 12px; line-height: 1.4; color: var(--pch-ink-soft, #3D3830); }
.ekm-mp-src[hidden] { display: none; }
.ekm-mp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (forced-colors: active) {
  .ekm-mp-opt.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
}
@media (prefers-reduced-motion: no-preference) {
  .ekm-mp-opt { transition: background-color 80ms ease-out; }
}
/* Outside the patient chart (request forms, session log rows, PMP, Medication Intelligence): the same list on the portal's own
   theme tokens (--c-box / --c-ink / --c-ink2 / --c-box-border, defined for every theme, dark ones included), so text keeps AA
   contrast on whatever card or modal hosts it. */
.ekm-mp--app {
  --pch-card: var(--c-box, #FAF6EF); --pch-ink: var(--c-ink, #1C1814); --pch-ink-soft: var(--c-ink2, #3D3830);
  --pch-muted: var(--c-ink2, #3D3830); --pch-border: var(--c-box-border, #D9D0C4);
  --pch-overlay-soft: color-mix(in srgb, var(--c-ink, #1C1814) 5%, transparent);
  --pch-gold-wash: color-mix(in srgb, var(--c-ink, #1C1814) 12%, transparent);
  max-width: none; width: 100%;
}
.ekm-mp--app > input { width: 100%; box-sizing: border-box; }
