:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --ink: #151817;
  --muted: #657067;
  --line: #d9ded7;
  --panel: #ffffff;
  --panel-2: #eef2ec;
  --accent: #0f7658;
  --accent-dark: #0a4a38;
  --warn: #975b00;
  --danger: #8c2f39;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px clamp(18px, 4vw, 52px) 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3.8vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.tagline {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 88px);
  gap: 8px;
}

.metrics div {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 11px;
}

.metrics strong {
  display: block;
  font-size: 23px;
  line-height: 1;
}

.metrics span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

main {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 36px) 48px;
}

.searchPanel {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 3.1fr);
  gap: 10px;
  padding: 12px 0;
  background: var(--bg);
}

.filterFields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.filterToggleButton {
  display: none;
  align-items: center;
  justify-content: center;
  height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.categoryTabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}

.categoryTab {
  flex: 0 0 auto;
  min-width: 64px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.categoryTab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.searchWrap {
  position: relative;
  height: 42px;
  align-self: start;
}

.searchIcon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
}

input,
select,
.resetFiltersButton {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}

.resetFiltersButton {
  font-weight: 900;
  cursor: pointer;
}

input {
  padding: 0 13px 0 40px;
}

select {
  padding: 0 10px;
}

.resultTools {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 6px 0 12px;
}

.resultTools h2 {
  margin: 0;
  font-size: 19px;
}

.resultTools p,
.viewHint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.summaryPanel {
  margin: 6px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
}

.summaryHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.summaryHeader strong {
  font-size: 15px;
}

.summaryHeader span,
.summaryLabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.summaryBlock {
  min-width: 0;
}

.summaryLabel {
  display: block;
  margin-bottom: 7px;
}

.summaryChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.summaryChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.summaryChip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.emptyInline {
  color: var(--muted);
  font-size: 12px;
}

.tableWrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: var(--panel);
}

.resultTable,
.groupTable,
.timelineTable {
  width: 100%;
  border-collapse: collapse;
}

.resultTable {
  min-width: 1400px;
}

.groupTable {
  min-width: 1180px;
}

.timelineTable {
  min-width: 1060px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
  text-align: left;
}

th {
  background: #f0f3ed;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfcfa;
}

.groupRow {
  cursor: pointer;
}

.groupRow.expanded {
  background: #fbfcfa;
}

.groupToggle {
  display: inline-grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.toggleIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.mainImageCell {
  width: 190px;
}

.mainProductImage {
  flex: 0 0 154px;
  width: 154px;
  height: 154px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  display: block;
  scroll-snap-align: start;
}

.imageSlider {
  position: relative;
  width: 154px;
}

.imageTrack {
  display: flex;
  width: 154px;
  overflow: hidden;
  scroll-snap-type: x mandatory;
  border-radius: 6px;
}

.imagePlaceholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 154px;
  height: 154px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.imagePlaceholder.compact {
  width: 132px;
  height: 92px;
}

.imageStrip {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 5px;
  width: 142px;
}

.imageStrip img {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: contain;
  background: #fff;
}

.imageNav {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 38px;
  border: 1px solid rgba(21, 24, 23, 0.22);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  transform: translateY(-50%);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.imageNav.prev {
  left: 4px;
}

.imageNav.next {
  right: 4px;
}

.imageCount {
  position: absolute;
  right: 7px;
  bottom: 7px;
  border-radius: 6px;
  background: rgba(21, 24, 23, 0.78);
  color: #fff;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.snapshot {
  width: 150px;
  height: 84px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
  display: block;
}

.snapshotCell {
  width: 170px;
}

.snapshotCell a {
  position: relative;
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

.timeBadge {
  position: absolute;
  left: 7px;
  bottom: 7px;
  min-width: 45px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.brandCell {
  min-width: 160px;
  max-width: 210px;
}

.productCell {
  min-width: 190px;
  max-width: 240px;
}

.brand {
  display: block;
  color: var(--accent-dark);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.product {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.video {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  max-width: 240px;
}

.videoTitleCell {
  min-width: 210px;
  max-width: 260px;
}

.groupImageCell {
  width: 170px;
}

.groupNameCell {
  min-width: 190px;
  max-width: 240px;
}

.groupProductsCell {
  min-width: 210px;
  max-width: 300px;
}

.groupReasonCell {
  min-width: 290px;
  max-width: 420px;
  color: #303633;
  font-size: 14px;
  line-height: 1.45;
}

.groupReasonCell ul {
  margin: 0;
  padding-left: 18px;
}

.groupReasonCell li + li {
  margin-top: 6px;
}

.groupVideosCell {
  min-width: 210px;
  max-width: 300px;
}

.groupVideo {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.groupVideo + .groupVideo {
  margin-top: 7px;
}

.representativeProducts {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.representativeProduct {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  font-size: 12px;
  line-height: 1.3;
}

.representativeProduct strong {
  display: block;
  overflow-wrap: anywhere;
}

.representativeProduct small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 800;
}

.rankNumber {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.evidenceStack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.evidenceItem {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 6px;
  background: #f2f5f0;
  color: var(--accent-dark);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.reasonTags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.reasonTag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border: 1px solid #cbd8cf;
  border-radius: 6px;
  background: #fff;
  color: #303633;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.groupDetailRow > td {
  padding: 0;
  background: #fbfcfa;
}

.groupDetailWrap {
  padding: 10px 14px 16px 190px;
}

.groupDetailSummary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.detailTable {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--panel);
}

.detailTable th {
  background: #f6f8f4;
}

.detailItemRow td {
  padding: 9px;
}

.detailImageCell {
  width: 78px;
}

.detailImage,
.detailImagePlaceholder {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detailProductCell {
  min-width: 190px;
  max-width: 260px;
}

.typeText,
.noteText {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent-dark);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill + .pill {
  margin-top: 6px;
}

.pill.warn {
  color: var(--warn);
}

.pill.danger {
  color: var(--danger);
}

.miniPill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 2px 8px;
  margin: 0 6px 6px 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.miniPillWrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  max-width: 100%;
}

.trustBadges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.trustBadge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 6px;
  background: #e5f0ea;
  color: var(--accent-dark);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.strengthBadge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  margin-top: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.strengthBadge.high {
  background: var(--accent);
  color: #fff;
}

.strengthBadge.medium {
  background: #dfece5;
  color: var(--accent-dark);
}

.strengthBadge.low {
  background: var(--panel-2);
  color: var(--muted);
}

.groupSummary {
  display: block;
  margin-top: 8px;
  color: #303633;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.reasonCell {
  min-width: 260px;
  max-width: 360px;
  color: #303633;
  font-size: 14px;
  line-height: 1.45;
}

.priceCell {
  min-width: 130px;
  max-width: 170px;
  color: #303633;
  font-size: 13px;
  line-height: 1.4;
}

.priceText {
  display: block;
  font-weight: 800;
}

.textLink {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sourceCell {
  min-width: 128px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.confidence {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-weight: 700;
}

.linksCell {
  min-width: 105px;
}

.productLinkCell {
  min-width: 108px;
}

.timelineTimeCell {
  width: 96px;
}

.timelineProductCell {
  min-width: 240px;
  max-width: 320px;
}

.timeLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.linkButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  margin: 0 6px 6px 0;
}

.linkButton.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.viewControls {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 4px;
}

.viewButton {
  min-width: 88px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.viewButton.active {
  background: var(--accent);
  color: #fff;
}

.emptyState {
  padding: 48px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 20px 16px 16px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 11px;
  }

  h1 {
    font-size: 34px;
  }

  .tagline {
    max-width: 280px;
    font-size: 13px;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics div {
    min-height: 58px;
    padding: 10px;
  }

  .metrics strong {
    font-size: 22px;
  }

  .searchPanel {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 0;
  }

  .searchWrap {
    grid-column: 1;
    order: 1;
  }

  .filterToggleButton {
    display: inline-flex;
    order: 3;
    width: 100%;
  }

  .filterFields {
    grid-column: 1 / -1;
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    order: 4;
  }

  .searchPanel.filtersOpen .filterFields {
    display: grid;
  }

  .categoryTabs {
    grid-column: 1 / -1;
    order: 2;
  }

  .resultTools {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .viewControls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

  .viewButton {
    min-width: 0;
    width: 100%;
    padding: 0 4px;
    font-size: 12px;
  }

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

@media (max-width: 720px) {
  main {
    padding: 12px 10px 32px;
  }

  .tableWrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .resultTable,
  .groupTable,
  .detailTable,
  .timelineTable {
    display: block;
    max-width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .resultTable thead,
  .groupTable thead,
  .detailTable thead,
  .timelineTable thead {
    display: none;
  }

  .resultTable tbody,
  .groupTable tbody,
  .detailTable tbody,
  .timelineTable tbody,
  .resultTable tr,
  .groupTable tr,
  .detailTable tr,
  .timelineTable tr {
    display: block;
    max-width: 100%;
  }

  .resultTable tr,
  .timelineTable tr,
  .groupRow,
  .detailItemRow {
    width: 100%;
    max-width: 100%;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    overflow: hidden;
  }

  .groupDetailRow {
    margin: -10px 0 18px;
    border: 0;
    background: transparent;
  }

  .groupDetailRow > td {
    display: block !important;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .groupDetailRow > td::before {
    content: none !important;
  }

  .groupDetailWrap {
    padding: 0 0 0 18px;
  }

  .groupDetailSummary {
    display: block;
    margin-bottom: 10px;
  }

  .detailTable {
    width: 100%;
  }

  th,
  td {
    border-bottom: 0;
  }

  .resultTable td,
  .groupTable td,
  .detailTable td,
  .timelineTable td {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .resultTable td:last-child,
  .groupTable td:last-child,
  .detailTable td:last-child,
  .timelineTable td:last-child {
    border-bottom: 0;
  }

  .resultTable td::before,
  .groupTable td::before,
  .detailTable td::before,
  .timelineTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.3;
    text-transform: uppercase;
  }

  .mainImageCell,
  .groupImageCell,
  .detailImageCell {
    display: block !important;
    padding: 0 !important;
  }

  .mainImageCell::before,
  .groupImageCell::before,
  .detailImageCell::before {
    content: none !important;
  }

  .imageSlider,
  .imageTrack,
  .mainProductImage,
  .imagePlaceholder {
    width: 100%;
  }

  .imageTrack {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .mainProductImage,
  .imagePlaceholder {
    flex-basis: 100%;
    height: 240px;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .imageStrip {
    display: flex;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    background: #fff;
  }

  .imageStrip img {
    flex: 0 0 33.333%;
    width: 33.333%;
    height: 112px;
    border-width: 0 1px 1px 0;
    border-radius: 0;
  }

  .imagePlaceholder.compact {
    width: 100%;
    height: 112px;
    border-radius: 0;
  }

  .detailImage,
  .detailImagePlaceholder {
    width: 100%;
    height: 150px;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .imageNav {
    width: 32px;
    height: 44px;
  }

  .groupToggle {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .toggleIcon {
    width: 24px;
    height: 24px;
  }

  .groupProductsCell,
  .groupReasonCell,
  .groupVideosCell,
  .reasonCell,
  .priceCell,
  .sourceCell,
  .videoTitleCell,
  .linksCell,
  .productLinkCell,
  .timelineTimeCell,
  .timelineProductCell,
  .brandCell,
  .productCell,
  .detailProductCell {
    min-width: 0;
    max-width: none;
  }

  .video {
    max-width: none;
  }

  .miniPill {
    max-width: 100%;
  }

  .linkButton {
    width: 100%;
    min-width: 0;
    margin-right: 0;
  }
}

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

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

  input,
  select,
  .resetFiltersButton {
    height: 44px;
  }

  .metrics {
    gap: 6px;
  }

  .metrics span {
    font-size: 11px;
  }

  .resultTools h2 {
    font-size: 17px;
  }

  .resultTools p {
    font-size: 12px;
  }

  .mainProductImage,
  .imagePlaceholder {
    height: 220px;
  }
}
