/* =====================================================================
   RRP · Painel de anúncios (v2)
   Base branca, azul só nos detalhes, cantos quase retos, acabamento técnico.
   ===================================================================== */

@view-transition { navigation: auto; }

:root {
  color-scheme: light;
  --navy: #0b1530;
  --brand-navy: #011c55;
  --blue: #1a96ff;
  --blue-ink: #0a72d9;
  --blue-wash: rgba(26, 150, 255, .08);
  --blue-line: rgba(26, 150, 255, .35);
  --good: #11994b;
  --good-wash: rgba(17, 153, 75, .09);
  --warn: #d4621f;
  --warn-wash: rgba(212, 98, 31, .1);
  --bad: #d93a3f;
  --bad-wash: rgba(217, 58, 63, .09);

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --hover: #f4f6f9;
  --glass: rgba(255, 255, 255, .78);
  --line: #e7e9ee;
  --line-2: #d9dde5;
  --text: #0b1530;
  --text-2: #4b5470;
  --text-3: #8a92a8;
  --dot: #dfe3ea;
  --chart-ink: #0b1530;

  --r: 6px;
  --r-sm: 4px;
  --shadow: 0 1px 2px rgba(11, 21, 48, .04);
  --shadow-pop: 0 12px 32px -8px rgba(11, 21, 48, .18), 0 2px 6px rgba(11, 21, 48, .06);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar: 236px;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Tema escuro: aplicado pela classe .dark (Automático segue o sistema; Claro/Escuro forçam) */
:root.dark {
  color-scheme: dark;
  --navy: #e9eefb;
  --blue-ink: #5cb4ff;
  --blue-wash: rgba(26, 150, 255, .12);
  --good-wash: rgba(17, 153, 75, .16);
  --warn-wash: rgba(212, 98, 31, .18);
  --bad-wash: rgba(217, 58, 63, .16);
  --bg: #0a0c11;
  --surface: #111419;
  --surface-2: #14181e;
  --hover: #181c23;
  --glass: rgba(17, 20, 25, .78);
  --line: #22262e;
  --line-2: #2d323c;
  --text: #e9eefb;
  --text-2: #a2aac0;
  --text-3: #6c748a;
  --dot: #1f232b;
  --chart-ink: #e9eefb;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-pop: 0 16px 40px -10px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3 { color: var(--text); margin: 0; letter-spacing: -.02em; font-weight: 600; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 16px; line-height: 1.35; }
h3 { font-size: 14.5px; line-height: 1.4; }
p { margin: 0; }
button { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 3px; }
.ico { flex: none; display: block; }
.muted { color: var(--text-2); }
.meta { color: var(--text-3); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: .01em; color: var(--text-3); font-weight: 450; }
.num, td.n, .v { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: rgba(26, 150, 255, .2); }

/* ---------- Estrutura ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.has-sidebar .content { margin-left: var(--sidebar); }
.main { padding: 0 36px 64px; max-width: 1280px; margin: 0 auto; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30; display: flex; flex-direction: column;
  padding: 20px 12px 16px; background: var(--glass); border-right: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.sb-brand { display: block; padding: 4px 10px 22px; }
.sb-brand img { width: 74px; display: block; }
.sb-client { margin: 0 4px 16px; padding: 10px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.sb-client small { display: block; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.sb-client strong { display: block; font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.sb-nav { display: grid; gap: 1px; }
.sb-section { margin: 14px 10px 6px; }
.sb-link {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: var(--r);
  color: var(--text-2); font-weight: 500; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.sb-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.sb-link .ico { color: var(--text-3); transition: color .15s; }
.sb-link.on { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.sb-link.on .ico { color: var(--blue); }
.sb-link.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px; background: var(--blue); view-transition-name: nav-active; }
.sb-foot { margin-top: auto; display: grid; gap: 1px; padding-top: 12px; border-top: 1px solid var(--line); }
.sb-foot form { margin: 0; }

.mobile-bar, .tabbar { display: none; }

.viewas {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: center; padding: 8px 16px; font-size: 13px;
  background: #fff8e6; color: #6b4a00; border-bottom: 1px solid #f2e3b8;
}
.dark .viewas { background: #221c0c; color: #f0d68e; border-color: #3a3016; }
.viewas a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Cabeçalho da página ---------- */
.page-head {
  position: sticky; top: 0; z-index: 20; margin: 0 -36px; padding: 22px 36px 14px;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent; transition: border-color .2s, padding .25s var(--ease);
}
.page-head.stuck { border-bottom-color: var(--line); padding-top: 12px; padding-bottom: 10px; align-items: center; }
.page-head h1 { transition: font-size .25s var(--ease); }
.page-head.stuck h1 { font-size: 17px; }
.page-head.stuck .sub, .page-head.stuck .back { display: none; }
.page-head .sub { margin-top: 3px; color: var(--text-2); font-size: 14px; max-width: 64ch; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--text-3); margin-bottom: 6px; }
.back:hover { color: var(--blue-ink); text-decoration: none; }
.period-line { margin: 10px 0 22px; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }

.period-ctrl { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r); background: var(--hover); border: 1px solid var(--line); }
.seg a {
  position: relative; z-index: 1; padding: 5px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  color: var(--text-2); white-space: nowrap; transition: color .15s;
}
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.on { color: var(--text); }
.seg a.on::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--r-sm); background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(11, 21, 48, .08); view-transition-name: seg-pill;
}
.date-pop { position: relative; }
.date-pop > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; padding: 6px 11px;
  border-radius: var(--r); font-size: 13px; font-weight: 500; color: var(--text-2); border: 1px solid var(--line); background: var(--surface);
}
.date-pop > summary::-webkit-details-marker { display: none; }
.date-pop[open] > summary, .date-pop.on > summary { color: var(--blue-ink); border-color: var(--blue-line); }
.date-pop .pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 260px; padding: 14px; display: grid; gap: 10px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); animation: pop-in .16s var(--ease);
}
.date-pop .pop label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 500; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Painéis ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card > h2 { margin-bottom: 14px; }
.card > h2:has(+ .card-sub) { margin-bottom: 2px; }
.card-sub { color: var(--text-3); font-size: 13px; margin-bottom: 14px; }
.block { margin: 28px 0 16px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head a { font-size: 13.5px; font-weight: 500; }
.section-title { font-size: 17px; margin-bottom: 12px; }
.section-head .section-title { margin-bottom: 0; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 16px; }
.grid-1-1 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-box { position: relative; height: 300px; }
.donut-box { position: relative; height: 280px; }
.hbar-box { position: relative; height: 260px; }
.empty-chart { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13.5px; margin: 0; }

/* Grade de pontos (toque técnico) */
.dots { background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 16px 16px; }

/* ---------- Herói ---------- */
.hero {
  position: relative; overflow: hidden; margin-bottom: 16px; padding: 26px 28px 24px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px 36px; align-items: stretch;
}
.hero::after {
  content: ""; position: absolute; inset: 0 0 0 45%; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 16px 16px;
  mask-image: linear-gradient(90deg, transparent, #000 40%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%);
}
.hero > * { position: relative; z-index: 1; }
.hero-status { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-wash); }
.hero-line { font-size: clamp(24px, 2.9vw, 34px); line-height: 1.18; letter-spacing: -.03em; font-weight: 450; color: var(--text-2); max-width: 26ch; text-wrap: balance; }
.hero-line b { color: var(--text); font-weight: 650; white-space: nowrap; }
.hero-points { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; color: var(--text-2); max-width: 62ch; }
.hero-points li { position: relative; padding-left: 16px; }
.hero-points li::before { content: ""; position: absolute; left: 0; top: .66em; width: 6px; height: 1.5px; background: var(--blue); }
.hero-points strong { color: var(--text); font-weight: 600; }
.hero-spark { margin: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 6px; min-height: 170px; }
.hero-spark svg { width: 100%; height: 100%; min-height: 130px; overflow: visible; }
.hero-spark .spark-line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero-spark .spark-area { fill: url(#sparkFill); }
.hero-spark .spark-dot { fill: var(--surface); stroke: var(--blue); stroke-width: 2.5; }
.hero-spark .spark-grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.hero-spark .axis { display: flex; justify-content: space-between; }
.hero-spark.draw .spark-line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: spark-draw 1.4s .2s var(--ease) forwards; }
.hero-spark.draw .spark-area, .hero-spark.draw .spark-dot { opacity: 0; animation: fade-in .6s 1.2s var(--ease) forwards; }
@keyframes spark-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

.trend { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 0 6px; border-radius: 3px; margin-left: 4px; white-space: nowrap; vertical-align: 1px; }
.trend.good { background: var(--good-wash); color: var(--good); }
.trend.bad { background: var(--bad-wash); color: var(--bad); }
.trend.neutral { background: var(--hover); color: var(--text-2); }

/* Destaques do público */
.summary { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; padding: 20px 22px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--blue); }
.summary h2 { margin-bottom: 8px; }
.summary-badge { flex: none; width: 34px; height: 34px; border-radius: var(--r); display: grid; place-items: center; background: var(--blue-wash); color: var(--blue-ink); }
.summary-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--text-2); font-size: 14px; }
.summary-list li { position: relative; padding-left: 16px; }
.summary-list li::before { content: ""; position: absolute; left: 0; top: .66em; width: 6px; height: 1.5px; background: var(--blue); }

/* ---------- Métricas interativas ---------- */
.metrics { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.metrics-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); margin: 0 -1px -1px 0; }
.metrics-row + .metrics-row { background: var(--surface-2); }
.metric {
  position: relative; display: grid; align-content: start; gap: 2px; min-width: 0; padding: 16px 18px 14px; text-align: left; cursor: pointer;
  background: none; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .15s;
}
.metric:hover { background: var(--hover); }
.metric[aria-pressed="true"] { background: var(--blue-wash); }
.metric[aria-pressed="true"]::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--blue); }
.metric .l { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.metric .v { margin-top: 4px; font-size: 22px; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; white-space: nowrap; color: var(--text); }
.metrics-row.small .metric { padding: 12px 18px 11px; }
.metrics-row.small .v { font-size: 16px; letter-spacing: -.01em; }
.metric .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; min-height: 20px; }
.metric .spark { width: 64px; height: 20px; flex: none; }
.metric .spark path { fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.metric[aria-pressed="true"] .spark path { stroke: var(--blue); }
.info {
  display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 3px; font-family: var(--font); font-size: 10px; font-weight: 600;
  color: var(--text-3); border: 1px solid var(--line-2); cursor: help; text-decoration: none !important; transition: all .15s;
}
a.info:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 3px; }
.delta.good { background: var(--good-wash); color: var(--good); }
.delta.bad { background: var(--bad-wash); color: var(--bad); }
.delta.neutral { background: var(--hover); color: var(--text-2); }

.explorer { margin-bottom: 16px; }
.explorer .metrics { border-radius: var(--r) var(--r) 0 0; box-shadow: none; }
.explorer-chart { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: 18px 22px 16px; box-shadow: var(--shadow); }
.explorer-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-bottom: 10px; }
.explorer-head h2 { font-size: 15px; }
.explorer-head .total { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.explorer-head .total b { color: var(--text); font-weight: 600; font-size: 13px; }
.explorer .chart-box { height: 260px; }
.explorer .note { margin-top: 8px; font-size: 12px; color: var(--text-3); }

/* ---------- Abas dentro da página ---------- */
.tabs-ui { margin: 28px 0 16px; }
.tablist { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tablist::-webkit-scrollbar { display: none; }
.tablist button {
  position: relative; padding: 10px 0 11px; background: none; border: 0; cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500; color: var(--text-3); transition: color .15s;
}
.tablist button:hover { color: var(--text); }
.tablist button[aria-selected="true"] { color: var(--text); }
.tablist button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--blue); }
.tablist .count { margin-left: 6px; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
[role="tabpanel"][hidden] { display: none; }
[role="tabpanel"] { animation: panel-in .25s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Diagnóstico (lista técnica) ---------- */
.diag-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.diag { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.diag:last-child { border-bottom: 0; }
.diag h3 { margin-bottom: 2px; }
.diag p { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.status { align-self: start; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 3px; justify-self: start; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.status.good { background: var(--good-wash); color: var(--good); }
.status.bad { background: var(--warn-wash); color: var(--warn); }
.status.note { background: var(--blue-wash); color: var(--blue-ink); }

/* ---------- Objetivos e campanhas ---------- */
.obj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.obj-card, .camp-card {
  display: grid; gap: 12px; align-content: start; color: inherit; background: var(--surface); text-align: left; cursor: pointer; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .2s;
}
.obj-card:hover, .camp-card:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-pop); }
.obj-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.obj-tag { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--blue-ink); background: var(--blue-wash); padding: 2px 7px; border-radius: 3px; white-space: nowrap; }
.obj-result strong, .camp-result strong, .cr-result strong { font-size: 26px; font-weight: 650; letter-spacing: -.03em; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.obj-result span, .camp-result span, .cr-result span { color: var(--text-2); font-size: 13.5px; }
.obj-stats, .camp-stats { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.obj-stats div, .camp-stats div { display: grid; }
.obj-stats span, .camp-stats span { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.obj-stats b, .camp-stats b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.share { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 4px; background: var(--hover); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--blue); transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.share .meta { font-family: var(--mono); font-size: 11px; white-space: nowrap; }

.camp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.camp-top { display: flex; justify-content: space-between; gap: 16px; }
.camp-title { min-width: 0; }
.camp-title h3 { margin-bottom: 8px; overflow-wrap: anywhere; }
.camp-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.camp-result { text-align: right; flex: none; }
.camp-result strong { display: block; }
.detail-tags { margin: 10px 0 20px; }
.mini-cr { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.35; }
.mini-cr img, .mini-ph { flex: none; width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--line); }
.mini-ph { display: block; background: linear-gradient(135deg, hsl(var(--h) 75% 58%), hsl(calc(var(--h) + 40) 65% 34%)); }
.camp-card .mini-cr { padding-top: 12px; border-top: 1px dashed var(--line-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 500; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--good-wash); color: var(--good); }
.badge.warn { background: var(--warn-wash); color: var(--warn); }
.badge.bad { background: var(--bad-wash); color: var(--bad); }

.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.hl { display: grid; gap: 3px; padding: 16px 18px; border-right: 1px solid var(--line); margin-right: -1px; }
.hl-label { font-family: var(--mono); font-size: 11px; color: var(--blue-ink); }
.hl strong { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; letter-spacing: -.01em; font-weight: 600; }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 18px; }
.filter-group { display: grid; gap: 6px; }
.filter-label { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: var(--r-sm); cursor: pointer; background: var(--surface);
  border: 1px solid var(--line-2); color: var(--text-2); transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--text-3); text-decoration: none; }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip-count { margin-left: 4px; font-family: var(--mono); font-size: 11px; opacity: .7; }

/* ---------- Funil ---------- */
.funnel-v { display: grid; gap: 8px; }
.fstep { display: grid; grid-template-columns: minmax(0, 1fr) 220px; align-items: center; gap: 16px; }
.fbar {
  height: 34px; border-radius: var(--r-sm); display: flex; align-items: center; padding: 0 12px; min-width: 70px; color: #fff; font-family: var(--mono);
  font-size: 13px; font-weight: 600; background: var(--blue); transform-origin: left; animation: grow .9s var(--ease) both;
}
.fstep:nth-child(2) .fbar { animation-delay: .06s; opacity: .85; }
.fstep:nth-child(3) .fbar { animation-delay: .12s; opacity: .7; }
.fstep:nth-child(4) .fbar { animation-delay: .18s; background: var(--good); }
.flabel { font-size: 13.5px; font-weight: 500; }
.flabel em { display: block; font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--text-3); }

/* ---------- Criativos ---------- */
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cr-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--surface); text-align: left;
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .2s; cursor: pointer;
}
.cr-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-pop); }
.cr-thumb { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--line); }
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.cr-card:hover .cr-thumb img { transform: scale(1.025); }
.cr-ph { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255, 255, 255, .85); font-size: 36px; background: linear-gradient(135deg, hsl(var(--h) 75% 58%), hsl(calc(var(--h) + 40) 65% 34%)); }
.rank {
  position: absolute; top: 10px; left: 10px; height: 24px; padding: 0 8px; border-radius: 3px; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--text); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line);
}
.rank-1 { background: #ffd23f; color: #3b2a00; border-color: transparent; }
.cr-type {
  position: absolute; bottom: 10px; left: 10px; font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 3px;
  color: #fff; background: rgba(0, 0, 0, .5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.cr-open { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); color: var(--text); opacity: 0; transition: opacity .15s; }
.cr-card:hover .cr-open { opacity: 1; }
.cr-body { padding: 14px 16px 16px; display: grid; gap: 3px; flex: 1; align-content: start; }
.cr-name { font-size: 14.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cr-camp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.cr-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-good, .tag-bad { display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.tag-good { background: var(--good-wash); color: var(--good); }
.tag-bad { background: var(--warn-wash); color: var(--warn); }
.cr-result { margin: 8px 0 4px; }
.cr-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.cr-stats div { display: grid; }
.cr-stats dt { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.cr-stats dd { margin: 0; font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ---------- Diálogos: painel lateral e visualização ampla ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(11, 21, 48, .32); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.drawer {
  margin: 0 0 0 auto; height: 100vh; height: 100dvh; max-height: none; width: min(460px, 100vw); padding: 0; border: 0;
  border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-pop);
}
.drawer[open] { animation: drawer-in .32s var(--ease); }
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } }
.dlg-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 17px; overflow-wrap: anywhere; }
.dlg-close { flex: none; width: 32px; height: 32px; border-radius: var(--r); display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.dlg-close:hover { color: var(--text); background: var(--hover); }
.dlg-body { padding: 18px 20px 28px; display: grid; gap: 18px; }
.dlg-result { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.dlg-result strong { font-size: 32px; font-weight: 650; letter-spacing: -.03em; line-height: 1; }
.dlg-result .cost { text-align: right; }
.dlg-result .cost b { display: block; font-size: 16px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat-grid > div { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.stat-grid dt { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.stat-grid dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dlg-section h3 { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--text-3); margin-bottom: 8px; letter-spacing: 0; }
.dlg-diag { display: grid; gap: 10px; }
.dlg-diag div { display: grid; gap: 4px; padding-left: 12px; border-left: 2px solid var(--line-2); }
.dlg-diag div.good { border-color: var(--good); }
.dlg-diag div.bad { border-color: var(--warn); }
.dlg-diag div.note { border-color: var(--blue); }
.dlg-diag b { font-size: 14px; }
.dlg-diag p { font-size: 13.5px; color: var(--text-2); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.lightbox {
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-pop); overflow: hidden;
}
.lightbox[open] { animation: lb-in .28s var(--ease); }
@keyframes lb-in { from { transform: scale(.98) translateY(8px); opacity: 0; } }
.lb-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); max-height: calc(100dvh - 50px); }
.lb-media { position: relative; background: #0b0e14; display: grid; place-items: center; min-height: 420px; }
.lb-media img { width: 100%; height: 100%; max-height: calc(100dvh - 50px); object-fit: contain; display: block; }
.lb-media .cr-ph { position: absolute; inset: 0; font-size: 64px; }
.lb-side { overflow-y: auto; display: grid; align-content: start; }
.lb-side .dlg-head { position: sticky; }
.lb-copy { white-space: pre-line; font-size: 14px; color: var(--text-2); line-height: 1.6; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.lb-copy b { display: block; color: var(--text); margin-bottom: 6px; }
.lb-dest { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.cta-pill { font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--text); background: var(--surface); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th { text-align: left; font-family: var(--mono); font-size: 11px; color: var(--text-3); font-weight: 500; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th[data-sort]::after { content: " ↕"; opacity: .4; }
th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; color: var(--blue-ink); }
th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; color: var(--blue-ink); }
td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td.n { text-align: right; font-family: var(--mono); font-size: 12.5px; }
th.n { text-align: right; }
td.name { white-space: normal; min-width: 220px; font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--hover); }
tr[data-camp] { cursor: pointer; }
table.compare td.name a { color: var(--text); font-weight: 600; }
td.win { color: var(--good); font-weight: 700; }
td.win strong { color: var(--good); }
td.win::before { content: "▲ "; font-size: 9px; vertical-align: 1px; }
td.warn-cell { color: var(--warn); font-weight: 700; }
.best-ad { min-width: 200px; white-space: normal !important; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }

/* ---------- Formulários e botões ---------- */
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--text); width: 100%; padding: 9px 11px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-2); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 150, 255, .15); }
textarea { resize: vertical; line-height: 1.6; }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 450 !important; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
.help { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.narrow { max-width: 820px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap; color: #fff; background: var(--text); border: 1px solid var(--text);
  transition: transform .1s, opacity .15s, background .15s;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-blue { background: var(--blue-ink); border-color: var(--blue-ink); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--hover); opacity: 1; }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--line-2); }
.btn-block { width: 100%; padding: 11px; }
.dark .btn:not(.btn-ghost):not(.btn-danger):not(.btn-blue) { color: #0b0e14; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .75; }
.btn[aria-busy="true"]::before { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }

.acc-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.acc { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 10px; cursor: pointer; text-align: left; }
.acc:hover { border-color: var(--blue); }
.acc span { font-family: var(--mono); color: var(--text-3); }
.danger-zone h2 { color: var(--bad); }

/* ---------- Avisos ---------- */
.flash { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r); margin: 16px 0; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; }
.flash-ok { background: var(--good-wash); color: var(--good); border-color: rgba(17, 153, 75, .2); }
.flash-error { background: var(--bad-wash); color: var(--bad); border-color: rgba(217, 58, 63, .2); }
.notice { padding: 10px 14px; border-radius: var(--r); margin-bottom: 16px; font-size: 13.5px; background: var(--blue-wash); border: 1px solid rgba(26, 150, 255, .2); }
.empty { text-align: center; padding: 44px 24px; color: var(--text-2); }
.empty .btn { margin-top: 14px; }

/* ---------- Relatórios ---------- */
.posts { display: grid; gap: 10px; }
.post-card { display: grid; gap: 3px; padding: 18px 20px; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .2s; }
.post-card:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-pop); }
.post-card h3 { font-size: 16.5px; }
.post-card p { font-size: 13.5px; color: var(--text-2); }
.tag { font-family: var(--mono); background: var(--hover); border-radius: 3px; padding: 0 6px; font-size: 11px; }
.article { max-width: 760px; margin: 18px auto 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 44px 52px; box-shadow: var(--shadow); }
.article h1 { font-size: 32px; letter-spacing: -.035em; margin: 6px 0 26px; text-wrap: balance; }
.article .body { font-size: 16px; line-height: 1.75; }
.article .body > * + * { margin-top: 16px; }
.article .body h2 { font-size: 21px; margin-top: 36px; letter-spacing: -.02em; }
.article .body h3 { font-size: 17px; margin-top: 26px; }
.article .body ul, .article .body ol { padding-left: 22px; }
.article .body li + li { margin-top: 6px; }
.article .body table { display: block; overflow-x: auto; font-size: 14.5px; border: 1px solid var(--line); border-radius: var(--r); }
.article .body th { font-family: var(--font); font-size: 13px; color: var(--text-2); background: var(--surface-2); }
.article .body th, .article .body td { white-space: normal; padding: 10px 14px; }
.attachment { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); color: var(--text); margin-bottom: 24px; background: var(--surface-2); }
.attachment:hover { border-color: var(--blue); text-decoration: none; }
.attachment-icon { background: var(--bad); color: #fff; font-family: var(--mono); font-weight: 600; font-size: 11px; border-radius: 3px; padding: 8px 7px; }
.attachment-img { border-radius: var(--r); margin-bottom: 24px; border: 1px solid var(--line); }

.review-bar {
  position: sticky; top: 12px; z-index: 25; max-width: 760px; margin: 18px auto 0; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 10px 16px; padding: 10px 12px 10px 16px; border-radius: var(--r); background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.review-bar .status-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.review-bar .actions form { margin: 0; }

.editor { border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.editor:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 150, 255, .15); }
.editor-tabs { display: flex; gap: 18px; padding: 0 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.editor-tabs button { position: relative; font-size: 13px; font-weight: 500; color: var(--text-3); background: none; border: 0; padding: 10px 0; cursor: pointer; }
.editor-tabs button[aria-selected="true"] { color: var(--text); }
.editor-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--blue); }
.editor textarea { border: 0; border-radius: 0; box-shadow: none !important; min-height: 420px; font-family: var(--mono); font-size: 13px; }
.editor .preview { padding: 22px 26px; min-height: 420px; max-height: 70vh; overflow: auto; }
.editor .preview.article { box-shadow: none; border: 0; border-radius: 0; margin: 0; max-width: none; }

/* ---------- Entenda os números: explorador ---------- */
.gx { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.gx-nav { position: sticky; top: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.gx-search { position: relative; padding: 10px; border-bottom: 1px solid var(--line); }
.gx-search input { padding-left: 32px; font-size: 13.5px; }
.gx-search .ico { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.gx-list { max-height: calc(100vh - 230px); overflow-y: auto; padding: 6px; }
.gx-group { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); padding: 10px 8px 4px; }
.gx-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 8px; border-radius: var(--r-sm); background: none; border: 0; cursor: pointer; font-size: 13.5px; color: var(--text-2); text-align: left; }
.gx-item:hover { background: var(--hover); color: var(--text); }
.gx-item[aria-selected="true"] { background: var(--blue-wash); color: var(--blue-ink); font-weight: 550; }
.gx-item .calc-dot { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.gx-item[aria-selected="true"] .calc-dot { color: var(--blue-ink); }
.gx-empty { padding: 16px; font-size: 13px; color: var(--text-3); }
.gx-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-height: 480px; }
.gx-term { display: none; padding: 28px 30px 30px; }
.gx-term.on { display: block; animation: panel-in .25s var(--ease); }
.gx-term h2 { font-size: 24px; letter-spacing: -.025em; margin-bottom: 4px; }
.gx-term .group { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-bottom: 18px; display: block; }
.gx-term .lead { font-size: 16px; line-height: 1.65; color: var(--text); max-width: 62ch; }
.gx-notes { display: grid; gap: 10px; margin-top: 18px; max-width: 64ch; }
.gx-notes p { font-size: 14.5px; line-height: 1.6; color: var(--text-2); padding: 10px 14px; border-left: 2px solid var(--line-2); }
.gx-notes p.good { border-color: var(--good); }
.gx-notes b { color: var(--text); font-weight: 600; }

.gx-detail { container-type: inline-size; }
@container (max-width: 560px) {
  .calc-body { grid-template-columns: minmax(0, 1fr); }
  .calc-inputs { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 1200px) { .gx { grid-template-columns: 250px minmax(0, 1fr); } }
.calc { margin-top: 26px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.calc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.calc-head span { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.calc-head button { font-family: var(--mono); font-size: 11px; color: var(--blue-ink); background: none; border: 0; cursor: pointer; }
.calc-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.calc-inputs { display: grid; gap: 12px; padding: 16px; border-right: 1px solid var(--line); }
.calc-inputs label { display: grid; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.calc-inputs input { font-family: var(--mono); font-size: 15px; }
.calc-op { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.calc-out { padding: 16px 18px; display: grid; align-content: center; gap: 8px; }
.calc-out .value { font-family: var(--mono); font-size: 36px; font-weight: 600; letter-spacing: -.03em; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.calc-out .verdict { font-size: 13.5px; color: var(--text-2); }
.gauge { position: relative; height: 6px; margin: 18px 0 22px; border-radius: 3px; background: var(--hover); }
.gauge .fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--blue); transition: width .35s var(--ease); }
.gauge .mark { position: absolute; top: -5px; bottom: -5px; width: 1px; background: var(--text-3); }
.gauge .mark span { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--text-3); white-space: nowrap; }
.gauge.good .fill { background: var(--good); }
.gauge.bad .fill { background: var(--warn); }
.calc-yours { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); padding: 10px 14px; border-top: 1px solid var(--line); }

/* ---------- Exportação (admin) ---------- */
.export-steps ol { margin: 0 0 16px; padding-left: 20px; line-height: 1.7; color: var(--text-2); }
.export-steps ol strong { color: var(--text); }
.export-toggle { margin-bottom: 12px; }
.export-steps .help { margin-bottom: 14px; }
.export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.export-text { min-height: 520px; font-family: var(--mono); font-size: 12px; line-height: 1.55; background: #0b0e14; color: #d7e0f5; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); background: var(--surface); }
.auth-panel { display: grid; grid-template-rows: auto 1fr auto; padding: 32px 48px; }
.auth-panel .brand img { width: 72px; display: block; }
.auth-form { width: 100%; max-width: 360px; align-self: center; justify-self: center; }
.auth-form h1 { font-size: 28px; letter-spacing: -.035em; }
.auth-form .lead { margin: 8px 0 28px; color: var(--text-2); font-size: 14.5px; }
.auth-form .form { gap: 12px; }
.field { position: relative; }
.field input { height: 52px; padding: 20px 12px 6px; }
.field label { position: absolute; left: 13px; top: 15px; font-size: 14.5px; font-weight: 450; color: var(--text-3); pointer-events: none; transform-origin: left top; transition: transform .18s var(--ease), color .18s; }
.field input:focus + label, .field input:not(:placeholder-shown) + label { transform: translateY(-9px) scale(.78); color: var(--text-2); }
.field input:focus + label { color: var(--blue-ink); }
.field .reveal { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-3); cursor: pointer; }
.field .reveal:hover { color: var(--text); background: var(--hover); }
.auth-form .btn-block { height: 48px; font-size: 14.5px; margin-top: 6px; }
.auth-form .flash { margin: -8px 0 20px; }
.auth-form.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-note { font-size: 12.5px; color: var(--text-3); }

.auth-visual { position: relative; overflow: hidden; background: var(--bg); border-left: 1px solid var(--line); display: grid; place-items: center; padding: 48px; }
.auth-visual::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; mask-image: radial-gradient(70% 70% at 50% 45%, #000, transparent); -webkit-mask-image: radial-gradient(70% 70% at 50% 45%, #000, transparent); }
.mock { position: relative; width: min(460px, 100%); display: grid; gap: 12px; }
.mock-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 16px 18px; }
.mock-card .mono { display: flex; justify-content: space-between; }
.mock-big { font-size: 30px; font-weight: 650; letter-spacing: -.03em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.mock-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mock-row .mock-card { padding: 12px 14px; }
.mock-row b { display: block; font-size: 17px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.mock svg { width: 100%; height: 90px; display: block; margin-top: 8px; }
.mock .ml { fill: none; stroke: var(--blue); stroke-width: 2; stroke-dasharray: 600; stroke-dashoffset: 600; animation: spark-draw 2s .3s var(--ease) forwards; }
.mock .ma { fill: url(#mockFill); opacity: 0; animation: fade-in .8s 1.6s forwards; }
.mock .mb { fill: var(--hover); }
.mock-tag { position: absolute; right: 0; top: -28px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.mock > .mock-card:last-child { margin-left: 40px; }

/* ---------- Instalação do app ---------- */
.install-sheet {
  position: fixed; left: 10px; right: 10px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 60; display: grid;
  grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); transform: translateY(160%); transition: transform .45s var(--ease);
}
.install-sheet.show { transform: none; }
.install-sheet img { width: 46px; height: 46px; border-radius: 10px; }
.install-sheet strong { display: block; font-size: 14.5px; }
.install-sheet p { font-size: 13px; color: var(--text-2); line-height: 1.45; margin-top: 2px; }
.install-sheet p .ico { display: inline-block; vertical-align: -4px; color: var(--blue-ink); }
.install-sheet .x { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; align-self: start; }
.install-sheet .btn { grid-column: 1 / -1; }

.foot { color: var(--text-3); font-family: var(--mono); font-size: 11px; padding: 28px 0 6px; text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .6s var(--ease) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero::after { inset: 40% 0 0 0; }
}
@media (max-width: 1000px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
}
@media (max-width: 960px) {
  :root { --sidebar: 0px; }
  .sidebar { display: none; }
  .has-sidebar .content { margin-left: 0; }
  .main { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .grid-1-1 { grid-template-columns: minmax(0, 1fr); }
  .gx { grid-template-columns: minmax(0, 1fr); }
  .gx-nav { position: static; }
  .gx-list { max-height: 260px; }

  .mobile-bar {
    position: sticky; top: 0; z-index: 35; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--glass); border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .mobile-bar img { width: 54px; display: block; }
  .mobile-bar .who { font-size: 13px; text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bar .who strong { font-weight: 600; }
  .mb-menu { position: relative; }
  .mb-menu > summary { list-style: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
  .mb-menu > summary::-webkit-details-marker { display: none; }
  .mb-menu .pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 4px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); animation: pop-in .16s var(--ease); }
  .mb-menu .pop a, .mb-menu .pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: var(--r-sm); font-size: 14.5px; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; }
  .mb-menu .pop a:hover, .mb-menu .pop button:hover { background: var(--hover); text-decoration: none; }
  .mb-menu .pop form { margin: 0; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--glass); border-top: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px 4px; font-size: 10.5px; font-weight: 500; color: var(--text-3); text-decoration: none; }
  .tabbar a.on { color: var(--blue-ink); }
  .tabbar .ico { width: 23px; height: 23px; }

  .page-head { top: calc(51px + env(safe-area-inset-top)); margin: 0 -16px; padding: 16px 16px 12px; }
  .page-head h1 { font-size: 23px; }
  .period-ctrl { width: 100%; flex-wrap: nowrap; }
  .seg { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg a { padding: 5px 7px; font-size: 12px; }
  .date-pop > summary { padding: 6px 8px; }
  .date-pop:not(.on) > summary .label { display: none; }
  .date-pop .pop { right: 0; }
}
@media (max-width: 640px) {
  .hero { padding: 20px 18px; }
  .hero-line { font-size: 24px; }
  .hero-points li:nth-child(n + 4) { display: none; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 12px 14px; }
  .metric .v { font-size: 19px; }
  .metric .spark { width: 48px; }
  .explorer-chart { padding: 14px; }
  .explorer .chart-box { height: 220px; }
  .card { padding: 16px; }
  .chart-box { height: 240px; }
  .donut-box { height: 260px; }
  .diag { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 14px; }
  .camp-list { grid-template-columns: minmax(0, 1fr); }
  .cr-grid { grid-template-columns: minmax(0, 1fr); }
  .cr-thumb { aspect-ratio: 4 / 3; }
  .cr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fstep { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .row2 { grid-template-columns: 1fr; }
  .article { padding: 26px 20px; }
  .article h1 { font-size: 25px; }
  .summary { padding: 16px; }
  .summary-badge { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb-grid { grid-template-columns: minmax(0, 1fr); max-height: none; }
  .lightbox { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; overflow-y: auto; }
  .lb-media { min-height: 0; aspect-ratio: 1 / 1; }
  .lb-side { overflow: visible; }
  .calc-body { grid-template-columns: minmax(0, 1fr); }
  .calc-inputs { border-right: 0; border-bottom: 1px solid var(--line); }
  .gx-term { padding: 20px 18px; }
  .auth-panel { padding: calc(20px + env(safe-area-inset-top)) 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  @view-transition { navigation: none; }
}

/* ===================== Relatórios ===================== */
.rep-feature {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin: 18px 0 32px; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  overflow: hidden; transition: border-color .15s, box-shadow .2s;
}
.rep-feature:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-pop); }
.rep-feature-main { display: grid; align-content: start; gap: 10px; padding: 28px 30px; }
.rep-feature h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.2; letter-spacing: -.03em; text-wrap: balance; }
.rep-excerpt { color: var(--text-2); font-size: 15px; line-height: 1.6; max-width: 62ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rep-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.rep-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.rep-cta { justify-self: start; margin-top: 10px; }
.rep-feature-side {
  position: relative; padding: 28px 26px; border-left: 1px solid var(--line); background: var(--surface-2);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 16px 16px;
}
.rep-toc { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: sec; display: grid; gap: 2px; }
.rep-toc li {
  counter-increment: sec; display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 7px 10px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.rep-toc li::before { content: counter(sec, decimal-leading-zero); font-family: var(--mono); font-size: 11px; color: var(--blue-ink); padding-top: 2px; }

.rep-archive { margin-bottom: 20px; }
.rep-year { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.rep-year > .mono { padding-top: 16px; font-size: 12px; }
.rep-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.rep-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 16px; align-items: center; gap: 16px; padding: 14px 18px;
  color: inherit; border-bottom: 1px solid var(--line); transition: background .12s;
}
.rep-row:last-child { border-bottom: 0; }
.rep-row:hover { background: var(--hover); text-decoration: none; }
.rep-date { font-size: 12px; }
.rep-text { display: grid; gap: 2px; min-width: 0; }
.rep-text strong { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-text .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-side { display: flex; align-items: center; gap: 10px; }
.rep-chevron { color: var(--text-3); font-size: 20px; line-height: 1; transition: transform .15s; }
.rep-row:hover .rep-chevron { transform: translateX(2px); color: var(--blue-ink); }

.rep-empty { max-width: 520px; margin: 48px auto; text-align: center; display: grid; justify-items: center; gap: 10px; }
.rep-empty-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--blue-ink); box-shadow: var(--shadow); }
.rep-empty h2 { font-size: 19px; margin-top: 6px; }
.rep-empty .btn { margin-top: 8px; }

/* Leitura */
.read { max-width: 760px; margin: 0 auto; }
.read.has-toc { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 760px) 220px; gap: 28px; align-items: start; justify-content: center; }
.read .article { margin-left: 0; margin-right: 0; }
.read-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 4px; }
.article .body h2 { scroll-margin-top: 90px; }
.read-toc { position: sticky; top: 100px; margin-top: 18px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.read-toc ol { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 1px; }
.read-toc a { display: block; padding: 6px 8px 6px 10px; border-left: 2px solid var(--line); font-size: 13px; line-height: 1.4; color: var(--text-2); }
.read-toc a:hover { color: var(--text); text-decoration: none; border-color: var(--text-3); }
.read-toc a.on { color: var(--blue-ink); border-color: var(--blue); font-weight: 550; }
.read-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.read-nav a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); color: inherit; transition: border-color .15s, background .15s; }
.read-nav a:hover { text-decoration: none; border-color: var(--line-2); background: var(--hover); }
.read-nav a.next { text-align: right; grid-column: 2; }
.read-nav strong { font-size: 14px; font-weight: 600; }

@media (max-width: 1100px) {
  .read.has-toc { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .read-toc { display: none; }
}
@media (max-width: 760px) {
  .rep-feature { grid-template-columns: minmax(0, 1fr); }
  .rep-feature-main { padding: 22px 20px; }
  .rep-feature-side { border-left: 0; border-top: 1px solid var(--line); padding: 20px; }
  .rep-year { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .rep-year > .mono { padding-top: 0; }
  .rep-row { grid-template-columns: 52px minmax(0, 1fr) 12px; gap: 12px; padding: 13px 14px; }
  .rep-side { display: none; }
  .read-nav { grid-template-columns: minmax(0, 1fr); }
  .read-nav a.next { grid-column: auto; text-align: left; }
}
.rep-feature.solo { grid-template-columns: minmax(0, 1fr); }

/* ---------- Logo claro/escuro e seletor de tema ---------- */
.logo-dark { display: none !important; }
.dark .logo-light { display: none !important; }
.dark .logo-dark { display: block !important; }
.theme-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 8px; }
.theme-switch .mono { font-size: 11px; }
.theme-opts { display: inline-flex; padding: 2px; gap: 1px; border-radius: var(--r); background: var(--hover); border: 1px solid var(--line); }
.theme-opts button {
  width: 30px; height: 26px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--text-3); cursor: pointer; transition: color .15s, background .15s;
}
.theme-opts button:hover { color: var(--text); }
.theme-opts button[aria-checked="true"] { background: var(--surface); color: var(--blue-ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(11, 21, 48, .08); }
.mb-menu .theme-switch { padding: 8px 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.auth-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-tools .theme-switch { padding: 0; }
.mb-menu .pop .theme-opts button { display: grid; width: 30px; height: 26px; padding: 0; font-size: 0; }
.mb-menu .pop .theme-opts button:hover { background: none; }
.mb-menu .pop .theme-opts button[aria-checked="true"] { background: var(--surface); }
