.results-shell {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.results-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.results-subtitle {
  margin: 6px 0 0;
  color: #667085;
  font-weight: 500;
}

.results-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 22px;
}

.results-search {
  flex: 1;
  min-width: 240px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.results-search input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  background: #fff;
}

.results-search input:focus {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.results-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.results-chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.results-chip.active {
  border-color: #3b82f6;
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.08);
}

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

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

@media (max-width: 1024px) {
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr;
  }

  .results-metric-grid {
    grid-template-columns: 1fr;
  }
}

.result-card {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: #dbe7ff;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.10);
}

.result-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.result-card-id {
  font-weight: 900;
  letter-spacing: -0.02em;
}

.result-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.result-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
}

.result-badge.good {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #047857;
}

.result-badge.warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
  color: #92400e;
}

.result-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 8px;
}

.channel-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.channel-section {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.05);
}

.channel-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 900;
}

.channel-section .chart-wrap {
  height: 260px;
  margin-top: 8px;
}

.channel-section .muted-hint {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 8px;
}

.gmb-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

@media (max-width: 980px) {
  .gmb-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .gmb-metric-grid {
    grid-template-columns: 1fr;
  }
}

.gmb-metric-card {
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background: #f9fafb;
  padding: 10px;
}

.gmb-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.gmb-metric-head .label {
  font-size: 11px;
  font-weight: 800;
  color: #6b7280;
}

.gmb-metric-head .value {
  font-size: 16px;
  font-weight: 900;
  color: #111827;
}

.gmb-metric-chart {
  height: 58px;
  margin-top: 6px;
}

.result-kpi {
  background: #f9fafb;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 10px;
}

.result-kpi .label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #6b7280;
  margin-bottom: 6px;
}

.result-kpi .value {
  font-size: 16px;
  font-weight: 900;
  color: #111827;
}

.result-chart {
  height: 92px;
}

.result-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.result-meta a {
  text-decoration: none;
  font-weight: 900;
  color: #2563eb;
}

.result-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-weight: 700;
}

.metric-tile {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
  padding: 14px 14px 10px;
}

.metric-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.metric-tile-title {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.metric-tile-sub {
  margin-top: 4px;
  color: #6b7280;
  font-weight: 700;
  font-size: 12px;
}

.metric-tile-value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #111827;
}

.metric-spark {
  height: 88px;
  margin-top: 8px;
}

.results-legend-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-detail-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
}

@media (max-width: 1024px) {
  .result-detail-grid {
    grid-template-columns: 1fr;
  }
}

.result-panel {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
  padding: 14px;
}

.result-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 900;
}

.result-panel .muted {
  color: #6b7280;
  font-weight: 700;
}

.result-cta {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.result-cta .btn {
  border-radius: 999px;
  padding: 12px 14px;
  font-weight: 900;
  border: 1px solid #e5e7eb;
  background: #111827;
  color: #fff;
  cursor: pointer;
}

.result-cta .btn.secondary {
  background: #fff;
  color: #111827;
}

/* ── Aggregating loader overlay ──────────────────────────────────────────── */
.aggregating-overlay {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.aggregating-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.aggregating-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 48px;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.12);
  text-align: center;
}

.aggregating-spinner {
  width: 56px;
  height: 56px;
  animation: spin 0.9s linear infinite;
}

.aggregating-svg {
  width: 100%;
  height: 100%;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.aggregating-label {
  font-size: 17px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.01em;
}

.aggregating-sub {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-top: -6px;
}

/* animated dots after "Aggregating data" */
.aggregating-dots::after {
  content: '';
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* ── Tile skeleton pulse ─────────────────────────────────────────────────── */
.tile-skeleton {
  display: block;
  width: 90px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

