/* The patient app. A phone-first shell drawn from the MedPanel v2 employee wireframes (hf-e-*): a top bar, one scrolling
   column of cards, and a bottom tab bar. It reuses the design tokens from styles.css and adds only what the wireframes need. */
.patient { position:fixed; inset:0; display:flex; flex-direction:column; background:var(--bg); color:var(--ink); font-family:var(--font); font-size:14px; line-height:1.45; max-width:560px; margin:0 auto; box-shadow:0 0 0 1px var(--line); }
.patient[hidden] { display:none; }
.patient button { font:inherit; color:inherit; cursor:pointer; }
.patient :focus-visible { outline:2px solid var(--brand); outline-offset:2px; }
.p-bar { display:flex; align-items:center; gap:12px; padding:12px 16px; min-height:56px; background:var(--surface); border-bottom:1px solid var(--line); }
.p-brand { display:flex; align-items:center; gap:10px; font-size:18px; font-weight:700; letter-spacing:-.01em; margin-inline-end:auto; }
.p-brand[hidden], .p-title[hidden], .p-icon[hidden], .p-brand.is-off { display:none; }
.p-mark { width:32px; height:32px; border-radius:9px; background:var(--brand); display:inline-flex; align-items:center; justify-content:center; }
.p-mark svg { width:18px; height:18px; }
.p-title { margin:0; font-size:17px; font-weight:650; flex:none; white-space:nowrap; }
.p-bar-actions { display:flex; gap:8px; margin-inline-start:auto; }
.p-icon, .p-lang { position:relative; min-width:40px; height:40px; padding:0 10px; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.p-icon svg { width:20px; height:20px; }
#p-back { border:0; background:none; margin-inline-start:-8px; }
[dir=rtl] #p-back svg { transform:scaleX(-1); }
.p-dot { position:absolute; top:7px; inset-inline-end:8px; width:8px; height:8px; border-radius:50%; background:var(--bad-ink); }
.p-dot[hidden] { display:none; }
.p-main { flex:1; overflow-y:auto; padding:16px 16px 24px; display:flex; flex-direction:column; gap:14px; outline:none; }
.p-main > * { flex:none; }
.p-tabs { display:grid; grid-template-columns:repeat(4,1fr); background:var(--surface); border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom); }
.p-tab { display:flex; flex-direction:column; align-items:center; gap:3px; padding:9px 4px 8px; border:0; background:none; color:var(--muted); font-size:12px; font-weight:600; min-height:56px; }
.p-tab svg { width:22px; height:22px; }
.p-tab.is-active { color:var(--brand); }
.p-greeting { display:flex; flex-direction:column; color:var(--muted); }
.p-greeting strong { font-size:24px; color:var(--ink); letter-spacing:-.01em; }
.p-hero { border-radius:16px; padding:16px; color:#fff; background:var(--brand-gradient); display:flex; flex-direction:column; gap:6px; }
.p-hero.is-inactive { background:linear-gradient(135deg,#64748b,#334155); }
.p-hero-top { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.p-hero-org { font-weight:600; opacity:.95; }
.p-hero-name { font-size:20px; }
.p-hero-meta { font-size:13px; opacity:.9; }
.p-hero-foot { display:flex; justify-content:space-between; font-size:12.5px; opacity:.92; margin-top:6px; }
.p-hero-why { margin:6px 0 0; font-size:13px; }
.p-hero .p-chip-status { background:rgb(255 255 255 / .18); color:#fff; border:1px solid rgb(255 255 255 / .6); text-transform:uppercase; letter-spacing:.04em; font-size:11px; }
.p-hero .p-dot-i { background:#fff; }
.p-card { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:14px 16px; box-shadow:var(--shadow-xs); display:flex; flex-direction:column; align-items:stretch; gap:10px; text-align:start; width:100%; box-sizing:border-box; font:inherit; color:inherit; }
.p-card h2 { margin:0; font-size:16px; }
button.p-card { background:var(--surface); }
.p-remaining { gap:8px; }
.p-remaining-line { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.p-figure { font-size:22px; letter-spacing:-.01em; font-variant-numeric:tabular-nums; }
.p-muted { color:var(--muted); } .p-faint { color:var(--faint); } .p-small { font-size:12.5px; }
.p-bar-track { height:8px; border-radius:999px; background:var(--sunken); overflow:hidden; }
.p-bar-fill { height:100%; border-radius:999px; background:var(--brand); }
.p-bar-fill.is-high { background:var(--bad-ink); }
.p-banner { display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:14px; border:1px solid var(--brand); background:var(--surface); text-align:start; width:100%; }
.p-banner-icon { width:44px; height:44px; border-radius:12px; background:var(--brand-soft); color:var(--brand); display:inline-flex; align-items:center; justify-content:center; flex:none; }
.p-banner-icon svg { width:22px; height:22px; }
.p-banner-text { display:flex; flex-direction:column; flex:1; min-width:0; color:var(--muted); font-size:12.5px; }
.p-banner-text span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.p-banner .p-chip-status { flex:none; }
.p-banner-text strong { color:var(--ink); font-size:14.5px; }
.p-actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.p-tile { display:flex; flex-direction:column; align-items:flex-start; gap:12px; padding:16px; min-height:84px; background:var(--surface); border:1px solid var(--line); border-radius:14px; font-weight:600; text-align:start; }
.p-tile svg { width:20px; height:20px; color:var(--brand); }
.p-rows { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.p-rows li { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.p-rows li:last-child { border-bottom:0; }
.p-rows .is-total { font-weight:600; }
.p-chip-status { display:inline-flex; align-items:center; gap:6px; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:600; line-height:18px; white-space:nowrap; background:var(--neutral-bg); color:var(--neutral-ink); }
.p-dot-i { width:6px; height:6px; border-radius:50%; background:currentColor; }
.p-chip-status.is-ok { background:var(--ok-bg); color:var(--ok-ink); }
.p-chip-status.is-warn { background:var(--warn-bg); color:var(--warn-ink); }
.p-chip-status.is-bad { background:var(--bad-bg); color:var(--bad-ink); }
.p-section { margin:6px 0 0; font-size:14px; color:var(--ink-2); }
.p-stack { display:flex; flex-direction:column; gap:12px; }
.p-ready { border:1.5px solid var(--brand); gap:6px; }
.p-ready-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.p-ready p { margin:0; }
.p-ready-foot { display:flex; justify-content:space-between; gap:8px; }
.p-person { gap:12px; }
.p-person-head { display:flex; align-items:center; gap:12px; }
.p-person-who { display:flex; flex-direction:column; flex:1; min-width:0; }
.p-avatar { width:40px; height:40px; border-radius:50%; background:var(--brand-soft); color:var(--brand-ink); font-weight:700; font-size:13px; display:inline-flex; align-items:center; justify-content:center; flex:none; }
.p-avatar.is-small { width:34px; height:34px; font-size:11.5px; }
.p-note { display:flex; gap:10px; padding:12px 14px; border-radius:12px; border:1px solid color-mix(in srgb, var(--info) 35%, transparent); background:color-mix(in srgb, var(--info) 8%, var(--surface)); }
.p-note svg { width:20px; height:20px; flex:none; color:var(--info); margin-top:1px; }
.p-note p { margin:2px 0 0; }
.p-note.is-ok { border-color:color-mix(in srgb, var(--ok-ink) 40%, transparent); background:var(--ok-bg); }
.p-note.is-ok svg { color:var(--ok-ink); }
.p-note.is-bad { border-color:color-mix(in srgb, var(--bad-ink) 40%, transparent); background:var(--bad-bg); }
.p-note.is-bad svg { color:var(--bad-ink); }
.p-list { padding:4px 16px; gap:0; }
.p-list-row { display:flex; align-items:center; gap:12px; padding:12px 0; border:0; border-bottom:1px solid var(--line); background:none; text-align:start; width:100%; }
.p-list-row:last-child { border-bottom:0; }
.p-list-text { display:flex; flex-direction:column; flex:1; min-width:0; }
.p-primary, .p-secondary { display:inline-flex; align-items:center; justify-content:center; min-height:48px; padding:0 16px; border-radius:12px; font-weight:650; border:1px solid var(--brand); }
.patient .p-primary { background:var(--brand); color:var(--on-brand); }
.p-primary:disabled { opacity:.6; }
.patient .p-secondary { background:var(--surface); color:var(--ink); border-color:var(--line-strong); }
.p-wide { width:100%; }
.patient .p-link { border:0; background:none; color:var(--brand-ink); font-weight:600; padding:8px 4px; text-decoration:underline; }
.p-inline-actions { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.p-qr-card { align-items:center; text-align:center; gap:12px; }
.p-qr { width:min(260px,70vw); height:min(260px,70vw); image-rendering:pixelated; border-radius:8px; }
.p-code { font-family:var(--mono); font-size:18px; font-weight:700; letter-spacing:.08em; }
.p-expires { display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:10px; background:var(--warn-bg); color:var(--warn-ink); font-weight:600; font-size:13px; }
.p-expires svg { width:18px; height:18px; }
.p-facts { margin:0; display:grid; grid-template-columns:auto 1fr; gap:10px 16px; }
.p-facts dt { color:var(--muted); font-size:14px; font-weight:400; text-transform:none; letter-spacing:0; align-self:center; margin:0; }
.p-facts dd { margin:0; align-self:center; text-align:end; font-weight:600; font-variant-numeric:tabular-nums; }
.p-form { display:flex; flex-direction:column; gap:14px; }
.p-field { display:flex; flex-direction:column; gap:6px; font-weight:600; }
.p-field input, .p-field select, .p-field textarea, .p-search { font:inherit; font-weight:400; min-height:46px; padding:10px 12px; border:1px solid var(--line-strong); border-radius:10px; background:var(--surface); color:var(--ink); width:100%; box-sizing:border-box; }
.p-field textarea { resize:vertical; }
.p-error { color:var(--bad-ink); margin:0; }
.p-empty, .p-loading { color:var(--muted); text-align:center; margin:12px 0; }
.p-segments { display:flex; gap:4px; padding:4px; border-radius:12px; background:var(--sunken); }
.p-segment { flex:1; min-height:38px; border:0; border-radius:9px; background:none; color:var(--muted); font-weight:600; }
.p-segment.is-active { background:var(--surface); color:var(--ink); box-shadow:var(--shadow-xs); }
.p-claim { gap:6px; }
.p-claim p { margin:0; }
.p-pay { display:flex; justify-content:space-between; gap:8px; font-weight:600; font-size:13px; }
.p-signout { margin-top:8px; }
@media (min-width:561px) { .patient { top:16px; bottom:16px; border-radius:20px; overflow:hidden; } body { background:var(--sunken); } }
@media print { .patient { position:static; box-shadow:none; } .p-tabs, .p-bar { display:none; } }

.p-form .p-primary[type=submit] { position:sticky; bottom:0; box-shadow:0 -8px 12px -8px var(--bg), 0 0 0 6px var(--bg); }
.p-ready-head strong, .p-person-who strong { overflow-wrap:anywhere; }

/* ---- Provider app and billing desk (shares the shell above) --------------------------------------------------------- */
.pv-site { color:var(--muted); font-size:12.5px; margin-inline-start:auto; min-width:0; flex:0 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pv-org { min-height:40px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); font:inherit; max-width:150px; }
.pv-org[hidden] { display:none; }
.patient .pv-scan { gap:10px; }
.pv-scan svg { width:20px; height:20px; }
.pv-stat { align-items:flex-start; text-align:start; }
.pv-stage { position:relative; height:300px; border-radius:16px; overflow:hidden; background:#0b1220; display:flex; align-items:flex-end; justify-content:center; }
.pv-stage video { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.pv-frame { position:absolute; inset:36px 54px 56px; border:3px solid var(--brand); border-radius:20px; }
.pv-hint { position:relative; z-index:1; margin:0 0 18px; color:#fff; font-size:13.5px; text-shadow:0 1px 3px rgb(0 0 0 / .6); }
.pv-entry { display:flex; flex-direction:column; gap:10px; }
.pv-entry input { font:inherit; min-height:46px; padding:10px 12px; border:1px solid var(--line-strong); border-radius:10px; background:var(--surface); color:var(--ink); }
.pv-lines { gap:0; }
.pv-line { gap:12px; }
.pv-line-text { display:flex; flex-direction:column; flex:1; min-width:0; }
.pv-qty { width:64px; min-height:44px; text-align:center; font:inherit; border:1px solid var(--line-strong); border-radius:10px; background:var(--surface); color:var(--ink); }
.pv-drop { position:relative; display:flex; flex-direction:column; align-items:center; gap:4px; padding:18px; border:1.5px dashed var(--line-strong); border-radius:12px; text-align:center; cursor:pointer; }
.pv-drop svg { width:28px; height:28px; color:var(--brand); }
.pv-file { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; }
.pv-done { align-self:center; width:72px; height:72px; border-radius:50%; background:var(--brand-soft); color:var(--brand); display:flex; align-items:center; justify-content:center; margin-top:12px; }
.pv-done svg { width:34px; height:34px; }
.pv-done-text { text-align:center; } .pv-done-text h2 { margin:0 0 4px; font-size:22px; }
.pv-ref { font-family:var(--mono); font-size:12.5px; }
.pv-amount { text-align:end; font-variant-numeric:tabular-nums; }
.pv-desk-head h2 { margin:2px 0; font-size:22px; } .pv-desk-head p { margin:0; }
.pv-stats { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.pv-stats .pv-stat { gap:4px; }
.pv-table { display:none; }
.pv-results { display:flex; flex-direction:column; gap:12px; }
.pv-cards { display:flex; flex-direction:column; gap:12px; }

/* Desktop: the tabs become a sidebar and Claims becomes the billing desk table. */
@media (min-width:900px) {
  .patient.provider { max-width:none; margin:0; top:0; bottom:0; border-radius:0; display:grid; grid-template-columns:220px minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
  .provider .p-bar { grid-column:1 / -1; }
  .provider .p-brand.is-off { display:flex; }
  .provider .p-title, .provider .p-back { display:none; }
  .provider .p-bar .pv-site { margin-inline-start:auto; }
  .provider .p-tabs { grid-column:1; grid-row:2; display:flex; flex-direction:column; gap:4px; padding:12px; border-top:0; border-inline-end:1px solid var(--line); align-content:flex-start; }
  .provider .p-tab { flex-direction:row; justify-content:flex-start; gap:10px; min-height:42px; padding:0 12px; border-radius:10px; font-size:14px; }
  .provider .p-tab.is-active { background:var(--brand-soft); }
  .provider .p-main { grid-column:2; grid-row:2; padding:24px 32px; }
  .provider .p-main > * { max-width:1120px; }
  .provider .pv-stats { grid-template-columns:repeat(4,1fr); }
  .provider .pv-cards { display:none; }
  .provider .pv-table { display:table; width:100%; border-collapse:collapse; background:var(--surface); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
  .provider .pv-table th { text-align:start; font-size:12px; font-weight:600; color:var(--muted); padding:10px 14px; background:var(--surface-2); border-bottom:1px solid var(--line); }
  .provider .pv-table td { padding:12px 14px; border-bottom:1px solid var(--line); }
  .provider .pv-table tbody tr { cursor:pointer; } .provider .pv-table tbody tr:hover { background:var(--surface-2); }
  .provider .p-segments { max-width:420px; }
  .provider .p-search { max-width:none; }
}
@media (max-width:899px) { .pv-desk-head { display:none; } .pv-stats { display:none; } }
