:root {
  color-scheme: light;
  --brand: #28534F;
  --sage: #789D91;
  --accent: #83B6BA;
  --mist: #E6EFEB;
  --white: #F4F7F5;
  --graphite: #303B3C;
  --muted: #647471;
  --line: #DCE6E2;
  --paper: #FFFFFF;
  --danger: #B74740;
  --danger-soft: #FCECE9;
  --shadow: 0 18px 48px rgba(40, 83, 79, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--graphite);
  background: var(--white);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--white); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.app-shell { width: min(1440px, calc(100% - 64px)); margin: 0 auto; }
.topbar { height: 94px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { display: block; width: 156px; height: auto; object-fit: contain; }
.account-actions { display: flex; align-items: center; gap: 18px; }
.account-actions #mfa-settings-button { padding: 0 13px; }
.account-copy { display: grid; gap: 3px; text-align: right; }
.account-copy strong { font-size: 14px; font-weight: 650; }
.eyebrow { display: block; margin: 0 0 7px; color: var(--brand); font-size: 10px; font-weight: 750; letter-spacing: .12em; line-height: 1.35; text-transform: uppercase; }
h1,h2,h3,h4,p { margin-top: 0; }
h1 { letter-spacing: -.045em; }
h2,h3 { letter-spacing: -.035em; }
.muted { color: var(--muted); }
.surface { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; border: 1px solid transparent; border-radius: 12px; padding: 0 18px; font-size: 13px; font-weight: 700; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; }
.primary-button { color: white; background: var(--brand); box-shadow: 0 7px 17px rgba(40,83,79,.16); }
.primary-button:hover:not(:disabled) { background: #1F4642; }
.secondary-button { color: var(--brand); border-color: var(--line); background: white; }
.secondary-button:hover:not(:disabled), .quiet-button:hover:not(:disabled) { background: var(--mist); }
.quiet-button { min-height: 40px; color: var(--brand); border-color: var(--line); background: transparent; }
.button.small { min-height: 38px; padding: 0 13px; font-size: 12px; }
.form-stack { display: flex; flex-direction: column; gap: 9px; }
.form-stack > div:first-child { margin-bottom: 8px; }
.mfa-secret { display: block; overflow-wrap: anywhere; padding: 12px; border: 1px solid var(--line, #d9dedb); border-radius: 10px; background: var(--surface-muted, #f3f6f4); font: 600 0.95rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
label { color: var(--graphite); font-size: 12px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid #CCDAD5; border-radius: 11px; outline: none; color: var(--graphite); background: white; transition: border-color .15s, box-shadow .15s; }
input { min-height: 46px; padding: 0 13px; }
.password-input-wrap { position: relative; width: 100%; }
.password-input-wrap input { padding-right: 48px; }
.password-visibility-toggle { position: absolute; top: 50%; right: 8px; display: grid; width: 34px; height: 34px; place-items: center; transform: translateY(-50%); border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.password-visibility-toggle:hover { color: var(--brand); background: var(--mist); }
.password-visibility-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.password-visibility-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility-toggle .eye-slash { opacity: 1; transition: opacity .12s ease; }
.password-visibility-toggle[data-visible="true"] .eye-slash { opacity: 0; }
textarea { min-height: 160px; padding: 13px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(131,182,186,.27); }
input::placeholder, textarea::placeholder { color: #879692; }
.hint { color: var(--muted); font-size: 10px; font-weight: 450; }
.field-row { display: flex; gap: 10px; }
.field-grow { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.field-small { width: 75px; display: flex; flex-direction: column; gap: 8px; }
.footnote { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

/* Entry */
.auth-layout { min-height: calc(100vh - 160px); display: grid; grid-template-columns: minmax(0,1.05fr) minmax(350px,.72fr); gap: clamp(42px,8vw,130px); align-items: center; max-width: 1150px; margin: auto; padding: 40px 18px 70px; }
.auth-intro { max-width: 650px; }
.auth-intro h1 { max-width: 620px; margin-bottom: 19px; font-size: clamp(40px,5.2vw,68px); line-height: 1.02; color: var(--brand); }
.auth-intro > p { max-width: 490px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.auth-intro > .auth-benefits-intro { margin-bottom: 8px; }
.auth-benefits-list { display: grid; gap: 8px; max-width: 520px; margin: 0; padding-left: 20px; font-size: 17px; line-height: 1.55; }
.auth-intro > .auth-benefits-intro, .auth-benefits-list, .auth-benefits-list li, .auth-benefits-list li::marker { color: var(--muted); }
.trust-line { display: flex; gap: 10px; align-items: center; max-width: 460px; margin-top: 40px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.trust-check,.review-check { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--brand); background: var(--mist); font-size: 14px; font-weight: 800; }
.auth-card { padding: 24px; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 25px; padding: 4px; border-radius: 12px; background: var(--white); }
.switch-button { min-height: 39px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 650; }
.switch-button.active { color: var(--brand); background: white; box-shadow: 0 2px 8px rgba(48,59,60,.08); }
.auth-card h2 { margin-bottom: 5px; font-size: 24px; }
.auth-card .primary-button { width: 100%; margin-top: 9px; }

/* Workspace */
.workspace { padding: 42px 0 60px; }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.welcome-row h1 { margin-bottom: 5px; color: var(--brand); font-size: clamp(30px,4vw,42px); }
.welcome-row p { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.recoverable-consultations { display: grid; gap: 12px; margin: 0 0 22px; padding: 18px 20px; border-color: #C9DCD4; background: var(--mist); }
.recoverable-consultations-title { margin: 0; color: var(--brand); font-size: 17px; line-height: 1.3; }
.recoverable-consultation-list { display: grid; gap: 8px; max-height: 250px; overflow-y: auto; padding-right: 3px; }
.recoverable-consultation-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.recoverable-consultation-details { display: grid; gap: 4px; min-width: 0; }
.recoverable-patient-name { overflow: hidden; color: var(--graphite); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.recoverable-interrupted-at { color: var(--muted); font-size: 11px; line-height: 1.45; }
.recoverable-consultation-card .button { min-height: 40px; padding: 0 15px; font-size: 12px; }
.recoverable-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.workspace-grid { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0,1.9fr); gap: 22px; align-items: start; }
.patient-list-card { padding: 22px; }
.section-title-row,.history-heading,.panel-heading,.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title-row h2,.panel-heading h2 { margin: 0; font-size: 20px; }
.add-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 13px; color: white; background: var(--brand); }
.add-button-icon { position: relative; display: block; width: 18px; height: 18px; }
.add-button-icon::before,.add-button-icon::after { position: absolute; top: 50%; left: 50%; border-radius: 1px; background: currentColor; content: ""; transform: translate(-50%,-50%); }
.add-button-icon::before { width: 16px; height: 2px; }
.add-button-icon::after { width: 2px; height: 16px; }
.search-box { display: flex; align-items: center; gap: 8px; margin: 20px 0 12px; padding-left: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--sage); background: white; }
.search-box input { min-height: 42px; border: 0; box-shadow: none; }
.patient-form { margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.patient-form input { min-height: 40px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; }
.patient-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.patient-list-section { display: flex; flex-direction: column; gap: 6px; }
.patient-list-section + .patient-list-section { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.patient-list-section-title { margin: 0 0 2px; color: var(--muted); font-size: 11px; font-weight: 700; }
.patient-list-section-items { display: flex; flex-direction: column; gap: 6px; }
.patient-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 10px; border: 1px solid transparent; border-radius: 13px; color: var(--graphite); text-align: left; background: transparent; }
.patient-item:hover { background: #F8FAF9; }
.patient-item.selected { border-color: #C7DCD4; background: var(--mist); }
.patient-initial { display: grid; flex: 0 0 39px; width: 39px; height: 39px; place-items: center; border-radius: 13px; color: var(--brand); background: #D9E8E2; font-size: 13px; font-weight: 750; }
.patient-item-copy { min-width: 0; display: grid; gap: 3px; }
.patient-item-name { overflow: hidden; color: var(--graphite); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.patient-item-detail { color: var(--muted); font-size: 10px; }
.privacy-note { display: flex; gap: 11px; align-items: center; margin: 13px 4px 0; padding: 13px; border-radius: 14px; background: var(--mist); }
.privacy-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.privacy-note strong { color: var(--brand); }
.patient-panel { min-height: 480px; padding: clamp(20px,3.5vw,40px); }
.placeholder-state { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.placeholder-mark { display: grid; width: 62px; height: 62px; place-items: center; margin-bottom: 18px; border-radius: 21px; color: var(--brand); background: var(--mist); font-size: 30px; font-weight: 700; }
.placeholder-state h2 { margin-bottom: 9px; color: var(--brand); font-size: 25px; }
.placeholder-state p { max-width: 360px; margin-bottom: 19px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.patient-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.patient-avatar { display: grid; flex: 0 0 54px; width: 54px; height: 54px; place-items: center; border-radius: 18px; color: var(--brand); background: var(--mist); font-size: 17px; font-weight: 750; }
.patient-heading-copy { flex: 1; min-width: 0; }
.patient-heading-copy h2 { margin: 0 0 4px; overflow-wrap: anywhere; color: var(--graphite); font-size: 22px; }
.patient-heading-copy .muted { margin: 0; font-size: 12px; }
.history-heading { margin: 26px 0 15px; }
.history-heading h3 { margin: 0; font-size: 19px; }
.clinical-documents { margin-top: 26px; }
.clinical-documents > .history-heading { margin-top: 0; }
.document-category { margin-top: 16px; }
.document-category-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.document-category-heading h4 { margin: 0; color: var(--graphite); font-size: 14px; }
.count-pill,.draft-label { padding: 7px 10px; border-radius: 999px; color: var(--brand); background: var(--mist); font-size: 10px; font-weight: 700; }
.clinical-history { display: flex; flex-direction: column; gap: 10px; }
.history-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.history-top { display: flex; justify-content: space-between; gap: 12px; }
.history-title { margin: 0; font-size: 13px; font-weight: 750; }
.history-date { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.history-reason { margin: 8px 0 0; color: var(--brand); font-size: 12px; font-weight: 650; }
.history-note { margin: 12px 0 0; color: var(--graphite); font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-observation { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--mist-green, #E6EFEB); border-radius: 10px; background: var(--natural-white, #F4F7F5); }
.history-observation[data-validation-status="unverified"] { border-style: dashed; }
.history-observation[data-validation-status="rejected"] { opacity: .72; }
.history-observation-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.clinical-origin-tag, .clinical-validation-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 10px; line-height: 1.4; font-weight: 600; }
.clinical-origin-tag { color: var(--graphite, #303B3C); background: #E6EFEB; }
.origin-ai_inferred { color: #694B12; background: #F8EBCB; }
.clinical-validation-tag { color: #694B12; background: #F8EBCB; }
.validation-verified { color: #24564A; background: #DDEDE6; }
.validation-rejected { color: #7A3030; background: #F5E1E1; }
.history-observation-audit { display: block; margin-top: 6px; color: var(--muted, #687575); font-size: 10px; }

.status-pill { display: inline-flex; margin-top: 11px; padding: 5px 9px; border-radius: 99px; color: var(--brand); background: var(--mist); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.status-pill.active { color: #664E1D; background: #F4EBD3; }
.empty-state { margin: 15px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.history-empty { padding: 30px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; }

/* Live consultation workspace */
.consultation-room { padding: 28px 0 60px; }
.consultation-topline { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 32px; }
.back-button { border: 0; padding: 8px 0; color: var(--brand); background: transparent; font-size: 13px; font-weight: 700; }
.consultation-patient { display: grid; gap: 2px; text-align: center; }
.consultation-patient .eyebrow { margin: 0; font-size: 9px; }
.consultation-patient strong { color: var(--graphite); font-size: 13px; }
.consultation-title-row { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 20px; }
.consultation-title-row h1 { max-width: 720px; margin: 0; color: var(--brand); font-size: clamp(27px,3.3vw,39px); line-height: 1.12; }
.session-status { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 11px; font-weight: 700; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sage); }
.session-status.recording { color: #842D28; border-color: #E8BDB8; background: var(--danger-soft); }
.session-status.recording .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(183,71,64,.13); }
.session-status.paused { color: #664E1D; border-color: #EAD9AE; background: #FBF6E9; }
.session-status.paused .status-dot { background: #AD812B; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(183,71,64,0); } }
.recorder-card { display: grid; gap: 13px; min-width: 0; padding: 16px; }
.recorder-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.recorder-card-heading .eyebrow { margin: 3px 0 0; }
.recorder-statuses { display: grid; justify-items: end; gap: 7px; }
.recorder-statuses .session-status { padding: 6px 9px; font-size: 10px; }
.recorder-left { display: flex; align-items: center; gap: 15px; min-width: 0; }
.record-symbol { display: grid; flex: 0 0 43px; width: 43px; height: 43px; place-items: center; border-radius: 14px; background: var(--mist); }
.record-symbol img { display: block; width: 28px; height: 28px; object-fit: contain; transition: transform .25s ease, filter .25s ease; }
.record-symbol.active { background: var(--danger-soft); }
.record-symbol.active img { animation: sage-recording 1.7s ease-in-out infinite; filter: saturate(1.25) drop-shadow(0 0 4px rgba(183,71,64,.42)); }
@keyframes sage-recording { 0%,100% { transform: scale(.88) rotate(-5deg); } 50% { transform: scale(1.08) rotate(5deg); } }
.recorder-copy { min-width: 0; }
.recorder-left strong { display: block; font-size: 14px; }
.recorder-left p { max-width: 560px; margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.recorder-feedback-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.recorder-feedback-actions .button { min-height: 30px; }
.recorder-controls { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: center; gap: 7px; }
.record-duration { min-width: 54px; color: var(--graphite); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 750; }
.record-button { min-height: 42px; color: white; border: 0; border-radius: 11px; padding: 0 15px; background: var(--brand); font-size: 12px; font-weight: 750; }
.stop-button { min-height: 42px; color: #842D28; border: 1px solid #E8BDB8; border-radius: 11px; padding: 0 14px; background: var(--danger-soft); font-size: 12px; font-weight: 750; }
.recorder-controls .record-duration { grid-column: 1 / -1; min-width: 0; text-align: right; }
.recorder-controls .button { min-height: 38px; padding: 0 7px; font-size: 10px; }
.recorder-consents { display: grid; gap: 9px; padding-top: 11px; border-top: 1px solid var(--line); }
.consent-row { display: flex; align-items: flex-start; gap: 8px; margin: 0; }
.consent-row input { width: 17px; height: 17px; min-height: 17px; margin: 1px 0 0; accent-color: var(--brand); }
.consent-row span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.transcription-consent-row { padding-top: 8px; border-top: 1px dashed var(--line); }
.callout { margin-bottom: 19px; padding: 14px 16px; border-radius: 12px; font-size: 12px; line-height: 1.55; }
.info-callout { color: #334945; border: 1px solid #C6DCD4; background: var(--mist); }
.consultation-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.75fr); gap: 18px; align-items: start; }
.transcript-panel,.document-panel { padding: 22px; }
.panel-heading { margin-bottom: 17px; }
.panel-heading h2 { font-size: 19px; }
.transcript-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 145px; margin-bottom: 20px; padding: 20px; border: 1px dashed #C8D6D1; border-radius: 14px; background: #FAFCFB; text-align: center; }
.wave-mark { margin-bottom: 8px; color: var(--accent); font-size: 30px; line-height: 1; }
.transcript-empty strong { font-size: 12px; }
.transcript-empty p { max-width: 420px; margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.transcript-consent { padding: 10px 12px; border-radius: 10px; background: var(--mist); font-size: 11px; line-height: 1.5; }
.transcript-consent span { color: var(--muted); }
.transcription-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
#transcription-status { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
#transcription-disclosure { padding: 9px 11px; border-left: 3px solid var(--sage); background: var(--natural-white); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.transcript-segments { display: grid; gap: 10px; margin: 14px 0 18px; }
.transcript-segment { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid #DDE6E2; border-radius: 10px; background: #FCFDFC; }
.transcript-timestamp { align-self: start; border: 0; padding: 3px 0; color: var(--brand); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.transcript-segment-body { display: grid; gap: 7px; min-width: 0; }
.transcript-segment-body textarea { min-height: 50px; padding: 8px 10px; font-size: 12px; }
.transcript-speaker { color: var(--brand); font-size: 11px; font-weight: 700; }
.transcript-segment-body select { max-width: 250px; min-height: 34px; font-size: 11px; }
#audio-playback { display: block; width: 100%; margin: -6px 0 13px; }
.text-action { margin: 0 0 15px; padding: 0; border: 0; color: var(--brand); background: transparent; font-size: 11px; font-weight: 700; text-decoration: underline; }
.field-label-row { margin: 14px 0 7px; }
.save-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 14px; }
.save-hint { color: var(--muted); font-size: 10px; line-height: 1.4; }
.document-panel > .muted { margin: 0 0 15px; font-size: 12px; line-height: 1.6; }
.spark { color: var(--accent); font-size: 22px; }
.document-list { display: grid; gap: 8px; }
.document-item { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.document-icon { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: var(--brand); background: var(--mist); font-size: 12px; font-weight: 750; }
.document-item > span:nth-child(2) { flex: 1; display: grid; gap: 3px; min-width: 0; }
.document-item strong { font-size: 11px; }
.document-item small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.soon { padding: 5px 7px; border-radius: 99px; color: var(--muted); background: var(--white); font-size: 9px; font-weight: 700; }
.human-review { display: flex; align-items: flex-start; gap: 10px; margin-top: 15px; padding: 12px; border-radius: 12px; background: var(--mist); }
.human-review p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.human-review strong { color: var(--brand); }
.site-footer { display: flex; justify-content: space-between; gap: 14px; padding: 17px 0 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.notice { position: fixed; right: 20px; bottom: 18px; z-index: 20; max-width: min(420px,calc(100% - 40px)); padding: 14px 17px; border: 1px solid var(--line); border-radius: 13px; color: var(--graphite); background: white; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; }
.notice.error { color: #842D28; border-color: #E8BDB8; background: #FFF9F8; }
@media(max-width:900px) {
  .app-shell { width: min(calc(100% - 36px),720px); }
  .workspace-grid { grid-template-columns: 1fr; }
  .patient-list { max-height: 300px; }
  .consultation-grid { grid-template-columns: 1fr; }
  .document-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .consultation-title-row { align-items: flex-start; flex-direction: column; }
}
@media(max-width:620px) {
  .app-shell { width: calc(100% - 28px); }
  .topbar { height: 72px; }
  .brand-logo { width: 125px; }
  .account-actions { gap: 8px; }
  .account-copy .eyebrow { display: none; }
  .account-copy strong { max-width: 120px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .quiet-button { min-height: 36px; padding: 0 11px; }
  .auth-layout { min-height: auto; grid-template-columns: 1fr; gap: 24px; padding: 42px 0 48px; }
  .auth-intro h1 { font-size: clamp(37px,10vw,54px); }
  .auth-intro > p, .auth-benefits-list { font-size: 14px; }
  .trust-line { margin-top: 20px; }
  .auth-card { padding: 18px; }
  .workspace { padding-top: 28px; }
  .welcome-row { align-items: flex-start; flex-direction: column; }
  .welcome-row h1 { font-size: 31px; }
  .recoverable-consultations { gap: 10px; margin-bottom: 16px; padding: 15px; }
  .recoverable-consultations-title { font-size: 16px; }
  .recoverable-consultation-list { max-height: 220px; }
  .recoverable-consultation-card { grid-template-columns: 1fr; gap: 10px; padding: 12px; }
  .recoverable-consultation-card .button { width: 100%; }
  .recoverable-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .patient-panel { min-height: 400px; padding: 18px; }
  .patient-heading { flex-wrap: wrap; }
  .patient-heading-copy { flex-basis: calc(100% - 75px); }
  .patient-heading > .button { width: 100%; }
  .history-top { flex-direction: column; gap: 5px; }
  .consultation-room { padding-top: 18px; }
  .consultation-topline { margin-bottom: 25px; }
  .consultation-topline .quiet-button { font-size: 10px; }
  .consultation-patient strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .consultation-title-row h1 { font-size: 29px; }
.recorder-card { padding: 14px; }
.recorder-controls { grid-template-columns: 1fr; }
.recorder-controls .record-duration { grid-column: auto; text-align: left; }
.recorder-controls .button { width: 100%; }
  .transcript-panel,.document-panel { padding: 17px; }
  .document-list { grid-template-columns: 1fr; }
  .save-row { align-items: stretch; flex-direction: column; }
  .save-row .button { width: 100%; }
  .site-footer { flex-direction: column; gap: 5px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* Prescription review dialog */
.prescription-dialog{width:min(920px,calc(100vw - 2rem));max-height:88vh;overflow:auto;border:1px solid #83B6BA;border-radius:18px;padding:1.5rem;color:#303B3C;background:#F4F7F5;box-shadow:0 24px 80px #172b2b55}
.prescription-dialog::backdrop{background:#182a2bcc}
.prescription-dialog .prescription-item{background:#fff;border:1px solid #E6EFEB;border-radius:12px;padding:1rem;margin:1rem 0}
.prescription-dialog .prescription-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:.7rem}
.prescription-dialog label{display:grid;gap:.25rem;color:#28534F;font-size:.9rem}
.prescription-dialog input,.prescription-dialog textarea,.prescription-dialog select{width:100%;padding:.65rem;border:1px solid #789D91;border-radius:8px;background:white;color:#303B3C}
.prescription-dialog .context-warning{background:#E6EFEB;border-left:4px solid #83B6BA;padding:.75rem;margin:.6rem 0}
.prescription-dialog .ai-pending{border-left:4px solid #83B6BA}
.prescription-dialog .prescription-version{border-top:1px solid #789D91;padding:.7rem 0}
/* Consultation workflow additions */
.consultation-title-main { min-width: 0; }
.consultation-title-actions { display: grid; justify-items: end; gap: 9px; }
.consultation-lifecycle-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.sync-status { display: inline-flex; align-items: center; gap: 7px; color: #24564A; font-size: 11px; font-weight: 700; }
.sync-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #3D8A63; box-shadow: 0 0 0 3px rgba(61,138,99,.13); }
.sync-status[data-state="pending"] { color: #765B18; }
.sync-status[data-state="pending"] .sync-status-dot { background: #C3942D; box-shadow: 0 0 0 3px rgba(195,148,45,.16); }
.sync-status[data-state="error"] { color: #842D28; }
.sync-status[data-state="error"] .sync-status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(183,71,64,.13); }
.consultation-side-column { display: grid; gap: 16px; min-width: 0; }
.soap-panel,.chat-panel,.audio-review-panel { padding: 20px; }
.soap-sections { display: grid; gap: 9px; }
.soap-section { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); }
.soap-section-heading { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.soap-section-heading strong { color: var(--brand); font-size: 12px; }
.soap-section-heading span,.soap-section p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.soap-record { margin-top: 7px !important; color: var(--graphite) !important; white-space: pre-wrap; overflow-wrap: anywhere; }
.soap-other-records { padding-top: 5px; border-top: 1px solid var(--line); }
.document-panel { min-width: 0; }
.document-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.document-item { display: grid; align-items: center; min-width: 0; grid-template-columns: 28px minmax(0,1fr) auto; gap: 8px; padding: 8px; }
.document-item > span:nth-child(2) { min-width: 0; }
.document-item strong { display: block; overflow-wrap: anywhere; font-size: 10px; }
.document-item small,.document-item .soon { font-size: 9px; }
.chat-panel { margin-top: 17px; }
.sage-chat-messages { display: grid; gap: 9px; max-height: 240px; overflow-y: auto; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.sage-chat-message { max-width: min(80%,600px); margin: 0; padding: 10px 12px; border-radius: 12px; color: var(--graphite); background: white; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.sage-chat-message.doctor { justify-self: end; color: white; background: var(--brand); }
.sage-chat-system-message { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sage-chat-compose { display: grid; grid-template-columns: minmax(0,1fr); align-items: stretch; gap: 9px; margin-top: 10px; }
.sage-chat-compose textarea { min-height: 56px; resize: vertical; }
.sage-send-button { width: 100%; min-height: 56px; justify-self: stretch; align-self: stretch; padding: 0 18px; border: 1px solid rgba(40,83,79,.2); border-radius: 999px; color: var(--brand); background: rgba(40,83,79,.045); box-shadow: none; font-size: 14px; }
.sage-send-button:hover:not(:disabled) { background: rgba(40,83,79,.09); }
.sage-send-button img { width: 23px; height: 23px; object-fit: contain; opacity: .68; }
.audio-review-panel { margin-top: 17px; box-shadow: none; }
.audio-review-panel .eyebrow { margin-bottom: 8px; }
.audio-review-panel audio { display: block; width: 100%; }
.local-draft-conflict { margin-top: 14px; padding: 12px; border: 1px solid #E8D6A8; border-radius: 12px; color: #684F18; background: #FBF6E9; }
.local-draft-conflict summary,.consultation-history summary { cursor: pointer; font-size: 12px; font-weight: 700; }
.local-draft-conflict p { margin: 8px 0; font-size: 11px; line-height: 1.5; }
.consultation-history { display: grid; gap: 10px; margin-top: 13px; }
.consultation-history summary { color: var(--brand); }
.consultation-history-content { display: grid; gap: 14px; margin-top: 12px; }
.consultation-history-block { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.consultation-history-block h5 { margin: 0 0 8px; color: var(--brand); font-size: 12px; }
.consultation-history-block p,.consultation-history-block li { margin: 5px 0; color: var(--graphite); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.consultation-history-block ul { margin: 0; padding-left: 18px; }
.consultation-history-block audio { display: block; width: 100%; margin-top: 8px; }
.history-provenance { display: inline-flex; margin: 4px 5px 0 0; padding: 3px 7px; border-radius: 999px; color: var(--brand); background: var(--mist); font-size: 9px; font-weight: 700; }
.consultation-exit-dialog { width: min(520px,calc(100% - 28px)); padding: 25px; border: 1px solid var(--line); border-radius: 18px; color: var(--graphite); background: var(--paper); box-shadow: var(--shadow); }
.consultation-exit-dialog::backdrop { background: rgba(28,45,43,.48); }
.consultation-exit-dialog h2 { margin-bottom: 8px; color: var(--brand); font-size: 20px; }
.consultation-exit-dialog p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.consultation-exit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }
@media(max-width:900px) { .consultation-title-actions { justify-items: start; } .consultation-lifecycle-actions { justify-content: flex-start; } }
@media(max-width:620px) {
  .consultation-title-actions,.consultation-lifecycle-actions { width: 100%; }
  .consultation-lifecycle-actions .button { flex: 1; }
  .document-list { grid-template-columns: 1fr; }
  .document-item { grid-template-columns: 28px minmax(0,1fr) auto; }
  .sage-chat-compose { grid-template-columns: 1fr; }
  .sage-chat-compose .button { width: 100%; }
  .consultation-exit-actions { flex-direction: column; }
  .consultation-exit-actions .button { width: 100%; }
  .soap-panel,.chat-panel,.audio-review-panel { padding: 16px; }
}
@media(max-width:640px){.prescription-dialog{width:calc(100vw - 1rem);max-height:94vh;padding:1rem}}
.security-dialog { width: min(520px,calc(100vw - 28px)); max-height: 90vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 18px; color: var(--graphite); background: var(--paper); box-shadow: var(--shadow); }
.settings-dialog { width: min(620px,calc(100vw - 28px)); }
.security-dialog::backdrop { background: rgba(28,45,43,.48); }
.security-dialog h2 { margin-bottom: 0; color: var(--brand); font-size: 21px; }
.security-dialog > p { margin-top: 12px; line-height: 1.55; }
.security-dialog .form-stack { gap: 10px; margin-top: 14px; }
.security-dialog label { display: grid; gap: 5px; color: var(--brand); font-size: 12px; font-weight: 650; }
.security-dialog input,.security-dialog select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--graphite); }
.security-dialog .button-row { display: flex; justify-content: flex-end; gap: 8px; }
.security-dialog .mfa-secret { display: block; padding: 13px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 9px; background: white; font-family: ui-monospace,monospace; font-size: 13px; }
.settings-menu { display: grid; gap: 7px; margin: 18px 0 10px; }
.settings-menu-item { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--brand); background: white; font-size: 12px; font-weight: 700; text-align: left; }
.settings-menu-item:hover,.settings-menu-item.active { border-color: #B8CDC5; background: var(--mist); }
.settings-placeholder { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.settings-panel { margin-top: 14px; }
.settings-panel > h3 { margin: 0 0 10px; color: var(--brand); font-size: 17px; }
.settings-panel > p { line-height: 1.55; }
.settings-panel > .button { margin-top: 4px; }
.settings-dialog .settings-panel .form-stack { margin-top: 14px; }

/* Integrated clinical workflow additions */
.patient-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.patient-profile-dialog { width: min(820px,calc(100vw - 28px)); max-height: 90vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 18px; color: var(--graphite); background: var(--paper); box-shadow: var(--shadow); }
.patient-profile-dialog::backdrop { background: rgba(28,45,43,.48); }
.patient-profile-dialog .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.patient-profile-dialog .panel-heading h2 { margin: 0; color: var(--brand); font-size: 22px; }
.patient-profile-dialog .form-stack { gap: 13px; }
.profile-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 13px; }
.profile-form-grid > div { display: grid; gap: 6px; min-width: 0; }
.profile-form-grid input,.profile-form-grid select,.profile-form-section input,.profile-form-section select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--graphite); background: white; }
.profile-form-section { min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.profile-form-section legend { padding: 0 6px; color: var(--brand); font-size: 12px; font-weight: 700; }
.profile-form-contacts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.profile-form-contacts .profile-form-section { display: grid; align-content: start; gap: 6px; }
.patient-profile-dialog .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.patient-profile-dialog .form-status.error { color: #842D28; }
.registration-group { min-width: 0; margin: 4px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.registration-group legend { padding: 0 6px; color: var(--brand); font-size: 12px; font-weight: 700; }
.registration-review-highlight { color: var(--brand); font-weight: 750; }
.registration-group select,.registration-group input { width: 100%; min-width: 0; }
.registration-fields { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.1fr) minmax(0,.65fr); gap: 10px; align-items: end; }
.registration-fields > div { display: grid; min-width: 0; gap: 7px; }
.registration-fields select { width: 100%; min-width: 0; min-height: 44px; padding: 0 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--graphite); background: var(--paper); }
.registration-fields { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.2fr) minmax(0,.65fr); align-items: end; }
.registration-fields > div { min-width: 0; }
.registration-fields .field-small { width: auto; }
.consultation-grid { grid-template-columns: minmax(0,1.08fr) minmax(320px,.92fr); }
.consultation-primary-column { display: grid; min-width: 0; gap: 18px; }
.consultation-sidebar { display: grid; min-width: 0; gap: 16px; }
.clinical-overview,.notes-panel { min-width: 0; padding: 22px; }
.clinical-overview .panel-heading,.notes-panel .panel-heading { align-items: flex-start; }
.soap-inputs { display: grid; gap: 13px; }
.soap-legacy-notice { margin: 0 0 12px; padding: 10px 12px; border-radius: 9px; background: var(--mist); font-size: 11px; line-height: 1.5; }
.soap-input-group { display: grid; gap: 7px; min-width: 0; }
.soap-input-group textarea { min-height: 92px; width: 100%; resize: vertical; }
.live-transcription-panel { display:grid; gap:10px; padding:14px; border:1px solid var(--line); border-radius:12px; background:#fbfdfc; }
.live-transcription-panel h2 { margin:2px 0 0; font-size:17px; }
.live-transcription-state { color:var(--muted); font-size:11px; }
.live-transcription-text { display:grid; gap:8px; max-height:340px; overflow:auto; }
.live-transcript-turn { display:grid; grid-template-columns:54px 1fr; gap:10px; padding:9px 10px; border-radius:9px; background:var(--white); border:1px solid var(--line); }
.live-transcript-turn.is-partial { opacity:.68; border-style:dashed; }
.live-transcript-turn time { color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.live-transcript-turn strong { color:var(--brand); font-size:11px; }
.live-transcript-turn p { margin:3px 0 0; white-space:pre-wrap; overflow-wrap:anywhere; font-size:13px; }
.transcription-usage-summary { margin:0; color:var(--muted); font-size:11px; }
#clinical-note[hidden] { display: none !important; }
.clinical-summary-unavailable { padding: 12px 14px; border-left: 3px solid var(--sage); border-radius: 8px; color: var(--graphite); background: var(--mist); font-size: 12px; line-height: 1.55; }
.clinical-overview .soap-sections { grid-template-columns: 1fr; gap: 10px; }
.clinical-overview .soap-section { min-height: 100px; }
.clinical-overview .soap-record { overflow-wrap: anywhere; }
.clinical-history-details { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.clinical-history-details h3,.clinical-history-details h4 { margin: 0 0 9px; color: var(--brand); }
.clinical-history-entry { display: grid; gap: 7px; margin: 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.clinical-history-entry p { margin: 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.clinical-history-entry summary { color: var(--brand); font-size: 12px; font-weight: 700; cursor: pointer; }
.notes-panel #clinical-note-subjective,.notes-panel #clinical-note-objective,.notes-panel #clinical-note-assessment,.notes-panel #clinical-note-plan { width: 100%; min-height: 92px; resize: vertical; }
.notes-panel .panel-heading .hint { text-align: right; }
.sync-status[data-state="failed"] { color: #842D28; }
.sync-status[data-state="failed"] .sync-status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(183,71,64,.13); }
.export-authorization-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--mist); color: var(--graphite); font-size: 12px; line-height: 1.5; }
.export-authorization-check input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--brand); }
.patient-export-dialog { max-width: 620px; }
.global-assistant { position: fixed; z-index: 20; right: max(20px,env(safe-area-inset-right)); bottom: max(20px,env(safe-area-inset-bottom)); display: grid; justify-items: end; gap: 12px; }
.assistant-toggle { min-height: 48px; padding-inline: 18px; border-radius: 999px; box-shadow: 0 9px 28px rgba(40,83,79,.25); }
.assistant-window { display: grid; gap: 12px; width: min(585px,calc(100vw - 32px)); max-height: min(90vh,930px); padding: 20px; overflow: auto; }
.assistant-window .panel-heading { margin-bottom: 0; }
.assistant-window .panel-heading h2 { font-size: 17px; }
.assistant-unavailable { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.assistant-window .sage-chat-messages { min-height: 150px; max-height: min(57vh,450px); }
.assistant-window .sage-chat-compose { grid-template-columns: minmax(0,1fr); align-items: stretch; }
.sage-chat-message.unsent { border: 1px dashed var(--sage); opacity: .82; }
@media(max-width:900px) {
  .patient-heading { align-items: flex-start; flex-wrap: wrap; }
  .patient-heading-actions { width: 100%; justify-content: flex-start; }
}
@media(max-width:620px) {
  .registration-fields { grid-template-columns: minmax(0,1fr); }
  .registration-group { padding: 10px; }
  .clinical-overview,.notes-panel { padding: 16px; }
  .assistant-window { width: calc(100vw - 20px); max-height: calc(100dvh - 88px); padding: 14px; }
  .clinical-overview .soap-sections { grid-template-columns: 1fr; }
  .patient-heading-actions { display: grid; grid-template-columns: 1fr; }
  .patient-heading-actions .button { width: 100%; }
  .profile-form-grid,.profile-form-contacts { grid-template-columns: 1fr; }
  .patient-profile-dialog { padding: 17px; }
  .assistant-window { padding: 14px; }
  .assistant-window .sage-chat-compose { grid-template-columns: minmax(0,1fr); align-items: stretch; }
  .assistant-window .sage-chat-compose .button { width: 100%; }
}
