/* A quieter conversation surface; business tabs and call feeds keep their layout. */
@media (min-width:901px) {
  .detail-dialog:has(#detail.crm-chat-expanded .v20-client-grid) { left:0; width:100vw; }
  body:has(#detail.ow-detail.crm-chat-expanded) .detail-dialog[open] { inset:0!important; width:100vw!important; }
  #detail.ow-detail.crm-chat-expanded .v20-client-grid { grid-template-columns:minmax(0,1fr); }
  #detail.ow-detail.crm-chat-expanded .ow-panel { display:none; }
}
.crm-tab-mobile,.crm-chat-task-toggle { display:none; }
#detail:has(.v20-client-grid) .v20-chat-head { min-height:70px; padding:10px 16px; }
#detail:has(.v20-client-grid) .v20-chat-head h2 { font-size:20px; }
#detail:has(.v20-client-grid) .biz-client-tabs { padding:6px 12px; }
.v20-chat-panel .timeline-filter { margin:0; padding:6px 12px; border-bottom:1px solid #e2e8eb; background:#fff; gap:6px; }
.v20-chat-panel .timeline-filter button { border-radius:9px; font-size:13px; min-height:36px; }
.v20-chat-panel .team-conversation { padding:5px 12px; min-height:42px; background:#fff; color:#62747b; gap:8px; }
.team-conversation > span { flex:1; min-width:0; }
.team-conversation strong { color:#2a434b; }
.team-conversation button { min-height:32px; background:#f2f7f6; border-color:#d6e5e0; font-weight:600; }
.v20-chat-panel .messages { background:#edf2f4; padding:20px 24px; gap:12px; }
.v20-chat-panel .message { position:relative; max-width:min(86%,780px); padding:13px 16px; border:1px solid #dce5e8; border-radius:16px 16px 16px 4px; box-shadow:0 1px 2px #1c3a4710; color:#20343c; line-height:1.55; font-size:15px; }
.v20-chat-panel .message.out { background:#e2f3ed; border-color:#c7e1d6; border-radius:16px 16px 4px 16px; }
.v20-chat-panel .message .message-text { padding-right:24px; }
.message-text a { color:#075f9c; text-decoration:underline; text-underline-offset:3px; }
.message-text a:hover { color:#03416c; }
.v20-chat-panel .message small { font-size:11px; color:#596d76; gap:6px; }
.v20-chat-panel .message small .channel-badge { display:none; }
.message .crm-message-more { position:absolute; top:4px; right:4px; display:grid; place-items:center; width:32px; height:32px; min-height:32px; padding:0; margin:0; border:0; border-radius:8px; background:transparent; color:#536d77; font-size:23px; line-height:1; cursor:pointer; }
.message .crm-message-more:hover,.message .crm-message-more:focus-visible { background:#d6e5e9; outline:2px solid #7cabbf; outline-offset:-2px; }
.crm-message-menu { max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); overflow-y:auto; }
.crm-message-menu .crm-message-limit { margin:5px 8px; padding:9px 6px 5px; border-top:1px solid #e3eaef; max-width:280px; color:#62747e; font-size:12px; line-height:1.45; }
.crm-lead-source { display:flex; align-items:center; gap:12px; margin-top:12px; padding:12px; border:1px solid #b7d6e8; border-radius:11px; background:#edf7ff; color:#144e70; text-decoration:none; }
.crm-lead-source:hover { background:#e1f1fd; border-color:#7fb4d4; }
.crm-lead-source > span:last-child { display:grid; gap:2px; min-width:0; }
.crm-lead-source .crm-source-icon { display:grid; place-items:center; flex:none; width:34px; height:34px; border-radius:9px; background:#d7eaf7; font-size:24px; }
.message .crm-lead-source small { display:block; margin:0; color:#466b82; font-size:11px; }
.crm-lead-source strong { font-size:14px; }
.crm-source-url { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; font-size:12px; color:#50718a; overflow-wrap:anywhere; }
.v20-chat-panel .crm-file-card { display:flex; align-items:center; gap:12px; padding:12px; background:#fff; border:1px solid #d0dee4; border-radius:11px; text-decoration:none; margin-top:10px; }
.crm-file-card strong { color:#234554; font-size:14px; }
.crm-file-card > span:nth-child(2) { min-width:0; overflow-wrap:anywhere; }
.message:has(> .crm-message-more):not(:has(.message-text)) { padding-top:32px; }
.crm-file-card small { display:block; margin-top:4px; }
.message .crm-media-item { margin-top:10px; }
.message .crm-photo img { max-height:320px; border-radius:10px; }
.message .crm-media-open { display:inline-block; margin:7px 10px 0 0; color:#14638a; font-size:12px; }
.message [data-biz-save-message] { margin-top:6px; padding:5px 8px; min-height:30px; border:1px solid #ccdade; border-radius:7px; background:#f6f9fa; font-size:11px; }
.v20-chat-panel .v20-compose { padding:10px 14px max(10px,env(safe-area-inset-bottom)); background:#fff; }
.v20-compose:has(.crm-max-record) { grid-template-columns:minmax(0,1fr) 42px 44px; }
.v20-compose:has(.crm-max-record) .compose-controls > button.primary { grid-column:3; }
.v20-compose .compose-controls > .crm-max-record { display:grid; place-items:center; color:#527b87; grid-column:2; grid-row:1; align-self:end; margin-bottom:2px; }
.v20-compose .compose-controls > .crm-max-record.recording { color:#b62742; }
.v20-chat-panel .chat-sync { min-height:22px; font-size:10px; background:#f8fafb; }
@media (max-width:900px) {
  [data-chat-expand] { display:none!important; }
  #detail:has(.v20-client-grid) .v20-chat-head { min-height:56px; padding:4px 8px; align-items:center; }
  #detail:has(.v20-client-grid) .v20-chat-head h2 { font-size:17px; }
  #detail:has(.v20-client-grid) .v20-chat-head .pills { display:none; }
  #detail:has(.v20-client-grid) .v20-chat-head h2 { text-align:left; margin:0; }
  #detail:has(.v20-client-grid) .v20-head-actions > button { width:40px; height:44px; min-height:44px; padding:0; justify-content:center; }
  #detail:has(.v20-client-grid) .biz-client-tabs { flex-wrap:nowrap; gap:0; padding:0 4px; height:44px; overflow-x:auto; scrollbar-width:none; }
  #detail .biz-client-tabs > button { flex:1 0 auto; border:0; border-radius:0; min-height:44px; padding:6px 8px; font-size:12px; background:transparent; white-space:nowrap; }
  #detail .biz-client-tabs > button.active { color:#145e54; background:#eff7f4; box-shadow:inset 0 -2px #2a7a68; }
  .biz-client-tabs .crm-tab-desktop { display:none; }
  .biz-client-tabs .crm-tab-mobile { display:inline; }
  #detail:has(>.biz-client-tabs) > .ow-mobile-tabs { display:none; }
  .v20-chat-panel .crm-task-buttons [data-task-manual] { width:40px; height:44px; padding:0; font-size:0; }
  .v20-chat-panel .crm-task-buttons [data-task-manual]::before { content:'+'; font-size:24px; font-weight:400; }
  .v20-chat-panel .crm-chat-toolbar { gap:0; padding-right:4px; }
  .v20-chat-panel .crm-chat-toolbar .timeline-filter { scrollbar-width:none; padding:2px 6px; }
  .v20-chat-panel .crm-chat-toolbar .timeline-filter button { min-height:40px; font-size:12px; padding:5px 9px; }
  .v20-chat-panel .crm-task-bar { padding:0 8px; max-height:34dvh; }
  .crm-task-bar .crm-chat-task-toggle { display:flex; align-items:center; gap:10px; width:100%; min-height:44px; padding:5px 4px; border:0; background:transparent; color:#365a54; text-align:left; }
  .crm-chat-task-toggle > span:first-child { flex:1; min-width:0; }
  .crm-chat-task-toggle strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; font-weight:600; }
  .crm-chat-task-toggle small { display:block; margin-top:2px; font-size:10px; color:#6a7d78; }
  .crm-task-bar:not(.crm-task-expanded) .crm-task-summary { display:none; }
  .crm-task-expanded .crm-task-summary { padding:6px 4px 10px; }
  .crm-task-expanded .crm-chat-task-toggle > span:last-child { transform:rotate(180deg); }
  .crm-task-summary button { min-height:40px; }
  .crm-task-summary .team-task-tools { display:flex; }
  .crm-keyboard-open #detail:has(.v20-client-grid) .v20-chat-head { min-height:48px; padding:2px 8px; grid-template-columns:40px minmax(0,1fr) auto; }
  .crm-keyboard-open #detail:has(.v20-client-grid) > .biz-client-tabs,
  .crm-keyboard-open .v20-chat-panel .crm-task-bar { display:none; }
  .v20-chat-panel .messages { padding:12px 10px; gap:10px; }
  .v20-chat-panel .v20-compose { padding:8px 8px max(8px,env(safe-area-inset-bottom)); column-gap:5px; }
  .v20-chat-panel .v20-compose textarea { padding-left:12px; padding-right:48px; }
  .crm-keyboard-open .v20-chat-panel .v20-compose { padding:6px 8px; }
  .v20-chat-panel .message { max-width:96%; padding:11px 12px; font-size:15px; }
  .message .crm-message-more { width:40px; height:40px; top:0; right:0; }
  .v20-chat-panel .message .message-text { padding-right:30px; }
  .v20-chat-panel .team-conversation { padding:4px 8px; gap:5px; font-size:11px; }
  .team-conversation button { min-height:36px; }
  .team-conversation [data-team-conversation="owner"] { font-size:0; width:36px; padding:0; }
  .team-conversation [data-team-conversation="owner"]::before { content:'↶'; font-size:22px; }
  .v20-chat-panel .timeline-filter { padding:4px 8px; }
  .v20-chat-panel .timeline-filter button { min-height:38px; }
}
@media (max-width:360px) {
  #detail .biz-client-tabs > button { font-size:11px; padding:6px 5px; }
}
