:root {
  --page: #0c0f14;
  --surface: #151b23;
  --surface-raised: #1b222c;
  --text: #e9ecf1;
  --muted: #8a94a4;
  --faint: #5b6573;
  --border: #27303c;
  --blue: #e7b24a;
  --blue-soft: rgba(231, 178, 74, 0.14);
  --display: "Archivo", sans-serif;
  --body: "Inter", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

.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;
}

html {
  background: var(--page);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background:
    radial-gradient(
      1100px 520px at 80% -10%,
      rgba(231, 178, 74, 0.1),
      transparent 60%
    ),
    var(--page);
}

main {
  width: min(1200px, calc(100% - 44px));
  margin: 0 auto;
  padding: 0 0 58px;
}

.hub-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.hub-link span {
  color: var(--blue);
  font-size: 15px;
}

.hub-link:hover {
  color: var(--text);
}

header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  min-height: 92px;
  padding: 24px 0 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.stale-banner {
  margin: -10px 0 18px;
  padding: 10px 13px;
  border: 1px solid var(--blue);
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--text);
  font-size: 11px;
}

.stale-banner[hidden] {
  display: none;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.run-meta {
  width: min(290px, 100%);
  text-align: right;
}

.run-meta strong,
.run-meta span {
  display: block;
}

.run-meta strong {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

.run-meta span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.scrape-progress {
  margin-top: 10px;
}

.scrape-progress[hidden] {
  display: none;
}

.scrape-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}

.scrape-row b {
  color: var(--text);
  font-weight: 500;
}

.scrape-row span {
  display: inline;
  margin: 0;
  font: inherit;
}

.scrape-track {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.scrape-fill {
  display: block;
  width: 0;
  height: 100%;
  margin: 0;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.5s ease;
}

.scrape-eta {
  margin-top: 3px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  text-align: right;
}

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

.kpi {
  min-height: 148px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.kpi:first-child {
  border-color: var(--blue);
  background: linear-gradient(180deg, var(--blue-soft), var(--surface) 68%);
}

.kpi span,
.kpi strong,
.kpi small {
  display: block;
}

.kpi span {
  color: var(--faint);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.kpi strong {
  margin: 22px 0 12px;
  font-family: var(--mono);
  font-size: 35px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.kpi:first-child strong {
  color: var(--blue);
}

.kpi small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.definition-line {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.trend-section,
.map-section {
  margin-top: 36px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.section-title > span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.trend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.trend-grid article {
  padding: 20px 20px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.trend-grid article > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.trend-grid span {
  color: var(--blue);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.trend-grid strong {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
}

.trend-grid canvas {
  width: 100%;
  height: 120px;
  display: block;
  margin-top: 10px;
}

.visual-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.visual-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.chart-eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chart-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.chart-status {
  flex: none;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.metric-toggle {
  display: inline-flex;
  flex: none;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-raised);
}

.map-controls {
  display: flex;
  align-items: flex-end;
  flex: none;
  flex-direction: column;
  gap: 7px;
}

.secondary-toggle {
  border-color: transparent;
  background: transparent;
}

.secondary-toggle .toggle-button {
  padding: 5px 9px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  font-size: 9px;
}

.secondary-toggle .toggle-button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.secondary-toggle.hidden {
  display: none;
}

.toggle-button {
  appearance: none;
  padding: 6px 12px;
  border: 0;
  border-radius: 18px;
  outline: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
}

.toggle-button:hover {
  color: var(--text);
}

.toggle-button:focus-visible {
  box-shadow: 0 0 0 2px var(--blue);
}

.toggle-button.active {
  background: var(--blue);
  color: var(--page);
}

.state-map {
  position: relative;
  min-height: 430px;
  margin-top: 16px;
}

.state-map svg {
  width: 100%;
  height: auto;
  max-height: 500px;
  display: block;
  margin: 0 auto;
}

.state-map path {
  stroke: var(--page);
  stroke-width: 1;
  transition: fill 160ms ease;
}

.state-map path:hover,
.state-map path:focus {
  stroke: var(--blue);
  stroke-width: 1.8;
  outline: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  pointer-events: none;
  padding: 8px 11px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--surface-raised);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
}

.chart-tooltip strong {
  color: var(--blue);
  font-family: var(--mono);
  font-weight: 600;
}

.chart-empty {
  margin: 0;
  padding: 70px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 22px;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.map-ramp {
  width: 160px;
  height: 8px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    #28303b,
    rgba(231, 178, 74, 0.42),
    var(--blue)
  );
}

#map-note {
  margin-left: auto;
  color: var(--faint);
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

#shelf-depth-chart,
#retailer-history-chart {
  width: 100%;
  display: block;
}

#shelf-depth-chart {
  height: 320px;
  margin-top: 16px;
}

#retailer-history-chart {
  height: 270px;
  margin-top: 12px;
}

.chart-legend {
  color: var(--muted);
  font-size: 10px;
}

.legend-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-label {
  color: var(--muted);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.legend-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.line-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  max-height: 92px;
  margin-top: 14px;
  overflow-y: auto;
}

.line-legend .legend-item {
  display: flex;
  gap: 6px;
}

.retailer-head-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 9px;
}

.retailer-selector {
  position: relative;
  z-index: 8;
}

.retailer-selector summary {
  min-width: 154px;
  padding: 7px 30px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  list-style: none;
  text-align: left;
}

.retailer-selector summary::-webkit-details-marker {
  display: none;
}

.retailer-selector summary::after {
  position: absolute;
  top: 7px;
  right: 12px;
  color: var(--blue);
  content: "⌄";
}

.retailer-selector[open] summary {
  border-color: var(--blue);
}

.retailer-selector[open] summary::after {
  content: "⌃";
}

.retailer-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(340px, calc(100vw - 44px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}

.retailer-search input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--page);
  color: var(--text);
  font: 11px var(--body);
}

.retailer-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
}

.retailer-search input::placeholder {
  color: var(--faint);
}

.retailer-menu-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin: 9px 0;
}

.retailer-menu-actions button {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: 600 9px var(--body);
}

.retailer-menu-actions button:hover,
.retailer-menu-actions button:focus-visible {
  border-color: var(--blue);
  color: var(--text);
}

.retailer-options {
  max-height: 285px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.retailer-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 3px;
  border-bottom: 1px solid rgba(39, 48, 60, 0.62);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.retailer-option:hover {
  color: var(--text);
}

.retailer-option input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--blue);
}

.retailer-option strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}

.line-swatch {
  width: 17px;
  height: 0;
  border-top: 2px solid;
}

.chart-note {
  margin: 8px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--faint);
  background: var(--surface-raised);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

td {
  color: var(--muted);
  font-size: 11px;
}

td:not(:first-child) {
  font-family: var(--mono);
  font-size: 10.5px;
}

td:first-child {
  color: var(--text);
}

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

td strong {
  font-weight: 650;
}

.detail-block {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.detail-block summary {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 18px;
  cursor: pointer;
  list-style: none;
}

.detail-block summary::-webkit-details-marker {
  display: none;
}

.detail-block summary::after {
  content: "+";
  color: var(--blue);
  font-size: 22px;
  line-height: 1;
}

.detail-block[open] summary::after {
  content: "–";
}

.detail-block summary span {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
}

.detail-block summary small {
  margin-left: auto;
  color: var(--faint);
  font-size: 10px;
}

.detail-content,
.source-content {
  padding: 22px 18px 18px;
  border-top: 1px solid var(--border);
}

.detail-content {
  display: grid;
  gap: 30px;
}

.detail-content h2 {
  margin-bottom: 10px;
}

.compact-table {
  max-height: 420px;
  overflow-y: auto;
}

.search {
  width: min(460px, 100%);
  height: 39px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 11px;
}

.search:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.source-content dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
  margin: 0;
}

.source-content dl div {
  min-width: 0;
}

dt {
  margin-bottom: 5px;
  color: var(--text);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.download-links a {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.download-links a:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 10px;
  text-align: center;
}

@media (max-width: 800px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .state-map {
    min-height: 350px;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 20px, 1200px);
    padding-top: 24px;
  }

  header {
    align-items: flex-start;
    flex-direction: column;
  }

  .run-meta {
    text-align: left;
  }

  .scrape-eta {
    text-align: left;
  }

  .kpi {
    min-height: 136px;
    padding: 15px;
  }

  .kpi strong {
    font-size: 29px;
  }

  .visual-card {
    padding: 18px;
  }

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

  .retailer-head-actions {
    width: 100%;
    align-items: flex-start;
  }

  .retailer-selector,
  .retailer-selector summary {
    width: 100%;
  }

  .retailer-menu {
    right: auto;
    left: 0;
  }

  .map-controls {
    align-items: flex-start;
  }

  .state-map {
    min-height: 250px;
  }

  .map-legend {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .map-ramp {
    width: 110px;
  }

  #map-note {
    width: 100%;
    margin-left: 0;
  }

  #shelf-depth-chart {
    height: 270px;
  }

  .detail-block summary {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 16px;
  }

  .detail-block summary small {
    width: calc(100% - 28px);
    margin-left: 0;
  }

  .source-content dl {
    grid-template-columns: 1fr;
  }
}
