:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #f9faf8;
  --ink: #121615;
  --muted: #66706a;
  --line: #d9e1dc;
  --panel: #17221f;
  --panel-line: #2c3a35;
  --panel-muted: #b8c7c0;
  --green: #14745f;
  --green-soft: #e8f5ef;
  --blue: #2b64d8;
  --blue-soft: #edf3ff;
  --rose: #b94263;
  --rose-soft: #fff0f4;
  --amber: #9b6512;
  --amber-soft: #fff6df;
  --shadow: 0 16px 34px rgba(18, 22, 21, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0)) 0 0 / 100% 340px no-repeat,
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 52px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 4px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.45rem);
  line-height: 0.94;
  max-width: 920px;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.15;
}

.lede {
  margin-top: 10px;
  color: var(--muted);
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

.report-stamp {
  min-width: 230px;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  color: var(--muted);
}

.report-stamp span,
.report-stamp strong {
  display: block;
}

.report-stamp span {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-stamp strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.95rem;
}

.filter-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

select,
.segmented {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

select {
  min-width: 190px;
  padding: 0 34px 0 12px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  overflow: hidden;
}

.segmented button {
  min-width: 94px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--ink);
  color: #ffffff;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--panel);
  color: #ffffff;
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-panel .eyebrow {
  color: #8fd0aa;
}

.hero-copy {
  display: grid;
  align-content: center;
  min-height: 156px;
}

.hero-copy h2 {
  max-width: 780px;
  font-size: clamp(1.9rem, 4vw, 3.6rem);
  line-height: 0.98;
}

.hero-subtitle {
  margin-top: 12px;
  color: var(--panel-muted);
  font-size: 1rem;
  line-height: 1.5;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hero-stat {
  display: grid;
  align-content: space-between;
  min-height: 156px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
}

.hero-stat span,
.hero-stat strong,
.hero-stat small {
  display: block;
}

.hero-stat span {
  color: var(--panel-muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-stat strong {
  margin-top: 12px;
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  line-height: 1;
}

.hero-stat small {
  margin-top: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

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

.metric-card {
  min-height: 150px;
  padding: 14px;
}

.metric-top {
  min-height: 50px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
}

.tag.instagram {
  background: var(--rose-soft);
  color: var(--rose);
}

.tag.facebook {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1;
}

.metric-card .metric-label {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.delta {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 23px;
  margin-top: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

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

.delta.negative {
  background: var(--rose-soft);
  color: var(--rose);
}

.delta.neutral {
  background: var(--amber-soft);
  color: var(--amber);
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 12px;
  margin-top: 12px;
}

.panel {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.trend-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.trend-block {
  display: grid;
  gap: 10px;
}

.trend-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.trend-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 62px;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
}

.trend-row span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.trend-row strong {
  text-align: right;
  font-size: 0.8rem;
}

.bar-track,
.split-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0ed;
}

.bar-fill,
.split-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.trend-block:nth-child(2) .bar-fill {
  background: var(--blue);
}

.trend-block:nth-child(3) .bar-fill {
  background: var(--rose);
}

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

.split-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.split-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.split-row-head strong {
  font-size: 0.94rem;
}

.split-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.split-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.split-metrics strong {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
}

.content-section {
  margin-top: 16px;
}

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

.post-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) minmax(300px, auto);
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.post-thumb {
  width: 118px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.post-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-thumb-link {
  display: block;
}

.thumb-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.post-copy {
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.post-date,
.post-type {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.post-caption {
  max-width: 720px;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
  text-decoration: none;
}

.post-link:hover {
  border-color: var(--ink);
}

.post-link.disabled {
  color: var(--muted);
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 6px;
  min-width: 300px;
}

.metric-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px;
}

.metric-pill strong,
.metric-pill span {
  display: block;
}

.metric-pill strong {
  font-size: 1rem;
  line-height: 1.05;
}

.metric-pill span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-panel,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    min-width: 0;
  }
}

@media (max-width: 860px) {
  .masthead {
    grid-template-columns: 1fr;
  }

  .report-stamp {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
  }

  .filter-bar,
  .controls {
    justify-content: flex-start;
  }

  .trend-matrix {
    grid-template-columns: 1fr;
  }

  .post-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .post-thumb {
    width: 92px;
  }

  .metric-list {
    grid-column: 1 / -1;
    min-width: 0;
  }
}

@media (max-width: 600px) {
  .shell {
    width: min(100vw - 20px, 1240px);
    padding-top: 16px;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.2rem);
  }

  .controls,
  .control,
  select,
  .segmented {
    width: 100%;
  }

  .segmented {
    grid-auto-flow: row;
  }

  .segmented button {
    min-height: 38px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-panel {
    padding: 16px;
  }

  .hero-stats,
  .kpi-grid,
  .split-metrics {
    grid-template-columns: 1fr;
  }

  .hero-stat {
    min-height: 112px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

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