:root {
  --page-bg: #f5f7fa;
  --panel-bg: #ffffff;
  --ink: #17212f;
  --muted: #647286;
  --line: #dfe5ed;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --ok: #138a5b;
  --soft-red: #fff2f1;
  --soft-green: #effaf4;
}

html {
  font-size: 15px;
  min-height: 100%;
  position: relative;
}

body {
  background: var(--page-bg);
  color: var(--ink);
  margin-bottom: 72px;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-dark);
}

.navbar-brand {
  font-weight: 700;
}

.container {
  max-width: 1480px;
}

.toolbar {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 18px 0 20px;
}

.toolbar h1 {
  font-size: 2rem;
  font-weight: 760;
  letter-spacing: 0;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.btn-scrape {
  border-radius: 6px;
  font-weight: 700;
  min-height: 42px;
  min-width: 168px;
}

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

.metric-card,
.source-band,
.table-panel,
.runs-panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  min-height: 88px;
  padding: 16px;
}

.metric-card span,
.source-band .label,
.section-heading span,
.product-cell span,
.run-list small {
  color: var(--muted);
  display: block;
  font-size: .82rem;
}

.metric-card strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.15;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card-wide strong {
  font-size: 1.1rem;
}

.source-band {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 1.4fr .5fr 1.2fr auto;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.source-band strong {
  font-size: .95rem;
}

.content-split {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.table-panel,
.runs-panel {
  min-width: 0;
  padding: 16px;
}

.section-heading {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 1.08rem;
  font-weight: 760;
  margin: 0;
}

.product-table {
  margin: 0;
  table-layout: fixed;
}

.product-table th {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 760;
  text-transform: uppercase;
}

.product-table th:first-child {
  width: 43%;
}

.product-table th:nth-child(2) {
  width: 150px;
}

.product-table th:nth-child(3) {
  width: 130px;
}

.product-table th:nth-child(4) {
  width: 86px;
}

.product-table th:nth-child(5) {
  width: 110px;
}

.product-table th:nth-child(6) {
  width: 72px;
}

.product-cell {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 54px minmax(0, 1fr);
}

.product-cell img {
  aspect-ratio: 1;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 54px;
  object-fit: cover;
  width: 54px;
}

.product-title {
  display: block;
  font-weight: 700;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  background: var(--soft-green);
  border: 1px solid #c6eed8;
  border-radius: 999px;
  color: var(--ok);
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  padding: 4px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price {
  font-weight: 760;
}

.run-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.run-list li {
  border-top: 1px solid var(--line);
  padding: 13px 0;
}

.run-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.run-list div {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.run-list p {
  margin: 6px 0 4px;
}

.mercado-grid .metric-card strong {
  font-size: 1.25rem;
}

.auth-panel {
  margin-bottom: 14px;
}

.auth-detail-list {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}

.auth-detail-list div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 180px minmax(0, 1fr);
  padding-bottom: 12px;
}

.auth-detail-list dt {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 760;
}

.auth-detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.auth-note {
  color: var(--muted);
  margin: 0;
}

.empty-state {
  background: var(--soft-red);
  border: 1px solid #ffd0ca;
  border-radius: 8px;
  color: #8a342d;
  font-weight: 700;
  padding: 20px;
}

.footer {
  background: #ffffff;
  bottom: 0;
  line-height: 60px;
  position: absolute;
  width: 100%;
}

@media (max-width: 1080px) {
  .metric-grid,
  .source-band,
  .content-split {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 720px) {
  .toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .source-band {
    grid-template-columns: 1fr;
  }

  .btn-scrape {
    width: 100%;
  }

  .product-table {
    min-width: 920px;
  }

  .auth-detail-list div {
    grid-template-columns: 1fr;
  }
}
