/* The iPhone visit flow (ios-visit.js) on phones up to 760px with html.ios: the Start a Visit sheet, the full-screen dark capture,
   the leave action sheet and red pill, the checklist after Stop, Note & sign with the Undo banner, the signed note, the transcript
   and Now Playing bar, the Audio segment, documents, Genie's listening pill and low bar, shared audio and the mic check.
   Apple HIG structure in DocVoc colours: every colour comes from tokens.css (iOS green only on switches). Android, the wide web and
   the desktop never show any of it (the elements stay hidden and the sheets only open on iPhones). */
.iv-rec,.iv-saved,.iv-progress,.iv-read,.iv-player,.iv-docs,.iv-listen,.iv-genie-chip,.iv-nav-back,.iv-nav-action,#iv-tab-audio,.iv-audio-pane,.iv-docs-group,.iv-addendum-group,.iv-note-rows{display:none}
.iv-icon{width:20px;height:20px;flex-shrink:0}
:root{--ios-switch:#34c759;--ios-separator:color-mix(in srgb,var(--ink) 12%,transparent);--ios-fill:color-mix(in srgb,var(--ink) 8%,transparent)}
:root[data-theme="dark"]{--ios-switch:#30d158}
/* ---- Sheets, action sheets and the full screens (first run) ---- */
dialog.iv-sheet{margin:auto 0 0;width:100%;max-width:none;max-height:calc(100dvh - var(--safe-top,0px) - 10px);padding:0 16px calc(16px + var(--safe-bottom,0px));border:0;border-radius:14px 14px 0 0;background:var(--app-bg);color:var(--ink);box-shadow:var(--shadow-dialog);display:flex;flex-direction:column;gap:10px;overflow:auto;overscroll-behavior:contain;transition:transform var(--motion-fast) var(--ease)}
dialog.iv-sheet:not([open]),dialog.iv-actions:not([open]),dialog.iv-full:not([open]){display:none}
dialog.iv-sheet::backdrop,dialog.iv-actions::backdrop{background:var(--backdrop)}
dialog.iv-sheet:focus,dialog.iv-actions:focus{outline:none}
.iv-grabber{position:relative;flex-shrink:0;width:36px;height:5px;margin:6px auto 0;border-radius:3px;background:var(--disabled);touch-action:none}
.iv-sheet-nav{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;min-height:44px;touch-action:none}
.iv-sheet-nav h2{margin:0;font-size:var(--text-card);font-weight:600;letter-spacing:0;text-align:center;white-space:nowrap}
.iv-sheet-nav .iv-right{justify-self:end}.iv-sheet-nav .iv-left{justify-self:start}
.iv-nav-text{min-height:44px;padding:0 4px;border:0;background:transparent;color:var(--accent-text);font-size:var(--text-card);font-weight:400}
.iv-nav-text:hover{background:transparent;color:var(--accent-text-hover)}
.iv-nav-text.iv-right{font-weight:600}
dialog.iv-actions{margin:auto auto 0;width:min(100%,430px);max-width:none;padding:0 8px calc(8px + var(--safe-bottom,0px));border:0;background:transparent;box-shadow:none;display:flex;flex-direction:column;gap:8px;overflow:visible}
.iv-action-group{display:flex;flex-direction:column;border-radius:14px;background:var(--popover);overflow:hidden}
.iv-action-head{padding:14px 16px 12px;text-align:center;border-bottom:1px solid var(--ios-separator)}
dialog .iv-action-head p{margin:0}
.iv-action-title{font-size:var(--text-secondary);font-weight:600;color:var(--hint)}
.iv-action-message{font-size:var(--text-secondary);color:var(--hint);line-height:1.4;margin-top:2px}
.iv-action,.iv-action-cancel{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:center;gap:0 8px;min-height:56px;width:100%;padding:12px 16px;border:0;border-radius:0;background:var(--popover);color:var(--accent-text);font-size:19px;font-weight:400;text-align:center}
.iv-action+.iv-action{border-top:1px solid var(--ios-separator)}
.iv-action:hover,.iv-action-cancel:hover{background:var(--row-highlight);border-color:transparent}
.iv-action strong{font-weight:400}
.iv-action small{font-size:var(--text-meta);color:var(--hint)}
.iv-action.danger{color:var(--danger)}
.iv-action-cancel{border-radius:14px;font-weight:600}
dialog.iv-full{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:calc(var(--safe-top,0px) + 20px) 16px calc(var(--safe-bottom,0px) + 20px);border:0;border-radius:0;background:var(--app-bg);color:var(--ink);display:flex;flex-direction:column;gap:14px;overflow:auto}
dialog.iv-full::backdrop{background:var(--app-bg)}
.iv-large{margin:0;font-size:34px;line-height:1.15;font-weight:700;letter-spacing:-.02em;color:var(--ink)}
.iv-subtitle{margin:-6px 0 0;font-size:var(--text-note);line-height:1.45;color:var(--hint)}
dialog p.iv-subtitle{margin-bottom:0}
.iv-note{margin:0;font-size:var(--text-secondary);line-height:1.45;color:var(--hint)}
dialog p.iv-note{margin-bottom:0}
.iv-note[hidden]{display:none}
.iv-section{margin:10px 16px -4px;font-size:var(--text-secondary);font-weight:400;letter-spacing:.02em;text-transform:uppercase;color:var(--hint)}
dialog p.iv-section{margin-bottom:-4px}
/* ---- Grouped inset lists ---- */
.iv-group{display:flex;flex-direction:column;border-radius:12px;background:var(--card);overflow:hidden;flex-shrink:0}
.iv-group[hidden]{display:none}
.iv-group.iv-docs-group,.iv-group.iv-addendum-group{display:none} /* iPhone-only rows: shown by the phone rules below, never on a wide iPad layout */
.iv-group>*+*{box-shadow:inset 16px 1px 0 var(--card),inset 0 1px 0 var(--ios-separator)}
.iv-row,.iv-check,.iv-pick{display:flex;align-items:center;justify-content:flex-start;gap:12px;width:100%;min-height:48px;padding:10px 14px 10px 16px;border:0;border-radius:0;background:var(--card);color:var(--ink);font-size:var(--text-card);font-weight:400;text-align:left}
.iv-row:hover,.iv-check:hover,.iv-pick:hover{background:var(--row-highlight);border-color:transparent}
.iv-row-copy{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.iv-row-copy strong{font-size:var(--text-card);font-weight:400;line-height:1.3;overflow:hidden;text-overflow:ellipsis}
.iv-row-copy small{font-size:var(--text-secondary);line-height:1.35;color:var(--hint)}
.iv-row-copy small:empty{display:none}
.iv-row-value{font-size:var(--text-card);color:var(--hint)}
.iv-row>.iv-icon{width:16px;height:16px;color:var(--disabled)}
.iv-row-link .iv-row-copy strong{color:var(--accent-text)}
.iv-row-danger .iv-row-copy strong{color:var(--danger)}
.iv-check>.iv-icon{width:22px;height:22px;color:var(--accent-text);visibility:hidden}
.iv-check[aria-checked=true]>.iv-icon{visibility:visible}
.iv-link{min-height:44px;padding:0 4px;border:0;background:transparent;color:var(--accent-text);font-size:var(--text-card);font-weight:400}
.iv-link:hover{background:transparent;color:var(--accent-text-hover)}
.iv-avatar{width:44px;height:44px;flex:0 0 44px;border-radius:50%;display:grid;place-items:center;background:var(--accent-surface);color:var(--accent-strong);font-weight:600;font-size:var(--text-note)}
.iv-avatar.small{width:32px;height:32px;flex-basis:32px;font-size:var(--text-meta)}
.iv-patient{flex-direction:row;align-items:center;gap:12px;padding:12px 12px 12px 14px}
.iv-patient>*,.iv-file>*,.iv-progress-card>*,.iv-audio-card>*,.iv-level-card>*,.iv-terms-card>*,.iv-doc-card>*{box-shadow:none!important}
.iv-patient .iv-row-copy strong{font-size:19px;font-weight:600}
.iv-picker{display:flex;flex-direction:column;gap:8px}
.iv-picker[hidden]{display:none}
label.iv-search,.iv-search{display:flex;flex-direction:row;align-items:center;gap:6px;height:38px;padding:0 10px;border-radius:10px;background:var(--ios-fill);color:var(--hint);margin:0;font-size:var(--text-card);font-weight:400;letter-spacing:0;text-transform:none}
.iv-search .iv-icon{width:18px;height:18px}
.iv-search[hidden]{display:none}
.iv-search input{flex:1;min-width:0;height:36px;padding:0;border:0;background:transparent;color:var(--ink);font-size:var(--text-card);box-shadow:none}
.iv-search input:focus-visible{box-shadow:none;border:0}
.iv-picker-list{max-height:32dvh;overflow:auto}
.iv-pick.selected{color:var(--accent-text);font-weight:600}
.iv-pick>.iv-icon{margin-left:auto;color:var(--accent-text)}
.iv-switch-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;padding:4px 14px 4px 16px;font-size:var(--text-card)}
.iv-switch-row[hidden]{display:none}
.iv-switch{position:relative;flex:0 0 auto;width:51px;height:31px;min-height:0;padding:2px;border:0;border-radius:999px;background:var(--ios-fill);display:flex;justify-content:flex-start;transition:background var(--motion-fast) var(--ease)}
.iv-switch::after{content:'';position:absolute;inset:-7px -4px}
.iv-switch:hover{background:var(--ios-fill)}
.iv-switch i{width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 2px 6px #0003;transition:transform var(--motion-fast) var(--ease)}
.iv-switch[aria-checked=true],.iv-switch[aria-checked=true]:hover{background:var(--ios-switch)}
.iv-switch[aria-checked=true] i{transform:translateX(20px)}
.iv-start,.iv-wide{width:100%;flex:0 0 auto;min-height:50px;border-radius:12px;font-size:var(--text-card);font-weight:600;gap:8px}
.iv-start .iv-icon{width:18px;height:18px}
.iv-chip{display:inline-flex;align-items:center;gap:6px;min-height:30px;padding:0 12px;border-radius:999px;background:var(--ios-fill);color:var(--ink);font-size:var(--text-secondary);font-weight:500}
.iv-capsules{display:flex;flex-wrap:wrap;gap:10px}
.iv-capsule{min-height:40px;padding:0 16px;border:0;border-radius:999px;background:var(--accent-tint);color:var(--accent-text);font-size:var(--text-note);font-weight:600}
.iv-capsule:hover{background:var(--accent-tint-hover);border-color:transparent}
.iv-capsule.primary{background:var(--accent);color:var(--on-accent);flex:0 0 auto}
.iv-capsule.iv-danger{background:var(--danger-bg);color:var(--danger)}
.iv-mono{font-family:var(--font-mono);font-size:var(--text-meta);color:var(--hint);font-variant-numeric:tabular-nums}
.iv-file{flex-direction:row;align-items:center;gap:14px;padding:12px}
.iv-file-icon{width:44px;height:44px;flex:0 0 44px;border-radius:10px;display:grid;place-items:center;background:var(--ios-fill);color:var(--accent-text)}
.iv-mic-actions{display:flex;flex-direction:column;align-items:stretch;gap:8px;margin-top:auto}
.iv-mic-actions [hidden]{display:none}
.iv-level-card{padding:12px 16px 14px;gap:10px}
.iv-level-card .iv-section{margin:0}
.iv-level{display:flex;align-items:center;gap:3px;height:56px}
.iv-level i{flex:1;height:15%;min-height:4px;border-radius:2px;background:var(--accent);transition:height 80ms linear}
.iv-mic-status{margin:0;font-size:var(--text-secondary);color:var(--signed-text)}
.iv-mic-chips{display:flex;flex-wrap:wrap;gap:8px}
.iv-mic-chips:empty{display:none}
.iv-bt{color:var(--accent-text)}.iv-bt .iv-icon{width:16px;height:16px}
#iv-mic-clip{width:100%}
.iv-terms-card{padding:14px 16px;gap:10px}
.iv-terms-text{margin:0;font-size:var(--text-note);line-height:1.55;color:var(--body)}
/* ---- Phone layout, iOS only ---- */
@media(max-width:760px){
/* The old in-page recorder and Android's pieces give way to the iPhone flow. */
:root.ios #phone-recorder,:root.ios #phone-template-chip{display:none!important}
:root.ios body.iv-visit #phone-tabs,:root.ios body.iv-recording #phone-tabs{display:none}
:root.ios body.iv-visit{--tabbar:var(--safe-bottom,0px)}
:root.ios .iv-genie-chip:not([hidden]){display:inline-flex;align-items:center;min-height:26px;padding:0 10px;border-radius:999px;background:var(--accent-tint);color:var(--accent-text);font-size:var(--text-meta);font-weight:500;white-space:nowrap}
:root.ios .workspace-header>.iv-genie-chip:not([hidden]){align-self:center;flex-shrink:0}
:root.iosb .workspace-header>.iv-genie-chip:not([hidden]){grid-area:2/2/3/3;justify-self:end;position:relative;z-index:1}
:root.iosb .workspace-header:has(.ios-bar-bottom>:not([hidden]))>.iv-genie-chip:not([hidden]){grid-area:3/1/4/3;justify-self:start;margin-top:6px}
/* ---- 02 Recording: full-screen dark capture ---- */
:root.ios .iv-rec:not([hidden]){display:flex;position:fixed;inset:0;z-index:30;flex-direction:column;background:var(--recorder);color:var(--recorder-text);padding:var(--safe-top,0px) 0 calc(var(--safe-bottom,0px) + 24px)}
.iv-rec-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:0 16px}
.iv-rec-done{min-height:44px;padding:0 4px;border:0;background:transparent;color:color-mix(in srgb,var(--accent) 55%,#fff);font-size:var(--text-card);font-weight:600}
.iv-rec-done:hover{background:transparent;color:#fff}
.iv-rec-who{min-height:44px;min-width:0;padding:0 2px;border:0;background:transparent;color:var(--recorder-muted);font-size:var(--text-note);font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iv-rec-who:hover{background:transparent;color:var(--recorder-text)}
.iv-rec-main{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;padding:0 20px;min-height:0}
.iv-clock{font-family:var(--font-mono);font-size:var(--text-phone-clock);font-weight:500;line-height:1;letter-spacing:.02em;color:var(--on-accent);font-variant-numeric:tabular-nums}
.iv-rec.paused .iv-clock{color:var(--recorder-muted)}
.iv-rec-bars{display:flex;align-items:center;justify-content:center;gap:5px;height:64px;width:100%;max-width:300px}
.iv-rec-bars i{flex:1;max-width:5px;height:15%;border-radius:3px;background:var(--level);transition:height 110ms linear}
.iv-rec.paused .iv-rec-bars i{height:8%!important;background:var(--recorder-muted);opacity:.5}
.iv-rec-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.iv-rec .iv-chip{background:color-mix(in srgb,var(--recorder-text) 14%,transparent);color:var(--recorder-text);border:0}
.iv-rec .iv-chip.offline{background:color-mix(in srgb,var(--review-dot) 30%,transparent);color:var(--on-accent)}
.iv-rec .iv-chip.pulse{animation:iv-pulse .6s var(--ease)}
@keyframes iv-pulse{0%{transform:scale(1)}40%{transform:scale(1.12)}100%{transform:scale(1)}}
.iv-rec-status{margin:0;font-size:var(--text-secondary);color:var(--recorder-muted);text-align:center}
.iv-rec-alert{margin:0;padding:8px 12px;border-radius:10px;background:color-mix(in srgb,var(--recording-red) 22%,transparent);color:var(--recorder-danger);font-size:var(--text-secondary);text-align:center}
.iv-rec-alert[hidden]{display:none}
.iv-transport{display:flex;align-items:flex-start;justify-content:center;gap:34px;padding:0 20px}
/* Stop and delete (journeys-17): a line of text under the transport, not a fourth ring beside Stop. */
.iv-stop-delete{align-self:center;flex:0 0 auto;min-height:0;margin-top:22px;padding:8px 14px;border:0;border-radius:10px;background:transparent;color:var(--recorder-muted);font-size:var(--text-meta);font-weight:500;text-decoration:underline;text-underline-offset:3px}
.iv-stop-delete:hover,.iv-stop-delete:focus-visible{background:color-mix(in srgb,var(--recorder-danger) 16%,transparent);color:var(--recorder-danger)}
.iv-ctl{display:flex;flex-direction:column;align-items:center;gap:8px}
.iv-ctl-label{font-size:var(--text-meta);color:var(--recorder-muted)}
.iv-round{width:56px;height:56px;min-height:0;margin-top:11px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--recorder-text) 16%,transparent);color:var(--on-accent)}
.iv-round:hover{background:color-mix(in srgb,var(--recorder-text) 24%,transparent);border-color:transparent}
.iv-round .iv-icon{width:24px;height:24px}
.iv-round[aria-pressed=true]{background:var(--on-accent);color:var(--recorder)}
.iv-stop{width:78px;height:78px;min-height:0;padding:0;border:3px solid var(--recorder-text);border-radius:50%;background:transparent}
.iv-stop:hover{background:color-mix(in srgb,var(--recorder-text) 10%,transparent);border-color:var(--on-accent)}
.iv-stop-square{display:block;width:32px;height:32px;border-radius:8px;background:var(--recording-red)}
.iv-rec :is(button):focus-visible{outline-color:var(--on-accent)}
/* ---- 19 Leave while recording: the red pill; the leave guard as an action sheet ---- */
:root.ios body.iv-away #phone-pill:not([hidden]){order:-1;align-self:center;margin:calc(var(--safe-top,0px) + 6px) auto 0;min-height:30px;padding:3px 14px;border:0;background:var(--recording-red);color:var(--on-recording-red);font-size:var(--text-secondary);font-weight:600;box-shadow:0 4px 14px color-mix(in srgb,var(--recording-red) 35%,transparent)}
:root.ios body.iv-away #phone-pill .ph-pill-icon{color:var(--on-recording-red)!important}
:root.ios body.iv-away #phone-pill.paused{background:var(--ink);color:var(--card)}
:root.ios body.iv-away #phone-pill.paused .ph-pill-icon{color:var(--card)!important}
:root.ios body:is(.iv-away,.iv-saved-on) .workspace-header{padding-top:8px}
:root.ios .iv-saved:not([hidden]){order:-1;display:flex;align-items:center;gap:8px;align-self:center;max-width:calc(100% - 24px);margin:calc(var(--safe-top,0px) + 6px) auto 0;min-height:32px;padding:2px 4px 2px 14px;border-radius:999px;background:var(--review-bg);color:var(--review-text);font-size:var(--text-secondary);font-weight:600;cursor:pointer}
.iv-saved .iv-dot{width:8px;height:8px;flex:0 0 8px;border-radius:50%;background:var(--review-dot)}
.iv-saved-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iv-saved-open{min-height:32px;padding:0 8px;border:0;background:transparent;color:var(--review-text);font-weight:700;text-decoration:underline;text-underline-offset:3px}
.iv-saved-close{width:32px;height:32px;min-height:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--review-text)}
.iv-saved-close .iv-icon{width:16px;height:16px}
.iv-saved button:hover{background:transparent;border-color:transparent}
:root.ios #recording-guard.iv-guard{margin:auto auto 0;width:min(100%,430px);max-width:none;padding:0 8px calc(8px + var(--safe-bottom,0px));border:0;background:transparent;box-shadow:none;overflow:visible}
:root.ios #recording-guard.iv-guard .dialog-body{display:flex;flex-direction:column;gap:0;background:transparent;overflow:visible}
:root.ios #recording-guard.iv-guard h2{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
:root.ios #recording-guard.iv-guard p{margin:0;padding:14px 18px 12px;border-radius:14px 14px 0 0;background:var(--popover);font-size:var(--text-secondary);line-height:1.4;color:var(--hint);text-align:center;border-bottom:1px solid var(--ios-separator)}
:root.ios #recording-guard.iv-guard .dialog-actions{display:flex;flex-direction:column;align-items:stretch;gap:0;margin:0}
:root.ios #recording-guard.iv-guard .dialog-actions button{min-height:56px;margin:0;border:0;border-radius:0;background:var(--popover);color:var(--accent-text);font-size:19px;font-weight:400;box-shadow:none}
:root.ios #recording-guard.iv-guard .dialog-actions button:hover{background:var(--row-highlight)}
:root.ios #recording-guard.iv-guard #guard-keep{order:1}
:root.ios #recording-guard.iv-guard #guard-stop{order:2;border-top:1px solid var(--ios-separator);border-radius:0 0 14px 14px}
:root.ios #recording-guard.iv-guard #guard-stay{order:3;margin-top:8px;border-radius:14px;font-weight:600;box-shadow:0 0 0 8px transparent}
/* ---- 11 After stop: large title, the progress card and the checklist ---- */
:root.ios .iv-progress:not([hidden]){display:flex;flex-direction:column;gap:14px;flex-shrink:0}
/* The shared pager (paging.js) may have moved the screen's content into a .pg-flow: hide the visit either way. */
:root.ios #encounter-page.iv-processing>:not(#iv-progress,#patient-matches,.pg-viewport,.pager),
:root.ios #encounter-page.iv-processing .pg-flow>:not(#iv-progress,#patient-matches){display:none}
:root.ios #encounter-page.iv-peek #iv-progress{order:-1}
.iv-progress-card{padding:14px 16px;gap:10px}
.iv-progress-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.iv-progress-top strong{font-size:var(--text-card);font-weight:600;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iv-pct{font-family:var(--font-mono);font-size:var(--text-secondary);color:var(--hint);font-variant-numeric:tabular-nums}
.iv-bar{position:relative;height:4px;border-radius:2px;background:var(--ios-fill);overflow:hidden}
.iv-bar i{position:absolute;left:0;top:0;bottom:0;width:0;border-radius:2px;background:var(--accent);transition:width var(--motion-slow) var(--ease)}
.iv-bar.indeterminate i{width:35%;animation:iv-slide 1.4s var(--ease) infinite}
@keyframes iv-slide{0%{left:-35%}100%{left:100%}}
.iv-progress-where{font-size:var(--text-meta);color:var(--hint);line-height:1.4}
.iv-steps{margin:0;padding:0;list-style:none}
.iv-step{display:flex;align-items:center;gap:14px;min-height:60px;padding:10px 16px}
.iv-step-mark{position:relative;width:24px;height:24px;flex:0 0 24px;border-radius:50%;display:grid;place-items:center;background:var(--ios-fill);color:var(--on-accent)}
.iv-step-mark .iv-icon{width:14px;height:14px;stroke-width:3}
.iv-step.done .iv-step-mark{background:var(--signed-dot)}
.iv-step.active .iv-step-mark{background:var(--accent)}
.iv-step.active .iv-step-mark::after{content:'';position:absolute;inset:-4px;border-radius:50%;border:2px solid var(--accent);opacity:.4;animation:iv-breathe 1.6s var(--ease) infinite}
@keyframes iv-breathe{0%,100%{transform:scale(.9);opacity:.5}50%{transform:scale(1.1);opacity:.15}}
.iv-step.error .iv-step-mark{background:var(--danger)}
.iv-step.error .iv-step-mark::before{content:'!';font-weight:700;font-size:14px}
.iv-step.waiting .iv-step-mark{background:var(--review-dot)}
.iv-step.todo .iv-row-copy strong{color:var(--muted)}
.iv-step .iv-row-copy strong{font-size:var(--text-card)}
/* ---- The visit's nav bar: back, the patient, one action; segmented Note · Transcript · Audio ---- */
:root.ios body.iv-visit .workspace-header{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:4px;min-height:calc(var(--safe-top,0px) + 44px);padding:var(--safe-top,0px) 8px 0;background:color-mix(in srgb,var(--app-bg) 88%,transparent);-webkit-backdrop-filter:saturate(1.6) blur(18px);backdrop-filter:saturate(1.6) blur(18px);border-bottom:1px solid var(--ios-separator)}
:root.ios body.iv-visit .iv-nav-back{display:inline-flex;grid-column:1;justify-self:start;align-items:center;gap:2px;min-height:44px;max-width:100%;padding:0 6px 0 0;border:0;background:transparent;color:var(--accent-text);font-size:var(--text-card);font-weight:400;overflow:hidden;white-space:nowrap}
:root.ios body.iv-visit .iv-nav-back .iv-icon{width:24px;height:24px}
:root.ios body.iv-visit .iv-nav-back:hover{background:transparent}
:root.ios body.iv-visit .phone-heading{grid-column:2;align-items:center;min-width:0;max-width:52vw}
:root.ios body.iv-visit #phone-title{font-size:var(--text-card);font-weight:600;letter-spacing:0;line-height:1.3}
:root.ios body.iv-visit #phone-subtitle,:root.ios body.iv-visit #account-mobile,:root.ios body.iv-visit #phone-add,:root.ios body.iv-visit #phone-menu,:root.ios body.iv-visit .iv-genie-chip{display:none}
:root.ios body.iv-visit .workspace-header .toolbar{grid-column:3;justify-self:end;margin:0;gap:4px}
:root.ios body.iv-visit .iv-nav-action:not([hidden]){display:inline-flex;min-height:44px;min-width:44px;padding:0 8px;border:0;background:transparent;color:var(--accent-text);font-size:var(--text-card);font-weight:400}
:root.ios body.iv-visit .iv-nav-action .iv-icon{width:22px;height:22px}
:root.ios body.iv-visit .iv-nav-action:hover{background:transparent}
:root.ios body.iv-visit #encounter-page{padding-top:12px}
:root.ios body.iv-visit #phone-chips{display:none}
:root.ios .tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:0;padding:2px;border-radius:9px;background:var(--ios-fill)}
:root.ios #tab-documents{display:none}
:root.ios #iv-tab-audio{display:inline-flex;order:2}
:root.ios .tabs button{height:32px;min-height:0;padding:0 8px;border:0;border-radius:7px;background:transparent;color:var(--ink);font-size:var(--text-secondary);font-weight:500;box-shadow:none}
:root.ios .tabs button:hover{background:transparent}
:root.ios .tabs button[aria-selected=true]{background:var(--card);color:var(--ink);font-weight:600;box-shadow:0 1px 3px #0000001f,0 0 0 .5px #0000000a}
:root.ios body.iv-visit[data-iv-tab=documents] .editor-toolbar{display:none}
:root.ios #encounter-page.ph-signed .editor-tools{display:none}
:root.ios #encounter-page #generate{min-height:34px;padding:0 14px;border:0;border-radius:999px;background:var(--accent-tint);color:var(--accent-text);font-weight:600}
:root.ios .iv-audio-pane:not([hidden]){display:flex;flex-direction:column;gap:10px;padding-top:12px}
.iv-audio-card{padding:14px 16px;gap:6px}
.iv-audio-head{display:flex;align-items:center;gap:10px}
.iv-audio-head strong{flex:1;font-size:var(--text-card);font-weight:600}
.iv-audio-head .iv-icon{color:var(--accent-text)}
/* ---- 04 Note & sign: the draft banner, sections in one inset card, the Sign bar, the Undo banner ---- */
:root.ios .note-actions{border-radius:999px;padding:8px 14px;background:var(--review-bg);box-shadow:0 -12px 0 var(--app-bg)}
:root.ios .note-actions .review-banner::before{content:'';display:inline-block;width:7px;height:7px;margin-right:8px;border-radius:50%;background:var(--review-dot);vertical-align:1px}
:root.ios .note-actions.is-signed{background:var(--signed-bg)}
:root.ios .note-actions.is-signed .review-banner::before{background:var(--signed-dot)}
:root.ios #edit-note{display:none}
/* The card's ground is rounded, its sections have none of their own: no clipping is needed, and clipping would hide the
   note's tail from the pager instead of letting it turn a page (owner, 16 Sept 2026). */
:root.ios #note-preview.note-prose{border-radius:12px;background:var(--card);overflow:visible}
:root.ios #note-preview.note-prose section{margin:0;border:0;border-radius:0;background:transparent;padding:2px 16px 14px}
:root.ios #note-preview.note-prose section+section{box-shadow:inset 16px 1px 0 var(--card),inset 0 1px 0 var(--ios-separator)}
:root.ios #note-preview .section-tab{font-family:var(--font-sans);font-size:var(--text-note);font-weight:600;letter-spacing:0;text-transform:none}
:root.ios .iv-addendum-group:not([hidden]),:root.ios .iv-docs-group{display:flex;margin:0}
/* The pinned block that carries them: it borrows .note-actions only so the pager pins it, never its pill look. */
:root.ios .iv-note-rows{display:flex;flex-direction:column;align-items:stretch;gap:8px;margin:0 0 12px;padding:0;border-radius:0;background:transparent;box-shadow:none}
:root.ios .iv-note-rows:not(:has(>:not([hidden]))){display:none}
:root.ios #encounter-page .document-footer{bottom:0;padding:10px 16px calc(10px + var(--safe-bottom,0px));background:color-mix(in srgb,var(--card) 90%,transparent);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}
:root.ios #encounter-page.ph-signed .document-footer{display:none}
:root.ios #encounter-page.ph-signed{padding-bottom:calc(var(--safe-bottom,0px) + 20px)}
:root.ios body.iv-visit:is([data-iv-tab=documents],[data-iv-tab=audio]) .document-footer{display:none}
:root.ios body.iv-quick #clinical-dialog{visibility:hidden}
:root.ios body.iv-quick #clinical-dialog::backdrop{background:transparent}
/* The Undo banner: an iOS banner above the Sign bar, like Undo Send (not a Material snackbar). */
:root.ios #sign-snackbar{left:12px;right:12px;bottom:calc(var(--safe-bottom,0px) + 84px);transform:none;min-width:0;max-width:none;gap:12px;padding:12px 8px 12px 16px;border-radius:14px;background:color-mix(in srgb,var(--popover) 86%,transparent);color:var(--ink);border:1px solid var(--ios-separator);-webkit-backdrop-filter:saturate(1.8) blur(20px);backdrop-filter:saturate(1.8) blur(20px);box-shadow:0 10px 30px #0000002e;font-size:var(--text-note);font-weight:600;overflow:hidden}
:root.ios #sign-snackbar .snackbar-text::before{content:'';display:inline-block;width:8px;height:8px;margin-right:10px;border-radius:50%;background:var(--signed-dot);vertical-align:1px}
:root.ios #sign-snackbar .snackbar-action{height:36px;min-height:36px;padding:0 12px;border-radius:999px;background:var(--accent-tint);color:var(--accent-text);font-weight:600}
:root.ios #sign-snackbar .snackbar-time{height:2px;opacity:.8}
/* ---- 12 Transcript: speaker turns in one card, markers, Find; the Now Playing bar ---- */
:root.ios #transcript-pane.iv-reading>:not(.iv-read,#kept-audio,.pg-viewport,.pager),
:root.ios #transcript-pane.iv-reading .pg-flow>:not(.iv-read){display:none}
:root.ios #transcript-pane.iv-reading #kept-audio{display:none}
:root.ios .iv-read:not([hidden]){display:flex;flex-direction:column;gap:10px}
.iv-read-body{display:flex;flex-direction:column;gap:10px}
.iv-read-body>.iv-section{margin-top:4px}
.iv-turn{display:flex;flex-direction:column;gap:4px;padding:12px 16px}
.iv-turn-label{display:flex;align-items:baseline;gap:8px;margin:0;font-size:var(--text-secondary)}
.iv-turn-label strong{font-weight:600;color:var(--ink)}
.iv-turn-text{margin:0;font-size:var(--text-note);line-height:1.5;color:var(--body)}
.iv-para{padding:12px 16px}
.iv-turns mark,.iv-read mark{background:var(--highlight);color:inherit;border-radius:3px}
.iv-find-count{font-size:var(--text-meta);color:var(--hint);white-space:nowrap}
.iv-edit-transcript{align-self:flex-start}
.iv-marker-row{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:8px 16px;border:0;border-radius:0;background:var(--card);color:var(--ink);font-size:var(--text-note);font-weight:400;text-align:left}
.iv-marker-row:hover{background:var(--row-highlight);border-color:transparent}
.iv-marker-row>span:first-of-type{flex:1}
.iv-marker-row .iv-icon{width:16px;height:16px;color:var(--accent-text)}
:root.ios .iv-player:not([hidden]){display:flex;align-items:center;gap:12px;position:fixed;left:12px;right:12px;bottom:calc(var(--safe-bottom,0px) + 10px);z-index:9;padding:10px 12px;border-radius:16px;border:1px solid var(--ios-separator);background:color-mix(in srgb,var(--popover) 84%,transparent);-webkit-backdrop-filter:saturate(1.8) blur(20px);backdrop-filter:saturate(1.8) blur(20px);box-shadow:0 8px 24px #0000001f}
:root.ios body.iv-visit:is([data-iv-tab=transcript],[data-iv-tab=audio]) #encounter-page{padding-bottom:calc(var(--safe-bottom,0px) + 110px)}
:root.ios body.iv-visit[data-iv-tab=transcript] #encounter-page:not(.ph-signed) .iv-player:not([hidden]){bottom:0}
:root.ios body.iv-visit[data-iv-tab=transcript]:has(.iv-player:not([hidden])) .document-footer{display:none}
.iv-play{width:44px;height:44px;flex:0 0 44px;min-height:0;padding:0;border:0;border-radius:50%;background:var(--accent);color:var(--on-accent)}
.iv-play:hover{background:var(--accent-hover);border-color:transparent}
.iv-play .iv-icon{width:20px;height:20px}
.iv-player-mid{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.iv-player-mid input[type=range]{width:100%;height:20px;padding:0;margin:0;border:0;background:transparent;accent-color:var(--accent)}
.iv-times{display:flex;justify-content:space-between;font-family:var(--font-mono);font-size:var(--text-label);color:var(--hint);font-variant-numeric:tabular-nums}
.iv-speed{min-height:30px;padding:0 10px;border:0;border-radius:999px;background:var(--ios-fill);color:var(--ink);font-family:var(--font-mono);font-size:var(--text-meta);font-weight:500}
/* ---- 13 Documents ---- */
:root.ios #encounter-page #documents-pane.iv-docs-on{padding:0;border:0;background:transparent;margin-top:0}
:root.ios #documents-pane.iv-docs-on>:not(.iv-docs,#drafted-document,.pg-viewport,.pager),
:root.ios #documents-pane.iv-docs-on .pg-flow>:not(.iv-docs,#drafted-document){display:none}
:root.ios #documents-pane.iv-docs-on #drafted-document:not([hidden]){display:flex;flex-direction:column;gap:10px;margin-top:12px;padding:14px 16px;border-radius:12px;background:var(--card)}
:root.ios .iv-docs:not([hidden]){display:flex;flex-direction:column;gap:12px}
.iv-docs-title{display:flex;align-items:center;justify-content:space-between;gap:12px}
.iv-docs-add{width:44px;height:44px;min-height:0;padding:0;border:0;background:transparent;color:var(--accent-text)}
.iv-docs-add .iv-icon{width:24px;height:24px}
.iv-docs-add:hover{background:transparent}
.iv-doc-thumb{width:30px;height:38px;flex:0 0 30px;border-radius:4px;border:1px solid var(--border);border-left:3px solid var(--accent);background:var(--app-bg)}
.iv-doc.open{background:var(--row-highlight)}
.iv-doc-card{padding:14px 16px;gap:10px}
.iv-doc-card-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.iv-doc-card-top strong{font-size:var(--text-note);font-weight:600}
.iv-doc-excerpt{margin:0;font-size:var(--text-secondary);line-height:1.55;color:var(--body);white-space:pre-wrap}
.iv-empty{display:flex;flex-direction:column;gap:6px;padding:24px 16px;text-align:center;color:var(--hint)}
.iv-empty strong{font-size:var(--text-card);color:var(--ink)}
.iv-empty p{margin:0;font-size:var(--text-secondary)}
/* ---- 06 / 16 Genie: iMessage bubbles, a circular tap-to-talk mic; listening lives at the top, the low bar carries Stop ---- */
:root.ios #assistant{border-radius:14px 14px 0 0}
:root.ios #assistant .chat-user,:root.ios #assistant .chat-answer{border-radius:18px}
:root.ios #assistant-mic{width:44px;height:44px;flex:0 0 44px;min-height:0;padding:0;border-radius:50%;background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
:root.ios #assistant-mic.listening{background:var(--recording-red);border-color:var(--recording-red)}
:root.ios #assistant-form .primary{border-radius:50%}
:root.ios .iv-listen:not([hidden]){display:flex;align-items:center;gap:8px;position:fixed;top:calc(var(--safe-top,0px) + 6px);left:50%;transform:translateX(-50%);z-index:40;min-height:34px;padding:0 14px;border-radius:999px;background:#000;color:#fff;font-size:var(--text-meta);font-weight:600;box-shadow:0 6px 18px #0004;pointer-events:none}
:root.ios body:has(#iv-listen:not([hidden])) .workspace-header{padding-top:calc(var(--safe-top,0px) + 46px)}
.iv-listen-dot{width:10px;height:10px;border-radius:50%;background:var(--accent)}
.iv-listen-bars{display:flex;align-items:center;gap:2px;height:14px}
.iv-listen-bars i{width:2px;height:40%;border-radius:1px;background:#7f9cff;animation:iv-listen 900ms ease-in-out infinite}
.iv-listen-bars i:nth-child(3n){animation-delay:-300ms}.iv-listen-bars i:nth-child(3n+1){animation-delay:-600ms}
@keyframes iv-listen{0%,100%{height:30%}50%{height:100%}}
:root.ios #assistant.voice-strip{top:auto;bottom:calc(var(--safe-bottom,0px) + var(--tabbar,0px) + 10px);left:12px;right:12px;border:1px solid var(--ios-separator);border-radius:18px;background:color-mix(in srgb,var(--popover) 90%,transparent);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);box-shadow:0 10px 30px #00000029}
:root.ios body.genie-strip .workspace>.screen:not([hidden]){padding-top:12px;padding-bottom:110px}
:root.ios #assistant.voice-strip .genie-stop{border-radius:999px;min-height:36px}
/* ---- No vertical scrolling (owner, 16 Sept 2026): the visit fills the screen and its panes page (paging.js) ---- */
/* The document and its pane take exactly the room left over, so the shared pager has a height to page within and the
   screen itself never overruns. The transport, the segmented control and the Sign bar stay put above and below it. */
:root.ios body.iv-visit #encounter-page{overflow:hidden}
:root.ios #encounter-page .document{flex:1;min-height:0;overflow:hidden}
:root.ios #encounter-page .document-pane{flex:1;min-height:0;overflow:hidden}
:root.ios .pager{margin:0;padding:6px 0 0;border-top:1px solid var(--ios-separator);background:transparent;gap:6px}
:root.ios .pager .pager-count{margin:0 auto;font-family:var(--font-sans);font-size:var(--text-meta);letter-spacing:0;color:var(--hint);font-variant-numeric:tabular-nums}
:root.ios .pager button{position:relative;min-height:36px;padding:0 14px;border:0;border-radius:999px;background:var(--ios-fill);color:var(--accent-text);font-size:var(--text-secondary);font-weight:600}
:root.ios .pager button::after{content:'';position:absolute;inset:-5px 0}   /* 44pt of tap area around a 36pt capsule */
:root.ios .pager button:disabled{background:transparent;color:var(--disabled);opacity:1}
/* The note's sections as an iOS segmented control rather than a row of chips. */
:root.ios .section-tabs{flex-wrap:nowrap;display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:2px;margin:0 0 10px;padding:2px;border-radius:9px;background:var(--ios-fill)}
:root.ios .section-tab{height:32px;min-height:32px;padding:0 6px;border:0;border-radius:7px;background:transparent;color:var(--ink);font-size:var(--text-secondary);font-weight:500;justify-content:center;overflow:hidden;text-overflow:ellipsis}
:root.ios .section-tab[aria-selected=true],:root.ios .section-tab[aria-selected=true]:hover{background:var(--card);color:var(--ink);font-weight:600;box-shadow:0 1px 3px #0000001f,0 0 0 .5px #0000000a}
/* Nothing below clips its own overflow: whatever cannot fit must reach the pager, never be cut off out of sight. */
:root.ios .iv-progress:not([hidden]){flex:0 0 auto}
:root.ios .iv-steps{overflow:visible}
:root.ios .iv-capsules{flex:0 0 auto}
/* Sheets and the first-run full screens are panes of the shared pager too (ios-visit.js registers them): their bodies page
   and the nav bar, the grabber and the primary action are pinned, so Start recording is never a page away. */
:root.ios .iv-picker-list{max-height:none;overflow:visible}
:root.ios dialog.iv-sheet>.pager,:root.ios dialog.iv-full>.pager{margin-top:4px}
/* The shared sheet of phone.js (#phone-sheet) pages the same way: the grabber and title above the paged body, the buttons that
   finish the job below it, whatever order the pinned parts were left in. */
:root.ios dialog.ph-sheet.pg-pane>.ph-grabber{order:0}
:root.ios dialog.ph-sheet.pg-pane>h2{order:1}
:root.ios dialog.ph-sheet.pg-pane>.pg-viewport{order:2}
:root.ios dialog.ph-sheet.pg-pane>.pager{order:3}
:root.ios dialog.ph-sheet.pg-pane>:is(.ph-sheet-secondary,#phone-template-rewrite,.ph-done,.ph-discard){order:4}
:root.ios dialog.ph-sheet>.pager{margin-top:4px}
}
@media(prefers-reduced-motion:reduce){.iv-bar.indeterminate i,.iv-step.active .iv-step-mark::after,.iv-listen-bars i,.iv-rec .iv-chip.pulse{animation:none}.iv-rec-bars i,.iv-level i,.iv-bar i,dialog.iv-sheet{transition:none}}
/* A sheet with a text field rises above the keyboard; the page behind it stays put (ios-visit.js --iv-keyboard, journeys-20). */
@media(max-width:760px){:root.ios #clinical-dialog{margin-bottom:var(--iv-keyboard,0px);max-height:calc(100dvh - var(--safe-top) - 24px - var(--iv-keyboard,0px))}}
