:root {
  --ink: #373737;
  --green: #9bbe34;
  --blue: #1d8eac;
  --pale: #f4fff5;
  --mist: #eaf4f2;
  --line: #dce8e4;
  --muted: #727b7c;
  --white: #fff;
  --shadow: 0 20px 60px rgba(55, 55, 55, 0.12);
  font-family: Raleway, Aptos, Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef6f2;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: var(--ink);
  color: var(--white);
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 16px solid var(--green);
}

.rail::after {
  content: "";
  position: absolute;
  top: 0;
  right: -32px;
  width: 16px;
  height: 100%;
  background: var(--blue);
}

.rail img {
  width: 210px;
  background: var(--white);
  padding: 14px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a, button, .rail-actions a {
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  font: inherit;
}

nav a {
  color: var(--white);
  text-decoration: none;
  background: rgba(255,255,255,.08);
}

nav a:hover, button:hover, .rail-actions a:hover { filter: brightness(.96); }

.rail-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

button {
  cursor: pointer;
  background: var(--green);
  color: var(--ink);
  font-weight: 800;
}

button:nth-child(2) { background: var(--white); }
button:nth-child(3) { background: var(--blue); color: var(--white); }
.rail-actions a {
  cursor: pointer;
  background: var(--blue);
  color: var(--white);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

main {
  padding: 32px clamp(24px, 5vw, 70px) 80px;
  display: grid;
  gap: 32px;
}

.cover, .section {
  background: var(--white);
  box-shadow: var(--shadow);
}

.cover {
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: stretch;
  background: linear-gradient(259deg, var(--green), var(--blue));
  color: var(--white);
  padding: clamp(34px, 6vw, 82px);
}

.cover h1 {
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1;
  margin: 28px 0;
  max-width: 720px;
  overflow-wrap: normal;
  word-break: normal;
}

.lead {
  font-size: clamp(20px, 2.3vw, 30px);
  line-height: 1.2;
  max-width: 780px;
}

.date-line {
  margin-top: 70px;
  border-top: 5px solid currentColor;
  padding-top: 24px;
  font-size: 19px;
  max-width: 680px;
}

.cover-panel {
  background: rgba(255,255,255,.92);
  color: var(--ink);
  padding: 28px;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 28px;
}

.cover-panel img { width: 100%; }
.cover-panel span { font-weight: 900; font-size: 21px; }

.cover .eyebrow {
  color: var(--ink);
}

.section {
  padding: clamp(28px, 5vw, 64px);
  scroll-margin-top: 24px;
}

.section.pale { background: var(--pale); }
header { max-width: 1020px; margin-bottom: 34px; }
.eyebrow {
  margin: 0 0 18px;
  color: var(--blue);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(34px, 4.5vw, 58px);
  line-height: 1.04;
}

h3 {
  margin: 0 0 20px;
  font-size: 26px;
}

header p:not(.eyebrow) {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.kpi-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.kpi {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 8px solid var(--ink);
  padding: 24px;
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 12px;
}

.kpi.green { border-left-color: var(--green); }
.kpi.blue { border-left-color: var(--blue); }
.kpi span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 13px;
}
.kpi strong {
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1;
}
.kpi.green strong { color: var(--green); }
.kpi.blue strong { color: var(--blue); }
.kpi small { color: var(--muted); font-size: 14px; }

.insight-grid, .action-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.insight-grid article, .action-grid article, .card, .callout {
  border: 1px solid var(--line);
  background: var(--white);
}

.insight-grid article {
  background: var(--pale);
  padding: 24px;
  font-weight: 900;
  font-size: 18px;
}

.split, .comparison {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: start;
}

.card {
  padding: 28px;
}

.bar-row {
  display: grid;
  grid-template-columns: 170px 1fr 120px;
  gap: 16px;
  align-items: center;
  min-height: 42px;
}

.bar-row span { font-weight: 900; }
.bar-row div {
  height: 18px;
  background: var(--mist);
}
.bar-row i {
  display: block;
  height: 18px;
  min-width: 8px;
  background: var(--green);
}
.blue-bar { background: var(--blue) !important; }
.dark-bar { background: var(--ink) !important; }
.mint-bar { background: #6fbf9a !important; }
.bar-row b { color: var(--muted); font-weight: 500; }

.callout {
  margin-top: 24px;
  padding: 24px 28px;
  border-top: 8px solid var(--blue);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}

.chart-card {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 0;
}

.chart-card.ads-style {
  overflow: hidden;
}

.ads-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.ads-metric {
  min-height: 116px;
  padding: 20px 24px;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 8px;
}

.ads-metric:last-child {
  border-right: 0;
}

.ads-metric span {
  color: var(--ink);
  font-weight: 900;
  font-size: 14px;
}

.ads-metric strong {
  color: var(--ink);
  font-size: clamp(30px, 3.5vw, 42px);
  line-height: 1;
}

.ads-metric small {
  color: var(--muted);
  font-size: 13px;
}

.metric-total {
  background: #f6aa00;
}

.metric-meta {
  background: var(--green);
}

.metric-google {
  background: var(--blue);
}

.metric-total span,
.metric-total strong,
.metric-total small,
.metric-meta span,
.metric-meta strong,
.metric-meta small,
.metric-google span,
.metric-google strong,
.metric-google small {
  color: var(--white);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 22px 28px 0;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-legend i {
  width: 14px;
  height: 14px;
  display: inline-block;
}

.legend-total { background: #f6aa00; }
.legend-meta { background: var(--green); }
.legend-google { background: var(--blue); }

.evolution-chart-wrap {
  position: relative;
  overflow-x: auto;
  padding: 0 22px 24px;
}

.evolution-chart {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.chart-plot-bg {
  fill: #fafafa;
}

.chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.chart-axis text,
.bar-label,
.bar-total {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.bar-label,
.bar-total {
  text-anchor: middle;
}

.bar-total {
  fill: var(--ink);
  font-size: 16px;
}

.chart-lines polyline {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-total {
  stroke: #f6aa00;
}

.line-meta {
  stroke: var(--green);
}

.line-google {
  stroke: var(--blue);
}

.point-total,
.point-meta,
.point-google {
  stroke: var(--white);
  stroke-width: 3;
}

.point-total {
  fill: #f6aa00;
}

.point-meta {
  fill: var(--green);
}

.point-google {
  fill: var(--blue);
}

.month-guide {
  opacity: 0;
  stroke: rgba(55,55,55,.18);
  stroke-width: 12;
}

.chart-hitbox {
  fill: transparent;
  cursor: pointer;
}

.evolution-month {
  outline: none;
}

.evolution-month:hover .month-guide,
.evolution-month:focus .month-guide {
  opacity: 1;
}

.evolution-month:hover circle,
.evolution-month:focus circle {
  r: 8px;
}

.evolution-month:hover .bar-total,
.evolution-month:focus .bar-total {
  fill: var(--ink);
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 210px;
  padding: 14px 16px;
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 16px 40px rgba(55,55,55,.18);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -110%);
  transition: opacity .12s ease;
  font-size: 14px;
  line-height: 1.35;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip b {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 16px;
}

.chart-tooltip span {
  display: block;
}

.screenshot {
  margin: 30px 0 0;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 18px;
}
.screenshot img {
  display: block;
  width: 100%;
}
.screenshot figcaption {
  margin-top: 18px;
  color: var(--muted);
  font-size: 16px;
}

.stacked {
  display: grid;
  gap: 20px;
}
.stacked article, .action-grid article {
  padding: 26px;
  border-top: 8px solid var(--blue);
  line-height: 1.35;
  font-size: 17px;
}
.stacked article:first-child, .action-grid article:first-child { border-top-color: var(--green); }
.action-grid article:last-child { border-top-color: var(--ink); }

.linkedin-detail, .demographic-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.linkedin-detail article, .demographic-grid article {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 8px solid var(--blue);
  padding: 28px;
  font-size: 18px;
  line-height: 1.35;
}

.linkedin-detail article:first-child, .demographic-grid article:first-child {
  border-top-color: var(--green);
}

.demographic-grid article:nth-child(3) {
  border-top-color: var(--green);
}

.demographic-grid article:nth-child(4) {
  border-top-color: var(--ink);
}

.demographic-table {
  margin-top: 14px;
  display: grid;
  border: 1px solid var(--line);
  background: var(--white);
  overflow-x: auto;
}

.table-title {
  margin: 34px 0 0;
  font-size: 24px;
}

.demographic-table > div {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(150px, 1fr));
  min-width: 680px;
  border-bottom: 1px solid var(--line);
}

.demographic-table.wide > div {
  grid-template-columns: minmax(180px, 1.2fr) repeat(8, minmax(130px, 1fr));
  min-width: 1220px;
}

.demographic-table.wide.geo-8 > div {
  grid-template-columns: minmax(180px, 1.2fr) repeat(7, minmax(130px, 1fr));
  min-width: 1090px;
}

.demographic-table.linkedin-summary > div {
  grid-template-columns: minmax(190px, 1.2fr) minmax(180px, 1.1fr) repeat(5, minmax(130px, 1fr));
  min-width: 980px;
}

.demographic-table > div:last-child {
  border-bottom: 0;
}

.demographic-table b,
.demographic-table span {
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.25;
}

.demographic-table b {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
}

.demographic-table span:first-child {
  font-weight: 900;
  color: var(--ink);
}

.demographic-table > div:nth-child(even) {
  background: #f8fbfa;
}

.bullets {
  display: grid;
  gap: 20px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}
.bullets li {
  position: relative;
  padding-left: 34px;
  font-size: 20px;
  line-height: 1.35;
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 16px;
  height: 16px;
  background: var(--green);
  border-radius: 50%;
}
.bullets li:nth-child(2)::before { background: var(--blue); }

.plan-table {
  display: grid;
  gap: 12px;
}
.plan-table > div {
  display: grid;
  grid-template-columns: 150px 160px minmax(260px, 1fr) 220px;
  gap: 22px;
  align-items: center;
  padding: 18px 22px;
  background: var(--white);
  border: 1px solid var(--line);
}
.plan-table > div:first-child {
  background: transparent;
  border: 0;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
}
.plan-table span:first-child {
  color: var(--blue);
  font-weight: 900;
  font-size: 20px;
}
.plan-table span:nth-child(2) { font-weight: 900; }

[contenteditable="true"] {
  outline: 2px solid transparent;
  border-radius: 4px;
}
[contenteditable="true"]:hover { outline-color: rgba(29,142,172,.25); }
[contenteditable="true"]:focus {
  outline-color: var(--blue);
  background: rgba(255,255,255,.55);
}

@media (max-width: 1050px) {
  body { grid-template-columns: 1fr; }
  .rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 10px solid var(--green);
  }
  .rail::after { display: none; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .rail-actions { grid-template-columns: repeat(3, 1fr); }
  .cover, .split, .comparison { grid-template-columns: 1fr; }
  .cover-panel { max-width: 420px; }
  .kpi-grid, .kpi-grid.compact, .insight-grid, .action-grid, .linkedin-detail, .demographic-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 680px) {
  main { padding: 18px; }
  nav, .rail-actions, .kpi-grid, .kpi-grid.compact, .insight-grid, .action-grid, .linkedin-detail, .demographic-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 6px; }
  .plan-table > div { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4 landscape; margin: 7mm; }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  html,
  body {
    width: auto;
    min-height: auto;
    background: #eef6f2;
    font-size: 12px;
  }
  body { display: block; }
  .rail { display: none; }
  main {
    padding: 0;
    display: block;
  }
  .cover, .section {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 7mm 8mm;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
    page-break-inside: auto;
    break-inside: auto;
    overflow: visible;
  }
  .cover {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 68mm;
    gap: 5mm;
  }
  .cover h1 {
    font-size: 32px;
    margin: 12px 0;
  }
  .lead {
    font-size: 16px;
    line-height: 1.2;
  }
  .date-line {
    margin-top: 20px;
    padding-top: 10px;
    border-top-width: 3px;
    font-size: 12px;
  }
  .cover-panel {
    padding: 12px;
    gap: 12px;
  }
  .cover-panel span {
    font-size: 16px;
  }
  h2 {
    font-size: 26px;
    margin: 0 0 8px;
  }
  h3 {
    margin: 0 0 10px;
    font-size: 18px;
  }
  header {
    margin-bottom: 4mm;
  }
  .eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
  }
  header p:not(.eyebrow) {
    margin: 0;
    font-size: 13px;
    line-height: 1.25;
  }
  .kpi-grid,
  .kpi-grid.compact,
  .insight-grid,
  .action-grid,
  .linkedin-detail,
  .demographic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .comparison,
  .split {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .kpi {
    min-height: 76px;
    padding: 12px;
    gap: 6px;
  }
  .kpi span {
    font-size: 10px;
  }
  .kpi strong {
    font-size: 24px;
  }
  .kpi small {
    font-size: 10px;
  }
  .insight-grid article,
  .action-grid article,
  .card,
  .callout,
  .linkedin-detail article,
  .demographic-grid article,
  .stacked article {
    padding: 12px;
    font-size: 12px;
    line-height: 1.25;
  }
  .stacked {
    gap: 8px;
  }
  .bar-row {
    grid-template-columns: 120px 1fr 78px;
    gap: 8px;
    min-height: 28px;
  }
  .bar-row div,
  .bar-row i {
    height: 12px;
  }
  .callout {
    margin-top: 8px;
    padding: 12px 14px;
    border-top-width: 5px;
    font-size: 13px;
  }
  .ads-metric {
    min-height: 72px;
    padding: 10px 12px;
    gap: 4px;
  }
  .ads-metric span {
    font-size: 10px;
  }
  .ads-metric strong {
    font-size: 22px;
  }
  .ads-metric small {
    font-size: 10px;
  }
  .chart-legend {
    gap: 10px;
    padding: 10px 12px 0;
    margin-bottom: 2px;
    font-size: 10px;
  }
  .chart-card,
  .screenshot,
  .demographic-table,
  .card,
  .callout,
  .insight-grid article,
  .action-grid article,
  .linkedin-detail article,
  .demographic-grid article {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .evolution-chart-wrap,
  .demographic-table {
    overflow: visible;
  }
  .evolution-chart {
    min-width: 0;
    max-height: 96mm;
  }
  .chart-axis text,
  .bar-label,
  .bar-total {
    font-size: 11px;
  }
  .screenshot {
    margin-top: 10px;
    padding: 10px;
  }
  .screenshot img {
    max-height: 90mm;
    object-fit: contain;
  }
  .screenshot figcaption {
    margin-top: 8px;
    font-size: 11px;
  }
  .table-title {
    margin: 12px 0 0;
    font-size: 18px;
  }
  .demographic-table {
    margin-top: 8px;
  }
  .demographic-table > div,
  .demographic-table.wide > div,
  .demographic-table.linkedin-summary > div {
    min-width: 0;
  }
  .demographic-table > div {
    grid-template-columns: minmax(110px, 1.25fr) repeat(3, minmax(72px, 1fr));
  }
  .demographic-table.wide > div {
    grid-template-columns: minmax(86px, 1.15fr) repeat(8, minmax(54px, 1fr));
  }
  .demographic-table.wide.geo-8 > div {
    grid-template-columns: minmax(90px, 1.15fr) repeat(7, minmax(62px, 1fr));
  }
  .demographic-table.linkedin-summary > div {
    grid-template-columns: minmax(120px, 1.2fr) minmax(115px, 1.1fr) repeat(5, minmax(70px, 1fr));
  }
  .demographic-table b,
  .demographic-table span {
    padding: 5px 4px;
    font-size: 8px;
    line-height: 1.15;
  }
  .demographic-table b {
    font-size: 7px;
  }
  .source-image img,
  .screenshot img {
    max-width: 100%;
    height: auto;
  }
  .cover:last-child,
  .section:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .chart-tooltip { display: none; }
  [contenteditable="true"] { outline: none !important; }

  #evolucao-resultados {
    padding: 6mm 7mm;
    page-break-before: always;
    break-before: page;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  #evolucao-resultados header {
    margin-bottom: 3mm;
    page-break-after: avoid;
    break-after: avoid;
  }
  #evolucao-resultados h2 {
    font-size: 22px;
    margin-bottom: 6px;
  }
  #evolucao-resultados .chart-card {
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-before: avoid;
    break-before: avoid;
  }
  #evolucao-resultados .ads-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #evolucao-resultados .ads-metric {
    min-height: 58px;
    padding: 8px 10px;
    gap: 3px;
  }
  #evolucao-resultados .ads-metric span {
    font-size: 9px;
  }
  #evolucao-resultados .ads-metric strong {
    font-size: 19px;
  }
  #evolucao-resultados .ads-metric small {
    font-size: 9px;
  }
  #evolucao-resultados .chart-legend {
    padding: 8px 10px 0;
    margin-bottom: 0;
    font-size: 9px;
  }
  #evolucao-resultados .evolution-chart-wrap {
    padding: 0 10px 10px;
  }
  #evolucao-resultados .evolution-chart {
    max-height: 72mm;
  }
  #evolucao-resultados .chart-axis text,
  #evolucao-resultados .bar-label,
  #evolucao-resultados .bar-total {
    font-size: 10px;
  }
}
