/* AURA WhatsApp workspace · approved V3, 17 September 2026.
 * Presentation only: canonical controllers own access, delivery and AI state.
 * All overrides are scoped to the WhatsApp lifecycle class. Conversation,
 * configuration and reception keep one shell; leaving restores the CRM.
 * !important is limited to this scope where legacy inline/important rules
 * otherwise prevent the viewport workspace from owning its own scrolling.
 */
body.wa-workspace-active {
  --wa-workspace-gradient:linear-gradient(110deg,#d84383,#b446b4 50%,#7552d4);
  --wa-workspace-ink:#34243e;
  --wa-workspace-soft:#756178;
  --wa-workspace-line:#e7e2e9;
  --wa-list-width:clamp(330px,26vw,430px);
  --wa-context-width:300px;
  overflow:hidden;
}
body.wa-workspace-active .app {height:100dvh;min-height:0;overflow:hidden}
body.wa-workspace-active .app>.main {display:flex;flex-direction:column;height:100dvh;min-height:0;padding:0!important;overflow:hidden;background:#fff}
body.wa-workspace-active #topBar,
body.wa-workspace-active .mobile-head,
body.wa-workspace-active #v-whatsapp>.wa-workspace-tabs {display:none!important}
body.wa-workspace-active #v-whatsapp.on {flex:1;min-height:0;gap:0!important;padding:0;margin:0;font-family:'Instrument Sans',Inter,sans-serif}
body.wa-workspace-active #v-whatsapp [hidden] {display:none!important}
body.wa-workspace-active #waBody {gap:0;overflow:hidden;min-height:0;flex:1}
body.wa-workspace-active #waBody>.card:has(#waGrid) {border:0!important;border-radius:0!important;box-shadow:none;margin:0!important;padding:0!important;min-height:0;flex:1;overflow:hidden}
body.wa-workspace-active #waGrid {position:relative;display:grid!important;grid-template-columns:var(--wa-list-width) minmax(0,1fr);height:100%!important;min-height:0!important;border:0;border-radius:0;overflow:hidden}
body.wa-workspace-active #waGrid>* {min-width:0;min-height:0}

/* The two destinations stay in the same place; status is never a tab. */
body.wa-workspace-active #v-whatsapp>.wa-control-heading {display:flex!important;align-items:center;gap:24px;height:88px;min-height:88px;padding:0 24px!important;margin:0;border-bottom:1px solid #e6e0e7;background:#fffffff2;flex:none}
body.wa-workspace-active .wa-control-heading .wa-workspace-brand {min-height:0;padding:0!important;flex:none;background:none}
body.wa-workspace-active .wa-control-heading .wa-workspace-brand p {font-size:12px}
body.wa-workspace-active .wa-control-heading .wa-workspace-tabs {display:flex;padding:4px;margin:0;border:1px solid #eee5f1;border-radius:13px;background:#f7f2fa;gap:4px}
body.wa-workspace-active .wa-control-heading .wa-workspace-tabs button {display:flex;align-items:center;gap:6px;min-height:40px!important;border-radius:9px;padding:9px 13px!important;font:650 12px/1.3 'Instrument Sans',sans-serif;white-space:nowrap}
body.wa-workspace-active .wa-control-heading .wa-workspace-tabs button[aria-selected=true] {background:#fff;color:#593768;box-shadow:0 3px 10px #663d7010}
body.wa-workspace-active .wa-nav-count {font-size:10px;border-radius:6px;background:#eee1f4;padding:2px 5px;color:#80518c}
body.wa-workspace-active #waChannelSummary {margin-left:auto;display:inline-flex;align-items:center;flex:none;font:650 11px/1.3 'Instrument Sans',sans-serif;color:#7f6345;background:#fff9ec;border:1px solid #ebdfc9;border-radius:20px;padding:8px 12px}
body.wa-workspace-active #waReception {flex:1;padding:24px;background:radial-gradient(ellipse at top right,#e9dcfb85,transparent 60%),#faf7fc}
body.wa-workspace-active .wa-list-heading {display:flex;align-items:baseline;flex-wrap:wrap;gap:7px;padding:18px 20px 13px;flex:none}
body.wa-workspace-active .wa-list-heading h2 {font:700 20px/1.2 'Instrument Sans',sans-serif;letter-spacing:-.4px;margin:0;color:#392b41}
body.wa-workspace-active .wa-list-heading>span {font-size:10px;color:#93799c}
.wa-handoff-labels {display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin-top:8px;font:650 10px/1.4 'Instrument Sans',sans-serif}
.wa-handoff-origin {border:1px solid #e8d5ef;background:#f4eafa;color:#83549a;border-radius:6px;padding:3px 6px}
.wa-handoff-state {color:#92703e}
.wa-handoff-labels[data-handoff-state=attending] .wa-handoff-state {color:#477a61}
.wa-handoff-labels[data-handoff-state=resolved] .wa-handoff-state {color:#807584}
body.wa-workspace-active .wa-handoff-banner {display:flex;align-items:center;gap:12px;flex:none;padding:11px 17px;background:linear-gradient(110deg,#fff7e8,#fffdf8);border-bottom:1px solid #efdfc4;color:#856236;max-height:25%;overflow:auto}
.wa-handoff-banner>div {flex:1;min-width:0}
.wa-handoff-banner strong {display:block;font-size:12px;line-height:1.4}
.wa-handoff-banner p {font-size:10px;line-height:1.5;margin:4px 0 0;overflow-wrap:anywhere}
body.wa-workspace-active .wa-handoff-banner .btn {font-size:11px;line-height:1.4;min-height:38px;padding:8px 10px;flex:none}
body.wa-workspace-active .wa-handoff-banner[data-handoff-state=attending] {background:linear-gradient(110deg,#edf8f1,#fcfffc);border-color:#dbeadd;color:#527c64}
body.wa-workspace-active .wa-handoff-banner[data-handoff-state=resolved] {background:#faf7fc;border-color:#eadfee;color:#7f6e86}
body.wa-workspace-active .wa-handoff-banner[data-handoff-state=unknown] {background:#f8f4fa;border-color:#e8deed;color:#836e8e}
@media(max-width:1250px){body.wa-workspace-active .wa-nav-long {display:none}body.wa-workspace-active #v-whatsapp>.wa-control-heading {gap:16px;padding:0 18px!important}}
@media(max-width:980px){body.wa-workspace-active #waChannelSummary {display:none}}
@media(max-width:860px){
 body.wa-workspace-active #v-whatsapp>.wa-control-heading {display:flex!important;height:111px;min-height:111px;padding:10px 13px!important;flex-wrap:wrap;gap:0}
 body.wa-workspace-active .wa-control-heading .wa-workspace-brand {width:100%}
 body.wa-workspace-active .wa-control-heading .wa-workspace-brand>div {display:flex;align-items:baseline;justify-content:space-between;gap:10px}
 body.wa-workspace-active .wa-control-heading .wa-workspace-brand p {font-size:10px;margin:0}
 body.wa-workspace-active .wa-control-heading .wa-workspace-tabs {width:100%;margin-top:10px}
 body.wa-workspace-active .wa-control-heading .wa-workspace-tabs button {flex:1;font-size:11px;padding:7px 8px!important;min-height:34px!important;justify-content:center}
 body.wa-workspace-active #v-whatsapp[data-wa-panel=inbox]:has(#waGrid.show-chat)>.wa-control-heading {display:none!important}
 body.wa-workspace-active .wa-handoff-banner {padding:9px 11px;gap:7px}
 .wa-handoff-banner strong {font-size:11px}.wa-handoff-banner p {font-size:10px}
 body.wa-workspace-active .wa-handoff-banner .btn {font-size:10px;padding:7px;max-width:115px;min-height:40px}
 body.wa-workspace-active #waReception {padding:14px}
}

/* Original AURA navigation and logo, focused to an icon rail in this inbox. */
@media(min-width:861px) {
  body.wa-workspace-active .app>.side {width:64px;min-width:64px;max-width:64px;flex:0 0 64px;padding:14px 7px;height:100dvh;overflow-y:auto;overflow-x:hidden;background:#f1f1ef;box-shadow:none;border-right:1px solid #dededa;backdrop-filter:none}
  body.wa-workspace-active .side .brand-wm {display:flex!important;justify-content:center;align-items:center;padding:0;margin:0 0 14px;min-height:40px}
  body.wa-workspace-active .side .brand-wm img {display:block!important;width:33px!important;height:33px!important;margin:0!important;filter:none}
  body.wa-workspace-active .side :is(.brand-wm .wm,.brand-wm .wtag,.brand-wm .wln,.nav-sep,.side-foot,.collapse-btn) {display:none!important}
  body.wa-workspace-active .side .nav-item {font-size:0;line-height:0;padding:9px!important;gap:0;min-height:42px;margin:0 0 3px;justify-content:center;border-radius:50%;width:42px;align-self:center;color:#696d6b;flex:none}
  body.wa-workspace-active .side .nav-item .ic {display:flex!important;margin:0;width:22px;height:22px;font-size:initial}
  body.wa-workspace-active .side .nav-item .ic svg {width:22px;height:22px}
  body.wa-workspace-active .side .nav-item.on {color:#714489;background:linear-gradient(120deg,#f1ddf1,#e4dbf7);box-shadow:none;border-color:transparent}
  body.wa-workspace-active .side .nav-item.on::before,
  body.wa-workspace-active .side .nav-item.on::after {display:none}
}

/* List: identity, search and channel notices live alongside conversations. */
body.wa-workspace-active #waGrid #waColList {display:flex;flex-direction:column;background:#fff!important;border-right:1px solid #e0e3e4!important;overflow:hidden}
body.wa-workspace-active .wa-workspace-brand {display:flex;align-items:center;gap:8px;min-height:87px;padding:14px 20px!important;background:#fff;border:0!important;flex:none}
body.wa-workspace-active .wa-workspace-brand>div {min-width:0;flex:1}
body.wa-workspace-active .wa-workspace-brand :is(h1,h2) {margin:0;font:750 27px/1.1 'Instrument Sans',sans-serif;letter-spacing:-.9px;white-space:nowrap;color:#273c32}
body.wa-workspace-active .wa-workspace-brand :is(h1,h2)>span {display:inline-block;background:var(--wa-workspace-gradient);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;font-size:24px;font-weight:750;letter-spacing:.2px;margin-left:3px}
body.wa-workspace-active .wa-workspace-brand p {margin:7px 0 0;font-size:13px;line-height:1.25;color:#8e7897}
body.wa-workspace-active .wa-workspace-brand .btn {display:inline-flex;align-items:center;justify-content:center;flex:none;width:38px;height:38px;min-height:38px;padding:0;border-radius:50%;box-shadow:none}
body.wa-workspace-active #waSearch {border:0!important;border-radius:22px!important;background:#f3f3f3!important;padding:11px 14px!important;font:14px/1.35 'Instrument Sans',sans-serif!important;min-width:0;min-height:41px}
body.wa-workspace-active #waColList>div:has(>#waSearch) {padding:0 20px 10px!important;gap:6px!important;border:0!important;flex:none}
body.wa-workspace-active #waColList>div:has(>#waSearch)>.btn {min-height:36px!important;height:36px!important;border-radius:50%;box-shadow:none}
body.wa-workspace-active .wa-list-filters {padding:0 20px 10px;gap:7px;flex:none}
body.wa-workspace-active .wa-list-filters button {border:1px solid #dfe0df;border-radius:20px;font:600 12px/1.2 'Instrument Sans',sans-serif;color:#68706b;min-height:32px;padding:6px 12px;background:white}
body.wa-workspace-active .wa-list-filters button[aria-pressed=true] {background:#f0e5f7;border-color:#dfcce9;color:#895396}
body.wa-workspace-active :is(.wa-workspace-list-nav,.wa-workspace-nav) {display:flex;align-items:center;gap:6px;padding:0 20px 10px;flex:none}
body.wa-workspace-active :is(.wa-workspace-list-nav,.wa-workspace-nav) .btn {font-size:11px;min-height:32px;padding:6px 10px;border-radius:10px}
body.wa-workspace-active #waCaptureEntry {margin:0 12px 8px;flex:none}
body.wa-workspace-active #waCaptureEntry button {font-size:12px;min-height:38px;border-radius:11px}
body.wa-workspace-active :is(#waAutopilotNotice,#waHealthBanner,#waConnectivityNotice,#waInboxDiagnosticMsg) {flex:none;margin:0 14px 8px!important;padding:10px 12px!important;border-radius:12px!important;font:12px/1.45 'Instrument Sans',sans-serif!important;max-width:100%;overflow-wrap:anywhere}
body.wa-workspace-active #waAutopilotNotice {gap:8px;align-items:flex-start}
body.wa-workspace-active #waAutopilotNotice button {font:650 11px/1.3 'Instrument Sans',sans-serif!important;min-height:32px!important;white-space:nowrap;padding:0;border:0}
/* The adapter renders the actual source notices here (and on mobile), never
 * a guessed success state. Retain originals until that derived host exists. */
body.wa-workspace-active:has(#waWorkspaceNotice) :is(#waAutopilotNotice,#waHealthBanner,#waConnectivityNotice,#waInboxDiagnosticMsg) {display:none!important}
body.wa-workspace-active #waWorkspaceNotice {flex:none;margin:0 14px 10px;padding:11px 12px;border:1px solid #efdfbc;border-radius:13px;background:#fff5de;color:#84652d;font:12px/1.45 'Instrument Sans',sans-serif;overflow-wrap:anywhere}
body.wa-workspace-active #waWorkspaceNotice p+p {margin-top:5px}
body.wa-workspace-active #waWorkspaceNotice button {min-height:32px;border:0;background:none;color:inherit;font:650 11px/1.3 'Instrument Sans',sans-serif;padding:3px 0;cursor:pointer}
body.wa-workspace-active #waChatList {flex:1;min-height:0;overflow-y:auto;padding:0 12px;overscroll-behavior:contain;scrollbar-width:thin}
body.wa-workspace-active #waChatList .wa-chat {min-height:86px;padding:11px 12px!important;gap:14px!important;border-radius:12px;margin:0 0 2px;border:0!important;overflow:hidden}
body.wa-workspace-active #waChatList .wa-chat[aria-current=true] {background:linear-gradient(100deg,#faf1f7,#f2edf8)!important;box-shadow:inset 3px 0 #b978b2}
body.wa-workspace-active #waChatList .wa-chat:hover {background:#f7f4f8!important}
body.wa-workspace-active #waChatList .wa-chat b {font:650 15px/1.3 'Instrument Sans',sans-serif!important;color:#34243e!important}
body.wa-workspace-active #waChatList .wa-chat>span {width:44px!important;height:44px!important;flex:0 0 44px!important;font-size:14px!important}
body.wa-workspace-active .wa-list-foot {padding:12px 15px;font:11px/1.35 'Instrument Sans',sans-serif;color:#8d7495;border-top:1px solid #edf0eb;flex:none}

/* Chat header: protect identity at the actual conversation width. */
body.wa-workspace-active #waGrid #waConvo {display:flex;flex-direction:column;height:100%;min-height:0;background:#efeae2!important;overflow:hidden;container-type:inline-size;container-name:wa-chat}
body.wa-workspace-active #waConvo .wa-chat-header {position:relative;flex:none;display:flex;align-items:center;gap:12px!important;height:64px;min-height:64px;padding:0 18px!important;background:linear-gradient(105deg,#fff 45%,#fdf9ff)!important;border-bottom:1px solid #eadfeb!important;overflow:visible}
body.wa-workspace-active .wa-chat-header::before {content:'';position:absolute;inset:0 0 auto;height:2px;pointer-events:none;background:var(--wa-workspace-gradient);opacity:.5}
body.wa-workspace-active .wa-workspace-header {min-width:0}
body.wa-workspace-active .wa-chat-header>.wa-workspace-header {display:contents}
body.wa-workspace-active .wa-workspace-person {min-width:125px;flex:1}
body.wa-workspace-active .wa-workspace-person :is(b,strong,h2) {display:block;margin:0;font:650 16px/20px 'Instrument Sans',sans-serif!important;color:#3c2d43!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.wa-workspace-active .wa-workspace-person :is(div,small,p) {font:12px/16px 'Instrument Sans',sans-serif;color:#88758f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.wa-workspace-active .wa-response-mode {display:grid;gap:1px;margin-left:auto;flex:none;min-width:206px;max-width:230px}
body.wa-workspace-active .wa-response-mode>small,
body.wa-workspace-active .wa-response-label {font:650 9px/10px 'Instrument Sans',sans-serif;letter-spacing:.55px;color:#9c83a4;white-space:nowrap}
body.wa-workspace-active .wa-response-segments {display:flex;align-items:center;gap:3px;background:#f6f0f8;border:1px solid #eee2f3;border-radius:10px;padding:1px}
body.wa-workspace-active .wa-chat-header .wa-response-segments button {display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:1;width:auto!important;height:32px!important;min-height:32px!important;min-width:0;padding:6px 8px!important;border:0!important;border-radius:7px;background:transparent!important;color:#896d93;font:650 12px/1.2 'Instrument Sans',sans-serif;white-space:nowrap;cursor:pointer;box-shadow:none}
body.wa-workspace-active .wa-chat-header #waOwnerHuman[aria-pressed=true] {background:var(--wa-workspace-gradient)!important;color:#fff}
body.wa-workspace-active .wa-chat-header #waOwnerAi[aria-pressed=true] {background:#fff2d9!important;color:#936f38}
body.wa-workspace-active .wa-chat-header .wa-response-mode[data-effective=true] #waOwnerAi[aria-pressed=true] {background:linear-gradient(115deg,#e4f2e0,#d8efd9)!important;color:#487957}
body.wa-workspace-active .wa-chat-header .wa-response-segments button:disabled,
body.wa-workspace-active .wa-chat-header .wa-response-segments button[aria-disabled=true] {color:#af98b7;cursor:not-allowed;opacity:.75}
body.wa-workspace-active .wa-response-explanation {font:10px/12px 'Instrument Sans',sans-serif;color:#8a6e52;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.wa-workspace-active .wa-conversation-actions {display:flex;align-items:center;gap:5px;flex:none;margin-left:10px}
body.wa-workspace-active .wa-chat-header .wa-conversation-actions .btn {display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:none;width:auto!important;min-width:0;height:36px!important;min-height:36px!important;padding:7px 10px!important;border:1px solid #eee5f1!important;border-radius:10px;background:#fff!important;box-shadow:none;color:#846d8c;font:650 12px/1.2 'Instrument Sans',sans-serif;white-space:nowrap}
body.wa-workspace-active .wa-chat-header .wa-conversation-actions .btn:first-child {background:linear-gradient(120deg,#f9f0f8,#eee7fb)!important;border-color:#e8d9ef!important;color:#895596}
body.wa-workspace-active .wa-conversation-actions svg {width:17px;height:17px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
body.wa-workspace-active .wa-pending-dot {width:5px;height:5px;flex:none;border-radius:50%;background:#cf9e5c;margin:0 0 9px -3px}
body.wa-workspace-active .wa-mobile-channel-notice {display:none}
body.wa-workspace-active #waOpsStrip {flex:none;min-height:25px;padding:4px 16px!important;gap:5px!important;font-size:11px!important;background:#fff!important;border-color:#ece6ef!important}
body.wa-workspace-active #waOpsStrip .wa-ops-copy {gap:6px;font-size:11px;line-height:1.4;flex-wrap:wrap}
body.wa-workspace-active #waOpsStrip .btn {min-height:24px!important;font-size:10px!important;padding:3px 8px!important}

/* One scroll owner: messages take all remaining height, never the tools. */
body.wa-workspace-active #waMsgs {order:10;flex:1 1 0;min-height:120px!important;overflow-y:auto!important;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;gap:12px!important;padding:24px 6%!important;background-color:#efeae2;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='210' height='185' viewBox='0 0 210 185'%3E%3Cg fill='none' stroke='%23c9c3b8' stroke-opacity='.27' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 22q10-12 20 0l-10 17zM72 16l14 9-13 10-14-9zM135 25c-12-8-25 7-10 17l10 8 11-9c14-12 0-23-11-16zM183 18l7 4-2 8-9 1-4-7zM40 64l8 5-4 9-9-5zM99 63c-17 3-16 20-2 22 10-8 13-19 2-22zM150 80l14-4 5 14-14 4zM19 122c11-14 24 1 1 15-24-13-10-29-1-15zM79 142c-15-19 9-27 16-17-13 1-14 11-16 17zM142 150l13-7 4 9-12 7zM173 126q15-10 20 4l-10 13zM54 162l7-4m3 9 7-2M190 168l8-2M114 107l5-8'/%3E%3Ccircle cx='196' cy='66' r='9'/%3E%3Cpath d='M192 64h1m6 0h1m-8 5q4 3 7 0'/%3E%3C/g%3E%3C/svg%3E")}
body.wa-workspace-active #waMsgs>[id^=wa-msg-] {max-width:min(80%,680px)!important;border-radius:8px!important;padding:9px 12px 6px!important;font:15px/1.5 'Instrument Sans',sans-serif!important;color:#26332b;background:#fff!important;border:0!important;box-shadow:0 1px 1px #09200c16!important;overflow-wrap:anywhere}
body.wa-workspace-active #waMsgs>[id^=wa-msg-][data-outgoing=true] {background:#d9fdd3!important;border-top-right-radius:0!important}
body.wa-workspace-active #waMsgs>[id^=wa-msg-][data-outgoing=false] {border-top-left-radius:0!important}
body.wa-workspace-active #waMsgs>[id^=wa-msg-][data-failed=true] {background:#fff0f1!important;border:1px solid #e8a0a8!important}
body.wa-workspace-active #waMsgs :is(img,video,audio) {max-width:100%!important}
body.wa-workspace-active #waWindowBar {order:20;flex:none;padding:8px 18px!important;font:12px/1.4 'Instrument Sans',sans-serif!important;border:0!important;border-top:1px solid #e5ddcf!important;min-height:34px;overflow-wrap:anywhere}
body.wa-workspace-active #waReplyBar {order:21;flex:none;padding:7px 14px!important;font:12px/1.4 'Instrument Sans',sans-serif;background:#eaf2e6!important}
body.wa-workspace-active #waDraftHint {order:40;flex:none;background:#efeae2!important;font:10px/1.4 'Instrument Sans',sans-serif;padding:0 18px 5px!important}

/* Compact composer; canonical input, attachment and send controls are retained. */
body.wa-workspace-active .wa-composer {order:30;flex:none;background:#efeae2!important;padding:8px 14px 12px!important;border:0}
body.wa-workspace-active .wa-compose-modes {display:flex;align-items:center;gap:5px;margin:0 0 5px}
body.wa-workspace-active .wa-compose-modes button {min-height:25px;padding:4px 8px;font:600 11px/1.2 'Instrument Sans',sans-serif;border-radius:8px;background:#ffffff75;color:#886c92}
body.wa-workspace-active .wa-compose-modes button[aria-pressed=true] {background:#f0e4f6;color:#71417d}
body.wa-workspace-active #waReplyArea {display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;gap:6px;min-height:54px;padding:5px 8px;background:#fff;border-radius:29px;box-shadow:0 1px 3px #1534210a}
body.wa-workspace-active #waInput {grid-column:2;grid-row:1;display:block;width:100%;height:38px;min-height:38px;max-height:120px;padding:8px 2px!important;resize:none;border:0!important;border-radius:0!important;background:#fff!important;color:#34243e;font:15px/22px 'Instrument Sans',sans-serif;overflow-y:auto}
body.wa-workspace-active #waInput:disabled {color:#89928b;-webkit-text-fill-color:#89928b;opacity:1}
body.wa-workspace-active .wa-compose-tools {display:contents;margin:0}
body.wa-workspace-active .wa-compose-more {grid-column:1;grid-row:1;align-self:end;width:44px;height:44px;min-height:44px;padding:0;border:0;background:none;color:#8f7599;font:300 28px/1 'Instrument Sans',sans-serif;border-radius:50%;cursor:pointer}
body.wa-workspace-active #waSendBtn {grid-column:3;grid-row:1;align-self:end;margin:0;width:44px!important;min-width:44px;height:44px!important;min-height:44px!important;padding:8px!important;border:0;border-radius:50%!important;box-shadow:none;background:var(--wa-workspace-gradient);color:white;font-size:0!important}
body.wa-workspace-active #waSendBtn::after {content:'➤';font:20px/1 'Instrument Sans',sans-serif;display:block;transform:rotate(-20deg)}
body.wa-workspace-active #waSendBtn:disabled {opacity:.4;cursor:not-allowed}
body.wa-workspace-active #waSendBtn svg {width:22px;height:22px}
body.wa-workspace-active #waSendBtn:has(svg)::after {content:none}
body.wa-workspace-active .wa-compose-tools>.btn:not(#waSendBtn),
body.wa-workspace-active .wa-compose-tools>#waFileLabel {grid-column:1 / -1;grid-row:auto;justify-self:start;font-size:11px!important;min-height:30px!important;padding:5px 9px!important}
body.wa-workspace-active .wa-compose-help {grid-column:1 / -1;margin:0;font:10px/1.4 'Instrument Sans',sans-serif;color:#8d8193}
body.wa-workspace-active #waReplyArea>.wa-compose-help {padding:0 8px 3px}
body.wa-workspace-active #waNoteArea {padding:9px;background:#fff9eb;border:1px solid #e9d7af;border-radius:16px}
body.wa-workspace-active #waNoteInput {height:50px;min-height:44px;max-height:120px;resize:none;padding:8px!important;border:0!important;border-radius:8px!important;background:#fffaf0!important;color:#654b35;font:15px/22px 'Instrument Sans',sans-serif}
body.wa-workspace-active #waNoteArea>.btn {min-height:34px;font-size:12px;margin:7px 0}

/* Patient context and auxiliary tools are independent stable hosts. */
body.wa-workspace-active #waGrid #waCtx {display:none!important;background:#fff!important;border-left:1px solid var(--wa-workspace-line)!important;padding:16px!important;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;position:static;box-shadow:none!important}
body.wa-workspace-active #waGrid.show-ctx #waCtx {display:block!important}
body.wa-workspace-active #waCtx .wa-context-close {background:#fff;min-height:44px;top:-16px;padding:9px 0;z-index:2;font:650 13px/1.3 'Instrument Sans',sans-serif;color:#735180}
body.wa-workspace-active #waCtx .wa-context-card {padding:19px;border-radius:20px;background:radial-gradient(ellipse at 105% -10%,#d878aa66,transparent 65%),linear-gradient(125deg,#382341,#4a2959 48%,#684475)}
body.wa-workspace-active #waCtx .wa-context-links .btn {font:600 12px/1.45 'Instrument Sans',sans-serif!important;min-height:42px;padding:10px 11px;border-radius:11px}
body.wa-workspace-active #waWorkspaceTools.wa-workspace-tools {position:absolute;z-index:8;inset:0 0 0 auto;width:var(--wa-context-width);max-width:100%;display:flex;flex-direction:column;gap:12px;overflow-y:auto;overscroll-behavior:contain;padding:16px;background:#fff;border-left:1px solid #e8dfed;box-shadow:-12px 0 35px -24px #5c3d70;color:#735880;font:13px/1.5 'Instrument Sans',sans-serif}
body.wa-workspace-active .wa-workspace-tools>header,
body.wa-workspace-active .wa-tools-heading,
body.wa-workspace-active .wa-workspace-tools-head {display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px;padding:0 0 10px;border-bottom:1px solid #eee5f2}
body.wa-workspace-active .wa-workspace-tools h2 {font:700 18px/1.2 'Instrument Sans',sans-serif;margin:0;color:#63416f}
body.wa-workspace-active .wa-workspace-tools h3 {font:650 15px/1.3 'Instrument Sans',sans-serif;margin:10px 0 6px;color:#735880}
body.wa-workspace-active .wa-workspace-tools .btn {min-height:42px;font:600 12px/1.4 'Instrument Sans',sans-serif;border-radius:11px;padding:10px 12px;white-space:normal;text-align:left}
body.wa-workspace-active .wa-workspace-tools :is(.wa-tools-actions,.wa-tools-send) {display:grid;gap:8px}
body.wa-workspace-active .wa-workspace-tools .wa-treatment-kit {flex:none;min-height:0!important;max-height:none!important;overflow:visible!important;border:1px solid #eee1f3;border-radius:14px}
body.wa-workspace-active .wa-workspace-tools .wa-treatment-kit summary {position:static!important;background:#fbf6ff!important;font:650 12px/1.4 'Instrument Sans',sans-serif!important;border-radius:14px}
body.wa-workspace-active .wa-workspace-tools #waSuggest {max-height:none;padding:12px!important;border-radius:14px;overflow:visible;background:#f7f1fc!important}
body.wa-workspace-active .wa-workspace-tools #waSuggest button {min-height:36px!important;font-size:12px!important;white-space:normal!important}
body.wa-workspace-active .wa-workspace-tools #waOpsStrip {padding:9px!important;border:1px solid #eee1f3!important;border-radius:12px;flex-wrap:wrap!important}
body.wa-workspace-active .wa-workspace-tools #waFileLabel {justify-content:flex-start;min-height:42px;border:1px solid #e7d8ef;border-radius:11px;padding:10px 12px;color:#795083}
body.wa-workspace-active #v-whatsapp :is(button,[role=button],input,textarea):focus-visible {outline:3px solid #a463c0;outline-offset:2px}
body.wa-workspace-active #v-whatsapp .btn:hover {transform:none}
/* Canonical toasts are text-only. Keep them visible away from the composer
 * without allowing their temporary overlay to intercept reception actions. */
body.wa-workspace-active #toastC {pointer-events:none;top:76px;bottom:auto!important;right:16px;left:auto!important;transform:none!important;max-width:min(360px,calc(100vw - 96px));align-items:stretch!important}

@media(min-width:1250px) {
  body.wa-workspace-active #waGrid.show-ctx {grid-template-columns:clamp(300px,27vw,430px) minmax(0,1fr) var(--wa-context-width)}
}
@media(min-width:861px) and (max-width:1249px) {
  body.wa-workspace-active {--wa-list-width:330px}
  body.wa-workspace-active #waGrid.show-ctx #waCtx {position:absolute!important;inset:0 0 0 var(--wa-list-width)!important;width:auto!important;z-index:9}
}
@media(min-width:861px) {
  @container wa-chat (max-width:920px) {
    body.wa-workspace-active #waConvo .wa-chat-header {display:grid!important;grid-template-columns:42px minmax(125px,1fr) auto;grid-template-areas:'avatar person owner' 'avatar actions owner';grid-template-rows:29px 35px;min-height:96px;height:96px;gap:6px 11px!important;padding:10px 15px!important}
    body.wa-workspace-active .wa-chat-header>span {grid-area:avatar;align-self:start;margin-top:6px}
    body.wa-workspace-active .wa-workspace-person {grid-area:person;min-width:125px;overflow:hidden}
    body.wa-workspace-active .wa-workspace-person :is(b,strong,h2) {font-size:15px!important;line-height:17px!important}
    body.wa-workspace-active .wa-workspace-person :is(div,small,p) {font-size:10px;line-height:13px}
    body.wa-workspace-active .wa-response-mode {grid-area:owner;align-self:center;min-width:194px;max-width:220px;margin:0}
    body.wa-workspace-active .wa-conversation-actions {grid-area:actions;margin:0;gap:4px;min-width:0}
    body.wa-workspace-active .wa-chat-header .wa-conversation-actions .btn {min-height:32px!important;height:32px!important;font-size:11px;padding:6px 8px!important}
    body.wa-workspace-active .wa-response-mode>small {font-size:8px}
  }
  @container wa-chat (max-width:650px) {
    body.wa-workspace-active .wa-conversation-actions svg {display:none}
    body.wa-workspace-active .wa-response-mode {min-width:178px}
    body.wa-workspace-active .wa-chat-header .wa-response-segments button {padding:6px!important}
  }
}
@media(max-width:860px) {
  body.wa-workspace-active .app>.main {padding:0 0 calc(70px + env(safe-area-inset-bottom))!important}
  body.wa-workspace-active:has(#waGrid.show-chat) .app>.main {padding:0!important}
  body.wa-workspace-active:has(#waGrid.show-chat) .app>.side {display:none!important}
  body.wa-workspace-active #v-whatsapp.on {gap:0!important}
  body.wa-workspace-active #waGrid,
  body.wa-workspace-active #waGrid.show-ctx {grid-template-columns:minmax(0,1fr)!important}
  body.wa-workspace-active #waGrid #waConvo {display:none!important}
  body.wa-workspace-active #waGrid.show-chat #waColList {display:none!important}
  body.wa-workspace-active #waGrid.show-chat #waConvo {display:flex!important}
  body.wa-workspace-active #waGrid.show-ctx #waCtx {position:absolute!important;inset:0!important;width:auto!important;z-index:9}
  body.wa-workspace-active #waWorkspaceTools.wa-workspace-tools {inset:0;width:100%;max-width:none;padding:16px 18px;z-index:10}
  body.wa-workspace-active #waConvo .wa-chat-header {display:grid!important;grid-template-columns:44px 30px minmax(90px,1fr) auto;grid-template-areas:'back avatar person owner' 'actions actions actions actions';grid-template-rows:60px 44px;gap:3px 7px!important;height:124px;min-height:124px;padding:7px 9px 10px!important}
  body.wa-workspace-active .wa-chat-header .wa-back-btn {grid-area:back;display:inline-flex!important;align-items:center;justify-content:center;width:44px!important;min-width:44px;height:44px!important;min-height:44px!important;color:#8c6897!important;font-size:28px}
  body.wa-workspace-active .wa-chat-header>span {grid-area:avatar;width:30px!important;height:30px!important;flex:none!important;font-size:10px!important}
  body.wa-workspace-active .wa-workspace-person {grid-area:person;min-width:90px;overflow:hidden}
  body.wa-workspace-active .wa-workspace-person :is(b,strong,h2) {font-size:14px!important;line-height:18px!important}
  body.wa-workspace-active .wa-workspace-person :is(div,small,p) {font-size:9px;line-height:12px}
  body.wa-workspace-active .wa-response-mode {grid-area:owner;min-width:0;max-width:135px;margin:0}
  body.wa-workspace-active .wa-response-mode>small,
  body.wa-workspace-active .wa-response-label {display:none}
  body.wa-workspace-active .wa-response-segments {padding:2px;gap:2px;border-radius:8px}
  body.wa-workspace-active .wa-chat-header .wa-response-segments button {font-size:11px!important;min-height:44px!important;height:44px!important;padding:4px!important;gap:2px}
  body.wa-workspace-active .wa-response-explanation {font-size:8px;line-height:10px;max-width:135px}
  body.wa-workspace-active .wa-conversation-actions {grid-area:actions;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;width:100%;margin:0;min-width:0}
  body.wa-workspace-active .wa-chat-header .wa-conversation-actions .btn {width:auto!important;min-width:0;height:44px!important;min-height:44px!important;padding:6px!important;font-size:11px;justify-content:center;gap:5px}
  body.wa-workspace-active .wa-conversation-actions svg {width:15px;height:15px}
  body.wa-workspace-active .wa-mobile-channel-notice:not([hidden]) {display:block;flex:none;padding:6px 10px;min-height:29px;max-height:30dvh;overflow-y:auto;background:#fff5de;border-bottom:1px solid #eee2c8;color:#84632d;font:11px/1.35 'Instrument Sans',sans-serif}
  body.wa-workspace-active .wa-mobile-channel-notice summary {min-height:24px;cursor:pointer;font-weight:650}
  body.wa-workspace-active .wa-mobile-channel-notice p {margin:5px 0}
  body.wa-workspace-active .wa-mobile-channel-notice button {margin-left:auto;border:0;background:none;color:inherit;font:650 11px/1.3 'Instrument Sans',sans-serif;min-height:32px;white-space:nowrap}
  body.wa-workspace-active #waOpsStrip {padding:4px 10px!important;min-height:25px;font-size:10px!important}
  body.wa-workspace-active #waMsgs {padding:17px 19px!important;gap:11px!important;min-height:100px!important}
  body.wa-workspace-active #waMsgs>[id^=wa-msg-] {font-size:15px!important;max-width:89%!important;padding:8px 11px 5px!important}
  body.wa-workspace-active #waWindowBar {font-size:11px!important;min-height:39px;padding:7px 11px!important}
  body.wa-workspace-active .wa-composer {padding:7px 7px calc(9px + env(safe-area-inset-bottom))!important}
  body.wa-workspace-active #waReplyArea {gap:4px;padding:4px 6px;min-height:52px}
  body.wa-workspace-active :is(#waInput,#waNoteInput) {font-size:16px;line-height:22px}
  body.wa-workspace-active #waInput {height:38px;min-height:38px;max-height:120px;padding:8px 0!important}
  body.wa-workspace-active .wa-compose-help {font-size:10px}
  body.wa-workspace-active .wa-workspace-brand {padding:14px 16px!important;min-height:87px}
  body.wa-workspace-active .wa-workspace-brand :is(h1,h2) {font-size:25px}
  body.wa-workspace-active .wa-workspace-brand :is(h1,h2)>span {font-size:22px}
  body.wa-workspace-active .wa-workspace-brand .btn {width:40px;height:44px;min-height:44px}
  body.wa-workspace-active .wa-list-filters {gap:5px;padding:0 16px 10px}
  body.wa-workspace-active .wa-list-filters button {font-size:11px;min-height:40px;padding:6px 11px}
  body.wa-workspace-active #toastC {top:calc(env(safe-area-inset-top) + 132px);right:12px;left:12px!important;bottom:auto!important;max-width:calc(100vw - 24px)}
}
@media(max-width:370px) {
  body.wa-workspace-active #waConvo .wa-chat-header {grid-template-columns:44px 27px minmax(75px,1fr) auto;column-gap:5px!important;padding-left:6px!important;padding-right:6px!important}
  body.wa-workspace-active .wa-workspace-person {min-width:75px}
  body.wa-workspace-active .wa-workspace-person :is(b,strong,h2) {font-size:12px!important}
  body.wa-workspace-active .wa-workspace-person :is(div,small,p) {font-size:8px}
  body.wa-workspace-active .wa-chat-header>span {width:27px!important;height:27px!important}
  body.wa-workspace-active .wa-chat-header .wa-back-btn {width:44px!important;min-width:44px}
  body.wa-workspace-active .wa-response-mode {max-width:125px}
  body.wa-workspace-active .wa-conversation-actions svg {display:none}
  body.wa-workspace-active .wa-chat-header .wa-conversation-actions .btn {font-size:10px}
}
/* With a software keyboard or a short landscape viewport, keep the editor
 * reachable instead of imposing a minimum history height on the whole page. */
@media(max-height:540px) {
  body.wa-workspace-active #waMsgs {min-height:0!important;padding-top:10px!important;padding-bottom:10px!important}
  body.wa-workspace-active .wa-mobile-channel-notice:not([hidden]) {max-height:24dvh}
}
@media(prefers-reduced-motion:reduce) {
  body.wa-workspace-active #v-whatsapp *,body.wa-workspace-active .side {scroll-behavior:auto!important;animation:none!important;transition:none!important}
}
/* The canonical patient record stays in the current WhatsApp workspace. */
.drawer.wa-patient-drawer{width:min(680px,92vw);background:#fbf8fc;border-left:1px solid #e8dced;box-shadow:-18px 0 52px -20px #34243e40}
.wa-patient-return{flex:none;min-height:44px;text-align:left;padding:.7rem 1.2rem;border:0;border-bottom:1px solid #e8dced;color:#714a83;background:linear-gradient(110deg,#fff,#f4ebfa);font:inherit;font-size:.85rem;font-weight:600;cursor:pointer}
.wa-patient-drawer .patient-head-row{display:block}
.wa-patient-drawer .patient-head-actions{justify-content:flex-start;margin-top:.75rem}
.wa-patient-drawer :is(.patient-grid-2,.patient-grid-3,.patient-form-fields){grid-template-columns:1fr}
.wa-patient-drawer .patient-tabs{flex-wrap:wrap}
.wa-patient-drawer .patient-health-strip{grid-template-columns:repeat(3,minmax(0,1fr))}
.wa-patient-drawer .patient-health-alerts{grid-column:1/-1}
.wa-patient-drawer .patient-head-metric strong{white-space:normal;overflow-wrap:anywhere}
.wa-patient-drawer .patient-item-row{flex-wrap:wrap}
@media(max-width:860px){.drawer.wa-patient-drawer{width:100vw;max-height:100dvh;min-height:100dvh}}

/* A verified automatic state explains the actual blocker in reception's
 * language. Never truncate that reason or rely on a desktop-only tooltip. */
body.wa-workspace-active #waConvo .wa-chat-header:has(.wa-response-mode){height:auto}
body.wa-workspace-active .wa-response-explanation{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;line-height:1.3}
body.wa-workspace-active .wa-response-mode[data-automatic-state=blocked] .wa-response-explanation,
body.wa-workspace-active .wa-response-mode[data-automatic-state=attention] .wa-response-explanation{color:#8b5126;font-weight:650}
@media(min-width:861px){
  @container wa-chat (max-width:920px){
    body.wa-workspace-active #waConvo .wa-chat-header:has(.wa-response-mode){grid-template-rows:minmax(29px,auto) 35px}
  }
}
@media(max-width:860px){
  body.wa-workspace-active #waConvo .wa-chat-header:has(.wa-response-mode){grid-template-rows:minmax(60px,auto) 44px}
  body.wa-workspace-active .wa-response-explanation{font-size:10px;line-height:1.3}
}
