/* Continuity list: keep the existing mobile list/chat separation authoritative.
   Later desktop layout rules must not let an empty conversation shrink the list. */
@media (max-width:860px){
  body:not(.mobile-chat-open) #tab-atendimento .detail.service-conversation{display:none!important}
  body:not(.mobile-chat-open) #tab-atendimento .service-queue{max-height:none!important}
}

/* Mobile-first + PWA layer. Desktop rules remain untouched above 860px. */
:root{--mobile-nav-h:72px;--mobile-top-h:58px;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px)}
.mobile-only{display:none!important}.mobile-more-sheet,.mobile-context-backdrop{display:none}html{min-width:0;overflow-x:hidden}body{min-width:0;overflow-x:hidden;-webkit-text-size-adjust:100%;touch-action:manipulation}button,input,select,textarea{font-size:16px}button{min-height:42px}img,video,canvas,svg{max-width:100%}.table-scroll,.pipeline-table-wrap,.wa-table-wrap{max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch}
@media (max-width:860px){
  html,body{height:100%;background:#f6f8f9}.mobile-only{display:initial!important}.desktop-only{display:none!important}
  .app{display:block;min-height:100dvh;padding:0;background:#f6f8f9}.sidebar{display:none!important}.main{height:100dvh;min-height:100dvh;overflow:hidden;padding:calc(var(--safe-top) + 8px) max(10px,var(--safe-right)) calc(var(--mobile-nav-h) + var(--safe-bottom) + 8px) max(10px,var(--safe-left));display:flex;flex-direction:column;gap:8px}
  .app-topbar{height:auto;min-height:var(--mobile-top-h);padding:8px 4px 8px;background:rgba(246,248,249,.92);backdrop-filter:blur(16px);border-bottom:1px solid rgba(215,224,228,.75);gap:8px;align-items:center;margin:0;z-index:30}.app-topbar .topbar-page{display:block;min-width:0;flex:1}.app-topbar .topbar-page .eyebrow,.app-topbar .topbar-page #pageSubtitle{display:none}.app-topbar h2{font-size:18px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.global-search-wrap{order:2;flex:1 0 100%;display:none}.mobile-search-open .global-search-wrap{display:block}.global-search{height:42px}.global-search-key{display:none}.topbar-actions{margin-left:0;gap:6px;flex:0 0 auto;flex-wrap:nowrap}.topbar-actions .secondary,.topbar-actions .icon-only[title="Respostas rápidas"],.topbar-actions .icon-only[title="Tarefas / pendências"],.topbar-actions .icon-only[title="Status WhatsApp"]{display:none}.user-badge{padding:6px 9px;font-size:12px;max-width:34vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-shadow:none}.topbar-actions .icon-only{width:38px;height:38px;min-height:38px}
  .tab-panel.active{display:block;min-height:0}.workspace-panel,.panel,section{border-radius:18px}.workspace-panel{flex:1;overflow:auto;-webkit-overflow-scrolling:touch}.grid.two,.grid.three,.split,.people-layout{grid-template-columns:1fr!important}.row{flex-wrap:wrap}.filters{grid-template-columns:1fr!important}.modal-backdrop{align-items:end;place-items:end center;padding:0 max(8px,var(--safe-right)) calc(var(--safe-bottom) + 8px) max(8px,var(--safe-left))}.modal-card{width:100%;max-height:86dvh;border-radius:22px 22px 18px 18px;padding:16px}.modal-actions{position:sticky;bottom:0;background:linear-gradient(180deg,rgba(255,253,248,0),#fffdf8 30%);padding-top:12px}.drawer-backdrop,.context-drawer{padding-bottom:calc(var(--safe-bottom) + 8px)}
  .mobile-bottom-nav{position:fixed;z-index:6000;left:0;right:0;bottom:0;height:calc(var(--mobile-nav-h) + var(--safe-bottom));padding:6px max(8px,var(--safe-right)) calc(6px + var(--safe-bottom)) max(8px,var(--safe-left));display:grid;grid-template-columns:repeat(5,1fr);gap:4px;background:rgba(255,255,255,.94);backdrop-filter:blur(18px);border-top:1px solid #dbe7ef;box-shadow:0 -10px 28px rgba(16,24,40,.08)}.mobile-bottom-nav button{min-height:56px;border-radius:16px;background:transparent;color:#526b76;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:4px;font-size:10px;font-weight:850;box-shadow:none}.mobile-bottom-nav button b{font-size:20px;line-height:1}.mobile-bottom-nav button.active{background:#e7f3f6;color:#0d4f63}.mobile-bottom-nav .nav-badge{min-width:19px;height:19px;border-radius:999px;background:#0d4f63;color:#fff;display:inline-grid;place-items:center;font-size:10px;padding:0 5px;position:absolute;transform:translate(18px,-18px)}
  .mobile-more-sheet{position:fixed;z-index:6100;inset:auto max(8px,var(--safe-right)) calc(var(--mobile-nav-h) + var(--safe-bottom) + 8px) max(8px,var(--safe-left));display:none;background:#fff;border:1px solid #dbe7ef;border-radius:24px;box-shadow:0 24px 80px rgba(8,43,60,.22);padding:10px}.mobile-more-open .mobile-more-sheet{display:block}.mobile-more-sheet h3{margin:6px 8px 10px;font-size:15px}.mobile-more-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.mobile-more-grid button{background:#f7fafb;color:#0b3447;border:1px solid #e1ebef;justify-content:flex-start;text-align:left;padding:12px;box-shadow:none}.mobile-sheet-backdrop{display:none;position:fixed;z-index:6090;inset:0;background:rgba(8,43,60,.18)}.mobile-more-open .mobile-sheet-backdrop{display:block}
  #viperAiFab{right:max(14px,var(--safe-right));bottom:calc(var(--mobile-nav-h) + var(--safe-bottom) + 14px);width:54px;height:54px;z-index:5200}.ai-drawer-open #viperAiFab{display:none}.ai-chat-shell{height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 28px)!important;min-height:0}.ai-messages{min-height:0;overflow:auto}.ai-composer-wrap{padding-bottom:max(8px,var(--safe-bottom))}.drawer-card,.drawer{max-width:100vw!important;width:100vw!important;height:100dvh!important;border-radius:0!important;margin:0!important;padding-top:var(--safe-top)!important;padding-bottom:var(--safe-bottom)!important}
  #tab-atendimento.tab-panel.active{height:100%;overflow:hidden;border:0;background:#f5f7fb;border-radius:0}.mobile-atendimento-toolbar{display:flex!important;gap:8px;align-items:center;padding:8px 0}.mobile-atendimento-toolbar button{background:#fff;color:#0d4f63;border:1px solid #dbe7ef;box-shadow:none}.mobile-atendimento-toolbar .mobile-filter-toggle{margin-left:auto}.mobile-filters-collapsed #tab-atendimento .atendimento-filters{display:none!important}#tab-atendimento .atendimento-filters{grid-template-columns:1fr!important;gap:8px;padding:8px;background:transparent;border:0;max-height:46dvh;overflow:auto}#tab-atendimento .atendimento-filters input,#tab-atendimento .atendimento-filters select,#tab-atendimento .atendimento-filters button{min-height:44px;font-size:16px}#tab-atendimento .service-workspace{height:100%;display:block;overflow:hidden;background:#fff;border:1px solid #e4e7ec;border-radius:20px}#tab-atendimento .service-queue{height:100%;max-height:none;border:0;display:flex;background:#fff}#tab-atendimento .service-queue-head{padding:14px 14px 9px;position:sticky;top:0;z-index:3}#tab-atendimento .service-list{padding:0;overflow:auto;-webkit-overflow-scrolling:touch}#tab-atendimento .ticket.queue-ticket{min-height:86px;padding:13px 14px}#tab-atendimento .detail.service-conversation{display:none;height:100%;min-height:0;background:#fff}.mobile-chat-open #tab-atendimento .service-queue{display:none}.mobile-chat-open #tab-atendimento .detail.service-conversation{display:block}.mobile-chat-open #tab-atendimento .atendimento-filters,.mobile-chat-open .mobile-atendimento-toolbar{display:none!important}#tab-atendimento .detail-layout,#tab-atendimento .chat-shell{height:100%;min-height:0}#tab-atendimento .chat-header{position:sticky;top:0;z-index:5;padding:9px 10px;gap:8px;align-items:center}#tab-atendimento .mobile-chat-back{display:inline-grid!important;width:38px;height:38px;min-height:38px;place-items:center;border-radius:999px;background:#f2f8fb;color:#0d4f63;border:1px solid #dbe7ef;padding:0;flex:0 0 auto}#tab-atendimento .chat-name{font-size:16px;line-height:1.15}#tab-atendimento .chat-meta{font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}#tab-atendimento .chat-actions{gap:6px;overflow-x:auto;max-width:42vw;flex-wrap:nowrap}#tab-atendimento .chat-actions button,#tab-atendimento .chat-actions select{min-height:36px;font-size:12px;padding:6px 8px;white-space:nowrap}#tab-atendimento .messages{padding:12px 10px;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}#tab-atendimento .msg{max-width:88%;font-size:14px;padding:9px 10px}#tab-atendimento .msg.outbound{margin-left:auto}#tab-atendimento .msg-media img,#tab-atendimento .msg-media video{max-width:min(240px,100%);max-height:220px}.chat-composer{position:sticky!important;bottom:0;z-index:6;padding:8px calc(8px + var(--safe-right)) max(8px,var(--safe-bottom)) calc(8px + var(--safe-left))!important;box-shadow:0 -8px 18px rgba(16,24,40,.06)}#tab-atendimento .chat-composer textarea{min-height:46px;max-height:116px;font-size:16px;resize:none}#tab-atendimento .composer-mode{width:100%;overflow-x:auto;padding-bottom:2px}#tab-atendimento .chat-composer > button{min-height:38px;padding:7px 10px}#tab-atendimento .chat-composer #sendReplyButton{margin-left:auto;min-width:82px}.mobile-context-button{display:inline-flex!important}.mobile-context-backdrop{position:fixed;z-index:6290;inset:0;background:rgba(8,43,60,.28)}.mobile-context-open .mobile-context-backdrop{display:block}#tab-atendimento .context-rail.v1-rail{position:fixed;z-index:6300;right:0;top:0;bottom:0;width:min(92vw,390px);height:100dvh;max-height:none;padding:calc(var(--safe-top) + 12px) max(12px,var(--safe-right)) calc(var(--safe-bottom) + 12px) 12px;transform:translateX(104%);transition:transform .18s ease;box-shadow:-20px 0 70px rgba(8,43,60,.22);border:0;border-left:1px solid #dbe7ef}.mobile-context-open #tab-atendimento .context-rail.v1-rail{transform:translateX(0)}#tab-atendimento .v1-rail-tabs{position:sticky;top:0;z-index:2}.mobile-context-close{display:block!important;width:100%;margin-bottom:10px;background:#eef6f8;color:#0d4f63;border:1px solid #dbe7ef}
  .operational-home{padding:12px}.op-hero{display:grid;grid-template-columns:1fr;padding:16px;border-radius:20px}.op-hero h3{font-size:24px}.op-grid,.op-metrics{grid-template-columns:1fr!important}.work-card,.task-card,.contact-card{min-height:54px}.day-summary,.day-board{grid-template-columns:1fr!important}#tab-meudia{padding:12px;overflow:auto}.people-tabs{overflow-x:auto;white-space:nowrap}.people-layout{display:grid!important}.people-layout>.panel{min-width:0}.people-layout>.panel:first-child{max-height:none}.people-layout .contact-card{padding:14px}.people-layout #contactSearch,#tab-contatos .filters input{min-height:46px}.people-layout #contactDetail{min-height:180px}#tab-contatos{padding:12px;overflow:auto}.dashboard-v2{padding:12px}.dash-hero{grid-template-columns:1fr;padding:16px;border-radius:22px}.dash-actions,.dash-filters{display:grid;grid-template-columns:1fr!important}.dash-hero-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.dash-kpi{min-height:82px;padding:12px}.dash-kpi.primary{grid-column:1/-1}.dashboard-grid.v2{grid-template-columns:1fr}.dashboard-grid.v2 .panel{max-height:none}.bar-row{grid-template-columns:1fr 52px}.bar-row .bar{grid-column:1/-1}.v2-table,.pipeline-table,.wa-table{min-width:720px}.pipeline-v2{padding:10px;gap:8px}.pipeline-hero{padding:12px;border-radius:18px}.pipeline-title-row{display:grid;grid-template-columns:1fr;gap:10px}.pipeline-title-row h3{font-size:24px}.pipeline-title-actions{display:grid;grid-template-columns:1fr 1fr}.filter-bar{display:flex;overflow-x:auto;flex-wrap:nowrap;padding-bottom:2px}.filter-pill{min-width:168px;max-width:78vw;height:42px}.pipeline-topline{display:block!important}.pipeline-kpis{display:flex!important;overflow-x:auto;gap:8px;margin:8px 0}.pipeline-kpis .kpi-stat{min-width:128px!important;height:64px!important}.pipeline-goal{height:auto!important;min-height:64px!important;margin:8px 0}.pipeline-category-row{display:grid;gap:8px}.pipeline-tabs{overflow-x:auto;display:flex}.pipeline-tab{min-width:max-content}.pipeline-view-tabs{display:flex!important;overflow-x:auto}.pipeline-view-tabs button{min-width:86px;height:38px}.pipeline-board-shell{height:auto;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch}.pipeline-board{display:grid!important;grid-auto-flow:column;grid-auto-columns:minmax(86vw,360px);grid-template-columns:none!important;width:max-content;min-width:100%;height:calc(100dvh - 330px);min-height:360px;overflow:visible}.opp-col{min-height:100%;max-height:100%;overflow:auto}.opp-card.pipeline-card-ux{padding:12px}.card-actions.compact button{width:42px;height:38px}.pipeline-list-view,.pipeline-funnel-view{min-width:0;width:100%}.pipeline-list-card,.pipeline-funnel-card{border-radius:18px}.pipeline-table-wrap{max-height:calc(100dvh - 300px)}#opportunityDetail{max-height:none}.wa-card,.wa-table{font-size:13px}#tab-whatsapp,#tab-importacoes,#tab-usuarios,#tab-metas{padding:12px;overflow:auto}.wa-table-wrap{margin:0 -4px}.wa-qr-panel iframe{height:65dvh}.mobile-landscape-hint{display:none}
}
@media (max-width:430px){@media (max-width:860px){.main{padding-left:max(8px,var(--safe-left));padding-right:max(8px,var(--safe-right))}.dash-hero-grid{grid-template-columns:1fr}.mobile-bottom-nav button span{font-size:9px}.pipeline-board{grid-auto-columns:minmax(90vw,1fr)}#tab-atendimento .chat-actions{max-width:38vw}.user-badge{max-width:26vw}}}
@media (max-width:860px) and (orientation:landscape){.main{padding-top:max(4px,var(--safe-top))}.app-topbar{min-height:48px}.mobile-bottom-nav{height:calc(60px + var(--safe-bottom))}.mobile-bottom-nav button{min-height:44px}.mobile-bottom-nav button b{font-size:17px}#tab-atendimento .chat-header{padding:6px 8px}.pipeline-board{height:calc(100dvh - 250px)}}
@media (min-width:861px){.mobile-bottom-nav,.mobile-more-sheet,.mobile-sheet-backdrop,.mobile-atendimento-toolbar,.mobile-chat-back,.mobile-context-button,.mobile-context-close,.mobile-context-backdrop{display:none!important}}

/* Mobile V2 structural fixes: own the viewport, not just the cosmetics. */
@media (max-width:860px){
  :root{--vvh:100dvh;--mobile-chrome-h:calc(var(--safe-top) + var(--mobile-top-h) + var(--mobile-nav-h) + var(--safe-bottom) + 24px)}
  html,body{height:var(--vvh);min-height:var(--vvh);overflow:hidden;overscroll-behavior:none}
  body.mobile-chat-open,body.ai-drawer-open,body.mobile-context-open{position:fixed;inset:0;width:100%;height:var(--vvh);overflow:hidden}
  .app{height:var(--vvh);min-height:var(--vvh);overflow:hidden}
  .main{height:var(--vvh);min-height:var(--vvh);max-height:var(--vvh);overflow:hidden;box-sizing:border-box}
  .workspace-panel{min-height:0;max-height:calc(var(--vvh) - var(--mobile-chrome-h));overflow:auto;overscroll-behavior:contain}

  #tab-atendimento.tab-panel.active{display:flex;flex-direction:column;min-height:0;height:100%;max-height:calc(var(--vvh) - var(--mobile-chrome-h));overflow:hidden}
  #tab-atendimento .service-workspace{flex:1 1 auto;min-height:0;height:auto;max-height:none;display:block;overflow:hidden;border-radius:18px}
  #tab-atendimento .service-queue{height:100%;min-height:0;display:flex!important;flex-direction:column;overflow:hidden}
  .mobile-chat-open #tab-atendimento .service-queue{display:none!important}
  #tab-atendimento .service-list{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .mobile-chat-open #tab-atendimento .detail.service-conversation{display:flex!important;flex-direction:column;height:100%;min-height:0;overflow:hidden}
  #tab-atendimento .detail-layout{display:flex!important;flex-direction:column;height:100%;min-height:0;overflow:hidden}
  #tab-atendimento .chat-shell{height:100%;min-height:0;display:flex!important;flex-direction:column;overflow:hidden;border-right:0}
  #tab-atendimento .chat-header{flex:0 0 auto;position:relative;top:auto;display:flex!important;flex-direction:row!important;min-height:54px;padding:8px 9px;background:#fff;box-shadow:0 1px 0 rgba(16,24,40,.06)}
  #tab-atendimento .chat-header>div{min-width:0;flex:1}
  #tab-atendimento .chat-actions{flex:0 0 auto;max-width:48vw;overflow-x:auto;overflow-y:hidden;display:flex!important;flex-direction:row!important;-webkit-overflow-scrolling:touch}
  #tab-atendimento .chat-ai{flex:0 0 auto;display:flex!important;flex-direction:row!important;align-items:center;gap:8px;padding:8px 10px;overflow-x:auto}
  #tab-atendimento .messages{flex:1 1 auto;min-height:0!important;max-height:none!important;height:auto;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding-bottom:118px;background:linear-gradient(180deg,#efe7d7,#f8f2e8)}
  #tab-atendimento .chat-composer{flex:0 0 auto;position:sticky!important;bottom:0;z-index:20;display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end;background:#fffdf8;border-top:1px solid #dbe7ef;padding:8px max(8px,var(--safe-right)) max(8px,var(--safe-bottom)) max(8px,var(--safe-left))!important}
  #tab-atendimento .composer-mode{grid-column:1/-1;display:flex;flex-direction:row!important;overflow-x:auto;white-space:nowrap}
  #tab-atendimento .chat-composer textarea{width:100%;min-width:0;max-height:104px;line-height:1.35}
  #tab-atendimento .chat-composer #sendReplyButton{grid-column:2;grid-row:2;margin:0;align-self:stretch}
  .mobile-keyboard-focus #tab-atendimento .chat-composer{padding-bottom:max(8px,var(--safe-bottom))!important}
  #tab-atendimento .context-rail.v1-rail{display:none!important;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;height:var(--vvh);max-height:var(--vvh)}
  .mobile-context-open #tab-atendimento .context-rail.v1-rail{display:block!important}

  #tab-pipeline.workspace-panel{height:100%;max-height:calc(var(--vvh) - var(--mobile-chrome-h));overflow:hidden}
  .pipeline-v2{height:100%;min-height:0;display:flex!important;flex-direction:column;overflow:hidden;padding:8px;gap:8px}
  .pipeline-hero{flex:0 0 auto;max-height:42vh;overflow:auto;-webkit-overflow-scrolling:touch;padding:10px;border-radius:18px}
  .pipeline-title-row{display:grid!important;grid-template-columns:minmax(0,1fr);gap:8px}.pipeline-title-actions{display:grid!important;grid-template-columns:1fr 1fr;position:sticky;top:0;z-index:4;background:rgba(255,255,255,.96);padding-bottom:6px}.pipeline-title-actions button{min-width:0;width:100%}
  .filter-bar{display:flex!important;flex-wrap:nowrap!important;overflow-x:auto;gap:8px;scroll-snap-type:x proximity}.filter-pill,.filter-bar .ghost{flex:0 0 auto;min-width:158px;max-width:76vw}
  .pipeline-kpis{display:flex!important;overflow-x:auto;gap:8px;margin:8px 0;scroll-snap-type:x proximity}.pipeline-kpis .kpi-stat{flex:0 0 132px;min-width:132px!important}.pipeline-goal{margin:6px 0}.pipeline-category-row{display:grid;gap:8px}.pipeline-tabs,.pipeline-view-tabs{display:flex!important;overflow-x:auto;gap:6px}.pipeline-tab,.pipeline-view-tabs button{flex:0 0 auto}
  .pipeline-board-shell{flex:1 1 auto;min-height:0;height:auto!important;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;touch-action:pan-x pan-y;scroll-snap-type:x proximity;border-radius:18px;padding-bottom:8px}
  .pipeline-board-shell::after{content:none!important}
  .pipeline-board{height:100%!important;min-height:0!important;width:max-content!important;min-width:100%!important;display:grid!important;grid-template-columns:none!important;grid-auto-flow:column!important;grid-auto-columns:minmax(86vw,360px)!important;gap:10px;overflow:visible!important;align-items:stretch;touch-action:pan-x pan-y}
  .opp-col{height:100%;min-height:0!important;max-height:none!important;overflow:hidden;scroll-snap-align:start;display:flex!important;flex-direction:column}.opp-col .col-cards{flex:1 1 auto;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch}.opp-card{touch-action:manipulation}.opp-card[draggable="false"]{-webkit-user-drag:none}
  .pipeline-board-shell[data-view="list"],.pipeline-board-shell[data-view="funnel"]{overflow:auto!important}.pipeline-list-view,.pipeline-funnel-view{width:100%;min-width:0}.pipeline-table-wrap{max-height:none}.pipeline-table{min-width:720px}

  body.ai-drawer-open .drawer-backdrop{display:none}.ai-drawer-open .context-drawer{position:fixed!important;inset:0!important;width:100vw!important;min-width:0!important;height:var(--vvh)!important;max-height:var(--vvh)!important;padding:var(--safe-top) 0 var(--safe-bottom)!important;display:grid!important;grid-template-rows:auto minmax(0,1fr)!important;overflow:hidden!important;border:0!important;border-radius:0!important;z-index:7000!important}.ai-drawer-open .drawer-head{position:relative!important;top:auto!important;min-height:52px;padding:8px 12px!important}.ai-drawer-open .drawer-head .ghost{min-width:42px;min-height:38px}
  .ai-chat-shell.ai-chat-premium{height:100%!important;min-height:0!important;max-height:none!important;display:grid!important;grid-template-rows:minmax(0,1fr) auto auto auto!important;overflow:hidden!important}.ai-chat-premium .ai-messages{min-height:0!important;height:auto!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:14px 14px 10px!important;scroll-padding-bottom:130px}.ai-welcome{max-height:28vh;overflow:auto;padding:0 14px 10px!important}.ai-welcome .ai-chips{display:flex;flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px}.ai-answer{flex:0 0 auto;max-height:72px;overflow:auto;padding:0 14px!important}.ai-composer-wrap{position:relative;z-index:2;flex:0 0 auto;padding:8px max(10px,var(--safe-right)) max(10px,var(--safe-bottom)) max(10px,var(--safe-left))!important;background:#fbfcfb}.ai-composer textarea{font-size:16px;max-height:96px!important}.ai-disclaimer{margin:5px 4px 0;font-size:11px}
}

/* Mobile V4: compact Pipeline, touch-first actions, no persistent overlays. */
@media (max-width:860px){
  body.mobile-pipeline-active #viperAiFab{display:none!important}
  body.mobile-pipeline-active .app-topbar{min-height:46px;padding-block:5px}.mobile-pipeline-active .app-topbar h2{font-size:16px}
  body.mobile-pipeline-active #tab-pipeline.workspace-panel{max-height:calc(var(--vvh) - var(--safe-top) - var(--mobile-nav-h) - var(--safe-bottom) - 58px)}
  body.mobile-pipeline-active .pipeline-v2{padding:6px;gap:6px;background:#f6f8f9}
  body.mobile-pipeline-active .pipeline-hero{max-height:31vh;min-height:0;padding:8px;border-radius:16px;box-shadow:0 1px 2px rgba(16,24,40,.04);overflow:auto}
  body.mobile-pipeline-active .pipeline-title-row{grid-template-columns:minmax(0,1fr) auto!important;gap:6px;align-items:center;margin:0 0 4px}
  body.mobile-pipeline-active .pipeline-title-row h3{font-size:18px;line-height:1;margin:0}
  body.mobile-pipeline-active #pipelineSubtitle{display:none}
  body.mobile-pipeline-active .pipeline-title-actions{position:static;display:flex!important;grid-template-columns:none!important;gap:6px;background:transparent;padding:0;justify-self:end}
  body.mobile-pipeline-active .pipeline-title-actions button{height:34px;min-height:34px;width:auto;min-width:40px;padding:0 9px;border-radius:10px;font-size:12px}
  body.mobile-pipeline-active .pipeline-title-actions button:first-child{font-size:0;width:38px;padding:0} body.mobile-pipeline-active .pipeline-title-actions button:first-child::before{content:'↻';font-size:17px}
  body.mobile-pipeline-active .pipeline-title-actions .primary{max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  body.mobile-pipeline-active .filter-bar{margin:4px 0;gap:6px;padding-bottom:2px}.mobile-pipeline-active .filter-pill,.mobile-pipeline-active .filter-bar .ghost{height:34px;min-height:34px;min-width:132px;max-width:64vw;font-size:12px;padding:0 10px;border-radius:999px}
  body.mobile-pipeline-active .pipeline-topline{display:block!important}.mobile-pipeline-active .pipeline-kpis{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:5px 0 4px;overflow:visible}.mobile-pipeline-active .pipeline-kpis .kpi-stat{display:none;min-width:0!important;height:50px!important;min-height:50px!important;padding:7px 8px;border-radius:14px}.mobile-pipeline-active .pipeline-kpis .kpi-stat:nth-child(-n+3),.mobile-pipeline-kpis-open .pipeline-kpis .kpi-stat{display:block}.mobile-pipeline-active .pipeline-kpis .kpi-stat strong{font-size:16px!important}.mobile-pipeline-active .pipeline-kpis .kpi-stat span{font-size:8px;letter-spacing:.04em;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-pipeline-active .pipeline-kpis .kpi-stat::after{inset:auto 8px 0;height:2px}.mobile-pipeline-kpi-toggle{display:block!important;width:100%;height:28px;min-height:28px;margin:2px 0 4px;border-radius:10px;font-size:11px;padding:0;box-shadow:none}.mobile-pipeline-kpis-open .mobile-pipeline-kpi-toggle::after{content:' abertos'}
  body.mobile-pipeline-active .pipeline-goal{height:auto!important;min-height:0!important;margin:4px 0;padding:7px 9px;border-radius:14px}.mobile-pipeline-active .goal-compact-title{font-size:8px}.mobile-pipeline-active .goal-compact-main strong{font-size:12px}.mobile-pipeline-active .goal-compact-main b{font-size:13px}.mobile-pipeline-active .goal-compact-foot{display:none!important}.mobile-pipeline-active .pipeline-goal .progress-track{height:4px}
  body.mobile-pipeline-active .pipeline-category-row{display:grid;grid-template-columns:1fr;gap:5px;margin-top:4px}.mobile-pipeline-active .pipeline-tabs{gap:6px;overflow-x:auto;white-space:nowrap;padding-bottom:1px}.mobile-pipeline-active .pipeline-tab{height:32px;min-height:32px;border-radius:999px;padding:0 10px;font-size:12px}.mobile-pipeline-active .pipeline-tab b{height:19px;min-width:20px;font-size:10px}.mobile-pipeline-active .pipeline-view-tabs{gap:5px;overflow-x:auto}.mobile-pipeline-active .pipeline-view-tabs button{height:31px;min-height:31px;min-width:68px;border-radius:999px;font-size:12px;padding:0 10px}
  body.mobile-pipeline-active .pipeline-board-shell{border-radius:16px;padding:0;min-height:0;scroll-padding-inline:4px;background:#eef4f6}.mobile-pipeline-active .pipeline-board-shell::after{content:none!important}.mobile-pipeline-hint .pipeline-board-shell::before{content:'← deslize etapas →';position:sticky;left:10px;top:8px;z-index:3;display:inline-block;padding:4px 8px;border-radius:999px;background:rgba(13,79,99,.78);color:#fff;font-size:10px;font-weight:800;pointer-events:none;opacity:.92}
  body.mobile-pipeline-active .pipeline-board{grid-auto-columns:calc(100vw - 28px)!important;gap:8px;height:100%!important;padding:4px;box-sizing:border-box}.mobile-pipeline-active .opp-col{height:100%;border-radius:16px;padding:8px}.mobile-pipeline-active .opp-col h3{font-size:11px;margin-bottom:5px}.mobile-pipeline-active .opp-col h3 b{font-size:11px}.mobile-pipeline-active .col-summary{font-size:11px;margin:0 0 6px}.mobile-pipeline-active .opp-card.pipeline-card-ux{padding:9px;margin-bottom:7px;border-radius:14px}.mobile-pipeline-active .opp-card-head.compact{grid-template-columns:28px minmax(0,1fr) 28px}.mobile-pipeline-active .opp-card-head.compact strong{font-size:13px}.mobile-pipeline-active .opp-card-head.compact small,.mobile-pipeline-active .card-meta.compact small{font-size:11px}.mobile-pipeline-active .next-action.compact{padding:6px;margin-top:6px}.mobile-pipeline-active .next-action.compact span{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.mobile-pipeline-active .card-actions.compact button{width:auto;min-width:42px;height:34px;min-height:34px;border-radius:10px}.mobile-pipeline-active .pipeline-card-ux .card-actions.compact button[data-card-action="conversation"]{min-width:76px}
}

/* Mobile V4.1: Atendimento iPhone Safari keyboard/back fixes. */
@media (max-width:860px){
  :root{--vvh:100dvh;--keyboard-bottom:0px;--vk-offset-top:0px;--mobile-chat-top:44px;--mobile-chat-gap:4px;--mobile-nav-compact-h:58px}
  html,body{height:var(--vvh)!important;min-height:var(--vvh)!important;max-height:var(--vvh)!important;overflow:hidden!important;position:relative;overscroll-behavior:none;background:#f6f8f9}
  body.mobile-chat-open,body.mobile-keyboard-open{position:fixed!important;inset:0!important;width:100%!important;height:var(--vvh)!important;min-height:var(--vvh)!important;max-height:var(--vvh)!important;overflow:hidden!important;touch-action:auto}
  body.mobile-keyboard-open #viperAiFab,body.mobile-atendimento-active #viperAiFab,body.mobile-chat-open #viperAiFab{display:none!important}
  body.mobile-chat-open .mobile-bottom-nav{transform:translateY(110%);pointer-events:none}body.mobile-keyboard-open .mobile-bottom-nav{display:none!important}
  .mobile-atendimento-active .main,.mobile-chat-open .main{height:var(--vvh)!important;min-height:var(--vvh)!important;max-height:var(--vvh)!important;padding-top:max(4px,var(--safe-top))!important;padding-bottom:calc(var(--safe-bottom) + 6px)!important;gap:4px;overflow:hidden!important}
  .mobile-chat-open .app-topbar{display:none!important}
  #tab-atendimento.tab-panel.active{height:100%!important;max-height:none!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;background:#f6f8f9!important}
  #tab-atendimento .mobile-atendimento-toolbar{flex:0 0 auto;padding:5px 0!important;gap:6px;min-height:38px}#tab-atendimento .mobile-atendimento-toolbar strong{font-size:15px;line-height:1}#tab-atendimento .mobile-atendimento-toolbar button{height:34px;min-height:34px;border-radius:11px;padding:0 10px;font-size:12px}
  #tab-atendimento .service-workspace{flex:1 1 auto!important;min-height:0!important;height:auto!important;max-height:none!important;overflow:hidden!important;border-radius:16px!important;display:flex!important;flex-direction:column!important}
  #tab-atendimento .service-queue{flex:1 1 auto!important;min-height:0!important;height:auto!important;overflow:hidden!important}#tab-atendimento .service-queue-head{padding:8px 10px 6px!important}.mobile-chat-open #tab-atendimento .service-queue{display:none!important}
  .mobile-chat-open #tab-atendimento .detail.service-conversation{display:flex!important;flex:1 1 auto!important;min-height:0!important;height:auto!important;max-height:var(--vvh)!important;overflow:hidden!important;background:#fff!important;border-radius:16px!important}
  #tab-atendimento .detail-layout{display:flex!important;flex-direction:column!important;flex:1 1 auto!important;min-height:0!important;height:100%!important;overflow:hidden!important}#tab-atendimento .chat-shell{display:flex!important;flex-direction:column!important;flex:1 1 auto!important;min-height:0!important;height:100%!important;overflow:hidden!important;background:#f7efe3!important}
  #tab-atendimento .chat-header{position:relative!important;top:auto!important;flex:0 0 auto!important;min-height:42px!important;padding:5px 7px!important;gap:6px!important;align-items:center!important;background:#fffdf8!important;box-shadow:0 1px 0 rgba(16,24,40,.08)!important}
  #tab-atendimento .mobile-chat-back{width:34px!important;height:34px!important;min-height:34px!important;font-size:24px!important;flex:0 0 34px!important}#tab-atendimento .chat-name{font-size:14px!important;line-height:1.05!important;max-width:46vw!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}#tab-atendimento .chat-header small,#tab-atendimento .chat-header .muted{font-size:10px!important;line-height:1.05!important;display:block!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;max-width:52vw!important}
  #tab-atendimento .chat-actions{max-width:42vw!important;gap:4px!important;display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;scrollbar-width:none!important}#tab-atendimento .chat-actions::-webkit-scrollbar{display:none}#tab-atendimento .chat-actions button{height:32px!important;min-height:32px!important;border-radius:10px!important;padding:0 8px!important;font-size:11px!important;white-space:nowrap!important;box-shadow:none!important}
  #tab-atendimento .chat-ai{display:none!important}#tab-atendimento .messages{flex:1 1 auto!important;min-height:0!important;height:auto!important;max-height:none!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important;padding:8px!important;scroll-padding-bottom:120px!important;background:linear-gradient(180deg,#efe7d7,#f8f2e8)!important}
  #tab-atendimento .msg{max-width:94%!important;margin-bottom:6px!important;padding:8px 9px!important;border-radius:12px!important}#tab-atendimento .msg .meta{font-size:9px!important;line-height:1.1!important;margin-bottom:3px!important}#tab-atendimento .msg p{font-size:13px!important;line-height:1.25!important;margin:0!important}
  #tab-atendimento .selected-quote{grid-column:1/-1!important;padding:6px 8px!important;border-radius:10px!important;font-size:11px!important}
  #tab-atendimento .chat-composer{position:relative!important;bottom:auto!important;flex:0 0 auto!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:6px!important;align-items:end!important;padding:6px max(7px,var(--safe-right)) max(6px,var(--safe-bottom)) max(7px,var(--safe-left))!important;background:#fffdf8!important;border-top:1px solid #dbe7ef!important;z-index:30!important;transform:translateZ(0)}
  #tab-atendimento .composer-mode{grid-column:1/-1!important;display:flex!important;flex-direction:row!important;gap:5px!important;overflow-x:auto!important;padding-bottom:1px!important}#tab-atendimento .composer-mode button{height:30px!important;min-height:30px!important;border-radius:9px!important;padding:0 8px!important;font-size:11px!important;white-space:nowrap!important;flex:0 0 auto!important}
  #tab-atendimento .chat-composer textarea{grid-column:1!important;grid-row:auto!important;width:100%!important;min-height:40px!important;height:40px;max-height:78px!important;padding:8px 10px!important;border-radius:12px!important;font-size:16px!important;line-height:1.25!important;resize:none!important;overflow-y:auto!important}#tab-atendimento .chat-composer #sendReplyButton{grid-column:2!important;grid-row:auto!important;height:40px!important;min-height:40px!important;padding:0 12px!important;border-radius:12px!important;font-size:12px!important;margin:0!important;align-self:end!important}#tab-atendimento .chat-composer .ghost,#tab-atendimento .chat-composer button:not(#sendReplyButton){height:34px!important;min-height:34px!important;font-size:11px!important;border-radius:10px!important;padding:0 8px!important}
  .mobile-keyboard-open #tab-atendimento .chat-header{min-height:38px!important;padding-block:4px!important}.mobile-keyboard-open #tab-atendimento .chat-actions{display:none!important}.mobile-keyboard-open #tab-atendimento .messages{padding-bottom:6px!important}.mobile-keyboard-open #tab-atendimento .composer-mode{display:none!important}.mobile-keyboard-open #tab-atendimento .chat-composer{padding-bottom:max(6px,var(--safe-bottom))!important}.mobile-keyboard-open #tab-atendimento .chat-composer textarea{height:42px!important;max-height:70px!important}
  .mobile-context-open #tab-atendimento .context-rail.v1-rail{position:fixed!important;inset:max(6px,var(--safe-top)) max(6px,var(--safe-right)) max(6px,var(--safe-bottom)) max(6px,var(--safe-left))!important;width:auto!important;height:auto!important;max-height:none!important;border-radius:18px!important;z-index:6300!important;padding:10px!important;background:#fffdf8!important;overflow:auto!important}
}

