/* Owner-specific composition; no global DS, Mail or Calendar rules. */
.wch-overview .mix-floating-section__body { display: grid; gap: 10px; }
.wch-overview-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wch-overview-title strong { font-size: 14px; }.wch-overview :is(small,span) { font-size: 11px; color: var(--mix-muted, #526d78); }
.wch-overview input, .wch-overview select { box-sizing: border-box; min-width: 0; width: 100%; padding: 9px 10px; border: 1px solid var(--mix-control-border,#bacbd6); border-radius: 9px; background: rgb(255 255 255 / 65%); color: var(--mix-ink,#173e4c); font: inherit; font-size: 12px; }
.wch-modes { display: flex; padding: 3px; border: 1px solid var(--mix-control-border,#bacbd6); border-radius: 10px; gap: 3px; }
.wch-modes button { flex: 1; padding: 7px 9px; border: 0; border-radius: 7px; color: var(--mix-muted,#526d78); background: transparent; cursor: pointer; font-size: 12px; }
.wch-modes button[aria-pressed="true"] { background: var(--mix-floating-surface,#f8fbff); color: var(--mix-blue,#1470b8); box-shadow: 0 2px 7px #173e4c12; font-weight: 650; }
.wch-modes button:disabled { opacity: .5; cursor: not-allowed; }
.wch-filter-row { display: flex; gap: 6px; margin-top: 8px; }.wch-filter-row select { flex: 1; }
#app .wch-thread-heading, #workspace-floating-conversation-portal .wch-thread-heading { display: flex; align-items: center; flex: 0 0 auto; gap: 9px; padding: 7px 10px; border: 1px solid var(--mix-control-border,#c8dade); border-radius: 11px; background: var(--mix-mail-row-background,#f8fbff); min-height: 44px; }
.wch-thread-heading > strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--mix-ink,#173e4c); }
.wch-thread-heading > div { display: flex; align-items: center; gap: 3px; }
#app .wch-thread-heading .internal-room-avatar, .wch-avatar { display: grid; place-items: center; border-radius: 50%; background: #1470b817; color: var(--mix-blue,#1470b8); width: 28px; height: 28px; flex: 0 0 28px; font-size: 10px; }
.wch-launchers { position: fixed; right: 92px; bottom: 18px; z-index: 170; display: flex; gap: 6px; margin-left: auto; max-width: min(600px,60vw); overflow-x: auto; padding: 3px; }
.wch-launchers button { display: flex; align-items: center; gap: 7px; min-width: 90px; max-width: 190px; padding: 8px 10px; border: 1px solid var(--mix-control-border,#c8dade); border-radius: 9px; background: var(--mix-floating-surface,#f8fbff); color: var(--mix-ink,#173e4c); font-size: 11px; cursor: pointer; }
.wch-launchers button[aria-expanded="true"] { border-color: var(--mix-blue,#1470b8); }
.wch-launchers span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }.wch-launchers svg { width: 15px; flex: 0 0 15px; }
[data-wch-avatars] .mix-communications-avatar { display: grid; place-items: center; border-radius: 50%; font-size: 11px; background: #1470b817; }
[data-wch-avatars] img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.wch-thread { position: relative; min-height: 0; height: 100%; display: flex; flex-direction: column; gap: 10px; color: var(--mix-ink,#173e4c); }
.wch-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 16px; border-radius: 12px; border: 1px solid var(--mix-control-border,#c8dade); background: var(--mix-floating-surface,#f8fbff); }
.wch-message { width: fit-content; max-width: 85%; margin: 0 auto 12px 0; padding: 9px 11px; border: 1px solid #173e4c18; background: #fff; border-radius: 4px 12px 12px; box-shadow: 0 2px 5px #173e4c09; }
.wch-message.mine { margin-left: auto; margin-right: 0; border-radius: 12px 4px 12px 12px; background: #e2f0f3; }
.wch-message header { display: flex; align-items: center; justify-content: space-between; gap: 9px; }.wch-message header strong { font-size: 11px; color: var(--mix-blue,#1470b8); }
.wch-message header button { border: 0; background: transparent; color: #536e7d; cursor: pointer; padding: 3px; }.wch-message svg { width: 14px; height: 14px; }
.wch-message p { font-size: 13px; line-height: 1.5; margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wch-message footer { font-size: 9px; color: #526d78; text-align: right; }.wch-message blockquote { margin: 5px 0; border-left: 3px solid var(--mix-blue,#1470b8); padding: 8px; background: #ffffff80; font-size: 11px; overflow-wrap: anywhere; }
.wch-message :is(img,video) { max-width: 100%; width: 280px; max-height: 240px; object-fit: contain; border-radius: 8px; }.wch-message audio { width: 250px; max-width: 100%; }
.wch-message .ws-image-button { width: 100%; }
.wch-composer { flex: 0 0 auto; margin: 0; padding: 10px; border: 1px solid var(--mix-control-border,#c8dade); border-radius: 12px; background: var(--mix-floating-surface,#f8fbff); }
.wch-compose-row { display: flex; gap: 6px; align-items: flex-end; }.wch-compose-row textarea { box-sizing: border-box; min-width: 0; flex: 1; height: 42px; max-height: 120px; resize: vertical; padding: 11px; border: 1px solid var(--mix-control-border,#c8dade); border-radius: 12px; background: #ffffffa0; color: inherit; font: inherit; font-size: 13px; }
.wch-composer small { display: block; font-size: 9px; color: #526d78; margin-top: 6px; }.wch-composer label { display: block; font-size: 11px; }.wch-composer select { display: block; width: 100%; margin: 7px 0; }
.wch-error { font-size: 11px; color: #963748; margin: 0 0 6px; }.wch-error:empty { display: none; }.wch-pending { min-width: 0; max-width: 100%; display: grid; gap: 4px; font-size: 11px; margin-bottom: 8px; }
.wch-pending > span { min-width: 0; display: grid; gap: 3px; overflow: hidden; }
.wch-pending :is(img,video,audio) { display: block; width: auto; max-width: 100%; height: auto; max-height: 100px; object-fit: contain; border: 1px solid var(--mix-control-border,#c8dade); border-radius: 8px; }
.wch-pending audio { width: min(100%, 280px); }
.wch-recording { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 7px; max-width: 100%; padding: 5px 7px; overflow-wrap: anywhere; border: 1px solid var(--mix-blue-200,#a8cef0); border-radius: 9px; background: var(--mix-blue-050,#eaf3fb); color: var(--mix-blue-deep,#0d5689); font-size: 10px; font-weight: 650; line-height: 1.25; }
.wch-recording > .mix-icon-button { flex: 0 0 auto; }
.wch-latest { position: absolute; right: 20px; bottom: 112px; padding: 8px 12px; background: #f8fbff; border: 1px solid #bacbd6; border-radius: 18px; color: #1470b8; cursor: pointer; }.wch-latest[hidden] { display: none; }
.wch-dragging::after { content: "Solte os arquivos aqui"; position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5; border: 3px dashed #1470b8; border-radius: 16px; color: #1470b8; font-weight: 600; background: #effafbee; }
#workspace-floating-conversation-portal { position: fixed; z-index: 180; right: 92px; bottom: 78px; width: min(390px,calc(100vw - 32px)); height: min(600px,calc(100dvh - 180px)); min-height: 280px; border: 1px solid var(--mix-control-border,#b7cbd4); border-radius: 16px; background: var(--mix-floating-surface,#f8fbff); box-shadow: 0 14px 48px #173e4c35; padding: 10px; box-sizing: border-box; }
#workspace-floating-conversation-portal * { box-sizing: border-box; }
#workspace-floating-conversation-portal .wch-thread-heading { border: 0; background: #1470b811; }
#workspace-floating-conversation-portal .wch-log { padding: 10px; border: 0; background: #e9f0f280; }
#workspace-floating-conversation-portal .wch-message { max-width: 90%; }
#workspace-floating-conversation-portal .wch-composer { border: 0; padding: 4px; }
#workspace-floating-conversation-portal :is(button,input,textarea,select):focus-visible { outline: 2px solid #1470b8; outline-offset: 2px; }
@media (max-width: 680px) {
  #workspace-floating-conversation-portal { right: 16px; bottom: 140px; height: min(570px,calc(100dvh - 235px)); }
  .wch-launchers { right: 16px; bottom: 84px; max-width: calc(100vw - 32px); }.wch-launchers button { max-width: 140px; }
  .wch-pending { width: fit-content; max-width: min(100%, 280px); }
  #app .wch-external { height: calc(100dvh - 315px); min-height: 320px; }.wch-external .ws-list-pane { max-height: none; }.wch-external .ws-thread-pane { display: none; height: 100%; }.wch-external.ws-mobile-thread .ws-thread-pane { display:flex; }.wch-external.ws-mobile-thread .ws-list-pane { display:none; }
  #app .wch-thread-heading { flex-wrap: wrap; }.wch-thread-heading > div { margin-left: auto; }
}

.ws-conversations .wch-customer-context { padding: 9px 12px; border: 1px solid var(--mix-control-border); border-radius: 10px; font-size: 12px; max-height: 180px; overflow: auto; background: var(--mix-floating-surface); }
.ws-conversations .wch-customer-context summary { cursor: pointer; font-weight: 600; }
.ws-conversations .wch-customer-context ul { padding-left: 18px; }
.ws-conversations .wch-customer-context p { margin: 4px 0 8px; }

#app [data-wch-back] { display:none; }
@media(max-width:680px) { #app [data-wch-back] { display:inline-flex; } }

/* Workspace composition only; canonical controls retain global styles. */
.wch-overview .mix-floating-section__body { gap:8px; padding:4px 2px 10px; }
.wch-overview-title small { display:none; }
.wch-overview-title strong { font-size:13px; font-weight:600; }
.wch-overview .mix-floating-section__body > span { font-size:11px; }
.wch-list-controls { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.wch-list-controls .wch-origin { flex:1; }
.wch-list-controls .mix-segmented-control { padding:3px; min-height:32px; }
.wch-list-controls .mix-segmented-control label { padding:0; }
.wch-list-controls .ws-list-actions { gap:2px; margin:0; }
.wch-overview [data-wch-search] { display:grid; gap:6px; }
.wch-overview .wch-filter-row { display:block; }
.wch-overview .wch-filter-row select { padding-block:5px; font-size:11px; }
html[data-mix-theme="mix-fiscal-default"] :is([data-wch-insight],[data-wch-details]) .wch-insight-window { position:fixed; right:clamp(32px,18vw,260px); top:210px; width:min(420px,calc(100vw - 32px)); max-height:calc(100dvh - 300px); z-index:250; overflow:auto; }
.wch-insight-window header { padding-right:30px; margin-bottom:16px; }
.wch-insight-window h2 { margin:4px 0; font-size:17px; }
.wch-insight-window h3 { font-size:13px; margin-top:18px; }
.wch-insight-window p { font-size:12px; line-height:1.5; }
.wch-insight-window small,.wch-insight-window time,.wch-context-dates { color:var(--mix-muted); font-size:11px; }
.wch-insight-window details { margin:12px 0; }
.wch-insight-window summary { font-size:13px; font-weight:600; cursor:pointer; }
.wch-insight-window ul,.wch-insight-timeline { list-style:none; margin:12px 0; padding:0; }
.wch-insight-window li { border-top:1px solid var(--mix-control-border); padding:12px 0; font-size:12px; }
.wch-insight-facts { display:grid; grid-template-columns:1fr 1fr; gap:12px; font-size:12px; }
.wch-insight-facts dt { color:var(--mix-muted); font-size:11px; }
.wch-insight-facts dd { margin:4px 0 0; }
@media(max-width:600px){html[data-mix-theme="mix-fiscal-default"] :is([data-wch-insight],[data-wch-details]) .wch-insight-window{right:12px;top:120px;max-height:60dvh;}}

html[data-mix-theme="mix-fiscal-default"] .ws-conversations .wch-overview { padding:10px 12px; }
html[data-mix-theme="mix-fiscal-default"] .ws-conversations .wch-list-controls .mix-segmented-control { padding:2px; }
html[data-mix-theme="mix-fiscal-default"] .ws-conversations .wch-origin label > span { min-height:28px; padding:0 10px; font-size:11px; }

html[data-mix-theme="mix-fiscal-default"] :is([data-wch-insight],[data-wch-details]) .wch-insight-window { width:min(420px,calc(100vw - 32px)); }

html[data-mix-theme="mix-fiscal-default"] .wch-overview .mix-icon-toolbar__rail { width:100%; justify-content:space-between; }
html[data-mix-theme="mix-fiscal-default"] .mix-page-toolbar > .mix-icon-toolbar { padding:0; border:0; background:transparent; box-shadow:none; }
html[data-mix-theme="mix-fiscal-default"] .wch-overview [aria-pressed="true"] { background:var(--mix-floating-section-background); border-radius:8px; }

.ws-selectable-row .ws-row-trailing {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}
.ws-selectable-row .ws-row-trailing > small { min-width: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-pinned-indicator { display: inline-grid; place-items: center; width: 18px; min-width: 18px; height: 18px; color: var(--mix-blue-deep,#0d5689); }
.ws-pinned-indicator svg { width: 12px; height: 12px; fill: currentColor; stroke: currentColor; }

/* Keep unread state visible through the card surface while the DS badge
   carries the compact count and the full accessible status. */
html[data-mix-theme="mix-fiscal-default"] body #app .ws-selectable-row .mix-card-list-item.ws-card-unread {
  border-color: var(--mix-blue, #1470b8) !important;
  background: var(--mix-blue-050, #eaf3fb) !important;
}
html[data-mix-theme="mix-fiscal-default"] .ws-selectable-row .ws-read-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
}
html[data-mix-theme="mix-fiscal-default"] body #app .ws-selectable-row .ws-read-indicator > .mix-badge {
  min-width: 20px !important;
  min-height: 20px !important;
  height: 20px !important;
  padding: 0 4px !important;
  border-radius: 999px !important;
  justify-content: center !important;
  border-color: var(--mix-blue, #1470b8) !important;
  background: var(--mix-blue, #1470b8) !important;
  color: #fff !important;
  font-size: 9px !important;
  line-height: 1 !important;
}

/* The workspace origin switch is local to this toolbar and keeps the
   canonical icon-toolbar geometry while making its pressed state explicit. */
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle {
  gap: 3px;
  padding: 3px;
  border-color: var(--mix-icon-toolbar-border);
  background: var(--mix-icon-toolbar-background);
}
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-toolbar__rail { gap: 3px; }
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button {
  border-radius: 8px;
  transition: border-color var(--mix-transition-fast), background var(--mix-transition-fast), color var(--mix-transition-fast), opacity var(--mix-transition-fast);
}
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button[aria-pressed="true"] {
  border-color: var(--mix-blue, #1470b8) !important;
  background: var(--mix-blue-050, #eaf3fb) !important;
  color: var(--mix-blue-deep, #0d5689) !important;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 76%), 0 2px 6px rgb(20 112 184 / 16%) !important;
  opacity: 1;
}
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button[aria-pressed="false"] {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--mix-muted, #526d78) !important;
  opacity: .72;
}
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button[aria-pressed="false"]:hover:not(:disabled),
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button[aria-pressed="false"]:focus-visible {
  opacity: 1;
}



@media(max-width:680px){
  html[data-mix-theme="mix-fiscal-default"] body #app .mix-module-page-header__tools:has(.ws-page-toolbar,[aria-label="Ferramentas das conversas externas"]) { flex:0 1 auto; min-width:0; max-width:calc(100vw - 210px); }
  html[data-mix-theme="mix-fiscal-default"] body #app :is(.ws-page-toolbar,[aria-label="Ferramentas das conversas externas"]) { width:100%; max-width:100%; overflow-x:auto; flex-wrap:nowrap; }
  html[data-mix-theme="mix-fiscal-default"] body #app :is(.ws-page-toolbar,[aria-label="Ferramentas das conversas externas"]) > * { flex-shrink:0; }
}

.wch-overview { position:relative; }
html[data-mix-theme="mix-fiscal-default"] .wch-overview .wch-filter-panel { position:absolute; top:calc(100% + 8px); left:0; width:min(340px,calc(100vw - 48px)); z-index:260; padding:16px; }
.wch-filter-panel form { display:grid; gap:12px; }
.wch-filter-panel header,.wch-filter-panel footer { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.wch-filter-panel label:not(.mix-checkbox) { display:grid; gap:5px; font-size:12px; }
.wch-filter-panel .mix-checkbox { margin:0; }
.wch-filter-panel .mix-checkbox input { width:1px; padding:0; }
html[data-mix-theme="mix-fiscal-default"] .wch-overview .wch-filter-panel { max-height:calc(100dvh - 360px); overflow:auto; }

.wch-filter-panel [hidden] { display:none!important; }
.wch-filter-panel .mix-segmented-control input { width:1px; padding:0; }

/* Dashboard switch composition: intrinsic width and a defined track outside dashboards. */
.wch-filter-panel .department-mode-toggle {
  --department-accent: #dbe5ed;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  grid-template-columns: auto 42px auto !important;
}
.wch-filter-panel .department-mode-toggle > span { text-transform: none !important; }
.wch-filter-panel .department-mode-toggle input:focus-visible + i {
  outline: 2px solid var(--mix-blue);
  outline-offset: 3px;
}

/* Match the surrounding filter labels without changing the shared checkbox. */
html[data-mix-theme="mix-fiscal-default"] .wch-filter-panel .mix-checkbox__content strong {
  font-size: 12px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: inherit;
}

/* Personal pin action lives in conversation headers; preserve the DS hit area. */
[data-wcl-pin][data-wcl-pinned="false"] svg { opacity: .42; }
[data-wcl-pin]:hover svg,
[data-wcl-pin]:focus-visible svg,
[data-wcl-pin][aria-pressed="true"] svg { opacity: 1; }

/* Stable origin filters and families, scoped to the conversations header. */
html[data-mix-theme="mix-fiscal-default"] body #app .mix-module-page-header__tools:has(.wch-family-toolbar) { width: auto; max-width: calc(100vw - 300px); }
html[data-mix-theme="mix-fiscal-default"] body #app .mix-page-toolbar.wch-family-toolbar { width: auto; justify-content: flex-start; flex-wrap: nowrap; gap: 6px; overflow-x: auto; }
.wch-toolbar-family { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.wch-family-toolbar > * { flex-shrink: 0; }
.wch-family-toolbar .mix-divider--vertical { width: 1px; min-width: 1px; flex: 0 0 1px; height: 22px; min-height: 22px; margin: 0 5px; align-self: center; }
@media (max-width: 700px) {
  html[data-mix-theme="mix-fiscal-default"] body #app .mix-module-page-header__tools:has(.wch-family-toolbar) { width: calc(100vw - 210px); }
}
html[data-mix-theme="mix-fiscal-default"] body #app .wch-family-toolbar > .wch-origin-toggle { width: auto; flex: 0 0 auto; }

.wch-thread-heading > .wch-contact-heading { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 0; gap: 3px; }
.wch-contact-heading > strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.wch-participant-line { border: 0; padding: 0; background: transparent; color: var(--mix-muted); font: inherit; font-size: 10px; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.wch-participant-line:hover, .wch-participant-line:focus-visible { color: var(--mix-primary); text-decoration: underline; }
.wch-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
#app .ws-conversations { height: calc(100dvh - 230px); }
@media(max-width:700px) { #app .ws-conversations { height: calc(100dvh - 290px); } #app .wch-external { height: calc(100dvh - 325px); } }
.wch-contact-search { display: flex; align-items: flex-end; gap: 10px; margin: 15px 0; }
.ws-dialog .wch-contact-search > label { flex: 1; min-width: 0; margin: 0; }
.wch-template-preview { white-space: pre-wrap; font-size: 12px; padding: 10px; background: var(--mix-floating-surface); border-radius: 8px; }
.wch-removed-list { display: grid; gap: 10px; }
.wch-removed-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* Origin totals use the shared badge, positioned only in this consumer. */
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button { position:relative; overflow:visible; }
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .wch-origin-count { position:absolute; top:-5px; right:-5px; min-width:15px; height:15px; padding:0 3px; display:inline-flex; justify-content:center; align-items:center; border-radius:999px; font-size:9px; line-height:1; pointer-events:none; }
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-toolbar__rail { gap:9px; }

/* Details use the same detached floating-window surface as customer context. */
.wch-details-window h2 { margin:0; font-size:15px; }
.wch-details-identity { display:grid; justify-items:center; gap:7px; padding:20px 0; text-align:center; overflow-wrap:anywhere; }
.wch-details-window small { display:block; color:var(--mix-muted); font-size:11px; overflow-wrap:anywhere; }
.wch-details-section { padding:14px 0; border-top:1px solid var(--mix-control-border); }
.wch-details-section h3 { margin:0 0 10px; font-size:13px; }
.wch-details-section p,.wch-details-section li { font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.wch-details-section ul { list-style:none; padding:0; margin:0; display:grid; gap:12px; }
.wch-details-media :is(img,video,audio) { width:100%; max-height:180px; object-fit:contain; border-radius:8px; }
.wch-details-media .ws-image-button { width:100%; }
.wch-details-section summary { font-size:12px; cursor:pointer; }
html[data-mix-theme="mix-fiscal-default"] .wch-origin-toggle .mix-icon-button .wch-origin-count {
  min-width:16px !important; width:auto !important; height:16px !important; min-height:16px !important;
  padding:0 3px !important; border-radius:999px !important; font-size:9px !important; line-height:1 !important;
  display:inline-flex !important; box-sizing:border-box;
}
.wch-details-section .wch-details-media { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
.wch-details-media li { min-width:0; }
.wch-details-media .wch-details-audio { grid-column:1 / -1; }
.wch-details-media :is(img,video) { height:100px; object-fit:contain; background:var(--mix-control-background,#eaf3fb); }
.wch-details-media small { font-size:10px; }
