/* Payments Analytics v6 (UX3): barra de filtros, faixa "Principais métricas", alerta, popup de tendência.
   Carregado POR ÚLTIMO nas duas páginas; só sobrescreve. Só var(--token); Inter 400/500/600; claro e escuro pelos tokens existentes. */
:root{ --an-pill-h:32px; --an6-r:8px; --an6-seg-on:color-mix(in srgb, var(--an-primary) 14%, transparent); }

/* ---------- Barra de filtros: um formato só (32 px, raio 8, borda única) ---------- */
.an4-toolbar{ gap:8px; min-height:48px; padding:8px 12px; }
.an4-ctl-btn,.an4-fchip-btn,.an4-metric-seg{ border-radius:var(--an6-r); }
.an4-ctl-btn{ padding:0 10px; gap:8px; font-weight:500; }
.an4-ctl-btn:hover,.an4-fchip-btn:hover{ background:var(--an-surface-2); border-color:color-mix(in srgb, var(--an-ctl-border) 70%, var(--an-text-2)); }
.an4-ctl[data-ctl="gran"] .an4-ctl-btn{ color:var(--an-text); background:var(--an-surface); }   /* sem tinta azul: só o estado ativo ganha cor */
.an4-ctl-btn svg{ color:var(--an-text-2); }
.an4-ctl-btn[aria-expanded="true"],.an4-fchip-btn[aria-expanded="true"]{ border-color:var(--an-primary); background:var(--an-surface-2); }
.an4-ctl-btn[aria-disabled="true"]{ opacity:.55; }

/* Segmentos Líquida/Bruta e Ambos/CIT/MIT: mesmo estilo, ativo em tinta suave */
.an4-ctl-seg{ gap:6px; }
.an4-metric-seg{ padding:2px; gap:2px; background:var(--an-surface); overflow:visible; }
.an4-metric-seg button{ padding:0 12px; border-radius:6px; font-size:13px; font-weight:500; color:var(--an-text-2); }
.an4-metric-seg button[aria-pressed="true"]{ background:var(--an6-seg-on); color:var(--an-primary); font-weight:600; box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--an-primary) 35%, transparent); border-radius:6px; }
.an4-metric-seg.is-off{ opacity:.7; }
.an4-metric-seg.is-off button[aria-pressed="true"]{ background:color-mix(in srgb, var(--an-text-3) 14%, transparent); color:var(--an-text-2); box-shadow:none; }
.an4-metric-seg.is-off button{ opacity:1; }

/* "Só na Executiva": dica discreta (ícone), texto completo no tooltip e para leitor de tela */
.an6-hint{ position:relative; display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:50%; color:var(--an-text-3); cursor:help; }
.an6-hint svg{ width:14px; height:14px; }
.an6-hint:hover,.an6-hint:focus-visible{ color:var(--an-text); outline:none; }
.an6-hint:focus-visible{ box-shadow:0 0 0 2px var(--an-primary); }
.an6-hint::after{ content:attr(data-tip); position:absolute; z-index:calc(var(--z-menu) + 1); left:50%; top:calc(100% + 6px); transform:translateX(-50%); width:max-content; max-width:260px; padding:8px 10px; border:1px solid var(--hairline-strong); border-radius:var(--radius-md); background:var(--panel); color:var(--an-text); box-shadow:var(--menu-shadow); font-size:12px; font-weight:400; line-height:1.4; white-space:normal; text-align:left; opacity:0; pointer-events:none; transition:opacity var(--motion-base) var(--ease-standard); }
.an6-hint:hover::after,.an6-hint:focus-visible::after{ opacity:1; }

/* Chips de filtro: mesmo formato dos botões, borda tracejada só para "adicionar" */
.an4-fchip-btn{ padding:0 10px; gap:6px; color:var(--an-text-2); border-style:dashed; }
.an4-fchip-btn svg{ width:14px; height:14px; }
.an4-fchip.is-on .an4-fchip-btn{ border-style:solid; border-color:var(--an-primary); background:var(--an6-seg-on); color:var(--an-text); border-radius:var(--an6-r) 0 0 var(--an6-r); }
.an4-fchip-x{ border-color:var(--an-primary); background:var(--an6-seg-on); color:var(--an-primary); border-radius:0 var(--an6-r) var(--an6-r) 0; width:30px; }
.an4-fchip.is-idle .an4-fchip-btn{ cursor:default; border-color:var(--an-ctl-border); background:transparent; color:var(--an-text-2); }
.an4-fchip.is-idle .an4-fchip-x{ border-color:var(--an-ctl-border); background:transparent; color:var(--an-text-2); }
.an4-fchip-clear{ border-radius:var(--an6-r); }
.an4-fchip-clear:hover{ background:var(--an-surface-2); }

/* Limpar: ghost alinhado à direita, na mesma altura */
.an4-ctl-clear:has(button:not([hidden])){ height:auto; padding-left:0; border-left:0; }
.an4-ctl-clear button{ gap:6px; padding:0 8px; border-radius:var(--an6-r); font-weight:500; color:var(--an-text-2); }
.an4-ctl-clear button:hover{ background:var(--an-surface-2); color:var(--an-primary); }

/* ---------- Faixa "Principais métricas": linha 1 título + comparação + selos; linha 2 mudanças ---------- */
.an4-strip{ display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; padding:12px 16px; }
.an4-strip .an4-sec-title{ order:1; }
.an4-strip .an4-cmp{ order:2; flex:0 1 auto; flex-wrap:nowrap; }
.an4-strip > .an4-tagrow{ order:3; margin-left:auto; }
.an4-strip .an4-changes{ order:4; flex:1 0 100%; }
.an4-strip .an4-sec-title{ font-size:15px; font-weight:600; letter-spacing:-0.005em; }
.an4-strip .an4-cmp{ gap:2px 6px; }
.an4-strip > .an4-tagrow{ gap:6px; flex-wrap:nowrap; }
.an4-cmp-dates{ white-space:nowrap; overflow:visible; }
.an4-cmp-lbl{ color:var(--an-text-3); font-size:13px; font-weight:400; }
.an4-cmp-pill{ border-radius:6px; }
.an4-cmp-select{ font-weight:500; max-width:240px; field-sizing:content; padding-left:6px; text-decoration:underline dotted color-mix(in srgb, var(--an-text-3) 70%, transparent); text-underline-offset:4px; }
.an4-cmp-pill:hover{ background:var(--an-surface-2); }
.an4-cmp-pill .chev{ right:6px; }
.an4-cmp-dates{ padding:2px 8px; border-radius:6px; background:var(--an-surface-2); font-size:12px; color:var(--an-text-2); }
/* selos "Dados reais": menores, tinta suave, sem moldura */
.an4-strip .an4-seal,.an4-strip .an4-seal.is-real{ height:20px; padding:0 7px; border:0; font-size:12px; font-weight:500; background:color-mix(in srgb, var(--good) 12%, transparent); color:var(--good); }
.an4-strip .an4-seal.is-parecer{ background:var(--warn-bg); color:var(--warn); }
/* Mudanças na janela: linha compacta com ícone; "e mais N" abre a lista completa */
.an4-strip .an4-changes{ align-items:center; gap:8px; min-width:0; margin:0; padding-top:6px; border-top:1px solid var(--an-border-subtle); font-size:12px; line-height:20px; color:var(--an-text-2); }
.an6-changes > svg{ width:14px; height:14px; margin:0; color:var(--an-text-3); }
.an6-chg-line{ display:flex; align-items:center; gap:8px; min-width:0; flex:1; }
.an6-chg-line .an4-chg-items{ display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; -webkit-line-clamp:unset; }
.an6-changes b{ font-weight:500; color:var(--an-text); }
.an6-chg-pop{ flex:none; }
.an6-chg-pop .an4-info.has-txt{ height:22px; padding:0 8px 0 10px; gap:4px; border:0; border-radius:999px; background:var(--an-surface-2); color:var(--an-primary); font-size:12px; font-weight:500; }
.an6-chg-pop .an4-info.has-txt:hover{ background:var(--an6-seg-on); }
.an6-chg-pop .an4-info svg{ width:12px; height:12px; color:currentColor; }
.an6-chg-pop .an4-pop{ width:min(560px,calc(100vw - 16px)); max-height:min(70vh,460px); }
.an6-chg-head{ margin:0 0 8px; font-size:12px; font-weight:600; color:var(--an-text-2); }
.an6-chg-list{ display:flex; flex-direction:column; gap:0; margin:0; padding:0; list-style:none; }
.an6-chg-list li{ display:grid; grid-template-columns:96px minmax(0,1fr); gap:8px; padding:6px 0; border-top:1px solid var(--an-border-subtle); font-size:12px; line-height:1.4; }
.an6-chg-list li:first-child{ border-top:0; }
.an6-chg-list time{ color:var(--an-text-3); font-variant-numeric:tabular-nums; }
.an6-chg-list li.is-inc span{ color:var(--an-text); }
@media (max-width:640px){ .an4-strip .an4-cmp{ flex-wrap:wrap; } .an4-strip > .an4-tagrow{ margin-left:0; } .an6-chg-line{ flex-wrap:wrap; } .an6-chg-line .an4-chg-items{ white-space:normal; } }

/* ---------- Alerta: menos pesado (fundo suave, faixa lateral), contagem e ação alinhadas à direita ---------- */
.an4-alertbar{ border-radius:var(--an-radius-card); border-width:1px; border-left-width:3px; box-shadow:none; }
.an4-alertbar.is-bad{ background:color-mix(in srgb, var(--bad) 6%, var(--an-surface)); border-color:var(--an-border-subtle); border-left-color:var(--bad); }
.an4-alertbar.is-warn{ background:color-mix(in srgb, var(--warn) 6%, var(--an-surface)); border-color:var(--an-border-subtle); border-left-color:var(--warn); }
.an4-alertbar-head{ min-height:44px; gap:10px; padding:0 8px 0 14px; }
.an4-alertbar-count{ display:inline-flex; align-items:center; height:22px; padding:0 8px; border-radius:999px; font-size:12px; font-weight:600; background:color-mix(in srgb, currentColor 12%, transparent); }
.an4-alertbar-first{ font-size:13px; font-weight:400; }
.an4-alertbar-rest{ margin-left:auto; font-size:12px; font-weight:500; padding:0 8px; height:22px; display:inline-flex; align-items:center; border-radius:999px; background:var(--an-surface-2); color:var(--an-text-2); }
.an4-alertbar-more{ display:inline-flex; align-items:center; height:28px; padding:0 10px; border:1px solid var(--an-ctl-border); border-radius:var(--an6-r); font-size:13px; font-weight:500; }
.an4-alertbar-more::after{ margin-left:6px; }
.an4-alertbar.is-ok{ border-left-width:1px; }
@media (max-width:640px){ .an4-alertbar-rest{ margin-left:0; } .an4-alertbar-more{ margin-left:auto; } }

/* ---------- Tendência clicável (aba Recusas) ---------- */
.an6-trend-btn{ display:inline-flex; align-items:center; justify-content:center; padding:4px 6px; border:1px solid transparent; border-radius:var(--an6-r); background:transparent; color:inherit; cursor:zoom-in; font:inherit; }
.an6-trend-btn:hover{ background:var(--an-surface-2); border-color:var(--an-border-subtle); }
.an6-trend-btn:hover .an4-trend path{ stroke:var(--an-primary); }
.an6-trend-btn:focus-visible{ outline:2px solid var(--an-primary); outline-offset:2px; }

/* ---------- Popup modal ---------- */
body.an6-modal-open{ overflow:hidden; }
.an6-overlay{ position:fixed; inset:0; z-index:calc(var(--z-drawer) + 20); display:flex; align-items:center; justify-content:center; padding:16px; background:var(--overlay); animation:an-fade-in var(--motion-base) var(--ease-standard); }
.an6-modal{ display:flex; flex-direction:column; width:min(760px,100%); max-height:calc(100vh - 32px); overflow:auto; background:var(--panel); color:var(--an-text); border:1px solid var(--hairline-strong); border-radius:var(--radius-lg, 16px); box-shadow:var(--menu-shadow); }
.an6-modal:focus{ outline:none; }
.an6-modal-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:16px 16px 8px 20px; }
.an6-modal-title{ margin:0; font-size:15px; line-height:24px; font-weight:600; color:var(--an-text); }
.an6-modal-sub{ margin:2px 0 0; font-size:12px; line-height:16px; color:var(--an-text-2); }
.an6-modal-x{ flex:none; display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; border:0; border-radius:var(--an6-r); background:transparent; color:var(--an-text-2); cursor:pointer; }
.an6-modal-x:hover{ background:var(--an-surface-2); color:var(--an-text); }
.an6-modal-x:focus-visible{ outline:2px solid var(--an-primary); outline-offset:2px; }
.an6-modal-x svg{ width:16px; height:16px; }
.an6-modal-body{ padding:8px 20px 20px; }
.an6-rule{ margin:12px 0 0; padding-top:12px; border-top:1px solid var(--an-border-subtle); font-size:12px; line-height:1.5; color:var(--an-text-2); }
.an6-chart{ position:relative; }
.an6-svg{ display:block; width:100%; height:auto; border-radius:var(--an6-r); touch-action:none; }
.an6-svg:focus-visible{ outline:2px solid var(--an-primary); outline-offset:2px; }
.an6-grid{ stroke:var(--an-border-subtle); stroke-width:1; }
.an6-axis{ fill:var(--an-text-3); font-size:11px; font-variant-numeric:tabular-nums; }
.an6-line{ fill:none; stroke:var(--an-spark-stroke); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.an6-area{ fill:var(--an-spark-fill); stroke:none; }
.an6-dot{ fill:var(--an-spark-stroke); opacity:.55; }
.an6-dot.is-on{ opacity:1; r:5; stroke:var(--panel); stroke-width:2; }
.an6-cursor{ stroke:var(--an-text-3); stroke-width:1; stroke-dasharray:3 3; }
.an6-tip{ position:absolute; top:8px; display:flex; flex-direction:column; gap:2px; min-width:120px; padding:8px 10px; border:1px solid var(--hairline-strong); border-radius:var(--radius-md); background:var(--panel); box-shadow:var(--menu-shadow); font-size:12px; line-height:1.3; pointer-events:none; white-space:nowrap; }
.an6-tip b{ font-weight:600; color:var(--an-text); font-variant-numeric:tabular-nums; }
.an6-tip span{ font-size:15px; font-weight:600; color:var(--an-text); font-variant-numeric:tabular-nums; }
.an6-tip i{ font-style:normal; color:var(--an-text-2); }
@media (max-width:640px){ .an6-overlay{ align-items:flex-end; padding:0; } .an6-modal{ width:100%; max-height:92vh; border-radius:16px 16px 0 0; } }
@media (prefers-reduced-motion:reduce){ .an6-overlay{ animation:none; } .an6-hint::after{ transition:none; } }

/* ---------- Páginas curtas (Contas, estados vazios): a linha do topo não estica; o conteúdo começa logo abaixo da barra superior ---------- */
body[data-page="analytics-pagamentos"] .app{ grid-template-rows:auto 1fr; }
/* O divisor solto some; Limpar segue como último item, alinhado à direita */
.an4-toolbar .an4-divider{ display:none; }
