/* HunterTrack — estilos das telas (Vendas, Visitas, funil) e ajustes finos.
   Carregado DEPOIS de app.css: a ordem importa. */

/* ---------- Vendas ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.filters > div { display: flex; align-items: center; gap: 8px; }
.flabel { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.grid.kpis4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(139, 92, 246, .06); }
tr.is-test td { opacity: .6; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--neg); border-color: rgba(240, 80, 110, .4); }
.icon-btn svg { width: 17px; height: 17px; }
.btn.danger:hover { border-color: var(--neg); }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; }
.modal[hidden] { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(5, 3, 10, .7); backdrop-filter: blur(2px); }
.modal-panel { position: relative; width: min(760px, 100%); height: 100%; background: var(--bg); border-left: 1px solid var(--border); display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.4); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 12px; }
.modal-head h2 { font-size: 20px; }
.tabs { display: flex; gap: 4px; margin: 0 22px; padding: 4px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; }
.tabs button { flex: 1; border: 0; background: none; color: var(--text-2); font: 600 13px var(--sans); padding: 9px 8px; border-radius: 7px; cursor: pointer; }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--brand); color: #fff; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 22px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border-soft); }
.msec { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.msec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.msec h3 { font-size: 15px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.kv-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.kv b { font-weight: 600; word-break: break-all; }
.kv b.mono { font-size: 12.5px; }
.kv .big { font-size: 20px; font-family: var(--mono); }
.pblog + .pblog { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.pblog .help { margin-bottom: 8px; }
@media (max-width: 1100px) { .grid.kpis4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.kpis4, .kv-grid, .kv-grid.three { grid-template-columns: 1fr; } .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; } .tabs { margin: 0 16px; } }

/* ---------- Visitas ---------- */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.t-pago { background: #9670f0; } .dot.t-organico { background: #1ea677; } .dot.t-direto { background: #bf8514; }
.dot.t-referencia { background: #3b82c4; } .dot.t-bot { background: #c2557a; }
.tag.t-pago { color: #b39af5; } .tag.t-organico { color: #3cc996; } .tag.t-direto { color: #dba53a; }
.tag.t-referencia { color: #6ba6dc; } .tag.t-bot { color: #e07a9c; }
.collapsible.collapsed .card-head { margin-bottom: 0; }
.collapsible.collapsed .legend { display: none; }
#chart-toggle .caret { display: inline-block; transition: transform .15s; }
.collapsible.collapsed #chart-toggle .caret { transform: rotate(-90deg); }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.switch input { accent-color: var(--brand); width: 15px; height: 15px; margin: 0; }
.bar { display: inline-block; width: 42px; height: 5px; border-radius: 3px; background: var(--surface-2); vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand-2); border-radius: 3px; }
.visits-table td { white-space: nowrap; }
.visits-table th, .visits-table td { padding-left: 7px; padding-right: 7px; }
.visits-table th { letter-spacing: .03em; }
.visits-table .bar { width: 30px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; }
.stat > span { display: block; font: 600 10.5px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat > b { display: block; font: 700 20px/1.3 var(--mono); margin-top: 6px; }
.stat > small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 0 0 14px 18px; border-left: 2px solid var(--border-soft); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--surface); }
.timeline li.ev-in::before { background: #3b82c4; } .timeline li.ev-scroll::before { background: #9670f0; }
.timeline li.ev-click::before { background: #bf8514; } .timeline li.ev-checkout::before { background: #1ea677; }
.timeline li.ev-out::before { background: #c2557a; }
.timeline .t { flex: 0 0 44px; color: var(--muted); font-size: 12px; padding-top: 1px; }
.timeline li.ev-checkout > div { color: var(--pos); font-weight: 600; }
.ptable { width: 100%; }
.ptable td { padding: 7px 8px; vertical-align: top; word-break: break-all; }
.ptable td:first-child { width: 28%; color: var(--text-2); }
.ptable td:last-child { width: 34%; word-break: normal; }
.msec hr { border: 0; border-top: 1px solid var(--border-soft); margin: 12px 0; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.timeline .t { flex: 0 0 74px; display: flex; flex-direction: column; line-height: 1.25; }
.timeline .t small { color: var(--muted); opacity: .7; font-size: 11px; }
.segs { display: grid; gap: 10px; }
.seg-row { display: grid; grid-template-columns: 28px auto 1fr auto 110px; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg); }
.seg-row small { display: block; font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seg-row b { font-size: 15px; }
.seg-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--mono); background: var(--brand-glow); color: var(--brand-2); }
.seg-line { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.seg-line i { display: block; height: 100%; width: var(--w); border-radius: 3px; background: linear-gradient(90deg, #3b82c4, var(--brand), #1ea677); }
.seg-dur { text-align: right; }
.seg-dur b { color: var(--brand-2); }
@media (max-width: 640px) { .seg-row { grid-template-columns: 26px 1fr 1fr; } .seg-line { display: none; } .seg-dur { grid-column: 2 / -1; text-align: left; } }

/* ---------- Ajustes de legibilidade e animação (v3.1) ---------- */
.flabel { font-size: 12px; }
.msec { position: relative; }
.msec h3 { font: 600 16px var(--display); }
.kv > span { font-size: 13px; }
.kv b.mono { font-size: 13.5px; }
.tabs button { font-size: 14px; padding: 10px 8px; transition: background .2s, color .2s; }
.tabs button.on { background: linear-gradient(135deg, #7c3aed, #9b6bff); box-shadow: 0 4px 16px rgba(139, 92, 246, .35); }
.stat > span { font-size: 11.5px; }
.stat > b { font: 700 22px/1.3 var(--display); }
.stat > small { font-size: 12.5px; }
.stat { background: var(--surface-solid); transition: border-color .2s; }
.stat:hover { border-color: #3a3060; }
.switch { font-size: 13px; }
.icon-btn { transition: background .2s, color .2s, border-color .2s; }
.modal:not([hidden]) .modal-bg { animation: fadein .25s ease both; }
.modal:not([hidden]) .modal-panel { animation: slidein .35s var(--ease) both; }
.modal-panel { background: linear-gradient(180deg, #0d0a18, #08070f); }
.modal-head h2 { font: 700 22px var(--display); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-body > * { animation: rise .35s var(--ease) both; }
.modal-body > *:nth-child(2) { animation-delay: .04s; } .modal-body > *:nth-child(3) { animation-delay: .08s; } .modal-body > *:nth-child(n+4) { animation-delay: .12s; }
.timeline li { animation: rise .3s var(--ease) both; }
.timeline li::before { box-shadow: 0 0 0 3px var(--surface-solid), 0 0 10px currentColor; }
.visits-table th, .visits-table td { padding-left: 10px; padding-right: 10px; }
tr.clickable td:first-child { position: relative; }
tr.clickable:hover td:first-child::before { content: ""; position: absolute; left: 0; top: 10%; bottom: 10%; width: 2px; background: var(--brand-2); box-shadow: 0 0 10px var(--brand); border-radius: 2px; }
@media (max-width: 900px) { .tabs { overflow-x: auto; } .tabs button { flex: 1 0 auto; padding: 9px 12px; } }
.tag { line-height: 1.45; white-space: nowrap; vertical-align: middle; }
.strike { text-decoration: line-through; }
/* Funil da visita */
.timeline li.ev-offer::before { background: #b197fc; } .timeline li.ev-offer > div { color: var(--brand-2); font-weight: 600; }
.timeline li.ev-checkout::before { background: var(--warn); } .timeline li.ev-checkout > div { color: var(--warn); }
.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 14px; border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden; background: var(--surface-solid); }
.fstep { position: relative; padding: 12px 14px 12px 16px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; color: var(--muted); animation: rise .4s var(--ease) both; animation-delay: calc(var(--i) * 80ms); }
.fstep + .fstep { border-left: 1px solid var(--border-soft); }
.fstep i { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--mono); font-style: normal; background: var(--surface-2); }
.fstep b { font-size: 14px; color: var(--text-2); }
.fstep small { font-size: 12px; }
.fstep.on i { background: linear-gradient(135deg, #7c3aed, #38d6f5); color: #fff; box-shadow: 0 0 14px rgba(139, 92, 246, .5); }
.fstep.on b { color: #fff; }
.fstep.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--brand), var(--cyan)); }
@media (max-width: 640px) { .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fstep:nth-child(3) { border-left: 0; } .fstep:nth-child(n+3) { border-top: 1px solid var(--border-soft); } }
.pb-group { display: block; margin-bottom: 10px; }
.pb-group > summary { margin-bottom: 4px; }
.pb-group[open] { padding-bottom: 4px; }
.pb-ev { margin: 12px 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copybox code { font-size: 12.5px; }
/* Filtros não podem alargar a página no celular: o grupo encolhe e os botões rolam por dentro */
.filters > div { max-width: 100%; min-width: 0; }
.filters .seg { min-width: 0; max-width: 100%; }
@media (max-width: 520px) { .filters > div { width: 100%; } .filters .seg { flex: 1 1 auto; overflow-x: auto; flex-wrap: nowrap; } }
