/* ===== Radar: tokens de mercado ===== */
:root { --up: #0b8a3e; --up-bg: #e2f5e9; --down: #c62f2f; --down-bg: #fbe5e3; --tape: #1b0628; --tape-ink: #eadcf5; --us: #6a1b9a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --up: #3fd17a; --up-bg: #12301d; --down: #ff6b6b; --down-bg: #3a1716; --tape: #0b0410; --us: #c08cf0; } }
:root[data-theme="dark"] { --up: #3fd17a; --up-bg: #12301d; --down: #ff6b6b; --down-bg: #3a1716; --tape: #0b0410; --us: #c08cf0; }

.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.up { background: var(--up-bg); color: var(--up); } .chip.down { background: var(--down-bg); color: var(--down); }
.chip.warn { background: var(--warning-bg); color: var(--warning-ink); } .chip.crit { background: var(--critical-bg); color: var(--critical-ink); }
.chip.ok { background: var(--good-bg); color: var(--good-ink); } .chip.accent { background: var(--accent-soft); color: var(--accent); }
.curva { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-weight: 800; font-size: 12px; }
.curva.A { background: var(--accent); color: var(--accent-ink); } .curva.B { background: var(--accent-3); color: #fff; } .curva.C { background: var(--surface-3); color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; }
.btn:hover { border-color: var(--accent-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input.in, select.in, textarea.in { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 8px 11px; min-width: 0; }
input.in:focus, select.in:focus { outline: 2px solid var(--accent-3); outline-offset: 0; }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card h2, .card h3 { margin: 0 0 12px; font-family: var(--display); letter-spacing: -.02em; color: var(--plum); }
.card h2 { font-size: 18px; } .card h3 { font-size: 15px; }
.card .h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card .h h2, .card .h h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ===== Fita da bolsa ===== */
.tape { position: sticky; top: 0; z-index: 20; background: var(--tape); color: var(--tape-ink); overflow: hidden; height: 38px; display: flex; align-items: center; border-radius: 12px; }
.tape .live { flex: none; display: flex; align-items: center; gap: 7px; padding: 0 14px; height: 100%; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; background: rgba(255,255,255,.08); color: #fff; z-index: 1; }
.tape .dot { width: 8px; height: 8px; border-radius: 50%; background: #3fd17a; animation: pulse 1.8s infinite; }
.tape .dot.off { background: #8a7898; animation: none; }
.tape .dot.busy { background: #fab219; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,209,122,.6); } 70% { box-shadow: 0 0 0 8px rgba(63,209,122,0); } 100% { box-shadow: 0 0 0 0 rgba(63,209,122,0); } }
.tape .vp { overflow: hidden; flex: 1; height: 100%; display: flex; align-items: center; }
.tape .track { display: flex; gap: 28px; white-space: nowrap; padding-left: 20px; animation: tape 150s linear infinite; will-change: transform; }
.tape:hover .track { animation-play-state: paused; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tape .it { font-size: 12.5px; display: inline-flex; gap: 7px; align-items: baseline; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
.tape .it b { color: #fff; font-weight: 700; }
.tape .it .up { color: #3fd17a; } .tape .it .down { color: #ff8a8a; } .tape .it .flat { color: #a595b3; }
.tape .it.us b { color: #e2c4ff; }
@media (prefers-reduced-motion: reduce) { .tape .track { animation: none; } .tape .vp { overflow-x: auto; } }

/* ===== KPIs ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--ring); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); text-align: left; color: var(--ink); font: inherit; }
button.kpi { cursor: pointer; } button.kpi:hover { border-color: var(--accent-3); }
button.kpi[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.kpi .v { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -.03em; color: var(--plum); margin-top: 4px; }
.kpi .s { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* ===== Toolbar ===== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 220px; max-width: 340px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ===== Lista única ===== */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 160px); border-radius: var(--radius); border: 1px solid var(--ring); background: var(--surface); box-shadow: var(--shadow); }
table.mk { width: 100%; border-collapse: collapse; min-width: 1240px; }
table.mk th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--ink-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; text-align: left; padding: 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; cursor: pointer; user-select: none; }
table.mk th.r, table.mk td.r { text-align: right; }
table.mk th[aria-sort="ascending"]::after { content: " ▲"; } table.mk th[aria-sort="descending"]::after { content: " ▼"; }
table.mk td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
table.mk tbody tr { cursor: pointer; }
table.mk tbody tr:hover { background: var(--surface-2); }
.flash-up { animation: fu 2.6s; } .flash-down { animation: fd 2.6s; }
@keyframes fu { 0% { background: var(--up-bg); } 100% { background: transparent; } }
@keyframes fd { 0% { background: var(--down-bg); } 100% { background: transparent; } }
.prod { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.thumb { width: 42px; height: 42px; border-radius: 10px; background: #fff; flex: none; border: 1px solid var(--line); object-fit: contain; }
.thumb.ph { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 13px; }
.thumb.lg { width: 112px; height: 112px; border-radius: 16px; font-size: 26px; }
.prod .n { font-weight: 600; line-height: 1.25; } .prod .c { font-size: 11.5px; color: var(--muted); }
.price { font-weight: 700; white-space: nowrap; } .price s { color: var(--muted); font-weight: 400; font-size: 11.5px; margin-right: 4px; }
.idx { display: inline-block; min-width: 46px; text-align: center; padding: 3px 8px; border-radius: 8px; font-weight: 800; font-size: 12.5px; }
.idx.hi { background: var(--down-bg); color: var(--down); } .idx.lo { background: var(--warning-bg); color: var(--warning-ink); } .idx.ok { background: var(--up-bg); color: var(--up); } .idx.na { background: var(--surface-2); color: var(--muted); }

.ruler { position: relative; width: 150px; height: 22px; }
.ruler .bar { position: absolute; left: 0; right: 0; top: 10px; height: 3px; border-radius: 2px; background: var(--line-strong); }
.ruler .iqr { position: absolute; top: 7px; height: 9px; border-radius: 5px; background: var(--accent-soft); border: 1px solid var(--accent-3); }
.ruler .tick { position: absolute; top: 6px; width: 2px; height: 11px; background: var(--muted); border-radius: 1px; opacity: .6; }
.ruler .us { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--us); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--us); }
.ruler .pr { position: absolute; top: 2px; width: 0; height: 0; margin-left: -6px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--warning); }

/* ===== Detalhe ===== */
.hero { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: 26px; margin: 4px 0 6px; letter-spacing: -.03em; color: var(--plum); line-height: 1.15; }
.hero .big { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: -.03em; color: var(--plum); }
.quote { text-align: right; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 16px; }
.metric { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.metric .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.metric .v { font-weight: 800; font-size: 18px; color: var(--plum); margin-top: 2px; }
.metric .s { font-size: 11.5px; color: var(--ink-2); }

.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px 12px; padding-top: 8px; }
.offer { border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px 12px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); position: relative; }
.offer.us { border-color: var(--us); box-shadow: 0 0 0 2px var(--accent-soft); }
.offer.out { opacity: .72; }
.offer .top { display: flex; gap: 10px; align-items: flex-start; }
.offer .mock { width: 64px; height: 64px; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; object-fit: contain; }
.offer .mock.ph { display: grid; place-items: center; color: var(--muted); font-size: 18px; font-weight: 800; background: var(--surface-2); }
.offer .brand-n { font-weight: 800; color: var(--plum); font-size: 13px; }
.offer .nm { font-size: 12px; color: var(--ink-2); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.offer .pp { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.offer .pp .now { font-weight: 800; font-size: 19px; color: var(--ink); }
.offer .pp s { color: var(--muted); font-size: 12px; }
.offer .row { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; align-items: center; }
.offer .tag { position: absolute; top: -10px; left: 12px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.offer .tag.principal { background: var(--warning); color: #3b2600; } .offer .tag.formula { background: var(--emb); color: #fff; } .offer .tag.sanavita { background: var(--us); color: #fff; } .offer .tag.canal { background: var(--midia); color: #fff; } .offer .tag.tiktok { background: #111; color: #fff; }
.offer .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.offer .err { font-size: 11px; color: var(--warning-ink); background: var(--warning-bg); border-radius: 6px; padding: 3px 6px; }
.spark { width: 100%; height: 34px; display: block; }

.chart { width: 100%; height: 320px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; margin-top: 8px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: 0; padding: 2px 0; color: var(--ink-2); font: inherit; }
.legend button.off { opacity: .35; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.ladder { display: flex; flex-direction: column; gap: 9px; }
.lad { display: grid; grid-template-columns: minmax(170px, 250px) minmax(0, 1fr) 90px 90px 76px; gap: 10px; align-items: center; font-size: 12.5px; }
.lad .bar { position: relative; height: 22px; background: var(--surface-2); border-radius: 6px; }
.lad .bar .alvo { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--plum); }
.lad .bar .real { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 4px; background: var(--accent-3); }
.lad .bar .real.bad { background: var(--down); }
.lad .bar .site { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--up); }
.lad.head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.lad .src { font-size: 11px; color: var(--muted); }

.fichas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fichas ul { margin: 0; padding-left: 18px; } .fichas li { margin: 3px 0; }
.quoteb { border-left: 3px solid var(--accent-3); padding: 8px 12px; background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: 13px; color: var(--ink-2); }

.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert { padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.alert.alto { background: var(--critical-bg); color: var(--critical-ink); }
.alert.medio { background: var(--warning-bg); color: var(--warning-ink); }
.alert.info { background: var(--surface-2); color: var(--ink-2); }

.feed { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 92px 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); font: inherit; font-size: 13px; cursor: pointer; background: none; color: inherit; text-align: left; width: 100%; }
.ev:hover { background: var(--surface-2); }
.ev .t { color: var(--muted); font-size: 11.5px; }
.ev .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.ev .ic.up { background: var(--up-bg); } .ev .ic.down { background: var(--down-bg); } .ev .ic.n { background: var(--surface-2); color: var(--ink-2); }

table.plain { width: 100%; border-collapse: collapse; }
table.plain th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line-strong); }
table.plain td { padding: 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; vertical-align: top; }
table.plain td.r, table.plain th.r { text-align: right; }
.bar-mini { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: flex; min-width: 110px; }
.bar-mini i { display: block; height: 100%; }

.sheet { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: 16px; }
.sheet .box { background: var(--surface); border-radius: 18px; padding: 22px; width: min(540px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sheet .box h3 { margin: 0 0 14px; color: var(--plum); font-family: var(--display); }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--plum); color: var(--page); padding: 10px 16px; border-radius: 12px; z-index: 60; font-weight: 600; box-shadow: var(--shadow); max-width: 90vw; }
.back { background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 700; padding: 0; display: inline-flex; gap: 6px; align-items: center; font: inherit; font-weight: 700; }
.tt { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px 110px 90px; gap: 12px; align-items: center; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tt.head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.src-note { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; gap: 6px; }
  .sidebar::after, .nav .label { display: none; }
  .brand { padding: 4px 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav button { width: auto; padding: 8px 10px; }
  .sidebar .me { margin: 0; border: 0; padding: 4px 8px; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .main { padding: 16px; }
  .grid2, .grid3, .fichas { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 72px 1fr; } .hero .quote { grid-column: 1 / -1; text-align: left; }
  .thumb.lg { width: 72px; height: 72px; }
  .lad { grid-template-columns: 1fr 76px 76px; } .lad .bar, .lad .gp { display: none; }
  .tt { grid-template-columns: 1fr 80px 90px; } .tt .hide-m { display: none; }
  .topbar h1 { font-size: 24px; }
  .tbl-wrap { max-height: none; }
}
