:root {
  --navy: #10245c;
  --navy-2: #1b3f8b;
  --red: #e10600;
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #e3e8ef;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ok: #0d7a45;
  --ok-bg: #e7f6ee;
  --no: #9b1c1c;
  --no-bg: #fdecec;
  --amber: #8a5a00;
  --amber-bg: #fff6df;
  --shadow: 0 10px 30px rgba(16, 36, 92, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.sr, .skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.skip:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  background: white;
  padding: 0.5rem 0.8rem;
  z-index: 20;
}

.wrap { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(244, 246, 248, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}
.top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding-top: 0.9rem;
}
.logo { width: 168px; height: auto; background: white; }
h1 { margin: 0; font-size: 1.7rem; line-height: 1.1; color: var(--navy); }
.source { margin: 0.2rem 0 0; color: var(--ok); font-size: 0.92rem; font-weight: 400; }
.excel {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--red);
  color: white;
  text-decoration: none;
  font-weight: 700;
  border-radius: 2px;
  padding: 0.7rem 1rem;
  white-space: nowrap;
}
.excel:hover { background: #c10500; }
.excel:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid #8eb4ff;
  outline-offset: 2px;
}

.search { display: flex; gap: 0.6rem; margin-top: 0.85rem; }
.search input {
  flex: 1;
  border: 1px solid #cfd7e3;
  border-radius: 2px;
  padding: 0.8rem 0.95rem;
  background: white;
  font-size: 1.05rem;
}
.search input:focus { border-color: var(--navy); outline: none; }
.search button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.search button, .chip, .pager button {
  border: 0;
  background: var(--navy);
  color: white;
  border-radius: 2px;
  padding: 0.75rem 1rem;
  font-weight: 700;
}
.search button:hover, .pager button:hover { background: var(--navy-2); }

.banner {
  width: min(1180px, calc(100% - 2rem));
  margin: 0.8rem auto 0;
  background: #fff6df;
  color: #6b4700;
  border: 1px solid #f0ddaa;
  border-radius: 2px;
  padding: 0.75rem 1rem;
}

main { padding-top: 1rem; }
.accordion {
  background: white;
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 0.85rem;
}
.accordion summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  font-weight: 700;
  color: var(--navy);
}
.summary-label { display: inline-flex; align-items: center; gap: 0.45rem; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--navy);
  border-bottom: 2px solid var(--navy);
  transform: rotate(45deg);
  margin-right: 0.15rem;
}
.accordion:not([open]) > .accordion-body { display: none; }
.accordion[open] summary { border-bottom: 1px solid var(--line); }
.accordion[open] summary::after { transform: rotate(-135deg); margin-top: 0.2rem; }
.accordion-body { padding: 0.75rem 0.9rem 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.15rem 0 0.35rem; }
.chips.sub { margin-bottom: 0.4rem; }
.chip {
  background: white;
  color: var(--navy);
  border: 1px solid #d5deea;
  border-radius: 2px;
  padding: 0.4rem 0.75rem;
  white-space: nowrap;
  font-weight: 600;
}
.chip span { color: var(--muted); font-weight: 600; margin-left: 0.25rem; }
.chip.is-on { background: var(--navy); color: white; border-color: var(--navy); }
.chip.is-on span { color: #d5e2ff; }

.filters {
  display: grid;
  grid-template-columns: minmax(8.5rem, 1.5fr) minmax(7.5rem, 1fr) minmax(7.5rem, 1fr) minmax(10rem, 1.4fr) auto;
  gap: 0.65rem 0.75rem;
  align-items: end;
  background: white;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.75rem;
  margin-bottom: 0.85rem;
}
.filters label { display: grid; gap: 0.25rem; font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.filters select {
  width: 100%;
  min-width: 0;
  border: 1px solid #d5deea;
  border-radius: 2px;
  background: white;
  padding: 0.45rem 0.5rem;
  font-weight: 600;
  color: var(--ink);
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 700;
  padding: 0.45rem 0.2rem;
}
.results-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin: 0.9rem 0 0.35rem;
}
#count { margin: 0; font-weight: 700; color: var(--navy); }

.cols {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 12rem 5.2rem 9rem;
  gap: 0.75rem 1rem;
  align-items: center;
}
.list-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
}
.list-head span:nth-child(4),
.list-head span:nth-child(5),
.stock-col, .price { text-align: right; }
.list {
  background: white;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.item {
  width: 100%;
  text-align: left;
  background: white;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: #f7f9fc; }
.thumb, .ph {
  width: 64px;
  height: 64px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #f3f5f8;
  object-fit: contain;
}
.ph { display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.name { margin: 0; font-size: 1.02rem; font-weight: 700; color: var(--navy); }
.desc {
  margin: 0.12rem 0 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta { margin: 0.2rem 0 0; color: var(--ink); font-size: 0.92rem; }
.codes { display: grid; gap: 0.15rem; }
.codes small { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.codes strong { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92rem; font-weight: 600; }
.pill {
  display: inline-block;
  min-width: 2rem;
  text-align: center;
  border-radius: 2px;
  padding: 0.15rem 0.55rem;
  font-weight: 700;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.no { background: var(--no-bg); color: var(--no); }
.price strong { display: block; font-size: 1.05rem; }
.price small { color: var(--muted); }
mark { background: #ffe38a; color: inherit; padding: 0 0.08em; border-radius: 3px; }
.empty { margin: 0; padding: 2rem 1rem; text-align: center; color: var(--muted); }

.pager { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; justify-content: flex-end; margin: 0.8rem 0 1.4rem; }
.pager button[aria-current="page"] { background: var(--red); }
.pager button[disabled] { opacity: 0.4; cursor: default; }
.pager span { color: var(--muted); padding: 0 0.2rem; }

dialog {
  width: min(920px, calc(100% - 1.5rem));
  border: 0;
  border-radius: 2px;
  padding: 0 0 1.2rem;
  box-shadow: 0 24px 80px rgba(16, 36, 92, 0.28);
}
dialog::backdrop { background: rgba(16, 36, 92, 0.48); }
.ficha-bar { display: flex; justify-content: flex-end; padding: 0.6rem 0.8rem 0; }
.ficha {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 1.2rem;
  padding: 0 1.2rem;
}
.ficha img, .ficha .ph {
  width: 100%;
  height: 260px;
  border-radius: 2px;
}
.ficha h2 { margin: 0 0 0.35rem; color: var(--navy); font-size: 1.45rem; }
.ficha-precio { margin: 0.85rem 0 0; }
.ficha-precio small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ficha-precio strong { display: block; color: var(--navy); font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.ficha .desc { -webkit-line-clamp: unset; display: block; }
dl { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.35rem 0.6rem; margin: 0.9rem 0; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }
.web-link {
  display: inline-block;
  margin-top: 0.4rem;
  background: var(--navy);
  color: white;
  text-decoration: none;
  font-weight: 700;
  border-radius: 2px;
  padding: 0.65rem 0.95rem;
}

.whatsapp {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
}
.whatsapp-btn {
  position: relative;
  display: flex;
  width: 62.5px;
  height: 62.5px;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  background: #25d366;
  color: white;
  text-decoration: none;
  font-size: 2.125rem;
  box-shadow: 0 0 20px transparent;
}
.whatsapp-btn::before {
  content: "";
  position: absolute;
  padding: 31.25px;
  border: 6px solid #25d366;
  border-radius: 50%;
  animation: whatsapp-pulse 1.5s ease-out infinite;
  opacity: 0.75;
}
.whatsapp-btn:hover { background: #128c7e; box-shadow: 0 0 20px rgb(0 0 0 / 30%); }
@keyframes whatsapp-pulse {
  0% { padding: 31.25px; opacity: 0.75; }
  75% { padding: 62.5px; opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .whatsapp-btn::before { animation: none; }
}

@media (max-width: 800px) {
  .top { grid-template-columns: 1fr auto; }
  .logo { grid-column: 1 / -1; width: 140px; }
  .excel { grid-column: 2; grid-row: 2; align-self: start; }
  .titles { grid-column: 1; grid-row: 2; }
  .list-head { display: none; }
  .item.cols {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas:
      "photo body"
      "photo codes"
      "stock price";
  }
  .photo { grid-area: photo; }
  .body { grid-area: body; }
  .codes { grid-area: codes; }
  .stock-col { grid-area: stock; text-align: left; }
  .price { grid-area: price; }
  .ficha { grid-template-columns: 1fr; }
  .search { flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
}
