/* Kolory biorą się z motywu Telegrama; wartości zapasowe dla zwykłej przeglądarki. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #111317);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2a7ae2);
  --accent: var(--tg-theme-button-color, #2a7ae2);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --sep: color-mix(in srgb, var(--hint) 22%, transparent);
  --soft: color-mix(in srgb, var(--hint) 12%, transparent);
  --ok: #2fa24f;
  --warn: #d98a00;
  --radius: 14px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #101114; --surface: #1b1d22; --text: #eef0f3; --hint: #8b919c;
    --link: #5aa2ff; --accent: #3d8bfd; --accent-text: #fff; --danger: #ff6b6b;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
a { color: var(--link); }
[hidden] { display: none !important; }

#view { padding: 12px 12px calc(var(--tabbar-h) + var(--safe-b) + 24px); min-height: 100vh; max-width: 720px; margin: 0 auto; }
body.has-action #view { padding-bottom: calc(84px + var(--safe-b)); }
body.has-action.has-tabs #view { padding-bottom: calc(84px + var(--tabbar-h) + var(--safe-b)); }

/* ---------- tabbar ---------- */
#tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--tab-bg, color-mix(in srgb, var(--surface) 92%, transparent));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--sep);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--tab-text, var(--hint)); font-size: 11px; font-weight: 500; position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--tab-active, var(--accent)); }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- action bar ---------- */
#actionbar {
  position: fixed; left: 0; right: 0; z-index: 21;
  bottom: 0; padding: 10px 12px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--sep);
  display: flex; gap: 10px; align-items: center;
}
body.has-tabs #actionbar { bottom: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: 10px; border-top: 1px solid var(--sep); }
#actionbar > * { max-width: 696px; }

/* ---------- typography / layout ---------- */
h1 { font-size: 24px; line-height: 1.2; margin: 6px 4px 4px; letter-spacing: -0.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--hint); font-weight: 600; margin: 20px 16px 8px; }
.sub { color: var(--hint); margin: 0 4px 14px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 12px; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-wrap: break-word; }

.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.section { background: var(--surface); border-radius: var(--radius); padding: 4px 0; }
.section + .section { margin-top: 12px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 48px; position: relative; width: 100%; text-align: left; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.item .chev { color: var(--hint); font-size: 20px; line-height: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: 12px; font-weight: 600;
  background: var(--accent); color: var(--accent-text); width: 100%;
  transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.secondary { background: var(--soft); color: var(--accent); }
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; width: auto; }
.link-btn { color: var(--link); font-weight: 500; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--soft); color: var(--text); font-size: 17px; flex: none; }
.icon-btn:disabled { opacity: .35; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 12px; margin: 0 -12px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--surface); color: var(--text); font-weight: 500; font-size: 14px; white-space: nowrap; }
.chip.active { background: var(--accent); color: var(--accent-text); }
.chip .n { opacity: .6; margin-left: 4px; }

/* ---------- search ---------- */
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 0 12px; height: 40px; margin-bottom: 10px; }
.search svg { width: 18px; height: 18px; color: var(--hint); flex: none; }
.search input { border: 0; outline: 0; background: none; flex: 1; height: 100%; min-width: 0; }

/* ---------- shop header ---------- */
.shop-head { padding: 6px 4px 12px; }
.shop-head h1 { margin: 0 0 4px; }

.cat-banner { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.cat-banner img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pcard { background: var(--surface); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-align: left; position: relative; }
.pcard .ph { aspect-ratio: 1; background: var(--soft); position: relative; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .name { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pcard .bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.price { font-weight: 700; }
.old-price { color: var(--hint); text-decoration: line-through; font-size: 12px; font-weight: 400; margin-left: 4px; }
.pcard.soldout .ph img { filter: grayscale(1); opacity: .55; }
.add-mini { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-text); font-size: 20px; line-height: 1; display: grid; place-items: center; flex: none; }
.add-mini.in { background: var(--soft); color: var(--accent); font-size: 14px; font-weight: 700; }

.tag { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 600; background: rgba(0,0,0,.6); color: #fff; }
.tag.sale { background: var(--danger); }
.tag.low { background: var(--warn); }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--hint); font-size: 34px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--hint); }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill.info { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* ---------- product page ---------- */
.gallery { position: relative; margin: -12px -12px 12px; background: var(--surface); }
.gallery .track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery .track::-webkit-scrollbar { display: none; }
.gallery .track img, .gallery .track .noimg { flex: none; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; max-height: 70vh; }
.gallery .dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gallery .dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.55); transition: width .2s; box-shadow: 0 0 2px rgba(0,0,0,.4); }
.gallery .dots i.on { width: 16px; background: #fff; }
.pinfo { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.pinfo h1 { margin: 0 0 6px; font-size: 21px; }
.pinfo .price { font-size: 22px; }
.desc { margin-top: 12px; }
.attrs { width: 100%; border-collapse: collapse; }
.attrs td { padding: 10px 16px; border-top: 1px solid var(--sep); vertical-align: top; }
.attrs tr:first-child td { border-top: 0; }
.attrs td:first-child { color: var(--hint); width: 40%; }

/* ---------- stepper ---------- */
.stepper { display: inline-flex; align-items: center; background: var(--soft); border-radius: 12px; height: 48px; flex: none; }
.stepper button { width: 44px; height: 100%; font-size: 22px; color: var(--accent); }
.stepper button:disabled { opacity: .3; }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; }
.stepper.sm { height: 32px; border-radius: 10px; }
.stepper.sm button { width: 32px; font-size: 18px; }
.stepper.sm span { min-width: 24px; font-size: 14px; }

/* ---------- cart ---------- */
.cart-line { display: flex; gap: 12px; padding: 10px 14px; align-items: center; position: relative; }
.cart-line + .cart-line::before { content: ""; position: absolute; top: 0; left: 82px; right: 0; border-top: 1px solid var(--sep); }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--soft); flex: none; display: grid; place-items: center; color: var(--hint); overflow: hidden; }
.thumb.sm { width: 44px; height: 44px; border-radius: 8px; }
.total-row { display: flex; justify-content: space-between; padding: 12px 14px; font-weight: 700; font-size: 17px; }

/* ---------- forms ---------- */
.field { display: block; padding: 10px 14px; position: relative; }
.field + .field::before, .field + .toggle::before, .toggle + .field::before, .toggle + .toggle::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.field > span { display: block; font-size: 12px; color: var(--hint); margin-bottom: 2px; }
.field input, .field textarea, .field select { width: 100%; border: 0; outline: 0; background: none; padding: 2px 0; font-size: 16px; }
.field textarea { resize: vertical; min-height: 84px; }
.field select { appearance: none; -webkit-appearance: none; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; position: relative; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--sep); border-radius: 15px; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
.hint { font-size: 13px; color: var(--hint); margin: 6px 16px 0; }

.attr-row { display: flex; gap: 8px; padding: 6px 10px 6px 14px; align-items: center; }
.attr-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: var(--soft); border-radius: 8px; padding: 8px 10px; font-size: 15px; }
.attr-row input:first-child { flex: 0.8; }

/* ---------- image editor ---------- */
.imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 14px; }
.imgbox { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--soft); }
.imgbox img { width: 100%; height: 100%; object-fit: cover; }
.imgbox .ctrl { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.imgbox .ctrl button { width: 26px; height: 26px; border-radius: 7px; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; }
.imgbox .ctrl button:disabled { opacity: .3; }
.imgbox .main { position: absolute; top: 4px; left: 4px; font-size: 10px; padding: 2px 6px; border-radius: 6px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
.imgbox.pending { outline: 2px dashed var(--accent); outline-offset: -2px; }
.imgbox.pending .main { background: var(--warn); }
.addimg { aspect-ratio: 1; border-radius: 10px; border: 2px dashed var(--sep); display: grid; place-items: center; color: var(--hint); text-align: center; font-size: 12px; cursor: pointer; }
.addimg b { display: block; font-size: 26px; font-weight: 400; color: var(--accent); }

/* ---------- admin ---------- */
.seg { display: flex; background: var(--soft); border-radius: 11px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; height: 32px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--hint); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-left: 4px; vertical-align: 2px; }
.admin-prod { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; position: relative; }
.admin-prod + .admin-prod::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; border-top: 1px solid var(--sep); }
.admin-prod .main-hit { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; }
.stock-ctl { display: flex; align-items: center; gap: 4px; }
.stock-ctl b { min-width: 30px; text-align: center; font-size: 14px; }
.order { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.order + .order { margin-top: 10px; }
.order .lines { margin: 8px 0; font-size: 14px; }
.order .lines div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.order .meta { font-size: 14px; display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--sep); }
.order select { border: 0; background: var(--soft); border-radius: 10px; height: 34px; padding: 0 10px; font-weight: 600; outline: 0; }
.fab-row { display: flex; gap: 8px; margin-bottom: 12px; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--hint); }
.empty .big { font-size: 48px; margin-bottom: 8px; }
.loader { width: 28px; height: 28px; margin: 40vh auto 0; border-radius: 50%; border: 3px solid var(--sep); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast {
  position: fixed; left: 50%; top: 14px; transform: translate(-50%, -140%); z-index: 50;
  background: rgba(20,20,22,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px);
  transition: transform .25s; pointer-events: none; text-align: center;
}
#toast.show { transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-weight: 500; margin: 0 4px 10px; }

/* ---------- lokalizacje ---------- */
.nowrap { white-space: nowrap; }
.loc-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 44px; padding: 0 14px; margin-bottom: 10px; border-radius: 12px; background: var(--surface); text-align: left; font-weight: 600; }
.loc-btn .chev { color: var(--hint); font-size: 13px; }
.loc-btn.unset { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.loc-line { margin-top: 8px; font-size: 14px; color: var(--hint); }
.loc-line.bad { color: var(--danger); }
.loc-sub { color: var(--hint); }
.loc-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; position: relative; }
.loc-row + .loc-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.loc-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: 6px 0; }
.loc-row input:focus { border-bottom: 2px solid var(--accent); }
.danger-ic { color: var(--danger); }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; position: relative; cursor: pointer; }
.check-row + .check-row::before, .toggle + .loc-list .check-row:first-child::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.check-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-row .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--sep); flex: none; display: grid; place-items: center; transition: .15s; }
.check-row input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check-row input:checked + .box::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-text); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }

/* ---------- bottom sheet ---------- */
#sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto;
  background: var(--bg); border-radius: 18px 18px 0 0; padding: 8px 12px calc(16px + var(--safe-b));
  transform: translateY(100%); transition: transform .22s ease-out; max-width: 720px; margin: 0 auto;
}
.sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--sep); margin: 0 auto 10px; }
#sheet.open .sheet-bg { opacity: 1; }
#sheet.open .sheet { transform: none; }
.sheet-title { font-weight: 700; font-size: 17px; margin: 2px 4px 12px; }
.sheet-opt.sel { color: var(--accent); font-weight: 600; }
.sheet-opt .check { color: var(--accent); font-weight: 700; }

/* ---------- strona główna: kafelki ---------- */
.home-head { padding: 10px 4px 16px; text-align: center; }
.home-head h1 { margin: 0 0 6px; font-size: 26px; }
.tiles { display: grid; gap: 8px; }
.tile-row { display: flex; gap: 8px; }
.tile {
  flex: 1; min-width: 0; min-height: 60px; padding: 10px 12px; border-radius: 16px; position: relative;
  background: var(--tile-bg, var(--surface)); color: var(--tile-text, var(--text)); font-weight: 600; font-size: 15px; line-height: 1.25;
  display: flex; align-items: center; justify-content: center; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); transition: transform .08s;
}
.tile[data-act]:active { transform: scale(.97); }
.tile-label { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.tile.primary { background: var(--tile-hi, var(--accent)); color: var(--tile-hi-text, var(--accent-text)); min-height: 64px; font-size: 16px; }
.tile.sel { box-shadow: 0 0 0 2px var(--accent) inset; }
.tile.primary.sel { box-shadow: 0 0 0 3px var(--text) inset; }
.tile-arrow { position: absolute; top: 6px; right: 9px; font-size: 11px; font-style: normal; opacity: .55; }
.home-preview { background: var(--bg); border: 1px dashed var(--sep); border-radius: var(--radius); padding: 8px; }
.info-card { background: var(--surface); border-radius: var(--radius); padding: 16px; font-size: 16px; line-height: 1.5; }
.info-card h1 { margin: 0 0 12px; font-size: 22px; }
.warnbox { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); padding: 10px 12px; border-radius: 12px; margin: 0 0 12px; }
.emoji-row { display: flex; gap: 4px; overflow-x: auto; padding: 4px 10px 10px; scrollbar-width: none; }
.emoji-row::-webkit-scrollbar { display: none; }
.emoji-row button { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--soft); font-size: 19px; }

/* ---------- ekran „Wygląd” ---------- */
.palettes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.palette { background: var(--surface); border-radius: 12px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.palette.on { box-shadow: 0 0 0 2px var(--accent) inset; }
.palette .dots { display: flex; }
.palette .dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; box-shadow: 0 0 0 1px var(--sep); }
.palette .dots i:first-child { margin-left: 0; }
.color-row { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; position: relative; }
.color-row + .color-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.color-row input[type=color] { width: 40px; height: 34px; padding: 0; border: 0; border-radius: 10px; background: none; flex: none; cursor: pointer; }
.color-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type=color]::-webkit-color-swatch { border: 1px solid var(--sep); border-radius: 10px; }
.color-row input[type=color]::-moz-color-swatch { border: 1px solid var(--sep); border-radius: 10px; }
.color-row .hex { width: 78px; border: 0; outline: 0; background: var(--soft); border-radius: 8px; padding: 7px 8px; font: 13px ui-monospace, Menlo, Consolas, monospace; text-transform: lowercase; }
.color-row .auto-tag { font-size: 11px; color: var(--hint); }
.theme-preview { border: 1px dashed var(--sep); border-radius: var(--radius); padding: 10px; background: var(--bg); display: grid; gap: 10px; }
.mini-tabs { display: flex; justify-content: space-around; padding: 8px 0 4px; border-radius: 12px; background: var(--tab-bg, var(--surface)); }
.mini-tabs span { font-size: 11px; font-weight: 600; color: var(--tab-text, var(--hint)); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mini-tabs span.on { color: var(--tab-active, var(--accent)); }
.mini-tabs svg { width: 20px; height: 20px; }

/* ---------- dostęp ---------- */
.gate { text-align: center; padding: 16vh 12px 0; display: grid; gap: 12px; justify-items: center; }
.gate .big { font-size: 56px; }
.gate h1 { margin: 0; }
.gate p { color: var(--hint); margin: 0 0 8px; max-width: 360px; line-height: 1.5; }
.gate p b { color: var(--text); }
.gate .btn { max-width: 360px; }
.okbox { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--text); padding: 10px 12px; border-radius: 12px; margin: 0 0 12px; }
.warn-text { color: var(--warn); }
.check-row.radio .box { border-radius: 50%; }
.check-row.radio input:checked + .box::after { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--accent-text); transform: none; }
.check-row .grow { display: flex; flex-direction: column; min-width: 0; }
.inline-input { margin-top: 6px; border: 0; outline: 0; background: var(--soft); border-radius: 8px; padding: 8px 10px; font-size: 15px; width: 100%; }
.order-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sep); }

/* ---------- status zamówienia / natywne listy ---------- */
.status-btn { height: 34px; padding: 0 12px; border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--soft); color: var(--text); display: inline-flex; align-items: center; gap: 6px; flex: none; }
.status-btn .caret { font-size: 11px; opacity: .6; }
.status-btn.info { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.status-btn.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.status-btn.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.dot-st { width: 10px; height: 10px; border-radius: 50%; background: var(--hint); flex: none; }
.dot-st.info { background: var(--accent); }
.dot-st.ok { background: var(--ok); }
.dot-st.bad { background: var(--danger); }
select option { background: var(--surface); color: var(--text); }
.purge-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-weight: 600; text-align: left; }
.purge-btn .small { font-weight: 400; }
.sheet-opt:disabled { opacity: .45; }

/* ---------- sprzedawcy ---------- */
.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; background: var(--soft); }
.avatar.sm { width: 40px; height: 40px; }
.avatar.lg { width: 64px; height: 64px; }
.avatar.xl { width: 96px; height: 96px; }
.avatar.noava { display: inline-grid; place-items: center; font-weight: 700; color: var(--accent-text); background: var(--accent); font-size: 18px; }
.avatar.lg.noava { font-size: 26px; }
.avatar.xl.noava { font-size: 38px; }
.seller-list { display: grid; gap: 8px; }
.seller-card, .sold-by, .seller-now { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--tile-bg, var(--surface)); color: var(--tile-text, var(--text)); text-align: left; }
.seller-card .grow, .sold-by .grow { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.seller-name { font-weight: 600; }
.seller-st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hint); min-width: 0; }
.seller-st.open { color: var(--ok); font-weight: 600; }
.seller-st.big { font-size: 15px; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--hint); flex: none; opacity: .7; }
.sdot.open { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.sdot.pause { background: var(--warn); opacity: 1; }
.seller-now { margin-bottom: 10px; font-size: 14px; }
.profile-head { display: grid; justify-items: center; gap: 6px; padding: 4px 0 14px; text-align: center; }
.profile-head h1 { margin: 6px 0 0; }
.sched { width: 100%; border-collapse: collapse; }
.sched td { padding: 10px 16px; border-top: 1px solid var(--sep); }
.sched tr:first-child td { border-top: 0; }
.sched td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.sched tr.today td { font-weight: 700; }
.sched-note { padding: 10px 16px; border-top: 1px solid var(--sep); color: var(--hint); font-size: 14px; }
.sched-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 52px; position: relative; }
.sched-row + .sched-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.sched-day { width: 28px; font-weight: 600; }
.sched-row.off .sched-day { color: var(--hint); }
.sched-row input.hhmm { flex: 1; min-width: 0; border: 0; outline: 0; background: var(--soft); border-radius: 8px; padding: 8px; font-size: 15px; font-variant-numeric: tabular-nums; }
.switch.sm { width: 42px; height: 26px; }
.switch.sm i::after { width: 20px; height: 20px; }
.switch.sm input:checked + i::after { transform: translateX(16px); }
.ava-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.ava-row .grow { display: flex; align-items: center; gap: 12px; }
.ava-row label.btn { cursor: pointer; }
.invite { padding: 12px 14px; display: grid; gap: 10px; }
.invite-link { font: 13px ui-monospace, Menlo, Consolas, monospace; background: var(--soft); padding: 10px; border-radius: 10px; word-break: break-all; user-select: all; }

.sched-row input.hhmm { text-align: center; max-width: 96px; }
.sched-row input.hhmm.bad { box-shadow: 0 0 0 2px var(--danger) inset; }

/* ---------- własne listy wyboru ---------- */
select.native-hidden { display: none !important; }
.pick-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 16px; text-align: left; color: var(--text); min-height: 26px; }
.pick-btn .caret { color: var(--hint); font-size: 12px; }

/* ---------- tryb testowy ---------- */
#dev-pill { position: fixed; top: 8px; right: 8px; z-index: 30; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 12px; font-weight: 700; background: #ffcf33; color: #2b2100; box-shadow: 0 2px 8px rgba(0,0,0,.2); max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dev-pill .caret { opacity: .6; }
.sheet-opt[disabled] { opacity: .45; }
body.dev #view { padding-top: 46px; }

/* ---------- produkty sprzedawcy / „Kup u” ---------- */
.admin-prod.not-mine .grow { opacity: .75; }
.mam { display: flex; align-items: center; gap: 6px; cursor: pointer; flex: none; }
.ok-text { color: var(--ok); font-weight: 600; }
.sp-bulk { margin: -2px 2px 10px; flex-wrap: wrap; gap: 6px; }
.buy-row { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 0; position: relative; }
.buy-row + .buy-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--sep); }
.buy-row.sel { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.buy-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 14px; text-align: left; }
.buy-pick .grow { display: flex; flex-direction: column; min-width: 0; }
.radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--sep); flex: none; position: relative; }
.radio-dot.on { border-color: var(--accent); }
.radio-dot.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.psl .psl-row { padding-right: 10px; }
.sheet .psl { max-height: 60vh; overflow-y: auto; }
.dur-row { gap: 10px; }
.dur-row input { flex: 0 0 90px; border: 0; outline: 0; background: var(--soft); border-radius: 8px; padding: 8px 10px; font-size: 16px; }
.dur-row .pick-btn { flex: 1; background: var(--soft); border-radius: 8px; padding: 8px 10px; }

/* ---------- sortowanie / filtr w sklepie ---------- */
.shop-tools { display: flex; gap: 8px; margin: -2px 0 10px; }
.shop-tools:empty { display: none; }
.tool-btn { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface); display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
.tool-btn .ellipsis { flex: 1; text-align: left; }
.tool-btn .caret { color: var(--hint); font-size: 11px; }
.tool-btn.on { box-shadow: 0 0 0 1.5px var(--accent) inset; color: var(--accent); }
.group-head { margin: 16px 0 8px; }
.group-head:first-child { margin-top: 0; }
.group-title { font-weight: 700; font-size: 16px; padding: 0 4px; }
.sheet-opt .avatar.sm { width: 34px; height: 34px; }

/* ---------- PIN ---------- */
.pin-screen { text-align: center; padding: 6vh 8px 0; display: grid; justify-items: center; gap: 6px; }
.pin-screen .big { font-size: 44px; }
.pin-screen h1 { margin: 4px 0 0; }
.pin-screen p { margin: 0; max-width: 340px; }
.pin-dots { display: flex; gap: 12px; margin: 18px 0 4px; min-height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--hint); transition: .12s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: pinshake .35s; }
@keyframes pinshake { 0%,100% { transform: none; } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-err { min-height: 20px; color: var(--danger); font-size: 14px; font-weight: 600; }
.pinpad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; margin: 6px 0 10px; }
.pinpad button { height: 64px; border-radius: 50%; background: var(--surface); font-size: 26px; font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.pinpad button:active { background: var(--soft); transform: scale(.96); }
.pinpad button.ok { background: var(--accent); color: var(--accent-text); font-size: 18px; font-weight: 700; }
.pinpad button.ok:disabled { opacity: .35; }

/* ---------- zestawy i rabaty ilościowe ---------- */
.disc { display: inline-block; font-size: 11px; font-weight: 700; color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-radius: 6px; padding: 1px 5px; vertical-align: 1px; }
.disc-row { display: flex; justify-content: space-between; color: var(--ok); font-weight: 600; }
.lines .disc-row { padding-top: 2px; }
.deal-hint { color: var(--accent); font-weight: 500; margin-top: 2px; }
.deal-tag { font-size: 11.5px; font-weight: 600; color: var(--ok); margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .tiers { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none; }
.deal .tier { flex: 1 0 auto; min-width: 86px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 10px;
  border-radius: 12px; background: var(--soft); border: 1.5px solid transparent; transition: border-color .15s, background .15s; }
.deal .tier .t-min { font-size: 12.5px; color: var(--hint); }
.deal .tier .t-pct { font-size: 18px; color: var(--ok); }
.deal .tier .t-unit { color: var(--hint); }
.deal .tier.on { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.deal .tier.on .t-min, .deal .tier.on .t-unit { color: var(--text); }
.deal-link { display: block; max-width: 100%; text-align: left; margin-top: 2px; padding: 0; }
.tier-row { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 14px; }
.tier-row input { width: 64px; min-width: 0; border: 0; outline: 0; background: var(--soft); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 15px; text-align: center; }
.tier-row .icon-btn { margin-left: auto; }
.tier-prev { line-height: 1.6; }
.sheet .deal-fields h2 { margin-top: 14px; }

/* ostrzeżenie: serwer nie uruchomiony ponownie po aktualizacji */
.srv-warn { position: sticky; top: 0; z-index: 50; margin: 8px 12px 0; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); color: var(--text);
  display: flex; flex-direction: column; gap: 6px; }
.srv-warn .btn { align-self: flex-start; }
.srv-warn code { font-size: 12px; background: var(--soft); padding: 1px 5px; border-radius: 5px; }
