/* ======================================================================
   Clinic app (index.html)
   ====================================================================== */
.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
/* Clinic header: white bar, brand mark carries the theme colour (admin header keeps its own look). */
.app-shell > .app-header { background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); border-bottom: 1px solid rgb(var(--c-line)); }
.app-shell > .app-header .brand, .app-shell > .app-header a { color: rgb(var(--c-ink)); }
.app-shell > .app-header .brand small { font-size: var(--fs-sm); font-weight: 600; color: rgb(var(--c-mute)); }
.app-shell > .app-header .brand-mono { background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); box-shadow: none; border-radius: 10px; }
.app-shell > .app-header :focus-visible { outline-color: rgb(var(--c-focus)); }
.screens { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 16px; }
.screen-live { overflow: hidden; padding: 0; }
:root { --toast-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 92px); }
@media (orientation: portrait) and (max-width: 1024px) { :root { --toast-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 150px); } }
@media (max-width: 599px) { :root { --toast-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 210px); } }
/* Clinic page: toasts sit bottom-centre above the dock/action bar at every width, never over the patient header chips
   (overrides the top-right desktop placement in components.css, which stays for the admin page). */
.toast-stack { top: auto; right: auto; left: 50%; bottom: var(--toast-bottom); transform: translateX(-50%); width: min(92vw, 480px); }
/* Review in portrait / phone: the approval bar is taller than the live dock, so lift toasts above it. */
@media (orientation: portrait), (max-width: 899px) { :root[data-screen="review"] { --toast-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 300px); } }
@media (max-width: 599px) { :root[data-screen="review"] { --toast-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 360px); } }
.container { width: 100%; max-width: 560px; margin: 0 auto; }
.container-wide { width: 100%; max-width: 860px; margin: 0 auto; }
.page-header { margin: 0 0 var(--sp-3); }
.page-title { margin: 0; font-size: var(--fs-2xl); font-weight: 700; color: rgb(var(--c-ink)); }
.page-subtitle { margin: 4px 0 0; color: rgb(var(--c-mute)); font-size: var(--fs-sm); }
.hero { text-align: center; margin: 24px 0 20px; }
.hero h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: rgb(var(--c-primary)); }
.hero p { margin: 4px 0 0; color: rgb(var(--c-mute)); font-size: 14px; }
.setup-footer { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2); }
.recent-list { list-style: none; margin: 0; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.recent-item { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.recent-resume { flex: 1 1 auto; justify-content: flex-start; text-align: left; white-space: normal; min-height: 44px; }
.recent-item > .btn-secondary.recent-resume { padding: 0 14px; border-color: transparent; background: rgb(var(--c-bg)); color: rgb(var(--c-ink)); font-weight: 600; }
.recent-item > .btn-secondary.recent-resume::after { content: "›"; margin-left: auto; padding-left: 8px; font-size: 20px; color: rgb(var(--c-mute)); }
.recent-item > .btn-secondary.recent-resume:hover:not(:disabled) { background: rgb(var(--c-vet-tint)); }
.recent-discard { flex: none; }
.form-error { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-control); background: rgb(var(--c-danger) / 0.08); color: rgb(var(--c-danger-text)); font-size: 14px; }
.notice { padding: 10px 12px; border-radius: var(--radius-control); background: rgb(var(--c-warn) / 0.09); color: rgb(var(--c-warn-text)); font-size: 13px; }

/* Setup (HVOC): two compact cards, status pills in one row, a big Start that stays above the fold. */
.setup-container { max-width: 720px; }
.setup-container > .page-header { margin-bottom: 14px; }
.setup-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.setup-main, .setup-side { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
@media (orientation: landscape) and (min-width: 1000px) {
  .setup-container { max-width: 1100px; }
  .setup-grid { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); align-items: start; gap: 20px; }
}
.setup-card { margin: 0; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.setup-card .form-row { margin: 0; }
.setup-container .field-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgb(var(--c-mute)); }
.setup-container .field-label :lang(zh-HK) { margin-left: 2px; letter-spacing: 0; font-weight: 600; }
.setup-card .input, .setup-card .select { min-height: 50px; padding: 0 16px; border-radius: 14px; font-size: 17px; }
.setup-card .segmented > button { min-height: 44px; padding: 0 8px; font-size: 15px; white-space: nowrap; }
/* Patient ID: optional, one quiet line whose box lines up under Breed */
.setup-card .setup-pid { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 14px; }
.setup-card .setup-pid > .input { min-height: 44px; font-size: var(--fs-lg); }
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-two > .form-row { margin-bottom: 0; }
@media (max-width: 599px) {
  .form-two { grid-template-columns: 1fr; }
  .setup-card .form-two:not(.setup-langs), .setup-card .setup-pid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .screen-setup { padding: 12px 12px 96px; }
  .setup-grid, .setup-main, .setup-side { gap: 12px; }
  .setup-card { padding: 14px 16px; gap: 10px; }
  .setup-card .form-row { gap: 4px; }
  .setup-card .input, .setup-card .select { min-height: 46px; }
  .setup-card .segmented > button { min-height: 44px; }
  .setup-container > .page-header { margin-bottom: 10px; }
  .setup-container > .page-header .page-title { font-size: var(--fs-xl); }
  .ready-check li { min-height: 30px; padding: 0 10px; }
}
.start-btn { min-height: 60px; border-radius: 20px; font-size: var(--fs-xl); }
/* VETTALK-92: on small phones Start stays on screen above the home indicator; .screen-setup pads for it. */
@media (max-width: 599px) { .start-btn { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 5; width: auto; box-shadow: 0 8px 24px rgb(0 0 0 / .18); } }
.setup-ready { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ready-check { list-style: none; margin: 0; padding: 0; display: contents; }
.ready-check li { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 12px;
  border: 1px solid rgb(var(--c-line)); border-radius: var(--radius-pill); background: rgb(var(--c-surface));
  font-size: var(--fs-sm); font-weight: 600; color: rgb(var(--c-mute)); white-space: nowrap; }
.ready-label { color: inherit; }
.ready-value { font-weight: 600; color: inherit; }
.ready-value::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: rgb(var(--c-ink-3)); vertical-align: 1px; }
.ready-value[data-state="ok"]::before { background: rgb(var(--c-ok-ink)); }
.ready-value[data-state="bad"]::before { background: rgb(var(--c-danger-ink)); }
.ready-check li:has(> .ready-value[data-state="ok"]) { background: rgb(var(--c-ok-tint)); border-color: rgb(var(--c-ok-ink) / .22); color: rgb(var(--c-ok-ink)); }
.ready-check li:has(> .ready-value[data-state="bad"]) { background: rgb(var(--c-danger-tint)); border-color: rgb(var(--c-danger-ink) / .22); color: rgb(var(--c-danger-ink)); }
.mic-test-btn { min-height: 32px; padding: 0 14px; font-size: var(--fs-sm); }
@media (pointer: coarse) { .mic-test-btn { min-height: 44px; } }
.setup-recent { margin: 0; overflow: hidden; }
.setup-recent > .section-header { min-height: 0; padding: 14px 16px 2px; border: 0; font-size: var(--fs-md); }
.setup-notes { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; padding: 2px 4px 0; }
.setup-notes > p { flex: 1 1 100%; margin: 0 0 4px; line-height: 1.45; }
.setup-tips { flex: 1 1 0; min-width: 0; }
.setup-tips > summary { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: rgb(var(--c-mute)); }
.setup-tips > p { margin: 0 0 6px; line-height: 1.45; }
.ready-more { flex: none; align-self: flex-start; }
.ready-more-list { right: 0; left: auto; max-width: calc(100vw - 32px); }
.ready-more-list > .menu-label { margin: 6px 10px; font-size: var(--fs-sm); }
.mic-test-result { display: flex; flex-direction: column; gap: 6px; }
.mic-test-bar {
  height: 8px; border-radius: 999px; background: rgb(230 234 240);
  overflow: hidden;
}
.mic-test-level {
  height: 100%; width: 0%;
  background: rgb(var(--c-owner-dot));
  transition: width 80ms linear;
}
.mic-test-verdict { margin: 0; }

/* Typeahead */
.typeahead { position: relative; }
.typeahead-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: 6px; list-style: none;
  max-height: 220px; overflow-y: auto;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.typeahead-option {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
  text-align: left; font: inherit; cursor: pointer; color: rgb(var(--c-ink));
}
.typeahead-option:hover, .typeahead-option[aria-selected="true"] {
  background: rgb(var(--c-vet-tint));
}
.typeahead-option .muted { display: block; font-size: var(--fs-xs); }

/* live consult dock: a floating white pill under the panes (in flow, so it never covers a bubble) */
.end-btn { margin-left: 0; }
.live-ctl { min-height: 48px; min-width: 96px; padding: 0 20px; font-size: var(--fs-lg); }
.live-dock { flex: none; align-self: center; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px;
  max-width: calc(100% - 32px); margin: 0 16px max(14px, env(safe-area-inset-bottom)); padding: 8px 10px;
  background: rgb(var(--c-surface)); border-radius: var(--radius-pill); box-shadow: 0 6px 24px rgb(31 59 82 / .16); }
.dock-speaker { flex: none; border: 0; }
.dock-speaker > button { flex: none; min-height: 44px; padding: 0 14px; white-space: nowrap; }
.dock-meter { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 4px; color: rgb(var(--c-mute)); font-size: var(--fs-sm); font-weight: 600; }
.dock-meter .status-pill { min-width: 0; }
.dock-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dock .rec-btn { width: 48px; height: 48px; flex: none; }
.dock-right { position: relative; display: flex; align-items: center; gap: 8px; }
.dock-more-btn { gap: 6px; background: rgb(var(--c-bg)); color: rgb(var(--c-ink)); }
.dock-more-list { width: 300px; }
#pauseBtn.btn-secondary { background: rgb(var(--c-primary-deep)); color: rgb(var(--c-on-primary)); border-color: rgb(var(--c-primary-deep)); }
#pauseBtn.btn-secondary:hover:not(:disabled) { background: rgb(var(--c-primary-hover)); border-color: rgb(var(--c-primary-hover)); }
/* Paused must be obvious at a glance: amber Resume button and an amber status pill (the "Paused" hint is hidden below 1280px). */
#pauseBtn.is-paused { background: rgb(var(--c-warn-ink)); border-color: rgb(var(--c-warn-ink)); color: #fff; }
#pauseBtn.is-paused:hover:not(:disabled) { background: rgb(var(--c-warn-ink)); filter: brightness(1.12); }
.status-pill[data-state="paused"] { background: rgb(var(--c-warn-tint)); color: rgb(var(--c-warn-ink)); }
/* Keep the dock on one row and the toast clear of it: cap the status pill, drop the level bar on narrower landscape screens. */
.dock-meter .status-pill { max-width: 220px; }
@media (max-width: 1100px) and (orientation: landscape) { .dock-meter .wave { display: none; } :root { --toast-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 150px); } }
@media (max-width: 1279px) { .dock-hint, .kbd-hint { display: none; } }
@media (orientation: portrait) { .dock-hint, .kbd-hint { display: none; } }
@media (max-width: 599px) {
  .live-dock { align-self: stretch; max-width: none; margin: 0 8px max(8px, env(safe-area-inset-bottom)); border-radius: 24px; }
  .dock-speaker { flex: 1 1 100%; } .dock-speaker > button { flex: 1 1 0; padding: 0 8px; }
  .dock-meter .wave, .dock-hint { display: none; }
  .dock-right { flex: 1 1 100%; margin-left: 0; } .dock-right > * { flex: 1 1 0; } .dock-right > .dock-more { flex: none; }
  .dock-right .live-ctl { min-width: 0; padding: 0 10px; }
  .dock-more-text { display: none; }
  .dock-right > .dock-more { min-width: 48px; }
  .dock-more-list { left: 0; right: auto; width: min(300px, calc(100vw - 32px)); }
}
@media (pointer: coarse) { .flag-more-btn, .dock-speaker > button { min-height: 44px; } }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 11px;
  border-radius: 999px; background: rgb(var(--c-bg));
  font-size: 12px; font-weight: 600; color: rgb(var(--c-mute));
}
.status-pill { min-width: 0; max-width: min(100%, 560px); }
#status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--c-mute) / 0.6); }
.status-pill[data-state="listening"]::before { background: rgb(var(--c-accent)); animation: pulse-dot 1.6s ease-in-out infinite; }
.status-pill[data-state="busy"]::before { background: rgb(var(--c-warn)); }
.status-pill[data-state="paused"]::before { background: rgb(var(--c-warn)); }
.status-pill[data-state="error"]::before { background: rgb(var(--c-danger)); }

.screen-live { background: rgb(var(--c-bg)); }
.screen-live .patient-banner { flex: none; position: relative; top: auto; flex-wrap: nowrap; min-height: 72px; padding: 10px 22px; gap: 14px; background: transparent; border-bottom: 0; }
.screen-live .patient-banner-avatar { width: 48px; height: 48px; background: rgb(var(--c-owner-tint)); color: rgb(var(--c-owner)); }
.screen-live .patient-banner-avatar .ico { width: 24px; height: 24px; }
.screen-live .patient-banner-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.screen-live .patient-banner-name { font-size: var(--fs-2xl); letter-spacing: -0.01em; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.screen-live .patient-banner-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgb(var(--c-mute)); }
.screen-live .patient-banner-flags { flex: none; flex-wrap: nowrap; align-items: center; }
.screen-live .patient-banner-flags .flag-info { background: rgb(var(--c-surface)); color: rgb(var(--c-mute)); border-color: rgb(var(--c-line)); }
.flag-more-btn { cursor: pointer; background: rgb(var(--c-surface-2)); color: rgb(var(--c-mute)); border: 1px solid rgb(var(--c-line)); }
.flag-more-list { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 220px; }
@media (max-width: 599px) {
  .screen-live .patient-banner-meta { display: none; }
  .screen-live .patient-banner { padding: 6px 12px; flex-wrap: wrap; }
  .screen-live .patient-banner-flags { flex-wrap: wrap; }
  .screen-live .patient-banner { min-height: 56px; gap: 8px 10px; }
  .screen-live .patient-banner-avatar { width: 36px; height: 36px; }
  .screen-live .patient-banner-name { font-size: var(--fs-xl); }
}

/* panes + bubbles */
.panes { flex: 1 1 auto; min-height: 0; display: flex; gap: 16px; padding: 0 22px 14px; }
.panes[data-layout="lr"] { flex-direction: row; }
.panes[data-layout="tb"], .panes[data-layout="tb-flip"] { flex-direction: column; }
.panes[data-layout="tb-flip"] .pane-owner { transform: rotate(180deg); transform-origin: center center; }
@media (max-width: 640px) { .panes[data-layout="lr"] { flex-direction: column; gap: 8px; } }
@media (orientation: portrait) and (max-width: 1024px) {
  .panes[data-layout="lr"] { flex-direction: column; }
  .panes { gap: 12px; padding: 0 16px 12px; }
}
@media (max-width: 599px) { .panes { gap: 8px; padding: 0 8px 8px; } }
.pane { flex: 1 1 0; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 20px; scroll-padding-bottom: 20px;
  background: rgb(var(--c-surface)); border: 0; border-radius: var(--radius-card); box-shadow: var(--shadow-1); }
@media (max-width: 599px) { .pane { padding: 0 12px 12px; border-radius: 16px; } }
/* One opaque sticky header per pane (title + D11 line together): nothing scrolls through it. */
.pane-title {
  position: sticky; top: 0; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  margin: 0 -20px 12px; padding: 16px 20px 10px;
  background: rgb(var(--c-surface));
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0; text-transform: none;
  color: rgb(var(--c-mute));
}
@media (max-width: 599px) { .pane-title { margin: 0 -12px 8px; padding: 10px 12px 8px; } }
.pane-who { text-transform: uppercase; letter-spacing: 0.05em; }
.pane-lang { margin-left: auto; font-weight: 700; }
.pane-owner .pane-lang { color: rgb(var(--c-owner)); }
.pane-vet .pane-lang { color: rgb(var(--c-vet)); }
.pane-d11 {
  flex-basis: 100%; margin: 0; padding: 0;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; letter-spacing: 0; text-transform: none;
  color: rgb(var(--c-mute));
}
.pane-legend {
  display: inline-flex; align-items: center; gap: 6px; order: 3;
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0; text-transform: none; color: rgb(var(--c-mute));
}
.pane-vet .pane-title::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
.pane-count { order: 4; min-height: 24px; padding: 0 10px; font-size: var(--fs-xs); }
.vt-unv {
  display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px dashed rgb(var(--c-ink-3));
}
#omsgs, #dmsgs { display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 94%; margin: 0; padding: 14px 18px; border: 0; border-radius: var(--radius-bubble); }
.bubble-owner { align-self: flex-start; background: rgb(var(--c-owner-tint)); border-bottom-left-radius: 8px; }
.bubble-vet { align-self: flex-end; background: rgb(var(--c-vet-tint)); border-bottom-right-radius: 8px; }
@media (max-width: 599px) { .bubble { padding: 10px 14px; border-radius: 18px; } }
.bubble-clinician { background: rgb(var(--c-vet-tint)); }
.bubble-client { background: rgb(var(--c-owner-tint)); }
.bubble.is-unverified { border-color: transparent; }
.bubble.is-verified { box-shadow: none; }
.bubble-error { background: rgb(var(--c-danger-tint)); box-shadow: inset 0 0 0 2px rgb(var(--c-danger-ink)); }
/* Held dose: white card, 2.5px red outline (non-colour cue), red label, red pill confirm under the text. */
.bubble-dose { display: flex; flex-direction: column; align-self: stretch; max-width: 100%; background: rgb(var(--c-surface)); box-shadow: inset 0 0 0 2.5px rgb(var(--c-danger-ink)); border-radius: 18px; }
.dose-band { display: contents; }
.dose-band-text { order: -1; margin-bottom: 4px; color: rgb(var(--c-danger-ink)); font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.dose-band .btn { order: 5; align-self: flex-start; margin-top: 12px; min-height: 44px; padding: 0 20px; font-size: var(--fs-md); }
.bubble-dose > .bubble-acts { order: 6; }
.bubble-dose .dose-line { display: block; }
.bubble-dose .dose-line + .dose-line { margin-top: 4px; }
.bubble.bubble-dose .body { font-size: 19px; }
.pane-owner .bubble-dose .body { font-size: var(--fs-18); font-weight: 600; color: rgb(var(--c-mute)); }
.bubble-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0; text-transform: none; color: rgb(var(--c-mute)); }
.bubble-owner .bubble-meta > span:first-child { color: rgb(var(--c-owner)); }
.bubble-vet .bubble-meta > span:first-child { color: rgb(var(--c-vet)); }
.bubble-meta .vt-unv, .bubble-meta .vt-ok { margin-left: auto; }
.vt-ok { position: relative; display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%; background: rgb(var(--c-ok-ink)); }
.vt-ok::after { content: ""; position: absolute; left: 5.5px; top: 2.5px; width: 3.5px; height: 7.5px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.b-orig { display: block; margin-top: 4px; font-size: var(--fs-live-orig); line-height: 1.5; color: rgb(var(--c-mute)); overflow-wrap: anywhere; }
.bubble-act { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
/* Report 回報: one disclosure per bubble; the three feedback codes + free report open inline (never clipped by the pane). */
.bubble-report { display: inline-flex; flex-direction: column; }
.bubble-report > summary { list-style: none; cursor: pointer; align-self: flex-start; text-transform: none; letter-spacing: 0; }
.bubble-report > summary::-webkit-details-marker { display: none; }
.bubble-report[open] { flex-basis: 100%; }
.bubble-report-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; text-transform: none; letter-spacing: 0; }
.bubble-report.is-reported > summary::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border-radius: 50%; background: rgb(var(--c-accent)); }
.bubble-report.is-floating > .bubble-report-menu {
  position: fixed; z-index: 60; flex-direction: column; flex-wrap: nowrap; gap: 2px; margin: 0; padding: 6px;
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: var(--radius-card); box-shadow: var(--shadow-2);
}
.bubble-report.is-floating > .bubble-report-menu .btn { justify-content: flex-start; width: 100%; min-height: 44px; border-color: transparent; background: transparent; color: rgb(var(--c-ink)); }
.bubble-report.is-floating > .bubble-report-menu .btn:hover { background: rgb(var(--c-surface-2)); }
.bubble-report.is-floating > .bubble-report-menu .btn[aria-pressed="true"] { background: rgb(var(--c-vet-tint)); color: rgb(var(--c-vet)); }
.bubble .body { display: block; margin-top: 2px; font-size: var(--fs-live); font-weight: 500; line-height: 1.38; overflow-wrap: anywhere; }
.bubble .body:lang(zh-HK), .bubble .body:lang(zh-Hans) { line-height: 1.5; }
.bubble-acts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px; margin: 8px -6px -4px; }
.pane-owner .bubble-acts, .pane-owner .bubble-tools { display: none; }
.bubble-tools { display: contents; }
.bubble-acts .btn-secondary, .bubble-acts .spk-chip { background: transparent; border-color: transparent; color: rgb(var(--c-mute)); font-weight: 600; }
.bubble-acts .btn-secondary:hover:not(:disabled), .bubble-acts .spk-chip:hover { background: rgb(var(--c-ink) / 0.05); color: rgb(var(--c-ink)); }
.spk-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.bubble-owner .spk-dot { background: rgb(var(--c-owner-dot)); }
.bubble-vet .spk-dot { background: rgb(var(--c-vet-dot)); }
.bubble-live { background: transparent; border: 1px dashed rgb(var(--c-ink) / 0.2); color: rgb(var(--c-ink) / 0.75); }
.bubble-live .body::after { content: "▍"; margin-left: 2px; color: rgb(var(--c-accent)); animation: caret 1s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .bubble-live .body::after { animation: none; } }
.spk-chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 10px;
  border: 0; border-radius: 999px; background: rgb(var(--c-ink) / 0.07);
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: none; color: rgb(var(--c-ink) / 0.8); cursor: pointer;
}
.spk-chip:hover { background: rgb(var(--c-ink) / 0.12); }
@media (pointer: coarse) { .spk-chip { min-height: 44px; padding: 4px 14px; } }
.w { cursor: pointer; border-radius: 4px; }
.w:hover, .w.is-playing { background: rgb(var(--c-accent) / 0.18); }
.bubble-pending {
  background: rgb(var(--c-ink) / 0.06);
  animation: skel 1.2s ease-in-out infinite;
}
.bubble-pending .body { min-height: 1.6em; color: rgb(var(--c-mute)); }
.bubble-slow {
  opacity: 0.85;
}
.bubble-slow .body { font-style: italic; color: rgb(var(--c-mute)); }

/* record level meter (inside the dock) */
.kbd-hint { font-size: var(--fs-xs); color: rgb(var(--c-mute)); }
@media (pointer: coarse) { .kbd-hint { display: none; } }
.wave { display: block; width: min(120px, 30vw); height: 24px; border-radius: 999px; background: rgb(var(--c-bg)); }
.rec-btn {
  position: relative;
  width: 70px; height: 70px; padding: 0; border: 1px solid rgb(var(--c-line)); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgb(var(--c-bg)); color: rgb(var(--c-primary));
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.15;
  cursor: pointer; transition: transform 0.12s, background 0.15s;
}
.rec-btn:active { transform: scale(0.97); }
.rec-btn.is-listening { animation: none; }
.rec-btn.is-recording { background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); border-color: rgb(var(--c-primary)); animation: none; box-shadow: 0 0 0 4px rgb(var(--c-accent) / 0.35); }
.rec-btn.is-recording::after { display: none; }

/* review screen (HVOC): patient header with pill flags, underline tabs over a white SOAP card, approval rail / bottom bar */
.screen-review {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgb(var(--c-bg));
}
.screen-review .patient-banner { flex: none; position: sticky; top: 0; z-index: 15; min-height: 72px; gap: 8px 14px; padding: 12px 22px; }
.screen-review .patient-banner-avatar { width: 46px; height: 46px; border-radius: 50%; background: rgb(var(--c-owner-tint)); color: rgb(var(--c-owner)); }
.screen-review .patient-banner-avatar .ico { width: 24px; height: 24px; }
.screen-review .patient-banner-main { min-width: 0; flex: 1 1 auto; }
.screen-review .patient-banner-name { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
.screen-review .patient-banner-meta { color: rgb(var(--c-mute)); }
.screen-review .patient-banner-flags { align-items: center; }
.screen-review .patient-banner-flags .badge {
  height: auto; min-height: 30px; padding: 0 13px; gap: 6px;
  border: 1px solid rgb(var(--c-line)); background: rgb(var(--c-bg)); color: rgb(var(--c-mute));
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.screen-review .patient-banner-flags .badge::before { display: none; }
.screen-review .patient-banner-flags .badge-ok { background: rgb(var(--c-ok-tint)); color: rgb(var(--c-ok-ink)); border-color: rgb(var(--c-ok-ink) / .22); }
.screen-review .patient-banner-flags .badge-warn { background: rgb(var(--c-warn-tint)); color: rgb(var(--c-warn-ink)); border-color: rgb(var(--c-warn-ink) / .22); }
.screen-review .patient-banner-flags .badge-danger { background: rgb(var(--c-danger-tint)); color: rgb(var(--c-danger-ink)); border-color: rgb(var(--c-danger-ink) / .22); }
@media (max-width: 599px) {
  .screen-review .patient-banner { padding: 10px 12px; }
  .screen-review .patient-banner-avatar { width: 36px; height: 36px; }
  .screen-review .patient-banner-name { font-size: var(--fs-xl); }
}
.review-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 22px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 599px) { .review-body { padding: 12px; } }
.review-edit-panel { margin: 8px 22px 0; max-width: 960px; }
.review-record { background: transparent; border: 0; box-shadow: none; }
.screen-review .record-tabs { gap: 4px; background: transparent; border-bottom: 1px solid rgb(var(--c-line)); }
.screen-review .record-tabs [role="tab"] { min-height: 44px; padding: 0 14px; font-size: 15px; font-weight: 600; }
.screen-review .record-tabs [role="tab"][aria-selected="true"] { background: transparent; color: rgb(var(--c-primary)); }
.value-flags-panel {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1.5px solid rgb(240 217 168);
  border-radius: 16px;
  background: rgb(var(--c-warn-tint));
}
.value-flags-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 0;
  color: rgb(var(--c-warn-ink));
  font-size: var(--fs-lg);
  font-weight: 700;
}
.value-flags-fyi-title {
  margin: 10px 0 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgb(var(--c-warn-ink));
}
.value-flags-list {
  margin: 0;
  padding: 0 0 0 1.2em;
  list-style: disc;
}
.value-flags-item {
  margin: 0;
  font-size: var(--fs-md);
  padding: 3px 0;
  color: rgb(var(--c-ink));
}
.value-flags-dlg .value-flags-list { margin-top: 0; }
.value-flags-weak-title {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: rgb(var(--c-mute));
}
.check-numbers {
  color: rgb(var(--c-mute));
  border-color: rgb(var(--c-line));
  background: rgb(var(--c-ink) / 0.04);
}
.check-numbers:hover:not(:disabled) {
  color: rgb(var(--c-mute));
  background: rgb(var(--c-ink) / 0.08);
}
/* "I checked these values" sits with the approval controls; the whole row is the tap target (>= 44px). */
.value-flags-ack {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: rgb(var(--c-warn-tint));
  font-size: var(--fs-md);
  font-weight: 600;
  color: rgb(var(--c-ink));
}
.value-flags-ack input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: rgb(var(--c-primary)); }
.value-flags-ack label { flex: 1 1 auto; min-height: 44px; display: flex; align-items: center; padding: 6px 0; cursor: pointer; }
.tab-panels { margin-top: 12px; padding: 20px 22px 22px; background: rgb(var(--c-surface)); border-radius: var(--radius-card); box-shadow: var(--shadow-1); }
@media (max-width: 599px) { .tab-panels { padding: 16px; } }
.tab-panels .field-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgb(var(--c-primary)); }
.soap-field {
  field-sizing: content;
  min-height: 7rem;
  max-height: none;
  overflow: hidden;
  resize: none;
  font-size: var(--fs-lg);
  line-height: 1.6;
  max-width: 72ch;
}
.soap-field[readonly] { border-color: transparent; background: rgb(var(--c-surface)); padding-left: 0; padding-right: 0; }
.owner-draft-badge { margin-bottom: 12px; }
.amend-history { display: flex; flex-direction: column; gap: 10px; }
.amend-item {
  padding: 10px 12px;
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--radius);
  background: rgb(var(--c-surface-2, var(--c-surface)));
}
.amend-item-meta { font-size: var(--fs-sm); color: rgb(var(--c-mute)); margin-bottom: 4px; }
.amend-item-reason { font-weight: 600; color: rgb(var(--c-ink)); }
#metaForm { padding: 20px 22px; }

/* Portrait / phone: approval controls are a bottom bar */
.review-actions {
  flex: none;
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 22px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgb(var(--c-line));
  background: rgb(var(--c-surface));
  box-shadow: 0 -6px 24px rgb(31 59 82 / .08);
}
.approve-card { display: flex; flex-direction: column; gap: 10px; }
.approver-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}
.approver-row .field-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgb(var(--c-mute)); }
.approver-row .select, .approver-row .input { min-height: 48px; border-radius: 14px; }
.pin-input { max-width: 150px; letter-spacing: 0.4em; font-size: var(--fs-xl); text-align: center; }
.approver-row .pin-input { height: 48px; padding-top: 0; padding-bottom: 0; }
.review-action-btns { width: 100%; gap: 8px; }
.review-action-btns .btn { min-height: 44px; }
#approveBtn { min-height: 52px; padding: 0 28px; font-size: var(--fs-lg); }
.export-note { color: rgb(var(--c-mute)); }
@media (max-width: 599px) {
  .review-actions { padding-left: 12px; padding-right: 12px; }
  .review-action-btns .btn { flex: 1 1 calc(50% - 8px); padding: 0 12px; }
  .review-action-btns #approveBtn { flex: 2 1 auto; padding: 0 16px; }
  .review-action-btns #newBtn { flex: 1 1 auto; }
  /* Copy / Export stay locked until approval; the note below says so, so the phone bar does not spend a row on them. */
  .review-action-btns #copyBtn:disabled, .review-action-btns #downloadBtn:disabled { display: none; }
  .approver-row { flex-wrap: nowrap; gap: 8px; }
  .approver-row .pin-input { width: 112px; letter-spacing: 0.25em; }
}
/* Landscape tablet / desktop: a right-hand approval rail */
@media (orientation: landscape) and (min-width: 900px) {
  .screen-review { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto auto auto minmax(0, 1fr); }
  .screen-review > .conflict-banner, .screen-review > .patient-banner, .screen-review > .review-edit-panel { grid-column: 1 / -1; }
  .screen-review > .review-body { grid-column: 1; grid-row: 4; min-height: 0; max-width: none; padding-right: 8px; }
  .screen-review > .review-actions { grid-column: 2; grid-row: 4; position: static; min-height: 0; overflow-y: auto; justify-content: flex-start;
    gap: 12px; padding: 14px 22px 16px 8px; border-top: 0; background: transparent; box-shadow: none; }
  .review-actions .approve-card { gap: 12px; padding: 18px; background: rgb(var(--c-surface)); border-radius: var(--radius-card); box-shadow: var(--shadow-1); }
  .review-actions .approver-row { flex-direction: column; align-items: stretch; }
  .review-actions .pin-input { max-width: none; }
  .review-action-btns { flex-direction: column; align-items: stretch; }
  .review-action-btns .btn { width: 100%; }
  #approveBtn { min-height: 56px; font-size: var(--fs-18); }
  .export-note { padding: 14px 18px; background: rgb(var(--c-surface)); border-radius: 16px; box-shadow: var(--shadow-1); font-size: var(--fs-sm); }
}

.conflict-banner {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 16px;
  background: rgb(var(--c-danger) / 0.12);
  color: rgb(var(--c-danger-text));
  border-bottom: 1px solid rgb(var(--c-danger) / 0.35);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.conflict-banner[hidden] { display: none !important; }

.tx-list { max-height: none; overflow: visible; }
.tx-item { padding: 12px 0; border-bottom: 1px solid rgb(var(--c-line)); }
.tx-item:last-child { border-bottom: 0; }
.tx-who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; }
.tx-who.is-doctor { color: rgb(var(--c-vet)); }
.tx-who.is-owner { color: rgb(var(--c-owner)); }
.tx-who .reportBubble { margin-left: auto; }
.tx-orig { margin-top: 4px; font-size: var(--fs-lg); line-height: 1.5; }
.tx-tr { margin-top: 2px; font-size: var(--fs-md); color: rgb(var(--c-mute)); }
.soap-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .soap-grid { grid-template-columns: 1fr 1fr; } }

/* Sync drawer */
.sync-drawer-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.sync-drawer-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--radius-card);
  background: rgb(var(--c-surface));
}
.sync-drawer-meta { flex: 1; min-width: 0; }
.sync-drawer-label { font-weight: 650; font-size: var(--fs-md); color: rgb(var(--c-ink)); }
.sync-drawer-detail { margin-top: 2px; font-size: var(--fs-sm); color: rgb(var(--c-mute)); }
.sync-drawer-empty { text-align: center; }

/* Consent dialog */
.consent-sheet .sheet-body { display: flex; flex-direction: column; gap: 14px; }
.consent-sheet .sheet-body { padding: 16px 20px; min-height: 120px; }
.consent-sheet .sheet-text { padding: 16px 18px; font-size: var(--fs-lg); line-height: 1.7; background: rgb(var(--c-bg)); border: 0; border-radius: 16px; }
.consent-sheet #picsLang { margin: 14px 20px 0; width: fit-content; }
.consent-sheet #picsLang > button { min-height: 40px; padding: 0 18px; }
.consent-ver > summary { min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: rgb(var(--c-mute)); }
.consent-tick-row {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 14px;
  min-height: 64px; margin: 0 20px 10px; padding: 14px 18px; cursor: pointer;
  border: 1.5px solid rgb(var(--c-line)); border-radius: 16px; background: rgb(var(--c-surface));
  font-size: var(--fs-18); font-weight: 650; line-height: 1.35;
}
.consent-tick-row input {
  width: 26px; height: 26px; flex: none; margin: 0;
  accent-color: rgb(var(--c-primary));
}
.consent-tick-row:has(input:checked) { border-color: rgb(var(--c-primary)); box-shadow: inset 0 0 0 1px rgb(var(--c-primary)); background: rgb(var(--c-vet-tint)); }
#qaRow { min-height: 52px; font-size: var(--fs-md); font-weight: 500; }
.consent-sheet .sheet-actions { padding: 14px 20px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: rgb(var(--c-surface)); }
.consent-sheet .sheet-actions .btn { min-height: 52px; padding: 0 24px; font-size: var(--fs-lg); }
/* Only the text scrolls; the tick rows and Start stay on screen. */
.consent-sheet #consentMain { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.consent-sheet #consentMain > :not(.sheet-body) { flex: none; }
@media (max-width: 599px) {
  .consent-sheet .sheet-body { padding: 12px 16px; }
  .consent-sheet #picsLang { margin: 12px 16px 0; }
  .consent-tick-row { margin: 0 16px 8px; padding: 12px 14px; font-size: var(--fs-lg); }
  .consent-sheet .sheet-actions { padding-left: 16px; padding-right: 16px; }
  .consent-sheet .sheet-actions .btn { flex: 1 1 100%; }
}
.disclaimer-heading { padding-top: 14px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* PWA update banner — thin strip under the header (not a floating pill over content) */
.update-bar {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px;
  width: 100%; padding: 8px 12px;
  border-bottom: 1px solid rgb(var(--c-warn-line) / 0.5);
  background: rgb(var(--c-warn-tint));
  color: rgb(var(--c-warn-ink));
  font-size: var(--fs-sm); font-weight: 600;
  min-height: var(--hit);
}
.update-bar .btn { min-height: var(--hit); min-width: var(--hit); }
@media (pointer: coarse) { .update-bar .btn { min-height: 44px; } }

.consent-error { margin-top: var(--sp-2); }
.consent-error .sheet-actions { margin-top: var(--sp-3); }

/* Review loading states (A6) — spinner animates transform only */
.progress-inline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: rgb(var(--c-surface-2, var(--c-surface)));
  border: 1px solid rgb(var(--c-line));
  font-size: var(--fs-sm);
  color: rgb(var(--c-ink));
}
.progress-inline[hidden] { display: none !important; }
.progress-spinner {
  width: 1rem;
  height: 1rem;
  flex: none;
  border: 2px solid rgb(var(--c-primary) / 0.25);
  border-top-color: rgb(var(--c-primary));
  border-radius: 50%;
  animation: progress-spin 0.8s linear infinite;
}
.progress-timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: rgb(var(--c-mute));
}
@keyframes progress-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-spinner { animation: none; }
}

/* keyframes (sheet-up, toast-in, skel, rec-pulse, caret, pulse-dot) live in components.css */

/* consent text: keep paragraph breaks from the stored text */
#picsText { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.6; }
