/* Máscara do WhatsApp Web: lista de conversas, conversa com balões e ticks, composer, funil de leads. */
.wa-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.wa-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); backdrop-filter: blur(var(--glass-blur)); }
.wa-tabs button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--text-2); font-weight: 600; cursor: pointer; }
.wa-tabs button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wa-tabs button[aria-pressed=true] { background: var(--primary-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--primary-line); }

.wa { display: grid; grid-template-columns: minmax(310px, 410px) minmax(0, 1fr); height: calc(100dvh - 150px); min-height: 520px; overflow: hidden; padding: 0; }
.wa-list { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: rgba(0, 0, 0, .12); }
.wa-list-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 18px 8px; }
.wa-list-head h2 { font: 600 26px/1.1 var(--font-serif); }
.wa-search { display: flex; align-items: center; gap: 10px; margin: 4px 14px 8px; padding: 0 14px; min-height: 42px; border-radius: var(--radius-pill); background: var(--field); border: 1px solid var(--line); color: var(--text-3); }
.wa-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; flex: none; }
.wa-search input { flex: 1; min-width: 0; min-height: 40px; padding: 0; border: 0; background: none; box-shadow: none; outline: none; color: var(--text); }
.wa-search:focus-within { border-color: var(--primary); }
.wa-chips { display: flex; gap: 8px; padding: 2px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.wa-chips::-webkit-scrollbar { display: none; }
.wa-chips button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 13px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: none; color: var(--text-2); font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.wa-chips button i { font-style: normal; font-size: 12px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--text); }
.wa-chips button[aria-pressed=true] { background: var(--primary-soft); color: var(--text); border-color: var(--primary); }
.wa-rows { flex: 1; overflow-y: auto; min-height: 0; }
.wa-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%; padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; transition: background .15s; }
.wa-row:hover { background: rgba(255, 255, 255, .04); }
.wa-row[aria-selected=true] { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.wa-row .avatar { width: 46px; height: 46px; }
.wa-row-main { min-width: 0; }
.wa-row-top, .wa-row-bot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wa-row-top .nm { flex: 1; min-width: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-row-top .tm { font-size: 12px; color: var(--text-3); flex: none; }
.wa-row-top .tm.novo { color: var(--primary); font-weight: 700; }
.wa-row-bot .sn { flex: 1; min-width: 0; color: var(--text-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick { display: inline-flex; color: var(--text-3); flex: none; }
.tick svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tick svg + svg { margin-left: -9px; }
.tick.ok { color: #53bdeb; }
.tick.bad { color: var(--danger); }

.wa-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); }
.wa-vazio { background: radial-gradient(circle at 50% 40%, rgba(var(--primary-rgb), .08), transparent 60%); }
.wa-head { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .18); }
.wa-head-nm { flex: 1; min-width: 0; }
.wa-head-nm h2 { font: 600 22px/1.15 var(--font-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-head-nm .sub { color: var(--text-2); font-size: 13px; }
.wa-head-act { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stage-sel { width: auto; min-height: 36px; padding: 4px 12px; font-size: 13.5px; border-radius: var(--radius-pill); }
.wa-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px clamp(14px, 4vw, 54px); display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(circle at 18% 28%, rgba(255, 255, 255, .045) 1.2px, transparent 1.8px), radial-gradient(circle at 68% 72%, rgba(255, 255, 255, .035) 1.2px, transparent 1.8px); background-size: 46px 46px, 62px 62px; }
.wa-dia { align-self: center; margin: 10px 0 6px; }
.wa-dia span { display: inline-block; padding: 4px 14px; border-radius: 8px; background: rgba(0, 0, 0, .35); color: var(--text-2); font-size: 12.5px; }
.wa-msg { position: relative; max-width: min(76%, 560px); padding: 7px 10px 6px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .28); animation: rise .25s var(--ease); overflow-wrap: anywhere; }
.wa-msg.in { align-self: flex-start; background: var(--bolha-in); border-top-left-radius: 2px; }
.wa-msg.out { align-self: flex-end; background: var(--bolha-out); border-top-right-radius: 2px; }
.wa-msg.humano { box-shadow: 0 1px 1px rgba(0, 0, 0, .28), inset 3px 0 0 var(--primary); }
.wa-msg .autor { font-size: 11.5px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.wa-msg .txt { white-space: pre-wrap; font-size: 14.8px; line-height: 1.42; }
.wa-msg .meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; color: var(--text-3); }
.wa-msg .meta .bad { color: var(--danger); }
.wa-msg.falhou { outline: 1px solid rgba(229, 96, 79, .55); }
.wa-msg .midia { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 4px; border-radius: 8px; background: rgba(0, 0, 0, .25); font-size: 14px; }
.wa-msg .midia svg { width: 20px; height: 20px; fill: none; stroke: var(--primary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wa-msg .apagada { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-style: italic; font-size: 14px; }
.wa-msg .apagada svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.wa-msg.del { opacity: .8; }
.msg-menu { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: rgba(0, 0, 0, .45); color: var(--text-2); cursor: pointer; opacity: 0; transition: opacity .15s; }
.msg-menu svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wa-msg:hover .msg-menu, .msg-menu:focus-visible { opacity: 1; }
@media (hover: none) { .msg-menu { opacity: .7; } }

.wa-foot { position: relative; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(0, 0, 0, .22); }
.wa-composer { display: flex; align-items: flex-end; gap: 10px; }
.wa-input { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; padding: 4px 8px; border-radius: 22px; background: var(--field); border: 1px solid var(--line); }
.wa-input:focus-within { border-color: var(--primary); }
.wa-input textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 130px; padding: 9px 6px; border: 0; background: none; box-shadow: none; outline: none; resize: none; line-height: 1.4; }
.icon-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--text-2); cursor: pointer; }
.icon-btn:hover:not([disabled]) { color: var(--text); background: rgba(255, 255, 255, .06); }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.icon-btn svg, .wa-send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wa-send { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); cursor: pointer; transition: transform .15s var(--ease), opacity .15s; }
:root[data-tema="azul"] .wa-send { color: #fff; background: linear-gradient(135deg, #3f8df0, #2a5fc2); }
.wa-send:active { transform: scale(.94); }
.wa-send:disabled { opacity: .6; cursor: default; }
.wa-dica { margin-top: 6px; padding-left: 6px; }
.wa-rec { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px 0 18px; border-radius: 22px; background: var(--field); border: 1px solid rgba(229, 96, 79, .5); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulsa-rec 1.1s ease-in-out infinite; }
.rec-t { font-variant-numeric: tabular-nums; font-weight: 650; }
.wa-rec .icon-btn { margin-left: auto; }
@keyframes pulsa-rec { 50% { opacity: .35; transform: scale(.8); } }
.emoji-pop { position: absolute; left: 14px; bottom: calc(100% + 6px); z-index: 6; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 10px; width: min(360px, calc(100% - 28px)); background: var(--surface-solid); border: 1px solid var(--primary-line); border-radius: var(--radius-m); box-shadow: var(--shadow); }
.emoji-pop button { font-size: 22px; line-height: 1; padding: 6px 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.emoji-pop button:hover { background: var(--primary-soft); }
.back { display: none; }

/* ---------- funil de leads ---------- */
.funil { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.funil-col { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); backdrop-filter: blur(var(--glass-blur)); min-height: 260px; transition: border-color .15s, background .15s; }
.funil-col.alvo { border-color: var(--primary); background: var(--primary-soft); }
.funil-col header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; border-bottom: 2px solid var(--primary-line); }
.funil-col.st-ganho header { border-color: rgba(76, 195, 138, .5); } .funil-col.st-perdido header { border-color: rgba(229, 96, 79, .5); }
.funil-cards { display: grid; gap: 10px; }
.funil-card { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); cursor: pointer; transition: transform .15s var(--ease), border-color .15s; }
.funil-card:hover { transform: translateY(-2px); border-color: var(--primary-line); }
.funil-card:active { cursor: grabbing; }
.funil-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.funil-top b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funil-top > div:last-child { min-width: 0; }
.funil-card .sn { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.funil-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.funil-card select { min-height: 36px; padding: 4px 10px; font-size: 13px; }
.vazio { padding: 14px 4px; text-align: center; }

@media (max-width: 900px) {
  /* no celular a lista é a página e a conversa abre em tela cheia (sem vidro: backdrop-filter prenderia o position:fixed) */
  .wa { display: block; height: auto; min-height: 0; overflow: visible; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .wa-list { border-right: 0; background: none; }
  .wa-rows { overflow: visible; }
  .wa-chat { position: fixed; inset: 0; z-index: 40; background: var(--bg); transform: translateX(100%); transition: transform .34s var(--ease); visibility: hidden; }
  .wa-chat.open { transform: none; visibility: visible; }
  .wa-msg { max-width: 86%; }
  .back { display: block; background: none; border: 0; padding: 6px; margin-left: -6px; cursor: pointer; color: var(--text); }
  .funil { grid-template-columns: repeat(5, 78vw); scroll-snap-type: x mandatory; }
  .funil-col { scroll-snap-align: start; }
  .wa-head { padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
}
