/* ============================================================
   OH Lead — Modo TV v2 · Painel de parede ao vivo
   Canvas fixo 1920×1080, escalado para caber em qualquer tela.
   Glanceável de longe: tipografia grande, contraste alto, vivo.
   ============================================================ */
:root {
  --accent: #ff6a00;
  --bg: #0a0a0b;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --t1: rgba(255, 255, 255, 0.96);
  --t2: rgba(255, 255, 255, 0.56);
  --t3: rgba(255, 255, 255, 0.34);
  --good: #4ade80;
  --bad: #f87171;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #000; overflow: hidden; }
body { font-family: "Inter Tight", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }

/* ── stage de escala ─────────────────────── */
#tv-stage {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 0%, #131215 0%, #000 70%);
}
#tv-board {
  width: 1920px; height: 1080px; flex: none; transform-origin: center center;
  position: relative; color: var(--t1);
  background:
    radial-gradient(80% 60% at 78% -8%, color-mix(in oklab, var(--accent) 14%, transparent) 0%, transparent 55%),
    var(--bg);
  display: flex; flex-direction: column; padding: 30px 34px 28px;
  font-feature-settings: "tnum" 1;
}

/* ── header ──────────────────────────────── */
.tvh { display: flex; align-items: center; justify-content: space-between; height: 70px; flex: none; }
.tvh-brand { display: flex; align-items: center; gap: 16px; }
.tvh-logo {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff; letter-spacing: -0.02em;
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 78%, white), var(--accent));
  box-shadow: 0 6px 24px color-mix(in oklab, var(--accent) 40%, transparent);
}
.tvh-name { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.tvh-name b { color: var(--accent); }
.tvh-store { font-size: 18px; color: var(--t2); font-weight: 600; margin-left: 4px; }
.tvh-live {
  display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 700; white-space: nowrap;
  color: var(--t1); padding: 9px 20px; border-radius: 999px;
  background: rgba(74, 222, 128, 0.1); border: 1px solid rgba(74, 222, 128, 0.28);
}
.tvh-live .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(74,222,128,0.55); animation: tv-pulse 2s infinite; }
.tvh-live .ago { color: var(--t2); font-weight: 600; font-size: 16px; }
@keyframes tv-pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); } 70% { box-shadow: 0 0 0 12px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
.tvh-right { display: flex; align-items: center; gap: 22px; }
.tvh-clock { text-align: right; }
.tvh-clock .t { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.tvh-clock .d { font-size: 15px; color: var(--t2); font-weight: 600; text-transform: capitalize; margin-top: 3px; }
.tvh-exit { font-size: 16px; color: var(--t2); border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 9px 18px; font-weight: 600; cursor: pointer; }

/* ── grid principal ──────────────────────── */
.tv-grid {
  flex: 1; min-height: 0; margin-top: 22px;
  display: grid;
  grid-template-columns: 384px 1fr 412px;
  grid-template-rows: 232px 1fr 226px;
  gap: 18px;
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px 24px; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.card-label { font-size: 14.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--t2); flex: none; }

/* posições */
.c-meta { grid-column: 1; grid-row: 1; }
.c-kpis { grid-column: 1; grid-row: 2 / 4; padding: 0; background: none; border: 0; gap: 14px; display: grid; grid-template-rows: repeat(4, 1fr); }
.c-hero { grid-column: 2; grid-row: 1; }
.c-chart { grid-column: 2; grid-row: 2; }
.c-bottom { grid-column: 2; grid-row: 3; padding: 0; background: none; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.c-cad { grid-column: 3; grid-row: 1; }
.c-feed { grid-column: 3; grid-row: 2; }
.c-geo { grid-column: 3; grid-row: 3; }

/* layout "mapa": mapa no centr\u00e3o, gr\u00e1fico vai para a direita */
.tv-grid.lay-mapa .c-feed { grid-column: 2; grid-row: 2; }
.tv-grid.lay-mapa .c-cad { grid-column: 1; grid-row: 1; }
.tv-grid.lay-mapa .c-kpis.kpis-3 { grid-template-rows: repeat(3, 1fr); }
.tv-grid.lay-mapa .c-bottom .c-chart { grid-column: auto; grid-row: auto; }
.tv-grid.lay-mapa .c-right { grid-column: 3; grid-row: 1 / 4; display: flex; flex-direction: column; gap: 18px; min-height: 0; min-width: 0; }
.tv-grid.lay-mapa .c-right > .card { flex: 1 1 0; min-height: 0; }

/* ── meta do dia (ring) ──────────────────── */
.meta-wrap { flex: 1; display: flex; align-items: center; gap: 22px; margin-top: 6px; }
.ring { position: relative; width: 150px; height: 150px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring-c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-pct { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.ring-cap { font-size: 12px; color: var(--t2); font-weight: 600; margin-top: 2px; }
.meta-info { min-width: 0; }
.meta-cur { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.meta-goal { font-size: 16px; color: var(--t2); font-weight: 600; margin-top: 4px; }
.meta-left { margin-top: 12px; font-size: 15px; font-weight: 700; color: var(--accent); }
.meta-left.done { color: var(--good); }

/* ── KPI tiles ───────────────────────────── */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.kpi-l { font-size: 14px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--t2); }
.kpi-v { font-size: 50px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; margin-top: 6px; }
.kpi-v.accent { color: var(--accent); }
.kpi-d { position: absolute; top: 16px; right: 18px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.kpi-d.up { color: var(--good); } .kpi-d.down { color: var(--bad); } .kpi-d.flat { color: var(--t3); }
.kpi-spark { position: absolute; right: 16px; bottom: 12px; opacity: 0.85; }
.kpi-cad { background: var(--panel-2); }
.kpi-cad-v { font-size: 58px; }
.kpi-cad .cad-burst { border-radius: 18px; }
.kpi-cad .cad-chip { top: 14px; right: 14px; padding: 4px 10px; }

/* ── hero faturamento ────────────────────── */
.c-hero {
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--accent) 26%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in oklab, var(--accent) 13%, transparent), color-mix(in oklab, var(--accent) 5%, transparent));
  border-color: color-mix(in oklab, var(--accent) 32%, transparent);
}
.hero-row { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.hero-main { min-width: 0; }
.hero-val { font-size: 92px; font-weight: 800; letter-spacing: -0.04em; line-height: 0.95; color: var(--accent); }
.hero-val .cur { font-size: 44px; vertical-align: 0.42em; margin-right: 6px; opacity: 0.85; }
.hero-sub { font-size: 18px; color: var(--t2); font-weight: 600; margin-top: 10px; }
.hero-sub b { color: var(--t1); }
.hero-delta { text-align: right; flex: none; }
.hero-delta .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 800; color: var(--good); }
.hero-delta .cap { font-size: 14px; color: var(--t2); font-weight: 600; margin-top: 4px; }

/* ── chart ───────────────────────────────── */
.chart-head { display: flex; align-items: center; justify-content: space-between; }
.chart-legend { display: flex; gap: 16px; font-size: 14px; color: var(--t2); font-weight: 600; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: 1px; }
.chart-body { flex: 1; min-height: 0; margin-top: 10px; }
.chart-body svg { width: 100%; height: 100%; display: block; }

/* ── cadastros (hero motivacional) ───────── */
.c-cad { background: var(--panel-2); }
.cad-v { font-size: 96px; font-weight: 800; letter-spacing: -0.04em; line-height: 0.92; margin-top: auto; }
.cad-foot { display: flex; align-items: baseline; gap: 12px; margin-top: 6px; }
.cad-delta { font-size: 19px; font-weight: 800; color: var(--good); }
.cad-cap { font-size: 15px; color: var(--t2); font-weight: 600; }
.cad-burst { position: absolute; inset: 0; pointer-events: none; border-radius: 20px; box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--accent) 0%, transparent); }
.cad-burst.go { animation: cad-flash 1.1s ease-out; }
@keyframes cad-flash {
  0% { box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--accent) 85%, transparent), inset 0 0 60px color-mix(in oklab, var(--accent) 40%, transparent); }
  100% { box-shadow: inset 0 0 0 2px transparent, inset 0 0 60px transparent; }
}
.cad-pop { animation: cad-pop 0.5s ease-out; transform-origin: left bottom; }
@keyframes cad-pop { 0% { transform: scale(1); } 26% { transform: scale(1.13); } 100% { transform: scale(1); } }
.cad-chip {
  position: absolute; top: 18px; right: 20px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); border-radius: 999px; padding: 5px 12px;
  opacity: 0; transform: translateY(-6px); transition: opacity 0.3s, transform 0.3s;
}
.cad-chip.go { opacity: 1; transform: none; }

/* ── mapa ao vivo (Leaflet) ───────────────── */
.tv-map { flex: 1; min-height: 0; margin-top: 12px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #0a0a0b; }
.tv-map .leaflet-container { width: 100%; height: 100%; background: #0a0a0b; font-family: inherit; }
.tv-map .leaflet-tile { filter: saturate(0.85) brightness(0.95); }

/* ── feed ao vivo ────────────────────────── */
.c-feed { padding-bottom: 14px; }
.feed-list { flex: 1; min-height: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 9px; overflow: hidden; }
.feed-item { display: flex; align-items: center; gap: 13px; flex: none; }
.feed-item.enter { animation: feed-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.feed-av {
  width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center;
  font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 70%, #7a3), var(--accent));
}
.feed-av.ret { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.feed-mid { min-width: 0; flex: 1; }
.feed-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-meta { font-size: 14.5px; color: var(--t2); font-weight: 500; margin-top: 1px; }
.feed-meta .tt { color: var(--accent); font-weight: 700; }
.feed-right { text-align: right; flex: none; }
.feed-val { font-size: 17px; font-weight: 800; color: var(--t1); }
.feed-ago { font-size: 13px; color: var(--t3); font-weight: 600; margin-top: 1px; }
.feed-tagnew { font-size: 11px; font-weight: 800; color: var(--good); letter-spacing: 0.05em; }

/* ── geo ─────────────────────────────────── */
.geo-list { flex: 1; min-height: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.geo-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.geo-name { font-size: 17px; font-weight: 700; }
.geo-name span { color: var(--t3); font-weight: 600; font-size: 14px; }
.geo-n { font-size: 18px; font-weight: 800; color: var(--accent); tab-size: 2; }
.geo-bar { grid-column: 1 / 3; height: 8px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.geo-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.6s; }

/* ── bottom: totens + interesses ─────────── */
.mini { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tot-list { flex: 1; min-height: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 13px; justify-content: center; }
.mini-count { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 800; color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, transparent); border-radius: 99px; padding: 1px 8px; vertical-align: 1px; }
.tot-list.cols2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; row-gap: 9px; align-content: center; }
.tot-list.cols2 .tot-name { font-size: 16px; }
.tot-list.cols2 .tot-r { font-size: 14px; }
.tot-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tot-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.tot-dot.on { background: var(--good); box-shadow: 0 0 10px rgba(74,222,128,0.6); animation: tv-pulse 2.4s infinite; }
.tot-dot.off { background: rgba(255,255,255,0.25); }
.tot-name { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tot-r { margin-left: auto; padding-left: 8px; font-size: 16px; font-weight: 700; color: var(--t2); flex: none; white-space: nowrap; }
.tot-r b { color: var(--accent); }
.tot-r.off { color: var(--bad); }
.int-list { flex: 1; min-height: 0; margin-top: 14px; display: flex; flex-direction: column; gap: 13px; justify-content: center; }
.int-row { display: flex; align-items: center; gap: 12px; }
.int-name { font-size: 16px; font-weight: 700; width: 92px; flex: none; }
.int-bar { flex: 1; height: 12px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.int-bar i { display: block; height: 100%; border-radius: 99px; transition: width 0.6s; }
.int-pct { font-size: 16px; font-weight: 800; width: 52px; text-align: right; flex: none; tab-size: 3; }

/* records footer chip no feed */
.feed-rec { flex: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; font-size: 14px; color: var(--t2); font-weight: 600; }
.feed-rec b { color: var(--t1); }

/* toast comemoração */
.tv-toast {
  position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 88%, white), var(--accent));
  color: #fff; font-size: 18px; font-weight: 800; letter-spacing: -0.01em;
  padding: 14px 26px; border-radius: 999px; box-shadow: 0 16px 50px color-mix(in oklab, var(--accent) 45%, transparent);
  opacity: 0; pointer-events: none; z-index: 50; display: flex; align-items: center; gap: 12px;
}
.tv-toast.go { animation: toast-pop 3s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.tv-toast .ti { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,0.25); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
@keyframes toast-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
  10%, 80% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .tvh-live .dot, .tot-dot.on { animation: none; }
  .feed-item.enter, .cad-burst.go, .tv-toast.go, .cad-pop { animation: none; }
}
