/*
 * Shared commerce components (architecture 18, ADR-0021): stat cards, hero, quick actions, charts, cart, payment
 * methods, stock list, workspace grids. Colours only through tokens (tests/web/tokens-lint.test.mjs).
 * Breakpoints as in components.css: 720px, 1010px; plus 1240px for the three-column dashboard.
 */

/* ---------------------------------------------------------------- tones */
.avb-tone--accent { background: var(--avb-accent-soft); color: var(--avb-accent-text); }
.avb-tone--success { background: var(--avb-success-soft); color: var(--avb-success); }
.avb-tone--danger { background: var(--avb-danger-soft); color: var(--avb-danger); }
.avb-tone--warning { background: var(--avb-warning-soft); color: var(--avb-warning); }
.avb-tone--info { background: var(--avb-info-soft); color: var(--avb-info); }
.avb-tone--neutral { background: var(--avb-surface-3); color: var(--avb-text-2); }
.avb-tone-text--accent { color: var(--avb-accent-text); }
.avb-tone-text--success { color: var(--avb-success); }
.avb-tone-text--danger { color: var(--avb-danger); }
.avb-tone-text--warning { color: var(--avb-warning); }
.avb-tone-text--info { color: var(--avb-info); }
.avb-tone-text--neutral { color: var(--avb-text-2); }

.avb-btn--lg {
  min-height: 54px;
  padding: 0 var(--avb-space-5);
  border-radius: var(--avb-radius-control);
  font-size: var(--avb-text-lg);
}

/* ---------------------------------------------------------------- panel (flat card used by the workspace) */
.avb-panel {
  min-width: 0;
  padding: var(--avb-space-4);
  border: 1px solid var(--avb-border);
  border-radius: var(--avb-radius-card);
  background: var(--avb-surface);
  box-shadow: var(--avb-shadow-1);
}

.avb-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--avb-space-3);
  margin-bottom: var(--avb-space-3);
}

.avb-panel__title {
  font-family: var(--avb-font-display);
  font-size: var(--avb-text-h2);
  font-weight: var(--avb-weight-bold);
  letter-spacing: var(--avb-tracking-tight);
}

.avb-panel__link {
  display: inline-flex;
  align-items: center;
  gap: var(--avb-space-1);
  border: 0;
  background: none;
  color: var(--avb-accent-text);
  font: inherit;
  font-size: var(--avb-text-sm);
  font-weight: var(--avb-weight-strong);
  cursor: pointer;
  white-space: nowrap;
}

.avb-panel__link:hover {
  text-decoration: underline;
}

@media (min-width: 720px) {
  .avb-panel {
    padding: var(--avb-space-5);
  }
}

/* ---------------------------------------------------------------- change chip */
.avb-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  padding: 2px var(--avb-space-2) 2px var(--avb-space-1h);
  border-radius: var(--avb-radius-pill);
  font-size: var(--avb-text-xs);
  font-weight: var(--avb-weight-bold);
}

.avb-delta--good { background: var(--avb-success-soft); color: var(--avb-success); }
.avb-delta--bad { background: var(--avb-danger-soft); color: var(--avb-danger); }

/* ---------------------------------------------------------------- stat card */
.avb-stat {
  display: flex;
  align-items: center;
  gap: var(--avb-space-3h);
  min-width: 0;
  padding: var(--avb-space-4);
  border: 1px solid var(--avb-border);
  border-radius: var(--avb-radius-card);
  background: var(--avb-surface);
  box-shadow: var(--avb-shadow-1);
  color: inherit;
  font: inherit;
  text-align: left;
}

.avb-stat--action {
  cursor: pointer;
  transition: box-shadow var(--avb-duration-base) var(--avb-ease-standard), transform var(--avb-duration-press) var(--avb-ease-standard);
}

.avb-stat--action:hover { box-shadow: var(--avb-shadow-2); }
.avb-stat--action:active { transform: scale(0.99); }

.avb-stat__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: var(--avb-radius-tile);
}

.avb-stat__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.avb-stat__label {
  color: var(--avb-text-muted);
  font-size: var(--avb-text-sm);
  font-weight: var(--avb-weight-label);
}

.avb-stat__value {
  font-family: var(--avb-font-display);
  font-size: var(--avb-text-kpi);
  font-weight: var(--avb-weight-heavy);
  letter-spacing: var(--avb-tracking-tight);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.avb-stat__note {
  color: var(--avb-text-muted);
  font-size: var(--avb-text-sm);
}

/* ---------------------------------------------------------------- hero */
.avb-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-2);
  min-width: 0;
  padding: var(--avb-space-5);
  border-radius: var(--avb-radius-panel);
  background: var(--avb-hero);
  color: var(--avb-hero-text);
  box-shadow: var(--avb-button-shadow);
  overflow: hidden;
}

.avb-hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--avb-space-3);
}

.avb-hero__label {
  font-size: var(--avb-text-lg);
  font-weight: var(--avb-weight-strong);
}

.avb-hero__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--avb-radius-tile);
  background: var(--avb-surface-3);
  border: 1px solid var(--avb-glass-border);
}

.avb-hero__value {
  font-family: var(--avb-font-display);
  font-size: 34px;
  font-weight: var(--avb-weight-heavy);
  letter-spacing: var(--avb-tracking-title);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.avb-hero__unit {
  font-size: 0.66em;
  font-weight: var(--avb-weight-bold);
}

.avb-hero__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--avb-space-2);
  font-size: var(--avb-text-sm);
}

.avb-hero .avb-delta--good,
.avb-hero .avb-delta--bad {
  background: var(--avb-surface);
}

@media (min-width: 720px) {
  .avb-hero__value { font-size: 44px; }
}

/* ---------------------------------------------------------------- quick actions */
.avb-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--avb-space-3);
}

.avb-quick__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--avb-space-3);
  min-width: 0;
  min-height: 72px;
  padding: var(--avb-space-3) var(--avb-space-4);
  border: 1px solid var(--avb-border);
  border-radius: var(--avb-radius-card);
  background: var(--avb-surface);
  box-shadow: var(--avb-shadow-1);
  color: var(--avb-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: box-shadow var(--avb-duration-base) var(--avb-ease-standard), transform var(--avb-duration-press) var(--avb-ease-standard);
}

.avb-quick__item:hover { box-shadow: var(--avb-shadow-2); }
.avb-quick__item:active { transform: scale(var(--avb-press-scale)); }

.avb-quick__item--primary {
  border-color: transparent;
  background: var(--avb-button);
  color: var(--avb-button-text);
  box-shadow: var(--avb-button-shadow);
}

.avb-quick__icon {
  display: grid;
  place-items: center;
  flex: none;
}

.avb-quick__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.avb-quick__title {
  font-weight: var(--avb-weight-bold);
  line-height: 1.25;
}

.avb-quick__hint {
  color: var(--avb-text-muted);
  font-size: var(--avb-text-sm);
  line-height: 1.3;
}

.avb-quick__item--primary .avb-quick__hint { color: inherit; }
.avb-quick__go { margin-left: auto; }

@media (min-width: 720px) {
  .avb-quick { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ---------------------------------------------------------------- charts */
.avb-chart { margin: 0; }

.avb-chart__svg {
  width: 100%;
  height: 220px;
  overflow: visible;
}

.avb-chart__grid { stroke: var(--avb-chart-grid); stroke-width: 1; }

.avb-chart__axis {
  fill: var(--avb-text-muted);
  font-size: 12px;
  font-family: var(--avb-font-body);
}

.avb-chart__area { fill: var(--avb-chart-fill); }

.avb-chart__line {
  fill: none;
  stroke: var(--avb-chart-1);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.avb-chart__dot {
  fill: var(--avb-chart-1);
  stroke: var(--avb-surface);
  stroke-width: 3;
}

.avb-chart__tip {
  fill: var(--avb-menu);
  stroke: var(--avb-border-strong);
}

.avb-chart__tiptext {
  fill: var(--avb-text);
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--avb-font-body);
}

.avb-series--1 { stroke: var(--avb-chart-1); background: var(--avb-chart-1); }
.avb-series--2 { stroke: var(--avb-chart-2); background: var(--avb-chart-2); }
.avb-series--3 { stroke: var(--avb-chart-3); background: var(--avb-chart-3); }
.avb-series--4 { stroke: var(--avb-chart-4); background: var(--avb-chart-4); }
.avb-series--5 { stroke: var(--avb-chart-5); background: var(--avb-chart-5); }

.avb-donut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--avb-space-5);
  margin: 0;
}

.avb-donut__ring {
  position: relative;
  flex: none;
  width: 168px;
  height: 168px;
}

.avb-donut__ring svg { width: 100%; height: 100%; }

.avb-donut__track { fill: none; stroke: var(--avb-surface-3); stroke-width: 20; }
.avb-donut__seg { fill: none; stroke-width: 20; }

.avb-donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
}

.avb-donut__center strong {
  font-family: var(--avb-font-display);
  font-size: 22px;
  font-weight: var(--avb-weight-heavy);
}

.avb-donut__center span { color: var(--avb-text-muted); font-size: var(--avb-text-sm); }

.avb-legend {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--avb-space-2h);
  min-width: 180px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.avb-legend__row {
  display: flex;
  align-items: center;
  gap: var(--avb-space-2h);
  font-size: var(--avb-text-md);
}

.avb-legend__dot {
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: var(--avb-radius-round);
}

.avb-legend__label { flex: 1; min-width: 0; }
.avb-legend__value { font-weight: var(--avb-weight-strong); }

.avb-rank {
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.avb-rank__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--avb-space-1h) var(--avb-space-2h);
}

.avb-rank__n {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--avb-radius-round);
  font-size: var(--avb-text-xs);
  font-weight: var(--avb-weight-heavy);
}

.avb-rank__n--1 { background: var(--avb-warning-soft); color: var(--avb-warning); }
.avb-rank__n--2 { background: var(--avb-info-soft); color: var(--avb-info); }
.avb-rank__n--3 { background: var(--avb-danger-soft); color: var(--avb-danger); }
.avb-rank__n--4 { background: var(--avb-surface-3); color: var(--avb-text-2); }

.avb-rank__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avb-rank__value { color: var(--avb-text-muted); font-size: var(--avb-text-sm); font-weight: var(--avb-weight-strong); }

.avb-rank__bar {
  grid-column: 2 / -1;
  width: 100%;
  height: 4px;
}

.avb-rank__track { fill: var(--avb-surface-3); }
.avb-rank__fill { fill: var(--avb-chart-1); }

/* ---------------------------------------------------------------- qty, thumb, chips */
.avb-qty {
  display: inline-flex;
  align-items: center;
  gap: var(--avb-space-1);
  flex: none;
}

.avb-qty .avb-iconbtn {
  width: 34px;
  height: 34px;
}

.avb-qty__n {
  min-width: 2ch;
  font-weight: var(--avb-weight-bold);
  text-align: center;
}

.avb-thumb {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--avb-radius-md);
  background: var(--avb-surface-2);
  object-fit: cover;
}

.avb-thumb--icon {
  border: 1px solid var(--avb-border);
  color: var(--avb-text-muted);
}

.avb-chips {
  display: flex;
  gap: var(--avb-space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.avb-chips::-webkit-scrollbar { display: none; }

.avb-chip {
  flex: none;
  min-height: 38px;
  padding: 0 var(--avb-space-4);
  border: 1px solid var(--avb-border-strong);
  border-radius: var(--avb-radius-pill);
  background: var(--avb-surface);
  color: var(--avb-text-2);
  font: inherit;
  font-size: var(--avb-text-sm);
  font-weight: var(--avb-weight-label);
  cursor: pointer;
}

.avb-chip:hover { background: var(--avb-surface-2); }

.avb-chip[aria-checked='true'] {
  border-color: transparent;
  background: var(--avb-nav-active);
  color: var(--avb-nav-active-text);
  font-weight: var(--avb-weight-bold);
}

/* ---------------------------------------------------------------- payment methods */
.avb-paymethods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
}

/* one row for every method, whatever the width (four or five methods) */
.avb-paymethods--n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.avb-paymethods--n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.avb-paymethods {
  gap: var(--avb-space-2);
}

.avb-paymethod {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--avb-space-1);
  min-width: 0;
  min-height: 68px;
  padding: var(--avb-space-2) var(--avb-space-1);
  border: 1px solid var(--avb-border-strong);
  border-radius: var(--avb-radius-control);
  background: var(--avb-surface);
  color: var(--avb-text);
  font: inherit;
  font-size: var(--avb-text-sm);
  font-weight: var(--avb-weight-strong);
  cursor: pointer;
}

.avb-paymethod:hover { background: var(--avb-surface-2); }

/* selected: accent border, tinted fill and accent text — plus aria-checked */
.avb-paymethod[aria-checked='true'] {
  border: 2px solid var(--avb-accent);
  background: var(--avb-accent-soft);
  color: var(--avb-accent-text);
}

/* ---------------------------------------------------------------- cart */
.avb-cart {
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-4);
  min-width: 0;
  padding: var(--avb-space-4);
  border: 1px solid var(--avb-border);
  border-radius: var(--avb-radius-panel);
  background: var(--avb-surface);
  box-shadow: var(--avb-shadow-1);
}

.avb-cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--avb-space-2);
}

.avb-cart__title {
  font-family: var(--avb-font-display);
  font-size: var(--avb-text-h2);
  font-weight: var(--avb-weight-bold);
}

.avb-cart__count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  margin-left: var(--avb-space-1);
  padding: 0 var(--avb-space-2);
  border-radius: var(--avb-radius-pill);
  background: var(--avb-accent-soft);
  color: var(--avb-accent-text);
  font-size: var(--avb-text-sm);
}

.avb-cart__lines {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.avb-cart__line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    'thumb info info remove'
    'thumb qty sum sum';
  align-items: center;
  gap: var(--avb-space-1h) var(--avb-space-3);
  padding: var(--avb-space-3) 0;
  border-bottom: 1px solid var(--avb-border);
}

.avb-cart__line > .avb-thumb { grid-area: thumb; }
.avb-cart__info { grid-area: info; display: flex; flex-direction: column; min-width: 0; }
.avb-cart__line > .avb-qty, .avb-cart__line > .avb-qty__n { grid-area: qty; justify-self: start; }
.avb-cart__sum { grid-area: sum; justify-self: end; font-weight: var(--avb-weight-bold); white-space: nowrap; }
.avb-cart__line > .avb-iconbtn { grid-area: remove; justify-self: end; }

.avb-cart__name {
  font-weight: var(--avb-weight-bold);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.avb-cart__code { color: var(--avb-text-muted); font-size: var(--avb-text-sm); }
.avb-cart__flag { color: var(--avb-warning); font-size: var(--avb-text-xs); font-weight: var(--avb-weight-bold); }

.avb-cart__totals {
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-3);
  margin: 0;
}

.avb-cart__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--avb-space-3);
}

.avb-cart__row dt { font-weight: var(--avb-weight-label); }
.avb-cart__row dd { margin: 0; font-weight: var(--avb-weight-bold); text-align: right; }

.avb-cart__row--pay {
  padding-top: var(--avb-space-3);
  border-top: 1px solid var(--avb-border);
}

.avb-cart__row--pay dt {
  font-family: var(--avb-font-display);
  font-size: 22px;
  font-weight: var(--avb-weight-heavy);
}

.avb-cart__row--pay dd {
  color: var(--avb-accent-text);
  font-family: var(--avb-font-display);
  font-size: 24px;
  font-weight: var(--avb-weight-heavy);
}

.avb-cart__discount {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--avb-space-2);
  min-width: 0;
}

.avb-cart__mode {
  min-width: 44px;
  height: 44px;
  padding: 0 var(--avb-space-2);
  border: 1px solid var(--avb-border-strong);
  border-radius: var(--avb-radius-md);
  background: var(--avb-surface-2);
  color: var(--avb-text);
  font: inherit;
  font-weight: var(--avb-weight-bold);
  cursor: pointer;
}

.avb-cart__input {
  width: 84px;
  min-height: 44px;
  text-align: right;
}

.avb-cart__minus { color: var(--avb-text-muted); white-space: nowrap; }

.avb-cart__error {
  margin: calc(-1 * var(--avb-space-2)) 0 0;
  color: var(--avb-danger);
  font-size: var(--avb-text-sm);
  text-align: right;
}

.avb-cart__hint {
  color: var(--avb-text-muted);
  font-size: var(--avb-text-sm);
  text-align: center;
}

.avb-cart__secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--avb-space-2h);
}

/* weighed and measured lines: the quantity opens the weigh sheet (architecture 17 §9) */
.avb-cart__weight {
  grid-area: qty;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: var(--avb-space-1h);
  min-height: 40px;
  padding: 0 var(--avb-space-2h);
  border: 1px solid var(--avb-border-strong);
  border-radius: var(--avb-radius-pill);
  background: var(--avb-surface-2);
  color: var(--avb-text);
  font: inherit;
  font-weight: var(--avb-weight-bold);
  white-space: nowrap;
  cursor: pointer;
}

.avb-cart__weight:disabled { cursor: default; }

.avb-cart__cash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--avb-space-1h) var(--avb-space-3);
}

.avb-cart__cash-label { font-weight: var(--avb-weight-label); }
.avb-cart__cash .avb-cart__input { width: 132px; }

.avb-cart__change {
  grid-column: 1 / -1;
  min-height: 1.3em;
  font-weight: var(--avb-weight-bold);
  text-align: right;
}

.avb-cart__change--low { color: var(--avb-danger); }

.avb-ws-weigh__sum {
  min-height: 1.4em;
  margin: 0;
  font-size: var(--avb-text-lg);
  font-weight: var(--avb-weight-bold);
}

.avb-receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--avb-space-2);
}

.avb-receipt-actions > * {
  flex: 1 1 160px;
  min-width: 0;
}

.avb-pos-sales {
  margin: 0;
  padding: 0;
  list-style: none;
}

.avb-pos-sales li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--avb-space-2);
  padding: var(--avb-space-2) 0;
  border-bottom: 1px solid var(--avb-border);
}

.avb-pos-sales__ref { font-weight: var(--avb-weight-bold); }
.avb-pos-sales__meta { color: var(--avb-text-muted); font-size: var(--avb-text-sm); }

@media (min-width: 720px) {
  .avb-cart { padding: var(--avb-space-5); }
}

/* ---------------------------------------------------------------- stock list */
.avb-stocklist {
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.avb-stocklist__row {
  display: flex;
  align-items: center;
  gap: var(--avb-space-3);
  width: 100%;
  min-height: 64px;
  padding: var(--avb-space-2) var(--avb-space-3);
  border: 1px solid var(--avb-border);
  border-radius: var(--avb-radius-tile);
  background: var(--avb-surface-2);
  color: inherit;
  font: inherit;
  text-align: left;
}

.avb-stocklist__row--action { cursor: pointer; }
.avb-stocklist__row--action:hover { background: var(--avb-surface-3); }

.avb-stocklist__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.avb-stocklist__name { font-weight: var(--avb-weight-bold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avb-stocklist__sub { color: var(--avb-text-muted); font-size: var(--avb-text-sm); }
.avb-stocklist__chev { color: var(--avb-text-muted); flex: none; }

.avb-stockpill {
  flex: none;
  padding: 3px var(--avb-space-2h);
  border-radius: var(--avb-radius-pill);
  background: var(--avb-surface-3);
  font-size: var(--avb-text-xs);
  font-weight: var(--avb-weight-bold);
  white-space: nowrap;
}

.avb-stockpill--ok { background: var(--avb-success-soft); color: var(--avb-success); }
.avb-stockpill--low { background: var(--avb-warning-soft); color: var(--avb-warning); }

.avb-opkind {
  display: inline-flex;
  align-items: center;
  gap: var(--avb-space-1h);
  font-weight: var(--avb-weight-bold);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- workspace layouts */
.avb-ws {
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-4);
}

.avb-ws-welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--avb-space-3);
}

.avb-ws-welcome__title {
  font-family: var(--avb-font-display);
  font-size: var(--avb-text-h1);
  font-weight: var(--avb-weight-heavy);
  letter-spacing: var(--avb-tracking-title);
  line-height: 1.15;
}

.avb-ws-welcome__hint { color: var(--avb-text-muted); }

.avb-ws-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--avb-space-3);
}

.avb-ws-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--avb-space-4);
}

.avb-ws-side {
  display: flex;
  flex-direction: column;
  gap: var(--avb-space-3);
  min-width: 0;
}

.avb-ws-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--avb-space-2h);
}

.avb-ws-toolbar > .avb-field { flex: 1 1 240px; }

.avb-ws-pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--avb-space-4);
  align-items: start;
}

.avb-ws-pos__main { min-width: 0; }

.avb-ws-note {
  display: flex;
  align-items: center;
  gap: var(--avb-space-2);
  color: var(--avb-text-muted);
  font-size: var(--avb-text-sm);
}

.avb-ws-status {
  display: inline-flex;
  align-items: center;
  gap: var(--avb-space-1h);
}

.avb-ws-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--avb-radius-round);
  background: var(--avb-success);
}

.avb-ws-dot--off { background: var(--avb-warning); }

@media (min-width: 720px) {
  .avb-ws-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1010px) {
  .avb-ws { gap: var(--avb-space-5); }
  .avb-ws-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .avb-ws-row { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--avb-space-5); }
  .avb-ws-pos { grid-template-columns: minmax(0, 1fr) minmax(360px, 420px); gap: var(--avb-space-5); }
  .avb-ws-pos > .avb-pos-cart { position: sticky; top: calc(var(--avb-safe-top) + 128px); }
}

.avb-row-product {
  display: inline-flex;
  align-items: center;
  gap: var(--avb-space-3);
  min-width: 0;
  font-weight: var(--avb-weight-strong);
}

.avb-row-product .avb-thumb {
  width: 40px;
  height: 40px;
}

.avb-label-stage {
  display: grid;
  place-items: center;
  padding: var(--avb-space-4);
  border: 1px dashed var(--avb-border-strong);
  border-radius: var(--avb-radius-card);
  background: var(--avb-surface-2);
}

.avb-label-stage > .avb-barcode {
  max-width: 320px;
}

.avb-row__title .avb-row-product {
  white-space: normal;
}

.avb-pos-cart {
  min-width: 0;
  scroll-margin-top: calc(var(--avb-safe-top) + 72px);
}

/* phone: the cart is below the list — a bar above the bottom navigation jumps to it */
.avb-pos-bar {
  position: fixed;
  right: calc(var(--avb-space-3) + var(--avb-safe-right));
  bottom: calc(var(--avb-nav-bar-height) + var(--avb-safe-bottom) + var(--avb-space-3));
  left: calc(var(--avb-space-3) + var(--avb-safe-left));
  z-index: var(--avb-z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--avb-space-3);
  min-height: 52px;
  padding: 0 var(--avb-space-4);
  border: 0;
  border-radius: var(--avb-radius-control);
  background: var(--avb-button);
  color: var(--avb-button-text);
  box-shadow: var(--avb-button-shadow);
  font: inherit;
  font-weight: var(--avb-weight-bold);
  cursor: pointer;
}

@media (max-width: 719.98px) {
  /* room for the cart bar above the bottom navigation */
  .avb-ws-pos {
    padding-bottom: 72px;
  }
}

.avb-paymethod > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* the cart line keeps its two-row layout on every width (the panel is narrow); names wrap at words only */
.avb-cart__name {
  overflow-wrap: break-word;
}

@media (max-width: 479.98px) {
  .avb-paymethod {
    font-size: var(--avb-text-xs);
  }
}
