:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #ebe7dc;
  --text: #1f2523;
  --muted: #64706c;
  --line: #d8d2c4;
  --accent: #0b6b58;
  --accent-2: #a73b32;
  --shadow: 0 8px 24px rgba(31, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

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

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 32px clamp(18px, 4vw, 48px) 24px;
  border-bottom: 1px solid var(--line);
  background: #fffaf0;
}

.app-header > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.summary {
  flex: 0 0 auto;
  color: var(--muted);
  text-align: right;
  font-weight: 700;
}

main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 4vw, 32px) 48px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(140px, 1fr)) minmax(132px, auto) minmax(172px, auto);
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

.store-filter {
  display: grid;
  gap: 6px;
}

.store-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.store-checkbox {
  display: inline-flex;
  min-width: auto;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.store-checkbox:has(input:checked) {
  border-color: var(--accent);
  background: #e3f1ed;
  color: var(--accent);
}

.store-checkbox input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--accent);
}

.checkbox {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  color: var(--text);
  line-height: 1.2;
}

.checkbox input {
  flex: 0 0 auto;
  width: 16px;
  min-height: 16px;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.offers {
  display: grid;
  gap: 14px;
}

.cluster {
  background: var(--surface);
  border: 1px solid var(--line);
}

.cluster summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  padding: 14px 16px;
  background: var(--surface-2);
  font-weight: 900;
}

.cluster-count {
  color: var(--muted);
  font-weight: 800;
}

.product-group {
  border-top: 1px solid var(--line);
}

.product-group-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #f7f5f0;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.product-group-title span:last-child {
  color: var(--muted);
  font-weight: 800;
}

.offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 1px;
  background: var(--line);
}

.offer {
  display: grid;
  grid-template-rows: 140px 1fr;
  min-height: 318px;
  background: var(--surface);
}

.offer-media {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.offer-media img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: contain;
}

.offer-media.is-empty::before {
  content: "Geen foto";
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.offer-body {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.offer-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.deal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.deal-score,
.deal-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.deal-score {
  background: #1f2523;
  color: #fff;
}

.deal-badge {
  background: #f5e8df;
  color: var(--accent-2);
}

.stockpile {
  background: #e3f1ed;
  color: var(--accent);
}

.muted-badge {
  background: #eceff0;
  color: var(--muted);
}

.store-logo {
  display: inline-flex;
  min-width: 54px;
  min-height: 28px;
  justify-content: center;
  align-items: center;
  border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.store-logo-jumbo {
  background: #f4c400;
  color: #151515;
}

.store-logo-ah {
  background: #00ade6;
  color: #fff;
}

.store-logo-aldi {
  background: #1f55a5;
  color: #fff;
  box-shadow: inset 0 -4px 0 #f49b1b, inset 0 -7px 0 #d71920;
}

.store-logo-lidl {
  background: #0050aa;
  color: #ffdc00;
  box-shadow: inset 0 0 0 3px #ffdc00;
}

.store-logo-poiesz {
  background: #d71920;
  color: #fff;
}

.store-logo-generic {
  background: #e3f1ed;
  color: var(--accent);
}

.offer h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.offer-price {
  color: var(--accent-2);
  font-size: 22px;
  font-weight: 950;
}

.normal-price {
  color: var(--muted);
  text-decoration: line-through;
}

.deal {
  color: var(--text);
  font-weight: 800;
}

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

.offer a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.empty {
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  .app-header {
    display: grid;
    align-items: start;
    gap: 12px;
  }

  .summary {
    text-align: left;
  }

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

  .store-filter {
    grid-column: 1 / -1;
  }

  .checkbox {
    min-height: 44px;
    align-items: center;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding: 18px 12px 14px;
  }

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

  h1 {
    font-size: clamp(23px, 7vw, 28px);
    line-height: 1;
  }

  main {
    padding: 12px 8px 32px;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
  }

  .toolbar > label:first-child,
  .store-filter {
    grid-column: 1 / -1;
  }

  input,
  select {
    min-height: 38px;
    padding: 0 9px;
    font-size: 14px;
  }

  .store-checkboxes {
    align-items: stretch;
    gap: 5px;
    padding: 5px;
  }

  .store-checkbox {
    flex: 1 1 30%;
    justify-content: center;
    min-height: 26px;
    padding: 3px 6px;
    font-size: 11px;
  }

  .checkbox {
    min-height: 38px;
    align-items: center;
    font-size: 11px;
  }

  .meta,
  .cluster summary {
    display: grid;
  }

  .meta {
    gap: 6px;
    margin: 12px 0;
  }

  .cluster summary {
    padding: 12px;
  }

  .product-group-title {
    display: grid;
  }

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

  .offer {
    grid-template-rows: 104px 1fr;
    min-height: 0;
  }

  .offer-media {
    min-height: 104px;
    padding: 7px;
  }

  .offer-media img {
    height: 88px;
  }

  .offer-body {
    gap: 6px;
    padding: 8px;
  }

  .offer-top {
    display: grid;
    gap: 8px;
  }

  .offer h2 {
    font-size: 13px;
  }

  .offer-price {
    font-size: 18px;
  }

  .normal-price,
  .deal,
  .small,
  .offer a {
    font-size: 11px;
  }

  .deal-score,
  .deal-badge {
    min-height: 21px;
    padding: 2px 5px;
    font-size: 10px;
  }

  .store-logo {
    min-width: 44px;
    min-height: 24px;
    padding: 3px 6px;
    font-size: 10px;
  }
}
