/* Reference design for the shared communication workspace. Navigation is untouched. */
.app-content:has(.sw-page) { padding: 14px 16px 12px; background: #f3f6fa; }
.sw-page { font-size: 14px; color: #233e65; }
.sw-workspace-grid { gap: 12px; height: calc(100dvh - 122px); min-height: 680px; }
.sw-workspace-content .sw-patient-header { gap: 6px 16px; padding: 14px 16px; border-color: #e3ebf5; }
.sw-workspace-content .sw-patient-header > .sw-avatar { width: 58px; height: 58px; flex-basis: 58px; font-size: 29px; background: linear-gradient(145deg, #478cde, #2c70c3); border: 2px solid #eaf2ff; }
.sw-workspace-content .sw-patient-main h1 { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: .5px; }
.sw-workspace-content .sw-patient-main > div { gap: 10px 16px; }
.sw-workspace-content .sw-patient-main p { margin-top: 4px; font-size: 13px; line-height: 1.4; color: #526b8c; }
.sw-workspace-content .sw-chat-header { gap: 0 12px; padding: 0; overflow: visible; position: relative; }
.sw-workspace-content .sw-chat-header > .sw-avatar { margin: 14px 0 0 14px; }
.sw-chat-header .sw-patient-main { padding-top: 14px; }
.sw-chat-header .sw-patient-tags { align-self: start; padding-bottom: 14px; }
.sw-chat-header .sw-profile-link { min-height: 30px; padding: 4px 10px; border-color: #2676df; background: #2676df; color: #fff; font-size: 12px; white-space: nowrap; }
.sw-chat-header .sw-profile-link:hover { background: #1666ca; color: #fff; }
.sw-chat-header .pd-path-view { position: relative; min-width: 0; height: 100%; margin: 0; overflow: hidden; }
.sw-chat-header .pd-path-view:hover { height: 225px; overflow: visible; z-index: 5; box-shadow: 0 12px 22px #2b45652b; }
.sw-chat-header .pd-journey { display: grid; grid-template-columns: 122px minmax(0,1fr); gap: 0; align-items: stretch; min-width: 0; height: 100%; padding: 0; border: 0; border-left: 1px solid #dce9fa; border-radius: 0; background: #fff; box-shadow: none; }
.sw-chat-header .pd-path-head { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-end; gap: 10px; min-width: 0; margin: 0; padding: 12px 8px; text-align: right; background: #fff; }
.sw-chat-header .pd-path-head h2 { margin: 0; font-size: 13px; color: #285b9b; }
.sw-chat-header .pd-path-head h2 small { display: block; margin-top: 7px; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.sw-chat-header .pd-path-head .pt-button { align-self: flex-end; width: 96px; min-height: 26px; padding: 2px 4px; font-size: 10px; }
.sw-chat-header .pd-journey-scroll { min-width: 0; min-height: 0; height: 100%; border: 0; border-left: 1px solid #e5edf7; border-radius: 0; background: #fff; }
.sw-chat-header .pd-journey-phase > header { min-height: 30px; padding: 5px 10px; }
.sw-chat-header .pd-journey-phase ol { gap: 12px; padding: 11px 10px 10px; }
.sw-chat-header .pd-journey-phase ol::before { top: 22px; }
.sw-chat-header .pd-journey-phase li { width: 155px; height: 120px; margin-top: 30px; padding: 7px 8px; }
.sw-chat-header .pd-time-pin { top: -25px; }
.sw-chat-header .pd-journey-phase li .pd-visit-title { min-height: 28px; margin-bottom: 4px; font-size: 11px; }
.sw-chat-header .pd-visit-meta { padding-bottom: 4px; }
.sw-chat-header .pd-journey-phase li .pd-visit-conclusion { min-height: 24px; margin: 4px 0 2px; font-size: 10px; }
.sw-chat-header .pd-journey-phase li .pd-visit-conclusion span { -webkit-line-clamp: 1; }
.sw-chat-header .pd-journey-phase li :is(.pd-source-button,.pd-visit-actions .pt-button) { min-height: 24px; padding: 2px 5px; font-size: 10px; }
.sw-patient-switch { font-size: 12px; gap: 6px; margin-left: auto; }
.sw-patient-switch select { max-width: 156px; font-size: 12px; color: #667f9e; }
.sw-workspace-content .sw-patient-tags { max-width: none; gap: 6px; }
.sw-workspace-content .sw-patient-tags .sw-tag { padding: 4px 9px; border-color: transparent; background: #edf3ff; color: #3675c4; font-size: 12px; }
.sw-workspace-content .sw-patient-tags .sw-tag.orange { color: #d5844a; background: #fff0e5; }
.sw-workspace-content .sw-patient-tags .sw-tag.red { color: #cf5151; background: #fff0ee; }
.sw-workspace-content .sw-patient-tags .sw-tag.green { color: #288660; background: #edf8f2; }
.sw-patient-actions { flex-direction: row; gap: 8px; }
.sw-patient-actions .sw-button { min-height: 36px; padding: 6px 12px; font-size: 13px; color: #2474d5; border-color: #93baff; }
.sw-workspace-content .sw-patient-actions [data-sw="record"] { background: #2676df; color: #fff; border-color: #2676df; }
.sw-workspace-content .sw-main { border-color: #e3ebf5; }
.sw-workspace-content .sw-tabs { min-height: 49px; padding: 0 12px; gap: 4px; flex-wrap: nowrap; }
.sw-workspace-content .sw-tabs > .sw-button { min-height: 49px; padding: 0 13px; font-size: 14px; color: #405578; }
.sw-workspace-content .sw-tabs > .sw-button.active { color: #1768d6; font-weight: 600; }
.sw-tabs > .active::after { left: 6px; right: 6px; height: 3px; }
.sw-workspace-content .sw-history-search { flex: 0 1 174px; width: auto; max-width: 174px; min-width: 108px; margin: 7px 0 7px auto; border-color: #e0e8f3; }
.sw-history-search button { order: -1; padding-left: 9px; color: #758aab; }
.sw-history-search input { padding-left: 3px; font-size: 12px; }
.sw-workspace-content .sw-care-service { padding: 9px 16px; min-height: 50px; gap: 8px; background: #f2f7ff; color: #798cac; border-color: #e7eef8; }
.sw-care-service > span { display: flex; align-items: center; gap: 10px; color: #36547d; font-weight: 500; }
.sw-care-service > span::before { content: ''; width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #2cbe94; box-shadow: 0 0 0 2px #fff; }
.sw-care-service .sw-button { color: #2674d9; border-color: #c9ddff; background: #fff; }
.sw-workspace-content .sw-messages { padding: 22px 18px 14px; min-height: 120px; scrollbar-width: thin; scrollbar-color: #d6dfed transparent; }
.sw-messages .sw-empty { min-height: 100%; gap: 10px; padding: 24px 0; font-size: 14px; }
.sw-message { gap: 12px; margin-bottom: 24px; }
.sw-message:last-child { margin-bottom: 0; }
.sw-message > .sw-avatar { width: 40px; height: 40px; flex-basis: 40px; background: linear-gradient(145deg, #4289de, #2268c1); border: 2px solid #eaf2ff; font-size: 20px; }
.sw-staff-avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 11px; color: #456591; background: #eaf2ff; border: 2px solid #f8fbff; }
.sw-ai-message-avatar { display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; }
.sw-ai-message-avatar .ai-icon.ai-avatar { display: block; width: 100%; height: 100%; border: 2px solid #e9defa; }
.sw-message > div { max-width: 80%; }
.sw-bubble { padding: 10px 14px; border-radius: 6px; background: #f0f4f9; color: #304769; font-size: 14px; line-height: 1.75; }
.sw-message.outgoing .sw-bubble { border-radius: 6px; background: #c5dfff; color: #284a78; }
.sw-message .sw-bubble.sw-scale-bubble { min-width: min(300px, 68vw); max-width: 360px; padding: 14px; border: 1px solid #c9dbf4; border-radius: 9px; background: #fff; box-shadow: 0 2px 9px rgba(35, 88, 150, .09); }
.sw-scale-card { display: flex; align-items: flex-start; gap: 12px; }
.sw-scale-card > svg { flex: none; }
.sw-scale-copy { display: grid; gap: 10px; min-width: 0; }
.sw-scale-copy strong { color: #24466e; font-size: 15px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.sw-scale-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; line-height: 1.4; white-space: nowrap; }
.sw-scale-status.is-waiting { color: #a66b08; }
.sw-scale-status.is-waiting i { width: 9px; height: 9px; border-radius: 50%; background: #e8a91a; box-shadow: 0 0 0 3px #fff3d2; animation: sw-scale-pulse 1.3s ease-in-out infinite; }
.sw-scale-status.is-filled { color: #168755; }
@keyframes sw-scale-pulse { 50% { opacity: .35; box-shadow: 0 0 0 6px #fff3d2; } }
@media (prefers-reduced-motion: reduce) { .sw-scale-status.is-waiting i { animation: none; } }
.sw-message small { margin-top: 5px; font-size: 11px; color: #8b9dbc; }
.sw-message .sw-care-sender, .sw-message[data-role="staff"] .sw-care-sender { margin-bottom: 5px; color: #8291ab; }
.sw-care-notice { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 20px; color: #899bbb; }
.sw-care-notice::before, .sw-care-notice::after { content: ''; width: 32px; height: 1px; background: #e6edf7; }
.sw-care-latest { margin: 4px auto; padding: 3px 10px; min-height: 28px; font-size: 12px; }

/* Keep the existing tools and saved-state text inside the compact editor surface. */
.sw-chat .sw-composer { position: relative; padding: 10px 18px 8px; border-top: 0; background: #fff; }
.sw-chat .sw-composer::before { content: ''; position: absolute; inset: 8px 10px; border: 1px solid #dfe8f4; border-radius: 7px; pointer-events: none; }
.sw-chat .sw-editor textarea { display: block; min-height: 58px; height: 58px; max-height: 140px; padding: 8px 78px 12px 6px; border: 0; border-radius: 4px; resize: vertical; background: transparent; font-size: 14px; line-height: 1.7; }
.sw-chat .sw-editor textarea:focus-visible { outline-offset: -2px; }
.sw-chat .sw-editor small { bottom: 7px; right: 6px; }
.sw-chat .sw-composer-tools { gap: 8px 10px; padding-top: 5px; }
.sw-chat .sw-composer-tools .sw-button { min-height: 32px; padding: 5px 8px; font-size: 12px; border-color: #dfe8f5; color: #36537c; }
.sw-chat .sw-composer-tools .sw-ai-button { background: #f6f1ff; color: #7344c5; border-color: #ddcfff; }
.sw-chat .sw-composer-tools .sw-ai-button .ai-avatar { width: 18px; height: 18px; }
.sw-chat .sw-composer-tools .sw-send { min-width: 86px; min-height: 36px; color: #fff; background: #2676df; border-color: #2676df; }
.sw-chat .sw-save-state { margin: 5px 0 3px; gap: 2px 8px; font-size: 10px; color: #8c9eb8; }
.sw-chat .ca-assistant > .ca-todos { padding: 0 14px 4px; margin: 0 0 12px; max-height: 340px; background: #fff; border: 1px solid var(--assistant-card-border); border-top: 0; border-radius: 0 0 6px 6px; }
.sw-chat .ca-assistant { display: flex; flex-direction: column; height: calc(100dvh - 122px); min-height: 400px; }
.sw-chat .ca-assistant > .ca-todos { flex: 1 1 auto; min-height: 0; max-height: none; margin-bottom: 0; }
.sw-chat .ca-todos > header { position: sticky; top: 0; z-index: 1; min-height: 42px; margin: 0 -14px; padding: 0 14px; background: #fff; border-bottom: 1px solid #e9edf4; }
.sw-chat .ca-todos > header > strong { color: #34455d; font-size: 14px; margin-right: 0; white-space: nowrap; }
.sw-chat .ca-todos > header > strong > span { color: var(--assistant-accent); margin-left: 5px; font-size: 13px; }
.sw-chat .ca-todo-source { color: #8792a4; font-size: 10px; white-space: nowrap; }
.sw-chat .ca-todos > header > .sw-button { margin-left: auto; border: 0; background: transparent; color: var(--assistant-accent); padding: 3px 0; white-space: nowrap; }
.sw-chat .ca-scale-list { display: grid; gap: 8px; margin: 10px 0 4px; padding: 12px; border: 1px solid #b9d6ff; border-radius: 7px; background: #edf5ff; }
.sw-chat .ca-scale-list > strong, .sw-chat .ca-other-tasks > strong { color: #174a86; font-size: 13px; }
.sw-chat .ca-scale-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 9px 10px; border: 1px solid #d3e3f8; border-radius: 6px; background: #fff; }
.sw-chat .ca-scale-row.is-requested { border-color: #4c97ec; box-shadow: 0 0 0 2px #ddecff; }
.sw-chat .ca-scale-row > div { display: grid; gap: 4px; min-width: 0; }
.sw-chat .ca-scale-row strong { font-size: 12px; color: #2c496d; overflow-wrap: anywhere; }
.sw-chat .ca-scale-state { font-size: 11px; }
.sw-chat .ca-scale-state.unsent { color: #ad6b08; }
.sw-chat .ca-scale-state.sent { color: #ad790b; }
.sw-chat .ca-scale-state.submitted { color: #168755; }
.sw-chat .ca-scale-state.done { color: #598575; }
.sw-chat .ca-scale-row .sw-button { min-height: 29px; padding: 4px 9px; background: #286fcb; border-color: #286fcb; color: #fff; white-space: nowrap; }
.sw-chat .ca-other-tasks { padding: 10px 0 0; }
.sw-chat .ca-other-tasks > strong { display: block; margin-bottom: 2px; }
.sw-chat .ca-todo-row { display: block; padding: 12px 0; }
.sw-chat .ca-todo-heading { display: flex; align-items: flex-start; gap: 8px; }
.sw-chat .ca-todo-content { flex: 1; flex-direction: column; align-items: flex-start; gap: 3px; white-space: normal; }
.sw-chat .ca-todo-content strong { font-size: 13px; line-height: 1.6; overflow: visible; overflow-wrap: anywhere; }
.sw-chat .ca-todo-content small, .sw-chat .ca-todo-date, .sw-chat .ca-todo-deadline { display: inline; font-size: 11px; }
.sw-chat .ca-todo-index { flex-shrink: 0; padding: 3px 6px; background: #f1f3f7; color: #66748a; font-size: 11px; font-weight: 400; }
.sw-chat .ca-todo-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sw-chat .ca-todo-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sw-chat .ca-todo-footer > .sw-button { min-height: 28px; margin-left: auto; padding: 4px 8px; background: #fff; color: var(--assistant-accent); border-color: var(--assistant-card-border); white-space: nowrap; }
.sw-chat .ca-todos > .ca-muted { margin: 8px 0; }

/* Keep each toolbar group together when the conversation column becomes narrow. */
.sw-chat .sw-composer-tools .sw-tool-group { display:flex; align-items:center; flex:0 0 auto; gap:4px; }
.sw-chat .sw-tool-options { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px 10px; min-width:0; margin-left:auto; }
.sw-chat .sw-composer-tools .sw-tool-group + .sw-tool-group { border-left:1px solid #d7dce5; padding-left:10px; }
.sw-chat .sw-service-switch { display:inline-flex; flex:0 0 auto; align-items:center; padding:3px; border:1px solid #dce0e7; border-radius:7px; background:#f2f3f6; }
.sw-chat .sw-service-switch button { border:0; border-radius:4px; background:transparent; color:#677083; padding:5px 9px; font:inherit; font-size:12px; line-height:20px; white-space:nowrap; cursor:pointer; }
.sw-chat .sw-service-switch button[aria-pressed="true"] { background:#fff; color:var(--ai-primary, #6d28d9); box-shadow:0 1px 3px #18234114; font-weight:600; }
.sw-chat .sw-service-switch button:hover:not(:disabled) { color:var(--ai-primary, #6d28d9); }
.sw-chat .sw-service-switch button:focus-visible { outline:2px solid var(--ai-primary, #6d28d9); outline-offset:1px; }
.sw-chat .sw-service-switch button:disabled { cursor:wait; opacity:.6; }
.sw-chat .sw-composer-tools .cm-media-tools { display:flex; flex-wrap:nowrap; gap:4px; padding:0; margin:0; }
.sw-chat .sw-composer-tools .cm-media-tools button { min-height:32px; padding:5px 8px; font-size:12px; border-radius:5px; border-color:#dfe8f5; color:#36537c; }
.sw-chat .sw-composer-tools .sw-button svg,.sw-chat .sw-composer-tools .cm-media-tools svg { width:16px; height:16px; }
.sw-chat .sw-composer-tools .sw-send { margin-left:0; min-width:64px; min-height:32px; }
.sw-chat .sw-composer-tools [hidden] { display:none!important; }
.sw-chat .sw-patient-actions { flex-wrap:wrap; }
.sw-save-state [data-save-state="error"] { color:#b44c47; }

/* Patient directory styling is shared by chat, phone and SMS. */
.sw-patient-directory { border-color: #e3ebf5; }
.sw-patient-directory > header { padding: 16px 15px 12px; }
.sw-patient-directory h2 { font-size: 18px; color: #193a65; }
.sw-patient-directory > header > span { color: #7a8dad; font-size: 13px; }
.sw-directory-search { margin: 0 15px 12px; min-height: 38px; background: #f1f5fa; }
.sw-directory-search input { font-size: 13px; }
.sw-directory-modes { margin: 0 15px; }
.sw-directory-modes button { padding: 8px 3px; font-size: 12px; }
.sw-directory-modes .is-active { background: #ecf4ff; border-radius: 4px 4px 0 0; color: #1c6ed6; border-bottom-color: #2c79e6; }
.sw-directory-hint { margin: 9px 15px 11px; color: #8799b6; }
.sw-contact { padding: 16px 15px; gap: 14px; min-height: 116px; border-color: #eaf0f8; }
.sw-contact-avatar { width: 44px; height: 44px; flex-basis: 44px; border-radius: 50%; background: #d6e6ff; color: #226ac3; font-size: 23px; }
.sw-contact:nth-of-type(3n) .sw-contact-avatar { background: #e4dfff; color: #6350b5; }
.sw-contact:nth-of-type(4n) .sw-contact-avatar { background: #c9f0ef; color: #2e989d; }
.sw-contact:nth-of-type(5n) .sw-contact-avatar { background: #ffe4bd; color: #bd7628; }
.sw-contact.is-active { background: #eaf4ff; }
.sw-contact.is-active::before { background: #287ae4; }
.sw-contact.is-active .sw-contact-avatar { background: linear-gradient(145deg, #518fd7, #3479c8); color: #fff; }
.sw-contact-heading strong, .sw-contact.is-active strong { color: #203e68; font-size: 14px; }
.sw-contact-heading time { font-size: 10px; color: #859ab9; }
.sw-contact-meta { font-size: 11px; color: #8496b1; }
.sw-contact-preview { font-size: 12px; color: #788eaf; }
.sw-contact-reason.urgent { background: #fff0e3; color: #c57b46; padding: 2px 6px; }
.sw-contact-reason.pending, .sw-contact-badges > small { background: #e7f1ff; color: #447bbd; border-radius: 3px; padding: 2px 6px; }
.sw-page-footer { margin: 8px 1px 0; font-size: 10px; line-height: 1.6; }

/* Conversation-specific content uses the same global assistant surfaces. */
.sw-workspace-content .sw-assistant.assistant-panel { scrollbar-width: thin; scrollbar-color: #d9dfee transparent; }
.sw-workspace-content .sw-assistant.assistant-panel > header { border-radius: 6px; flex-wrap: nowrap; }
.sw-workspace-content .sw-assistant.assistant-panel > section { border-radius: 6px; }
.sw-workspace-content .sw-assistant h3 { font-size: 16px; }
.sw-workspace-content .sw-assistant p, .sw-workspace-content .sw-assistant li { font-size: 14px; color: #40536f; }
.sw-workspace-content .sw-assistant .sw-muted, .sw-workspace-content .sw-assistant .ca-muted { font-size: 13px; color: #8492ac; }
.sw-assistant.ca-assistant > header { display: grid; grid-template-columns: 76px minmax(0,1fr); grid-template-rows: auto auto; gap: 2px 14px; min-height: 100px; margin-bottom: 0; border-radius: 6px 6px 0 0 !important; border-bottom: 0; }
.sw-assistant.ca-assistant > header .ai-icon.ai-avatar { grid-row: 1 / 3; width: 76px; height: 76px; }
.ca-assistant > header h2 { align-self: end; font-size: 20px; }
.ca-assistant > header > .sw-tag { align-self: start; text-align: left; max-width: none; font-size: 13px; }
.ca-priority-card { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e9edf4; }
.ca-priority-card:last-child { border-bottom: 0; padding-bottom: 0; }
.ca-priority-card > b { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; background: #e8f2ff; color: #2466b6; font-size: 12px; }
.ca-priority-card > div { min-width: 0; }
.ca-priority-card strong { color: #29486d; font-size: 13px; }
.ca-priority-card p { margin: 4px 0 7px; font-size: 12px !important; overflow-wrap: anywhere; }
.ca-assistant .ca-live-status { padding: 9px 16px; margin: 0; gap: 6px; background: #fff; border-inline: 1px solid var(--assistant-card-border); font-size: 11px; color: #8392ab; }
.ca-assistant .ca-live-status button { min-height: 28px; padding: 3px 7px; font-size: 11px !important; background: #fff; color: #794ac4; border-color: #dccbfa; }
@media (max-width: 650px) { .sw-ai-message-avatar { width: 32px; height: 32px; flex-basis: 32px; } }
.ca-assistant > [data-ca-assistant-body] > section { padding: 18px; margin-bottom: 12px; border-color: var(--assistant-card-border); border-radius: 6px; }
.ca-assistant > [data-ca-assistant-body] > section:first-of-type { border-top: 0; border-radius: 0 0 6px 6px; }
.ca-assistant h3 { gap: 9px; margin-bottom: 12px; }
.ca-assistant h3::before { --ca-section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-8l-5 3v-3H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E"); content: ''; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background-color: var(--assistant-accent); background-position: center; background-repeat: no-repeat; background-size: 19px; background-image: var(--ca-section-icon); }
.ca-assistant section:nth-of-type(2) h3::before { --ca-section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M9 18h6m-6 3h6M8 14a7 7 0 1 1 8 0c-1 1-1 2-1 4H9c0-2 0-3-1-4Z'/%3E%3C/svg%3E"); }
.ca-assistant section:nth-of-type(3) h3::before { --ca-section-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M6 2h9l4 4v16H6ZM14 2v5h5M9 11h7m-7 4h7m-7 4h5'/%3E%3C/svg%3E"); }
.ca-assistant .ca-statement { padding: 0 0 14px; margin-bottom: 14px; border-bottom-color: #edf0f7; }
.ca-assistant .ca-statement:last-child { padding-bottom: 0; margin-bottom: 4px; border-bottom: 0; }
.ca-assistant .ca-statement > p { position: relative; padding: 14px 18px; margin: 8px 0 12px; background: #f6f3fd; border-radius: 6px; color: #30486e; }
.ca-assistant .ca-statement > small { color: #8797b2; font-size: 11px; }
.ca-assistant .sw-suggestion { background: #fff; padding: 12px; border-color: #e8eaf4; border-radius: 4px; }
.ca-assistant .sw-suggestion > div { gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.ca-assistant .sw-suggestion .sw-button { flex: 1 1 auto; }
.ca-assistant section .sw-button { min-height: 33px; padding: 6px 12px; border-color: #ddcfff; color: #784ac5; background: #fff; }
.ca-assistant section .sw-button:hover { background: #f7f2ff; }
.ca-assistant section [data-ca="record"] { display: flex; width: 100%; margin-top: 12px; border-color: #b896f4; min-height: 40px; }
.ca-assistant .ca-sources { margin: 18px -18px -18px; padding: 16px 18px; border-top-color: #e9edf5; }
.ca-assistant .ca-sources summary { color: #52678a; font-size: 13px; }

@media (min-width: 1350px) {
  .sw-workspace-grid { grid-template-columns: 254px minmax(0,1fr) minmax(300px,24%); grid-template-rows: auto minmax(0,1fr); }
  .sw-workspace-content, .sw-workspace-content .sw-layout { display: contents; }
  .sw-patient-directory { grid-column: 1; grid-row: 1 / 3; }
  .sw-workspace-content .sw-patient-header { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; grid-column: 2; grid-row: 1; margin: 0; min-height: 136px; }
  .sw-patient-header > .sw-avatar { grid-column: 1; grid-row: 1 / 3; align-self: start; margin-top: 4px; }
  .sw-patient-main { grid-column: 2 / 4; grid-row: 1; }
  .sw-patient-tags { grid-column: 2; grid-row: 2; align-self: center; }
  .sw-patient-actions { grid-column: 3; grid-row: 2; align-self: end; }
  .sw-workspace-content .sw-chat-header { grid-template-columns: 86px minmax(0,1fr) minmax(320px,52%); grid-template-rows: max-content max-content; align-content: start; align-items: start; height: 152px; min-height: 0; }
  .sw-chat-header .sw-patient-main { grid-column: 2; grid-row: 1; }
  .sw-chat-header .pd-path-view { position: absolute; top: 0; right: 1px; width: 52%; height: 151px; }
  .sw-chat-header .sw-patient-tags { grid-column: 2; grid-row: 2; }
  .sw-workspace-content .sw-main { grid-column: 2; grid-row: 2; }
  .sw-workspace-content .sw-assistant { grid-column: 3; grid-row: 1 / 3; }
}
@media (min-width: 1350px) and (max-width: 1500px) {
  .sw-workspace-grid { grid-template-columns: 228px minmax(0,1fr) 288px; gap: 10px; }
  .sw-workspace-content .sw-patient-header { padding: 14px; gap: 8px 12px; grid-template-columns: 48px minmax(0,1fr); }
  .sw-workspace-content .sw-patient-header > .sw-avatar { width: 48px; height: 48px; }
  .sw-patient-main { grid-column: 2; }
  .sw-patient-tags { grid-column: 1 / 3; grid-row: 2; }
  .sw-patient-actions { grid-column: 1 / 3; grid-row: 3; justify-content: flex-end; }
  .sw-patient-switch { margin-left: 0; }
  .sw-workspace-content .sw-chat-header { grid-template-columns: 76px minmax(0,1fr); grid-template-rows: auto auto auto; height: auto; min-height: 0; padding: 0; }
  .sw-chat-header .pd-path-view { position: relative; top: auto; right: auto; width: auto; grid-column: 1 / 3; grid-row: 3; }
  .sw-chat-header .pd-path-view:hover { height: 225px; }
  .sw-chat-header .pd-journey { border-left: 0; border-top: 1px solid #dce9fa; }
  .sw-workspace-content .sw-tabs { gap: 0; padding: 0 8px; }
  .sw-workspace-content .sw-tabs > .sw-button { font-size: 12px; padding: 0 8px; }
  .sw-contact { padding: 14px 12px; gap: 10px; }
  .sw-chat .sw-composer-tools { gap: 5px; }
  .sw-chat .sw-composer-tools .sw-button { font-size: 11px; padding: 5px; }
  .sw-chat .sw-composer-tools .sw-button svg { width: 16px; height: 16px; }
  .sw-chat .sw-composer-tools .sw-send { min-width: 66px; }
}
@media (min-width: 1501px) and (max-width: 1900px) {
  .sw-workspace-content .sw-chat-header { grid-template-columns: 86px minmax(0,1fr); grid-template-rows: max-content max-content max-content; height: auto; }
  .sw-chat-header .pd-path-view { position: relative; top: auto; right: auto; width: auto; height: 184px; grid-column: 1 / 3; grid-row: 3; }
  .sw-chat-header .pd-journey { border-left: 0; border-top: 1px solid #dce9fa; }
}
@media (max-width: 1349px) {
  .sw-workspace-grid { height: auto; min-height: 0; }
  .sw-workspace-content .sw-patient-header { margin: 0; }
  .sw-workspace-content .sw-main { min-height: 690px; }
  .sw-workspace-content .sw-messages { min-height: 280px; max-height: 480px; }
  .sw-workspace-content .sw-assistant { max-height: none; }
  .sw-workspace-content .sw-patient-tags { flex: 1 1 200px; }
  .sw-chat-header .pd-path-view { flex: 1 1 320px; }
}
@media (max-width: 850px) {
  .sw-workspace-content .sw-patient-header { margin-bottom: 12px; }
  .sw-patient-directory { height: 350px; }
  .sw-contact { min-height: 104px; padding: 12px 15px; }
}
@media (max-width: 650px) {
  .app-content:has(.sw-page) { padding: 12px 10px; }
  .sw-workspace-content .sw-patient-header { padding: 14px; }
  .sw-workspace-content .sw-chat-header { padding: 0; }
  .sw-workspace-content .sw-patient-main { flex-basis: 65%; }
  .sw-workspace-content .sw-patient-main h1 { font-size: 21px; }
  .sw-chat-header .pd-path-view { flex-basis: 100%; }
  .sw-patient-switch { margin-left: 0; }
  .sw-patient-actions { flex-wrap: wrap; }
  .sw-workspace-content .sw-tabs { flex-wrap: wrap; gap: 0; }
  .sw-workspace-content .sw-tabs > .sw-button { font-size: 12px; min-height: 44px; padding: 0 10px; }
  .sw-workspace-content .sw-history-search { flex-basis: 100%; width: 100%; max-width: none; margin: 0 0 9px; }
  .sw-workspace-content .sw-care-service { padding: 8px 12px; }
  .sw-workspace-content .sw-messages { padding: 18px 12px; }
  .sw-message { gap: 8px; }
  .sw-message > .sw-avatar, .sw-staff-avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .sw-chat .sw-composer-tools { gap: 6px; }
  .sw-chat .sw-save-state > span { max-width: 100%; }
  .sw-page-footer { flex-wrap: wrap; }
}
@media (max-width: 1500px) {
  .sw-chat-header .pd-path-view { height: 184px; }
  .sw-chat-header .pd-path-view:hover { height: 225px; }
}

/* Let the conversation use the width released by the patient directory. */
.sw-directory-toggle { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border: 1px solid #d8e4f5; border-radius: 5px; background: #fff; color: #286cc3; font-size: 21px; line-height: 1; cursor: pointer; }
.sw-directory-toggle:hover { background: #eef5ff; }
.sw-directory-toggle:focus-visible { outline: 2px solid #286cc3; outline-offset: 2px; }
.sw-directory-collapsed .sw-patient-directory > header { justify-content: center; padding: 10px 4px; }
.sw-directory-collapsed .sw-patient-directory > header > :not(.sw-directory-toggle),
.sw-directory-collapsed .sw-patient-directory > :not(header) { display: none; }
@media (min-width: 1350px) {
  .sw-directory-collapsed .sw-workspace-grid { grid-template-columns: 46px minmax(0,1fr) minmax(300px,24%); }
}
@media (min-width: 1350px) and (max-width: 1500px) {
  .sw-directory-collapsed .sw-workspace-grid { grid-template-columns: 46px minmax(0,1fr) 288px; }
}
@media (min-width: 851px) and (max-width: 1349px) {
  .sw-directory-collapsed .sw-workspace-grid { grid-template-columns: 46px minmax(0,1fr); }
}
@media (max-width: 850px) {
  .sw-directory-collapsed .sw-patient-directory { height: 48px; }
  .sw-directory-collapsed .sw-patient-directory > header { justify-content: flex-end; padding: 9px; }
}
.sw-chat .sw-service-switch button[data-care-mode="ai"] { display: inline-flex; align-items: center; gap: 5px; color: #fff; background: linear-gradient(115deg,#8251d9,#6040b5); font-weight: 600; }
.sw-chat .sw-service-switch button[data-care-mode="ai"][aria-pressed="true"] { color: #fff; background: linear-gradient(115deg,#8251d9,#6040b5); box-shadow: 0 2px 7px #7046bf3d; }
.sw-chat .sw-service-switch button[data-care-mode="ai"]:hover:not(:disabled) { color: #fff; background: linear-gradient(115deg,#7444cc,#5333a8); }
.sw-chat .sw-service-switch button[data-care-mode="ai"] .ai-avatar { width: 20px; height: 20px; }

/* Chat header spans the conversation and assistant columns; its two cards remain independent. */
.sw-workspace-content .sw-chat-header { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.sw-chat-header .sw-chat-patient-block { display: grid; grid-template-columns: 58px minmax(0,1fr); grid-template-rows: auto auto; align-content: start; gap: 4px 16px; min-width: 0; height: 152px; padding: 14px 16px; border: 1px solid #e3ebf5; border-radius: 8px; background: #fff; box-shadow: 0 3px 10px #233e6610; overflow: hidden; }
.sw-chat-patient-block > .sw-avatar { grid-column: 1; grid-row: 1 / 3; align-self: start; margin: 0; }
.sw-chat-patient-block > .sw-patient-main { grid-column: 2; grid-row: 1; min-width: 0; padding: 0; }
.sw-chat-patient-block > .sw-patient-tags { grid-column: 2; grid-row: 2; align-self: start; min-width: 0; padding: 0; }
.sw-chat-header > .pd-path-view { position: relative; top: auto; right: auto; width: auto; height: 184px; min-width: 0; margin: 0; border: 1px solid #e3ebf5; border-radius: 8px; background: #fff; overflow: hidden; box-shadow: 0 3px 10px #233e6610; }
.sw-chat-header > .pd-path-view:hover { height: 225px; overflow: visible; z-index: 5; box-shadow: 0 12px 22px #2b45652b; }
.sw-chat-header .pd-journey { border: 0; border-radius: 8px; }
.sw-chat-header .pd-journey-scroll { border-radius: 0 8px 8px 0; }
@media (min-width: 1350px) {
  .sw-workspace-content .sw-chat-header { grid-column: 2 / 4; grid-row: 1; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); grid-template-rows: 152px; height: 152px; min-height: 0; }
  .sw-chat-header .sw-chat-patient-block { grid-column: 1; grid-row: 1; }
  .sw-chat-header > .pd-path-view { grid-column: 2; grid-row: 1; height: 152px; }
  .sw-chat-header > .pd-path-view:hover { height: 225px; }
  .sw-chat .sw-workspace-content .sw-assistant { grid-column: 3; grid-row: 2; }
  .sw-chat .ca-assistant { height: 100%; min-height: 0; }
}
@media (min-width: 1350px) and (max-width: 1500px) {
  .sw-chat-header .sw-chat-patient-block { grid-template-columns: 48px minmax(0,1fr); gap: 3px 10px; padding: 12px; }
  .sw-chat-patient-block > .sw-avatar { width: 48px; height: 48px; flex-basis: 48px; }
  .sw-chat-patient-block .sw-patient-main p { font-size: 11px; }
  .sw-chat-patient-block .sw-patient-tags .sw-tag { font-size: 10px; padding: 2px 5px; }
}
@media (max-width: 1349px) {
  .sw-workspace-content .sw-chat-header { grid-template-rows: 152px 184px; height: 348px; }
  .sw-chat-header .sw-chat-patient-block { grid-column: 1; grid-row: 1; }
  .sw-chat-header > .pd-path-view { grid-column: 1; grid-row: 2; }
  .sw-chat-header .pd-journey { border-top: 0; }
}
@media (max-width: 650px) {
  .sw-workspace-content .sw-chat-header { grid-template-rows: minmax(152px,auto) 184px; height: auto; }
  .sw-chat-header .sw-chat-patient-block { height: auto; min-height: 152px; grid-template-columns: 48px minmax(0,1fr); gap: 5px 10px; padding: 12px; overflow: visible; }
  .sw-chat-patient-block > .sw-avatar { width: 48px; height: 48px; flex-basis: 48px; }
}

/* The current node lives in the patient card; the full path opens over it on hover. */
.sw-workspace-content .sw-chat-header { grid-template-columns: minmax(0,1fr); grid-template-rows: 152px; height: 152px; }
.sw-chat-header .sw-chat-patient-block { position: relative; grid-template-columns: 58px minmax(0,1fr) 220px; height: 152px; overflow: visible; }
.sw-chat-patient-block > .sw-current-path { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 220px; height: 100%; min-width: 0; padding: 10px 16px; border-left: 1px solid #e3ebf5; border-radius: 0 8px 8px 0; background: #fff; cursor: pointer; }
.sw-current-path > span { color: #6880a1; font-size: 10px; }
.sw-current-path > em { overflow: hidden; color: #42618a; font-size: 11px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.sw-current-node-card { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-height: 62px; padding: 8px 11px; border: 2px solid #246be0; border-radius: 10px; background: #edf4ff; box-shadow: 0 0 0 3px #cfe0ff; }
.sw-current-node-card > strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: #314765; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.sw-current-node-card > small { color: #246be0; font-size: 10px; }
.sw-current-path > .sw-path-hover-hint { color: #3675c4; font-size: 11px; }
.sw-current-path:focus-visible { outline: 2px solid #2676df; outline-offset: -3px; }
.sw-chat-header .sw-chat-patient-block > .pd-path-view { position: absolute; grid-area: auto; top: 0; right: 0; width: 100%; height: 225px; visibility: hidden; opacity: 0; pointer-events: none; z-index: 10; }
.sw-chat-header .sw-chat-patient-block.sw-path-open > .pd-path-view,
.sw-chat-header .sw-chat-patient-block > .sw-current-path:focus ~ .pd-path-view,
.sw-chat-header .sw-chat-patient-block > .pd-path-view:is(:hover,:focus-within) { visibility: visible; opacity: 1; pointer-events: auto; box-shadow: 0 12px 22px #2b45652b; }
@media (min-width: 1350px) {
  .sw-workspace-content .sw-chat-header { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 1349px) {
  .sw-workspace-content .sw-chat-header { grid-template-rows: 152px; height: 152px; }
  .sw-chat-header .sw-chat-patient-block { grid-row: 1; }
}
@media (max-width: 650px) {
  .sw-workspace-content .sw-chat-header { grid-template-rows: 152px; height: 152px; }
  .sw-chat-header .sw-chat-patient-block { grid-template-columns: 48px minmax(0,1fr) 116px; height: 152px; min-height: 152px; padding: 12px; }
  .sw-chat-patient-block > .sw-current-path { width: 116px; gap: 3px; padding: 8px 7px; }
  .sw-current-path > span,.sw-current-path > em,.sw-current-path > .sw-path-hover-hint { font-size: 9px; }
  .sw-current-node-card { min-height: 62px; padding: 6px 7px; }
  .sw-current-node-card > strong { font-size: 11px; }
  .sw-chat-patient-block .sw-patient-main p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .sw-chat-patient-block > .sw-patient-tags { overflow: hidden; max-height: 48px; }
}
