:root {
  --lidl-blue: #0050aa;
  --lidl-yellow: #fff000;
  --lidl-red: #e60a14;
  --lidl-dark-blue: #002466;
  --lidl-light-blue: #008cd2;
  --lidl-light-yellow: #ffed70;
  --lidl-dark-red: #ad080f;
  --white: #ffffff;
  --line: #c9d8ef;
  --panel: #f6f9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Lidl Font Pro", "Segoe UI", Arial, sans-serif;
  color: var(--lidl-dark-blue);
  background: var(--white);
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 56px;
  display: grid;
  gap: 14px;
}

.hero {
  display: grid;
  gap: 8px;
}

.brand-hero {
  position: relative;
  overflow: hidden;
  background: var(--lidl-blue);
  color: var(--white);
  border: 2px solid var(--lidl-blue);
  border-radius: 14px;
  padding: 16px 18px;
}

.brand-circle {
  position: absolute;
  width: 124px;
  height: 124px;
  right: -10px;
  top: -8px;
  border-radius: 50%;
  background: var(--lidl-yellow);
}

.brand-rhombus {
  position: absolute;
  width: 66px;
  height: 66px;
  right: 96px;
  top: 18px;
  background: var(--lidl-red);
  transform: rotate(45deg);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 700;
}

h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

p {
  margin: 0;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.search-panel {
  display: grid;
  gap: 10px;
}

.search-form {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.filters-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-items: end;
}

.resolve-form {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--lidl-dark-blue);
}

input,
select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  color: var(--lidl-dark-blue);
  background: var(--white);
}

button,
.external-link,
.back-link,
.pager-link {
  border: 2px solid var(--lidl-blue);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: var(--lidl-blue);
  color: var(--white);
}

.back-link,
.external-link,
.pager-link {
  width: fit-content;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.checkbox input {
  width: auto;
  margin: 0;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.grid-form.compact {
  margin-top: 8px;
}

.result-summary,
.meta {
  font-size: 13px;
  color: var(--lidl-dark-blue);
}

.results {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.product-card {
  text-decoration: none;
  color: inherit;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.product-image-wrap {
  width: 100%;
  height: 116px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.product-image-placeholder {
  font-size: 12px;
  color: var(--lidl-dark-blue);
}

.product-top,
.flag-row,
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.discount,
.stock,
.chip,
.flag-pill {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
}

.discount {
  background: var(--lidl-red);
  color: var(--white);
}

.stock-ok {
  background: var(--lidl-blue);
  color: var(--white);
}

.stock-no {
  background: var(--lidl-dark-red);
  color: var(--white);
}

.chip {
  background: var(--lidl-light-yellow);
  color: var(--lidl-dark-blue);
}

.flag-pill {
  background: var(--panel);
  color: var(--lidl-dark-blue);
  border: 1px solid var(--line);
}

.product-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

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

.price {
  font-size: 20px;
  font-weight: 700;
  color: var(--lidl-dark-blue);
}

.price-muted {
  font-size: 14px;
}

.old-price {
  font-size: 13px;
  color: #5f7193;
  text-decoration: line-through;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

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

.stat {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  padding: 10px;
  display: grid;
  gap: 3px;
}

.stat span {
  font-size: 12px;
}

.stat strong {
  font-size: 19px;
}

.detail-image {
  width: min(100%, 300px);
  border: 2px solid var(--line);
  border-radius: 10px;
  object-fit: contain;
  background: var(--white);
}

.period-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
}

.history-table th {
  background: var(--panel);
}

.market-row.active {
  background: #fffbe0;
}

.chart-wrap {
  margin-top: 10px;
  height: 188px;
}

#historyChart {
  width: 100%;
  height: 100%;
}

.empty {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 14px;
  color: var(--lidl-dark-blue);
}

.admin-link a {
  color: var(--lidl-blue);
  font-weight: 700;
}

@media (max-width: 900px) {
  .filters-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .search-form,
  .filters-row,
  .resolve-form,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .brand-circle {
    width: 106px;
    height: 106px;
  }

  .brand-rhombus {
    width: 56px;
    height: 56px;
    right: 86px;
  }
}
