:root {
  color-scheme: dark;

  /* Paleta Trakio — nomes iguais aos do Tailwind, para facilitar uma migração futura */
  --slate-50: #f8fafc;
  --slate-400: #94a3b8;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --teal: #2dd4bf; /* primária: botões, ícones ativos, linha do gráfico */
  --lime: #bef264; /* destaque: SÓ preço final com desconto, tag "oferta do dia" e ponto mais baixo do gráfico */
  --rose: #f43f5e; /* alerta: preço inflado / preço subindo */

  /* Papéis usados pelo restante do CSS */
  --bg: var(--slate-900);
  --surface: var(--slate-800);
  --text: var(--slate-50);
  --muted: var(--slate-400);
  --line: var(--slate-700);
  --accent: var(--teal);
  --accent-ink: var(--slate-900);
  --hot: var(--rose);
  --hot-bg: color-mix(in srgb, var(--rose) 14%, transparent);
  --good: var(--teal);
  --good-bg: color-mix(in srgb, var(--teal) 12%, transparent);
  --warn: var(--rose);
  --warn-bg: color-mix(in srgb, var(--rose) 14%, transparent);

  --radius: 12px; /* cards e modal; controles menores usam 8–10px */
  --font-display:
    "Montserrat", "Poppins", system-ui, sans-serif; /* logo, títulos e preços */
  --font-body:
    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-body);
}

/* Montserrat: logo, títulos e, obrigatoriamente, o preço do produto */
h1,
h2,
h3,
.brand,
.heading,
.m-title,
.card-price,
.m-price,
.stat b {
  font-family: var(--font-display);
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}
main.wrap {
  padding-top: 18px;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
a {
  color: inherit;
}

/* topo: logo | abas | busca, tudo numa linha (empilha no celular) */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: flex;
  align-items: center;
  flex: none;
  line-height: 0;
  text-decoration: none;
}
.brand img {
  height: 50px;
  width: auto;
  display: block;
}

.tabs,
.chips {
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar,
.chips::-webkit-scrollbar {
  display: none;
}
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  min-width: 0;
}
.tabs button {
  padding: 8px 16px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  white-space: nowrap;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  transition:
    color 0.12s,
    background-color 0.12s;
}
.tabs button:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.tabs button.active {
  background: var(--text);
  color: var(--bg);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 360px;
  margin-left: auto;
  min-width: 0;
}
.search input {
  width: 100%;
  min-width: 0;
  padding: 10px 16px 10px 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
.search-btn {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.search-btn:hover,
.search:focus-within .search-btn {
  color: var(--accent);
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* chips */
.chips {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
  color: var(--muted);
}
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 600;
}
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 600;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.sort-label select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}
.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 10px;
  margin: 0 0 14px;
}
.heading {
  font-size: 17px;
  margin: 4px 0 14px;
}

/* cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  transition:
    transform 0.12s,
    border-color 0.12s;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.card-img {
  aspect-ratio: 1;
  background: #fff;
  position: relative;
  overflow: hidden;
  flex: none;
}
.card-img img {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: contain;
}
.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
/* sempre 2 linhas de altura (reticências se passar): mantém todos os cards alinhados */
.card-name {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  max-height: 2.7em;
  overflow-wrap: anywhere; /* códigos de modelo sem espaço não alargam o card */
}
.card-old {
  color: var(--muted);
  font-size: 13px;
  text-decoration: line-through;
  min-height: 1.3em;
}
.card-price {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
/* Lime Drop: exclusivo do preço final com desconto */
.card-price.deal,
.m-price.deal {
  color: var(--lime);
}
.card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}
/* etiqueta de desconto: "aba" colada no canto superior esquerdo do card, grande e de alto contraste */
.badge {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  padding: 8px 13px 9px 11px;
  border-radius: 0 0 16px 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  background: var(--accent);
  color: var(--accent-ink);
}
.badge.rank {
  background: var(--text);
  color: var(--bg);
}
.badge.drop {
  background: var(--lime);
  color: var(--slate-900);
}
.card-save {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.ship {
  color: var(--good);
  font-weight: 600;
}

/* aba Categorias */
.overview {
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}
.cat-thumb {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 4px;
  border: 2px solid var(--line);
}
.cat-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}
.cat-count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.cat-more {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.cat-title:hover .cat-name {
  color: var(--accent);
}
.cat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.heading .back {
  margin-right: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}
.skeleton {
  height: 330px;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    var(--surface),
    var(--line),
    var(--surface)
  );
  background-size: 200% 100%;
  animation: sk 1.2s infinite linear;
}
@keyframes sk {
  to {
    background-position: -200% 0;
  }
}
.more-wrap {
  text-align: center;
  margin: 22px 0 8px;
}
.more {
  padding: 10px 24px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
}

.foot {
  color: var(--muted);
  font-size: 12.5px;
  padding-top: 24px;
  padding-bottom: 40px;
}
.foot p {
  margin: 4px 0;
}

/* modal */
.modal {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}
.modal::backdrop {
  background: rgb(8 12 20 / 0.6);
}
.m-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--bg);
  font-size: 22px;
  line-height: 1;
  z-index: 2;
}
.m-inner {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.m-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-right: 40px;
}
.m-head img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  flex: none;
}
.m-title {
  font-size: 17px;
  line-height: 1.3;
  margin: 0 0 6px;
}
.m-price-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.m-badge {
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  background: var(--accent);
  color: var(--accent-ink);
}
.m-save {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
  font-size: 14px;
}
.m-save s {
  color: var(--muted);
}
.m-save strong {
  color: var(--accent);
  font-weight: 700;
}
.m-price {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.m-sub {
  color: var(--muted);
  font-size: 13px;
}
.m-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
}
/* selo do Mercado Livre */
.ml-badge,
.ml-chip {
  display: grid;
  place-items: center;
}
/* nos cards: aba branca colada no canto superior direito, com a mesma altura da etiqueta de desconto */
.ml-badge {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  height: 34px;
  padding: 0 12px 0 14px;
  border-radius: 0 0 0 16px;
  background: #fff;
  /* contorno discreto: as fotos também têm fundo branco e a aba sumiria */
  border-left: 1px solid rgb(15 23 42 / 0.12);
  border-bottom: 1px solid rgb(15 23 42 / 0.12);
}
.ml-badge img {
  display: block;
  height: 22px;
  width: auto;
}
/* no botão do modal: só a logo */
.ml-chip img {
  display: block;
  height: 22px;
  width: auto;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 600;
}

.m-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.m-section h3 {
  margin: 0;
  font-size: 15px;
}
.seller {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.seller strong {
  color: var(--text);
  font-weight: 600;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.tag.good {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}
.features {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.features li::marker {
  color: var(--accent);
}
.specs {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.specs summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.specs dl {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  margin: 10px 0 0;
  font-size: 13.5px;
}
.specs dt,
.specs dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.specs dt {
  color: var(--muted);
  padding-right: 12px;
}

.range {
  display: flex;
  gap: 6px;
}
.range button {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  color: var(--muted);
}
.range button.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chart-head h3 {
  margin: 0;
  font-size: 15px;
}
.chart-box {
  position: relative;
}
.chart-box svg {
  width: 100%;
  height: auto;
  display: block;
  touch-action: pan-y;
}
.chart-box .grid-line {
  stroke: var(--line);
  stroke-width: 1;
}
.chart-box .axis-text {
  fill: var(--muted);
  font-size: 11px;
}
.chart-box .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linejoin: round;
}
.chart-box .orig {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
}
.chart-box .cursor {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart-box .dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart-box .min-dot {
  fill: var(--lime);
  stroke: var(--surface);
  stroke-width: 2;
}
.tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -110%);
  background: var(--text);
  color: var(--bg);
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 3;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend i {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2.4px solid var(--accent);
  vertical-align: middle;
  margin-right: 6px;
}
.legend i.dash {
  border-top: 1.4px dashed var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat b {
  display: block;
  font-size: 16px;
}
.stat span {
  font-size: 12px;
  color: var(--muted);
}
.verdict {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}
.verdict.good {
  background: var(--good-bg);
  color: var(--good);
}
.verdict.bad {
  background: var(--hot-bg);
  color: var(--hot);
}
.verdict.info {
  background: var(--bg);
  color: var(--muted);
}
.verdict.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

@media (max-width: 820px) {
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .top-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-top: 8px;
    padding-bottom: 8px;
    min-height: 0;
  }
  .brand img {
    height: 36px;
  }
  .search {
    flex: 1 1 0;
    margin-left: 0;
  }
  .tabs {
    order: 3;
    flex: 1 0 100%;
    margin: 0 -4px;
  }
}
@media (max-width: 560px) {
  /* a aba "Categorias" vira um menu: seta indica que abre o carrossel de categorias */
  .tabs [data-tab="categories"]::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 1px 3px 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s;
  }
  .tabs [data-tab="categories"][aria-expanded="true"]::after {
    margin-bottom: -2px;
    transform: rotate(225deg);
  }
  .chips {
    display: none;
  }
  .chips.open {
    display: flex;
  }
  .overview {
    gap: 28px;
  }
  .cat-name {
    font-size: 17px;
  }
  .cat-count {
    display: none;
  }
  .cat-thumb {
    width: 40px;
    height: 40px;
  }
  .card-save {
    font-size: 12px;
    white-space: nowrap;
  }
  .badge {
    font-size: 15px;
    padding: 7px 11px 8px 9px;
  }
  .ml-badge {
    height: 30px;
    padding: 0 10px 0 12px;
  }
  .ml-badge img {
    height: 20px;
  }
  /* cabeçalho em 2 linhas (logo + busca lado a lado / abas); não fica fixo para não ocupar a tela */
  .top {
    position: static;
  }
  .top-inner {
    gap: 0 12px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .brand {
    flex: none;
  }
  .search {
    flex: 1 1 0;
    margin-top: 0;
  }
  .search input {
    height: 38px;
    padding: 0 14px 0 38px;
    font-size: 14px; /* mesmo tamanho dos textos do site no celular */
  }
  .search-btn {
    width: 38px;
    height: 38px;
    left: 0;
  }
  .search-btn svg {
    width: 16px;
    height: 16px;
  }
  .tabs {
    margin-top: 16px;
  }
  .tabs {
    gap: 2px;
  }
  .tabs button {
    padding: 7px 9px;
    font-size: 13px;
  }
  .sort-label {
    font-size: 13px;
  }
  .sort-label select {
    padding: 5px 8px;
    font-size: 13px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .card-price {
    font-size: 19px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .m-head img {
    width: 72px;
    height: 72px;
  }
  .m-price {
    font-size: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .card,
  .skeleton {
    transition: none;
    animation: none;
  }
}
