:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-muted: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #1a1a1a;
  --text-muted: #4b5563;
  --border: #d5dce6;
  --lidl-blue: #0050aa;
  --lidl-yellow: #fff000;
  --lidl-red: #e60a14;
  --accent: #0050aa;
  --accent-contrast: #ffffff;
  --btn-primary-bg: #fff000;
  --btn-primary-text: #0050aa;
  --header-bg: #fff000;
  --header-text: #0050aa;
  --header-sub: #1a1a1a;
  --nav-active-bg: #0050aa;
  --nav-active-text: #ffffff;
  --focus: #0050aa;
  --shadow: 0 10px 28px rgba(0, 80, 170, 0.1);
  --overlay: rgba(0, 24, 58, 0.78);
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #ca8a04;
  --warn-soft: #fef9c3;
  --fail: #e60a14;
  --fail-soft: #fee2e2;
  --thumb-bg: #f4f6fb;
  --soon: #0050aa;
  --store: #6d28d9;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0b;
  --bg-muted: #121212;
  --surface: #1a1a1a;
  --surface-2: #222222;
  --text: #f2f2f2;
  --text-muted: #c6c6c6;
  --border: #3f3f3f;
  --accent: #e10600;
  --accent-contrast: #ffffff;
  --btn-primary-bg: #e10600;
  --btn-primary-text: #ffffff;
  --header-bg: #0b0b0b;
  --header-text: #f2f2f2;
  --header-sub: #c6c6c6;
  --nav-active-bg: #e10600;
  --nav-active-text: #ffffff;
  --focus: #e10600;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
  --overlay: rgba(0, 0, 0, 0.88);
  --ok: #2fa36b;
  --ok-soft: #12301f;
  --warn: #d4a017;
  --warn-soft: #2a2208;
  --fail: #e10600;
  --fail-soft: #3a0c0c;
  --thumb-bg: #111111;
  --soon: #3b82f6;
  --store: #a855f7;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: var(--accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.85rem 1.25rem 0.75rem;
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 1px 0 var(--border);
}

[data-theme="dark"] .site-header {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 3.15rem;
  height: 3.15rem;
  flex: 0 0 auto;
  border-radius: 0.85rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), 0 8px 16px rgba(0, 0, 0, 0.16);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.brand-sub {
  color: var(--header-sub);
  font-size: 0.82rem;
}

.theme-toggle {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--header-text) 25%, transparent);
  background: color-mix(in srgb, var(--header-text) 8%, transparent);
  color: var(--header-text);
  cursor: pointer;
  padding: 0;
}

.theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.theme-icon-moon svg {
  fill: currentColor;
  stroke: none;
}

[data-theme="light"] .theme-icon-sun,
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.app-nav {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--header-text) 22%, transparent);
  color: var(--header-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-tab:hover {
  background: color-mix(in srgb, var(--header-text) 8%, transparent);
}

.nav-tab.is-active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-bg);
  color: var(--nav-active-text);
}

.health-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--text-muted);
  display: inline-block;
}

.health-dot.status-ok {
  background: var(--ok);
}

.health-dot.status-warn {
  background: var(--warn);
}

.health-dot.status-fail {
  background: var(--fail);
}

main {
  padding: 1rem 1.15rem 2rem;
  display: grid;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.05rem 1.15rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}

.controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.controls #search {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.country-filter {
  position: relative;
}

#deals-country-filter .country-filter-menu,
#offers-country-filter .country-filter-menu {
  left: auto;
  right: 0;
}

.country-filter-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 12rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.country-filter-menu[hidden] {
  display: none;
}

.country-filter-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
}

.country-filter-option:hover {
  background: var(--bg-muted);
}

.country-filter-option:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
}

.country-filter-option input {
  margin: 0;
  cursor: pointer;
}

.country-filter-all {
  font-weight: 600;
}

.country-filter-divider {
  height: 1px;
  margin: 0.25rem 0.35rem;
  background: var(--border);
}

.country-cell-dim {
  opacity: 0.38;
}

input,
button,
.manual-actions a,
.pdf-viewer-download {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

button,
.manual-actions a,
.pdf-viewer-download {
  cursor: pointer;
  min-height: 2.5rem;
}

button:hover,
.manual-actions a:hover,
.pdf-viewer-download:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.btn-primary,
#search-btn {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: transparent;
  font-weight: 700;
}

.mobile-sort {
  display: none;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
}

.mobile-sort .sort-btn {
  min-height: 2.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.55rem 0.45rem;
  font-size: 0.9rem;
}

.sort-btn {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sort-btn:hover,
.sort-btn.is-active {
  color: var(--accent);
}

.sort-btn.is-active::after {
  content: " \2193";
  font-size: 0.75rem;
}

.sort-btn.is-active.is-asc::after {
  content: " \2191";
}

tbody tr {
  cursor: pointer;
}

.products-table tbody tr:hover {
  background: var(--bg-muted);
}

ul {
  margin: 0;
  padding-left: 1.1rem;
}

.products-table td {
  vertical-align: top;
}

.cell-label {
  display: none;
}

.thumb-cell {
  width: 72px;
}

.product-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--thumb-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.product-thumb[data-lightbox] {
  cursor: zoom-in;
}

.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.lang-tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.7rem;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(78px, 1fr));
  gap: 0.3rem;
}

.country-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.country-link:hover .country-cell {
  border-color: var(--accent);
  background: var(--surface);
}

.country-link:focus-visible .country-cell {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.country-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0.35rem 0.4rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  text-align: center;
  min-height: 70px;
}

.country-cell-empty {
  opacity: 0.55;
}

.country-head {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--text);
}

.country-head .flag {
  font-size: 1rem;
  line-height: 1;
}

.country-head .cc {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.country-price {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

.country-price-was {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.deal-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem;
}

.deal-pill {
  display: inline-block;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: var(--fail);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.deal-pill-day {
  background: var(--lidl-yellow, #fff000);
  color: #111;
}

[data-theme="dark"] .deal-pill-day {
  background: var(--accent);
  color: #fff;
}

.deal-pill-low {
  background: var(--ok);
  color: #fff;
}

.deal-pill-country {
  background: var(--lidl-blue, #0050aa);
  color: #fff;
}

.deal-low-was {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.deals-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.deal-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.deal-card:hover {
  border-color: var(--accent);
}

.deal-card.is-expired {
  background: #ececec;
  border-color: #d0d0d0;
  color: #8a8a8a;
}

.deal-card.is-expired .deal-kicker,
.deal-card.is-expired .deal-meta,
.deal-card.is-expired .country-price-was,
.deal-card.is-expired .deal-link {
  color: #9a9a9a;
}

.deal-card.is-expired .deal-pill:not(.deal-pill-low):not(.deal-pill-country),
.deal-card.is-expired .deal-pill-day {
  background: #c8c8c8;
  color: #555;
}

[data-theme="dark"] .deal-card.is-expired {
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #8d8d8d;
}

[data-theme="dark"] .deal-card.is-expired .deal-pill:not(.deal-pill-low):not(.deal-pill-country),
[data-theme="dark"] .deal-card.is-expired .deal-pill-day {
  background: #4a4a4a;
  color: #c6c6c6;
}

.deal-card img,
.deal-thumb-empty {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--thumb-bg);
  border: 1px solid var(--border);
}

.deal-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.deal-kicker {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.deal-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.3;
}

.deal-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.deal-price strong {
  font-size: 1.15rem;
}

.deal-meta {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.deal-link {
  display: inline-flex;
  margin-top: 0.45rem;
  font-weight: 700;
  text-decoration: none;
}

.avail-pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: #64748b;
  white-space: nowrap;
}

.avail-available {
  background: var(--ok);
}

.avail-sold_out {
  background: var(--fail);
}

.avail-available_soon {
  background: var(--soon);
}

.avail-store_only {
  background: var(--store);
}

.avail-unknown {
  background: #64748b;
  color: #f8fafc;
}

#availability-history li,
#price-history li {
  margin-bottom: 0.2rem;
  line-height: 1.4;
}

#availability-history .avail-pill {
  margin-left: 0.25rem;
}

.products-table tr.is-expanded {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.product-history-row td {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem;
}

.inline-history h4 {
  margin: 0 0 0.7rem 0;
  font-size: 0.95rem;
  color: var(--text);
}

.inline-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 0.75rem;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.65rem;
}

.chart-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.chart-meta,
.chart-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.history-chart-svg {
  width: 100%;
  height: 170px;
  display: block;
}

.price-mobile {
  display: none;
}

.price-country-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.price-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.8rem, 1fr));
  gap: 0.4rem;
}

.price-country {
  display: contents;
}

.price-country-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
}

.price-country-chip strong {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.price-country-input:checked + .price-country-chip {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.price-country-input:focus-visible + .price-country-chip {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.price-country-detail {
  display: none;
  grid-column: 1 / -1;
  order: 1;
}

.price-country-input:checked ~ .price-country-detail {
  display: block;
}

.price-ends {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: end;
  margin: 0.15rem 0 0.35rem;
}

.price-ends strong {
  display: block;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.price-end-kicker,
.price-ends time,
.price-change span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.price-end-latest {
  text-align: right;
}

.price-change {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.price-change.down,
.price-step-delta.down {
  color: var(--ok);
}

.price-change.up,
.price-step-delta.up {
  color: var(--fail);
}

.price-change.flat,
.price-step-delta.flat {
  color: var(--text-muted);
}

.price-span {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0 0 0.35rem;
}

.price-spark {
  width: 100%;
  height: 4.6rem;
  display: block;
  margin: 0.2rem 0 0.35rem;
}

.price-spark polyline {
  fill: none;
  stroke: var(--spark, var(--accent));
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.price-spark circle {
  fill: var(--surface);
  stroke: var(--spark, var(--accent));
  stroke-width: 2;
}

.price-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16.5rem;
  overflow: auto;
}

.price-steps li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.55rem;
  align-items: baseline;
  padding: 0.48rem 0.1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.price-step-amount {
  font-weight: 700;
}

.chart-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-line-price {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.chart-point-price {
  stroke: var(--surface);
  stroke-width: 0.8;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  margin-bottom: 0.35rem;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.chart-line-avail {
  stroke-width: 2;
}

.chart-dot {
  stroke: var(--surface);
  stroke-width: 0.8;
}

.avail-bar {
  stroke: none;
}

.chart-line-avail.avail-available,
.chart-dot.avail-available,
.avail-bar.avail-available,
.chart-legend-swatch.avail-available {
  stroke: var(--ok);
  fill: var(--ok);
  background: var(--ok);
}

.chart-line-avail.avail-sold_out,
.chart-dot.avail-sold_out,
.avail-bar.avail-sold_out,
.chart-legend-swatch.avail-sold_out {
  stroke: var(--fail);
  fill: var(--fail);
  background: var(--fail);
}

.chart-line-avail.avail-available_soon,
.chart-dot.avail-available_soon,
.avail-bar.avail-available_soon,
.chart-legend-swatch.avail-available_soon {
  stroke: var(--soon);
  fill: var(--soon);
  background: var(--soon);
}

.chart-line-avail.avail-store_only,
.chart-dot.avail-store_only,
.avail-bar.avail-store_only,
.chart-legend-swatch.avail-store_only {
  stroke: var(--store);
  fill: var(--store);
  background: var(--store);
}

.chart-line-avail.avail-unknown,
.chart-dot.avail-unknown,
.avail-bar.avail-unknown,
.chart-legend-swatch.avail-unknown {
  stroke: #94a3b8;
  fill: #94a3b8;
  background: #94a3b8;
}

.history-chart-svg-avail {
  height: auto;
  min-height: 200px;
}

.lane-bg {
  fill: var(--bg-muted);
  opacity: 0.9;
}

.chart-row-label,
.chart-x-label {
  font-size: 9.5px;
  fill: var(--text-muted);
  font-family: inherit;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.stats-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-muted);
  padding: 0.7rem 0.85rem;
}

.stats-title {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.stats-value {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: break-word;
}

.health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.health-header h2 {
  margin: 0;
}

.health-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.health-back {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.server-chart-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 0.7rem;
}

.server-chart-bar .sort-btn {
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-muted);
}

.server-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.server-spark {
  height: 110px;
}

.health-banner {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--bg-muted);
}

.health-banner.status-ok {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.health-banner.status-warn {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.health-banner.status-fail {
  border-color: var(--fail);
  background: var(--fail-soft);
}

.health-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  margin-right: 0.45rem;
}

.health-pill.status-ok {
  background: var(--ok);
  color: #fff;
}

.health-pill.status-warn {
  background: var(--warn);
  color: #1a1a1a;
}

.health-pill.status-fail {
  background: var(--fail);
  color: #fff;
}

.health-section h3 {
  margin: 1rem 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.health-table {
  cursor: default;
  min-width: 720px;
}

.health-table tbody tr {
  cursor: default;
}

.health-table tbody tr.status-warn {
  background: var(--warn-soft);
}

.health-table tbody tr.status-fail {
  background: var(--fail-soft);
}

.health-issues,
.recent-meta,
.page-info {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.fx-card {
  margin-bottom: 0.25rem;
}

.health-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-list li {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0;
  font-size: 0.85rem;
}

.image-gallery-wrap,
.manuals-wrap,
.siblings-wrap {
  margin: 0.65rem 0 1rem;
}

.gallery-title,
.siblings-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.manuals-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.manual-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 420px;
  padding: 0.5rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.manual-icon {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 6px;
  background: var(--fail);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.manual-body {
  min-width: 0;
  flex: 1 1 auto;
}

.manual-name {
  font-size: 0.82rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.manual-meta {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.manual-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.manual-actions button,
.manual-actions a {
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  min-height: 2rem;
  text-decoration: none;
  white-space: nowrap;
}

.manual-count-badge {
  font-size: 0.72rem;
  color: #fff;
  background: var(--fail);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  display: inline-block;
  font-weight: 600;
}

.pdf-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--overlay);
  padding: 0.75rem;
}

.pdf-viewer[hidden] {
  display: none;
}

.pdf-viewer-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.pdf-viewer-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-viewer iframe {
  flex: 1;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.gallery-strip,
.siblings-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.gallery-thumb-link {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  line-height: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.gallery-thumb-link:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.gallery-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
  background: var(--thumb-bg);
}

.title-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.variant-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-count-badge {
  font-size: 0.72rem;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  display: inline-block;
  font-weight: 600;
  white-space: nowrap;
}

.active-variant-erp {
  color: var(--accent);
  font-weight: 600;
  margin-left: 0.2rem;
}

.sibling-card {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  max-width: 240px;
}

.sibling-card:hover {
  border-color: var(--accent);
}

button.sibling-card {
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 0;
}

.sibling-card.variant-card.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 0 0 1px var(--accent) inset;
  cursor: default;
}

.sibling-thumb,
.sibling-thumb-empty {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--thumb-bg);
}

.sibling-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sibling-meta {
  font-size: 0.78rem;
  min-width: 0;
}

.sibling-erp {
  font-weight: 600;
}

.sibling-label {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sibling-price {
  margin-top: 0.15rem;
}

.page-info {
  margin: 0.2rem 0 0.7rem;
}

.empty-state {
  padding: 1.4rem 0.4rem;
  text-align: center;
  color: var(--text-muted);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.95rem;
}

.pager-btn,
.pager-ellipsis {
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
}

.pager-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-ellipsis {
  border: none;
  background: transparent;
  color: var(--text-muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  padding: 1.2rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(92vw, 1100px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lightbox-close,
.lightbox-nav {
  background: #111;
  color: #fff;
  border: 0;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.6rem;
  height: 2.6rem;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-prev {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

@media (max-width: 800px) {
  .site-header {
    padding: 0.7rem 0.85rem 0.65rem;
  }

  .brand-mark {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.72rem;
  }

  .brand-title {
    font-size: 1.12rem;
  }

  .brand-sub {
    display: none;
  }

  main {
    padding: 0.75rem 0.7rem 1.5rem;
  }

  .panel {
    padding: 0.85rem 0.75rem 1rem;
    border-radius: 12px;
  }

  .controls {
    align-items: stretch;
  }

  .controls #search,
  .controls button,
  .controls .toggle,
  .controls .country-filter,
  .controls .country-filter button {
    width: 100%;
  }

  .country-filter-menu {
    right: 0;
    left: auto;
    width: min(18rem, 92vw);
  }

  #deals-view .health-header,
  #offers-view .health-header {
    flex-direction: column;
    align-items: stretch;
  }

  #deals-view .health-header-actions,
  #offers-view .health-header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  #deals-view .country-filter,
  #offers-view .country-filter,
  #deals-view .country-filter button,
  #offers-view .country-filter button,
  #deals-view .toggle,
  #offers-view .toggle,
  #deals-view #deals-reload-btn,
  #offers-view #offers-reload-btn {
    width: 100%;
  }

  .mobile-sort {
    display: flex;
    flex-wrap: wrap;
  }

  .products-wrap {
    overflow: visible;
  }

  .products-table thead {
    display: none;
  }

  .products-table,
  .products-table tbody {
    display: block;
    width: 100%;
  }

  .products-table tbody tr.empty-row,
  .products-table tbody tr.empty-row td {
    display: block;
    border: 0;
    padding: 0;
  }

  .products-table tbody tr.product-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-areas:
      "thumb title"
      "erp erp"
      "countries countries"
      "first last";
    gap: 0.45rem 0.7rem;
    margin: 0 0 0.75rem;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
  }

  .products-table tbody tr.product-row td {
    border: 0;
    padding: 0;
    width: auto;
  }

  .products-table tbody tr.product-row .thumb-cell {
    grid-area: thumb;
  }

  .products-table tbody tr.product-row .title-cell {
    grid-area: title;
  }

  .products-table tbody tr.product-row .erp-cell {
    grid-area: erp;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .products-table tbody tr.product-row .countries-cell {
    grid-area: countries;
  }

  .products-table tbody tr.product-row .first-seen-cell {
    grid-area: first;
    color: var(--text-muted);
    font-size: 0.78rem;
  }

  .products-table tbody tr.product-row .last-seen-cell {
    grid-area: last;
    color: var(--text-muted);
    font-size: 0.78rem;
  }

  .cell-label {
    display: inline;
    margin-right: 0.3rem;
    font-weight: 600;
  }

  .country-grid {
    display: flex;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
  }

  .country-cell,
  .country-link {
    min-width: 92px;
    flex: 0 0 92px;
  }

  .inline-history-grid {
    grid-template-columns: 1fr;
  }

  .price-desktop {
    display: none;
  }

  .price-mobile {
    display: block;
  }

  .product-history-row,
  .product-history-row td {
    display: block;
  }

  .product-history-row {
    margin: -0.5rem 0 0.85rem;
  }

  .manual-card {
    max-width: none;
    width: 100%;
  }

  .lightbox {
    padding: 0.6rem;
  }

  .lightbox img {
    max-height: 74vh;
  }
}
