:root {
  --ink: #17231b;
  --muted: #68746d;
  --soft: #f3f7f3;
  --line: #dce8de;
  --paper: #ffffff;
  --charcoal: #0f1f15;
  --brand-red: #df0707;
  --brand-red-dark: #b80505;
  --brand-red-soft: #fff1f1;
  --brand-green: #0c6f18;
  --brand-green-dark: #084d12;
  --yellow: #df0707;
  --green: #0c7a1c;
  --green-soft: #e8f6eb;
  --blue: #0c6f18;
  --orange: #c66a05;
  --red: #df0707;
  --rank-mid: #f3c343;
  --gray-cell: #d9dee5;
  --shadow: 0 14px 32px rgba(12, 57, 20, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

button {
  font: inherit;
}

.site-header {
  background:
    radial-gradient(circle at 8% 18%, rgba(223, 7, 7, 0.24), transparent 30%),
    linear-gradient(135deg, var(--brand-green-dark), #111915 58%, #2a0c0c);
  color: #fff;
  border-bottom: 5px solid var(--brand-red);
}

.header-inner {
  width: min(1500px, calc(100vw - 48px));
  margin: 0 auto;
  min-height: 150px;
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 265px;
  gap: 28px;
  align-items: center;
  padding: 22px 0;
}

.brand-mark {
  width: 185px;
  height: 112px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(223, 7, 7, 0.26);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.brand-mark img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.site-header .eyebrow {
  color: #ff6666;
}

.header-copy h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: 0;
}

.subhead {
  max-width: 760px;
  margin: 12px 0 0;
  color: #dce8df;
  font-size: 16px;
}

.gmb-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.gmb-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f4f6f8;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
}

.gmb-details b {
  flex: 0 0 auto;
  margin-right: 8px;
  color: #ff6666;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.gmb-chip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.gmb-details a {
  color: #fff;
}

.gmb-details a:hover {
  border-color: rgba(255, 102, 102, 0.78);
  background: rgba(223, 7, 7, 0.14);
}

.header-meta {
  justify-self: end;
  width: 100%;
  border: 1px solid rgba(255, 102, 102, 0.28);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.header-meta span,
.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.header-meta span {
  color: #bbc2cc;
}

.header-meta strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

#printButton {
  width: 100%;
  height: 38px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

#printButton:hover {
  background: var(--brand-red-dark);
}

.page-shell {
  width: min(1500px, calc(100vw - 48px));
  margin: 24px auto 48px;
}

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

.overview-card,
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overview-card {
  padding: 18px;
  min-height: 100px;
  border-top: 4px solid rgba(12, 111, 24, 0.24);
}

.overview-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
}

.overview-card.positive strong {
  color: var(--green);
}

.overview-card.positive {
  border-top-color: var(--brand-red);
}

.panel {
  padding: 22px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.section-heading p:not(.eyebrow) {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.positive-panel {
  margin-bottom: 18px;
}

.positive-movers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.positive-card {
  border: 1px solid #bee6c5;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--green-soft), #fff);
  padding: 16px;
}

.positive-card h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.positive-card .metric-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid #bee6c5;
  padding-top: 12px;
}

.positive-card .metric-line > span {
  min-width: 0;
}

.positive-card strong {
  color: var(--green);
  display: block;
  font-size: 20px;
  line-height: 1.05;
  white-space: nowrap;
}

.report-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.keyword-panel {
  position: sticky;
  top: 18px;
}

.keyword-list {
  display: grid;
  gap: 10px;
}

.keyword-button {
  width: 100%;
  min-height: 82px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 12px;
}

.keyword-button.active {
  border-color: var(--brand-green-dark);
  box-shadow: inset 5px 0 0 var(--brand-red);
}

.keyword-button strong {
  display: block;
  font-size: 15px;
  margin-bottom: 8px;
}

.keyword-button .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.delta {
  font-weight: 800;
}

.delta.positive {
  color: var(--green);
}

.delta.negative {
  color: var(--red);
}

.delta.neutral,
.delta.empty {
  color: var(--muted);
}

.detail-topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.detail-topline h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

.selected-date {
  min-width: 220px;
  text-align: right;
}

.selected-date span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.selected-date strong {
  display: block;
  margin-top: 7px;
  font-size: 30px;
}

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

.metric-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.metric-box strong {
  display: block;
  margin-top: 7px;
  font-size: 23px;
}

.visual-layout {
  display: grid;
  grid-template-columns: minmax(410px, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
}

.grid-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.grid-card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.grid-card-head h3 {
  margin: 0;
  font-size: 18px;
}

.grid-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.top {
  background: var(--green);
}

.legend-dot.mid {
  background: var(--rank-mid);
}

.legend-dot.low {
  background: var(--orange);
}

.legend-dot.none {
  background: var(--gray-cell);
}

.rank-grid {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f5;
}

.grid-shot {
  display: block;
  width: 100%;
  aspect-ratio: 1080 / 567;
  object-fit: cover;
}

.trend-chart {
  min-height: 290px;
}

.trend-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.trend-axis {
  stroke: #cbd3dc;
  stroke-width: 1;
}

.trend-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-dot {
  fill: var(--paper);
  stroke: var(--blue);
  stroke-width: 3;
}

.trend-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.timeline-section {
  margin-top: 22px;
}

.timeline-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 12px;
}

.timeline-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.timeline-button.active {
  border-color: var(--brand-green-dark);
  box-shadow: inset 0 4px 0 var(--brand-red);
}

.timeline-button strong {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}

.timeline-button .mini-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.mini-grid {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #eef2f5;
}

.mini-shot {
  display: block;
  width: 100%;
  aspect-ratio: 1080 / 567;
  object-fit: cover;
}

.latest-panel {
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 870px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  background: var(--brand-green-dark);
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td strong {
  display: block;
  margin-bottom: 2px;
}

td .sub {
  color: var(--muted);
  font-size: 12px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f7fbf7;
}

tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .header-inner,
  .report-grid,
  .visual-layout {
    grid-template-columns: 1fr;
  }

  .header-meta {
    justify-self: stretch;
  }

  .keyword-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .header-inner,
  .page-shell {
    width: min(100vw - 24px, 1500px);
  }

  .overview-grid,
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading,
  .detail-topline,
  .grid-card-head {
    display: block;
  }

  .selected-date {
    text-align: left;
    margin-top: 12px;
  }

  .header-copy h1 {
    font-size: 32px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-header {
    break-after: avoid;
  }

  #printButton,
  .keyword-panel,
  .timeline-button:not(.active) {
    display: none;
  }

  .page-shell {
    width: 100%;
    margin: 16px 0;
  }

  .panel,
  .overview-card {
    box-shadow: none;
  }
}
