/*
 * AnmarPRO — Błękit czysty — arkusz komponentów (niezależny od frameworka).
 * Używa wyłącznie zmiennych --ap-* z design-system/dist/tokens.css (dołącz go PRZED tym plikiem).
 * Klasy z prefiksem `ap-`. Źródło prawdy dla wyglądu: docs/ux/prototyp/index.html. Stany: hover, focus-visible,
 * active, disabled, aria-busy, aria-invalid, aria-pressed, aria-current. Układ na container queries,
 * cele dotykowe na pointer:coarse, globalny prefers-reduced-motion, skip link, regiony aria-live,
 * scroll-padding pod dolne paski (WCAG 2.4.11).
 *
 * Kolejność dołączenia:
 *   <link rel="stylesheet" href=".../dist/tokens.css">
 *   <link rel="stylesheet" href=".../css/anmarpro.css">
 */

.ap-root {
  font-family: var(--ap-semantic-font-family-ui);
  color: var(--ap-semantic-color-text-primary);
  font-size: 14px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  background: var(--ap-semantic-color-surface-default);
}
body.ap-root {
  margin: 0;
}
.ap-root *,
.ap-root *::before,
.ap-root *::after {
  box-sizing: border-box;
}
/* :where() keeps this reset at zero specificity, so a single component class
   (.ap-btn--primary, .ap-field__control…) always wins over it without !important. */
.ap-root :where(button) {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.ap-root :where(input, select, textarea) {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
}
.ap-root :where(a) {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.ap-root svg.ap-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: var(--ap-primitive-icon-stroke-width, 1.7);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ap-root :focus-visible,
.ap-root .ap-focus-visible {
  outline: 2px solid var(--ap-semantic-color-focus-ring);
  outline-offset: 2px;
  border-radius: 8px;
}
.ap-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .ap-root *,
  .ap-root *::before,
  .ap-root *::after,
  .turbo-progress-bar {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Pasek postępu Turbo (opóźnienie 500 ms ustawia Turbo.config.drive.progressBarDelay) */
.turbo-progress-bar {
  height: 3px;
  background: var(--ap-semantic-color-action-primary-from);
}

/* ============================================================ Button ==== */
.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ap-component-button-gap);
  height: var(--ap-component-button-height);
  min-width: var(--ap-btn-min, 0);
  padding: 0 var(--ap-component-button-padding-x);
  border-radius: var(--ap-component-button-radius, 8px);
  font-weight: var(--ap-component-button-font-weight);
  font-size: var(--ap-component-button-font-size);
  white-space: nowrap;
  transition:
    background-color var(--ap-primitive-duration-base) ease,
    box-shadow var(--ap-primitive-duration-base) ease,
    filter var(--ap-primitive-duration-base) ease;
}
.ap-btn svg {
  width: 16px;
  height: 16px;
}
.ap-btn--lg {
  height: var(--ap-component-button-height-lg);
  font-size: var(--ap-component-button-font-size-lg);
  padding: 0 var(--ap-component-button-padding-xlg);
}
.ap-btn--block {
  width: 100%;
}
.ap-btn--primary {
  color: var(--ap-component-button-primary-text-color);
  background: var(--ap-component-button-primary-gradient);
  box-shadow: var(--ap-component-button-primary-shadow);
}
.ap-btn--primary:hover {
  filter: var(--ap-component-button-primary-hover-filter);
}
.ap-btn--primary:active {
  filter: var(--ap-component-button-primary-active-filter);
  transform: translateY(0.5px);
}
/* Niedostępny (np. blokada logowania): wyszarzony, bez reakcji. Wysyłanie (Turbo: disabled na przycisku
   i aria-busy na formularzu) wygląda inaczej: przycisk zostaje pełny, tylko przygaszony, kursor „progress”. */
.ap-btn:disabled {
  opacity: var(--ap-component-button-disabled-opacity);
  cursor: not-allowed;
}
.ap-btn--primary:disabled {
  filter: none;
  transform: none;
}
.ap-btn--primary[aria-busy='true'],
form[aria-busy='true'] .ap-btn--primary:disabled {
  opacity: 1;
  filter: var(--ap-component-button-primary-disabled-filter);
  cursor: progress;
}
form[aria-busy='true'] .ap-btn:disabled {
  cursor: progress;
}
.ap-btn--secondary {
  color: var(--ap-component-button-secondary-text-color);
  background: var(--ap-component-button-secondary-bg);
  box-shadow: var(--ap-component-button-secondary-ring);
}
.ap-btn--secondary:hover {
  background: var(--ap-component-button-secondary-hover-bg);
}
.ap-btn--ghost {
  color: var(--ap-component-button-ghost-text-color);
  padding: 0 10px;
}
.ap-btn--ghost:hover {
  background: var(--ap-component-button-ghost-hover-bg);
  color: var(--ap-component-button-ghost-hover-text-color);
}
.ap-btn[aria-disabled='true'] {
  opacity: var(--ap-component-button-disabled-opacity);
  pointer-events: none;
}
/* Oczekiwanie na serwer: Turbo ustawia disabled i podmienia tekst z data-turbo-submits-with.
   Stała szerokość: kontroler submit_guard zapisuje szerokość przycisku w --ap-btn-min przy turbo:submit-start. */
.ap-btn[aria-busy='true'] {
  cursor: progress;
  pointer-events: none;
}
.ap-btn--secondary[aria-busy='true'],
.ap-btn--ghost[aria-busy='true'] {
  opacity: var(--ap-component-button-disabled-opacity);
}
.ap-btn__short {
  display: none;
}
.ap-link {
  color: var(--ap-semantic-color-text-link);
  font-weight: 600;
  text-underline-offset: 3px;
}
.ap-link:hover {
  text-decoration: underline;
}

/* ============================================================ Stepper === */
.ap-stepper {
  display: inline-flex;
  align-items: center;
  height: var(--ap-component-stepper-height);
  border-radius: var(--ap-component-stepper-radius, 8px);
  border: 1px solid var(--ap-component-stepper-border-color);
  background: var(--ap-semantic-color-surface-default);
  overflow: hidden;
  flex: none;
}
.ap-stepper--in-cart {
  border-color: var(--ap-component-stepper-border-color-in-cart);
}
.ap-stepper--error {
  border-color: var(--ap-semantic-color-status-err);
}
.ap-stepper :focus-visible {
  outline-offset: -2px;
}
.ap-stepper button {
  width: var(--ap-component-stepper-button-width);
  height: var(--ap-component-stepper-height);
  display: grid;
  place-items: center;
  color: var(--ap-semantic-color-text-secondary);
  font-size: 16px;
  border-radius: 8px;
}
.ap-stepper button:hover {
  color: var(--ap-semantic-color-text-brand);
  background: var(--ap-semantic-color-bg-hover);
}
.ap-stepper input {
  width: var(--ap-component-stepper-input-width);
  text-align: center;
  font-weight: 600;
  appearance: textfield;
}
.ap-stepper input::-webkit-outer-spin-button,
.ap-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ap-converter {
  font-size: 12px;
  color: var(--ap-semantic-color-text-muted);
  text-align: right;
}
/* Podpowiedź „niepełne opakowanie”: tekst ostrzegawczy pod przelicznikiem, bez blokady i bez ikony alarmowej */
.ap-converter__hint {
  display: block;
  color: var(--ap-semantic-color-status-warn);
  font-weight: 500;
}
.ap-converter svg + .ap-converter__hint {
  display: inline;
}
/* Szybki wybór na karcie produktu: „+ 1 opk”, „+ 1 karton” (dodają do ilości w polu) */
.ap-quick-add {
  display: flex;
  gap: 8px;
}
@media (max-width: 599px) {
  .ap-quick-add .ap-btn {
    flex: 1;
    height: var(--ap-semantic-size-touch-target);
  }
}
.ap-converter--active {
  color: var(--ap-semantic-color-text-brand);
  font-weight: 500;
}
.ap-converter svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.6;
  vertical-align: -1px;
  margin-right: 2px;
}
/* Komunikat pod stepperem: walidacja, „Zapisywanie…”, „Nie zapisano” */
.ap-qty-note {
  font-size: 12px;
  color: var(--ap-semantic-color-text-muted);
  text-align: right;
}
.ap-qty-note--err {
  color: var(--ap-semantic-color-status-err);
  font-weight: 500;
}

/* ====================================================== Product row ====
 * Jeden markup na każdą szerokość: <ul class="ap-product-list"> z <li class="ap-product-row" id="row_<id>">.
 * Układ liczy container query na liście (container ap-list), nie okno i nie cała aplikacja:
 *   < 520 px   karta: miniatura + nazwa, dostępność, cena i ilość w osobnym rzędzie
 *   ≥ 520 px   cena i ilość po prawej, dostępność pod nazwą, przelicznik pod stepperem
 *   ≥ 800 px   kolumny: nazwa | dostępność | cena | ilość
 */
.ap-product-list {
  container-type: inline-size;
  container-name: ap-list;
  list-style: none;
  margin: 0;
  padding: 0;
}
.ap-product-row,
.ap-product-head {
  display: grid;
  grid-template-columns: var(--ap-component-product-row-thumb-photo-size) minmax(0, 1fr) auto;
  grid-template-areas:
    'thumb main main'
    'thumb avail avail'
    'price price qty';
  gap: 4px 12px;
  align-items: center;
  padding: var(--ap-component-table-cell-padding-y) var(--ap-component-table-cell-padding-x);
  border-bottom: 1px solid var(--ap-component-table-border-color);
}
.ap-product-head {
  display: none;
  padding-top: 0;
  padding-bottom: 8px;
  font-size: var(--ap-component-table-header-font-size);
  font-weight: 500;
  color: var(--ap-component-table-header-color);
}
.ap-product-row:hover {
  background: var(--ap-component-table-row-hover-bg);
}
.ap-product-row--in-cart {
  background: var(--ap-component-product-row-in-bg);
}
.ap-product-row--in-cart:hover {
  background: var(--ap-component-product-row-in-hover-bg);
}
.ap-product-row--offline {
  opacity: var(--ap-component-product-row-off-opacity);
}
.ap-product-row__thumb {
  grid-area: thumb;
  align-self: start;
}
.ap-product-row__main {
  grid-area: main;
  min-width: 0;
}
.ap-product-row__avail {
  grid-area: avail;
  min-width: 0;
}
.ap-product-row__price {
  grid-area: price;
  display: grid; /* karta (< 520 px): „/ jednostka” pod ceną, jak w prototypie */
}
.ap-product-row__qty {
  grid-area: qty;
  display: grid;
  justify-items: end;
  gap: 4px;
}
/* Linia stanu „✓ w zamówieniu: …” tylko na wąskiej karcie (telefon); szerzej mówi to przelicznik przy polu ilości */
.ap-product-row__status {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-semantic-color-focus-ring);
}
.ap-product-row__status svg {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  stroke-width: 2.6;
}
/* Telefon (prototyp .phone .step): wartość pierwsza i wyrównana w prawo, separator między − i +; obrys zostaje (kontrast 3,7:1) */
.ap-product-row .ap-stepper input {
  order: -1;
  text-align: right;
  padding-right: 8px;
  font-size: 17px;
}
.ap-product-row .ap-stepper--in-cart input {
  color: var(--ap-semantic-color-focus-ring);
}
.ap-product-row .ap-stepper button:last-of-type {
  position: relative;
}
.ap-product-row .ap-stepper button:last-of-type::before {
  content: '';
  position: absolute;
  left: 0;
  height: 16px;
  border-left: 1px solid var(--ap-component-stepper-border-color);
}
.ap-product-head > :nth-child(2) {
  grid-area: main;
}
.ap-product-head > :nth-child(3) {
  grid-area: avail;
}
.ap-product-head > :nth-child(4) {
  grid-area: price;
  text-align: right;
}
.ap-product-head > :nth-child(5) {
  grid-area: qty;
  text-align: right;
}
@container ap-list (min-width: 520px) {
  .ap-product-row__status {
    display: none;
  }
  .ap-product-row .ap-stepper input {
    order: 0;
    text-align: center;
    padding-right: 0;
    font-size: inherit;
  }
  .ap-product-row .ap-stepper--in-cart input {
    color: inherit;
  }
  .ap-product-row .ap-stepper button:last-of-type::before {
    display: none;
  }
  .ap-product-row,
  .ap-product-head {
    grid-template-columns: var(--ap-component-product-row-thumb-photo-size) minmax(0, 1fr) auto auto;
    grid-template-areas:
      'thumb main price qty'
      'thumb avail price qty';
  }
  .ap-product-row__price {
    display: block;
    text-align: right;
  }
  /* Kolumna ilości stałej szerokości: stepper zawsze w tym samym miejscu, akcja w kolumnie 68 px */
  .ap-product-row .ap-product-row__qty {
    width: 214px;
  }
  .ap-product-row .ap-qty-cell {
    grid-template-columns: minmax(0, 1fr) 68px;
  }
  .ap-product-row .ap-qty-cell > :not(.ap-stepper, .ap-converter),
  .ap-product-row .ap-qty-cell > form.button_to > * {
    justify-self: end;
  }
}
@container ap-list (min-width: 800px) {
  .ap-product-row,
  .ap-product-head {
    grid-template-columns: var(--ap-component-product-row-thumb-photo-size) minmax(0, 1fr) 150px 112px 262px;
    grid-template-areas: 'thumb main avail price qty';
  }
  .ap-product-head {
    display: grid;
  }
  .ap-product-row .ap-product-row__qty {
    width: auto;
  }
  /* „Ilość” nad stepperem: padding = kolumna akcji 68 + odstęp 8 */
  .ap-product-head > :nth-child(5) {
    justify-self: end;
    width: 176px;
    padding-right: 76px;
    text-align: center;
  }
}
.ap-thumb {
  width: var(--ap-component-product-row-thumb-size);
  height: var(--ap-component-product-row-thumb-size);
  border-radius: var(--ap-component-product-row-thumb-radius, 8px);
  background: var(--ap-component-product-row-thumb-bg);
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ap-primitive-color-ink-400, #405881);
  line-height: 1;
  text-align: center;
}
.ap-thumb--lg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 12px;
  font-size: 28px;
  font-weight: 300;
  gap: 4px;
  align-content: center;
}
.ap-thumb--lg small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-semantic-color-text-muted);
}
/* Zdjęcie produktu na białym tle (48px w wierszu, pełna szerokość na karcie produktu) —
   zastępuje ikonę formatu opakowania, gdy zdjęcie jest dostępne. */
.ap-thumb--photo {
  width: var(--ap-component-product-row-thumb-photo-size);
  height: var(--ap-component-product-row-thumb-photo-size);
  background: var(--ap-component-product-row-thumb-photo-bg);
  box-shadow: inset 0 0 0 1px var(--ap-component-product-row-thumb-photo-border);
  overflow: hidden;
  padding: 2px;
}
.ap-thumb--photo.ap-thumb--lg {
  padding: 12px;
}
.ap-thumb--photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Przycisk-ikona (np. „Usuń z koszyka”) */
.ap-icon-btn {
  width: var(--ap-component-icon-button-size);
  height: var(--ap-component-icon-button-size);
  border-radius: var(--ap-component-icon-button-radius, 8px);
  display: grid;
  place-items: center;
  color: var(--ap-semantic-color-text-muted);
}
.ap-icon-btn svg {
  width: 16px;
  height: 16px;
}
.ap-icon-btn--danger:hover {
  background: var(--ap-component-icon-button-danger-hover-bg);
  color: var(--ap-component-icon-button-danger-hover-color);
}
/* Pełna nazwa z wariantem. Zawija się (zwykle 2–3 linie), nigdy nie jest ucinana wielokropkiem ani line-clamp:
   wariant (np. a'2, rozm. 7,5) musi być zawsze widoczny w całości (zasada 5, test 12.10.2026). */
.ap-name {
  min-width: 0;
  overflow-wrap: break-word;
  text-wrap: pretty;
  font-size: 14px;
  font-weight: 500;
}
.ap-name a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ap-name b {
  font-weight: 700;
  color: var(--ap-semantic-color-text-brand);
  white-space: nowrap;
  margin-left: 6px;
}
.ap-meta {
  font-size: 12.5px;
  color: var(--ap-semantic-color-text-muted);
  margin-top: 1px;
}
/* SKU zawsze w całości: łamany, nigdy ucinany */
.ap-sku {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.ap-price {
  font-size: 14px;
  white-space: nowrap;
}
.ap-price small {
  color: var(--ap-semantic-color-text-secondary);
  font-size: 12px;
}
/* Komórka ilości: stepper | akcja („Dodaj” albo kosz), pod spodem przelicznik i podpowiedź.
   Przelicznik i komunikaty mają contain: inline-size, więc długi tekst się zawija, a nie poszerza kolumny
   i nie przesuwa steppera (prototyp .qc). */
.ap-qty-cell {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: end;
  align-items: center;
  column-gap: 8px;
  row-gap: 3px;
}
.ap-qty-cell > .ap-stepper {
  grid-area: 1 / 1;
  justify-self: end;
}
.ap-qty-cell > .ap-converter {
  grid-area: 2 / 1 / auto / -1;
  contain: inline-size;
  text-align: right;
}
.ap-product-row__qty > .ap-qty-note {
  contain: inline-size;
  justify-self: stretch;
}

/* ================================================= Availability ======== */
.ap-status {
  font-size: 13px;
  color: var(--ap-semantic-color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-status b {
  color: var(--ap-semantic-color-text-primary);
  font-weight: 600;
}
.ap-status--ok,
.ap-status--warn,
.ap-status--err {
  font-weight: 600;
}
.ap-status--ok {
  color: var(--ap-component-availability-ok-color);
}
.ap-status--warn {
  color: var(--ap-component-availability-warn-color);
}
.ap-status--err {
  color: var(--ap-component-availability-err-color);
}
.ap-status--ok::before,
.ap-status--warn::before,
.ap-status--err::before {
  content: '';
  display: inline-block;
  width: var(--ap-component-availability-dot-size);
  height: var(--ap-component-availability-dot-size);
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  vertical-align: 1px;
}

/* ======================================================= Side nav ====== */
.ap-sidenav {
  background: var(--ap-semantic-color-bg-sunken);
  border-right: 1px solid var(--ap-semantic-color-border-default);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  width: var(--ap-component-side-nav-width);
}
.ap-sidenav__head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 20px;
}
.ap-sidenav__head .ap-sidenav__logo {
  margin: 0 0 0 8px;
}
.ap-sidenav__logo {
  display: block;
  width: var(--ap-component-side-nav-logo-width);
  margin: 4px 8px 20px;
}
.ap-sidenav__group {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ap-semantic-color-text-muted);
  padding: 16px 10px 6px;
}
.ap-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--ap-component-side-nav-item-height);
  padding: 0 10px;
  border-radius: var(--ap-component-side-nav-item-radius, 8px);
  color: var(--ap-semantic-color-text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: background-color var(--ap-primitive-duration-fast) ease;
  width: 100%;
  text-align: left;
}
.ap-nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--ap-semantic-color-text-muted);
}
.ap-nav-item:hover {
  background: var(--ap-semantic-color-bg-hover);
  color: var(--ap-semantic-color-text-primary);
}
.ap-nav-item[aria-current] {
  background: var(--ap-component-side-nav-active-bg);
  color: var(--ap-semantic-color-text-primary);
  box-shadow: var(--ap-component-side-nav-active-ring);
}
.ap-nav-item[aria-current] svg {
  color: var(--ap-semantic-color-text-brand);
}
.ap-nav-item__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--ap-semantic-color-text-muted);
  font-weight: 500;
}
.ap-sidenav__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--ap-semantic-color-border-default);
  text-align: left;
  width: 100%;
}
.ap-sidenav__foot:hover {
  background: var(--ap-semantic-color-bg-hover);
}
/* Przycisk zwijania/rozwijania SideNav do samych ikon — niezależny od breakpointu
   navCollapse (można zwinąć ręcznie na szerokim ekranie, patrz SideNav.md). */
.ap-navtog {
  margin-left: auto;
  width: var(--ap-component-side-nav-toggle-size);
  height: var(--ap-component-side-nav-toggle-size);
  border-radius: var(--ap-component-side-nav-item-radius, 8px);
  display: grid;
  place-items: center;
  color: var(--ap-semantic-color-text-muted);
  flex: none;
}
.ap-navtog:hover {
  background: var(--ap-semantic-color-bg-hover);
  color: var(--ap-semantic-color-text-primary);
}
.ap-navtog svg {
  width: 16px;
  height: 16px;
}
.ap-sidenav--collapsed .ap-navtog svg {
  transform: rotate(180deg);
}
.ap-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ap-primitive-color-slate-avatar, #e3e8f0);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ap-semantic-color-text-brand);
  flex: none;
}

/* ===================================================== Search field ==== */
.ap-search {
  width: var(--ap-component-search-field-width);
  height: var(--ap-component-search-field-height);
  border-radius: var(--ap-component-search-field-radius, 8px);
  /* obrys kontrolki: border-control (3,7:1), także na telefonie (WCAG 1.4.11) */
  box-shadow: inset 0 0 0 1px var(--ap-semantic-color-border-control);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 12px;
  background: var(--ap-semantic-color-surface-default);
  flex: none;
}
.ap-search:focus-within {
  box-shadow: var(--ap-component-search-field-focus-ring);
}
.ap-search svg {
  width: 16px;
  height: 16px;
  color: var(--ap-semantic-color-text-muted);
  flex: none;
}
.ap-search input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}
.ap-search input::placeholder {
  color: var(--ap-semantic-color-text-muted);
}
.ap-search kbd {
  font: inherit;
  font-size: 11.5px;
  color: var(--ap-semantic-color-text-muted);
  border: 1px solid var(--ap-semantic-color-border-strong);
  border-radius: 5px;
  padding: 0 5px;
}
.ap-search__clear {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--ap-semantic-color-text-muted);
}
.ap-search__clear:hover {
  background: var(--ap-semantic-color-bg-hover);
  color: var(--ap-semantic-color-text-primary);
}

/* ================================================ Segmented control ==== */
.ap-segmented {
  display: inline-flex;
  padding: var(--ap-component-segmented-control-track-padding, 3px);
  border-radius: 8px;
  background: var(--ap-component-segmented-control-track-bg);
  gap: 2px;
}
.ap-segmented button {
  height: var(--ap-component-segmented-control-item-height);
  padding: 0 12px;
  border-radius: var(--ap-component-segmented-control-item-radius, 6px);
  font-weight: 500;
  font-size: 13px;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-segmented button[aria-pressed='true'] {
  background: var(--ap-component-segmented-control-active-bg);
  color: var(--ap-semantic-color-text-primary);
  box-shadow: var(--ap-component-segmented-control-active-ring);
}
/* Wariant „na jasnym” (pbar/seg0 w prototypie) */
.ap-segmented--outline {
  background: transparent;
  border: 1px solid var(--ap-semantic-color-border-strong);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.ap-segmented--outline button {
  border-radius: 0;
  height: 34px;
}
.ap-segmented--outline button:focus-visible {
  outline-offset: -2px;
}
.ap-segmented--outline button + button {
  border-left: 1px solid var(--ap-semantic-color-border-strong);
}
.ap-segmented--outline button[aria-pressed='true'] {
  background: var(--ap-semantic-color-text-brand);
  color: #fff;
  box-shadow: none;
}

/* ============================================================ Select === */
.ap-select {
  height: var(--ap-component-select-height);
  border-radius: var(--ap-component-select-radius, 8px);
  box-shadow: var(--ap-component-select-ring);
  padding: 0 30px 0 10px;
  background: var(--ap-semantic-color-surface-default)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 9px center/14px;
  appearance: none;
  font-size: 14px;
  color: var(--ap-semantic-color-text-primary);
  width: 100%;
}
.ap-select--sm {
  width: auto;
  height: var(--ap-component-select-height-sm);
  font-size: 13px;
}

/* ========================================================= Dropdown ==== */
/* Wybór z listy stylizowany jak SegmentedControl (tor + biała „pigułka”) —
   używany dla kategorii i sortowania w katalogu, zamiast natywnego <select>. */
.ap-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ap-dropdown__button {
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: var(--ap-component-dropdown-track-padding, 3px);
  border-radius: 8px;
  background: var(--ap-component-dropdown-track-bg);
}
.ap-dropdown__value {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: var(--ap-component-dropdown-value-height);
  padding: 0 8px 0 12px;
  border-radius: 6px;
  background: var(--ap-component-dropdown-value-bg);
  /* obrys kontrolki 3,7:1 zamiast border-strong (1,35:1), test 12.10.2026; token valueRing do zmiany w tokens.json */
  box-shadow:
    0 0 0 1px var(--ap-semantic-color-border-control),
    0 1px 2px rgba(16, 24, 40, 0.06);
  font-weight: 500;
  font-size: 13px;
  color: var(--ap-semantic-color-text-primary);
  white-space: nowrap;
  overflow: hidden;
}
.ap-dropdown__value svg {
  width: 16px;
  height: 16px;
  color: var(--ap-semantic-color-text-muted);
  transition: transform 0.15s;
}
.ap-dropdown__button[aria-expanded='true'] .ap-dropdown__value svg {
  transform: rotate(180deg);
}
.ap-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: var(--ap-component-dropdown-menu-min-width);
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--ap-semantic-color-surface-default);
  border: 1px solid var(--ap-semantic-color-border-strong);
  border-radius: var(--ap-component-dropdown-menu-radius, 10px);
  box-shadow: var(--ap-component-dropdown-menu-shadow);
}
.ap-dropdown__menu li {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--ap-component-dropdown-menu-item-height);
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--ap-semantic-color-text-primary);
  cursor: pointer;
}
.ap-dropdown__menu li svg {
  width: 14px;
  height: 14px;
  color: var(--ap-semantic-color-text-brand);
  visibility: hidden;
  flex: none;
}
.ap-dropdown__menu li[aria-selected='true'] {
  font-weight: 600;
}
.ap-dropdown__menu li[aria-selected='true'] svg {
  visibility: visible;
}
.ap-dropdown__menu li:hover,
.ap-dropdown__menu li:focus {
  background: var(--ap-semantic-color-bg-hover);
}

/* ============================================================= Field === */
.ap-field {
  display: grid;
  gap: 6px;
}
.ap-field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-component-field-label-color);
}
.ap-field__hint {
  font-size: 12px;
  color: var(--ap-component-field-hint-color);
}
.ap-field__control {
  height: var(--ap-component-field-height);
  border-radius: var(--ap-component-field-radius, 8px);
  box-shadow: var(--ap-component-field-ring);
  padding: 0 10px;
  background: var(--ap-semantic-color-surface-default);
  font-size: 14px;
  color: var(--ap-semantic-color-text-primary);
  width: 100%;
}
.ap-field__input {
  position: relative;
}
.ap-field__input .ap-field__control {
  padding-right: 120px;
}
.ap-field__toggle {
  position: absolute;
  inset: 0 0 0 auto;
  padding: 0 12px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-semantic-color-text-link);
  cursor: pointer;
}
textarea.ap-field__control {
  height: 76px;
  padding: 8px 10px;
  resize: vertical;
}
.ap-field__control[aria-invalid='true'] {
  box-shadow: var(--ap-component-field-error-ring);
}
.ap-field__error {
  font-size: 12px;
  font-weight: 500;
  color: var(--ap-semantic-color-status-err);
}
.ap-field__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.ap-field__counter {
  margin-left: auto;
  font-size: 12px;
  color: var(--ap-semantic-color-text-muted);
  white-space: nowrap;
}

/* ========================================================== RadioCard == */
.ap-radio-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: var(--ap-component-radio-card-padding, 8px 10px);
  border-radius: var(--ap-component-radio-card-radius, 8px);
  cursor: pointer;
}
.ap-radio-card:hover {
  background: var(--ap-component-radio-card-hover-bg);
}
.ap-radio-card input {
  margin-top: 3px;
  accent-color: var(--ap-component-radio-card-control-accent);
  width: 18px;
  height: 18px;
}
.ap-radio-card small {
  display: block;
  color: var(--ap-semantic-color-text-muted);
  font-size: 12.5px;
  margin-top: 2px;
}

/* ====================================================== OrderPanel =====
 * Jeden element #order_panel w trzech układach, wybieranych container query na .ap-app:
 *   ≥ 1024 px   kolumna z prawej (316 px)
 *   < 1024 px   pasek u dołu (dawny dock), nagłówek, lista pozycji i rozbicie kwot ukryte
 *   ≤ 480 px    mini-pasek nad zakładkami
 */
.ap-order-panel {
  border-left: 1px solid var(--ap-semantic-color-border-default);
  background: var(--ap-semantic-color-surface-default);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: var(--ap-component-order-panel-width);
}
.ap-order-panel__header {
  height: var(--ap-component-order-panel-header-height);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
}
.ap-order-panel__scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.ap-order-panel__section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
  display: grid;
  gap: 10px;
}
.ap-order-panel__label {
  font-size: 12.5px;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-order-panel__total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  margin: 0;
  font-weight: var(--ap-component-order-panel-total-font-weight);
  font-size: var(--ap-component-order-panel-total-font-size);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.ap-order-panel__total small {
  font-size: 13px;
  color: var(--ap-semantic-color-text-secondary);
  letter-spacing: 0;
}
.ap-order-panel__actions {
  padding: 16px 20px 20px;
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--ap-semantic-color-border-default);
}
.ap-order-panel__note {
  margin: 0;
  font-size: 12px;
  color: var(--ap-semantic-color-text-muted);
  text-align: center;
}
.ap-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  font-size: 13px;
  margin: 0;
}
.ap-kv > div,
.ap-sum > div {
  display: contents;
}
.ap-kv dt {
  color: var(--ap-semantic-color-text-muted);
}
.ap-kv dd {
  margin: 0;
  text-align: right;
}
/* Rozbicie kwot: Netto, VAT per stawka, Brutto */
.ap-sum {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin: 0;
  font-size: 13px;
}
.ap-sum dt {
  color: var(--ap-semantic-color-text-secondary);
}
.ap-sum dd {
  margin: 0;
  text-align: right;
  white-space: nowrap;
}
.ap-sum__gross > * {
  padding-top: 6px;
  border-top: 1px solid var(--ap-semantic-color-border-default);
  font-weight: 600;
  color: var(--ap-semantic-color-text-primary);
}
.ap-lines {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.ap-lines > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.ap-lines span {
  color: var(--ap-semantic-color-text-secondary);
  overflow-wrap: anywhere;
}
.ap-lines b {
  flex: none;
  white-space: nowrap;
}

/* ============================================================= Toast === */
/* Stały region aria-live w layoucie (pusty, dopóki nie ma toastu). Serwer podmienia jego zawartość strumieniem. */
.ap-toast-region {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
  z-index: 10;
}
.ap-app:has(.ap-sidenav) > .ap-toast-region {
  left: var(--ap-component-side-nav-width);
}
.ap-app:has(#order_panel) > .ap-toast-region {
  right: var(--ap-component-order-panel-width);
  bottom: var(--ap-component-toast-bottom-offset);
}
@container ap-app (max-width: 1359px) {
  .ap-app:has(.ap-sidenav) > .ap-toast-region {
    left: var(--ap-component-side-nav-width-compact);
  }
}
@container ap-app (max-width: 1023px) {
  .ap-app:has(#order_panel) > .ap-toast-region {
    right: 0;
  }
}
@container ap-app (max-width: 480px) {
  .ap-app > .ap-toast-region {
    left: 0;
    padding: 0 8px;
  }
  .ap-app:has(.ap-tabs) > .ap-toast-region {
    bottom: calc(var(--ap-mobile-tabs-height) + var(--ap-toast-gap));
  }
  .ap-app:has(#order_panel) > .ap-toast-region {
    bottom: calc(var(--ap-mobile-bar-bottom) + var(--ap-mobile-bar-height) + var(--ap-toast-gap));
  }
}
.ap-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--ap-component-toast-radius, 12px);
  background: var(--ap-component-toast-bg);
  color: var(--ap-component-toast-text-color);
  font-size: 13.5px;
  box-shadow: var(--ap-component-toast-shadow);
  max-width: 100%;
}
.ap-toast .ap-toast__warn {
  color: var(--ap-semantic-color-overlay-toast-warn-accent, #f6c98a);
}
.ap-toast button {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.ap-toast button:hover {
  background: rgba(255, 255, 255, 0.2);
}
@media (prefers-reduced-motion: no-preference) {
  .ap-toast {
    animation: ap-toast-in var(--ap-primitive-duration-toast) var(--ap-primitive-easing-decelerate);
  }
  @keyframes ap-toast-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}

/* ============================================================ Banner === */
.ap-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: var(--ap-component-banner-padding-y) var(--ap-component-banner-padding-x);
  border-radius: var(--ap-component-banner-radius, 8px);
  font-size: 13px;
}
.ap-banner svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.ap-banner--info {
  background: var(--ap-component-banner-info-bg);
  color: var(--ap-component-banner-info-text);
}
.ap-banner--err {
  background: var(--ap-component-banner-err-bg);
  color: var(--ap-component-banner-err-text);
}
.ap-banner--neutral {
  background: var(--ap-semantic-color-selection-bg);
  color: var(--ap-semantic-color-text-primary);
}
.ap-banner > span {
  flex: 1 1 16rem;
}
.ap-banner__action {
  margin-left: auto;
}

/* ========================================================= EmptyState = */
.ap-empty {
  padding: var(--ap-component-empty-state-padding, 36px 8px);
  display: grid;
  gap: 10px;
  justify-items: start;
  max-width: var(--ap-component-empty-state-max-width, 620px);
}
.ap-empty h3 {
  margin: 0;
  font-weight: 600;
  font-size: var(--ap-component-empty-state-title-font-size, 16px);
}
.ap-empty p {
  margin: 0;
  color: var(--ap-semantic-color-text-secondary);
  font-size: 14px;
}
.ap-empty__actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ======================================================= Breadcrumbs == */
.ap-breadcrumbs {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: var(--ap-component-breadcrumbs-font-size);
  color: var(--ap-component-breadcrumbs-color);
  margin-bottom: 14px;
}
.ap-breadcrumbs a {
  color: var(--ap-component-breadcrumbs-link-color);
}
.ap-breadcrumbs a:hover {
  color: var(--ap-semantic-color-text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================ Card ===== */
.ap-card {
  border: 1px solid var(--ap-component-card-border-color);
  border-radius: var(--ap-component-card-radius, 10px);
  padding: var(--ap-component-card-padding, 16px 18px);
  display: grid;
  gap: 10px;
}
.ap-card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* ========================================================= OrdersTable =
 * Jeden markup: <table>. Szeroko tabela, poniżej 640 px szerokości kontenera .ap-orders ten sam markup
 * układa się w karty (grid na <tr>). Pierwsza komórka to link do /zamowienia/:id, rozciągnięty na cały wiersz.
 */
.ap-orders {
  container-type: inline-size;
  container-name: ap-orders;
}
.ap-orders-table {
  width: 100%;
  border-collapse: collapse;
}
.ap-orders-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--ap-semantic-color-text-muted);
  text-align: left;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
}
.ap-orders-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
  font-size: 13.5px;
}
.ap-orders-table .ap-orders-table__col--right {
  text-align: right;
}
.ap-orders-table tbody tr {
  position: relative;
}
.ap-orders-table tbody tr:hover {
  background: var(--ap-component-table-row-hover-bg);
}
.ap-orders-table__link {
  font-weight: 700;
}
.ap-orders-table__link::after {
  content: '';
  position: absolute;
  inset: 0;
}
.ap-orders-table__link:focus-visible {
  outline-offset: -2px;
}
/* Przycisk w wierszu leży nad rozciągniętym linkiem do szczegółów */
.ap-orders-table__action {
  position: relative;
  z-index: 1;
}
@container ap-orders (max-width: 639px) {
  .ap-orders-table,
  .ap-orders-table tbody {
    display: block;
  }
  .ap-orders-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .ap-orders-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'no status'
      'date value'
      'by by'
      'act act';
    gap: 2px 12px;
    padding: 11px 10px;
    border-bottom: 1px solid var(--ap-semantic-color-border-default);
  }
  .ap-orders-table td {
    padding: 0;
    border: 0;
  }
  .ap-orders-table td:nth-child(1) {
    grid-area: no;
  }
  .ap-orders-table td:nth-child(2) {
    grid-area: date;
    color: var(--ap-semantic-color-text-secondary);
  }
  .ap-orders-table td:nth-child(3) {
    grid-area: status;
    text-align: right;
  }
  .ap-orders-table td:nth-child(4) {
    grid-area: by;
    color: var(--ap-semantic-color-text-muted);
    font-size: 12.5px;
  }
  .ap-orders-table td:nth-child(5) {
    grid-area: value;
    font-weight: 600;
  }
  .ap-orders-table td.ap-orders-table__action {
    grid-area: act;
    text-align: left;
    margin-top: 8px;
  }
}
.ap-sort-button {
  display: inline-flex;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ap-semantic-color-text-muted);
}
.ap-sort-button:hover,
.ap-sort-button--on {
  color: var(--ap-semantic-color-text-primary);
}

/* ========================================================= OrderDetail = */
.ap-order-detail {
  border: 1px solid var(--ap-semantic-color-border-default);
  border-radius: 10px;
  display: grid;
}
.ap-order-detail__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
  display: grid;
  gap: 4px;
}
.ap-order-detail__section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
  display: grid;
  gap: 10px;
}
.ap-order-detail__section:last-child {
  border-bottom: 0;
}
.ap-order-status {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.ap-order-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  vertical-align: 1px;
}
.ap-order-status--ok {
  color: var(--ap-semantic-color-status-ok);
}
.ap-order-status--warn {
  color: var(--ap-semantic-color-status-warn);
}
.ap-order-status--err {
  color: var(--ap-semantic-color-status-err);
}
.ap-order-status--neutral {
  color: var(--ap-semantic-color-status-neutral);
}
.ap-timeline {
  display: grid;
  gap: 10px;
  font-size: 13px;
}
.ap-timeline__item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
}
.ap-timeline__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ap-semantic-color-text-brand);
  margin-top: 4px;
}
.ap-timeline__dot--open {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--ap-semantic-color-border-strong);
}
.ap-timeline small {
  display: block;
  color: var(--ap-semantic-color-text-muted);
  font-size: 12px;
}

/* ======================================================== Login/Done === */
.ap-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 0;
  background: radial-gradient(800px 400px at 70% -10%, #e3edf9 0%, rgba(227, 237, 249, 0) 70%), var(--ap-semantic-color-bg-sunken);
}
.ap-login-card {
  width: 400px;
  max-width: calc(100% - 32px);
  background: var(--ap-semantic-color-surface-default);
  border: 1px solid var(--ap-semantic-color-border-default);
  border-radius: 12px;
  padding: 32px 30px;
  display: grid;
  gap: 16px;
  box-shadow: var(--ap-primitive-shadow-card), var(--ap-primitive-shadow-float);
}
.ap-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ap-semantic-color-text-muted);
  font-size: 12px;
}
.ap-or-divider::before,
.ap-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ap-semantic-color-border-default);
}
.ap-done {
  max-width: 560px;
  margin: 40px auto;
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
}
.ap-done__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ap-semantic-color-status-ok-bg);
  color: var(--ap-semantic-color-status-ok);
  display: grid;
  place-items: center;
}

/* ========================================================= Skeleton ====
 * Statyczny szkielet ładowania, bez animacji. Wiersz ma wymiary prawdziwego .ap-product-row
 * (ten sam grid), więc po podmianie treści nic nie skacze.
 */
.ap-skeleton {
  display: block;
  height: var(--ap-component-skeleton-bar-height);
  border-radius: 6px;
  background: var(--ap-component-skeleton-bg);
}
.ap-skeleton--thumb {
  width: var(--ap-component-product-row-thumb-photo-size);
  height: var(--ap-component-product-row-thumb-photo-size);
  border-radius: var(--ap-component-product-row-thumb-radius, 8px);
}
.ap-skeleton--name {
  width: 70%;
  height: 14px;
}
.ap-skeleton--meta {
  width: 45%;
}
.ap-skeleton--avail {
  width: 80px;
}
.ap-skeleton--price {
  width: 72px;
  justify-self: end;
}
.ap-skeleton--qty {
  width: 98px;
  height: var(--ap-component-stepper-height);
  border-radius: var(--ap-component-stepper-radius, 8px);
}

/* ======================================================== ErrorPage ====
 * Pełnoekranowy szablon 404/403/500/503, bez nawigacji sklepowej.
 */
.ap-error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--ap-semantic-color-bg-sunken);
}
.ap-error-page__box {
  width: 100%;
  max-width: 480px;
  display: grid;
  gap: 12px;
  justify-items: start;
}
.ap-error-page__brand {
  width: 240px;
  max-width: 100%;
  margin-bottom: 16px;
}
.ap-error-page h1 {
  margin: 0;
  font-size: var(--ap-primitive-font-size-500, 24px);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.ap-error-page p {
  margin: 0;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-error-page__id {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ap-semantic-color-text-muted);
  overflow-wrap: anywhere;
}

/* ============================================== SessionTimeoutDialog ===== */
.ap-dialog {
  width: calc(100% - 32px);
  max-width: var(--ap-component-dialog-max-width);
  padding: var(--ap-component-dialog-padding);
  border: 1px solid var(--ap-semantic-color-border-strong);
  border-radius: var(--ap-component-dialog-radius);
  background: var(--ap-semantic-color-surface-default);
  color: var(--ap-semantic-color-text-primary);
  font-family: var(--ap-semantic-font-family-ui);
}
.ap-dialog::backdrop {
  background: var(--ap-component-dialog-backdrop);
}
.ap-dialog h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}
.ap-dialog p {
  margin: 0;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

/* ======================================================== Pagination === */
.ap-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 0;
  font-size: 13px;
}
.ap-pagination__range {
  color: var(--ap-semantic-color-text-secondary);
}
.ap-pagination__pages {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ap-pagination__link,
.ap-pagination__gap {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-pagination__link:hover {
  background: var(--ap-semantic-color-bg-hover);
  color: var(--ap-semantic-color-text-primary);
}
.ap-pagination__link[aria-current='page'] {
  background: var(--ap-semantic-color-text-brand);
  color: #fff;
}
.ap-pagination__link[aria-disabled='true'] {
  opacity: var(--ap-component-button-disabled-opacity);
  pointer-events: none;
}

/* ===================================================== Punkty łamania ==
 * Układ liczony od szerokości KONTENERA aplikacji (container query na .ap-app),
 * nie od szerokości okna — zgodnie z prototypem i audytem RAPORT.md.
 * Nadaj przodkowi aplikacji `container-type: inline-size; container-name: ap-app`.
 */
.ap-app {
  container-type: inline-size;
  container-name: ap-app;
  --ap-mobile-tabs-height: 66px;
  --ap-mobile-bar-bottom: 74px;
  --ap-mobile-bar-height: 72px;
  --ap-toast-gap: 8px;
}

@container ap-app (max-width: 1359px) {
  .ap-sidenav {
    width: var(--ap-component-side-nav-width-compact);
    padding: 14px 10px;
    align-items: center;
  }
  .ap-sidenav__logo {
    width: var(--ap-component-side-nav-logo-width-compact);
    overflow: hidden;
    margin: 2px 0 18px;
  }
  .ap-nav-item {
    width: 44px;
    height: 40px;
    padding: 0;
    justify-content: center;
    position: relative;
  }
  .ap-nav-item__label,
  .ap-sidenav__group,
  .ap-sidenav__foot .ap-nav-item__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ap-nav-item__count {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10.5px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--ap-semantic-color-selection-bg);
    color: var(--ap-semantic-color-text-brand);
    display: grid;
    place-items: center;
    font-weight: 700;
  }
  .ap-catalog-split {
    grid-template-columns: 1fr;
  }
  .ap-catalog-split__cats {
    display: none;
  }
  .ap-order-split {
    grid-template-columns: 1fr;
  }
}

@container ap-app (max-width: 1100px) {
  .ap-topbar__sub {
    display: none;
  }
}

/* OrderPanel < 1024 px: pasek u dołu. Nagłówek, lista pozycji, rozbicie kwot i podpis znikają z widoku. */
@container ap-app (max-width: 1023px) {
  .ap-order-panel {
    position: absolute;
    left: var(--ap-component-dock-side-offset-compact);
    right: 0;
    bottom: 0;
    z-index: 4;
    flex-direction: row;
    align-items: center;
    gap: var(--ap-component-dock-gap);
    width: auto;
    height: var(--ap-component-dock-height);
    padding: 0 var(--ap-component-dock-padding-x);
    border-left: 0;
    border-top: 1px solid var(--ap-semantic-color-border-default);
    box-shadow: var(--ap-component-dock-shadow);
  }
  .ap-order-panel .ap-order-panel__header,
  .ap-order-panel .ap-order-panel__lines,
  .ap-order-panel .ap-order-panel__sum,
  .ap-order-panel .ap-order-panel__note {
    display: none;
  }
  .ap-order-panel__scroll {
    display: flex;
    align-items: center;
    gap: var(--ap-component-dock-gap);
    overflow: visible;
  }
  .ap-order-panel__section {
    display: flex;
    align-items: center;
    gap: var(--ap-component-dock-gap);
    padding: 0;
    border: 0;
  }
  .ap-order-panel__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ap-order-panel__total {
    font-size: var(--ap-component-dock-total-font-size);
    font-weight: var(--ap-component-dock-total-font-weight);
    white-space: nowrap;
  }
  .ap-order-panel .ap-kv {
    display: flex;
    gap: 16px;
    white-space: nowrap;
  }
  .ap-order-panel .ap-kv > div {
    display: flex;
    gap: 4px;
  }
  .ap-order-panel__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 0;
    border: 0;
  }
  .ap-order-panel__actions .ap-btn--block {
    width: auto;
  }
}

@container ap-app (max-width: 900px) {
  .ap-product-hero {
    grid-template-columns: 1fr;
  }
  .ap-order-panel .ap-kv > div:not(:first-child) {
    display: none;
  }
}


/* ======================================================= Telefon (iOS) ==
 * Do 480 px szerokości aplikacji: dolne zakładki (.ap-tabs) zamiast bocznego menu,
 * a #order_panel staje się mini-paskiem nad zakładkami. Patrz docs/ux/design-system/README.md → „Telefon (iOS)”.
 */
.ap-tabs {
  display: none;
}
@container ap-app (max-width: 480px) {
  .ap-sidenav {
    display: none !important;
  }
  .ap-order-panel {
    left: 8px;
    right: 8px;
    bottom: var(--ap-mobile-bar-bottom);
    height: var(--ap-mobile-bar-height);
    padding: 0 12px;
    gap: 10px;
    border: 1px solid var(--ap-semantic-color-border-default);
    border-radius: var(--ap-component-card-radius, 10px);
    box-shadow: var(--ap-primitive-shadow-mobile-bar);
  }
  .ap-order-panel__section {
    display: grid;
    gap: 0;
  }
  .ap-order-panel .ap-kv > div:not(:nth-child(2)),
  .ap-order-panel__actions .ap-btn--ghost {
    display: none;
  }
  .ap-order-panel .ap-kv > div:nth-child(2) {
    display: flex;
  }
  .ap-btn__full {
    display: none;
  }
  .ap-btn__short {
    display: inline;
  }
  .ap-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--ap-mobile-tabs-height);
    background: var(--ap-semantic-color-surface-default);
    border-top: 1px solid var(--ap-semantic-color-border-default);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 5;
  }
  .ap-tabs button {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    font-size: 11px;
    color: var(--ap-semantic-color-text-muted);
    font-weight: 500;
  }
  .ap-tabs svg {
    width: 20px;
    height: 20px;
  }
  .ap-tabs button[aria-current] {
    color: var(--ap-semantic-color-text-brand);
    font-weight: 700;
  }
}

/* ============================================== Nawigacja i dostępność ==
 * Skip link, region aria-live, fokus na <h1>, scroll-padding pod dolne paski.
 * Wymagania: NFR-05, NFR-06 (docs/produkt/wymagania-niefunkcjonalne.md).
 */
/* Skip link „Przejdź do treści”: pierwszy element w kolejności Tab, widoczny dopiero po fokusie. */
.ap-skip {
  position: absolute;
  left: 8px;
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ap-semantic-color-surface-default);
  color: var(--ap-semantic-color-text-link);
  font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--ap-semantic-color-focus-ring);
}
.ap-skip:focus {
  top: 8px;
}
/* Stałe, puste regiony aria-live w layoucie. Ogłoszenia (dodano, wyniki wyszukiwania, złożono zamówienie)
   trafiają tu przez Turbo Stream; polite dla potwierdzeń, assertive dla błędów i złożenia. */
.ap-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* <h1 tabindex="-1">: fokus ustawiany programowo po nawigacji, bez ramki (to nie element do klikania). */
.ap-root [tabindex='-1']:focus {
  outline: none;
}
/* Przewijany kontener (zwykle <main> albo html) dostaje scroll-padding-bottom równy wysokości dolnego paska,
   żeby sfokusowany element nie chował się pod pasek zamówienia ani zakładki (WCAG 2.4.11 Focus Not Obscured). */
.ap-scroll {
  scroll-padding-top: 8px;
  scroll-padding-bottom: var(--ap-scroll-pad-bottom, 24px);
}
@container ap-app (max-width: 1023px) {
  .ap-scroll {
    --ap-scroll-pad-bottom: calc(var(--ap-component-dock-height) + 24px);
  }
}
@container ap-app (max-width: 480px) {
  .ap-scroll {
    /* zakładki 66 px + mini-pasek 56 px nad nimi (bottom: 74 px) + zapas */
    --ap-scroll-pad-bottom: 146px;
  }
}

/* Chip wyboru wariantu (rozmiar). Aktywny link: aria-current="page", aktywny przycisk: aria-pressed. */
.ap-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--ap-semantic-color-border-control);
  background: var(--ap-semantic-color-surface-default);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.ap-chip[aria-pressed='true'],
.ap-chip[aria-current='page'] {
  background: var(--ap-semantic-color-selection-bg);
  color: var(--ap-semantic-color-text-brand);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--ap-semantic-color-focus-ring);
}

/* Menu konta na telefonie: awatar w nagłówku otwiera menu z „Wyloguj” (komputer ma „Wyloguj” w stopce SideNav).
   Przycisk ma aria-label z widocznym tekstem: „AN, konto: Anna Nowak” (WCAG 2.5.3). */
.ap-account {
  display: none;
  position: relative;
}
.ap-account__button {
  display: grid;
  place-items: center;
  width: var(--ap-semantic-size-touch-target);
  height: var(--ap-semantic-size-touch-target);
  border-radius: 8px;
}
.ap-account__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--ap-semantic-color-surface-default);
  border: 1px solid var(--ap-semantic-color-border-strong);
  border-radius: var(--ap-component-dropdown-menu-radius, 10px);
  box-shadow: var(--ap-component-dropdown-menu-shadow);
}
.ap-account__menu[hidden] {
  display: none;
}
.ap-account__menu button,
.ap-account__menu a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--ap-semantic-size-touch-target);
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  text-align: left;
}
.ap-account__menu button:hover,
.ap-account__menu a:hover {
  background: var(--ap-semantic-color-bg-hover);
}
.ap-account__who,
.ap-account__caregiver {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ap-semantic-color-border-default);
  font-size: 13px;
  color: var(--ap-semantic-color-text-secondary);
}
@container ap-app (max-width: 480px) {
  .ap-account {
    display: block;
  }
}

/* Tło grupowane na telefonie (iOS, #F2F2F7): text.muted ma tam 4,46:1 (poniżej AA), więc na tym tle
   tekst wyciszony schodzi do text.secondary (6,23:1). Dotyczy etykiet „Kategoria”, linii dostawy, placeholderów.
   Na białej powierzchni (zakładki, karty) zostaje text.muted (4,97:1). */
.ap-surface-grouped {
  --ap-phone-grouped-bg: #f2f2f7;
  background: var(--ap-phone-grouped-bg);
  --ap-semantic-color-text-muted: var(--ap-semantic-color-text-secondary);
}

/* ============================================================ Dotyk ====
 * Urządzenia z dotykiem: cele co najmniej 44 px (WCAG 2.5.8 AA wymaga 24 px, produkt celuje w 44).
 * Na końcu pliku, żeby wygrywać z regułami kontenerowymi o tej samej specyficzności.
 */
@media (pointer: coarse) {
  .ap-btn,
  .ap-stepper,
  .ap-stepper button,
  .ap-nav-item,
  .ap-field__control,
  .ap-select,
  .ap-select--sm,
  .ap-search,
  .ap-pagination__link,
  .ap-pagination__gap,
  .ap-dropdown__value,
  .ap-segmented button,
  .ap-sort-button,
  .ap-chip {
    height: var(--ap-semantic-size-touch-target);
  }
  .ap-stepper button {
    width: var(--ap-semantic-size-touch-target);
  }
  .ap-stepper input {
    width: var(--ap-semantic-size-touch-target);
    height: var(--ap-semantic-size-touch-target);
  }
  .ap-sidenav__logo {
    padding-block: 8px;
  }
  .ap-icon-btn,
  .ap-search__clear,
  .ap-navtog {
    width: var(--ap-semantic-size-touch-target);
    height: var(--ap-semantic-size-touch-target);
  }
  .ap-pagination__link,
  .ap-pagination__gap,
  .ap-chip {
    min-width: var(--ap-semantic-size-touch-target);
  }
  /* Pozycje list rozwijanych i menu konta */
  .ap-dropdown__menu li {
    height: var(--ap-semantic-size-touch-target);
  }
  /* Linki tekstowe poza zdaniem (np. „Wszystkie zamówienia →”, „Zapomniałeś/aś hasła?”, okruszki):
     obszar klikalny co najmniej 44 px, tekst zostaje mały. Link w środku zdania dostaje `.ap-link--inline`
     (wyjątek WCAG 2.5.8 dla linków w tekście). */
  .ap-link:not(.ap-link--inline),
  .ap-breadcrumbs a,
  .ap-orders-table__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--ap-semantic-size-touch-target);
  }
  .ap-sort-button {
    min-width: var(--ap-semantic-size-touch-target);
    align-items: center;
  }
  /* Wiersze klikalne i pola ilości w listach */
  .ap-product-row__thumb {
    min-width: var(--ap-semantic-size-touch-target);
    min-height: var(--ap-semantic-size-touch-target);
  }
  .ap-qty-cell .ap-stepper input {
    min-width: var(--ap-semantic-size-touch-target);
  }
}

/* ============================================== Uzupełnienia dla komponentów Rails === */
.ap-search__clear[hidden] {
  display: none;
}
.ap-dropdown__value > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  text-align: left;
}
.ap-dropdown__count {
  margin-left: auto;
  color: var(--ap-semantic-color-text-muted);
  font-weight: 400;
  font-size: 12px;
}
.ap-field__label > span {
  color: var(--ap-semantic-color-text-muted);
  font-weight: 400;
}
.ap-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ap-lines small {
  display: block;
}
.ap-sort-button {
  text-decoration: none;
}
.ap-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ap-order-detail__header {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.ap-order-detail__header > .ap-order-detail__meta {
  grid-column: 1 / -1;
}
.ap-order-detail__meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--ap-semantic-color-text-muted);
}
.ap-order-detail__reason,
.ap-order-detail__contact {
  margin: 0;
  font-size: 13px;
}
.ap-order-detail__contact {
  color: var(--ap-semantic-color-text-secondary);
}
.ap-sidenav__foot[aria-current] {
  background: var(--ap-component-side-nav-active-bg);
  box-shadow: var(--ap-component-side-nav-active-ring);
}
.ap-nav-item__count:empty {
  display: none;
}
@container ap-app (max-width: 1359px) {
  .ap-navtog {
    display: none;
  }
}
/* Ręcznie zwinięte menu (≥ 1360 px): te same reguły co układ wąski */
.ap-sidenav--collapsed {
  width: var(--ap-component-side-nav-width-compact);
  padding: 14px 10px;
  align-items: center;
}
.ap-sidenav--collapsed .ap-sidenav__logo {
  width: var(--ap-component-side-nav-logo-width-compact);
  overflow: hidden;
  margin: 2px 0 18px;
}
.ap-sidenav--collapsed .ap-nav-item {
  width: 44px;
  height: 40px;
  padding: 0;
  justify-content: center;
  position: relative;
}
.ap-sidenav--collapsed .ap-nav-item__label,
.ap-sidenav--collapsed .ap-sidenav__group {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.ap-sidenav--collapsed .ap-nav-item__count {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10.5px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--ap-semantic-color-selection-bg);
  color: var(--ap-semantic-color-text-brand);
  display: grid;
  place-items: center;
  font-weight: 700;
}
@container ap-app (max-width: 480px) {
  .ap-tabs a {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    color: var(--ap-semantic-color-text-muted);
    font-weight: 500;
  }
  .ap-tabs a[aria-current] {
    color: var(--ap-semantic-color-text-brand);
    font-weight: 700;
  }
  .ap-tabs svg.ap-icon {
    stroke-width: 1.6;
  }
}
.ap-tabs__badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 5px);
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--ap-semantic-color-selection-bg);
  color: var(--ap-semantic-color-text-brand);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.ap-tabs__badge:empty {
  display: none;
}
.ap-order-panel__empty {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-order-panel__empty-bar {
  display: none;
  margin: 0;
  color: var(--ap-semantic-color-text-secondary);
}
@container ap-app (max-width: 1023px) {
  .ap-order-panel__empty {
    display: none;
  }
  .ap-order-panel__empty-bar {
    display: block;
  }
}
.ap-qty-cell form.button_to,
.ap-order-panel__actions form.button_to {
  display: contents;
}
.ap-sidenav__foot .ap-nav-item__label small {
  display: block;
  color: var(--ap-semantic-color-text-muted);
}
.ap-login-form {
  display: grid;
  gap: 16px;
}
.ap-login-form .ap-link {
  margin-top: 8px;
}
.ap-link--button {
  order: 1;
  margin: -8px 0 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.ap-login-form > .ap-btn--primary {
  order: 2;
}
.ap-login-card__contact {
  margin: 0;
  font-size: 12.5px;
  color: var(--ap-semantic-color-text-muted);
}
.ap-account-page {
  display: grid;
  gap: 16px;
  max-width: 640px;
}
.ap-card__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ap-card__row-end {
  margin-left: auto;
}
.ap-card__saved {
  color: var(--ap-semantic-color-status-ok);
}

/* Logowanie i hasła: karta i stopka razem wyśrodkowane w pionie (prototyp .login/.lfoot) */
.ap-login-card {
  margin-top: auto;
}
.ap-login-card > img {
  display: block;
  max-width: 100%;
  height: auto;
}
.ap-login-card h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.ap-login-card > p:not([class]) {
  margin: 0;
  color: var(--ap-semantic-color-text-secondary);
  font-size: 13.5px;
}
.ap-login-card form.button_to {
  justify-self: center;
}
.ap-login-foot {
  display: grid;
  gap: 8px;
  max-width: 440px;
  padding: 0 16px;
  margin-bottom: auto;
  text-align: center;
  font-size: 12.5px;
  color: var(--ap-semantic-color-text-muted);
}
.ap-login-foot p {
  margin: 0;
}
.ap-login-foot a {
  color: var(--ap-semantic-color-text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ap-login:not(:has(.ap-login-foot)) .ap-login-card {
  margin-bottom: auto;
}
@media (max-width: 480px) {
  .ap-login {
    padding: 24px 0 34px;
    background: var(--ap-semantic-color-bg-sunken);
  }
  .ap-login-card {
    width: 100%;
    max-width: none;
    background: none;
    border: 0;
    box-shadow: none;
    padding: 16px;
    gap: 14px;
  }
  .ap-login-card h1 {
    font-size: 34px;
    line-height: 41px;
    font-weight: 700;
  }
  .ap-login-card > p:not([class]) {
    font-size: 15px;
  }
  .ap-login-foot nav {
    display: grid;
    justify-items: center;
  }
  .ap-login-foot nav > span {
    display: none;
  }
  .ap-login-foot a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

/* ===================================================== Powłoka aplikacji ===
 * Menu boczne | treść | panel zamówienia. Poniżej 1024 px panel staje się paskiem u dołu
 * (reguły OrderPanel), poniżej 481 px menu zastępuje pasek zakładek.
 */
.ap-app {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  height: 100dvh;
  overflow: hidden;
}
.ap-app > main {
  min-width: 0;
  overflow: auto;
  padding: 18px 28px var(--ap-scroll-pad-bottom, 32px);
}
@container ap-app (max-width: 1023px) {
  .ap-app > main {
    --ap-scroll-pad-bottom: calc(var(--ap-component-dock-height) + 24px);
  }
}
@container ap-app (max-width: 480px) {
  .ap-app > main {
    padding: 12px 16px calc(var(--ap-component-dock-height) + 90px);
  }
}

/* Ekran: nagłówek i sekcje */
.ap-screen {
  max-width: 1460px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}
.ap-screen-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.ap-screen-head__sub {
  font-size: 13px;
  color: var(--ap-semantic-color-text-muted);
}
@container ap-app (max-width: 1099px) {
  .ap-screen-head__sub {
    display: none;
  }
}
.ap-section {
  display: grid;
  gap: 10px;
}
.ap-section__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ap-section__head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ap-section__head > :last-child:not(h2) {
  margin-left: auto;
}

/* Katalog */
.ap-catalog {
  display: grid;
  gap: 14px;
}
.ap-catalog__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.ap-catalog__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--ap-semantic-color-text-muted);
}

/* Karta produktu */
.ap-product-hero {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.ap-product-section h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}
.ap-buy {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--ap-semantic-color-border-default);
  border-radius: var(--ap-component-card-radius, 10px);
}
.ap-buy--in-cart {
  background: var(--ap-semantic-color-selection-bg);
  border-color: transparent;
}

/* Nowe zamówienie i Podsumowanie */
.ap-cart-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.ap-cart-head > a,
.ap-cart-head > form {
  margin-left: auto;
}
.ap-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.ap-checkout__main {
  display: grid;
  gap: 16px;
}
.ap-checkout__aside {
  position: sticky;
  top: 16px;
  align-self: start;
}
@container ap-app (max-width: 1023px) {
  .ap-checkout {
    grid-template-columns: 1fr;
  }
  .ap-checkout__aside {
    position: static;
  }
}
.ap-done__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

@container ap-app (max-width: 900px) {
  .ap-product-hero {
    grid-template-columns: 1fr;
  }
}

/* Górny pasek: wyszukiwarka i menu konta */
.ap-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-bottom: 16px;
}
.ap-topbar form[role="search"] {
  flex: 0 1 410px;
  min-width: 0;
}
.ap-topbar .ap-search {
  width: 100%;
}
@container ap-app (max-width: 480px) {
  .ap-topbar form[role="search"] {
    flex: 1 1 auto;
  }
  .ap-topbar .ap-search kbd {
    display: none;
  }
}
.ap-topbar .ap-account {
  margin-left: auto;
}
.ap-product-lead {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ap-semantic-color-text-secondary);
  max-width: 60ch;
}
.ap-product-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}
.ap-product-section p + p {
  margin-top: 8px;
}

/* ============================================ Poprawki z przeglądu makiet (15.10) ===
 * Jeden rozmiar h1 ekranu (prototyp: tytuł ekranu, większy niż nagłówki sekcji 18 px; na telefonie duży tytuł iOS).
 * Wyjątki jak w prototypie: nazwa produktu na karcie (.pc h2) i „Zamówienie złożone” (.done h2).
 */
.ap-app > main h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.ap-app > main > h1 {
  margin-bottom: 16px;
}
@container ap-app (max-width: 480px) {
  .ap-app > main h1 {
    font-size: 28px;
    line-height: 34px;
    font-weight: 700;
    letter-spacing: 0.2px;
  }
}

/* Katalog: tytuł wyników i licznik; na telefonie licznik pod tytułem */
.ap-catalog > p,
.ap-catalog__head .ap-meta {
  margin: 0;
}
.ap-catalog__head {
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 10px;
}
@container ap-app (max-width: 480px) {
  .ap-catalog__head h1 {
    flex-basis: 100%;
  }
}

/* Nowe zamówienie: „N pozycji”, zapis, „Dodaj produkty”; na telefonie nagłówek w osobnym wierszu */
.ap-cart-head {
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-bottom: 10px;
}
.ap-cart-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
@container ap-app (max-width: 480px) {
  .ap-cart-head h2 {
    flex-basis: 100%;
    font-size: 20px;
    font-weight: 700;
  }
}

/* Karta produktu (prototyp .pc, .buy, .facts) */
.ap-product-hero > * {
  min-width: 0;
}
.ap-product-hero__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-content: start;
}
.ap-app .ap-product-hero h1 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.ap-product-hero h1 b {
  font-weight: 700;
  color: var(--ap-semantic-color-text-brand);
}
.ap-product-lead {
  margin: -10px 0 0;
}
.ap-thumb--lg:not(.ap-thumb--photo) {
  background: #f6f8fb;
  color: var(--ap-semantic-color-text-muted);
  gap: 10px;
  padding: 12px;
}
.ap-thumb--lg:not(.ap-thumb--photo) svg {
  width: 64px;
  height: 64px;
  stroke-width: 1.5;
}
@container ap-app (min-width: 1360px) {
  .ap-product-hero {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 32px;
  }
}
@container ap-app (max-width: 900px) {
  .ap-product-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .ap-product-hero > .ap-thumb--lg {
    max-width: 200px;
  }
}
@container ap-app (max-width: 480px) {
  .ap-product-hero > .ap-thumb--lg {
    max-width: 160px;
  }
  .ap-app .ap-product-hero h1 {
    font-size: 22px;
    line-height: 28px;
    font-weight: 600;
    letter-spacing: 0.2px;
  }
  /* Wiele wariantów: przewijany rząd pigułek w obrębie ekranu */
  .ap-product-hero .ap-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -2px;
    padding: 2px;
  }
  .ap-product-hero .ap-chips::-webkit-scrollbar {
    display: none;
  }
  .ap-product-hero .ap-chip {
    flex: none;
  }
}
.ap-buy {
  gap: 12px;
  padding: 18px;
}
.ap-buy--in-cart {
  background: none;
  border-color: var(--ap-semantic-color-border-default);
}
.ap-buy > .ap-price {
  margin: 0;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.02em;
  white-space: normal;
}
.ap-buy > .ap-price small {
  font-size: 13px;
  letter-spacing: 0;
}
.ap-buy .ap-status {
  white-space: normal;
}
.ap-buy .ap-product-row__qty {
  grid-area: auto;
  justify-items: stretch;
  gap: 12px;
}
.ap-buy .ap-quick-add {
  justify-self: start;
}
.ap-buy .ap-qty-cell {
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: stretch;
}
.ap-buy .ap-qty-cell > .ap-stepper {
  justify-self: start;
}
.ap-buy .ap-qty-cell > :not(.ap-stepper, .ap-converter),
.ap-buy .ap-qty-cell > form.button_to > * {
  justify-self: end;
}
.ap-buy .ap-converter,
.ap-buy .ap-qty-note {
  text-align: left;
}
@container ap-app (max-width: 480px) {
  .ap-buy {
    padding: 16px;
  }
  .ap-buy > .ap-price {
    display: grid;
    font-size: 28px;
    line-height: 34px;
    font-weight: 700;
  }
  .ap-buy .ap-quick-add {
    justify-self: stretch;
  }
  .ap-buy .ap-quick-add .ap-btn {
    flex: 1;
  }
  .ap-buy .ap-qty-cell > :not(.ap-stepper, .ap-converter),
  .ap-buy .ap-qty-cell > form.button_to > * {
    grid-area: 3 / 1 / auto / -1;
    justify-self: stretch;
    margin-top: 6px;
  }
}
.ap-product-section {
  margin-top: 8px;
}
.ap-product-section + .ap-product-section {
  margin-top: 8px;
}
.ap-product-section .ap-kv {
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 18px;
  font-size: 13.5px;
}
.ap-product-section .ap-kv dd {
  text-align: left;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Potwierdzenie (prototyp .done) */
.ap-done {
  padding: 0 16px;
}
.ap-done h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.ap-done p {
  margin: 0;
  color: var(--ap-semantic-color-text-secondary);
}
.ap-done .ap-sum {
  width: 100%;
  max-width: 320px;
  text-align: left;
}
.ap-done__actions {
  margin-top: 8px;
}
@media (max-width: 480px) {
  .ap-done {
    margin: 28px auto;
  }
  .ap-done h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.36px;
  }
  .ap-done p {
    font-size: 15px;
  }
  .ap-done__actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
}

/* Zamówienia na telefonie: status w jednej linii z numerem (link ma 44 px wysokości na dotyku) */
@media (pointer: coarse) {
  @container ap-orders (max-width: 639px) {
    .ap-orders-table td:nth-child(3) {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      min-height: var(--ap-semantic-size-touch-target);
      align-self: start;
    }
  }
}

/* Pozycje z miniaturą (panel zamówienia, Podsumowanie; prototyp .lines .li2) */
.ap-lines--thumbs > div {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: start;
}
.ap-lines--thumbs .ap-thumb {
  width: 40px;
  height: 40px;
}
.ap-lines--thumbs > div > span:not(.ap-thumb) {
  color: var(--ap-semantic-color-text-primary);
  min-width: 0;
}
.ap-lines--thumbs small {
  color: var(--ap-semantic-color-text-secondary);
}
/* Na tle wiersza „w zamówieniu” po najechaniu metadane mają kontrast ≥ 4,5:1 (WCAG 1.4.3) */
.ap-product-row--in-cart:hover {
  --ap-semantic-color-text-muted: var(--ap-semantic-color-text-secondary);
}

/* Karta podsumowania pod listą w Nowym zamówieniu: tylko telefon, wyżej działa panel zamówienia */
.ap-cart-summary {
  display: none;
  margin-top: 16px;
}
@container ap-app (max-width: 480px) {
  .ap-cart-summary {
    display: grid;
  }
  .ap-cart-summary form.button_to {
    display: contents;
  }
}
