.pd-workspace{display:grid;grid-template-columns:clamp(240px,26%,300px) minmax(0,1fr);min-height:650px;border:1px solid #e5e7eb;border-radius:10px;background:white;overflow:hidden}.pd-workspace [hidden]{display:none!important}.pd-sidebar{display:flex;flex-direction:column;gap:14px;border-right:1px solid #e5e7eb;padding:18px;min-width:0}.pd-sidebar-heading,.pd-detail-header{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap}.pd-workspace h2{font-size:16px;font-weight:600;color:#111827}.pd-workspace button,.pd-detail-header a{font-size:13px;border:1px solid #d1d5db;border-radius:6px;padding:7px 10px;background:white;color:#374151}.pd-workspace button:hover,.pd-detail-header a:hover{background:#f9fafb}.pd-workspace button:disabled{opacity:.5;cursor:default}.pd-workspace :is(button,a,input):focus-visible{outline:2px solid #6366f1;outline-offset:2px}.pd-search-label{display:block;font-size:12px;color:#6b7280}.pd-search-label input{display:block;border:1px solid #d1d5db;border-radius:6px;padding:9px 10px;width:100%;margin-top:5px;font-size:14px;color:#111827}.pd-muted{font-size:12px;line-height:1.5;color:#6b7280}.pd-patient-results{max-height:260px;overflow:auto;background:white;border:1px solid #e5e7eb;margin-top:8px}.pd-thread-list{flex:1;overflow:auto;max-height:520px}.pd-workspace .pd-thread-row{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid #f3f4f6;border-radius:0;padding:14px 10px;white-space:normal}.pd-thread-row[aria-current=true]{background:#eef2ff!important;border-left:3px solid #6366f1!important}.pd-thread-top{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.pd-thread-top strong{font-size:15px;color:#111827}.pd-thread-row>span:not(.pd-thread-top){display:block;color:#6b7280;font-size:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-top:4px}.pd-thread-row small{display:block;font-size:11px;color:#9ca3af;margin-top:5px}.pd-unread{font-size:11px;color:#4338ca;white-space:nowrap;font-weight:600}.pd-list-footer{display:flex;flex-direction:column;gap:8px;font-size:11px;color:#6b7280}.pd-list-footer button{width:100%}.pd-conversation{padding:24px;min-width:0}.pd-detail-header{display:block;border:0;padding:0;margin:0 0 6px}.pd-detail-header p{font-size:13px;color:#6b7280;margin:0}.pd-detail-header a{color:#4f46e5}.pd-empty{height:100%;min-height:450px;display:flex;align-items:center;justify-content:center;text-align:center;font-size:14px;color:#9ca3af}.pd-error{font-size:13px;color:#dc2626}.pd-error:empty{display:none}.pd-workspace .pd-mobile-back{display:none}@media(max-width:800px){.pd-workspace{display:block;min-height:580px}.pd-sidebar{border-right:0;min-height:580px}.pd-conversation{display:none;padding:16px}.pd-show-thread .pd-sidebar{display:none}.pd-show-thread .pd-conversation{display:block}.pd-workspace .pd-mobile-back{display:block}.pd-thread-list{max-height:none}.pd-detail-header{justify-content:flex-start}}

/* Shared creation dialog for the Inbox and patient chart. */
.pd-create-dialog{width:560px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);margin:auto;padding:0;border:1px solid #e5e7eb;border-radius:12px;background:#fff;color:#111827;box-shadow:0 20px 60px #10182833;overflow:hidden}
.pd-create-dialog[open]{display:flex;flex-direction:column}.pd-create-dialog::backdrop{background:#10182870}.pd-create-dialog[hidden]{display:none!important}
.pd-picker-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 24px;border-bottom:1px solid #e5e7eb}.pd-picker-heading h3{font-size:18px;font-weight:600;color:#111827}
.pd-create-body{padding:20px 24px;overflow-y:auto;overscroll-behavior:contain;min-height:0}.pd-create-body .pd-patient-results{max-height:260px;border-radius:6px}.pd-create-dialog .pd-people-results{max-height:240px}.pd-optional-title{margin-top:18px}.pd-optional-title span{font-weight:400;color:#9ca3af}.pd-create-privacy{margin-top:18px}.pd-create-body .pd-error{margin-top:12px}
.pd-create-footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fafafa}.pd-create-dialog button{font-size:13px;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;background:white;color:#374151}.pd-create-dialog [data-discussion-create]{background:#4f46e5;color:#fff;border-color:#4f46e5;font-weight:600}.pd-create-dialog [data-discussion-create]:disabled{opacity:.45;cursor:default}.pd-create-dialog :is(button,input):focus-visible{outline:2px solid #6366f1;outline-offset:2px}
@media(max-width:600px){.pd-create-dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}.pd-create-body,.pd-picker-heading,.pd-create-footer{padding:16px}}
.pd-compose-host{display:inline-flex}.pd-compose-host [hidden]{display:none!important}.pd-compose-trigger{font-size:13px;border:1px solid #d1d5db;border-radius:6px;padding:7px 10px;background:white;color:#374151}.pd-compose-host :is(button,input):focus-visible{outline:2px solid #6366f1;outline-offset:2px}.pd-picker-heading button{font-size:22px;line-height:1;padding:3px 8px;border:1px solid transparent;border-radius:6px;color:#6b7280}
.pd-people-results{max-height:200px;overflow:auto;margin:8px 0}.pd-person-option{display:flex;align-items:center;gap:8px;padding:8px 4px;font-size:13px;border-bottom:1px solid #f3f4f6}.pd-person-option small{margin-left:auto;font-size:11px;color:#6b7280}.pd-person-option input{width:auto}.pd-picked-patient{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;margin-bottom:12px}.pd-picked-patient button{font-size:12px;color:#4f46e5}.pd-embedded{min-height:500px}.pd-embedded .pd-sidebar{padding:18px}.pd-embedded .pd-conversation{padding:24px}.pd-embedded .pd-thread-list{max-height:360px}.pd-embedded [data-discussion-patient-link]{display:none}
.pd-member-heading,.pd-member-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:8px 0;font-size:12px}.pd-member-heading button,.pd-member-actions button,[data-discussion-attach]{font-size:12px;padding:6px 9px;border:1px solid #d1d5db;border-radius:6px;background:white;color:#374151}.pd-file-chip{display:flex;align-items:center;gap:8px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;margin-top:8px;font-size:12px;flex-wrap:wrap}.pd-file-chip>span{overflow-wrap:anywhere}.pd-file-chip small{color:#6b7280;margin-right:auto}.pd-file-chip button{font-size:12px;color:#4f46e5}[data-discussion-members][hidden],[data-discussion-add-panel][hidden],[data-discussion-upload-controls][hidden],[data-discussion-files][hidden]{display:none!important}
.pd-create-dialog button[data-discussion-create]{background:#4f46e5;color:#fff;border-color:#4f46e5}.pd-create-dialog button[data-discussion-create]:hover:not(:disabled){background:#4338ca;border-color:#4338ca}.pd-picker-heading,.pd-create-footer{flex-shrink:0}.pd-people-results h4{font-size:11px;font-weight:600;color:#6b7280;letter-spacing:.04em;text-transform:uppercase;padding:10px 4px 4px}.pd-person-option>span,.pd-picked-patient strong{min-width:0;overflow-wrap:anywhere}.pd-person-option>span{flex:1}.pd-person-option small{max-width:42%;text-align:right;overflow-wrap:anywhere}.pd-person-option input{flex-shrink:0}.pd-picked-patient button{flex-shrink:0}[data-people-selected]{overflow-wrap:anywhere}

.patient-message-unread { display:inline-flex; align-items:center; justify-content:center; min-width:1.25rem; height:1.25rem; margin-inline-start:.375rem; padding:0 .3rem; border-radius:999px; background:#e0e7ff; color:#312e81; font-size:.6875rem; font-weight:700; line-height:1; vertical-align:middle; }
.patient-message-unread[hidden] { display:none; }

.pd-about { margin:.25rem 0; color:#374151; font-size:.875rem; font-weight:500; overflow-wrap:anywhere; }

/* Keep reading surfaces spacious, with one compact conversation context block. */
#main-content:has(> .pd-workspace:not(.pd-embedded)){max-width:1320px;padding:32px;--pd-page-offset:196px}
.pd-conversation>[data-discussion-detail]{display:flex;flex-direction:column;height:100%;min-height:0}
.pd-detail-header{flex-shrink:0}
.pd-header-title-row,.pd-header-context{display:flex;align-items:center;gap:6px 12px;flex-wrap:wrap}
.pd-header-title-row{margin-bottom:6px}
.pd-header-title-row h2{flex:1;min-width:0;overflow-wrap:anywhere}
.pd-header-title-row a{flex-shrink:0}
.pd-header-context{font-size:13px;color:#6b7280;gap:4px 6px}
.pd-header-context p{margin:0;overflow-wrap:anywhere}
.pd-header-context [data-discussion-organization]:empty{display:none}
.pd-header-context [data-discussion-topic]:not([hidden]):not(:empty)+[data-discussion-organization]:not(:empty)::before{content:'·';margin-right:6px}
.pd-focus-context{margin-bottom:6px;flex-shrink:0}
[data-discussion-chat],[data-inbox-discussion-chat]{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}
.pd-chat{flex:1;min-width:0;min-height:0}
.pd-chat [data-discussion-members]{flex-shrink:0;margin-bottom:16px}
.pd-chat .pd-member-heading{margin:0;align-items:flex-start;gap:8px 12px}
.pd-member-summary{flex:1;min-width:0;font-size:14px;line-height:1.45;font-weight:500;color:#374151;overflow-wrap:anywhere}
.pd-chat [data-discussion-member-names]{overflow-wrap:anywhere}
.pd-chat [data-portal-thread]{min-height:180px!important;max-height:none!important}
.pd-chat [data-portal-compose],.pd-chat [data-discussion-upload-controls]{flex-shrink:0}
.pd-chat [data-portal-input]{min-width:0}
.focus-container.focus-container--discussion{width:calc(100vw - 48px);max-width:1100px;height:90dvh}
.focus-container--discussion .focus-body{display:flex;flex-direction:column;min-height:0;overflow:hidden}
.focus-container--discussion .focus-card{display:flex;flex:1;flex-direction:column;min-height:0}
.pd-patient-tab-body.pd-messages-body{display:flex;flex-direction:column;min-height:0;overflow:hidden}
.pd-messages-body>.pd-messages-pane{display:flex;flex:1;flex-direction:column;height:100%;min-height:0}
.pd-messages-body .pd-workspace{flex:1;height:100%;min-height:0}
.pd-messages-body .pd-sidebar,.pd-messages-body .pd-conversation{min-height:0}
.pd-messages-body .pd-thread-list{max-height:none}
#provider-portal-patient-modal .modal-content-fixed.pd-messages-active{height:90dvh;max-height:calc(100dvh - 32px)}
@media(min-width:801px){.pd-workspace:not(.pd-embedded){height:calc(100dvh - var(--pd-page-offset,196px));min-height:580px}.pd-sidebar{min-height:0}.pd-thread-list{max-height:none}.pd-conversation{min-height:0}}
@media(min-width:1024px){#provider-portal-patient-modal .modal-content-fixed.pd-messages-active{width:calc(100vw - 48px);max-width:1280px}}
@media(max-width:1024px){#main-content:has(> .pd-workspace:not(.pd-embedded)){padding:24px;--pd-page-offset:180px}}
@media(max-width:800px){#main-content:has(> .pd-workspace:not(.pd-embedded)){padding:16px}.pd-conversation,.pd-embedded .pd-conversation{padding:16px}.pd-conversation>[data-discussion-detail]{height:auto;min-height:560px}.pd-chat [data-portal-thread]{min-height:300px!important}.focus-container.focus-container--discussion{width:calc(100vw - 32px)}.focus-container--discussion .pd-chat [data-portal-thread]{min-height:120px!important}.focus-container--discussion .focus-body{overflow-y:auto}.pd-messages-body .pd-conversation{height:100%;overflow-y:auto}.pd-messages-body .pd-conversation>[data-discussion-detail]{height:100%;min-height:0}.pd-messages-body .pd-chat [data-portal-thread]{min-height:120px!important}.pd-messages-body .pd-sidebar{height:100%;min-height:0}}

/* Patient and participants identify a conversation; an optional topic is secondary. */
.pd-workspace .pd-header-title-row h2{font-size:18px;line-height:1.3}
.pd-workspace .pd-thread-row>.pd-thread-participants{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal;color:#374151;font-size:13px;line-height:1.45;font-weight:500}
.pd-thread-participants strong{font-weight:600}
.pd-header-context [data-discussion-topic]{font-size:12px;color:#6b7280}
.pd-inbox-participants{display:block;margin-top:4px;font-size:13px;line-height:1.45;color:#374151;white-space:normal;overflow-wrap:anywhere}

.pd-chat .pd-member-heading{justify-content:flex-start;align-items:center;gap:8px}
.pd-member-label{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;font-size:14px;color:#374151}
.pd-member-label [data-discussion-add-people]{width:28px;height:28px;min-width:28px;padding:0;font-size:20px;font-weight:400;line-height:1;border-color:#d1d5db}
@media(max-width:800px){.pd-member-label [data-discussion-add-people]{width:44px;height:44px;min-width:44px}}

/* Anchored, nonmodal participant sheet; the top layer avoids clipped chat panes. */
.pd-chat .pd-member-heading{justify-content:flex-start;gap:8px;flex-wrap:nowrap}
.pd-chat .pd-member-summary{flex:0 1 auto;min-width:0}
.pd-chat [data-discussion-add-people]{flex-shrink:0;width:26px;height:26px;min-width:26px;border-radius:50%;padding:0;font-size:18px;line-height:1;display:inline-flex;align-items:center;justify-content:center}
.pd-people-sheet{position:fixed;inset:auto;margin:0;padding:16px;border:1px solid #d1d5db;border-radius:12px;background:#fff;color:#111827;box-shadow:0 12px 32px #10182829;overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box}
.pd-people-sheet:not([hidden]){display:flex;flex-direction:column;gap:0}.pd-people-sheet>h3,.pd-people-sheet>p,.pd-people-sheet>.pd-member-actions{flex-shrink:0}.pd-people-sheet [data-discussion-add-picker]{display:flex;flex-direction:column;min-height:0;flex:1}.pd-people-sheet [data-discussion-add-picker]>:not(.pd-people-results){flex-shrink:0}.pd-people-sheet .pd-people-results{min-height:0;flex:1}.pd-people-sheet[hidden]{display:none!important}.pd-people-sheet::backdrop{background:transparent;pointer-events:none}
.pd-people-sheet-title{font-size:14px;font-weight:600;margin:0 0 8px}.pd-people-sheet .pd-people-results{max-height:220px}
.pd-people-sheet .pd-member-actions{margin-top:12px;justify-content:flex-end}
@media(max-width:800px){.pd-chat [data-discussion-add-people]{width:32px;height:32px;min-width:32px}}

/* Creation keeps participant selection compact until Find people is opened. */
.pd-create-people-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px}.pd-create-people-heading button{flex-shrink:0}
[data-discussion-selected-people]{margin-top:8px;overflow-wrap:anywhere}
.pd-people-sheet [data-discussion-create-people-picker]{display:flex;flex-direction:column;min-height:0;flex:1}.pd-people-sheet [data-discussion-create-people-picker]>:not(.pd-people-results){flex-shrink:0}

/* Removable selections share the same compact pills in sheets and forms. */
.pd-selected-label{margin:8px 0 5px;font-size:12px;color:#6b7280}.pd-selected-pills{display:flex;flex-wrap:wrap;align-items:center;gap:6px;max-height:100px;overflow-y:auto}
.pd-selected-pill{display:inline-flex;align-items:center;gap:4px;max-width:100%;padding:3px 5px 3px 9px;border:1px solid #e5e7eb;border-radius:999px;background:#f3f4f6;color:#374151;font-size:12px;line-height:1.4}.pd-selected-pill>span{min-width:0;overflow-wrap:anywhere}
.pd-selected-pills .pd-selected-pill button{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;padding:0;border:0;border-radius:50%;background:transparent;color:#6b7280;font-size:17px;line-height:1}.pd-selected-pills .pd-selected-pill button:hover{background:#e5e7eb;color:#111827}.pd-selected-pill button:focus-visible{outline:2px solid #6366f1;outline-offset:1px}

/* Patient identity stays together; the latest message precedes optional topics. */
.pd-header-patient{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px;flex:1;min-width:0}
.pd-header-title-row .pd-header-patient h2{flex:initial}
.pd-header-patient [data-discussion-dob]{font-size:12px;line-height:1.5;font-weight:400;color:#6b7280}
.pd-thread-top strong{font-weight:500}
.pd-workspace .pd-thread-row.pd-thread-unread{background:#f5f7ff}
.pd-thread-unread .pd-thread-top strong{font-weight:600}
.pd-thread-row>span[data-preview]{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.45}

/* The embedded patient conversation and its shared SMS modal host use the same live workspace. */
.pd-patient-partner-pane>.pd-workspace{height:clamp(620px,75dvh,820px)}
.pd-patient-partner-pane .pd-thread-list{max-height:none}
.pd-patient-partner-pane .pd-conversation{padding:18px;min-height:0}
.pd-patient-partner-pane [data-discussion-detail]{height:100%;min-height:0}
.pd-expanded-modal .sms-modal-panel{width:calc(100vw - 48px);max-width:1100px;height:90dvh;max-height:calc(100dvh - 32px)}
.pd-expanded-modal #standalone-chat-header h3{font-size:14px}
.pd-expanded-modal [data-chat-kind-separator],.pd-expanded-modal [data-discussion-expand]{display:none}
.pd-expanded-modal #standalone-chat-body{display:flex;min-height:0;overflow:hidden;padding:16px}
.pd-expanded-modal #standalone-chat-container{display:flex;flex:1;min-width:0;min-height:0}
.pd-expanded-modal .pd-workspace{flex:1;width:100%;height:100%;min-height:0}
.pd-expanded-modal .pd-thread-list{max-height:none}
.pd-expanded-modal .pd-conversation{min-height:0;padding:18px}
.pd-expanded-modal .pd-conversation>[data-discussion-detail]{height:100%;min-height:0}
@media(max-width:800px){.pd-expanded-modal .sms-modal-panel{width:calc(100vw - 24px)}.pd-expanded-modal #standalone-chat-body{padding:12px}.pd-expanded-modal .pd-sidebar{height:100%;min-height:0}.pd-expanded-modal .pd-chat [data-portal-thread]{min-height:120px!important}}
