@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap");
:root {
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #171b1f;
  --muted: #667078;
  --line: #dbe1e4;
  --red: #d0001b;
  --red-dark: #9f0017;
  --teal: #08736c;
  --amber: #a35f00;
  --blue: #285b8f;
  --shadow: 0 18px 45px rgba(23, 27, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(208, 0, 27, 0.06), transparent 360px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--red-dark);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0 auto;
  max-width: 1480px;
  padding: 22px;
}

.hero-band,
.panel,
.mini-stat {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-band {
  overflow: hidden;
}

.hero-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  padding: 34px;
}

.hero-copy {
  max-width: 920px;
}

.eyebrow {
  color: var(--red-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2.15rem, 4vw, 4.4rem);
  font-weight: 850;
  letter-spacing: 0;
  line-height: 0.98;
  margin-bottom: 18px;
  max-width: 900px;
}

h2 {
  font-size: clamp(1.22rem, 2vw, 1.75rem);
  font-weight: 820;
  letter-spacing: 0;
  line-height: 1.12;
  margin-bottom: 0;
}

h3 {
  font-size: 1rem;
  margin: 22px 0 8px;
}

.thesis {
  color: #394148;
  font-size: clamp(1.05rem, 1.7vw, 1.32rem);
  line-height: 1.55;
  margin: 0;
  max-width: 860px;
}

.hero-metric {
  align-self: stretch;
  background:
    linear-gradient(135deg, rgba(208, 0, 27, 0.12), rgba(8, 115, 108, 0.12)),
    var(--surface-soft);
  border: 1px solid #cfd7da;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 250px;
  padding: 28px;
}

.hero-metric span,
.mini-stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-metric strong {
  color: var(--red-dark);
  font-size: clamp(4rem, 9vw, 7rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.9;
  margin: 10px 0 16px;
}

.hero-metric p,
.mini-stat p,
.panel p,
.insight-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
}

.period-strip {
  align-items: center;
  background: #171b1f;
  color: #f7fafb;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 15px 34px;
}

.period-strip span {
  color: #aeb8bf;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.period-strip a {
  color: #ffffff;
}

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

.mini-stat {
  box-shadow: none;
  min-height: 150px;
  padding: 22px;
}

.mini-stat strong {
  color: var(--ink);
  display: block;
  font-size: clamp(2rem, 3vw, 3.1rem);
  font-weight: 850;
  line-height: 1;
  margin: 12px 0;
}

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

.section-grid--wide {
  grid-template-columns: minmax(0, 2fr) minmax(330px, 1fr);
}

.panel {
  min-width: 0;
  padding: 24px;
}

.panel--large {
  min-height: 420px;
}

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

.badge,
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #47515a;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
  padding: 7px 10px;
  white-space: nowrap;
}

.pill {
  background: #fff7f7;
  border-color: #f2c4ca;
  color: var(--red-dark);
  white-space: normal;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(160px, 250px) 1fr 58px;
}

.bar-row__meta {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.bar-row__meta span {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.bar-row__meta strong,
.topic-row em {
  font-style: normal;
  font-weight: 850;
}

.bar-track {
  align-self: center;
  background: #e8edef;
  border-radius: 999px;
  height: 11px;
  overflow: hidden;
}

.bar-track span {
  background: var(--teal);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.bar-row.is-highlight .bar-track span {
  background: var(--red);
}

.bar-row.is-highlight .bar-row__meta span,
.bar-row.is-highlight .bar-row__meta strong {
  color: var(--red-dark);
}

.bar-row small {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.interpretation {
  background:
    linear-gradient(180deg, rgba(8, 115, 108, 0.08), transparent),
    var(--surface);
}

.interpretation h2 {
  color: var(--teal);
  margin-bottom: 18px;
}

.interpretation p + p {
  margin-top: 14px;
}

.insight-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.insight-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 8px;
  min-height: 176px;
  padding: 18px;
}

.insight-card span {
  color: #394148;
  display: block;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.28;
  margin-bottom: 12px;
}

.insight-card strong {
  color: var(--ink);
  display: block;
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.tone-contrast {
  border-left-color: var(--blue);
}

.tone-narrow {
  border-left-color: var(--amber);
}

.tone-reading {
  border-left-color: var(--teal);
}

.chart-panel {
  min-height: 310px;
}

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

.month-chart line {
  stroke: #9aa5ab;
  stroke-width: 1;
}

.month-total {
  fill: #cbd5da;
}

.month-ai-line {
  fill: none;
  stroke: var(--red);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.month-ai-dot {
  fill: var(--surface);
  stroke: var(--red);
  stroke-width: 4;
}

.month-chart text {
  fill: var(--muted);
  font-size: 20px;
  font-weight: 750;
}

.month-ai-label {
  fill: var(--red-dark) !important;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}

.chart-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 750;
  gap: 8px;
}

.chart-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 24px;
}

.legend-total {
  background: #cbd5da;
}

.legend-ai {
  background: var(--red);
}

.table-panel {
  padding-bottom: 10px;
}

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

table {
  border-collapse: collapse;
  min-width: 1180px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf1f3;
  color: #47515a;
  font-size: 0.78rem;
  font-weight: 850;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

td {
  color: #303840;
  font-size: 0.92rem;
}

td strong {
  color: var(--ink);
  display: block;
  font-weight: 800;
  line-height: 1.35;
  max-width: 470px;
}

td small {
  color: var(--muted);
  display: block;
  font-weight: 650;
  line-height: 1.35;
  margin-top: 6px;
}

.topic-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.topic-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 44px minmax(0, 1fr) 88px 72px;
  padding: 12px 14px;
}

.topic-row:last-child {
  border-bottom: 0;
}

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

.topic-row strong {
  overflow-wrap: anywhere;
}

.topic-row small {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.method-panel p {
  margin-bottom: 14px;
}

.method-panel ul {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  padding-left: 20px;
}

.method-panel li + li {
  margin-top: 8px;
}

.source-note {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .section-grid,
  .section-grid--wide,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-shell {
    padding: 12px;
  }

  .hero-grid,
  .kpi-grid,
  .section-grid,
  .section-grid--wide,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid,
  .period-strip,
  .panel,
  .mini-stat {
    padding: 18px;
  }

  .hero-metric {
    min-height: auto;
  }

  .period-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading {
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-row small {
    text-align: left;
  }

  .table-wrap {
    border: 0;
    max-height: none;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
  }

  td {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    grid-template-columns: 105px minmax(0, 1fr);
  }

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

  td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  td strong {
    max-width: none;
  }

  .topic-row {
    grid-template-columns: 34px minmax(0, 1fr) 70px;
  }

  .topic-row small {
    grid-column: 2 / 4;
    text-align: left;
  }
}
