/* ============================================================================
   Campaign report (/profile/<username>/report) — Meta Ads infographic.
   Built on the shared design tokens (base.css) and reuses .card/.kpi/.grid/
   .section-title; the r- classes below add the report-specific layout.
   ============================================================================ */

.r-root { display: block; }
.r-loading, .r-empty { text-align: center; padding: 48px 20px; }
.r-empty h2 { margin: 0 0 8px; }
.r-empty .btn { margin-top: 16px; display: inline-block; }

/* lead paragraph under a section title */
.r-lead { color: var(--muted); margin: -6px 4px 16px; font-size: 14px; max-width: 70ch; }
.section-title.r-sect { margin-top: 34px; }

/* ---- HERO --------------------------------------------------------------- */
.r-hero { padding: 0; overflow: hidden; }
.r-back {
  display: inline-block; padding: 14px 20px 0; color: var(--muted);
  font-size: 13px; cursor: pointer; text-decoration: none;
}
.r-back:hover { color: var(--text); }
.r-hero-main {
  display: grid; grid-template-columns: auto 1fr auto; gap: 22px;
  align-items: center; padding: 16px 22px 22px;
}
.r-avatar {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border2); background: var(--elevated);
}
.r-avatar-ph { background: var(--grad); }
.r-eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: 11px;
  font-weight: 700; color: var(--blue); margin-bottom: 6px;
}
.r-name {
  margin: 0; font-size: clamp(22px, 3vw, 30px); font-weight: 800;
  display: flex; align-items: center; gap: 8px; line-height: 1.1;
}
.r-name .verified svg { width: 20px; height: 20px; }
.r-handle { color: var(--muted); margin-top: 4px; font-size: 14px; }
.r-handle a { color: var(--blue); text-decoration: none; }
.r-handle a:hover { text-decoration: underline; }
.r-bio { color: var(--muted); margin-top: 8px; font-size: 13px; max-width: 60ch; }
.r-hero-stats { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
.r-hstat { display: flex; flex-direction: column; }
.r-hstat b { font-size: 18px; font-weight: 800; }
.r-hstat span { font-size: 12px; color: var(--faint); }
.r-hero-spend {
  text-align: right; padding: 16px 18px; border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--warn) 12%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--warn) 32%, transparent);
  min-width: 190px;
}
.r-spend-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.r-spend-value { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; margin: 4px 0; color: var(--warn); }
.r-spend-sub { font-size: 12px; color: var(--faint); }

/* ---- KPI tiles (accent bar via --c) ------------------------------------- */
/* wider columns than the dashboard's so money values (R$ 27.842) stay one line */
.r-kpis { grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); }
.r-kpi { position: relative; overflow: hidden; padding-left: 22px; }
.r-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--c, var(--blue));
}
.r-kpi .value { background: none; font-size: 23px; white-space: nowrap; }
.r-kpi .value span { color: inherit; }

/* ---- SPEND card --------------------------------------------------------- */
.r-spend-head { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 4px; }
.r-spend-big b { font-size: 32px; font-weight: 800; }
.r-spend-big span { display: block; font-size: 12px; color: var(--faint); }
.r-big-cobrado b { color: var(--purple); }
.r-big-investido b { color: var(--warn); }
.r-spend-explain {
  color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 78ch; margin: 4px 0 18px;
}
.r-spend-explain b { color: var(--text); }

/* monthly grouped bar chart (billed vs invested) */
.r-mchart { margin: 4px 0 20px; }
.r-mlegend { display: flex; gap: 18px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.r-mkey { display: inline-flex; align-items: center; gap: 7px; }
.r-mkey::before { content: ""; width: 11px; height: 11px; border-radius: 3px; }
.r-mkey.cobrado::before, .r-mbar.cobrado { background: var(--purple); }
.r-mkey.investido::before, .r-mbar.investido { background: var(--warn); }
.r-mbars { display: flex; gap: 8px; align-items: flex-end; }
.r-mgroup { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.r-mcols { display: flex; gap: 8px; align-items: flex-end; height: 170px; }
.r-mbarwrap {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%;
}
.r-mval { font-size: 11px; color: var(--muted); margin-bottom: 5px; white-space: nowrap; }
.r-mbar { width: 30px; max-width: 8vw; border-radius: 6px 6px 0 0; transition: height .5s ease; }
.r-mlabel { margin-top: 9px; font-size: 12px; color: var(--text); font-weight: 600; }

.r-spend-txblock { margin-top: 4px; }
.r-spend-txtitle {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px;
}
.r-spend-tx { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.r-tx-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 13px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--elevated); font-size: 13px;
}
.r-tx-row .r-tx-date { color: var(--muted); }
.r-tx-row .r-tx-amt { font-weight: 700; }

/* ---- FUNNEL ------------------------------------------------------------- */
.r-funnel { display: flex; flex-direction: column; gap: 10px; }
.r-funnel-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: 14px; align-items: center; }
.r-funnel-meta { display: flex; flex-direction: column; }
.r-funnel-stage { font-weight: 700; font-size: 14px; }
.r-funnel-hint { font-size: 11px; color: var(--faint); }
.r-funnel-track { background: var(--elevated); border-radius: 10px; height: 38px; display: flex; align-items: center; }
.r-funnel-fill {
  height: 100%; border-radius: 10px; min-width: 52px;
  background: var(--grad-btn); display: flex; align-items: center; padding: 0 12px;
  color: #fff; font-weight: 800; font-size: 14px; transition: width .5s ease;
}
.r-funnel-conv { text-align: right; }
.r-conv { display: block; font-weight: 800; font-size: 16px; color: var(--ok); }
.r-conv-l { font-size: 11px; color: var(--faint); }

/* ---- SERIES charts ------------------------------------------------------ */
.r-series-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.r-series-title { font-weight: 700; font-size: 14px; }
.r-series-sub { font-size: 12px; }
.r-series-total { font-size: 22px; font-weight: 800; }
.r-series-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; margin-top: 4px; }

/* ---- RANKING ------------------------------------------------------------ */
.r-rankcard { display: flex; flex-direction: column; gap: 14px; }
.r-rank { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.r-rank-pos {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: var(--text);
  background: var(--elevated); border: 1px solid var(--border2);
}
.r-rank:first-child .r-rank-pos { background: var(--grad-btn); color: #fff; border-color: transparent; }
.r-rank-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.r-rank-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
.r-rank-val { font-weight: 800; font-size: 14px; white-space: nowrap; }
.r-rank-track { background: var(--elevated); border-radius: 7px; height: 8px; margin: 7px 0 5px; overflow: hidden; }
.r-rank-fill { height: 100%; border-radius: 7px; transition: width .5s ease; }
.r-rank-sub { font-size: 12px; color: var(--muted); }

/* ---- BY OBJECTIVE ------------------------------------------------------- */
.r-objgrid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.r-obj { display: flex; flex-direction: column; gap: 10px; }
.r-obj-head { display: flex; justify-content: space-between; align-items: baseline; }
.r-obj-name { font-weight: 700; font-size: 15px; }
.r-obj-ads { font-size: 12px; color: var(--faint); }
.r-obj-spend { font-size: 22px; font-weight: 800; }
.r-obj-spend span { font-size: 12px; color: var(--faint); font-weight: 400; }
.r-objbar-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.r-objbar-t { background: var(--elevated); border-radius: 6px; height: 7px; overflow: hidden; }
.r-objbar-f { height: 100%; border-radius: 6px; transition: width .5s ease; }
.r-obj-cpr { font-size: 13px; font-weight: 600; margin-top: 2px; }

/* ---- INSIGHTS ----------------------------------------------------------- */
.r-insights { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.r-insight { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.r-insight-ic {
  font-size: 22px; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 12px; background: var(--elevated); border: 1px solid var(--border2);
}
.r-insight-t { font-weight: 700; margin-bottom: 4px; }
.r-insight-b { font-size: 13px; color: var(--muted); line-height: 1.5; }
.r-kind-win .r-insight-ic { border-color: color-mix(in oklch, var(--ok) 45%, transparent); background: color-mix(in oklch, var(--ok) 12%, var(--elevated)); }
.r-kind-lever .r-insight-ic, .r-kind-efficiency .r-insight-ic { border-color: color-mix(in oklch, var(--warn) 45%, transparent); background: color-mix(in oklch, var(--warn) 12%, var(--elevated)); }
.r-kind-formato .r-insight-ic { border-color: color-mix(in oklch, var(--blue) 45%, transparent); background: color-mix(in oklch, var(--blue) 12%, var(--elevated)); }
.r-kind-tema .r-insight-ic { border-color: color-mix(in oklch, var(--ok) 45%, transparent); background: color-mix(in oklch, var(--ok) 12%, var(--elevated)); }
.r-kind-gancho .r-insight-ic { border-color: color-mix(in oklch, var(--purple) 45%, transparent); background: color-mix(in oklch, var(--purple) 12%, var(--elevated)); }
.r-kind-eficiencia .r-insight-ic { border-color: color-mix(in oklch, var(--warn) 45%, transparent); background: color-mix(in oklch, var(--warn) 12%, var(--elevated)); }

/* ---- CREATIVE champions ------------------------------------------------- */
.r-subhead {
  font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 4px 12px;
}
.r-champs { display: flex; flex-direction: column; gap: 10px; }
.r-champ { display: grid; grid-template-columns: 26px 52px 1fr auto auto; gap: 14px; align-items: center; }
.r-champ-pos {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 12px; background: var(--elevated); border: 1px solid var(--border2);
}
.r-champ:first-child .r-champ-pos { background: var(--grad-btn); color: #fff; border-color: transparent; }
.r-cthumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--elevated); }
.r-cthumb-ph { background: var(--grad); }
.r-champ-body { min-width: 0; }
.r-champ-name {
  font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.r-ctags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.r-ctag {
  font-size: 11px; color: var(--muted); background: var(--elevated);
  border: 1px solid var(--border2); border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.r-champ-metric { text-align: right; white-space: nowrap; }
.r-champ-metric b { font-size: 15px; font-weight: 800; }
.r-champ-metric span { display: block; font-size: 11px; color: var(--faint); }
.r-champ-open {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--border2); color: var(--muted); text-decoration: none; font-size: 15px;
}
.r-champ-open:hover { color: var(--text); border-color: var(--blue); }
@media (max-width: 640px) {
  .r-champ { grid-template-columns: 22px 44px 1fr; }
  .r-champ-metric { grid-column: 2 / 4; text-align: left; }
  .r-champ-open { display: none; }
}

/* ---- ADS TABLE ---------------------------------------------------------- */
.r-tablecard { padding: 0; }
.r-tablescroll { overflow-x: auto; }
.r-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.r-table th, .r-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.r-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); position: sticky; top: 0; background: var(--surface); }
.r-table tbody tr:hover { background: var(--elevated); }
.r-table .r-num { text-align: right; white-space: nowrap; }
.r-td-name { max-width: 320px; }
.r-tn { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.r-obj-tag { font-size: 11px; color: var(--blue); }
.r-rt { display: block; font-size: 11px; color: var(--faint); }
.r-status { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border2); }
.r-status.ok { color: var(--ok); border-color: color-mix(in oklch, var(--ok) 45%, transparent); background: color-mix(in oklch, var(--ok) 12%, transparent); }
.r-status.off { color: var(--muted); }
.r-status.bad { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 45%, transparent); background: color-mix(in oklch, var(--danger) 12%, transparent); }

.r-foot { text-align: center; margin: 28px 0 8px; font-size: 12px; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 760px) {
  .r-hero-main { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .r-hero-spend { text-align: center; width: 100%; }
  .r-hero-stats { justify-content: center; }
  .r-spend-grid { grid-template-columns: 1fr; }
  .r-funnel-row { grid-template-columns: 110px 1fr; }
  .r-funnel-conv { grid-column: 2; text-align: left; }
}
