/* @ekm-tags: style, ui-shell, security, patient */
/*
 * @ekm-tags+: patient
 * Patient portal staff screens (owner approved 2026-11-18): Access Requests (js/ekm-portal-access.js, a full-screen workspace
 * like the GLP-1 Program) and Share visit changes in the patient chart's Appointments page (js/ekm-visit-changes.js).
 * Built on the 2030 kit (css/ekm-kit-2030.css: k-sheet, k-row, k-stats, k-seg, k-btn, k-check, k-status) in Pearl and Pearl
 * Night; every other theme gets the same layout from the portal's theme tokens (--c-*). Dense on purpose (owner likes dense
 * staff screens). Kit rules kept: 44px targets, no pills (radii stay small), no painted rounded boxes inside the one sheet
 * (notices are a left rule, not a box), no round numbered markers ("Step 1" is words), no brown fills.
 */
.pa-ws, .pvc {
  --pa-ink: var(--k-ink, var(--c-ink, #1C1814));
  --pa-muted: var(--k-muted, var(--c-muted, #5A5248));
  --pa-hair: var(--k-hair, color-mix(in srgb, var(--c-ink, #1C1814) 10%, transparent));
  --pa-rule: var(--k-rule, color-mix(in srgb, var(--c-ink, #1C1814) 16%, transparent));
  --pa-bg: var(--c-bg, #F3EDE4);
  --pa-card: var(--c-box, #FAF6EF);
  --pa-field: var(--k-field, var(--c-box, #FFFFFF));
  --pa-ok: var(--k-ok, var(--status-success-ink, #2E7051));
  --pa-warn: var(--k-warn, #84530B);
  --pa-alert: var(--k-alert, var(--status-danger-ink, #9A3B2E));
  --pa-amber: rgba(231, 200, 122, .16);
  --pa-font: var(--k-font-ui, var(--font-ui, 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif));
  color: var(--pa-ink);
  font-family: var(--pa-font);
  font-size: 14px;
  line-height: 1.45;
}

/* ---- workspace shell (above the app, below shared modals such as the password re-check) ---- */
body.pa-ws-open #modal.modal-bg { z-index: 9500; }
.pa-ws { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; background: var(--pa-bg); }
.pa-ws[hidden] { display: none; }
.pa-ws-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--pa-hair);
  background: color-mix(in srgb, var(--pa-card) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.pa-eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--pa-muted); }
.pa-ws-title { margin: 2px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.pa-ws-body { flex: 1; overflow: auto; padding: 16px 24px 48px; }
.pa { display: grid; gap: 14px; max-width: 1320px; margin: 0 auto; min-width: 0; }
.pa-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 16px; }
.pa-sub { margin: 0; max-width: 80ch; color: var(--pa-muted); }
.pa-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 560px) { .pa-head { grid-template-columns: minmax(0, 1fr); } .pa-actions { justify-content: flex-start; } }

/* ---- buttons and fields: 44px targets in every theme ---- */
.pa-btn, .pvc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; min-height: 44px; min-width: 44px;
  padding: 0 14px; margin: 0; border: 1px solid var(--pa-rule); border-radius: 6px; background: var(--pa-field); color: var(--pa-ink);
  font: 500 14px/1.2 var(--pa-font); white-space: nowrap; cursor: pointer; }
.pa-btn:disabled, .pvc-btn:disabled { cursor: not-allowed; background: var(--btn-dis-bg, color-mix(in srgb, var(--pa-ink) 8%, transparent)); color: var(--btn-dis-ink, var(--pa-muted)); }
.pa-btn--primary:not(:disabled), .pvc-btn--primary:not(:disabled) { background: var(--fin-solid, var(--c-accent, var(--pa-ink))); color: var(--fin-ink, var(--c-on-accent, #fff)); border-color: transparent; }
.pa-btn:focus-visible, .pvc-btn:focus-visible, .pa-input:focus-visible, .pvc-input:focus-visible, .pa-row:focus-visible { outline: 2px solid var(--k-focus, var(--pa-ink)); outline-offset: 2px; }
.pa-input, .pvc-input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; margin: 0; border: 1px solid var(--pa-rule); border-radius: 6px;
  background: var(--pa-field); color: var(--pa-ink); font: 400 14px/1.4 var(--pa-font); }
textarea.pa-input, textarea.pvc-input { resize: vertical; min-height: 64px; }
.pa-lbl, .pvc-lbl { display: block; margin: 8px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pa-muted); }
.pa-inline, .pvc-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.pa-inline .pa-input, .pvc-inline .pvc-input { flex: 1 1 220px; width: auto; }
.pa-check, .pvc-switch, .pvc-confirm { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.pa-check input, .pvc-switch input, .pvc-confirm input { width: 20px; height: 20px; margin: 0; accent-color: var(--pa-ink); }
.pa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- stats, tabs, list ---- */
.pa-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--pa-rule); border-bottom: 1px solid var(--pa-rule); }
.pa-stat { display: grid; gap: 2px; justify-items: center; padding: 10px 12px; text-align: center; box-shadow: -1px 0 0 var(--pa-hair); }
.pa-stat-n { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pa-stat-l { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pa-muted); }
.pa-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
@media (max-width: 900px) { .pa-grid { grid-template-columns: minmax(0, 1fr); } }
.pa-listcol, .pa-detail, .pa-add { min-width: 0; padding: 10px 16px; }
.pa-tabs { display: inline-flex; gap: 2px; margin: 4px 0 8px; }
.pa-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; color: var(--pa-muted); font: 500 14px/1.2 var(--pa-font); cursor: pointer; }
.pa-tab[aria-pressed="true"] { color: var(--pa-ink); border-bottom-color: var(--pa-ink); font-weight: 600; }
.pa-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 4px;
  background: var(--pa-ink); color: var(--k-on-ink, var(--pa-card)); font-size: 11px; font-weight: 600; }
.pa-list, .pa-cands, .pa-found, .pvc-visits { margin: 0; padding: 0; list-style: none; }
.pa-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; width: 100%; min-height: 56px; padding: 6px 4px; margin: 0;
  border: 0; border-bottom: 1px solid var(--pa-hair); border-radius: 0; background: none; color: var(--pa-ink); font: inherit; text-align: left; cursor: pointer; }
.pa-row[aria-current="true"] { background: color-mix(in srgb, var(--pa-ink) 6%, transparent); }
.pa-row .k-row__main { display: grid; gap: 1px; min-width: 0; }
.pa-row .k-row__title, .pa-cand .k-row__title { font-weight: 600; overflow-wrap: anywhere; }
.pa-row .k-row__meta, .pa-cands .k-row__meta, .pa-found .k-row__meta, .pvc-visits .k-row__meta { font-size: 12.5px; color: var(--pa-muted); overflow-wrap: anywhere; }
.pa-av { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--pa-ink) 7%, transparent); font-size: 12px; font-weight: 600; }
.pa-cands > li, .pa-found > li, .pvc-visits > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 6px 0; border-bottom: 1px solid var(--pa-hair); }
.pa-cands .k-row__main, .pa-found .k-row__main, .pvc-visits .k-row__main { display: grid; gap: 1px; min-width: 0; }

/* ---- status words (a small square, never a pill) ---- */
.pa-status, .pvc-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pa-status::before, .pvc-state::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; flex: none; }
.pa-status.k-status--ok, .pvc-state.k-status--ok { color: var(--pa-ok); }
.pa-status.k-status--warn, .pvc-state.k-status--warn { color: var(--pa-warn); }
.pa-status.k-status--alert { color: var(--pa-alert); }
.pa-status.k-status--muted { color: var(--pa-muted); }

/* ---- request detail ---- */
.pa-dh { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px 0 10px; border-bottom: 1px solid var(--pa-hair); }
.pa-h { margin: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.pa-meta, .pa-note, .pa-empty, .pa-audit { margin: 4px 0 0; color: var(--pa-muted); font-size: 13px; overflow-wrap: anywhere; }
.pa-empty { padding: 16px 4px; }
.pa-block { padding: 10px 0; border-bottom: 1px solid var(--pa-hair); min-width: 0; }
.pa-bh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.pa-unverified { display: inline-block; padding: 2px 6px; border-left: 3px solid var(--pa-warn); color: var(--pa-warn); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.pa-cmp { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.pa-cmp th, .pa-cmp td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--pa-hair); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.pa-cmp thead th { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pa-muted); }
.pa-cmp thead th:nth-child(1) { width: 22%; } .pa-cmp thead th:nth-child(3) { width: 28px; }
.pa-cmp tbody th { font-weight: 500; color: var(--pa-muted); }
.pa-typed { font-style: italic; }
.pa-mk { font-weight: 700; color: var(--pa-muted); }
.pa-mk--y { color: var(--pa-ok); }
.pa-mk--n { color: var(--pa-warn); }
.pa-typedmsg { margin: 8px 0 0; font-style: italic; overflow-wrap: anywhere; white-space: pre-wrap; }
.pa-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--pa-hair); }
.pa-fact dt { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pa-muted); }
.pa-fact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.pa-assign { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pa-assign .pa-input { flex: 1 1 160px; width: auto; }
.pa-steps { margin: 0; padding: 0; list-style: none; }
.pa-step { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--pa-hair); }
.pa-step:first-child { border-top: 0; }
.pa-step-n { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pa-muted); padding-top: 2px; }
.pa-step.is-current .pa-step-n { color: var(--pa-ink); }
.pa-step.is-current { box-shadow: inset 3px 0 0 var(--pa-ink); padding-left: 8px; }
.pa-step-main { min-width: 0; }
.pa-form { margin-top: 6px; max-width: 560px; }
.pa-msg { margin: 10px 0 0; padding: 6px 10px; border-left: 3px solid var(--pa-ok); }
.pa-msg p { margin: 0; }
.pa-msg--error { border-left-color: var(--pa-alert); color: var(--pa-alert); }
.pa-missing { margin: 4px 0 0; padding-left: 18px; }
.pa-error { color: var(--pa-alert); }
.pa-hist { margin: 0; padding-left: 18px; font-size: 13px; }
.pa-hist li { padding: 3px 0; overflow-wrap: anywhere; }
.pa-hist-when { color: var(--pa-muted); font-variant-numeric: tabular-nums; }
.pa-hist-note { display: block; color: var(--pa-muted); }
.pa-calm { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; text-align: center; color: var(--pa-muted); }
.pa-calm-title { margin: 0; font-size: 22px; color: var(--pa-ink); }
.pa-calm p { margin: 0; max-width: 60ch; }
.pa-loading, .pvc-loading { height: 2px; margin: 12px 0; background: var(--pa-hair); }

/* ---- Unified Inbox Website lane: the one-line pointer ---- */
.uib-pa-pointer .uib-pa-link { min-height: 44px; }

/* ---- Share visit changes (patient chart → Appointments) ---- */
.pch-vc-slot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--pa-hair, rgba(0, 0, 0, .1)); }
.pvc-head { margin-bottom: 6px; }
.pvc-h { margin: 0; font-size: 16px; font-weight: 600; }
.pvc-h5 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.pvc-sub, .pvc-note, .pvc-audit { margin: 4px 0 0; color: var(--pa-muted); font-size: 13px; overflow-wrap: anywhere; }
.pvc-calm { margin: 8px 0; color: var(--pa-muted); }
.pvc-error { color: var(--pa-alert); }
.pvc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 4px 0 8px; border-bottom: 1px solid var(--pa-hair); }
.pvc-visitmeta { font-weight: 600; overflow-wrap: anywhere; }
.pvc-block { margin: 8px 0; padding: 6px 10px; border-left: 3px solid var(--pa-alert); color: var(--pa-alert); }
.pvc-msg { margin: 8px 0; padding: 6px 10px; border-left: 3px solid var(--pa-ok); }
.pvc-msg--error { border-left-color: var(--pa-alert); color: var(--pa-alert); }
.pvc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; margin-top: 8px; }
@media (max-width: 900px) { .pvc-grid { grid-template-columns: minmax(0, 1fr); } }
.pvc-lines { min-width: 0; }
.pvc-line { padding: 8px 0 10px; border-bottom: 1px solid var(--pa-hair); }
.pvc-line.is-off > :not(.pvc-switch) { opacity: .55; }
.pvc-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; background: color-mix(in srgb, var(--pa-ink) 8%, transparent); font-size: 11.5px; font-weight: 600; }
.pvc-title { font-weight: 600; }
.pvc-offnote { color: var(--pa-muted); font-size: 12.5px; }
.pvc-dose { margin: 4px 0; }
.pvc-dosepill { display: inline-block; padding: 1px 6px; border: 1px solid var(--pa-rule); border-radius: 3px; font-variant-numeric: tabular-nums; }
.pvc-flag { margin: 8px 0 0; padding: 4px 10px; border-left: 3px solid #C9922E; background: var(--pa-amber); }
.pvc-flag p { margin: 4px 0 0; color: var(--pa-warn); font-weight: 500; }
.pvc-add { padding: 10px 0; border-bottom: 1px solid var(--pa-hair); }
.pvc-addk { flex: 0 0 140px !important; }
.pvc-versions { padding: 10px 0; border-bottom: 1px solid var(--pa-hair); }
.pvc-vlist { margin: 0; padding-left: 18px; font-size: 13px; }
.pvc-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.pvc-phonewrap { position: sticky; top: 8px; }
/* the phone: a frame of hairlines, radius kept under the kit's box threshold */
.pvc-phone { box-sizing: border-box; width: 100%; max-width: 300px; min-height: 420px; max-height: 620px; overflow: auto; padding: 18px 14px;
  border: 6px solid var(--pa-ink); border-radius: 7px; background: var(--pa-field); color: var(--pa-ink); font-size: 13px; }
.pvc-pv-head { padding-bottom: 8px; border-bottom: 1px solid var(--pa-hair); }
.pvc-pv-eyebrow { margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--pa-muted); }
.pvc-pv-date { margin: 2px 0 0; font-size: 16px; font-weight: 600; }
.pvc-pv-who { margin: 0; color: var(--pa-muted); }
.pvc-pv-item { padding: 8px 0; border-bottom: 1px solid var(--pa-hair); }
.pvc-pv-badge { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pa-warn); }
.pvc-pv-title { margin: 2px 0; font-weight: 600; }
.pvc-pv-dose { margin: 2px 0; font-variant-numeric: tabular-nums; }
.pvc-pv-part { margin: 2px 0; overflow-wrap: anywhere; }
.pvc-pv-empty { color: var(--pa-muted); }
.pvc-pv-ack { margin: 10px 0 0; text-align: center; font-weight: 600; color: var(--pa-muted); }
