* { box-sizing: border-box; }

:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #161b2a;
  --muted: #737b8c;
  --line: #e2e6ee;
  --navy: #0c1124;
  --accent: #d91f46;
  --soft-red: #fff0f3;
  --green: #22b45b;
  --amber: #d99000;
  --blue: #3458d4;
  --purple: #7b4cd6;
  --teal: #168f8f;
}

html { scroll-behavior: smooth; }

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

button, select { font: inherit; }

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 28px 72px;
}

.hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero p {
  margin: 12px 0 0;
  max-width: 470px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.source-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.source-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(13, 22, 45, 0.05);
  font-size: 0.92rem;
  cursor: pointer;
}

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

.status-dot,
.source-state,
.legend-dot {
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
}

.status-dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 3px rgba(34, 180, 91, 0.12);
}

.source-pill.partial .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 144, 0, 0.12);
}

.source-pill.error .status-dot {
  background: #cf334f;
  box-shadow: 0 0 0 3px rgba(207, 51, 79, 0.12);
}

.source-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 32px));
  max-height: min(70vh, 610px);
  overflow: auto;
  z-index: 50;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 22px 60px rgba(12, 17, 36, 0.18);
}

.source-panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
}

.source-panel-head strong {
  display: block;
  font-size: 1.05rem;
}

.source-panel-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .8rem;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.source-list {
  padding: 4px 0;
}

.source-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #f0f2f6;
}

.source-state {
  width: 9px;
  height: 9px;
}

.source-state.partial { background: var(--amber); }
.source-state.error { background: #cf334f; }

.source-copy strong {
  display: block;
  font-size: .91rem;
}

.source-copy span,
.source-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.3;
}

.source-copy small { color: #a04b5a; }

.source-count {
  min-width: 55px;
  text-align: right;
}

.source-count strong,
.source-count span {
  display: block;
}

.source-count strong { font-size: .9rem; }
.source-count span {
  margin-top: 2px;
  color: var(--muted);
  font-size: .68rem;
}

.source-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px 16px;
  color: var(--muted);
  font-size: .72rem;
}

.legend-dot {
  width: 7px;
  height: 7px;
  margin-right: 4px;
}
.legend-dot.partial { background: var(--amber); }
.legend-dot.error { background: #cf334f; }

.filters { margin-bottom: 32px; }

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

.select-wrap select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, transparent 50%, #596273 50%) calc(100% - 19px) calc(50% - 2px)/6px 6px no-repeat,
    linear-gradient(135deg, #596273 50%, transparent 50%) calc(100% - 15px) calc(50% - 2px)/6px 6px no-repeat,
    var(--card);
  padding: 13px 42px 13px 15px;
  color: var(--text);
  font-weight: 650;
  outline: none;
}

.select-wrap select:focus {
  border-color: #aab3c3;
  box-shadow: 0 0 0 4px rgba(12, 17, 36, 0.06);
}

.period-tabs {
  display: inline-flex;
  gap: 8px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.period-btn {
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 9px 16px;
  color: #4f5869;
  cursor: pointer;
  font-weight: 700;
}

.period-btn.active {
  background: var(--navy);
  color: white;
}

.section-block {
  margin-top: 30px;
  scroll-margin-top: 18px;
}

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

.section-title-row h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.section-title-row > span {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.section-kicker {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .86rem;
}

.card-stack {
  display: grid;
  gap: 14px;
}

.story-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 8px 22px rgba(21, 29, 49, 0.04);
}

.story-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

.story-card 
.brief-method-note {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.45;
}

.executive-brief,
.why-desktop {
  margin-top: 15px;
}

.executive-brief {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.executive-brief.headline-only {
  padding: 13px 14px;
  border: 1px dashed #d5dae3;
  border-radius: 14px;
  background: #fafbfc;
}

.brief-label {
  display: block;
  margin-bottom: 5px;
  color: #697284;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.brief-text,
.why-text {
  margin: 0;
  color: #3f4858;
  line-height: 1.52;
}

.brief-text {
  font-size: .96rem;
}

.why-desktop {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f5f7fa;
}

.why-text {
  font-size: .9rem;
}

.why-mobile {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f7f8fa;
}

.why-mobile summary {
  cursor: pointer;
  color: #596273;
  font-size: .82rem;
  font-weight: 800;
}

.why-mobile p {
  margin: 9px 0 0;
  color: #434b5b;
  font-size: .88rem;
  line-height: 1.5;
}

.impact-grid.single {
  grid-template-columns: 1fr;
}

.compact .executive-brief {
  margin-top: 12px;
  padding-top: 12px;
}

.compact .brief-text {
  font-size: .9rem;
}

.compact .why-text {
  font-size: .85rem;
}

.read-link {
  margin-top: auto;
  padding-top: 16px;
}

.story-card.must-know { border-left: 4px solid var(--accent); }

.story-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.must-badge,
.content-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: .03em;
}

.must-badge {
  padding: 6px 9px;
  background: var(--soft-red);
  color: var(--accent);
}

.content-badge {
  padding: 6px 9px;
  background: #eef1f6;
  color: #536071;
}

.type-news { background: #edf3ff; color: var(--blue); }
.type-official { background: #eaf7ef; color: #25834b; }
.type-report { background: #f3edff; color: var(--purple); }
.type-insight { background: #eaf8f7; color: var(--teal); }
.type-update { background: #fff5df; color: #9a6500; }

.score {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f1f3f7;
  color: #3d4657;
  font-size: 0.78rem;
  font-weight: 800;
}

.score-help {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.score-help summary {
  width: fit-content;
  cursor: pointer;
  color: #596273;
  font-weight: 700;
}

.score-help p {
  max-width: 680px;
  margin: 8px 0 0;
  line-height: 1.5;
}

.story-card h3 {
  margin: 0;
  font-size: 1.38rem;
  line-height: 1.32;
  letter-spacing: -0.025em;
}

.story-link {
  color: inherit;
  text-decoration: none;
}

.story-link:hover,
.story-link:focus {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.story-top .meta { margin: 0; }

.summary {
  margin: 16px 0 0;
  color: #434b5b;
  font-size: 1.01rem;
  line-height: 1.55;
}


.brief-method-note {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.45;
}

.executive-brief,
.why-desktop {
  margin-top: 15px;
}

.executive-brief {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.executive-brief.headline-only {
  padding: 13px 14px;
  border: 1px dashed #d5dae3;
  border-radius: 14px;
  background: #fafbfc;
}

.brief-label {
  display: block;
  margin-bottom: 5px;
  color: #697284;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.brief-text,
.why-text {
  margin: 0;
  color: #3f4858;
  line-height: 1.52;
}

.brief-text {
  font-size: .96rem;
}

.why-desktop {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f5f7fa;
}

.why-text {
  font-size: .9rem;
}

.why-mobile {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f7f8fa;
}

.why-mobile summary {
  cursor: pointer;
  color: #596273;
  font-size: .82rem;
  font-weight: 800;
}

.why-mobile p {
  margin: 9px 0 0;
  color: #434b5b;
  font-size: .88rem;
  line-height: 1.5;
}

.impact-grid.single {
  grid-template-columns: 1fr;
}

.compact .executive-brief {
  margin-top: 12px;
  padding-top: 12px;
}

.compact .brief-text {
  font-size: .9rem;
}

.compact .why-text {
  font-size: .85rem;
}

.read-link {
  display: inline-block;
  margin-top: 14px;
  color: #243657;
  font-size: .91rem;
  font-weight: 800;
  text-decoration: none;
}

.read-link:hover,
.read-link:focus { text-decoration: underline; }

.impact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.impact-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
}

.impact-box strong {
  display: block;
  margin-bottom: 4px;
  color: #6f7785;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.compact .story-card {
  padding: 18px;
  border-radius: 20px;
}

.compact .story-card h3 { font-size: 1.08rem; }

.compact .summary {
  font-size: 0.94rem;
  margin-top: 10px;
}

.payment-tabs {
  display: flex;
  gap: 8px;
  margin: 2px 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.payment-tabs::-webkit-scrollbar { display: none; }

.payment-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  padding: 9px 13px;
  color: #4f5869;
  cursor: pointer;
  font-weight: 750;
}

.payment-pill.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.bottom-space { margin-bottom: 20px; }

.bottom-nav {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(94%, 520px);
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 7px;
  background: rgba(12, 17, 36, 0.96);
  backdrop-filter: blur(12px);
  border-radius: 22px;
  box-shadow: 0 12px 35px rgba(12, 17, 36, 0.22);
  z-index: 10;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #b8c0d0;
  border-radius: 16px;
  padding: 7px 3px;
  display: grid;
  place-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.nav-item span { font-size: 0.68rem; }

.nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.empty-state {
  padding: 18px;
  border: 1px dashed #cfd5df;
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  color: var(--muted);
  line-height: 1.5;
}

.loading {
  position: relative;
  overflow: hidden;
  min-height: 90px;
}

.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer { 100% { transform: translateX(100%); } }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


@media (min-width: 900px) {
  #mustKnowList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .card-stack.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}

@media (min-width: 1180px) {
  .card-stack.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .why-desktop {
    display: none;
  }

  .why-mobile {
    display: block;
  }

  .executive-brief {
    margin-top: 13px;
  }

  .executive-brief.headline-only {
    padding: 11px 12px;
  }


  .app { padding: 22px 16px 165px; }

  .bottom-nav { display: grid; }

  .hero { display: block; }

  .source-menu-wrap {
    width: fit-content;
    margin-top: 14px;
  }

  .source-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: 92px;
    width: auto;
    max-height: calc(100vh - 120px);
  }

  .select-grid { grid-template-columns: 1fr; }

  .period-tabs { width: 100%; }

  .period-btn {
    flex: 1;
    padding-inline: 10px;
  }

  .section-title-row {
    display: block;
  }

  .section-title-row > span {
    display: block;
    margin-top: 6px;
    text-align: left;
  }

  #mustKnowList,
  .card-stack.compact {
    grid-template-columns: 1fr;
  }

  .story-card {
    padding: 18px;
    border-radius: 20px;
  }

  .story-card h3 { font-size: 1.22rem; }

  .impact-grid { grid-template-columns: 1fr; }

  .nav-item span { font-size: .62rem; }
}
