:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --accent: #4f46e5;
  --good: #15803d;
  --bad: #b91c1c;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151c; --surface: #1b1f29; --text: #e8eaf0; --muted: #9aa3b2; --border: #2b3140; --accent: #8b85ff; --good: #4ade80; --bad: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.muted { color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end;
}
.topbar h1 { font-size: 18px; margin: 0 auto 6px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.filters select, .filters input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}

main { padding: 16px 20px 40px; }
.summary { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); outline: none; }
.thumb {
  position: relative; aspect-ratio: 1 / 1; background: var(--border) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; padding: 8px;
}
.thumb.video::after {
  content: "▶"; position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; padding-left: 4px;
}
.badge {
  position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 99px;
}
.card-info { padding: 10px 12px 12px; }
.card-client { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card-name { margin: 2px 0 8px; font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0; }
.card-metrics dt { font-size: 10px; color: var(--muted); }
.card-metrics dd { margin: 0; font-size: 13px; font-weight: 600; }

.detail {
  width: min(1100px, 96vw); max-height: 94vh; padding: 0; border: none; border-radius: 14px;
  background: var(--surface); color: var(--text);
}
.detail::backdrop { background: rgba(10, 12, 18, .6); }
.close { position: absolute; top: 8px; right: 12px; font-size: 26px; background: none; border: none; color: var(--muted); cursor: pointer; z-index: 2; }
.detail-body { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; max-height: 94vh; }
.preview { background: var(--bg); padding: 16px; overflow: auto; border-right: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { font: inherit; font-size: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 10px; cursor: pointer; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.preview-frame { display: flex; justify-content: center; }
.preview-frame iframe { border: none; width: 100%; max-width: 380px; height: 720px; background: #fff; border-radius: 8px; }
.preview-frame img { max-width: 100%; border-radius: 8px; }
.info { padding: 22px 26px; overflow: auto; }
.info .client { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.info h2 { margin: 4px 0; font-size: 19px; padding-right: 30px; }
.info h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.kpi { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.kpi span { display: block; font-size: 11px; color: var(--muted); }
.kpi strong { font-size: 17px; }
.kpi small { display: block; font-size: 11px; color: var(--muted); }
.title { font-weight: 600; margin: 0 0 6px; }
.body { white-space: pre-wrap; line-height: 1.5; margin: 0; font-size: 14px; }
.cards { display: grid; gap: 6px; margin-top: 10px; }
.cards div { font-size: 13px; background: var(--bg); padding: 6px 10px; border-radius: 6px; }
.chart svg { width: 100%; height: 140px; display: block; }
.chart .legend { font-size: 11px; color: var(--muted); display: flex; gap: 14px; margin-top: 4px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

@media (max-width: 800px) {
  .detail-body { grid-template-columns: 1fr; }
  .preview { border-right: none; border-bottom: 1px solid var(--border); }
  .preview-frame iframe { height: 600px; }
}

.objective {
  position: absolute; top: 8px; right: 8px; color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; background: #6b7280;
}
.objective.leads { background: #15803d; }
.objective.traffic { background: #2563eb; }
.objective.engagement { background: #c026d3; }
.objective.video { background: #ea580c; }
.objective.reach { background: #0891b2; }
.kpi.highlight { outline: 2px solid var(--accent); }

/* ---- anúncios de pesquisa do Google ---- */
.thumb.text-ad { background: var(--surface); align-items: flex-start; justify-content: flex-start; padding: 34px 14px 12px; border-bottom: 1px solid var(--border); }
.text-ad-title { margin: 0; color: #1a0dab; font-size: 15px; line-height: 1.35; text-align: left; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-color-scheme: dark) { .text-ad-title { color: #8ab4f8; } }
.serp { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; width: 100%; }
.serp p { margin: 0; }
.serp-sponsored { font-size: 12px; font-weight: 700; color: var(--text); }
.serp-url { font-size: 12px; color: var(--muted); margin-bottom: 4px !important; }
.serp-title { font-size: 18px; color: #1a0dab; line-height: 1.3; margin-bottom: 4px !important; }
@media (prefers-color-scheme: dark) { .serp-title { color: #8ab4f8; } }
.serp-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }
.serp-lists { width: 100%; margin-top: 14px; font-size: 13px; }
.serp-lists h4 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.serp-lists ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.preview-frame { flex-direction: column; }
