/* Seção 5 · Relatórios e dados: o painel vivo. */
.relatorios { background: var(--carbono); color: var(--pedra); padding: clamp(72px, 10vw, 140px) 0; }
.relatorios .apoio { color: #c9c6bf; }

.dash { position: relative; margin-top: clamp(40px, 6vw, 64px); background: #1A1A19; border: 1px solid var(--linha-escura); border-radius: 18px; padding: 18px; overflow: hidden; }
.dash::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 85% 0%, rgba(232, 89, 12, .12), transparent 70%); pointer-events: none; }

.d-barra { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 4px 4px 18px; }
.d-marca { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.d-marca strong { font-size: 16px; font-weight: 600; }
.d-marca .etiqueta { color: var(--cinza-dado); font-size: 11px; }
.d-ponto { width: 9px; height: 9px; border-radius: 50%; background: var(--laranja); box-shadow: 0 0 0 0 rgba(232, 89, 12, .6); animation: vivo 2s ease-out infinite; }
@keyframes vivo { 70% { box-shadow: 0 0 0 9px rgba(232, 89, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(232, 89, 12, 0); } }
.d-periodos { display: flex; gap: 4px; background: var(--carbono); padding: 4px; border-radius: 10px; }
.d-periodos button { position: relative; overflow: hidden; font: 500 12px/1 var(--mono); padding: 10px 14px; border-radius: 7px; color: var(--cinza-dado); transition: background-color 200ms ease, color 200ms ease; }
.d-periodos button[aria-selected="true"] { background: var(--grafite); color: var(--pedra); }
.d-periodos button::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--laranja); transform: scaleX(0); transform-origin: left; }
.d-periodos button.contando::after { animation: contando 10s linear forwards; }
@keyframes contando { to { transform: scaleX(1); } }
.d-pedir {
  position: relative; display: inline-flex; align-items: center; gap: 10px; background: var(--laranja); color: var(--carbono);
  font: 700 15px/1 var(--texto); padding: 14px 18px; border-radius: 12px; transition: transform 160ms var(--ease-out), background-color 200ms ease;
  box-shadow: 0 8px 28px rgba(232, 89, 12, .35);
}
.d-pedir:hover { background: #ff6a1a; }
.d-pedir:active { transform: scale(.97); }
/* A chamada fica numa faixa própria no topo do painel, longe das notificações, e o botão
   pulsa devagar para chamar o clique. */
.d-chamada { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: var(--grafite); border-radius: 14px; padding: 14px 14px 14px 20px; margin-bottom: 14px; }
.d-chamada p { font-size: 16px; color: #c9c6bf; }
.d-chamada p b { font-weight: 700; color: var(--pedra); }
.d-pedir::after { content: ""; position: absolute; inset: -3px; border-radius: 15px; border: 2px solid var(--laranja); opacity: 0; pointer-events: none; animation: chama-ia 2.6s ease-out infinite; }
@keyframes chama-ia { 0% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.12, 1.35); } }
.d-pedir-icone { animation: respira 2.6s ease-in-out infinite; }
@keyframes respira { 50% { transform: scale(1.18) rotate(20deg); } }
.d-pedir-icone { width: 26px; height: 26px; border-radius: 50%; background: var(--carbono); color: var(--laranja); display: grid; place-items: center; font-size: 13px; }

.d-toasts { position: absolute; right: 18px; bottom: 18px; align-content: end; z-index: 4; display: grid; gap: 8px; width: 270px; pointer-events: none; }
.d-toast { display: flex; align-items: center; gap: 10px; background: rgba(42, 42, 40, .92); backdrop-filter: blur(8px); border: 1px solid #3a3936; border-radius: 12px; padding: 10px 12px; animation: toast-entra 400ms var(--ease-out); transition: opacity 400ms ease, transform 400ms ease; }
.d-toast.sai { opacity: 0; transform: translateX(16px); }
.d-toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--laranja); flex-shrink: 0; }
.d-toast div { flex: 1; min-width: 0; }
.d-toast b { display: block; font-size: 13px; font-weight: 600; }
.d-toast span { display: block; font-size: 12px; color: #b5b2ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-toast small { font: 400 10.5px/1 var(--mono); color: var(--cinza-dado); }
@keyframes toast-entra { from { opacity: 0; transform: translateX(24px) scale(.96); } }

.d-grade { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.d-card { background: var(--carbono); border: 1px solid #262625; border-radius: 14px; padding: 16px; min-width: 0; }
.d-card-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.d-card h4 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.d-kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.d-kpi { display: flex; flex-direction: column; gap: 8px; transition: border-color 400ms ease; }
.d-kpi .etiqueta { color: var(--cinza-dado); font-size: 11px; }
.d-kpi b { font: 800 clamp(34px, 3.4vw, 48px)/1 var(--display); font-variation-settings: "wdth" 62; font-variant-numeric: tabular-nums; }
.d-kpi:first-child b { color: var(--laranja); }
.d-kpi.pulso { animation: pulso 900ms var(--ease-out); }
@keyframes pulso { 0% { border-color: var(--laranja); box-shadow: 0 0 0 0 rgba(232, 89, 12, .35); } 100% { border-color: #262625; box-shadow: 0 0 0 10px rgba(232, 89, 12, 0); } }
.d-kpi-base { display: flex; align-items: center; gap: 10px; }
.d-kpi em { font: 500 11px/1 var(--mono); font-style: normal; padding: 5px 7px; border-radius: 99px; background: var(--grafite); color: #c9c6bf; }
.d-kpi em.bom { background: rgba(232, 89, 12, .18); color: #FF8A4C; }
.d-kpi svg { flex: 1; height: 30px; }
.d-kpi path { fill: none; stroke: var(--laranja); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* A linha pequena se revela da esquerda para a direita */
.d-kpi path.desenha { animation: revela-linha 1100ms var(--ease-out) both; }
@keyframes revela-linha { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes desenha { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.d-grafico { grid-column: span 8; }
.d-legenda { display: flex; gap: 14px; font: 400 11px/1 var(--mono); color: var(--cinza-dado); }
.d-legenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.l-bar::before { background: #3a3936; }
.l-lin::before { background: var(--laranja); }
.d-svg-box { position: relative; height: 260px; }
.d-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.d-gradeh line { stroke: #262625; stroke-width: 1; vector-effect: non-scaling-stroke; }
.d-barras rect { fill: #33332f; }
.d-linha { fill: none; stroke: var(--laranja); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; }
.d-linha.desenha { animation: desenha 1300ms var(--ease-out) both; }
.d-pontos circle { fill: var(--carbono); stroke: var(--laranja); stroke-width: 2; vector-effect: non-scaling-stroke; transition: r 200ms ease; }
.d-cursor { transition: transform 600ms var(--ease-out); }
.d-cursor line { stroke: rgba(238, 236, 232, .25); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.d-cursor circle { fill: var(--laranja); stroke: var(--carbono); stroke-width: 3; vector-effect: non-scaling-stroke; transition: cy 600ms var(--ease-out); }
.d-tip { position: absolute; transform: translate(-50%, calc(-100% - 16px)); background: var(--pedra); color: var(--carbono); border-radius: 9px; padding: 8px 10px; display: grid; gap: 2px; font-size: 12px; white-space: nowrap; opacity: 0; transition: left 600ms var(--ease-out), top 600ms var(--ease-out), opacity 300ms ease; pointer-events: none; }
.d-tip.on { opacity: 1; }
.d-tip b { font: 500 10.5px/1.2 var(--mono); text-transform: uppercase; color: #77746d; }
.d-tip .v { font-weight: 700; color: #B8460A; }
.d-rotulos { display: grid; grid-template-columns: repeat(8, 1fr); margin-left: calc(34 / 640 * 100%); font: 400 11px/1 var(--mono); color: var(--cinza-dado); text-align: center; padding-top: 8px; }

.d-canais { grid-column: span 4; }
.d-canais ul { list-style: none; display: grid; gap: 14px; }
.d-canais li { display: grid; grid-template-columns: 78px 1fr 38px; gap: 10px; align-items: center; font-size: 13px; }
.d-canais i { height: 10px; border-radius: 5px; background: #262625; overflow: hidden; }
.d-canais u { display: block; height: 100%; background: var(--pedra); transform-origin: left; transform: scaleX(0); border-radius: 5px; }
.d-canais li:first-child u { background: var(--laranja); }
.d-canais b { font: 500 12px/1 var(--mono); text-align: right; color: #c9c6bf; }

.d-funil { grid-column: span 5; display: grid; grid-template-columns: 140px 1fr; grid-template-rows: auto 1fr; column-gap: 16px; align-items: center; }
.d-funil .d-card-topo { grid-column: 1 / -1; }
.d-donut-box { position: relative; width: 140px; height: 140px; }
.d-donut { width: 100%; height: 100%; }
.d-donut circle { transition: none; }
.d-donut-centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.d-donut-centro b { font: 800 34px/1 var(--display); font-variation-settings: "wdth" 62; }
.d-donut-centro small { font: 400 9.5px/1.2 var(--mono); color: var(--cinza-dado); max-width: 70px; }
.d-funil-leg { list-style: none; display: grid; gap: 9px; }
.d-funil-leg li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.d-funil-leg i { width: 10px; height: 10px; border-radius: 3px; }
.d-funil-leg b { font: 500 12px/1 var(--mono); color: #c9c6bf; }

.d-insight { grid-column: span 7; background: linear-gradient(135deg, #2A2A28, #1d1d1c); border-color: #3a3936; }
.d-ia { font: 500 10.5px/1 var(--mono); background: var(--laranja); color: var(--carbono); padding: 4px 6px; border-radius: 4px; }
.d-insight p { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; min-height: 3.2em; }
.d-insight p.cursor::after { content: "▍"; color: var(--laranja); animation: piscar 1s steps(1) infinite; margin-left: 2px; }
@keyframes piscar { 50% { opacity: 0; } }

/* Primeira montagem: os cartões entram em sequência */
.dash.montando .d-card { animation: card-entra 600ms var(--ease-out) both; }
.dash.montando .d-kpi:nth-child(2) { animation-delay: 60ms; } .dash.montando .d-kpi:nth-child(3) { animation-delay: 120ms; } .dash.montando .d-kpi:nth-child(4) { animation-delay: 180ms; }
.dash.montando .d-grafico { animation-delay: 220ms; } .dash.montando .d-canais { animation-delay: 300ms; } .dash.montando .d-funil { animation-delay: 380ms; } .dash.montando .d-insight { animation-delay: 440ms; }
@keyframes card-entra { from { opacity: 0; transform: translateY(16px) scale(.98); } }

/* Resumo pedido à IA */
.d-resumo { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(12, 12, 12, .55); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity 300ms ease; }
.d-resumo.on { opacity: 1; pointer-events: auto; }
.d-fone { width: min(380px, calc(100% - 24px)); height: min(560px, calc(100% - 24px)); background: #F1EFEA; color: var(--carbono); border-radius: 26px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); transform: translateY(30px) scale(.96); transition: transform 450ms var(--ease-out); }
.d-resumo.on .d-fone { transform: none; }
.d-fone-topo { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--carbono); color: var(--pedra); }
.d-fone-topo .avatar { background: var(--laranja); color: var(--carbono); width: 34px; height: 34px; }
.d-fone-topo div { flex: 1; }
.d-fone-topo strong { display: block; font-size: 14px; }
.d-fone-topo small { display: block; font-size: 12px; color: var(--cinza-dado); }
.d-fechar { width: 34px; height: 34px; border-radius: 50%; color: var(--pedra); box-shadow: inset 0 0 0 1px #3a3936; }
.d-fone-lista { flex: 1; overflow-y: auto; scrollbar-width: none; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.d-resp p { max-width: 100%; }
.d-resp { animation: entra-baixo 300ms var(--ease-out); }
.d-resp > p:first-child { padding-bottom: 2px; }
.d-resp-linha { background: #fff !important; border: 0 !important; padding: 2px 14px !important; font-size: 13.5px; animation: entra-baixo 300ms var(--ease-out); }
.msg.d-resp { background: #fff; border: 1px solid #e3e0da; border-radius: 16px; border-bottom-left-radius: 5px; padding: 6px 0 10px; max-width: 92%; }
.msg.d-resp p { background: transparent; border: 0; }
.d-mini { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin: 8px 14px 4px; }
.d-mini i { flex: 1; height: var(--h); background: var(--laranja); border-radius: 3px 3px 0 0; transform-origin: bottom; animation: sobe 600ms var(--ease-out) both; }
.d-mini i:nth-child(odd) { background: #F4A77A; }
@keyframes sobe { from { transform: scaleY(0); } }

@media (max-width: 960px) {
  .d-grafico, .d-canais, .d-funil, .d-insight { grid-column: 1 / -1; }
  .d-kpis { grid-template-columns: repeat(2, 1fr); }
  .d-toasts { display: none; }
}
@media (max-width: 600px) {
  .dash { padding: 12px; border-radius: 14px; }
  .d-barra { gap: 12px; }
  .d-pedir { width: 100%; justify-content: center; }
  .d-chamada { padding: 14px; }
  .d-chamada p span { display: none; }
  .d-kpis { gap: 8px; }
  .d-kpi { padding: 12px; }
  .d-svg-box { height: 200px; }
  .d-funil { grid-template-columns: 110px 1fr; }
  .d-donut-box { width: 110px; height: 110px; }
  .d-donut-centro b { font-size: 26px; }
  .d-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .d-pedir::after, .d-pedir-icone { animation: none; }
  .d-ponto, .d-linha.desenha, .d-kpi path.desenha, .dash.montando .d-card, .d-mini i { animation: none; }
}
