/* Radar de Ofertas. A data panel for buying stock: navy ink on white and cool grey,
   shelf-tag yellow only on the lowest price, condensed numerals as on a price tag,
   ruled lists instead of cards. */
:root {
  --ink: #14213d;
  --mute: #5a6780;
  --paper: #ffffff;
  --wash: #eef1f5;
  --rule: #c9d1dc;
  --tag: #ffd60a;
  --good: #0b7a4b;
  --bad: #b3261e;
  --focus: #1d4ed8;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* DIN-like condensed faces that ship with Windows and Android: the look of a price tag. */
  --figures: "Bahnschrift", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

/* An element marked hidden stays hidden even when a rule below gives it a display value. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font: 16px/1.4 var(--text);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
}

.top h1 { margin: 0; font: 700 1.25rem/1 var(--figures); font-stretch: condensed; letter-spacing: 0.02em; }
.who { display: flex; align-items: baseline; gap: 14px; font-size: 0.875rem; }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }
section > h2 { margin: 4px 0 2px; font: 700 1.6rem/1.1 var(--figures); font-stretch: condensed; }
section > h3 { margin: 28px 0 8px; font-size: 1rem; }
.lede { margin: 0 0 16px; color: var(--mute); }

/* Navigation: a bar at the thumb on phones. */
.tabs {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--rule);
}

.tab {
  padding: 14px 4px 16px;
  border: 0;
  border-top: 3px solid transparent;
  background: none;
  color: var(--mute);
  font-size: 0.875rem;
  font-weight: 600;
}

.tab[aria-current] { color: var(--ink); border-top-color: var(--ink); }

.badge {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 2px;
  padding: 0 5px;
  background: var(--ink);
  color: #fff;
  font: 700 0.75rem/1.5 var(--figures);
  text-align: center;
}

/* Forms */
form { display: grid; gap: 6px; padding: 14px; background: var(--paper); border: 1px solid var(--rule); }
label { margin-top: 6px; font-size: 0.875rem; font-weight: 600; }

input, textarea, select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
}

.primary {
  margin-top: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.primary:disabled { opacity: 0.55; cursor: default; }
.link { padding: 4px 0; border: 0; background: none; text-decoration: underline; }
.notice { color: var(--mute); }
.error { margin: 6px 0 0; color: var(--bad); font-weight: 600; }
.ok { margin: 6px 0 0; color: var(--good); font-weight: 600; }
.count { color: var(--mute); font-weight: 400; }

.banner { margin: 0 0 12px; padding: 10px 12px; background: var(--paper); border-left: 4px solid var(--ink); font-size: 0.9rem; }

/* Ruled lists */
.items { list-style: none; margin: 0; padding: 0; background: var(--paper); border-top: 1px solid var(--rule); }
.item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.item.text-only { grid-template-columns: 1fr; }
.thumb { width: 56px; height: 56px; object-fit: cover; background: var(--wash); }
.item p { margin: 0; overflow-wrap: anywhere; }
.item .body { white-space: pre-wrap; }
.item .meta, .meta { margin: 2px 0 0; color: var(--mute); font-size: 0.8125rem; }
.item .where { margin-top: 6px; font-weight: 600; }
.offers { margin: 4px 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.offers li { overflow-wrap: anywhere; }
.offers strong, .figure { font-family: var(--figures); font-stretch: condensed; font-variant-numeric: tabular-nums; white-space: nowrap; }
.retry { color: var(--bad); font-weight: 700; }
.offers-fold summary { margin: 4px 0; color: var(--ink); font-weight: 600; cursor: pointer; }
.item a { color: inherit; }

.tag { display: inline-block; margin-bottom: 4px; font-size: 0.8125rem; font-weight: 700; color: var(--mute); }
.tag.read { color: var(--good); }
.tag.failed { color: var(--bad); }

/* Onde comprar: the supplier scoreboard */
.board { width: 100%; margin: 0 0 8px; border-collapse: collapse; background: var(--paper); border-top: 4px solid var(--ink); }
.board caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.board td { padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.board td:first-child { padding-left: 14px; }
.board td:last-child { padding-right: 14px; }
.board .rank { width: 1.6em; font-size: 1.5rem; font-weight: 700; line-height: 1; }
.board .who-cell { font-weight: 700; }
.board .detail { display: block; color: var(--mute); font-size: 0.8125rem; font-weight: 400; }
.board .num { text-align: right; white-space: nowrap; }
.board .num .figure { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.board .above { font-size: 0.875rem; }
.board tr:first-child .num .figure { background: var(--tag); padding: 0 6px; }
.board .idle td { color: var(--mute); }
.board .idle .who-cell { font-weight: 400; }

.buy-list { margin-top: 22px; }
.buy-list h3 { margin: 0 0 6px; font-size: 1.0625rem; }
.buy { background: var(--paper); border-bottom: 1px solid var(--rule); }
.buy:first-of-type { border-top: 1px solid var(--rule); }
.buy > summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
.buy > summary::-webkit-details-marker { display: none; }
.buy-name { font-weight: 600; }
.buy-name .unit { color: var(--mute); font-weight: 400; }
.buy-price { font-size: 1.125rem; font-weight: 700; text-align: right; }
.buy-gap { grid-column: 1 / -1; color: var(--mute); font-size: 0.8125rem; }
.buy[open] > summary { border-bottom: 1px dashed var(--rule); }
.detail-box { padding: 4px 14px 12px; }

.sources { padding: 0 0 4px; }
.sources .primary { margin: 10px 14px 0; }
.sources .items li { display: block; padding: 10px 14px; border-bottom: 1px solid var(--rule); }

/* Price history */
.history { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); }
.history h4 { margin: 0 0 8px; font-size: 0.9375rem; }
.periods { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.period { padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); font-size: 0.875rem; }
.period[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.history-chart { display: block; width: 100%; height: auto; overflow: visible; }
.history-chart .grid { stroke: #e3e7ed; stroke-width: 1; }
.history-chart .tick { fill: var(--mute); font: 10.5px var(--text); }
.history-chart .tick.strong { fill: var(--ink); font-weight: 600; }
.history-chart .trace { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.history-chart .run { stroke-width: 2; stroke-linecap: round; opacity: 0.35; }
.history-chart .target-line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.history-chart .pt.on { stroke: var(--ink); stroke-width: 2.5; }
.history-chart .hit { fill: transparent; cursor: pointer; }
.history-chart .hit:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.readout { min-height: 2.6em; margin: 4px 0 6px; font-size: 0.875rem; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 0.8125rem; }
.legend li { display: flex; align-items: center; gap: 2px; }
.table-view { margin: 4px 0 10px; }
.table-view summary { color: var(--mute); font-size: 0.875rem; cursor: pointer; }
.target-form { margin-top: 10px; padding: 10px 0 0; border: 0; border-top: 1px dashed var(--rule); grid-template-columns: 1fr auto; align-items: end; }
.target-form label, .target-form .error { grid-column: 1 / -1; }
.target-form .primary { margin: 0; }
.banner.hit { border-left-color: var(--good); font-weight: 600; }

/* Product detail */
.deals { list-style: none; margin: 0; padding: 0; }
.deal { margin: 0 0 14px; padding: 14px 14px 10px; background: var(--paper); border-top: 4px solid var(--ink); }
.deal h3 { margin: 0; font-size: 1.0625rem; line-height: 1.25; }
.deal .unit { color: var(--mute); font-weight: 400; }

.headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 10px 0 2px; }

/* The lowest price, set like a shelf tag. */
.pricetag {
  padding: 2px 8px 0;
  background: var(--tag);
  font: 700 2rem/1.15 var(--figures);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pricetag small { font-size: 0.5em; font-weight: 600; }
.delta { font-weight: 700; }
.delta.good { color: var(--good); }
.delta.flat { color: var(--mute); font-weight: 400; }

.scale { display: block; width: 100%; height: auto; margin: 10px 0 2px; overflow: visible; }
.scale .axis { stroke: var(--rule); stroke-width: 2; }
.scale .dot { fill: var(--ink); }
.scale .dot.low { fill: var(--tag); stroke: var(--ink); stroke-width: 2; }
.scale .mark { stroke: var(--mute); stroke-width: 2; stroke-dasharray: 3 3; }
.scale text { fill: var(--mute); font: 11px var(--text); }

.stores { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9rem; }
.stores td { padding: 7px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.stores td.num { padding-left: 10px; text-align: right; font-weight: 700; }
.stores .low td.num span { background: var(--tag); padding: 0 4px; }
.stores .detail { display: block; color: var(--mute); font-size: 0.8125rem; font-weight: 400; }
.refs { margin: 8px 0 0; color: var(--mute); font-size: 0.8125rem; }

/* Conferir */
.matchbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 0;
  background: var(--wash);
}

.matchbar .primary { margin: 0; }
.matchrow { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.matchrow .offer-title { font-weight: 600; }
.matchrow .offer-title .figure { margin-right: 6px; font-size: 1.0625rem; font-weight: 700; }
.matchrow select { padding: 8px; }
.matchrow.open select { border-color: var(--bad); }

@media (min-width: 760px) {
  main { padding-bottom: 32px; }
  .tabs { position: static; max-width: 720px; margin: 0 auto; border-top: 0; border-bottom: 1px solid var(--rule); background: none; }
  .tab { border-top: 0; border-bottom: 3px solid transparent; }
  .tab[aria-current] { border-bottom-color: var(--ink); }
  .matchrow { grid-template-columns: 1fr 280px; align-items: center; }
}

@media (prefers-reduced-motion: no-preference) {
  .scale .dot { transition: r 120ms ease-out; }
}
