/* Panel hurtowy — komputer: menu z boku; telefon: zakładki na dole. Kolory sklepu Pasmanteria Szczygieł. */
:root {
  --bg: #f6f3ec;
  --surface: #fff;
  --ink: #1d2620;
  --ink-2: #2a352d;
  --text: #23211c;
  --muted: #756d5f;
  --line: #e8e1d2;
  --line-2: #d9cfb9;
  --soft: #faf8f3;
  --accent: #a6303f;
  --accent-dark: #862533;
  --green: #3b5a46;
  --green-soft: #e7efe9;
  --gold: #a87a22;
  --gold-soft: #f6eedb;
  --red-soft: #f8e6e8;
  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 248px;
  --tabs-h: 62px;
  --shadow: 0 1px 2px rgba(29, 38, 32, .05), 0 4px 16px rgba(29, 38, 32, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font: 600 26px/1.2 Georgia, "Times New Roman", serif; letter-spacing: -.01em; }
h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; }
h2 svg { color: var(--muted); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
small { font-size: 12.5px; }
.muted { color: var(--muted); }
.strong { font-weight: 650; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.empty { margin: 0; padding: 28px 12px; color: var(--muted); text-align: center; }
.loading { margin: 0; padding: 22px; color: var(--muted); text-align: center; }

/* Przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: 600 14px/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; }
.btn-link { min-height: 0; padding: 4px 6px; border: 0; background: none; color: var(--muted); text-decoration: underline; }
.btn-link.danger { color: var(--accent); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 15.5px; }
.btn-block { width: 100%; }

/* Komunikaty */
.alert { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid #ecdcb5; }
.alert-ok { background: var(--green-soft); border-color: #c9dccf; color: #24402f; }
.alert-error { background: var(--red-soft); border-color: #eec7cc; color: #7d1f2b; }

/* Logowanie */
body.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px 16px; background: var(--ink); background-image: radial-gradient(circle at 20% 10%, #2f3e33 0, transparent 50%), radial-gradient(circle at 90% 90%, #3a2226 0, transparent 45%); }
.auth-box { width: 100%; max-width: 400px; padding: 30px 26px; border-radius: 14px; background: var(--surface); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-box .brand { margin-bottom: 22px; color: var(--text); }
.auth-box h1 { margin-bottom: 4px; }
.auth-box > .muted { margin: 0 0 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin: 16px 0 0; font-size: 13.5px; }
.auth-links a { color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 20px; padding: 4px; border-radius: 10px; background: var(--line); }
.auth-tabs a { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 7px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; }
.auth-tabs a:hover { color: var(--text); }
.auth-tabs a.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.auth-lead { margin: 0 0 16px; color: var(--text); font-size: 14.5px; line-height: 1.5; }
.auth-privacy { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.auth-privacy p { margin: 0; }
.auth-switch { margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); color: var(--text); font-size: 14.5px; text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 700; }

/* Logo */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 9px; background: var(--accent); }
.brand-mark img { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }

/* Układ */
.side { display: none; }
.page { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
.main { flex: 1; width: 100%; min-width: 0; max-width: 1240px; margin: 0 auto; padding: 18px 16px 28px; }
.page { min-width: 0; overflow-x: clip; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--ink); color: #fff;
}
.top-brand { flex: 1; min-width: 0; }
.top-client { display: none; }
.top-cart { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .1); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.top-cart .js-cart-total-top { display: none; }
.top-out { display: inline-flex; padding: 8px; opacity: .8; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; font-style: normal; }
.top-cart .count { position: absolute; top: -6px; right: -6px; }

.tier { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; background: var(--green-soft); color: var(--green); }
.tier-special { background: var(--gold-soft); color: var(--gold); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.is-active { color: var(--accent); }
.tabs .count { position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; font-size: 10.5px; }

.foot { display: flex; justify-content: space-between; gap: 12px; max-width: 1240px; width: 100%; margin: 0 auto; padding: 0 16px 18px; color: var(--muted); font-size: 12px; }
.foot a { text-decoration: none; letter-spacing: .04em; }

@media (min-width: 1024px) {
  body.app { padding-left: var(--side-w); }
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 25;
    display: flex; flex-direction: column; width: var(--side-w);
    padding: 20px 14px; background: var(--ink); color: #e9e4d8; overflow-y: auto;
  }
  .side .brand { padding: 0 6px 22px; color: #fff; }
  .side .brand-text strong { white-space: normal; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a, .side-foot a {
    display: flex; align-items: center; gap: 11px; padding: 10px 12px;
    border-radius: var(--radius-sm); color: #cfc8b8; text-decoration: none; font-weight: 550; font-size: 14.5px;
  }
  .side-nav a:hover, .side-foot a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
  .side-nav a.is-active { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
  .side-nav .count { margin-left: auto; }
  .side-rep { margin: 22px 4px 0; padding: 14px; border-radius: var(--radius); background: rgba(255, 255, 255, .06); font-size: 13px; }
  .side-rep small { display: block; margin-bottom: 2px; color: #a59d8b; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
  .side-rep strong { display: block; margin-bottom: 8px; color: #fff; }
  .side-rep a { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: #cfc8b8; text-decoration: none; word-break: break-all; }
  .side-rep svg { width: 15px; height: 15px; }
  .side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .08); }

  .page { padding-bottom: 0; }
  .top { padding: 12px 28px; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line); }
  .top-brand, .top-out { display: none; }
  .top-client { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; }
  .top-client strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-cart { margin-left: auto; background: var(--soft); border: 1px solid var(--line); }
  .top-cart .js-cart-total-top { display: inline; }
  .tabs { display: none; }
  .main { padding: 26px 28px 36px; }
  .foot { padding: 0 28px 20px; }
}

/* Nagłówek strony */
.page-head { margin: 4px 0 18px; }
.page-head .muted { margin: 4px 0 0; }
.page-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.page-head h1 .status { vertical-align: middle; margin-left: 6px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.back { display: inline-block; margin-bottom: 6px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Karty */
.card { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head a { color: var(--muted); font-size: 13.5px; text-decoration: none; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; }
.stack { min-width: 0; }
@media (min-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
  .cols-single { grid-template-columns: minmax(0, 1fr); }
  .cols-wide { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}

/* Pulpit */
.hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px; padding: 24px 22px; border-radius: 14px;
  background: var(--ink); background-image: linear-gradient(120deg, #1d2620 0%, #2b3a30 60%, #3d2a2c 100%); color: #fff;
}
.hero h1 { font-size: 28px; }
.hero p { margin: 6px 0 0; color: #d8d2c4; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .03em; }
.stat strong { display: block; margin-top: 3px; font-size: 16px; }
.shortcuts { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
.shortcut {
  display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.shortcut:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.shortcut svg { grid-row: span 2; width: 40px; height: 40px; padding: 9px; border-radius: 9px; background: var(--soft); color: var(--accent); }
.shortcut strong { font-size: 15px; }
.shortcut span { color: var(--muted); font-size: 13px; }
@media (min-width: 640px) { .shortcuts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .stats, .shortcuts { grid-template-columns: repeat(4, 1fr); } }
.rep-name { margin: 0 0 8px; font-size: 17px; font-weight: 650; }
.rep-links a { display: flex; align-items: center; gap: 8px; padding: 5px 0; text-decoration: none; word-break: break-all; }
.rep-links svg { color: var(--accent); }

/* Tabele */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th.num { text-align: right; }
.table a.strong { text-decoration: none; }
.table .sku { color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.status { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.status-new { background: var(--gold-soft); color: var(--gold); }
.status-work { background: #e5ecf6; color: #2d5281; }
.status-done { background: var(--green-soft); color: var(--green); }
.status-off { background: #eee; color: #777; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 14px; }

@media (max-width: 720px) {
  .table.orders thead { display: none; }
  .table.orders tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table.orders td { padding: 0; border: 0; }
  .table.orders td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; }
  .table.orders td.num { text-align: left; }
  .table.orders .row-actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: 8px; }
}

/* Formularze */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.field input, .field textarea, .filters select, .quick textarea, .search-box input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff;
  font: inherit; font-size: 16px; color: var(--text);
}
.field input:focus, .field textarea:focus, .filters select:focus, .quick textarea:focus, .search-box input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.check { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.grid-form { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.grid-form .field { flex: 1 1 100%; }
.grid-form .field.half { flex: 1 1 calc(50% - 6px); min-width: 140px; }
.grid-form .check { flex: 1 1 100%; }
.inline { display: inline; }

/* Zamów: kategorie | siatka | koszyk */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.cat-side, .order-side { display: none; }
@media (min-width: 1024px) {
  .order-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .cat-side { display: block; position: sticky; top: 78px; }
  .filters .js-cat { display: none; }
  .filters { grid-template-columns: 1fr !important; }
}
@media (min-width: 1500px) {
  .order-layout { grid-template-columns: 230px minmax(0, 1fr) 290px; }
  .order-side { display: block; position: sticky; top: 78px; }
}

.cat-card { padding: 14px 10px; max-height: calc(100vh - 100px); overflow-y: auto; }
.cat-card h2 { margin: 2px 8px 10px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cat-tree, .cat-tree ul { margin: 0; padding: 0; list-style: none; }
.cat-tree ul { margin-left: 12px; padding-left: 8px; border-left: 1px solid var(--line); }
.cat-row { display: flex; align-items: center; }
.cat-link { flex: 1; min-width: 0; padding: 7px 8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: 500 14px/1.3 inherit; font-family: inherit; text-align: left; cursor: pointer; }
.cat-link:hover { background: var(--soft); }
.cat-link.is-active { background: var(--red-soft); color: var(--accent-dark); font-weight: 650; }
.cat-toggle { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer; }
.cat-toggle:hover { background: var(--soft); }
.cat-toggle svg { width: 16px; height: 16px; transition: transform .15s; }
.cat-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

.quick { padding: 0; }
.quick summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; }
.quick summary::-webkit-details-marker { display: none; }
.quick summary svg { color: var(--accent); }
.quick summary .muted { margin-left: auto; font-size: 13px; }
@media (max-width: 560px) { .quick summary .muted { display: none; } }
.quick form { padding: 0 18px 18px; }
.quick textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; resize: vertical; }
.quick-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.quick-result { margin: 0; font-size: 13.5px; }
.quick-result.is-error { color: var(--accent); }

.filters { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .filters { grid-template-columns: 1fr 260px; } }
.search-box { position: relative; display: block; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 40px; }
.filters select { appearance: auto; }


/* Siatka produktów */
.grid-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin: 4px 0 12px; }
.grid-head h2 { font: 600 20px/1.25 Georgia, "Times New Roman", serif; }
.grid-head .muted { font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; padding: 0; list-style: none; transition: opacity .15s; }
.grid.is-loading { opacity: .45; pointer-events: none; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; } }
.tile { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.tile:hover { box-shadow: var(--shadow); border-color: var(--line-2); }
.tile.in-cart { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile-img { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; padding: 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: zoom-in; overflow: hidden; }
.tile-img img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .25s; }
.tile-img:hover img { transform: scale(1.04); }
.tile-img.no-img { cursor: default; background: var(--soft) url("icon.svg") center / 34% no-repeat; opacity: .5; }
.tile-badge { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
.tile-body { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 12px; }
.tile-name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
.tile-variant { margin: 0; color: var(--text); font-size: 13px; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 0; color: var(--muted); font-size: 12px; }
.tile-meta .stock { font-size: 12px; }
.tile-price { margin-top: auto; padding-top: 8px; }
.tile-price strong { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.tile-price strong span { color: var(--muted); font-size: 13px; font-weight: 500; }
.tile-price small { display: block; color: var(--muted); font-size: 12px; }
.tile-custom { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 11px; font-weight: 700; }
.tile-buy { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.tile-buy .qty { width: 100%; }
.tile-buy .qty input { flex: 1; width: auto; min-width: 0; }
.tile-add { width: 100%; min-height: 40px; }
.tile.in-cart .tile-add { background: var(--green); border-color: var(--green); }
@media (min-width: 900px) { .tile-buy { grid-template-columns: 1fr auto; } .tile-add { width: auto; padding: 8px 12px; } }
@media (min-width: 900px) and (max-width: 1100px) { .tile-buy { grid-template-columns: minmax(0, 1fr); } .tile-add { width: 100%; } }
.stock { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--green); white-space: nowrap; }
.stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock.low { color: var(--gold); }
.stock.out { color: var(--accent); }
.sku-line { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.avail { display: flex; margin: 10px 0 0; font-weight: 600; }
.sheet-price .avail { margin-top: 12px; font-size: 13.5px; }

/* Strony */
.js-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 6px 0 24px; }
.page-btn { min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; }
.page-btn:hover:not(:disabled) { border-color: var(--ink); }
.page-btn[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-gap { padding: 0 4px; color: var(--muted); }
@media (max-width: 520px) { .page-nav { flex: 1 1 100%; order: 2; } .js-pager { gap: 5px; } }

.qty { display: inline-flex; align-items: stretch; height: 40px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.qty button { width: 34px; border: 0; background: var(--soft); font: 600 18px/1 inherit; color: var(--text); cursor: pointer; }
.qty button:hover { background: var(--line); }
.qty input { width: 56px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font: 600 15px/1 inherit; font-family: inherit; color: var(--text); }
.qty input:focus { outline: 2px solid var(--ink); outline-offset: -2px; }
/* Mini-koszyk */
.mini-cart h2 { margin-bottom: 10px; }
.mini-lines { margin: 0 0 10px; padding: 0; list-style: none; max-height: 46vh; overflow-y: auto; }
.mini-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.mini-lines li span { min-width: 0; }
.mini-lines li small { display: block; color: var(--muted); }
.mini-lines li b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sum { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.sum strong { font-size: 16px; }
.sum-sub { color: var(--muted); font-size: 13.5px; }
.sum-grand { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.sum-grand strong { font-size: 20px; }
.mini-cart .btn { margin-top: 12px; }

.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 10px); z-index: 25;
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px;
  background: var(--accent); color: #fff; text-decoration: none; box-shadow: 0 8px 24px rgba(134, 37, 51, .35);
}
.cart-bar strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.cart-bar-go { font-weight: 650; }
@media (min-width: 1500px) { .cart-bar { display: none !important; } }
.view-catalog .main { max-width: 1680px; padding-bottom: 90px; }

/* Podsumowanie */
.checkout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; }
@media (min-width: 1024px) { .checkout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.cart-table .cart-name strong { display: block; font-weight: 600; }
.cart-table .cart-name small { color: var(--muted); }
.cart-table td.qty-cell { text-align: right; }
.cart-table .qty { height: 36px; }
.cart-table .qty input { width: 52px; }
.remove { padding: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }
.remove:hover { color: var(--accent); }
@media (max-width: 720px) {
  .cart-table thead { display: none; }
  .cart-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .cart-table td { padding: 0; border: 0; }
  .cart-table td.cart-name { grid-column: 1; }
  .cart-table td.cart-remove { grid-column: 2; grid-row: 1; text-align: right; }
  .cart-table td.cart-price { grid-column: 1; text-align: left; color: var(--muted); font-size: 13px; }
  .cart-table td.qty-cell { grid-column: 1; text-align: left; }
  .cart-table td.cart-total { grid-column: 2; grid-row: 2 / span 2; align-self: end; }
}
.choices { display: grid; gap: 8px; }
.choices-row { grid-template-columns: 1fr 1fr; }
.choice { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer; }
.choice input { margin: 2px 0 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.choice strong { display: block; font-size: 14px; }
.choice small { display: block; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--accent); background: #fdf6f6; box-shadow: 0 0 0 1px var(--accent); }
.small-link { display: inline-block; margin-top: 10px; color: var(--accent); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.fixed-choice { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px; border-radius: var(--radius-sm); background: var(--green-soft); color: #24402f; }
.lead-time { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--soft); font-size: 13.5px; font-weight: 600; }
.lead-time svg { color: var(--green); }
.summary .btn-lg { margin-top: 4px; }

/* Szczegóły zamówienia */
.totals { max-width: 340px; margin: 12px 0 0 auto; }
.details dl { margin: 0; }
.details dt { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.details dd { margin: 3px 0 14px; }
.details dd:last-child { margin-bottom: 0; }

/* Potwierdzenie */
.done { max-width: 640px; margin: 10px auto; padding: 34px 24px; text-align: center; }
.done-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 14px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.done-icon svg { width: 32px; height: 32px; stroke-width: 2.4; }
.done-number { margin: 8px 0 4px; font-size: 17px; font-weight: 650; }
.done .lead-time { justify-content: center; }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

/* Adresy */
.addresses { margin: 0 0 12px; padding: 0; list-style: none; }
.address { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.address > div { min-width: 0; flex: 1; }
.address small { display: block; color: var(--muted); }
.badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.address-edit { flex: 1 1 100%; }
.address-edit summary, .address-new summary { list-style: none; }
.address-edit summary::-webkit-details-marker, .address-new summary::-webkit-details-marker { display: none; }
.address-edit[open] summary { margin-bottom: 12px; }
.address-new[open] summary { margin-bottom: 14px; }
.address .address-edit { order: 3; }
.address-edit:not([open]) { flex: none; }

/* Podgląd zdjęcia */
.zoom { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 18, 16, .88); cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }

/* Powiadomienie */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 76px); z-index: 60; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
@media (min-width: 1024px) { .toast { bottom: 28px; } }

/* Karta: nazwa i „Szczegóły” otwierają okno produktu */
button.tile-name { padding: 0; border: 0; background: none; color: var(--text); font-family: inherit; text-align: left; cursor: pointer; }
button.tile-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.tile-more { align-self: flex-start; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--accent); font: 600 12.5px/1.4 inherit; font-family: inherit; cursor: pointer; }
.tile-more::after { content: " ›"; }
.tile-more:hover { text-decoration: underline; }
.tile-img { cursor: pointer; }
.tile-img.no-img { cursor: pointer; }

/* Okno szczegółów produktu */
html.no-scroll, html.no-scroll body { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 18, 16, .6); animation: rh-fade .15s ease-out; }
@keyframes rh-fade { from { opacity: 0; } to { opacity: 1; } }
.sheet { position: relative; width: 100%; max-width: 980px; max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 14px; background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.sheet-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--text); font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.sheet-close:hover { background: var(--soft); }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .sheet-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.gallery { padding: 18px; background: #fff; border-bottom: 1px solid var(--line); }
@media (min-width: 820px) { .gallery { border-bottom: 0; border-right: 1px solid var(--line); } }
.gallery-main { display: block; width: 100%; aspect-ratio: 1 / 1; padding: 0; border: 0; background: #fff; cursor: zoom-in; }
.gallery-main img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery-main.no-img { cursor: default; background: var(--soft) url("icon.svg") center / 30% no-repeat; opacity: .5; }
.gallery-main.no-img img { display: none; }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gallery-thumb { width: 62px; height: 62px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery-thumb.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sheet-info { display: flex; flex-direction: column; gap: 10px; padding: 24px; }
.sheet-cats { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
.sheet-cats:empty { display: none; }
.sheet-title { padding-right: 36px; font: 600 24px/1.25 Georgia, "Times New Roman", serif; }
.sheet-variant { margin: 0; font-weight: 600; }
.sheet-meta { font-size: 13px; }
.sheet-price { padding: 14px; border-radius: var(--radius); background: var(--soft); }
.sheet-price strong { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.sheet-price strong span { color: var(--muted); font-size: 14px; font-weight: 500; }
.sheet-price small { display: block; color: var(--muted); font-size: 13px; }
.sheet-buy { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; margin-top: 12px; }
.sheet-buy .qty { width: 100%; height: 50px; }
.sheet-buy .qty input { flex: 1; width: auto; min-width: 0; font-size: 17px; }
.sheet-buy .qty button { width: 42px; }
@media (max-width: 480px) { .sheet-buy { grid-template-columns: minmax(0, 1fr); } }
.sheet-text { font-size: 14.5px; line-height: 1.6; }
.sheet-text:empty { display: none; }
.sheet-text p { margin: 0 0 10px; }
.sheet-text ul, .sheet-text ol { margin: 0 0 10px; padding-left: 20px; }
.sheet-text table { border-collapse: collapse; margin-bottom: 10px; }
.sheet-text td, .sheet-text th { padding: 4px 8px; border: 1px solid var(--line); }
.sheet-params { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet-params th, .sheet-params td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.sheet-params th { width: 40%; color: var(--muted); font-weight: 600; }
.sheet-desc { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sheet-desc summary { padding: 11px 14px; font-weight: 650; cursor: pointer; }
.sheet-desc .sheet-text { padding: 0 14px 6px; }
@media (max-width: 640px) {
  .modal { align-items: flex-end; padding: 0; }
  .sheet { max-height: 92vh; border-radius: 16px 16px 0 0; }
  .sheet-info { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .gallery { padding: 12px; }
  .gallery-main { aspect-ratio: 4 / 3; }
  .sheet-title { font-size: 21px; }
}

/* Wysyłka i obsługa zamówienia (poniżej progu netto) */
.sum-fee .is-free { color: var(--green); font-weight: 700; }
.free-hint { margin: 6px 0 8px; padding: 7px 10px; border-radius: var(--radius); background: var(--gold-soft); color: var(--gold); font-size: 12.5px; font-weight: 600; }

/* Zapytaj o produkt */
.avail { flex-wrap: wrap; align-items: center; column-gap: 4px; }
.ask-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 650; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tile.is-out .tile-img img { opacity: .55; }
.tile-ask { width: 100%; margin-top: 10px; }
.sheet-price .ask-btn { width: 100%; margin-top: 12px; }
.ask-modal { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 18, 16, .6); animation: rh-fade .15s ease-out; }
.ask-sheet { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px 20px 20px; border-radius: 14px; background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.ask-sheet h2 { margin: 0 44px 6px 0; font-size: 20px; }
.ask-sheet .ask-product { margin: 0 0 6px; font-weight: 650; }
.ask-sheet .muted { margin: 0 0 16px; font-size: 13.5px; }
.ask-sheet .btn { width: 100%; }
.ask-result { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.ask-result.is-ok { background: var(--green-soft); color: #24402f; }
.ask-result.is-error { background: var(--red-soft); color: #7d1f2b; }
.toast .toast-action { margin-left: 10px; padding: 0; border: 0; background: none; color: #fff; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
