:root {
  --ink: #17212b;
  --muted: #5c6875;
  --line: #dfe4e8;
  --paper: #fffdf8;
  --panel: #ffffff;
  --orange: #f36f21;
  --orange-dark: #c94d11;
  --blue: #0b78a8;
  --mint: #e3f5ed;
  --gold: #f5c543;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

.app-header {
  position: relative;
  min-height: 94vh;
  background: #111820;
  color: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(13, 18, 24, 0.84), rgba(13, 18, 24, 0.28) 58%, rgba(13, 18, 24, 0.68)),
    linear-gradient(rgba(19, 27, 35, 0.1), rgba(19, 27, 35, 0.58));
  pointer-events: none;
}

.header-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ghost-link {
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.hero {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 32px));
  margin: auto auto 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: end;
  gap: 24px;
}

.hero-copy {
  max-width: 820px;
  padding-bottom: 24px;
}

.eyebrow,
.section-kicker,
.panel-label,
.metric-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.eyebrow,
.section-kicker {
  color: var(--orange);
}

.hero h1 {
  margin: 0;
  font-size: 5.6rem;
  line-height: 0.95;
  max-width: 780px;
}

.intro {
  max-width: 680px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
}

.button.primary {
  background: var(--orange);
  color: white;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border-color: rgba(255, 255, 255, 0.36);
}

.hero-panel {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-panel strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.15;
}

.hero-panel span:last-child {
  display: block;
  color: var(--muted);
  margin-top: 10px;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: -28px;
  position: relative;
  z-index: 2;
}

.metric,
.advice,
.dashboard,
.sources {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(23, 33, 43, 0.06);
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1.15;
  margin-bottom: 8px;
}

.metric span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.advice,
.dashboard,
.sources {
  margin-top: 28px;
  padding: 24px;
}

.advice {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 24px;
  align-items: start;
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 2.35rem;
  line-height: 1.1;
}

.advice-list {
  display: grid;
  gap: 10px;
}

.advice-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 4px;
}

.advice-card strong {
  font-size: 1rem;
}

.advice-card span {
  color: var(--muted);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.section-note {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.filters {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(140px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
}

.field,
.check-field {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.check-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf9;
  white-space: nowrap;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

.chart-wrap {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfcfc;
}

.print-note {
  display: none;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}

.chart-head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(140px, 1fr) 82px;
  gap: 12px;
  align-items: center;
}

.bar-label {
  min-width: 0;
}

.bar-label strong,
.bar-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label span {
  color: var(--muted);
  font-size: 0.88rem;
}

.bar-track {
  height: 16px;
  border-radius: 999px;
  background: #e9edf0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-price {
  font-weight: 900;
  text-align: right;
}

.table-shell {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
  background: white;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
  background: #f8faf9;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.product-title {
  display: grid;
  gap: 4px;
}

.product-title strong {
  max-width: 360px;
}

.product-title span,
.subtle {
  color: var(--muted);
  font-size: 0.9rem;
}

.price {
  font-weight: 900;
  white-space: nowrap;
}

.old-price {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: line-through;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--mint);
  color: #1d5f42;
}

.badge.offer {
  background: #fff0d8;
  color: var(--orange-dark);
}

.badge.warn {
  background: #f5e8e8;
  color: #8d2c2c;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 900;
  color: var(--blue);
  background: white;
}

.source-link:hover,
.source-link:focus-visible,
.button:hover,
.button:focus-visible,
.ghost-link:hover,
.ghost-link:focus-visible {
  outline: 3px solid rgba(11, 120, 168, 0.24);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.source-card strong,
.source-card span {
  display: block;
}

.source-card span {
  color: var(--muted);
  margin: 6px 0 12px;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 34px;
  color: var(--muted);
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

@page {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  :root {
    --ink: #111111;
    --muted: #444444;
    --line: #cfcfcf;
    --paper: #ffffff;
    --panel: #ffffff;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    background: white;
    color: var(--ink);
    font-size: 9pt;
  }

  .topbar,
  .hero-actions,
  .filters,
  .chart-wrap,
  .print-action {
    display: none !important;
  }

  .app-header {
    position: relative;
    min-height: auto;
    background: white;
    color: var(--ink);
    display: block;
    overflow: visible;
  }

  .app-header::before {
    display: none;
  }

  .header-photo {
    position: relative;
    display: block;
    width: 100%;
    height: 36mm;
    margin-bottom: 5mm;
    object-fit: cover;
    object-position: center 36%;
    z-index: auto;
  }

  .hero,
  main,
  .footer {
    width: 100%;
    margin: 0;
  }

  .hero {
    display: block;
    padding-bottom: 8mm;
    border-bottom: 1px solid var(--line);
  }

  .hero-copy {
    max-width: none;
    padding: 0;
  }

  .hero h1 {
    font-size: 26pt;
    line-height: 1.05;
  }

  .intro {
    max-width: none;
    color: var(--muted);
    font-size: 10pt;
  }

  .hero-panel {
    margin-top: 5mm;
    box-shadow: none;
    border: 1px solid var(--line);
    padding: 8px;
  }

  .summary-grid {
    margin-top: 6mm;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .metric,
  .advice,
  .dashboard,
  .sources {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .metric {
    padding: 8px;
  }

  .metric strong {
    font-size: 14pt;
  }

  .advice,
  .dashboard,
  .sources {
    margin-top: 7mm;
    padding: 0;
    border: 0;
  }

  .advice {
    grid-template-columns: 0.85fr 1.15fr;
    gap: 8mm;
  }

  h2 {
    font-size: 16pt;
  }

  h3 {
    font-size: 11pt;
  }

  .section-heading {
    align-items: start;
  }

  .section-note,
  .print-note {
    display: block;
    color: var(--muted);
    font-size: 8.5pt;
  }

  .table-shell {
    overflow: visible;
    border: 0;
  }

  table {
    min-width: 0;
    font-size: 7.8pt;
  }

  th,
  td {
    padding: 5px 4px;
  }

  .product-title strong {
    max-width: none;
  }

  .product-title span,
  .subtle {
    font-size: 7.4pt;
  }

  .badge {
    min-height: 18px;
    padding: 0 5px;
    border: 1px solid var(--line);
    background: white !important;
    color: var(--ink) !important;
    font-size: 6.8pt;
  }

  .source-link {
    border: 0;
    min-height: auto;
    padding: 0;
    color: var(--ink);
    display: block;
    font-weight: 800;
  }

  .source-link::after {
    content: attr(href);
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 6.6pt;
    font-weight: 400;
    overflow-wrap: anywhere;
  }

  .source-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .source-card {
    padding: 7px;
    break-inside: avoid;
  }

  .footer {
    margin-top: 7mm;
    font-size: 8pt;
    border-top: 1px solid var(--line);
    padding-top: 4mm;
  }
}

@media (max-width: 1040px) {
  .summary-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .advice {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    max-width: 520px;
  }

  .hero h1 {
    font-size: 4.2rem;
  }

  h2 {
    font-size: 2rem;
  }

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

@media (max-width: 700px) {
  .app-header {
    min-height: auto;
    padding-bottom: 22px;
  }

  .app-header::before {
    background:
      linear-gradient(rgba(13, 18, 24, 0.72), rgba(13, 18, 24, 0.46) 36%, rgba(13, 18, 24, 0.86)),
      linear-gradient(90deg, rgba(13, 18, 24, 0.76), rgba(13, 18, 24, 0.18));
  }

  .header-photo {
    object-position: center 34%;
  }

  .topbar {
    width: min(1180px, calc(100% - 24px));
    padding: 12px 0;
    align-items: center;
    gap: 12px;
  }

  .brand {
    gap: 8px;
    font-size: 0.95rem;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .topbar-actions {
    gap: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(8, 12, 17, 0.46);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .ghost-link {
    min-height: 30px;
    padding: 0 11px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .ghost-link:first-child {
    background: rgba(255, 255, 255, 0.16);
  }

  .source-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .hero,
  main,
  .footer {
    width: min(1180px, calc(100% - 24px));
  }

  .hero {
    margin: 38px auto 0;
    gap: 16px;
  }

  .hero-copy {
    max-width: none;
    padding-bottom: 0;
  }

  .eyebrow,
  .section-kicker,
  .panel-label,
  .metric-label {
    font-size: 0.72rem;
  }

  .hero h1 {
    max-width: 11ch;
    font-size: 2.45rem;
    line-height: 0.98;
  }

  .intro {
    max-width: none;
    margin-top: 14px;
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
  }

  .hero-actions .print-action {
    grid-column: 1 / -1;
  }

  .button {
    min-height: 42px;
    padding: 0 12px;
    font-size: 0.92rem;
  }

  .hero-panel {
    max-width: none;
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
  }

  .hero-panel strong {
    font-size: 1.18rem;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
  }

  .metric {
    padding: 13px;
  }

  .metric strong {
    font-size: 1.32rem;
    margin-bottom: 5px;
  }

  .metric span:last-child {
    font-size: 0.82rem;
  }

  h2 {
    font-size: 1.45rem;
    line-height: 1.15;
  }

  .section-heading,
  .chart-head {
    display: grid;
    gap: 6px;
    align-items: start;
  }

  .section-note {
    max-width: none;
    font-size: 0.92rem;
  }

  .advice,
  .dashboard,
  .sources {
    margin-top: 16px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(23, 33, 43, 0.05);
  }

  .advice {
    gap: 14px;
  }

  .advice-card {
    padding: 12px;
  }

  .filters {
    margin-top: 16px;
    gap: 10px;
  }

  .field,
  .check-field {
    font-size: 0.84rem;
  }

  .field input,
  .field select,
  .check-field {
    min-height: 44px;
  }

  .check-field {
    white-space: normal;
  }

  .chart-wrap {
    margin-top: 16px;
    padding: 12px;
  }

  .chart-head span {
    font-size: 0.84rem;
  }

  .bar-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .bar-label {
    min-width: 0;
  }

  .bar-label strong,
  .bar-label span {
    white-space: normal;
  }

  .bar-track {
    grid-column: 1 / -1;
    height: 12px;
  }

  .bar-price {
    text-align: left;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .table-shell {
    margin-top: 14px;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
    background: transparent;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    box-shadow: 0 12px 26px rgba(23, 33, 43, 0.07);
  }

  td {
    display: grid;
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0;
    border: 0;
    align-items: start;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  td[data-label="Product"],
  td[data-label="Supermarkt"],
  td[data-label="Status"],
  td[data-label="Bron"] {
    grid-column: 1 / -1;
  }

  td[data-label="Product"] {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  td[data-label="Product"]::before,
  td[data-label="Supermarkt"]::before,
  td[data-label="Status"]::before,
  td[data-label="Bron"]::before {
    display: none;
  }

  td[data-label="Supermarkt"] {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 2px 0 0;
  }

  td[data-label="Supermarkt"] strong {
    font-size: 1rem;
  }

  td[data-label="Supermarkt"] .subtle {
    justify-self: start;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f1f5f3;
    color: var(--muted);
    font-weight: 800;
  }

  td[data-label="Prijs"],
  td[data-label="Per liter"],
  td[data-label="Per blik"] {
    min-height: 66px;
    padding: 9px;
    border: 1px solid #e6ece8;
    border-radius: var(--radius);
    background: #f8faf9;
    align-content: center;
  }

  td[data-label="Prijs"]::before,
  td[data-label="Per liter"]::before,
  td[data-label="Per blik"]::before {
    color: #66727f;
    font-size: 0.66rem;
  }

  td[data-label="Status"] {
    padding-top: 2px;
  }

  td[data-label="Bron"] {
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  td.empty-state {
    display: block;
    grid-column: 1 / -1;
  }

  td.empty-state::before {
    display: none;
  }

  .product-title strong {
    max-width: none;
    font-size: 1.08rem;
    line-height: 1.25;
  }

  .product-title span,
  .subtle {
    font-size: 0.84rem;
  }

  .product-title span:last-child {
    margin-top: 2px;
    line-height: 1.35;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .price {
    font-size: 1.04rem;
    line-height: 1;
  }

  .badge-row {
    gap: 6px;
  }

  .badge {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.74rem;
  }

  .source-link {
    justify-self: start;
    min-height: 32px;
    max-width: 100%;
    padding: 0 12px;
    font-size: 0.86rem;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .source-card {
    padding: 12px;
  }

  .footer {
    margin-top: 20px;
    margin-bottom: 24px;
    font-size: 0.86rem;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .hero {
    margin-top: 28px;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .hero-actions,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  td {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
