/* Only what the app adds to the website's style.css */
.data-link { position: relative; }
.sync-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-dot[data-state="ok"] { background: var(--g-a); }
.sync-dot[data-state="off"] { background: var(--g-d); }
.drop-hint { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: oklch(0.16 0.009 220 / 0.82); }
.drop-hint > div { display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 40px 56px; border: 3px dashed var(--accent);
  border-radius: 20px; color: #fff; font-size: 1.25rem; text-align: center; }
.drop-hint[hidden] { display: none; }
.qr svg { width: 220px; height: 220px; background: #fff; border-radius: 12px; margin-top: 12px; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; }

/* ---------- app layout: tabs (bottom bar on phones, top bar on wide screens), Settings gear, round Scan button ---------- */
.app-header .wrap { gap: 8px; }
.app-header .logo { margin-right: 0; }
.app-tabs { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.app-tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: var(--radius);
  color: var(--ink-2); font-size: 0.9375rem; }
.app-tabs a:hover { background: var(--surface-3); color: var(--ink); }
.app-tabs a[aria-current="page"] { color: var(--accent-soft-ink); background: var(--accent-soft); font-weight: 600; }
.app-tabs .badge-count { top: 2px; right: 0; }
.settings-link { position: relative; flex: none; }
.settings-link[aria-current="page"] { color: var(--accent-soft-ink); background: var(--accent-soft); }
.settings-link .sync-dot { top: 6px; right: 6px; }
.fab-scan { position: fixed; right: max(16px, calc((100vw - 992px) / 2 + 16px)); bottom: 24px; z-index: 40; display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px; background: var(--accent); color: oklch(0.215 0.011 220);
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; box-shadow: 0 2px 6px oklch(0.2 0.01 220 / 0.25), 0 8px 24px oklch(0.2 0.01 220 / 0.25); }
.fab-scan:hover { background: var(--accent-hover); }
.fab-scan .icon { width: 24px; height: 24px; }
.fab-scan[hidden], .scanning .fab-scan, .sheet-open .fab-scan { display: none; }
main { padding-bottom: 104px; }
@media (max-width: 720px) {
  .app-header .wrap { height: 56px; }
  .app-header .logo { margin-right: auto; }
  .app-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0; justify-content: space-around;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .app-tabs a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: 56px; padding: 0 4px; font-size: 0.75rem; border-radius: 12px; max-width: 120px; }
  .app-tabs a[aria-current="page"] { background: none; }
  .app-tabs a[aria-current="page"] .icon { background: var(--accent-soft); border-radius: 999px; width: 52px; padding: 3px 0; height: 28px; }
  .app-tabs a span[data-t] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .app-tabs .badge-count { top: 2px; right: calc(50% - 26px); }
  .fab-scan { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 60px; height: 60px; padding: 0; justify-content: center; }
  .fab-scan span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .fab-scan .icon { width: 28px; height: 28px; }
  main { padding: 20px 0 170px; }
  .site-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}
.site-footer .wrap { font-size: 0.75rem; }
.app-head { align-items: center; margin-bottom: 16px; }
.app-head p { font-size: 0.9375rem; }

/* ---------- uniform square image tiles: white like a photo card (also in dark mode), the whole pack visible ---------- */
.thumb { background: #fff; object-fit: contain; padding: 3px; }
.thumb.blank { padding: 0; background: var(--surface-3); border-color: var(--line); }
.thumb.tile { width: 72px; height: 72px; border-radius: 10px; }
.product-fig { margin: 0; }
.product-fig figcaption { margin-top: 6px; }

/* ---------- filters folded away ---------- */
.filters { margin: 14px 0 18px; gap: 10px; }
.filter-box { position: relative; }
.filter-box summary { list-style: none; }
.filter-box summary::-webkit-details-marker { display: none; }
.filter-box[open] summary { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: transparent; }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-strong); color: #fff; font-size: 11px; font-weight: 700; }
.filter-panel { display: grid; gap: 12px; margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.filter-box[open] { flex-basis: 100%; order: 2; }
.filter-box[open] ~ .spacer { display: none; }
.filters .select { min-height: 36px; }

/* ---------- Scans ---------- */
.hist-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.hist-row { position: relative; display: flex; align-items: center; border-top: 1px solid var(--line); }
.hist-row:first-child { border-top: 0; }
.hist-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px 4px 12px 12px; border-radius: var(--radius-lg); }
.hist-main:hover .item-title { text-decoration: underline; text-underline-offset: 2px; }
.hist-main .thumb { width: 64px; height: 64px; }
.hist-main .item-meta { margin-top: 1px; gap: 2px 8px; }
.hist-main .item-meta > * + *::before { content: "·"; margin-right: 8px; color: var(--muted); }
.hist-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 5px; font-size: 0.8125rem; }
.hist-price { color: var(--ink-2); }
.hist-price b { font-weight: 700; color: var(--ink); }
.hist-when { align-self: start; padding-top: 2px; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.star-on { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: var(--promo); }
.star-on .icon { fill: currentColor; }
.hist-note { margin-top: 10px; }
.fav-filter[aria-pressed="true"] { color: var(--promo); background: var(--promo-soft); }
.fav-filter[aria-pressed="true"] .icon { fill: currentColor; }
.row-menu { position: relative; flex: none; margin-right: 6px; }
.row-menu summary { list-style: none; color: var(--muted); }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu[open] summary { background: var(--surface-3); color: var(--ink); }
.row-menu .menu-panel { position: absolute; right: 0; top: 44px; z-index: 20; width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: 0 8px 30px oklch(0.2 0.01 220 / 0.18); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius); background: none; color: var(--ink); font: inherit; font-size: 0.9375rem; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-3); }
@media (max-width: 440px) { .hist-main { grid-template-columns: 56px 1fr; gap: 10px; } .hist-main .thumb { width: 56px; height: 56px; }
  .hist-when { position: absolute; right: 52px; bottom: 12px; } .hist-line { padding-right: 70px; } }

/* health dot + word */
.hw { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); text-transform: capitalize; white-space: nowrap; }
.hw i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.hw-excellent i { background: var(--g-a); } .hw-good i { background: var(--g-b); } .hw-poor i { background: var(--g-d); } .hw-bad i { background: var(--g-e); }
.hw-n { color: var(--muted); font-weight: 500; }
.hw-none { color: var(--muted); font-weight: 500; text-transform: none; }

/* ---------- Better: pair cards ---------- */
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 12px; }
.pair { position: relative; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
:root:not(.dark) .pair { box-shadow: var(--shadow); }
.pair-side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; min-width: 0; }
.pair-side + .pair-side, .pair-swap + .pair-side { border-left: 1px solid var(--line); }
.pair-side:hover .pair-name { text-decoration: underline; text-underline-offset: 2px; }
.pair-side .thumb { margin-bottom: 6px; }
.pair-name { font-weight: 600; font-size: 0.9375rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pair-shop { font-size: 0.8125rem; color: var(--muted); }
.pair-price { margin-top: auto; padding-top: 6px; font-size: 0.8125rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 2px 8px; }
.pair-price b { color: var(--ink); }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 700; text-transform: capitalize; }
.verdict i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.verdict .icon { stroke-width: 3; width: 13px; height: 13px; }
.verdict.is-bad i { background: var(--g-e); color: var(--g-e-ink); }
.verdict.is-good i { background: var(--g-a); color: var(--g-a-ink); }
.verdict .num { font-weight: 500; color: var(--muted); }
.diff-good { color: var(--g-a); font-weight: 700; }
:root.dark .diff-good, :root[data-colors="safe"] .diff-good { color: var(--accent-ink); }
.diff-more { color: var(--muted); font-weight: 600; }
.pair-swap { position: absolute; left: 50%; top: 52px; transform: translate(-50%, -50%); display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; z-index: 1; }
.pair-swap:hover { background: var(--surface-3); color: var(--ink); }

/* ---------- comparison sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; z-index: 0; display: block; background: oklch(0.16 0.009 220 / 0.55); }   /* the website's style.css gives it a z-index: keep it under the sheet */
.sheet { position: relative; z-index: 1; width: min(100%, 560px); max-height: 88vh; overflow: auto; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0; background: var(--surface); border: 1px solid var(--line); }
@media (min-width: 721px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; } }
@media (max-width: 720px) { .sheet-wrap.sheet-over-tabs { bottom: calc(65px + env(safe-area-inset-bottom)); } .sheet-over-tabs .sheet { max-height: calc(88vh - 65px); } }   /* the side by side: above the tab bar */
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cmp { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.875rem; }
.cmp thead td { width: 30%; }
.cmp thead th { vertical-align: top; padding: 4px 6px 12px; font-weight: 600; text-align: left; }
.cmp thead th a { display: grid; gap: 4px; }
.cmp thead th span { line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.cmp thead th small { color: var(--muted); font-weight: 500; }
.cmp tbody th { text-align: left; font-weight: 500; color: var(--muted); padding: 9px 6px 9px 0; }
.cmp tbody td { padding: 9px 6px; font-variant-numeric: tabular-nums; }
.cmp tbody tr { border-top: 1px solid var(--line); }
.cmp td.win { font-weight: 700; }
.cmp td.win::after { content: " ✓"; color: var(--accent-ink); }

/* ---------- Settings ---------- */
.set-group { max-width: 680px; margin-top: 22px; }
.set-group:first-of-type { margin-top: 0; }
.set-group > h2 { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 4px 8px; }
.set-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 14px; }
.set-list { padding: 4px; display: grid; gap: 0; }
.set-list .menu-switch { width: 100%; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); }
.set-row + .set-row, .set-list .menu-switch + .menu-switch { border-top: 1px solid var(--line); border-radius: 0; }
.set-row:hover { background: var(--surface-3); }
.set-row > span { flex: 1; display: grid; gap: 2px; }
.set-row small { color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.set-row .icon { color: var(--muted); }
.set-about { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg button { min-height: 40px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: inherit; font-size: 0.9375rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px oklch(0.2 0.01 220 / 0.15); }
:root.dark .seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-soft-ink); }
@media (max-width: 400px) { .seg { grid-template-columns: repeat(2, 1fr); } }
.cat-row { display: flex; gap: 8px; overflow-x: auto; margin: 14px -16px 0; padding: 2px 16px 6px; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-row .cat-chip { flex: none; min-width: 84px; }
.pair-side { align-items: center; text-align: center; }
.pair-price { justify-content: center; }
.hist-main .item-meta { gap: 2px 4px; }
.hist-main .item-meta > * + *::before { margin-right: 4px; }
@media (max-width: 720px) { .site-footer { display: none; } }
@media (max-width: 720px) {
  .product-top { gap: 14px; }
  .product-fig { width: 168px; }
  .product-img { max-width: 168px; padding: 8px; }
  .product-title { font-size: 1.5rem; }
  .big-price { font-size: 1.875rem; }
}
.cmp thead th span { overflow-wrap: anywhere; hyphens: auto; }
@media (min-width: 721px) { .site-footer { padding-bottom: 96px; } }
@media (max-width: 560px) {
  .add-term .btn-label { display: none; }
  .add-term { width: 40px; padding: 0; }
  .add-term::after { content: ""; width: 18px; height: 18px; margin-left: -4px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='21' r='1'/%3E%3Ccircle cx='19' cy='21' r='1'/%3E%3Cpath d='M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='21' r='1'/%3E%3Ccircle cx='19' cy='21' r='1'/%3E%3Cpath d='M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12'/%3E%3C/svg%3E") center / contain no-repeat; }
  .add-term:disabled { width: auto; padding: 0 10px; }
  .add-term:disabled::after { display: none; }
}

/* ---------- product page: compact, prices first; two columns in landscape and on wide screens ---------- */
.pp { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side" "hist"; gap: 14px; }
.pp-main { grid-area: main; min-width: 0; } .pp-side { grid-area: side; min-width: 0; } .pp-hist { grid-area: hist; min-width: 0; }
@media (min-width: 640px) and (orientation: landscape), (min-width: 900px) {
  .pp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "main side" "hist side"; align-items: start; gap: 14px 22px; }
}
.pp-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; }
.pp-fig { margin: 0; }
.pp-fig .pp-img { width: 96px; height: 96px; max-width: none; padding: 6px; border-radius: var(--radius); }
.pp-fig .pp-img.blank .icon { width: 32px; height: 32px; }
.pp-fig figcaption { font-size: 0.625rem; margin-top: 2px; }
.pp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.pp-id .product-title { font-size: 1.25rem; line-height: 1.2; margin-top: 2px; }
.pp-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 4px; }
.pp-price .big-price { font-size: 1.375rem; }
.pp-h { font-size: 1.0625rem; margin: 0 0 6px; }
.pp-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; margin-top: 10px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 6px 4px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: none; color: var(--ink-2); font: inherit; cursor: pointer; text-align: center; }
.act:hover { background: var(--surface-2); color: var(--ink); }
.act .icon { width: 20px; height: 20px; }
.act-label { font-size: 0.6875rem; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.act[aria-pressed="true"] { color: var(--accent-soft-ink); background: var(--accent-soft); border-color: transparent; }
.act[aria-pressed="true"] .icon { fill: currentColor; }
.act:disabled { opacity: 1; color: var(--g-a-ink, var(--ink)); background: color-mix(in oklch, var(--g-a) 16%, transparent); }
.pp-contribute { margin-top: 10px; }
.pp-contribute .btn { min-height: 36px; }
.alts { margin-top: 6px; }
/* health, compact: score and grades in one line, the bars always shown */
.hc { padding: 12px; }
.hc-top { display: flex; align-items: center; gap: 12px; }
.ring.hc-ring { width: 58px; height: 58px; flex: none; }
.ring.hc-ring::before { inset: 6px; }
.ring.hc-ring b { font-size: 1.25rem; }
.hc-sum { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hc-word { font-weight: 700; text-transform: capitalize; }
.hc .badges { gap: 4px; }
.hc .badge { padding: 2px 8px 2px 3px; font-size: 0.75rem; }
.hc .badge:not(:has(.ns)) { padding-left: 8px; }
.hc .badge .ns { width: 18px; height: 18px; font-size: 0.6875rem; }
.hc-parts { margin-top: 8px; color: var(--ink-2); line-height: 1.5; }
.hc .implausible { margin-top: 8px; }
.hc-cols { display: grid; grid-template-columns: 1fr; gap: 4px 20px; margin-top: 8px; }
@media (min-width: 900px) { .hc-cols { grid-template-columns: 1fr 1fr; } }
.hc-title { display: flex; align-items: baseline; gap: 6px; font-size: 0.875rem; margin: 10px 0 2px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.hc-cols .hc-title { margin-top: 6px; }
.nr { display: grid; grid-template-columns: minmax(0, 1fr) auto 10px; grid-template-areas: "name val dot" "bar bar bar"; align-items: center;
  gap: 2px 8px; padding: 5px 0 6px; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
.nr.static { grid-template-areas: "name val dot"; }
.nr-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-val { grid-area: val; font-weight: 600; white-space: nowrap; }
.nr .dot { grid-area: dot; width: 10px; height: 10px; }
.nr-bar { grid-area: bar; position: relative; display: block; height: 10px; }
.nr-bands { position: absolute; left: 0; right: 0; top: 3px; height: 4px; display: flex; border-radius: 2px; overflow: hidden; opacity: 0.85; }
.nr-bands > span { display: block; height: 100%; }
.nr-mark { position: absolute; top: 0; width: 3px; height: 10px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 1.5px var(--surface); }
.hc-adds { list-style: none; margin: 0; padding: 0; }
.hc-add { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
.hc-add .tiny { margin-left: auto; }
.hc-add .hc-note { flex-basis: 100%; margin-left: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hc .ingredients { margin-top: 4px; max-height: 6em; }
.hc-src { margin-top: 10px; }
.hc-empty { padding: 16px; }
