/* WhatsApp · Nei Madeireira (prefixo wa-). Base: WhatsApp do Seu Lóza (css/whatsapp-extra.css), adaptado.
   Só tokens de css/tokens.css; o tema claro troca os tokens sozinho. */

/* ---------- Cabeçalho compacto ---------- */
.page-head.wa-head { display: grid; gap: 10px; justify-content: stretch; align-items: stretch; margin-bottom: 12px; }
.wa-head__top { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; min-width: 0; }
.wa-head__top h1 { font-size: 30px; line-height: 1.05; margin: 0; }
.wa-head .wa-head__eb { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; min-width: 0; flex: 0 1 auto; font-size: var(--fs-2xs); }
.wa-head__eb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wa-head .wa-head__eb svg { flex: none; width: 13px; height: 13px; color: var(--wa); }
.wa-head .wa-kpis { gap: 6px; align-items: center; }
.wa-head .wa-kpis > div { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: var(--r-pill); background: var(--s1); border: 1px solid var(--line-2); white-space: nowrap; }
.wa-head .wa-kpis small { font-size: var(--fs-2xs); color: var(--tx-3); }
.wa-head .wa-kpis b { font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.wa-head .wa-kpis b.warn-tx { color: var(--warn); }
.wa-tx-wa { color: var(--wa); }
.wa-kpis__eq span { display: flex; gap: 8px; align-items: center; }
.wa-kpis__eq i { display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-weight: 600; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.wa-kpis__eq .wa-dono { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }
.wa-nums { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-width: 0; }
.wa-nums .segmented button { display: inline-flex; align-items: center; gap: 6px; }
.wa-nums .segmented svg { width: 13px; height: 13px; }
.wa-nums .segmented em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--tx-4); font-variant-numeric: tabular-nums; }
.wa-nums .segmented button.on em { color: var(--tx-3); }
.wa-nums__eu { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--tx-3); }
.wa-nums__eu svg { width: 13px; height: 13px; }
.wa-nums__eu b { color: var(--tx); font-weight: 600; }
.wa-nums__eu .wa-dono { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }

/* selo do número da conversa */
.wa-num { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font-size: 10px; font-weight: 500; white-space: nowrap; vertical-align: 1px; }
.wa-num svg { width: 11px; height: 11px; flex: none; }
.wa-num.com { background: var(--wa-soft); color: var(--wa); }
.wa-num.ent { background: var(--gold-soft); color: var(--gold-tx); }

/* ---------- Tela inteira sem rolagem da página: só lista, mensagens e painel rolam ---------- */
.page:has(> .wa-app) { height: 100%; display: flex; flex-direction: column; padding-top: 18px; padding-bottom: 18px; }
.page:has(> .wa-app) > .wa-head { flex: none; }
.page:has(> .wa-app) > .wa-app { flex: 1 1 auto; height: auto; min-height: 420px; grid-template-rows: minmax(0, 1fr); }

/* três colunas: lista · conversa · painel */
.wa-app { position: relative; grid-template-columns: 316px minmax(0, 1fr) 304px; }
.wa-app .wa__ctx { display: grid; overflow-x: hidden; }
.wa-ficha-btn { display: none; flex: none; gap: 6px; }
.wa-ficha-btn svg { width: 15px; height: 15px; }
.wa-ctx__bar { display: none; }

/* ---------- Lista ---------- */
.wa__list { min-width: 0; }
.wa-f { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
.wa-f button { height: 27px; padding: 0 9px; font-size: 11px; gap: 5px; }
.wa-f button em { font-style: normal; font-size: 10px; color: var(--tx-4); font-variant-numeric: tabular-nums; }
.wa-f button.on em { color: inherit; opacity: .8; }
.wa-f .badge { height: 16px; min-width: 16px; padding: 0 5px; font-size: 10px; }
.wa-f .wa-dono.sm { width: 16px; height: 16px; font-size: 7px; box-shadow: none; margin-left: -4px; }
.wa-lbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 8px; border-bottom: 1px solid var(--line); }
.wa-lbar small { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-2xs); color: var(--tx-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wa-lbar svg { width: 12px; height: 12px; }
.wa__convs .empty { padding: 32px 18px; line-height: 1.6; font-size: var(--fs-xs); }
.wa-vazio { margin: 6px auto 0; display: inline-flex; }
.conv__emp { display: flex; min-width: 0; }
.conv__emp > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__bot .wa-pv { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; color: var(--tx-3); }
.conv__tags { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 5px; min-width: 0; }
.conv__tags .conv__tag { margin-top: 0; height: 20px; gap: 4px; padding: 0 8px; }
.conv__tags .conv__tag svg { width: 11px; height: 11px; }
.conv__tags .conv__dono { margin-left: auto; }
.wa-semmsg { font-style: normal; color: var(--tx-4); }
.wa-av-novo { background: var(--s4); color: var(--tx-2); }
.wa-av-novo svg { width: 16px; height: 16px; }
.avatar.lg.wa-av-novo svg { width: 22px; height: 22px; }

/* avatar pequeno do responsável */
.wa-dono { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 8.5px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--s1); }
.wa-dono.md { width: 28px; height: 28px; font-size: 10.5px; }
/* selo de ação na lista */
.wa-fupselo { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font-size: 10px; font-weight: 600; white-space: nowrap; color: var(--warn); background: var(--warn-soft); }
.wa-fupselo svg { width: 11px; height: 11px; }
.wa-fupselo.atrasado { color: var(--crit); background: var(--crit-soft); }

/* ---------- Conversa ---------- */
.chat__head { min-width: 0; }
.chat__head .chat__who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__acts { align-items: center; gap: 4px; }
.wa-meta { display: flex; align-items: center; gap: 6px 16px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--s1); font-size: var(--fs-2xs); color: var(--tx-3); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.wa-meta::-webkit-scrollbar { display: none; }
.wa-meta > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.wa-meta > span + span { padding-left: 16px; border-left: 1px solid var(--line-2); }
.wa-meta > span > svg { width: 13px; height: 13px; }
.wa-meta b { color: var(--tx); font-weight: 500; font-size: var(--fs-xs); }
.wa-meta .wa-dono { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }
.wa-nochat { margin: auto; display: grid; justify-items: center; gap: 6px; max-width: 320px; padding: 26px 22px; text-align: center; border-radius: var(--r-lg); background: var(--s1); border: 1px dashed var(--line-2); }
.wa__chat > .wa-nochat { align-self: center; }
.wa-nochat svg { width: 24px; height: 24px; color: var(--wa); }
.wa-nochat b { font-size: var(--fs-sm); font-weight: 600; }
.wa-nochat small { font-size: var(--fs-2xs); color: var(--tx-3); line-height: 1.5; }
.wa__chat .sys { max-width: min(92%, 520px); border-radius: var(--r-md); line-height: 1.4; }

/* imagem: placeholder desenhado, sem arquivo externo */
.wa-img { position: relative; width: min(300px, 62vw); aspect-ratio: 5 / 3; background: var(--s2); border: 1px solid var(--line); }
.wa-ph { display: block; width: 100%; height: 100%; }
.wa-ph__papel { fill: var(--s1); }
.wa-ph__grade { stroke: var(--line); stroke-width: 1; }
.wa-ph__linha { fill: none; stroke: var(--info); stroke-width: 2; }
.wa-ph__linha.dk { stroke: var(--gold); }
.wa-ph__viga { stroke: var(--wood); stroke-width: 3; stroke-linecap: round; opacity: .8; }
.wa-ph__deck { stroke: var(--gold-line); stroke-width: 2; }
.wa-ph__agua { fill: var(--info-soft); stroke: var(--info); stroke-width: 1; stroke-dasharray: 3 3; }
.wa-ph__t { font: 500 9px var(--mono); fill: var(--tx-3); text-anchor: middle; }
.wa-ph__t.b { font: 600 8.5px var(--font); letter-spacing: .12em; fill: var(--tx-2); }
.wa-ph__s1 { stop-color: var(--s3); }
.wa-ph__s2 { stop-color: var(--s1); }
.wa-ph__sol { fill: var(--gold); opacity: .4; }
.wa-ph__parede { fill: var(--s4); }
.wa-ph__janela { fill: var(--s2); stroke: var(--line-3); }
.wa-ph__chao { fill: var(--s4); opacity: .7; }
.wa-ph__sombra { fill: var(--line-2); }
.wa-ph__madeira { fill: var(--wood); }
.wa-ph__madeira.dk { opacity: .75; }
.wa-ph__mesa { fill: none; stroke: var(--tx-4); stroke-width: 2; stroke-linecap: round; }
.wa-ph__topo { fill: var(--wood); stroke: var(--line-3); }
.wa-ph__anel { fill: none; stroke: var(--gold-line); stroke-width: 1.2; }
.wa-img__cap { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--s1); border: 1px solid var(--line-2); font-size: 10.5px; color: var(--tx-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-img__cap svg { width: 12px; height: 12px; flex: none; }
.msg.wa-m-img { padding-top: 6px; }

/* áudio: player desenhado */
.msg.wa-m-audio { min-width: 0; }
.wa-aud { display: flex; align-items: center; gap: 10px; padding: 2px 0 0; }
.wa-aud__play { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--s4); color: var(--tx); transition: transform var(--t-fast) var(--ease); }
.wa-aud__play:hover { transform: scale(1.06); }
.wa-aud__play svg { width: 15px; height: 15px; fill: currentColor; }
.wa-aud__i2 { display: none; }
.wa-aud.on:not(.pausa) .wa-aud__i1 { display: none; }
.wa-aud.on:not(.pausa) .wa-aud__i2 { display: block; }
.wa-aud__w { display: grid; gap: 3px; min-width: 0; }
.wa-aud__w small { font-size: 10.5px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.wa-aud__wave { position: relative; width: 150px; height: 24px; }
.wa-aud__base, .wa-aud__fill > span { position: absolute; left: 0; top: 0; width: 150px; height: 24px; display: flex; align-items: center; justify-content: space-between; }
.wa-aud__wave i { width: 2.5px; border-radius: 2px; background: var(--line-3); }
.wa-aud__fill { position: absolute; left: 0; top: 0; height: 24px; width: 0; overflow: hidden; }
.wa-aud__fill i { background: var(--tick); }
.wa-aud.on .wa-aud__fill { animation: wa-aud var(--dur, 30s) linear forwards; }
.wa-aud.pausa .wa-aud__fill { animation-play-state: paused; }
@keyframes wa-aud { from { width: 0; } to { width: 150px; } }
.wa-aud__av { position: relative; flex: none; }
.wa-aud__mic { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--wa); color: var(--bg); box-shadow: 0 0 0 2px var(--s3); }
.wa-aud__mic svg { width: 9px; height: 9px; }

/* ações rápidas acima do campo */
.wa-qa { padding-top: 10px; scrollbar-width: none; }
.wa-qa::-webkit-scrollbar { display: none; }
.wa-qa .quick__b { display: inline-flex; align-items: center; gap: 6px; }
.wa-qa .quick__b svg { width: 13px; height: 13px; color: var(--tx-3); flex: none; }
.wa-qa .quick__b:hover svg { color: var(--red-tx); }
.wa-qa__rr { margin-left: auto; border-style: dashed; }

/* campo: anexo, respostas rápidas e menu do clipe */
.wa-cmp { position: relative; }
.wa-cmp .composer { align-items: flex-end; }
.wa-cmp .composer textarea { min-width: 0; }
.composer.wa-flash textarea { animation: wa-flash 1s var(--ease); }
@keyframes wa-flash { 0% { box-shadow: 0 0 0 0 var(--red-line); } 40% { box-shadow: 0 0 0 4px var(--red-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
.wa-clip { position: relative; flex: none; }
.wa-clip__menu { position: absolute; z-index: 20; left: 0; bottom: calc(100% + 8px); width: 260px; display: grid; padding: 4px; border-radius: var(--r-md); background: var(--s2); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); animation: rise .25s var(--ease) both; }
.wa-clip__menu[hidden] { display: none; }
.wa-clip__menu button { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); text-align: left; }
.wa-clip__menu button:hover { background: var(--s3); }
.wa-clip__menu button > svg { width: 30px; height: 30px; padding: 7px; border-radius: 9px; background: var(--s4); color: var(--tx-2); }
.wa-clip__menu button:nth-child(1) > svg { background: var(--info-soft); color: var(--info); }
.wa-clip__menu button:nth-child(2) > svg { background: var(--gold-soft); color: var(--gold-tx); }
.wa-clip__menu button:nth-child(3) > svg { background: var(--red-soft); color: var(--red-tx); }
.wa-clip__menu span { display: grid; min-width: 0; }
.wa-clip__menu b { font-size: var(--fs-xs); font-weight: 600; }
.wa-clip__menu small { font-size: 10.5px; color: var(--tx-3); }
.wa-anexo { display: flex; align-items: center; gap: 10px; margin: 10px 14px 0; padding: 8px 8px 8px 10px; border-radius: var(--r-md); background: var(--s2); border: 1px solid var(--line-2); box-shadow: inset 3px 0 0 var(--wa); animation: rise .3s var(--ease) both; }
.wa-anexo[hidden] { display: none; }
.wa-anexo .att-pdf__ic { width: 30px; height: 36px; font-size: 9px; }
.wa-anexo__ic { width: 30px; height: 36px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.wa-anexo__ic.img { background: var(--info-soft); color: var(--info); }
.wa-anexo__ic svg { width: 16px; height: 16px; }
.wa-anexo > div { flex: 1; min-width: 0; display: grid; }
.wa-anexo b { font-size: var(--fs-xs); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-anexo small { font-size: 10.5px; color: var(--tx-3); }
.wa-anexo .icon-btn { width: 30px; height: 30px; flex: none; }
.wa-anexo .icon-btn svg { width: 15px; height: 15px; }
.wa-rr { position: absolute; z-index: 20; left: 14px; right: 14px; bottom: calc(100% - 4px); max-height: 280px; overflow-y: auto; display: grid; gap: 2px; padding: 4px; border-radius: var(--r-md); background: var(--s2); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); animation: rise .2s var(--ease) both; }
.wa-rr[hidden] { display: none; }
.wa-rr__h { display: flex; align-items: center; gap: 6px; padding: 6px 8px 4px; font-size: 10.5px; font-weight: 600; color: var(--tx-2); text-transform: uppercase; letter-spacing: .06em; }
.wa-rr__h svg { width: 12px; height: 12px; color: var(--gold-tx); }
.wa-rr__h small { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--tx-4); }
.wa-rr button { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: var(--r-sm); text-align: left; }
.wa-rr button b { font-size: var(--fs-xs); font-weight: 500; color: var(--red-tx); }
.wa-rr button span { font-size: var(--fs-xs); color: var(--tx-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-rr button:hover, .wa-rr button.on { background: var(--s3); }
.wa-rr button.on { box-shadow: inset 2px 0 0 var(--red); }
.wa-rr__vazio { padding: 12px; font-size: var(--fs-xs); color: var(--tx-3); }

/* ---------- Painel lateral ---------- */
.wa__ctx .ctx__card, .wa__ctx .ctx__card > * { min-width: 0; }
.wa__ctx .ctx__title { flex-wrap: wrap; row-gap: 2px; }
.wa__ctx .ctx__title small { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: var(--fs-2xs); white-space: nowrap; }
.wa__ctx .ctx__deal { align-items: baseline; flex-wrap: wrap; }
.wa__ctx .ctx__deal b { font-size: var(--fs-lg); }
.wa__ctx .ctx__deal span { font-size: var(--fs-2xs); }
.wa__ctx .input, .wa__ctx .select { height: 34px; font-size: var(--fs-xs); width: 100%; min-width: 0; }
.wa__ctx input[type="date"] { padding-right: 6px; }
.wa__ctx .kv.tight > div { grid-template-columns: 84px minmax(0, 1fr); align-items: baseline; }
.wa__ctx .kv b small { font-weight: 400; }
.wa-kv-s { font-size: 10.5px; color: var(--tx-3); }
.wa-kv-who { display: inline-flex; align-items: center; gap: 6px; }
.wa-kv-who .wa-dono { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }
.wa-link { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-2xs); color: var(--red-tx); text-transform: none; letter-spacing: 0; }
.wa-link svg { width: 12px; height: 12px; }
.wa-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.wa-p { font-size: 12px; margin: 0; line-height: 1.45; }
.wa-full { width: 100%; justify-content: center; }
.wa-hint { display: block; margin: 0; font-size: 10.5px; line-height: 1.45; }
.wa-hint svg { display: inline; width: 12px; height: 12px; vertical-align: -2px; margin-right: 4px; }
.wa-err { border-color: var(--crit) !important; box-shadow: 0 0 0 3px var(--crit-soft) !important; }
/* abas */
.wa-tabs { position: sticky; top: -14px; z-index: 3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 4px; border-radius: var(--r-md); background: var(--s1); border: 1px solid var(--line-2); box-shadow: 0 -14px 0 0 var(--bg-2); }
.wa-tabs button { position: relative; display: grid; justify-items: center; gap: 3px; padding: 7px 2px 6px; border-radius: var(--r-sm); font-size: 10.5px; color: var(--tx-3); transition: all var(--t-fast); }
.wa-tabs button svg { width: 15px; height: 15px; }
.wa-tabs button:hover { color: var(--tx); background: var(--s3); }
.wa-tabs button.on { color: var(--tx); background: var(--red-soft); box-shadow: inset 0 -2px 0 var(--red); }
.wa-tabs button em { position: absolute; top: 3px; right: 6px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--r-pill); font-style: normal; font-size: 9px; font-weight: 600; display: grid; place-items: center; background: var(--s4); color: var(--tx-2); }
.wa-tabbody { display: grid; gap: 10px; animation: rise .3s var(--ease) both; min-width: 0; }
/* aba Cliente */
.wa-cli__pills, .wa-cli__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wa-cli__pills .pill { height: 22px; font-size: 10.5px; }
.wa-cli__tags .pill { height: 20px; font-size: 10px; background: transparent; border: 1px dashed var(--line-3); }
.ctx__who > div { min-width: 0; }
.ctx__who b { overflow-wrap: anywhere; }
.wa-atalhos { display: grid; gap: 2px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.wa-atalhos a, .wa-atalhos button { display: grid; grid-template-columns: 16px minmax(0, 1fr) 14px; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); color: var(--tx-2); text-align: left; transition: all var(--t-fast); }
.wa-atalhos a:hover, .wa-atalhos button:hover { background: var(--s3); color: var(--tx); }
.wa-atalhos svg { width: 15px; height: 15px; color: var(--tx-3); }
.wa-atalhos svg:last-child { width: 13px; height: 13px; color: var(--red-tx); }
.wa-atalhos span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* aba Venda: etapas */
.wa-etapas { display: grid; gap: 4px; }
.wa-etapas button { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); text-align: left; font-size: var(--fs-xs); color: var(--tx-2); transition: all var(--t-fast); }
.wa-etapas button i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c); }
.wa-etapas button.done i { background: color-mix(in srgb, var(--c) 55%, transparent); }
.wa-etapas button.now { border-color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--tx); font-weight: 600; }
.wa-etapas button.now i { background: var(--c); box-shadow: 0 0 8px var(--c); }
.wa-etapas button small { font-size: 9.5px; font-weight: 400; color: var(--tx-3); }
.wa-etapas button:hover:not(.now) { border-color: var(--line-3); color: var(--tx); }
/* próxima ação */
.wa-fq { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 600; white-space: nowrap; color: var(--tx-2); background: var(--s3); font-variant-numeric: tabular-nums; justify-self: start; }
.wa-fq svg { width: 12px; height: 12px; flex: none; }
.wa-fq.hoje { color: var(--warn); background: var(--warn-soft); }
.wa-fq.atrasado { color: var(--crit); background: var(--crit-soft); }
.wa-prox { display: grid; gap: 6px; padding: 10px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--line-3); }
.wa-prox.hoje { box-shadow: inset 3px 0 0 var(--warn); }
.wa-prox.atrasado { box-shadow: inset 3px 0 0 var(--crit); }
.wa-prox p { margin: 0; font-size: var(--fs-xs); line-height: 1.45; color: var(--tx); }
.wa-prox__acts { display: flex; gap: 6px; flex-wrap: wrap; }
.wa-prox__acts .btn { height: 28px; font-size: 11.5px; }
.wa-prox__acts .btn svg { width: 14px; height: 14px; }
.wa-form { display: grid; gap: 8px; }
.wa-form label { display: grid; gap: 4px; font-size: var(--fs-2xs); color: var(--tx-3); min-width: 0; }
.wa-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.wa-chips button { height: 24px; padding: 0 9px; border-radius: var(--r-pill); font-size: 10.5px; color: var(--tx-3); border: 1px dashed var(--line-3); }
.wa-chips button:hover { color: var(--tx); border-style: solid; }
/* responsável */
.wa-vends { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.wa-vends button { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px 7px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); font-size: 11px; color: var(--tx-2); transition: all var(--t-fast); }
.wa-vends button .wa-dono { box-shadow: none; }
.wa-vends button > svg { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; color: var(--red-tx); }
.wa-vends button:hover { border-color: var(--line-3); color: var(--tx); }
.wa-vends button.on { border-color: var(--red-line); background: var(--red-soft); color: var(--tx); font-weight: 600; }
/* etiquetas */
.wa-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wa-tags button { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--r-pill); font-size: 10.5px; color: var(--tx-3); border: 1px dashed var(--line-3); transition: all var(--t-fast); }
.wa-tags button svg { width: 11px; height: 11px; }
.wa-tags button.on { border-style: solid; border-color: var(--line-3); background: var(--s4); color: var(--tx); }
.wa-tags button.on:hover svg { color: var(--crit); }
.wa-tags button:not(.on):hover { color: var(--tx); border-style: solid; }
.wa-tags--sug { padding-top: 8px; border-top: 1px dashed var(--line); }
.wa-newtag { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.wa-newtag .btn { height: 34px; }
/* aba Pedidos */
.wa-it { border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; }
.wa-it + .wa-it { margin-top: -4px; }
.wa-it__h { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 14px; grid-template-rows: auto auto; row-gap: 5px; column-gap: 8px; align-items: center; padding: 9px 10px; text-align: left; font-size: var(--fs-xs); }
.wa-it__h > :nth-child(1) { grid-column: 1; grid-row: 1; white-space: nowrap; font-weight: 600; }
.wa-it__h > .pill { grid-column: 1 / -1; grid-row: 2; justify-self: start; height: 20px; font-size: 10px; }
.wa-it__h > b { grid-column: 2; grid-row: 1; white-space: nowrap; font-size: var(--fs-xs); }
.wa-it__h > svg:last-child { grid-column: 3; grid-row: 1; width: 14px; height: 14px; color: var(--tx-3); transition: transform var(--t-fast); }
.wa-it.open .wa-it__h > svg:last-child { transform: rotate(180deg); }
.wa-it__h:hover { background: var(--s3); }
.wa-it__b { display: none; gap: 8px; padding: 0 10px 10px; }
.wa-it.open .wa-it__b { display: grid; }
.wa-it__obra { margin: 0; font-size: var(--fs-xs); color: var(--tx-2); line-height: 1.4; }
.wa-orc__kv { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-2xs); color: var(--tx-3); }
.wa-orc__kv span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.wa-orc__kv svg { width: 12px; height: 12px; }
.wa-orc__act { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-orc__act .btn { flex: 1 1 auto; justify-content: center; height: 30px; font-size: 11.5px; padding: 0 10px; }
.wa-orc__act .btn svg { width: 14px; height: 14px; }
/* roteiro da OS: onde a madeira está */
.wa-rota { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.wa-rota li { position: relative; display: grid; justify-items: center; gap: 4px; min-width: 0; }
.wa-rota li::before { content: ""; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--s4); z-index: 0; }
.wa-rota li:first-child::before { display: none; }
.wa-rota li.done::before, .wa-rota li.now::before, .wa-rota li.stop::before { background: var(--ok); }
.wa-rota li > span { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--s3); border: 1px solid var(--line-2); color: var(--tx-4); }
.wa-rota li > span svg { width: 12px; height: 12px; }
.wa-rota li.done > span { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.wa-rota li.now > span { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-tx); box-shadow: 0 0 0 3px var(--gold-soft); animation: wa-pulse 2s var(--ease) infinite; }
.wa-rota li.stop > span { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }
.wa-rota li small { font-size: 9.5px; color: var(--tx-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wa-rota li.now small, .wa-rota li.stop small { color: var(--tx); font-weight: 600; }
@keyframes wa-pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.wa-onde { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--gold-soft); border: 1px solid var(--gold-line); }
.wa-onde > svg { width: 16px; height: 16px; flex: none; color: var(--gold-tx); }
.wa-onde span { display: grid; min-width: 0; }
.wa-onde small { font-size: 10px; color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em; }
.wa-onde b { font-size: var(--fs-xs); font-weight: 600; line-height: 1.35; }
.wa-onde.crit { background: var(--crit-soft); border-color: var(--crit); }
.wa-onde.crit > svg { color: var(--crit); }

/* ---------- Modal Cadastrar cliente ---------- */
.modal.wa-cadm { width: min(600px, calc(100vw - 32px)); }
.wa-cad__ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--red-soft); color: var(--red-tx); flex: none; }
.wa-cad__ic svg { width: 18px; height: 18px; }
.wa-cad { display: grid; gap: 14px; }
.wa-cad__tipo .segmented button { display: inline-flex; align-items: center; gap: 6px; }
.wa-cad__tipo .segmented svg { width: 14px; height: 14px; }
.wa-cad__g { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wa-cad__f { display: grid; min-width: 0; }
.wa-cad__f.wide { grid-column: 1 / -1; }
.wa-cad__f .lbl { margin-bottom: 4px; }
.wa-cad__f .input, .wa-cad__f .select { width: 100%; min-width: 0; }

/* ---------- Telas médias: a ficha vira painel deslizante sobre a conversa ---------- */
@media (max-width: 1399px) {
  .wa-app { grid-template-columns: 300px minmax(0, 1fr); }
  .wa-app .wa__ctx { position: absolute; top: 0; right: 0; bottom: 0; z-index: 8; width: min(340px, 100%); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-2); transform: translateX(105%); visibility: hidden; transition: transform var(--t-med) var(--ease), visibility 0s linear var(--t-med); }
  .wa-app.ctx-open .wa__ctx { transform: none; visibility: visible; transition: transform var(--t-med) var(--ease), visibility 0s; }
  .wa-ficha-btn { display: inline-flex; }
  .wa-ctx__bar { position: sticky; top: -14px; z-index: 4; display: flex; align-items: center; gap: 8px; height: 56px; margin: -14px -14px 0; padding: 14px 8px 8px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
  .wa-ctx__bar > span { flex: 1; min-width: 0; display: grid; }
  .wa-ctx__bar b { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wa-ctx__bar small { font-size: var(--fs-2xs); color: var(--tx-3); }
  .wa-ctx__bar .icon-btn { width: 34px; height: 34px; flex: none; }
  .wa-ctx__bar .icon-btn:first-child { display: none; }
  .wa-tabs { top: 42px; box-shadow: 0 -12px 0 0 var(--bg-2); }
}
@media (min-width: 1101px) and (max-width: 1399px) {
  .wa-head__top { flex-wrap: wrap; }
}
@media (min-width: 1400px) {
  .wa-head__top { flex-wrap: nowrap; }
  .wa-head__top h1, .wa-head .wa-kpis { flex: none; }
  .wa-head .wa-kpis { flex-wrap: nowrap; }
}

/* ---------- Celular: uma coluna por vez (lista → conversa → ficha) ---------- */
@media (max-width: 760px) {
  .page:has(> .wa-app) { padding-top: 12px; padding-bottom: 12px; }
  .page:has(> .wa-app.chat-open) > .wa-head { display: none; }
  .page:has(> .wa-app) > .wa-app { min-height: 0; }
  .wa-head__top h1 { font-size: 24px; }
  .wa-head .wa-head__eb { display: none; }
  .wa-nums { gap: 8px; }
  .wa-nums .segmented { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wa-nums .segmented button { justify-content: center; padding: 0 6px; }
  .wa-nums__eu { display: none; }
  .wa-app { grid-template-columns: minmax(0, 1fr); border-radius: var(--r-lg); }
  .wa-app .wa__ctx { width: 100%; border-left: 0; }
  .wa-ctx__bar .icon-btn:first-child { display: grid; }
  .wa-ctx__bar .icon-btn:last-child { display: none; }
  .wa-ficha-btn { width: 38px; padding: 0; justify-content: center; }
  .wa-ficha-btn span { display: none; }
  .chat__head { gap: 8px; padding: 8px 10px; }
  .chat__acts .icon-btn { width: 34px; height: 34px; }
  .wa-meta { padding: 6px 12px; gap: 6px 12px; }
  .wa-meta > span + span { padding-left: 12px; }
  .wa-meta small { display: none; }
  .chat__body { padding: 14px 12px; }
  .msg { max-width: 88%; }
  .wa-img { width: min(260px, 64vw); }
  .wa-aud__wave, .wa-aud__base, .wa-aud__fill > span { width: 120px; }
  @keyframes wa-aud { from { width: 0; } to { width: 120px; } }
  .wa-qa { padding: 8px 10px 0; }
  .wa-qa__rr { margin-left: 0; }
  .wa-cmp .composer { padding: 8px 10px 10px; gap: 6px; }
  .wa-rr { left: 8px; right: 8px; }
  .wa-rr button { grid-template-columns: 1fr; gap: 2px; }
  .wa-anexo { margin: 8px 10px 0; }
  .wa-cad__g { grid-template-columns: 1fr; }
}

/* nome longo da conversa no topo não pode alargar a tela (no celular).
   Correção geral sugerida para app.css: .main { grid-template-columns: minmax(0, 1fr); } e .crumbs b { min-width: 0; } */
.app:has(.wa-app) .main { grid-template-columns: minmax(0, 1fr); }
.app:has(.wa-app) .crumbs b { min-width: 0; }
/* nome do PDF numa linha só (não quebra no hífen do número do orçamento) */
.wa__chat .att-pdf > div { min-width: 0; }
.wa__chat .att-pdf b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }

/* Levantamento da obra na coluna estreita: rótulo em cima, valor embaixo; formulário em uma coluna */
.ctx__card .lv-dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
.ctx__card .lv-dl dt { margin-top: 10px; font-size: var(--fs-2xs); }
.ctx__card .lv-dl dt:first-child { margin-top: 0; }
.ctx__card .lv-dl dd { font-size: var(--fs-sm); }
.ctx__card .lv-form { grid-template-columns: minmax(0, 1fr); }
.ctx__card .lv-vazio { grid-template-columns: minmax(0, 1fr); }
.ctx__card .lv-vazio > svg { display: none; }
.ctx__card .lv-vazio .btn { grid-column: 1; }
/* Etapa do funil na lista: mesma cor da etapa no funil, em tom discreto */
.pill.wa-etp { color: var(--tx-2); background: color-mix(in srgb, var(--c) 12%, transparent); border-color: color-mix(in srgb, var(--c) 35%, transparent); }
.pill.wa-etp svg { color: var(--c); }

/* Temperatura e dias na etapa (mesmos dados do funil) */
.wa-temp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 3px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--bg-2); margin-bottom: 8px; }
.wa-temp button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; border-radius: var(--r-pill); font-size: var(--fs-xs); color: var(--tx-3); transition: background var(--t-fast), color var(--t-fast); }
.wa-temp button svg { width: 13px; height: 13px; }
.wa-temp button.on { background: var(--s3); color: var(--tx); }
.wa-temp button.on.quente svg { color: var(--warn); }
.wa-temp button.on.frio svg { color: var(--info); }
.wa-dias { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: var(--fs-xs); color: var(--tx-3); }
.wa-dias svg { width: 13px; height: 13px; flex: none; }
.wa-dias.parada { color: var(--warn); }
.wa-cfg { margin-left: auto; flex: none; }
