.source-stats-launcher {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(130, 145, 175, .28);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
  color: var(--text-secondary, #62718a);
  font: 600 13px/1 inherit;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.source-stats-launcher > i { color: #248168; }
.source-stats-launcher:hover {
  color: #176e58;
  border-color: rgba(36, 129, 104, .4);
  background: rgba(255, 255, 255, .9);
  transform: translateY(-1px);
}
.source-stats-launcher[hidden] { display: none !important; }

.ssg-overlay {
  position: fixed;
  inset: 0;
  z-index: 3002;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: min(6vh, 52px) 20px 20px;
  background: rgba(13, 23, 39, .5);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  letter-spacing: 0;
}
.ssg-overlay.is-open { display: flex; }

.ssg-dialog {
  width: min(1180px, 100%);
  max-height: min(88vh, 850px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(205, 215, 229, .94);
  border-radius: 8px;
  background: rgba(252, 253, 255, .99);
  color: #263349;
  box-shadow: 0 28px 90px rgba(23, 35, 60, .3), 0 5px 20px rgba(23, 35, 60, .13);
  transform: translateY(-8px) scale(.992);
  opacity: 0;
  animation: ssg-enter .18s ease forwards;
}
@keyframes ssg-enter { to { transform: translateY(0) scale(1); opacity: 1; } }

.ssg-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid #e7ecf3;
}
.ssg-head,
.ssg-control-band,
.ssg-view-tabs,
.ssg-summary,
.ssg-report-head,
.ssg-footer { flex: 0 0 auto; }
.ssg-app-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #248168;
  color: #fff;
  box-shadow: 0 8px 18px rgba(36, 129, 104, .22);
}
.ssg-title { min-width: 0; flex: 1; }
.ssg-title strong { display: block; font-size: 17px; line-height: 1.3; }
.ssg-title span { display: block; margin-top: 2px; color: #8490a4; font-size: 12px; }
.ssg-scope {
  max-width: 260px;
  overflow: hidden;
  padding: 6px 9px;
  border-radius: 6px;
  background: #edf7f3;
  color: #24755f;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ssg-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #dce3ed;
  border-radius: 7px;
  background: #fff;
  color: #718097;
  cursor: pointer;
}
.ssg-icon-btn:hover { color: #24755f; border-color: #afd1c6; background: #f2f9f6; }
.ssg-icon-btn:disabled { cursor: not-allowed; opacity: .4; }

.ssg-control-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 260px) 34px;
  align-items: end;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid #e7ecf3;
  background: #f9fbfc;
}
.ssg-range-group { min-width: 0; display: flex; align-items: center; gap: 12px; }
.ssg-control-label { flex: 0 0 auto; color: #66748b; font-size: 12px; font-weight: 700; }
.ssg-segments {
  min-width: 0;
  display: inline-flex;
  padding: 3px;
  border: 1px solid #dce4ed;
  border-radius: 7px;
  background: #f1f4f7;
}
.ssg-segments button {
  min-width: 58px;
  height: 31px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #728096;
  font: 600 12px/1 inherit;
  white-space: nowrap;
  cursor: pointer;
}
.ssg-segments button.is-active {
  background: #fff;
  color: #247a63;
  box-shadow: 0 1px 5px rgba(45, 67, 82, .12);
}
.ssg-store-field {
  height: 38px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
  background: #fff;
}
.ssg-store-field:focus-within { border-color: #68a996; box-shadow: 0 0 0 3px rgba(36, 129, 104, .09); }
.ssg-store-field i { color: #738198; font-size: 12px; text-align: center; }
.ssg-store-field select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 28px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #445269;
  font: 500 13px/1 inherit;
}
.ssg-refresh.is-loading i { animation: ssg-spin .8s linear infinite; }
@keyframes ssg-spin { to { transform: rotate(360deg); } }

.ssg-view-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 18px;
  border-bottom: 1px solid #e5ebf2;
}
.ssg-view-tabs button {
  position: relative;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #748198;
  font: 700 13px/1 inherit;
  cursor: pointer;
}
.ssg-view-tabs button::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}
.ssg-view-tabs button:hover { color: #40506a; }
.ssg-view-tabs button.is-active { color: #247a63; }
.ssg-view-tabs button.is-active::after { background: #2d9478; }
.ssg-view-tabs button:focus { outline: 0; }
.ssg-view-tabs button:focus-visible { box-shadow: inset 0 0 0 2px rgba(36, 129, 104, .28); }
.ssg-view-tabs b {
  min-width: 22px;
  padding: 3px 5px;
  border-radius: 10px;
  background: #eef2f6;
  color: #7d899c;
  font-size: 10px;
  text-align: center;
}
.ssg-view-tabs button.is-active b { background: #e4f4ee; color: #247a63; }

.ssg-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 18px;
  border-bottom: 1px solid #e6ecf3;
}
.ssg-summary > div {
  min-width: 0;
  padding: 14px 16px 13px;
  border-right: 1px solid #e7ecf3;
}
.ssg-summary > div:first-child { padding-left: 0; }
.ssg-summary > div:last-child { border-right: 0; }
.ssg-summary span { display: block; color: #7b879b; font-size: 11px; }
.ssg-summary strong { display: block; margin-top: 4px; color: #28364d; font-size: 23px; line-height: 1.1; }
.ssg-summary small { display: block; margin-top: 5px; overflow: hidden; color: #8a96a8; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ssg-summary .ssg-trend-counts { display: flex; align-items: baseline; gap: 7px; }
.ssg-trend-counts b { font: inherit; }
.ssg-trend-counts b:first-child { color: #d55358; }
.ssg-trend-counts b:last-child { color: #25845f; }
.ssg-trend-counts i { color: #a2acbb; font-size: 15px; font-style: normal; font-weight: 500; }

.ssg-report-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
}
.ssg-report-head > div { min-width: 0; }
.ssg-report-head > div strong { display: block; color: #35435a; font-size: 14px; }
.ssg-report-head > div span { display: block; margin-top: 3px; color: #8a96a8; font-size: 11px; }
.ssg-search {
  width: min(310px, 38%);
  height: 38px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 28px;
  align-items: center;
  border: 1px solid #d8e0ea;
  border-radius: 7px;
  background: #fff;
}
.ssg-search:focus-within { border-color: #68a996; box-shadow: 0 0 0 3px rgba(36, 129, 104, .09); }
.ssg-search > i { color: #7a879a; font-size: 12px; text-align: center; }
.ssg-search input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #344158;
  font: 500 13px/1 inherit;
}
.ssg-search input::placeholder { color: #a0aabd; }
.ssg-search input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
.ssg-search-clear {
  width: 26px;
  height: 26px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #eff3f7;
  color: #7b879a;
  cursor: pointer;
}
.ssg-search-clear.is-visible { display: grid; }

.ssg-table-wrap {
  position: relative;
  min-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
  border-top: 1px solid #e6ebf2;
  flex: 1 1 auto;
}
.ssg-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  table-layout: fixed;
}
.ssg-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 42px;
  padding: 0 10px;
  border-bottom: 1px solid #e3e9f1;
  background: #f5f7fa;
  color: #6b7890;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.ssg-table th:first-child,
.ssg-table td:first-child { padding-left: 18px; }
.ssg-table th:last-child,
.ssg-table td:last-child { padding-right: 18px; }
.ssg-table th:nth-child(2) { width: 29%; }
.ssg-table td {
  height: 56px;
  padding: 8px 10px;
  border-bottom: 1px solid #ebeff4;
  color: #4c5a70;
  font-size: 12px;
  vertical-align: middle;
}
.ssg-table tr:hover td { background: #f8fafb; }
.ssg-table td > strong { color: #344158; font-size: 13px; }
.ssg-table td > small { margin-left: 3px; color: #919bad; font-size: 10px; }
.ssg-rank-col { width: 56px; }
.ssg-rank {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #eef2f6;
  color: #69778d;
  font-size: 11px;
  font-weight: 800;
}
.ssg-rank.is-top-1 { background: #fff0cc; color: #9b6811; }
.ssg-rank.is-top-2 { background: #eef1f5; color: #657187; }
.ssg-rank.is-top-3 { background: #f8e8dc; color: #9b5a33; }

.ssg-product-name,
.ssg-top-product { min-width: 0; }
.ssg-product-name strong,
.ssg-top-product strong {
  display: block;
  overflow: hidden;
  color: #344158;
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ssg-product-name small,
.ssg-top-product small { display: block; margin-top: 3px; color: #929daf; font-size: 10px; }
.ssg-store-name { min-width: 0; display: flex; align-items: center; gap: 7px; }
.ssg-store-name strong { overflow: hidden; color: #344158; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ssg-store-name span { flex: 0 0 auto; padding: 2px 5px; border-radius: 4px; background: #e5f5ef; color: #2b8068; font-size: 9px; font-weight: 700; }

.ssg-share { width: 86px; }
.ssg-share strong { display: block; color: #45536a; font-size: 11px; }
.ssg-share > span { display: block; height: 3px; margin-top: 5px; overflow: hidden; border-radius: 3px; background: #edf1f5; }
.ssg-share i { display: block; height: 100%; border-radius: inherit; background: #5da891; }

.ssg-change { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.ssg-change strong { font-size: 11px; }
.ssg-change small { font-size: 9px; }
.ssg-change.is-up strong, .ssg-delta.is-up, .ssg-rate.is-up { color: #d55358; }
.ssg-change.is-up small { color: #df7478; }
.ssg-change.is-down strong, .ssg-delta.is-down, .ssg-rate.is-down { color: #25845f; }
.ssg-change.is-down small { color: #53a281; }
.ssg-change.is-stable { color: #8a96a7; font-size: 11px; }
.ssg-delta { font-size: 11px !important; }
.ssg-rate { font-size: 11px; font-weight: 700; }

.ssg-trend {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 5px;
  background: #eef2f6;
  color: #748095;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.ssg-trend.is-new,
.ssg-trend.is-growth { background: #fdebec; color: #c94e55; }
.ssg-trend.is-stopped,
.ssg-trend.is-decline { background: #e6f5ee; color: #247c5d; }

.ssg-empty {
  position: absolute;
  inset: 0;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  color: #8a96a8;
  text-align: center;
}
.ssg-empty[hidden] { display: none; }
.ssg-empty i { margin-bottom: 12px; color: #aab5c5; font-size: 27px; }
.ssg-empty strong { color: #46546b; font-size: 14px; }
.ssg-empty span { margin-top: 6px; font-size: 11px; }

.ssg-skeleton {
  width: 100%;
  height: 13px;
  display: block;
  border-radius: 4px;
  background: linear-gradient(90deg, #edf1f5 25%, #f7f9fb 50%, #edf1f5 75%);
  background-size: 200% 100%;
  animation: ssg-shimmer 1.2s infinite;
}
@keyframes ssg-shimmer { to { background-position: -200% 0; } }

.ssg-footer {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-top: 1px solid #e5eaf1;
  background: #fafbfd;
  color: #7e8a9e;
  font-size: 11px;
}
.ssg-comparison { color: #68768d; text-align: center; }
.ssg-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ssg-pager span { min-width: 56px; text-align: center; }
.ssg-pager button { width: 31px; height: 30px; }

@media (max-width: 1160px) {
  .source-stats-launcher span { display: none; }
  .source-stats-launcher { width: 38px; justify-content: center; padding: 0; }
  .ssg-dialog { width: min(1040px, 100%); }
  .ssg-segments button { min-width: 0; padding-inline: 8px; }
}

@media (max-width: 820px) {
  .ssg-overlay { padding: 0; align-items: stretch; }
  .ssg-dialog { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .ssg-title span { display: none; }
  .ssg-control-band { grid-template-columns: 1fr 34px; }
  .ssg-range-group { grid-column: 1 / -1; align-items: flex-start; flex-direction: column; gap: 6px; }
  .ssg-segments { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); }
  .ssg-store-field { min-width: 0; }
  .ssg-view-tabs { padding-inline: 8px; }
  .ssg-view-tabs button { gap: 5px; }
  .ssg-view-tabs button i { display: none; }
  .ssg-summary { grid-template-columns: 1fr 1fr; }
  .ssg-summary > div:nth-child(2) { border-right: 0; }
  .ssg-summary > div:nth-child(-n+2) { border-bottom: 1px solid #e7ecf3; }
  .ssg-report-head { align-items: stretch; flex-direction: column; gap: 8px; padding-block: 10px; }
  .ssg-search { width: 100%; }
  .ssg-footer { grid-template-columns: 1fr auto; }
  .ssg-comparison { display: none; }
}

@media (max-width: 520px) {
  .ssg-head { padding-inline: 12px; }
  .ssg-scope { display: none; }
  .ssg-control-band { padding-inline: 12px; }
  .ssg-control-label { display: none; }
  .ssg-segments button { padding-inline: 3px; font-size: 11px; }
  .ssg-view-tabs span { font-size: 11px; }
  .ssg-view-tabs b { display: none; }
  .ssg-summary { margin-inline: 12px; }
  .ssg-summary > div { padding-inline: 10px; }
  .ssg-summary > div:nth-child(odd) { padding-left: 0; }
  .ssg-report-head { padding-inline: 12px; }
  .ssg-footer { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ssg-dialog { animation: none; opacity: 1; transform: none; }
  .ssg-refresh.is-loading i,
  .ssg-skeleton { animation: none; }
}
