:root {
  --ink: #17202a;
  --muted: #5f6f7d;
  --line: #d7e0e8;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --navy: #19324d;
  --teal: #0f766e;
  --rose: #be3a5b;
  --gold: #b7791f;
  --green: #287a45;
  --blue: #2f6fab;
  --shadow: 0 18px 45px rgba(25, 50, 77, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef5f7 0, #f9fbfd 320px, #ffffff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 34px clamp(18px, 4vw, 56px) 22px;
  background: var(--navy);
  color: white;
}

.eyebrow {
  margin: 0 0 7px;
  color: #a8dadc;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  font-weight: 850;
}

.last-updated {
  margin-top: 10px;
  color: #cfe7ec;
  font-size: 0.92rem;
  font-weight: 750;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.excel-link,
.article-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  color: white;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

main {
  width: min(1480px, calc(100% - 36px));
  margin: 22px auto 48px;
}

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

.metric,
.viz-panel,
.article-card,
.controls,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 104px;
  padding: 18px;
  border-radius: 8px;
  display: grid;
  align-content: space-between;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

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

.controls {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 2fr repeat(5, 1fr);
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c7d3df;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.viz-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.35fr 0.85fr 0.85fr;
  gap: 16px;
}

.viz-panel {
  min-height: 310px;
  border-radius: 8px;
  padding: 16px;
}

.wide {
  grid-column: span 1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.chart {
  min-height: 245px;
}

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

.bar-row {
  cursor: pointer;
}

.bar-row text {
  font-size: 12px;
  fill: var(--ink);
}

.bar-row:hover rect {
  filter: brightness(0.94);
}

.donut-wrap {
  display: grid;
  place-items: center;
}

.legend-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--muted);
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.view-tabs {
  margin-top: 18px;
  display: flex;
  gap: 8px;
}

.tab {
  min-height: 40px;
  border: 1px solid #c7d3df;
  border-radius: 8px;
  padding: 0 18px;
  background: white;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
}

.tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.month-stack {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.month-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.month-toggle {
  width: 100%;
  min-height: 64px;
  border: 0;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  text-align: left;
  font: inherit;
}

.month-toggle:hover {
  background: #f8fafc;
}

.month-title {
  display: grid;
  gap: 4px;
}

.month-title strong {
  font-size: 1.12rem;
}

.month-title span,
.month-count {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaf2f8;
  color: var(--navy);
  font-weight: 900;
  transition: transform 180ms ease;
}

.month-panel.open .chevron {
  transform: rotate(90deg);
}

.month-content {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid #e5ebf1;
}

.month-panel.open .month-content {
  display: block;
}

.cards-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.article-card {
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.card-accent {
  height: 7px;
  background: var(--accent, var(--teal));
}

.card-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 850;
}

.badge.high {
  background: #ddf4e6;
  color: #17663a;
}

.badge.medium {
  background: #fff3c4;
  color: #7c4d05;
}

.badge.pediatric {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}

.badge.new-badge {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #b91c1c;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.24);
  letter-spacing: 0.04em;
}

.badge.quality-high {
  background: #e7f8ec;
  color: #14532d;
  border: 1px solid #bbf7d0;
}

.badge.quality-good {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}

.badge.quality-moderate {
  background: #fff3c4;
  color: #7c4d05;
  border: 1px solid #fde68a;
}

.badge.quality-low {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.baby-icon {
  font-size: 1rem;
  line-height: 1;
}

.article-title-block {
  padding: 12px 0 10px;
  border-top: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;
  display: grid;
  gap: 7px;
}

.score-orb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #111827;
  font-size: 0.9rem;
  font-weight: 950;
  border: 2px solid currentColor;
  box-shadow: 0 8px 18px rgba(25, 50, 77, 0.14);
  flex: 0 0 auto;
}

.score-orb.quality-high {
  background: #dcfce7;
  color: #166534;
}

.score-orb.quality-good {
  background: #dbeafe;
  color: #1d4ed8;
}

.score-orb.quality-moderate {
  background: #fef3c7;
  color: #92400e;
}

.score-orb.quality-low {
  background: #fee2e2;
  color: #991b1b;
}

.article-kicker {
  color: var(--accent, var(--teal));
  font-size: 0.74rem;
  line-height: 1.2;
  font-weight: 900;
  text-transform: uppercase;
}

.article-card h3 {
  color: #111827;
  font-size: clamp(1.02rem, 1.1vw, 1.18rem);
  line-height: 1.34;
  font-weight: 850;
}

.article-meta,
.article-authors,
.small-label {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.article-authors {
  color: #3f4f5d;
  font-size: 0.8rem;
  font-weight: 750;
}

.detail-grid {
  display: grid;
  gap: 8px;
}

.detail {
  border-top: 1px solid #edf1f5;
  padding-top: 8px;
}

.small-label {
  display: block;
  margin-bottom: 3px;
  font-weight: 850;
  text-transform: uppercase;
}

.detail p {
  font-size: 0.9rem;
  line-height: 1.45;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
}

.pmid {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.article-link {
  min-height: 34px;
  border-color: var(--navy);
  background: var(--navy);
  font-size: 0.82rem;
}

.table-wrap {
  margin-top: 14px;
  border-radius: 8px;
  overflow: auto;
  max-height: 760px;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5ebf1;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
  line-height: 1.4;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: white;
  background: var(--navy);
}

.hidden {
  display: none;
}

.empty {
  grid-column: 1 / -1;
  padding: 26px;
  border: 1px dashed #b8c6d3;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .summary-grid,
  .viz-grid,
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 680px) {
  .topbar {
    display: grid;
    padding: 26px 18px 18px;
  }

  main {
    width: calc(100% - 24px);
  }

  .summary-grid,
  .viz-grid,
  .controls,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .month-toggle {
    grid-template-columns: 1fr auto;
  }

  .month-count {
    display: none;
  }

  .metric {
    min-height: 86px;
  }

  .card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .article-link {
    width: 100%;
  }
}
