/* Terminy BRAT.pl – arkusz stylów (mobile-first, bez zewnętrznych bibliotek) */

:root {
    --bg: #f6f3ef;
    --surface: #ffffff;
    --ink: #1f1c1a;
    --ink-2: #4a4542;
    --muted: #7a736d;
    --line: #e8e2db;
    --line-strong: #d6cec5;

    --brand: #b14243;
    --brand-dark: #8e2f33;
    --brand-soft: #f9ecea;

    --warn: #8a4b00;
    --warn-bg: #fff2d9;
    --warn-line: #f1d39a;
    --ok: #1e6b3e;
    --ok-bg: #e5f4ea;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(31, 28, 26, .05), 0 4px 16px rgba(31, 28, 26, .05);
    --shadow-lift: 0 2px 4px rgba(31, 28, 26, .06), 0 10px 28px rgba(31, 28, 26, .09);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

    --gutter: 16px;
    --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; }
a { color: var(--brand-dark); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 100;
    background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid rgba(177, 66, 67, .45); outline-offset: 2px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: .01em; }

/* ---------- Nagłówek ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}
.brand__logo { width: 84px; height: auto; flex: none; }
.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand__title { font-weight: 700; font-size: 15px; }
.brand__sub { color: var(--muted); font-size: 13px; white-space: nowrap; }

.header-shop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.header-shop:hover { border-color: var(--brand); color: var(--brand-dark); }

/* ---------- Pasek wyszukiwania ---------- */

.search-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px 0;
    background: rgba(246, 243, 239, .92);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s, box-shadow .2s;
}
.search-bar.is-stuck {
    border-bottom-color: var(--line);
    box-shadow: 0 6px 20px rgba(31, 28, 26, .06);
}
.search-sentinel { height: 1px; margin-top: -1px; }

/* Przyklejony jest tylko pasek z wyszukiwarką (stała wysokość), filtry są pod nim w zwykłym przepływie.
   Wcześniej chowanie filtrów zmieniało wysokość paska i na telefonie ekran "skakał". */
.search-bar { overflow-anchor: none; }
.filters-wrap { padding-top: 2px; }
.filters-wrap .filters { margin-top: 0; }

.intro { padding-top: 18px; }
.intro__title {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: -.015em;
}
.intro__text { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

.search {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color .15s, box-shadow .15s;
}
.search:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(177, 66, 67, .12);
}
.search__icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search__input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 8px 0 44px;
    border: 0;
    background: transparent;
    font-size: 17px; /* >= 16px: iOS nie powiększa strony przy pisaniu */
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.search__input::placeholder { color: #a39b94; }
.search__input::-webkit-search-cancel-button { cursor: pointer; }
.search__scan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    height: 42px;
    margin-right: 5px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}
.search__scan:hover { background: var(--brand-dark); }
.search__scan:active { transform: scale(.97); }

.filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
/* Na telefonie dostępność na całą szerokość, pod nią kraj i sortowanie */
.filters .select--avail { grid-column: 1 / -1; }
.select { position: relative; display: block; min-width: 0; }
.select::after {
    content: "";
    position: absolute;
    right: 14px; top: 50%;
    width: 8px; height: 8px;
    border-right: 2px solid var(--ink-2);
    border-bottom: 2px solid var(--ink-2);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
.select select {
    width: 100%;
    height: 44px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 16px;
    text-overflow: ellipsis;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.select select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(177, 66, 67, .12); }
.select.is-active select { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }

/* ---------- Lista produktów ---------- */

.site-main { flex: 1; }

.result-count {
    margin: 14px 0 10px;
    color: var(--muted);
    font-size: 14px;
}
.result-count strong { color: var(--ink); }

.list-head { display: none; }

.product-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item {
    position: relative;
    display: grid;
    grid-template-columns: 64px 1fr;
    grid-template-areas:
        "img main"
        "img meta";
    column-gap: 12px;
    row-gap: 6px;
    align-items: start;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow .15s, border-color .15s, transform .1s;
}
.item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.item:has(.item__name:active) { transform: scale(.99); }

/* Cała karta jest klikalna (link rozciągnięty na kartę), a przyciski kopiowania leżą nad nim */
.item__name { color: inherit; text-decoration: none; }
.item__name::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.item__name:focus-visible { outline: none; }
.item__name:focus-visible::after { outline: 3px solid rgba(177, 66, 67, .45); outline-offset: 2px; }
.item .copy { position: relative; z-index: 1; }

.item__img {
    grid-area: img;
    width: 64px; height: 64px;
    border-radius: 10px;
    background: #f1ece6;
    object-fit: contain;
    overflow: hidden;
}
.item__img--empty {
    display: flex; align-items: center; justify-content: center;
    color: #bdb4ab;
}
.item__main { grid-area: main; min-width: 0; }
.item__name {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item__codes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 0 -6px;
}
.item__meta {
    grid-area: meta;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    min-width: 0;
}
.item__dates { display: flex; flex-wrap: wrap; gap: 4px; }
.item__country {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--ink-2);
    font-size: 14px;
}
.item__country svg { color: var(--muted); flex: none; }

@media (max-width: 359px) {
    .search__scan-label { display: none; }
    .search__scan { padding: 0 10px; }
    .brand__text { display: none; }
}
.item__arrow { display: none; }

mark { background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Kopiowanie EAN / symbolu ---------- */

.copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
    cursor: copy;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, border-color .15s, color .15s;
}
.copy svg { flex: none; opacity: .55; }
.copy:hover { background: #f3eee8; border-color: var(--line); color: var(--ink); }
.copy:hover svg { opacity: 1; }
.copy__done { display: none; }
.copy.is-copied { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.copy.is-copied .copy__icon { display: none; }
.copy.is-copied .copy__done { display: block; opacity: 1; }
.copy__label { font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: .03em; }

.copy--fact {
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
    margin: -6px 0 -4px;
    padding: 6px 10px;
    border: 1px dashed var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 16px;
    font-weight: 650;
    text-align: left;
}
.copy--fact span { overflow-wrap: anywhere; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 200;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 999px;
    text-align: center;
    background: #24201e;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    transform: translateX(-50%);
    animation: toast-in .18s ease-out;
}
.page-product .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
@media (min-width: 760px) { .page-product .toast { bottom: 24px; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Zestawy (ZST-) ---------- */

.set-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: #eef3fb;
    color: #1f3f6b;
    font-size: 15px;
}
.set-note svg { flex: none; margin-top: 1px; }
.set-note p { margin: 0; }
.chip--set { background: #eef3fb; color: #1f3f6b; }

/* ---------- Dostępność ---------- */

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot--ok { background: #2e8b57; }
.dot--off { background: #c0504f; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status--ok { background: var(--ok-bg); color: var(--ok); }
.status--off { background: #f6e6e4; color: #8e2f33; }

@media (max-width: 559px) {
    /* Na telefonie trzy równe przyciski, liczba produktów w drugiej linii */
}

@media (max-width: 479px) {
    /* EAN i symbol na całą szerokość, żeby kod nie łamał się w połowie */
    .facts .fact { grid-column: 1 / -1; }
}

/* ---------- Wyczyść filtry ---------- */

.result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    margin: 6px 0 4px;
}
.result-bar .result-count { margin: 0; }
.reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--brand);
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}
.reset:hover { background: var(--brand); color: #fff; }

/* Daty ważności (lista i strona produktu) */
.date, .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ok-bg);
    color: var(--ok);
    font-size: 13.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.date--short, .chip--short { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.date--past, .chip--past { background: #efebe7; color: var(--muted); font-weight: 500; }
.date--text, .chip--text { background: #efebe7; color: var(--ink-2); font-weight: 500; }
.chip--none { background: transparent; color: var(--muted); padding-left: 0; font-weight: 500; }
.date__note { font-weight: 500; font-size: 12px; }

/* Szkielet ładowania */
.item--skeleton { pointer-events: none; }
.item--skeleton .item__img, .sk {
    background: linear-gradient(90deg, #eee8e1 0%, #f7f3ee 50%, #eee8e1 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
}
.item--skeleton .item__dates, .item--skeleton .item__country { grid-area: meta; }
.item--skeleton .item__country { display: none; }
.sk { display: block; height: 14px; border-radius: 6px; margin: 4px 0; }
.sk--line { width: 85%; }
.sk--short { width: 45%; }
.sk--chip { width: 96px; height: 22px; border-radius: 999px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty {
    margin: 24px 0;
    padding: 28px 20px;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}
.empty svg { margin: 0 auto 8px; color: var(--muted); }
.empty__title { margin: 0 0 4px; font-weight: 700; font-size: 17px; }
.empty__text { margin: 0 auto 16px; max-width: 420px; color: var(--muted); font-size: 15px; }

.load-more { display: flex; justify-content: center; padding: 16px 0 32px; }

.notice {
    padding: 14px 16px;
    background: var(--warn-bg);
    border-radius: var(--radius-sm);
}

/* ---------- Przyciski ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    font-weight: 650;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn--block { width: 100%; }

/* ---------- Strona produktu ---------- */

.product-page { padding-top: 8px; padding-bottom: 32px; }

.crumbs { margin: 4px 0 10px; }
.crumbs__back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    margin-left: -6px;
    padding: 0 8px;
    border-radius: 10px;
    color: var(--ink-2);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
}
.crumbs__back:hover { background: #ece6df; color: var(--ink); }

.product {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.product__media {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    max-height: 36vh;
    padding: 16px;
    background: #fbf9f7;
    border-bottom: 1px solid var(--line);
    border-radius: 17px 17px 0 0;
}
.product__media img { width: auto; height: 100%; max-height: 100%; object-fit: contain; }
.placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: #b7ada3; font-size: 14px;
}
.product__body { padding: 18px 16px 20px; }
.product__name {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 16px;
    padding: 4px 12px 4px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
}
.badge__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--neutral { background: #efebe7; color: var(--ink-2); }
.badge--off { background: #f6e6e4; color: #8e2f33; }

.facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 18px;
}
.fact {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fdfcfa;
}
.fact--wide { grid-column: 1 / -1; }
.fact dt {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.fact dd { margin: 0; font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.fact__hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; }

.dates { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dates .date { font-size: 16px; padding: 5px 12px; }

.product__cta { margin: 0 0 22px; }

.description { border-top: 1px solid var(--line); padding-top: 16px; }
.description h2 { margin: 0 0 8px; font-size: 17px; }
.description__text { color: var(--ink-2); font-size: 15.5px; }
.description__text p { margin: 0 0 .7em; }
.description__text img { height: auto; }

.product__updated {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

/* Przycisk "Zobacz w sklepie" stoi zwykle pod danymi (bez przyklejania do dołu ekranu) */

/* ---------- Błędy ---------- */

.error-page { padding-top: 48px; padding-bottom: 64px; text-align: center; max-width: 560px; }
.error-page__code { margin: 0; font-size: 64px; font-weight: 800; color: var(--brand); line-height: 1; }
.error-page h1 { font-size: 24px; margin: 12px 0 8px; }
.error-page p { color: var(--ink-2); margin: 0 0 24px; }

/* ---------- Skaner kodów ---------- */

.scanner {
    width: 100%;
    max-width: 520px;
    max-height: 100%;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #111;
    color: #fff;
    overflow: hidden;
}
.scanner::backdrop { background: rgba(10, 10, 10, .75); }
.scanner__top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 8px 10px 16px;
}
.scanner__title { margin: 0; font-size: 17px; }
.scanner__close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff; cursor: pointer;
}
.scanner__view { position: relative; aspect-ratio: 3 / 4; max-height: 70vh; background: #000; }
.scanner__view video { width: 100%; height: 100%; object-fit: cover; }
.scanner__frame {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.scanner__frame span {
    width: 78%; height: 32%;
    border: 3px solid rgba(255, 255, 255, .9);
    border-radius: 14px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
    position: relative;
}
.scanner__frame span::after {
    content: ""; position: absolute; left: 6%; right: 6%; top: 50%;
    height: 2px; background: #ff5a5f;
    box-shadow: 0 0 10px #ff5a5f;
    animation: scanline 1.6s ease-in-out infinite alternate;
}
@keyframes scanline { from { transform: translateY(-28px); } to { transform: translateY(28px); } }
.scanner__hint { margin: 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); text-align: center; color: #ddd; font-size: 15px; }
.scanner__hint.is-error { color: #ffb4b4; }

@media (max-width: 559px) {
    .scanner { max-width: none; width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; display: none; flex-direction: column; }
    .scanner[open] { display: flex; }
    .scanner__view { flex: 1; aspect-ratio: auto; max-height: none; }
}

/* ---------- Stopka ---------- */

.site-footer {
    margin-top: 24px;
    background: #24201e;
    color: #cfc7bf;
    font-size: 14px;
}
.site-footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    text-align: center;
}
.site-footer a { color: #fff; }
.sync-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; max-width: 520px; text-align: left; }
.sync-note svg { flex: none; margin-top: 3px; }
.social { display: flex; gap: 4px; }
.social a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%;
    color: #a99f96;
}
.social a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.copyright { margin: 0; font-size: 12.5px; color: #8f857c; }

/* ---------- Większe ekrany ---------- */

@media (min-width: 480px) {
    .brand__logo { width: 100px; }
    .brand__title { font-size: 16px; }
}

@media (min-width: 760px) {
    :root { --gutter: 24px; }

    .site-header__inner { min-height: 76px; }
    .brand__logo { width: 120px; }

    .intro { padding-top: 28px; }
    .intro__title { font-size: 30px; }
    .intro__text { font-size: 16px; }
    .search-bar { padding: 14px 0; }
    .search { max-width: 760px; }
    .search__input { height: 56px; font-size: 18px; }
    .filters { grid-template-columns: repeat(3, minmax(0, 260px)); }
    .filters .select--avail { grid-column: auto; }

    .product-page { padding-top: 16px; }
    .product { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
    .product__media { aspect-ratio: auto; max-height: none; min-height: 420px; border-bottom: 0; border-right: 1px solid var(--line); border-radius: 17px 0 0 17px; padding: 32px; }
    .product__media img { height: auto; max-height: 460px; width: 100%; }
    .product__body { padding: 28px 28px 24px; }
    .product__name { font-size: 28px; }
}

@media (min-width: 960px) {
    .list-head, .item {
        grid-template-columns: 56px minmax(0, 1fr) 100px 140px 190px 140px 20px;
        grid-template-areas: "img main price status dates country arrow";
        align-items: center;
        column-gap: 16px;
    }
    .list-head {
        display: grid;
        padding: 0 13px 6px;
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .05em;
    }
    .product-list { gap: 6px; }
    .item { padding: 10px 12px; }
    .item__img { width: 56px; height: 56px; }
    .item__meta { display: contents; }
    .item__dates { grid-area: dates; }
    .item__country { grid-area: country; }
    .item .status { grid-area: status; justify-self: start; }
    .item__price { grid-area: price; font-size: 15px; }
    .item--skeleton .item__dates { grid-area: dates; }
    .item--skeleton .item__country { grid-area: country; display: block; }
    .item__arrow { display: block; grid-area: arrow; color: var(--line-strong); }
    .item:hover .item__arrow { color: var(--brand); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- Zestawy: odesłanie do pojedynczej sztuki ---------- */

.chip--ref {
    position: relative;
    z-index: 1;
    border: 0;
    background: #eef3fb;
    color: #1f3f6b;
    font-family: inherit;
    cursor: pointer;
}
.chip--ref:hover { background: #dfe9f8; }
.chip--ref svg { flex: none; }

/* Długie teksty zamiast daty - skracane, pełny tekst w podpowiedzi */
.chip--text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.date--text { white-space: normal; }

.ref-link {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 10px;
    background: #eef3fb;
    color: #1f3f6b;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}
.ref-link:hover { background: #dfe9f8; }
.ref-link__code { padding: 1px 8px; border-radius: 6px; background: #fff; font-weight: 700; }

/* ---------- Legenda kolorów dat ---------- */

.help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 20px;
    height: 20px;
    margin-left: 4px;
    padding: 0;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font: 700 12px/1 var(--font);
    vertical-align: middle;
    cursor: pointer;
}
button.help:hover { color: var(--brand); }
button.help::before { content: ""; position: absolute; width: 44px; height: 44px; } /* większe pole dotyku */
button.help { position: relative; }

.legend-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    min-height: 36px;
    padding: 0 6px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.legend-link .help { margin: 0; }
.legend-link:hover { color: var(--brand-dark); }

.legend {
    width: min(480px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.legend::backdrop { background: rgba(20, 16, 14, .55); }
.legend__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 10px 6px 20px;
}
.legend__head h2 { margin: 0; font-size: 18px; }
.legend__close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: transparent; color: var(--ink-2); cursor: pointer;
}
.legend__close:hover { background: #f1ece6; }
.legend__list { margin: 0; padding: 6px 20px 4px; }
.legend__list > div {
    display: grid;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.legend__list dt { display: flex; flex-wrap: wrap; gap: 4px; }
.legend__list dd { margin: 0; color: var(--ink-2); font-size: 15px; }
.legend__note { margin: 0; padding: 12px 20px 20px; color: var(--muted); font-size: 13.5px; }

@media (min-width: 560px) {
    .legend__list > div { grid-template-columns: 190px 1fr; align-items: center; gap: 12px; }
}
@media (min-width: 960px) {
    .legend-link { display: none; } /* na komputerze pytajnik jest w nagłówku kolumny */
}

/* Pasek wyników: licznik, legenda i "Wyczyść filtry" zawijają się na wąskim ekranie */
.result-bar { flex-wrap: wrap; row-gap: 4px; }
.result-bar .result-count { white-space: nowrap; }
.result-bar .reset { margin-left: auto; }
.legend-link { white-space: nowrap; }
.legend-link + .reset { margin-left: 0; }

/* ---------- Karta produktu: kafelki "Wszystkie produkty" i "Skanuj" ---------- */

.product-nav {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 4px 0 12px;
}
.product-nav:not(:has(.tile--scan:not([hidden]))) { grid-template-columns: 1fr; }
.tile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--ink);
    font: 650 16px/1.2 var(--font);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.tile:active { transform: scale(.98); }
.tile svg { flex: none; }
.tile--back svg { color: var(--muted); }
.tile--scan {
    justify-content: center;
    padding: 0 18px;
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}
.tile--scan:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* ---------- Ceny ---------- */

.item__price {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.fact--price { background: #fff; border-color: var(--line-strong); }
.price {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 2px;
}
.price__item { display: flex; flex-direction: column; gap: 2px; }
.price__label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.price__value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price__item--gross .price__value { font-size: 26px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; }
.price__sep { align-self: stretch; width: 1px; background: var(--line-strong); }

.vat { font-size: 20px; font-weight: 750; }

/* Symbol i VAT zawsze obok siebie, także na telefonie */
@media (max-width: 479px) {
    .facts .fact--pair { grid-column: auto; }
}

/* Eksport do Excela */
.export-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: #1d6f42;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}
.export-link:hover { border-color: #1d6f42; background: #eef7f1; }
.result-bar .export-link { margin-left: auto; }
.result-bar .export-link + .legend-link { margin-left: 0; }
@media (max-width: 479px) {
    .export-link span { display: none; } /* na telefonie sama ikonka */
    .export-link { padding: 0 10px; }
    .export-link::after { content: "Excel"; }
}

/* ---------- Karta produktu: data ważności i kraj w jednym prostokącie ---------- */

.split { display: flex; flex-wrap: wrap; gap: 12px 0; }
.split__item { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.split__item + .split__item { padding-left: 16px; margin-left: 16px; border-left: 1px solid var(--line-strong); }
.fact__label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.fact__label .help { margin-left: 0; }
.split__value { font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.split__value .dates .date { font-size: 15px; }
.fact--split dd { margin: 0; }
.product__cta { margin-top: 4px; }
/* bardzo wąskie ekrany: jedno pod drugim */
@media (max-width: 339px) {
    .split__item + .split__item { padding-left: 0; margin-left: 0; border-left: 0; padding-top: 12px; border-top: 1px solid var(--line); }
}

/* Telefon: ciaśniejsze etykiety w prostokącie data/kraj, kody w jednej linii */
@media (max-width: 479px) {
    .fact__label { font-size: 12px; letter-spacing: .02em; flex-wrap: nowrap; white-space: nowrap; gap: 5px; }
    .fact__label > svg { width: 14px; height: 14px; flex: none; }
    .fact__label .help { width: 18px; height: 18px; font-size: 11px; }
    .split__item + .split__item { padding-left: 12px; margin-left: 12px; }
    .split__value .dates .date { font-size: 14px; padding: 4px 10px; }
    .split__value .fact__hint { font-size: 12.5px; }
    .fact--pair .copy--fact { font-size: 14px; padding: 6px 8px; gap: 4px; }
    .fact--pair .copy--fact span { overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}

.shared-note { margin: 0; font-size: 15px; font-weight: 500; color: var(--ink-2); line-height: 1.45; }
.fact--split .ref-link { align-self: flex-start; }

/* Telefon: data i kraj zawsze obok siebie (kolumny po równo), etykieta może zawinąć się do 2 linii */
@media (min-width: 340px) and (max-width: 479px) {
    .split { flex-wrap: nowrap; }
    .split__item { flex: 1 1 0; }
    .fact__label { white-space: normal; flex-wrap: wrap; row-gap: 2px; }
}
@media (max-width: 339px) {
    .split__item { flex-basis: 100%; }
}
@media (min-width: 340px) and (max-width: 479px) {
    /* ikonka i tekst w jednej linii, zawijanie jak w zwykłym tekście */
    .fact__label { display: block; line-height: 1.5; }
    .fact__label > svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }
    .fact__label .help { display: inline-flex; vertical-align: -4px; margin-left: 2px; }
}

/* ---------- Karta produktu: "Wszystkie produkty" i "Skanuj" przyklejone u góry przy przewijaniu ---------- */
.page-product .product-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-left))) 4px;
    padding: 10px max(var(--gutter), env(safe-area-inset-left));
    background: rgba(246, 243, 239, .92);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    overflow-anchor: none;
}
.page-product .product-page { padding-top: 0; }

/* Logo z pliku SVG (np. TikTok) w kolorze pozostałych ikon - pokazywane dopiero, gdy plik istnieje */
.social__logo {
    display: none;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: var(--logo) center / contain no-repeat;
    mask: var(--logo) center / contain no-repeat;
}
.social__logo.is-ready { display: block; }
.social__logo.is-ready + .social__fallback { display: none; }
