/* Polish layer (v2, provider-first review). Loaded after every other sheet. Rules:
   - one spacing scale: tile padding 20 / 16 on phones, 16 between blocks inside a tile, 12 between rows
   - no tinted icon squares: icons are plain glyphs; when an icon needs a container it is a solid neutral or ink disc
   - nothing tilts on hover; motion is short and purposeful
   - every interactive target is at least 44 px tall (older users, touch) */

/* ---------- spacing scale ---------- */
:root { --tile-p: clamp(16px, 1.6vw, 22px); --tile-gap: 16px; --gap: clamp(14px, 1.3vw, 20px); --row-h: 60px; }
.tile { gap: var(--tile-gap); }
.tile--flush > .th { padding: var(--tile-p) var(--tile-p) 0; margin-bottom: var(--sp-4); }
.tile > .th + * { margin-top: 0; }
.grid > .tile, .grid > .stack > .tile { height: 100%; }
.grid > .stack { align-content: stretch; grid-auto-rows: auto; }
.grid > .stack > .tile:last-child { flex: 1; }
.th { min-height: 28px; }
.th__k { font-size: var(--fs-15); font-weight: var(--w-med); letter-spacing: -0.01em; gap: var(--sp-10); }
.th__k .ic { display: none; }                         /* tile headers: titles only, no decorative icon tiles */
.th__s { font-size: var(--fs-13); }

/* ---------- icon containers (no low-opacity squares) ---------- */
.ic { width: 36px; height: 36px; border-radius: 50%; background: var(--c-bg-2); color: var(--c-ink); }
.ic .i { width: var(--ic-18); height: var(--ic-18); --duo: .5; }
.ic--ink, .ic--brand { background: var(--c-ink); color: var(--c-white); }
.ic--ok { background: var(--c-bg-2); color: var(--c-ok); } .ic--warn { background: var(--c-bg-2); color: var(--c-warn); }
.ic--err { background: var(--c-bg-2); color: var(--c-err); } .ic--lav { background: var(--c-bg-2); color: var(--c-violet); }
.ic--mute { background: var(--c-bg-2); color: var(--c-ink-2); } .ic--info { background: var(--c-bg-2); color: var(--c-brand-ink); }
.ic--lg { width: 44px; height: 44px; border-radius: 50%; }
.empty .ic { width: 56px; height: 56px; border-radius: 50%; background: var(--c-ink); color: var(--c-white); }
.empty .ic--ok { background: var(--c-ok); color: var(--c-white); } .empty .ic--err { background: var(--c-err); color: var(--c-white); }
.empty .ic--warn { background: var(--c-warn); color: var(--c-white); } .empty .ic--mute { background: var(--c-bg-2); color: var(--c-ink-2); }
.empty--sm .ic { width: 44px; height: 44px; border-radius: 50%; }
.mdl__h .ic { background: var(--c-ink); color: var(--c-white); }
.mdl__h .ic--err { background: var(--c-err); color: var(--c-white); } .mdl__h .ic--ok { background: var(--c-ok); color: var(--c-white); } .mdl__h .ic--warn { background: var(--c-warn); color: var(--c-white); }
.i .a, symbol .a { opacity: var(--duo, .48); }

/* ---------- buttons: no tilt; the arrow nudges, the fill stays ---------- */
.btn:hover .btn__i, .btn:focus-visible .btn__i { transform: none; }
.btn__i .i { transition: transform 360ms var(--ease-expo); }
.btn:hover .btn__i .i, .btn:focus-visible .btn__i .i { transform: translateX(2px); }
.btn:hover .btn__i [href="#i-cart"], .btn:hover .btn__i [href="#i-plus"] { transform: none; }
.b { min-height: 44px; padding: 0 var(--sp-16); border-radius: 14px; font-size: var(--fs-14); }
.b .i { color: currentColor; opacity: .9; }
.b--sm { min-height: 38px; padding: 0 var(--sp-13); border-radius: 12px; font-size: var(--fs-13); }
.b:disabled, .b[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.b--ink .i { color: currentColor; }
.ib { width: 44px; height: 44px; }
.ib--sm { width: 36px; height: 36px; }
.ib:disabled { opacity: .35; pointer-events: none; }
.tlink { min-height: 32px; }
.chk { min-height: 32px; }
.in { min-height: 48px; font-size: var(--fs-15); border-radius: 14px; }
.in--sm { min-height: 40px; font-size: var(--fs-14); border-radius: 12px; }
input[type=number].in::-webkit-inner-spin-button, input[type=number].in::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].in { -moz-appearance: textfield; appearance: textfield; }

/* ---------- sidebar: legible at rest, clear on hover, unmistakable when active ---------- */
.side__in { gap: var(--sp-6); }
.nv { min-height: 46px; gap: var(--sp-13); padding: 0 var(--sp-12); border-radius: 14px; font-size: var(--fs-15); color: var(--c-ink-2); }
.nv .i { width: var(--ic-21); height: var(--ic-21); color: var(--c-ink); --duo: .42; }
.nv:hover { background: var(--c-bg-2); color: var(--c-ink); }
.nv:hover .i { color: var(--c-ink); --duo: .55; }
.nv:active { transform: scale(.985); }
.nv.on { background: var(--c-ink); color: var(--c-white); box-shadow: none; }
.nv.on .i { color: var(--c-white); --duo: .55; }
.nv:focus-visible { box-shadow: var(--focus-ring); }
.side__g { font-size: var(--fs-11); letter-spacing: .12em; padding: var(--sp-18) var(--sp-12) var(--sp-6); color: var(--c-ink-3); }
.side__foot { margin-top: auto; padding: var(--sp-14) var(--sp-14) var(--sp-16); border-top: 1px solid var(--c-line); display: grid; gap: var(--sp-2); font-size: var(--fs-12); }
.side__portal-tag { font-weight: var(--w-med); color: var(--c-ink-2); }
.is-rail .side__foot { display: none; }

/* ---------- top bar: history controller, single account button ---------- */
.top { gap: var(--sp-10); }
.navc { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-radius: 99px; background: var(--c-white); box-shadow: inset 0 0 0 1px var(--c-line); flex: none; }
.navc__b { width: 38px; height: 38px; }
.navc__b .i { width: var(--ic-18); height: var(--ic-18); }
.navc__r.spin .i { animation: spin .7s var(--ease-out); }
.top__ttl { display: none; }
.top__me { display: inline-flex; align-items: center; gap: var(--sp-10); min-height: 48px; padding: var(--sp-4) var(--sp-12) var(--sp-4) var(--sp-4); border-radius: 99px; background: var(--c-white); box-shadow: inset 0 0 0 1px var(--c-line); max-width: 260px; transition: box-shadow 160ms, background 160ms; }
.top__me:hover { box-shadow: inset 0 0 0 1px var(--c-line-2); background: var(--c-hover); }
.top__me-t { display: grid; min-width: 0; text-align: left; line-height: 1.2; }
.top__me-t b { font-size: var(--fs-14); font-weight: var(--w-med); }
.top__me-t small { font-size: var(--fs-12); color: var(--c-ink-3); }
.top__me-c { width: 14px; height: 14px; color: var(--c-ink-3); flex: none; }
@media (max-width: 1099.98px) { .top__me-t, .top__me-c { display: none; } .top__me { padding: var(--sp-4); } }
@media (max-width: 767.98px) { .navc__b:not(.navc__r) { display: none; } .navc { padding: 0; box-shadow: none; background: none; } }
.top__cart.bump { animation: cartBump 620ms var(--ease-liquid); }
.top__cart.bump .cnt { animation: cntPop 620ms var(--ease-liquid); }
@keyframes cartBump { 0% { transform: scale(1); } 30% { transform: scale(1.32) rotate(-6deg); } 60% { transform: scale(.92); } 100% { transform: scale(1); } }
@keyframes cntPop { 0%, 30% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.cnt--dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: var(--sp-9); right: var(--sp-10); font-size: 0; }
/* busy bar (soft reloads, page changes) */
html.is-busy .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: calc(-1 * var(--sp-1)); height: 2px; background: linear-gradient(90deg, transparent, var(--c-brand), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: busy 900ms linear infinite; }
@keyframes busy { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.top { position: sticky; }

/* account menu */
.pop--me { width: min(320px, calc(100vw - 24px)); padding: var(--sp-8); }
.me { display: flex; align-items: center; gap: var(--sp-12); padding: var(--sp-10) var(--sp-10) var(--sp-12); }
.me__t { display: grid; min-width: 0; line-height: 1.3; }
.me__t b { font-size: var(--fs-15); font-weight: var(--w-med); }
.me__t small { font-size: var(--fs-12); color: var(--c-ink-3); }
.me__t .me__org { color: var(--c-ink-2); margin-top: var(--sp-2); }
.me__disp { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-10); padding: var(--sp-6) var(--sp-10); font-size: var(--fs-13); color: var(--c-ink-2); }
.me__disp .seg button { min-height: 32px; padding: 0 var(--sp-10); }
.pop__i { min-height: 44px; font-size: var(--fs-15); }

/* ---------- pager with labels ---------- */
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-12); align-items: center; padding: var(--sp-14) var(--tile-p); }
.pager__c b { font-weight: var(--w-med); color: var(--c-ink); }
.pager__n { display: flex; align-items: center; gap: var(--sp-10); }
.pager__p { color: var(--c-ink-2); white-space: nowrap; }
.pager__per { display: flex; align-items: center; gap: var(--sp-8); justify-self: end; font-size: var(--fs-13); }
.pager__per .sel { min-height: 38px; width: auto; min-width: 76px; }
@media (max-width: 767.98px) { .pager { grid-template-columns: 1fr; justify-items: center; text-align: center; } .pager__per { justify-self: center; } .pager__p { display: none; } }

/* ---------- themed select, date picker, number stepper ---------- */
.sel__native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; }
.sel { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--sp-10); width: 100%; min-height: 48px; padding: 0 var(--sp-14); border-radius: 14px; background: var(--c-white); box-shadow: inset 0 0 0 1px var(--c-line-2); font-size: var(--fs-15); color: var(--c-ink); text-align: left; transition: box-shadow 160ms, background 160ms; min-width: 0; }
.sel:hover { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c-ink) 28%, transparent); }
.sel:focus-visible, .sel[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px var(--c-brand), 0 0 0 4px var(--c-brand-14); outline: none; }
.sel > .i { width: var(--ic-16); height: var(--ic-16); flex: none; color: var(--c-ink-3); transition: transform 240ms var(--ease-out); }
.sel[aria-expanded="true"] > .i:last-child { transform: rotate(180deg); }
.sel__v { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel__ph { color: var(--c-ink-3); }
.sel.in--sm, .tbar .sel { min-height: 44px; border-radius: 12px; font-size: var(--fs-14); }
.sel:disabled { opacity: .55; pointer-events: none; }
.f.is-err .sel { box-shadow: inset 0 0 0 1.5px var(--c-err); }
.tbar .sel { width: auto; max-width: 240px; }
.pop--sel { padding: var(--sp-6); max-height: min(360px, 60dvh); overflow-y: auto; overscroll-behavior: contain; }
.sel__l { display: grid; gap: var(--sp-2); }
.sel__o { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); min-height: 44px; padding: 0 var(--sp-12); border-radius: 10px; font-size: var(--fs-15); text-align: left; color: var(--c-ink); }
.sel__o span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel__o.hi, .sel__o:focus-visible { background: var(--c-bg-2); outline: none; }
.sel__o.on { font-weight: var(--w-med); }
.sel__o .i { width: var(--ic-16); height: var(--ic-16); color: var(--c-brand); flex: none; }
.datef > .i:first-child { color: var(--c-ink-2); width: var(--ic-18); height: var(--ic-18); }
.pop--dp { padding: var(--sp-12); width: 300px; }
.dp__h { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-8); }
.dp__h b { font-weight: var(--w-med); }
.dp__g { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-2); text-align: center; }
.dp__g > span { font-size: var(--fs-12); color: var(--c-ink-3); padding: var(--sp-6) 0; }
.dp__d { height: 38px; border-radius: 10px; font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.dp__d:hover, .dp__d:focus-visible { background: var(--c-bg-2); outline: none; }
.dp__d.today { box-shadow: inset 0 0 0 1px var(--c-line-2); }
.dp__d.on { background: var(--c-ink); color: var(--c-white); }
.dp__f { display: flex; justify-content: space-between; margin-top: var(--sp-8); padding-top: var(--sp-8); border-top: 1px solid var(--c-line); }
.stepr { position: relative; display: flex; align-items: stretch; }
.stepr .in, .stepr .inw { flex: 1; min-width: 0; }
.stepr .in { padding-right: var(--sp-48); }
.dayoff { margin-bottom: var(--sp-16); }
.dayoff__h { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); margin-bottom: var(--sp-8); }
.dayoff__h b { font-weight: var(--w-med); }
.dayoff__h button, .dayoff__d { display: grid; place-items: center; border-radius: 10px; }
.dayoff__h button { width: 32px; height: 32px; }
.dayoff__w, .dayoff__g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.dayoff__w { margin-bottom: 4px; color: var(--c-ink-3); font-size: var(--fs-12); }
.dayoff__d { height: 36px; }
.dayoff__d:hover { background: var(--c-bg); }
.dayoff__d.on { background: var(--c-ink); color: var(--c-white); }
.dayoff__s { margin: var(--sp-8) 0 0; color: var(--c-ink-2); font-size: var(--fs-13); }
.stepr .inw:has(> .inw__suf) > .in { padding-right: 7.25rem; }
.stepr .inw__suf { right: 48px; max-width: 4.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepr__b { position: absolute; right: var(--sp-6); top: var(--sp-6); bottom: var(--sp-6); display: grid; grid-template-rows: 1fr 1fr; width: 34px; border-radius: 10px; overflow: hidden; background: var(--c-bg); box-shadow: inset 0 0 0 1px var(--c-line); }
.stepr__b button { display: grid; place-items: center; color: var(--c-ink-2); }
.stepr__b button:hover { background: var(--c-bg-2); color: var(--c-ink); }
.stepr__b button + button { border-top: 1px solid var(--c-line); }
.stepr__b .i { width: var(--ic-14); height: var(--ic-14); }

/* ---------- popovers & dropdown boxes ---------- */
.pop { border-radius: 18px; background: var(--c-white); box-shadow: var(--sh-3), 0 0 0 1px var(--c-line); animation: popIn 180ms var(--ease-out); }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- notifications (popover + page) ---------- */
.nf { width: min(400px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.nf__h { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-16) var(--sp-16) var(--sp-10); }
.nf__h b { font-size: var(--fs-16); font-weight: var(--w-med); }
.nf__l { max-height: min(460px, 62dvh); overflow-y: auto; }
.nf--page .nf__l { max-height: none; }
.nf__g { padding: var(--sp-10) var(--sp-16) var(--sp-4); font-size: var(--fs-12); font-weight: var(--w-med); color: var(--c-ink-3); }
.nfi { width: 100%; display: flex; align-items: flex-start; gap: var(--sp-12); padding: var(--sp-12) var(--sp-16); text-align: left; border-radius: 0; position: relative; transition: background 140ms; }
.nfi:hover { background: var(--c-hover); }
.nfi + .nfi { box-shadow: inset 0 1px 0 var(--c-line); }
.nfi__mk { width: 8px; height: 8px; margin: var(--sp-8) var(--sp-4) 0; border-radius: 50%; background: var(--c-line-2); flex: none; }
.nfi__mk--approvals, .nfi__mk--wait { background: var(--c-warn); } .nfi__mk--orders, .nfi__mk--info { background: var(--c-brand); }
.nfi__mk--appointments { background: var(--c-violet); } .nfi__mk--alerts, .nfi__mk--err { background: var(--c-err); } .nfi__mk--ok { background: var(--c-ok); }
.nfi__t { flex: 1; min-width: 0; display: grid; gap: var(--sp-2); }
.nfi__k { font-size: var(--fs-12); color: var(--c-ink-3); }
.nfi__t b { font-weight: var(--w-med); font-size: var(--fs-14); }
.nfi__b { font-size: var(--fs-13); color: var(--c-ink-2); overflow-wrap: anywhere; }
.nfi__u { width: 9px; height: 9px; border-radius: 50%; background: var(--c-brand); flex: none; margin-top: var(--sp-6); }
.nfi:not(.unread) b { font-weight: var(--w-reg); }
.nf__f { padding: var(--sp-10) var(--sp-16) var(--sp-14); border-top: 1px solid var(--c-line); text-align: center; font-size: var(--fs-14); }
.nf__f a { color: var(--c-brand-ink); font-weight: var(--w-med); }

/* ---------- completion mark (order placed, export ready) ---------- */
.okmark { --s: 112px; width: var(--s); height: var(--s); display: grid; place-items: center; border-radius: 50%; background: var(--c-brand); box-shadow: none; position: relative; animation: okIn 620ms var(--ease-liquid) both; }
.okmark::before { content: ""; position: absolute; inset: calc(-1 * var(--sp-10)); border-radius: 50%; background: color-mix(in oklab, var(--c-brand) 16%, transparent); animation: okRing 1400ms var(--ease-out) 200ms both; }
.okmark svg { width: 62%; height: 62%; position: relative; }
.okmark circle { fill: none; stroke: color-mix(in srgb, var(--c-pri-on) 45%, transparent); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: okDraw 700ms var(--ease-out) 120ms forwards; }
.okmark path { fill: none; stroke: var(--c-pri-on); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: okDraw 420ms var(--ease-out) 560ms forwards; }
.okmark--sm { --s: 64px; }
.okmark--sm::before { inset: calc(-1 * var(--sp-6)); }
@keyframes okIn { from { transform: scale(.4); opacity: 0; } }
@keyframes okRing { from { transform: scale(.7); opacity: 0; } 50% { opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
@keyframes okDraw { to { stroke-dashoffset: 0; } }
.xdone { display: grid; justify-items: center; gap: var(--sp-10); text-align: center; padding: var(--sp-18) 0 var(--sp-8); }
.xdone b { font-size: var(--fs-18); font-weight: var(--w-med); }

/* ---------- two-column pages: the shorter side stays in view ---------- */
@media (min-width: 1024px) { .stick { position: sticky; top: calc(var(--top-h) + var(--sp-16)); align-self: start; height: auto !important; } }

/* ---------- tables a little roomier for older eyes ---------- */
.tbl table { font-size: var(--fs-15); }
.tbl th { font-size: var(--fs-13); height: 48px; }
.tbl td { padding: var(--sp-12) var(--sp-14); }
.badge-lg, .bdg { height: 28px; font-size: var(--fs-13); padding: 0 var(--sp-11); }

/* ---------- long data never breaks a layout ---------- */
.ellip, .clip1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cell__t b, .cell__t small { min-width: 0; }
.ph h1 { overflow-wrap: anywhere; }
.dl dd { overflow-wrap: anywhere; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) { .okmark, .okmark::before, .okmark circle, .okmark path, .top__cart.bump, .pop { animation: none !important; } .okmark circle, .okmark path { stroke-dashoffset: 0; } }

/* Patient files on clinic screens (prescription proof). */
.tfile--img { padding: 0; overflow: hidden; border-radius: 10px; line-height: 0; }
.tfile--img img { display: block; max-width: 220px; max-height: 160px; object-fit: cover; }
