/* =====================================================================
   YAS · sistema visual (redesign v20)
   Vale para todas as telas: Conversas, Funil, Agenda, Equipe/Loja ao vivo, Jornada e Automações.
   Cores: vinho YAS (#7D1D47) no Conversas; verde (#0B5D50) no YAS Vendas. Fonte Inter (servida pelo próprio sistema).
   Espaçamentos 4 · 8 · 12 · 16 · 20 · 24 · 32. Raio 10–12px. Toque mínimo 44px no celular.
   ===================================================================== */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fontes/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fontes/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --acento: #7D1D47; --acento-forte: #64163A; --acento-suave: #F6E9EF;
  --fundo: #F7F6F7; --painel: #FFFFFF; --painel-2: #FAF8F9; --borda: #E7E2E4; --borda-forte: #DCD4D8; --linha: #F0ECEE;
  --texto: #1C1719; --texto-2: #3D2F35; --fraco: #5B5257; --mais-fraco: #6B6066;
  --ia: #4C2A9A; --ia-suave: #F3EEFC; --ia-borda: #DDD0F5; --ia-texto: #3B2670;
  --bom: #15803D; --bom-suave: #DCFCE7; --bom-texto: #166534;
  --atencao: #B45309; --atencao-suave: #FFF4E5; --atencao-borda: #F6D3A1; --atencao-texto: #7C3F00;
  --ruim: #B91C1C; --ruim-suave: #FEE2E2; --ruim-texto: #991B1B;
  --nota: #FFF8E6; --nota-borda: #F2DFA8; --nota-texto: #5C4508;
  --raio: 10px; --raio-g: 12px; --sombra: 0 1px 2px rgba(28, 23, 25, .06);
  --trilho: 84px;
  --fonte: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body.vendas { --acento: #0B5D50; --acento-forte: #084A40; --acento-suave: #E3F3EF; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--fonte); color: var(--texto); background: var(--fundo); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
img, video, canvas, svg { max-width: 100%; }
a { color: var(--acento); }
.oculto { display: none !important; }

/* ---------- botões e campos ---------- */
.bt, button.bt { min-height: 40px; padding: 0 14px; border: 1px solid var(--borda-forte); border-radius: 9px; background: var(--painel); color: var(--texto);
  font: 600 13px var(--fonte); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.bt:hover { background: var(--painel-2); }
.bt.primario, button.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.bt.primario:hover, button.primario:hover { background: var(--acento-forte); }
.bt.pequeno { min-height: 32px; padding: 0 10px; font-size: 12px; }
.bt:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.campo, input.campo, select.campo { height: 40px; padding: 0 12px; border: 1px solid var(--borda-forte); border-radius: var(--raio); background: var(--painel); font-size: 14px; }
input[type=search].campo { background: var(--painel-2); }

/* segmentado (abas compactas) */
.segmentos { display: flex; gap: 4px; padding: 3px; background: #F3EFF1; border-radius: var(--raio); }
.segmentos button { flex: 1 1 0; min-height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--fraco); font: 600 13px var(--fonte); cursor: pointer; padding: 0 8px; white-space: nowrap; }
.segmentos button.sel, .segmentos button[aria-selected=true] { background: var(--painel); color: var(--texto); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* abas sublinhadas */
.abas-linha { display: flex; gap: 24px; border-bottom: 1px solid var(--borda); overflow-x: auto; scrollbar-width: none; }
.abas-linha button { border: 0; background: none; padding: 10px 0; margin-bottom: -1px; font: 500 15px var(--fonte); color: var(--fraco); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.abas-linha button.sel, .abas-linha button.ativo { color: var(--acento); border-bottom-color: var(--acento); font-weight: 600; }

/* pílulas */
.pilula { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #F3EFF1; color: var(--texto-2); }
.pilula.bom { background: var(--bom-suave); color: var(--bom-texto); } .pilula.atencao { background: var(--atencao-suave); color: var(--atencao-texto); }
.pilula.ruim { background: var(--ruim-suave); color: var(--ruim-texto); } .pilula.ia { background: var(--ia-suave); color: var(--ia-texto); }
.pilula.acento { background: var(--acento-suave); color: var(--acento); }
.ponto { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex-shrink: 0; background: #C9C1C5; }
.ponto.on { background: var(--bom); }
.avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 999px; background: #EDE7EA; color: var(--texto-2); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.avatar.p { width: 28px; height: 28px; font-size: 11px; }
.avatar.g { width: 48px; height: 48px; font-size: 15px; }

/* cartões e KPIs */
.cartao { background: var(--painel); border: 1px solid var(--borda); border-radius: var(--raio-g); padding: 16px 20px; }
.cartao h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.cartao .sub, .sub { color: var(--fraco); font-size: 13px; margin: 0 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi { background: var(--painel); border: 1px solid var(--borda); border-radius: var(--raio-g); padding: 16px 20px; min-width: 0; }
.kpi > span:first-child { display: block; color: var(--fraco); font-size: 14px; }
.kpi b { display: block; font-size: 28px; font-weight: 700; line-height: 1.25; margin: 4px 0 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { display: block; color: var(--fraco); font-size: 13px; }
.kpi.bom b { color: var(--bom); } .kpi.atencao { background: #FFFBEB; border-color: #F2DFA8; } .kpi.ruim { background: #FEF2F2; border-color: #FCA5A5; }
.kpi small.atencao { color: var(--atencao); font-weight: 600; } .kpi small.ruim { color: var(--ruim); font-weight: 600; }

/* página com trilho (telas fora do Conversas) */
.pagina { min-height: 100vh; padding-left: var(--trilho); }
.pagina > main { max-width: 1320px; margin: 0 auto; padding: 28px 32px 48px; display: grid; gap: 20px; }
.cabeca-pagina { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cabeca-pagina h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.cabeca-pagina .dir { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vazio-bonito { border: 2px dashed var(--borda-forte); border-radius: var(--raio-g); padding: 40px 24px; text-align: center; background: var(--painel); }
.vazio-bonito h3 { margin: 0 0 6px; font-size: 18px; }
.vazio-bonito p { margin: 0 auto 16px; max-width: 520px; color: var(--fraco); }

/* tabelas */
table.tab { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tab th { text-align: left; font-size: 13px; font-weight: 600; color: var(--fraco); padding: 8px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
table.tab td { padding: 10px 8px; border-bottom: 1px solid var(--linha); vertical-align: middle; }
table.tab .n { text-align: right; font-variant-numeric: tabular-nums; }

/* =====================================================================
   TRILHO (menu principal à esquerda; no celular vira barra embaixo)
   ===================================================================== */
.trilho { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--trilho); background: var(--painel); border-right: 1px solid var(--borda);
  padding: 16px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; overflow-y: auto; scrollbar-width: none; }
.trilho .logo { width: 40px; height: 40px; border-radius: 10px; background: var(--acento); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; flex-shrink: 0; text-decoration: none; }
.trilho .nav { width: 68px; min-height: 56px; border-radius: 10px; border: 0; background: transparent; color: var(--fraco); font: 500 11px/1.2 var(--fonte); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; cursor: pointer; padding: 6px 2px; flex-shrink: 0; position: relative; }
.trilho .nav:hover { background: var(--painel-2); color: var(--texto); }
.trilho .nav.ativo { background: var(--acento-suave); color: var(--acento); font-weight: 600; }
.trilho .nav svg { width: 20px; height: 20px; }
.trilho .nav .bolinha { position: absolute; top: 6px; right: 14px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--acento); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; }
.trilho .espaco { flex: 1 1 auto; min-height: 12px; }
.trilho .perfil .avatar { width: 36px; height: 36px; font-size: 12px; }
.trilho .perfil span:last-child { font-size: 10px; font-weight: 600; }
.trilho .so-cel { display: none; }
.menu-perfil { position: fixed; z-index: 40; left: calc(var(--trilho) + 8px); bottom: 12px; width: 260px; background: var(--painel); border: 1px solid var(--borda); border-radius: var(--raio-g);
  box-shadow: 0 12px 32px rgba(28,23,25,.16); padding: 12px; display: grid; gap: 8px; }
.menu-perfil .quem b { display: block; font-size: 14px; } .menu-perfil .quem span { color: var(--fraco); font-size: 12px; overflow-wrap: anywhere; }
.menu-perfil .bt { width: 100%; justify-content: flex-start; }

@media (max-width: 760px) {
  :root { --trilho: 0px; }
  .trilho { top: auto; right: 0; bottom: 0; width: auto; height: calc(64px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; padding: 4px 8px env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--borda); overflow: visible; }
  .trilho .logo, .trilho .espaco, .trilho .perfil, .trilho .nav:not(.cel) { display: none; }
  .trilho .nav { flex: 1 1 0; width: auto; min-height: 56px; font-size: 12px; }
  .trilho .so-cel { display: flex; }
  /* "Mais": abre todas as opções numa folha por cima */
  .trilho.expandido { top: auto; height: auto; max-height: 80dvh; flex-wrap: wrap; justify-content: flex-start; align-content: flex-start; gap: 8px; padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.18); overflow-y: auto; }
  .trilho.expandido .nav, .trilho.expandido .perfil { display: flex; flex: 0 0 calc(25% - 6px); }
  .trilho.expandido .espaco { display: block; flex-basis: 100%; min-height: 0; }
  .menu-perfil { left: 12px; right: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .pagina { padding-left: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .pagina > main { padding: 16px 16px 24px; gap: 16px; }
  .cabeca-pagina h1 { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi b { font-size: 22px; }
}
@media (pointer: coarse) {
  .bt, button.bt { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; }
}
