body.authenticated .app:has(#consultations:not(.hidden)) { min-width:0; }
#consultations { padding: 18px 24px; min-width:0; }
#consultations select { height:44px; min-height:44px; font-size:16px; }
.consult-toolbar { display:flex; align-items:end; flex-wrap:wrap; gap:10px; margin-bottom:8px; }
.consult-toolbar label { width:280px; max-width:100%; display:grid; gap:6px; color:#60736d; font-size:13px; }
.consult-toolbar button { min-height:42px; }
.consult-toolbar > .action-menu { margin-left:auto; }
.consult-workspace { display:grid; grid-template-columns:220px minmax(0,1fr); border:1px solid #d8e2df; height:calc(100dvh - 238px); min-height:450px; background:#fff; }
.consult-patients { border-right:1px solid #d8e2df; display:flex; flex-direction:column; min-height:0; }
.consult-patients header { display:flex; justify-content:space-between; padding:16px; flex:none; }
#consultVisitList { overflow:auto; min-height:0; }
.consult-patient { display:grid; gap:6px; text-align:left; width:100%; border:0; border-bottom:1px solid #e2e9e7; border-radius:0; padding:14px 16px; background:#fff; color:#19252c; min-height:74px; }
.consult-patient.selected { background:#e0f0eb; border-left:3px solid #15786d; }
.consult-patient small { color:#6b797e; }
.consult-main { display:flex; flex-direction:column; min-width:0; min-height:0; }
#consultVisitHeader { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; border-bottom:1px solid #d8e2df; flex:none; }
#consultVisitHeader h2 { margin:0; font-size:20px; overflow-wrap:anywhere; min-width:0; }
#consultVisitHeader h2 small { color:#405d55; font-size:14px; font-weight:400; display:inline-block; }
#consultVisitHeader h2 .patient-code { font-weight:600; }
#consultCancelCheck[hidden] { display:none !important; }
.consult-patient-matches .consult-patient-identity { color:#405d55; font-size:13px; font-weight:500; overflow-wrap:anywhere; }
.consult-header-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.consult-header-actions .icon-control { flex-shrink:0; }
.consult-trash-row { display:flex; align-items:center; gap:16px; border-bottom:1px solid #d8e2df; padding:14px 0; }
.consult-trash-row > div { flex:1; min-width:0; overflow-wrap:anywhere; }
.consult-trash-row small { display:block; margin-top:5px; color:#657672; }
.consult-trash-row button { flex-shrink:0; min-height:44px; }
#consultTrashDialog .consult-actions { margin-bottom:0; }
.consult-tabs { display:flex; overflow:auto; flex:none; border-bottom:1px solid #d8e2df; padding:0 12px; }
.consult-tabs button { white-space:nowrap; background:transparent; border:0; border-bottom:3px solid transparent; border-radius:0; color:#647570; padding:12px; min-height:44px; }
.consult-tabs button.active { border-bottom-color:#17887a; color:#126e62; }
#consultContent { overflow:auto; min-height:0; padding:20px; }
.consult-grid { display:grid; grid-template-columns:minmax(240px,1fr) minmax(280px,1.25fr); gap:24px; }
.consult-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.consult-fields label { display:grid; gap:6px; font-size:13px; color:#5c7070; }
.consult-fields .full { grid-column:1/-1; }
.consult-fields textarea { min-height:88px; resize:vertical; }
.consult-fields input, .consult-fields select, .consult-fields textarea { width:100%; min-width:0; box-sizing:border-box; }
.consult-other { margin-top:16px; }
.consult-other .consult-fields { margin-top:12px; }
.consult-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:18px 0; }
.consult-photo { max-width:100%; width:100%; max-height:380px; object-fit:contain; background:#f4f7f6; }
.consult-source { white-space:pre-wrap; overflow-wrap:anywhere; max-height:320px; overflow:auto; line-height:1.7; border-top:1px solid #dbe4e1; padding:12px 0; }
.consult-note { font-size:13px; color:#657672; line-height:1.6; }
.consult-warning { border-left:3px solid #d58729; padding:10px 14px; background:#fff5e9; color:#8c461b; line-height:1.6; margin:12px 0; overflow-wrap:anywhere; }
.consult-band { padding:12px 0; border-bottom:1px solid #dde7e3; }
.consult-band h3 { font-size:16px; margin:6px 0; }
.consult-band p { white-space:pre-wrap; overflow-wrap:anywhere; }
.consult-reference-mode { display:flex; flex-wrap:wrap; gap:8px 16px; align-items:center; margin-bottom:12px; }
.consult-reference-mode .consult-segments { flex-wrap:wrap; max-width:100%; }
.consult-change-row { border-top:1px solid #dde7e3; padding:12px 0; }
.consult-change-row h4 { font-size:14px; margin:0 0 10px; overflow-wrap:anywhere; }
.consult-change-row textarea { min-height:66px; }
.consult-prescription { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px 20px; margin:16px 0; font-size:15px; line-height:1.7; }
.consult-prescription[hidden] { display:none; }
.consult-prescription > div { min-width:0; overflow-wrap:anywhere; }
.consult-prescription small { display:block; color:#657672; font-size:13px; }
@media(max-width:600px) { .consult-prescription { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; } }
.consult-table { width:100%; border-collapse:collapse; table-layout:fixed; }
.consult-table th,.consult-table td { padding:8px; border-bottom:1px solid #dce5e2; text-align:left; overflow-wrap:anywhere; }
.consult-table input { width:100%; min-width:0; box-sizing:border-box; }
.consult-table .consult-warning:empty { display:none; }
.consult-table small.consult-warning:not(:empty) { display:block; margin:6px 0 0; }
.consult-table .dose { width:90px; }
.consult-table .remove { width:60px; }
.consult-table td:last-child button { box-sizing:border-box; padding:8px; width:44px; min-width:44px; height:44px; }
.consult-table img { width:18px; height:18px; }
.consult-empty { padding:30px 0; color:#6a7a75; }
.consult-check { display:flex; align-items:center; gap:8px; margin:14px 0; font-size:14px; }
.consult-check input { width:18px; height:18px; }
#consultContent.consult-form-view { display:flex; flex-direction:column; overflow:hidden; padding:0; flex:1; }
.consult-conversation { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; touch-action:pan-y pinch-zoom; -webkit-overflow-scrolling:touch; overflow-anchor:none; padding:20px; container-type:inline-size; }
#consultConversationBody { display:flow-root; }
.consult-message { margin:0 0 20px; padding:12px 16px; max-width:720px; line-height:1.8; overflow-wrap:anywhere; }
.consult-message p { margin:6px 0; white-space:pre-wrap; }
.consult-message small { color:#60736d; font-size:12px; }
.consult-message.user { margin-left:auto; background:#eef5f3; border-radius:6px; }
.consult-message.assistant { border-left:3px solid #729083; }
.consult-message summary { cursor:pointer; font-size:13px; color:#5c7070; }
.consult-message progress { width:100%; }
@media(max-width:760px) { #consultContent.consult-form-view { height:70dvh; min-height:420px; flex:none; } .consult-conversation { padding:14px; } }
.consult-summary { margin:12px 0; }
.consult-summary > div { display:grid; grid-template-columns:110px minmax(0,1fr); gap:14px; border-bottom:1px solid #e3e9e7; padding:10px 0; font-size:14px; line-height:1.7; }
.consult-summary dt { color:#61756e; }
.consult-summary dd { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.consult-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin:0 0 14px; }
.consult-section-head h3 { margin:0; font-size:17px; }
.consult-section-head .consult-actions { margin:0; }
.consult-section-head select { width:auto; max-width:100%; min-height:44px; }
.consult-intake { width:100%; min-width:0; margin-bottom:0; }
.consult-patient-matches { border-block:1px solid #d8e2df; max-height:320px; overflow:auto; }
.consult-patient-matches:empty { border:0; }
.consult-patient-matches .consult-patient { min-height:64px; width:100%; justify-content:stretch; align-items:stretch; }
.consult-patient-matches strong { display:flex; justify-content:space-between; gap:16px; overflow-wrap:anywhere; }
.consult-patient-matches strong span { font-weight:400; }
.consult-patient-picker [hidden] { display:none !important; }
#consultPickedPatient { padding-block:16px; border-top:1px solid #d8e2df; }
#consultPickedPatient h3 { font-size:17px; margin:0; overflow-wrap:anywhere; }
.consult-patient-picker .consult-bottom-actions { flex-wrap:nowrap; }
.consult-patient-picker .consult-bottom-actions button { flex:none; }
.consult-patient-picker .consult-bottom-actions span { min-width:0; overflow-wrap:anywhere; }
@media(max-width:760px) {
  .consult-patient-matches { max-height:300px; }
  .consult-patient-picker .consult-bottom-actions { position:sticky; bottom:0; padding:12px 0; }
  .consult-patient-picker .consult-bottom-actions > span { flex-basis:auto; }
}
.consult-segments { display:flex; gap:0; padding:3px; margin:0; border:1px solid #d8e2df; border-radius:6px; background:#f4f7f6; min-width:0; }
.consult-segments label { position:relative; display:flex; cursor:pointer; }
.consult-segments input { position:absolute; opacity:0; width:1px; height:1px; }
.consult-segments span { display:flex; align-items:center; justify-content:center; padding:10px 14px; min-height:44px; box-sizing:border-box; border-radius:4px; font-size:14px; }
.consult-segments input:checked + span { background:#fff; color:#126e62; box-shadow:0 1px 3px #132e2422; font-weight:600; }
.consult-segments input:focus-visible + span { outline:2px solid #16786d; outline-offset:1px; }
.consult-segments input:disabled + span { cursor:default; opacity:.65; }
.consult-wide-label { display:grid; gap:8px; min-width:0; margin:12px 0; color:#506762; font-size:14px; }
.consult-wide-label :is(input,select,textarea) { width:100%; min-width:0; box-sizing:border-box; }
.consult-wide-label textarea { min-height:92px; resize:vertical; line-height:1.8; font-size:16px; }
.consult-handwriting textarea { min-height:160px; padding:14px; }
.consult-chief textarea { min-height:88px; }
#consultIntakeForm { min-width:0; }
.consult-form-section { padding:26px 0; border-bottom:1px solid #dde7e3; min-width:0; }
.consult-form-section:first-child { padding-top:0; }
.consult-form-section h3,.consult-diagnostics > h3 { margin:0 0 14px; font-size:16px; line-height:1.5; color:#243b35; }
.consult-form-section > textarea { width:100%; min-width:0; box-sizing:border-box; min-height:92px; font-size:16px; line-height:1.8; resize:vertical; }
.consult-form-section .consult-section-head { margin-bottom:0; gap:12px; flex-wrap:wrap; }
.consult-form-section .consult-section-head h3 { margin:0; }
.consult-form-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin-bottom:18px; }
.consult-form-heading h3 { display:flex; align-items:center; gap:10px; margin:0; }
.consult-section-number { font-size:12px; font-weight:400; font-variant-numeric:tabular-nums; color:#687976; }
.consult-form-meta { color:#687976; font-size:12px; }
.consult-basics { grid-template-columns:minmax(0,1fr) minmax(0,1.35fr) minmax(0,.65fr); gap:16px 20px; }
.consult-input-unit { display:flex; align-items:center; border:1px solid #d8e2df; border-radius:4px; }
.consult-input-unit input { border:0; }
.consult-input-unit > span { padding-right:12px; color:#687976; white-space:nowrap; }
.consult-chief textarea { min-height:104px; }
.consult-intake-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,100px)); gap:20px; border-bottom:1px solid #dde7e3; margin-bottom:22px; }
.consult-intake-tabs button { display:flex; align-items:center; justify-content:center; gap:8px; min-width:0; min-height:48px; padding:8px 3px 12px; border:0; border-bottom:3px solid transparent; border-radius:0; background:transparent; color:#687976; white-space:normal; }
.consult-intake-tabs button[aria-selected="true"] { color:#0f766e; border-bottom-color:#17887a; font-weight:600; }
.consult-intake-tabs button:hover { background:#f4f7f6; }
.consult-records h4 { font-size:14px; font-weight:600; margin:16px 0 8px; line-height:1.6; overflow-wrap:anywhere; }
.consult-record-source { min-width:0; }
.consult-records .consult-grid:empty { display:none; }
.consult-form-section .consult-wide-label { margin-bottom:0; }
#consultOptionalReminder:empty,#consultSummaryMissing:empty { display:none; }
.consult-intake-section[hidden] { display:none; }
.consult-intake-count { color:#687976; font-size:12px; font-weight:400; font-variant-numeric:tabular-nums; }
.consult-intake-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px 26px; padding:0 0 20px; }
.consult-intake-groups fieldset { border:0; border-bottom:1px solid #e1e8e5; padding:0 0 16px; margin:0; min-width:0; }
.consult-intake-groups legend { font-weight:600; font-size:14px; margin-bottom:8px; padding:0; }
.consult-choice-type { color:#687976; font-size:12px; font-weight:400; margin-left:8px; }
.consult-intake-options { display:flex; flex-wrap:wrap; gap:4px 16px; }
.consult-intake-options label { display:flex; align-items:center; gap:8px; min-height:44px; min-width:0; max-width:100%; font-size:14px; color:#273f39; }
.consult-intake-options label span { min-width:0; overflow-wrap:anywhere; }
.consult-intake-options input:is([type=checkbox],[type=radio]) { width:20px; height:20px; margin:0; flex:none; accent-color:#0f766e; }
.consult-basics .consult-basic-sex { border:0; padding:0; margin:0; min-width:0; }
.consult-basic-sex legend { padding:0; margin-bottom:6px; font-size:13px; color:#5c7070; }
.consult-basics .consult-intake-options label { display:flex; font-size:14px; color:#273f39; }
.consult-basics .consult-intake-options input { width:20px; }
.consult-intake-value { display:grid; gap:6px; margin:8px 0; font-size:13px; color:#5c7070; }
.consult-examination { grid-column:1/-1; min-width:0; border-top:1px solid #dde7e3; padding-top:16px; }
.consult-examination h4 { margin:0 0 12px; font-size:15px; }
.consult-examination .consult-intake-groups { padding-bottom:0; }
.consult-observation-review { border-left:3px solid #b86b16; padding:0 0 0 12px; margin-bottom:16px; min-width:0; }
.consult-observation-review .consult-check { min-height:44px; }
.consult-observation-review button { min-height:44px; max-width:100%; white-space:normal; }
#consultIntakeForm :is(input:not([type=checkbox],[type=radio]),select,textarea) { width:100%; min-width:0; max-width:100%; box-sizing:border-box; font-size:16px; min-height:44px; }
#consultIntakeForm textarea { resize:vertical; }
@container (max-width:740px) {
  #consultIntakeForm .consult-basics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .consult-basics > label:first-child { grid-column:1/-1; }
}
@container (max-width:540px) {
  .consult-intake-groups,#consultSafety .consult-fields,#consultIntakeForm .consult-basics { grid-template-columns:1fr; }
  .consult-intake-tabs { grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
  .consult-intake-tabs button { gap:5px; padding-inline:0; font-size:14px; }
  .consult-form-section { padding-block:22px; }
  .consult-source-entry > .consult-actions { width:100%; }
  .consult-source-entry > .consult-actions button { flex:1; }
}
.consult-source-entry { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.consult-source-entry > div:first-child { min-width:0; }
.consult-source-entry small { display:block; margin-top:4px; }
.consult-source-entry .consult-actions { margin:0; }
.consult-form-footer { display:flex; align-items:center; justify-content:space-between; gap:18px; flex-wrap:wrap; }
.consult-form-footer > .consult-note { flex:1; min-width:180px; margin:0; color:#855a25; }
.consult-form-footer > .consult-actions { flex:none; }
.consult-symptoms { padding:20px 0; }
.consult-history,.consult-safety,.consult-followup,.consult-transcripts,.consult-source-details { border-bottom:1px solid #dde7e3; }
:is(.consult-history,.consult-safety,.consult-followup,.consult-transcripts,.consult-source-details) > summary { cursor:pointer; padding:14px 0; min-height:44px; box-sizing:border-box; font-size:14px; color:#315b52; }
.consult-history > summary,.consult-safety > summary { font-weight:600; }
.consult-history > summary span,.consult-safety > summary span { margin-left:12px; font-weight:400; }
.consult-observations { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; border-block:1px solid #d8e2df; padding:20px 0; }
.consult-observation { min-width:0; }
.consult-observation-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 14px; }
.consult-observation-groups[hidden],#consultExisting[hidden] { display:none; }
.consult-choice-group { border-bottom:1px solid #e0e7e4; min-width:0; }
.consult-choice-group[open] { grid-column:1/-1; }
.consult-choice-group > summary { padding:12px 0; cursor:pointer; min-height:44px; box-sizing:border-box; font-size:14px; overflow-wrap:anywhere; }
.consult-choice-group > summary span { margin-left:10px; font-size:13px; color:#657672; }
.consult-choice-group[open] > summary { color:#126e62; }
.consult-choice-items { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); padding:0 0 8px; gap:4px 8px; }
.consult-choice-items label { display:flex; align-items:center; gap:8px; min-height:44px; cursor:pointer; font-size:15px; }
.consult-choice-items input { width:18px; height:18px; flex:none; margin:0; accent-color:#15786d; }
.consult-observation-summary { display:block; min-height:42px; padding:10px 12px; background:#f2f6f8; border-left:3px solid #6f8495; font-size:14px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.consult-bottom-actions { position:sticky; bottom:-20px; margin:0; padding:14px 0; background:#fff; border-top:1px solid #d8e2df; z-index:1; }
.consult-bottom-actions > span { margin-right:auto; }
#consultContent :is(button,input:not([type=checkbox],[type=radio]),select) { min-height:44px; }
#consultContent :is(input:not([type=checkbox],[type=radio]),textarea,select) { font-size:16px; }
@media (max-width:1250px) { .consult-observations { grid-template-columns:1fr; } .consult-observation + .consult-observation { border-top:1px solid #d8e2df; padding-top:20px; } }
@media (max-width:760px) { .consult-bottom-actions { bottom:0; } .consult-bottom-actions > span { flex-basis:100%; } .consult-choice-items { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:1100px) { .consult-workspace { grid-template-columns:180px minmax(0,1fr); } .consult-grid { grid-template-columns:1fr; } }
@media (max-width:760px) { #consultations { padding:12px; } .consult-workspace { display:flex; flex-direction:column; height:auto; min-height:0; } .consult-patients { border-right:0; border-bottom:1px solid #d8e2df; } .consult-patients header { padding:10px 12px; } #consultVisitList { display:flex; overflow-x:auto; max-height:110px; } .consult-patient { width:160px; flex:none; min-height:72px; } #consultContent { padding:14px; overflow:visible; } .consult-fields { grid-template-columns:1fr; } .consult-tabs { position:sticky; top:0; background:#fff; z-index:2; } .consult-toolbar label { flex-basis:100%; } .consult-table th,.consult-table td { padding:5px; } }
@media (max-width:900px) and (orientation:portrait) {
  .consult-workspace:has(.consult-form-view) { display:flex; flex-direction:column; height:calc(100dvh - 250px); min-height:480px; }
  .consult-workspace:has(.consult-form-view) .consult-patients { flex:none; border-right:0; border-bottom:1px solid #d8e2df; }
  .consult-workspace:has(.consult-form-view) .consult-patients header { padding:8px 12px; }
  .consult-workspace:has(.consult-form-view) #consultVisitList { display:flex; overflow-x:auto; max-height:70px; }
  .consult-workspace:has(.consult-form-view) .consult-patient { width:160px; flex:none; min-height:64px; padding:10px 12px; }
  .consult-workspace:has(.consult-form-view) .consult-main { flex:1; }
  #consultContent.consult-form-view { height:auto; min-height:0; flex:1; }
}
@media (min-width:900px) and (max-width:1200px) and (orientation:landscape) {
  body.authenticated #consultations { margin:12px 16px; padding:0; }
  .consult-workspace { grid-template-columns:176px minmax(0,1fr); height:calc(100dvh - 184px); min-height:380px; }
  .consult-toolbar label { width:260px; }
  .consult-patients header { padding:12px; }
  .consult-patient { padding:12px; }
  #consultVisitHeader { padding:10px 16px; }
  .consult-conversation { padding:16px; }
}

/* The workspace follows the visual viewport, including the tablet keyboard. */
body.authenticated #consultations { margin:12px 20px; padding:0; }
.consult-workspace, .consult-workspace:has(.consult-form-view) { height:var(--consult-height,calc(100dvh - 220px)); min-height:0; }
#consultContent { flex:1; overflow:auto; overscroll-behavior:contain; }
#consultContent.consult-form-view { height:auto; min-height:0; flex:1; }
.consult-main { flex:1; }
.consult-patient-picker { display:grid; grid-template-columns:minmax(140px,1fr) minmax(0,2fr); gap:0 20px; }
.consult-patient-picker > :not(.consult-wide-label) { grid-column:1/-1; }
.consult-patient-picker .consult-patient-matches { max-height:none; overflow:visible; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.consult-patient-picker .consult-bottom-actions { bottom:-20px; }
.consult-form-actions { border-top:1px solid #d8e2df; padding-top:16px; margin-top:16px; }
.consult-form-actions .consult-actions { margin:12px 0 0; justify-content:flex-end; }
.consult-form-actions .consult-form-footer .consult-actions { margin:0; }
.consult-form-actions button { max-width:100%; white-space:normal; }
#consultReferenceStatus { margin:8px 0 0; max-height:96px; overflow:auto; overflow-wrap:anywhere; }
#consultReferenceStatus:empty { display:none; }
.consult-message { max-width:82%; }
.consult-patient-matches .consult-patient { min-width:0; }
.consult-toolbar { margin-bottom:4px; }
#consultStatus:empty { margin:0; }
@media(max-width:1200px) {
  .consult-workspace { grid-template-columns:160px minmax(0,1fr); }
  .consult-patient-picker .consult-patient-matches { grid-template-columns:1fr; }
  #consultVisitHeader { padding:10px 14px; }
  .consult-tabs button { padding:10px; }
}
@media(max-width:900px) {
  body.authenticated #consultations { margin:8px 12px; }
  .consult-workspace,.consult-workspace:has(.consult-form-view) { display:flex; flex-direction:column; }
  .consult-patients { flex:none; border-right:0; border-bottom:1px solid #d8e2df; }
  .consult-patients header { display:none; }
  #consultVisitList,.consult-workspace:has(.consult-form-view) #consultVisitList { display:flex; max-height:58px; overflow:auto; }
  #consultVisitList .consult-patient,.consult-workspace:has(.consult-form-view) #consultVisitList .consult-patient { width:156px; min-height:56px; padding:6px 12px; gap:2px; }
  .consult-toolbar label { width:auto; flex:1; min-width:160px; font-size:12px; }
  .consult-toolbar button { min-width:44px; }
  .consult-conversation { padding:14px; }
  .consult-message { max-width:92%; }
  .consult-patient-picker .consult-bottom-actions { bottom:-14px; }
}
@media(max-width:540px) {
  .consult-toolbar { gap:6px; }
  .consult-toolbar label { flex-basis:calc(100% - 50px); order:-2; }
  .consult-toolbar > #consultMore { order:-1; margin-left:0; align-self:flex-end; }
  .consult-toolbar > button { font-size:13px; padding-inline:10px; }
  .consult-patient-picker { grid-template-columns:1fr; }
  #consultContent { padding:12px; }
  .consult-tabs button { font-size:12px; padding:8px 6px; flex:1; }
  #consultVisitHeader { padding:8px 12px; }
  #consultVisitHeader h2 { font-size:17px; }
  .consult-form-actions .consult-actions { display:grid; grid-template-columns:1fr; }
  .consult-form-footer > .consult-actions { width:100%; }
}
body.consult-keyboard #consultations :is(.consult-toolbar,#consultStatus,.consult-patients,#consultTabs) { display:none; }
@media(max-width:980px) and (max-height:540px) {
  #consultations:has(.consult-form-view) :is(.consult-toolbar,.consult-patients,#consultStatus) { display:none; }
  #consultations:has(.consult-form-view) #consultVisitHeader { padding:6px 12px; }
  #consultReferenceStatus { margin-top:4px; max-height:48px; }
}
@media(max-width:980px) {
  body.consult-keyboard:has(#consultations:not(.hidden)) :is(#sidebar,#pageHeader) { display:none; }
  body.consult-keyboard #consultations .consult-patient-picker .consult-section-head { margin-bottom:4px; }
  body.consult-keyboard #consultations .consult-patient-picker .consult-wide-label { margin:6px 0; gap:4px; }
  body.consult-keyboard #consultations .consult-patient-picker #consultPatientSearchStatus { margin:4px 0; }
  body.consult-keyboard #consultations .consult-patient-picker .consult-bottom-actions { position:static; padding:8px 0; }
}
/* Each paired inconsistency has a light background and a visible numbered label. */
.consult-conflict-field{background:var(--conflict-bg)!important;outline:2px solid var(--conflict-edge);outline-offset:2px}
.consult-conflict-badge{display:inline-flex;align-items:center;border:1px solid var(--conflict-edge);background:var(--conflict-bg);border-radius:4px;padding:1px 6px;font-size:12px;line-height:20px;color:#263338;margin:2px 6px 4px 0;white-space:nowrap}
.consult-conflict-tone-0{--conflict-bg:#fff3c4;--conflict-edge:#ad821b}
.consult-conflict-tone-1{--conflict-bg:#fce0e2;--conflict-edge:#bc6671}
.consult-conflict-tone-2{--conflict-bg:#deedff;--conflict-edge:#5788bd}
.consult-conflict-tone-3{--conflict-bg:#e1f1df;--conflict-edge:#62905f}
.consult-conflict-tone-4{--conflict-bg:#eee3fa;--conflict-edge:#9171af}
.consult-conflict-count{margin:0 0 0 5px}
.consult-consistency-issues{display:grid;gap:16px;margin:12px 0}
.consult-consistency-issue{border-left:4px solid var(--conflict-edge);padding:12px 16px;background:var(--conflict-bg);min-width:0}
.consult-consistency-issue p{margin:8px 0;overflow-wrap:anywhere}
.consult-consistency-issue label{display:block;margin-top:10px}
.consult-consistency-issue textarea{width:100%;background:#fff}
.consult-consistency-issue .consult-check{display:flex;align-items:flex-start;gap:8px}
.consult-conflict-sources{display:flex;gap:8px;flex-wrap:wrap}
.consult-conflict-sources button{white-space:normal;text-align:left;max-width:100%;height:auto;overflow-wrap:anywhere}
.consult-attempt{border-left:3px solid #b16831;padding:12px 16px;margin:12px 0}
.consult-attempt p{overflow-wrap:anywhere}
.consult-attempt-success{border-left:0;border-top:1px solid #dce5e2;border-bottom:1px solid #dce5e2;padding:12px 0}
.consult-attempt-success summary{cursor:pointer;min-height:44px;padding:10px 0;box-sizing:border-box;overflow-wrap:anywhere;color:#315b52}
#consultContent textarea.consult-autogrow{height:auto;max-height:none;overflow-y:hidden;resize:none;box-sizing:border-box;line-height:1.6}
@media(max-width:600px){
  .consult-table:has(#consultDrugRows),.consult-table:has(#consultDrugRows) tbody{display:block;width:100%}
  .consult-table:has(#consultDrugRows) thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  #consultDrugRows tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(80px,110px) 44px;gap:8px 10px;padding:12px 0;border-bottom:1px solid #dce5e2}
  #consultDrugRows td{min-width:0;border:0;padding:0}
  #consultDrugRows td:nth-child(3){grid-column:1 / 3;grid-row:2}
  #consultDrugRows td:nth-child(4){grid-column:3;grid-row:1;align-self:end}
  #consultDrugRows td[data-label]::before{content:attr(data-label);display:block;color:#5c7070;font-size:12px;margin-bottom:5px}
  #consultDrugRows td button{width:44px;min-width:44px;height:44px;padding:8px}
  #consultDrugRows input{box-sizing:border-box}
}
.consult-baseline-readonly{border-top:1px solid #cddbd8;padding-top:12px;margin-top:16px}
.consult-baseline-readonly p{overflow-wrap:anywhere}
/* Keep version conflicts next to the basic fields without hiding the draft. */
.consult-profile-conflict { margin-top:16px; padding:12px 0; border-top:1px solid #c69c43; }
.consult-profile-conflict fieldset { margin:12px 0; min-width:0; }
.consult-profile-values { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.consult-profile-values label { display:flex; align-items:flex-start; gap:8px; min-width:0; min-height:44px; overflow-wrap:anywhere; }
.consult-profile-values label span { min-width:0; }
.consult-profile-values input[type=radio] { width:20px; height:20px; padding:0; margin:0; flex:0 0 20px; accent-color:#0f766e; }
@media (max-width:600px) { .consult-profile-values { grid-template-columns:1fr; } }
.consult-outcome { margin-block: 12px; min-width: 0; }
.consult-outcome h4 { font-size: 14px; margin: 8px 0; }
.consult-outcome-item { border-left: 3px solid #a76b20; padding: 4px 12px; margin: 12px 0; overflow-wrap: anywhere; }
.consult-outcome-item[data-category="technical"] { border-color: #b43737; }
.consult-outcome-item[data-category="conflict"] { border-color: #4381a6; }
.consult-outcome-item p { margin: 6px 0; }
.consult-outcome-reminders { border-top: 1px solid #dce5e5; padding-top: 8px; }
