/* Fast POS Sale layout. Shared tokens and components: custom-widgets/design-system/. */
.screen { max-width: 1280px; margin-inline: auto; padding: 20px 16px 112px; display: grid; gap: 24px; min-height: 100%; }
.catalog, .invoice { min-width: 0; }
.sale-view-switch { display: none; }
.product > span:first-child { min-width: 0; }
.product .product-sku { font-weight: var(--type-label-weight); color: var(--ink); width: fit-content; }
.product-price { margin-inline-start: auto; white-space: nowrap; }
.invoice-total { display: flex; align-items: center; justify-content: space-between; gap: var(--space); }
.payment-label { color: var(--muted); font-size: var(--type-label-size); line-height: var(--type-label-line); }
.products { display: grid; gap: 10px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; }
.product { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: start; min-height: 80px; padding: 14px 18px; border-radius: var(--small-radius); }
.product strong, .product small { display: block; }
.product strong, .line-name { overflow-wrap: anywhere; }
.product small { color: var(--muted); margin-top: 3px; font-size: var(--type-label-size); line-height: var(--type-label-line); }
.add-mark { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 25px; }
.invoice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; align-self: start; }
#invoice-status { margin: -8px 0 12px; }
.lines { display: grid; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding-block: 12px; border-bottom: 1px solid var(--border); }
.line-name { font-weight: var(--type-label-weight); }
.line-total { white-space: nowrap; font-size: var(--type-label-size); line-height: var(--type-label-line); color: var(--muted); margin-top: 4px; }
.invoice-total { padding-block: 24px 12px; font-weight: var(--type-label-weight); }
.invoice-total strong, .bar-total strong { font-size: var(--type-headline-size); line-height: var(--type-headline-line); font-variant-numeric: tabular-nums; }
.payment-area { margin-top: 20px; }
.payment-label { margin-bottom: 10px; }
.checkout { position: fixed; bottom: 0; inset-inline: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border-top: 1px solid var(--border); padding: 12px max(16px, calc((100% - 760px) / 2)) calc(12px + env(safe-area-inset-bottom)); z-index: 2; }
.bar-total { display: grid; flex-shrink: 0; }
.bar-total span { color: var(--muted); font-size: 12px; }
.bar-total strong { font-size: var(--type-title-size); line-height: var(--type-title-line); }
.pay-button { width: 100%; max-width: 420px; }
@media (min-width: 600px) { .screen { padding: 32px 32px 120px; } .invoice { padding: 24px; } }
@media (width < 840px) {
  /* Only the chosen view is in the phone flow; checkout remains visible in both. */
  .screen { align-content: start; }
  .sale-view-switch { display: flex; position: sticky; top: 0; z-index: 1; }
  .sale-view-switch button { flex: 1; }
  .sale-view-switch { margin-bottom: 24px; gap: 12px; padding-block: 8px; }
  .screen[data-view="invoice"] .catalog { display: contents; }
  .screen[data-view="invoice"] .catalog > :is(#product-heading, #products, #product-limit) { display: none; }
  .screen[data-view="catalog"] .invoice { display: contents; }
  .screen[data-view="catalog"] .invoice > :not(.checkout) { display: none; }
  #product-limit { margin-top: 12px; }
  .search-box { margin-bottom: 16px; }
  .products { max-height: min(360px, calc(var(--viewport-height) * .4)); }
  .lines { max-height: min(320px, calc(var(--viewport-height) * .35)); }
}
@media (min-width: 840px) {
  html, body { height: var(--viewport-height); overflow: hidden; }
  .screen { height: var(--viewport-height); min-height: 0; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: minmax(0, 1fr); gap: 32px; padding: 24px 32px; overflow: hidden; }
  .catalog { display: flex; flex-direction: column; min-height: 0; }
  .catalog > :not(.products) { flex-shrink: 0; }
  .products { flex: 1; gap: 6px; }
  .product { min-height: 64px; padding: 8px 12px; }
  .line { padding-block: 6px; }
  .step-button { min-width: 48px; min-height: 48px; }
  .invoice { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
  .invoice > :not(.lines) { flex-shrink: 0; }
  .lines { flex: 1; }
  .checkout { position: static; border: 0; padding: 24px 0 0; }
  .bar-total { display: none; }
  .pay-button { max-width: none; }
}

/* Previous-invoice review uses the same surfaces, spacing and Material controls. */
.old-panel { grid-column: 1 / -1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; overflow-y: auto; }
.old-panel h1 { font-size: clamp(22px, 4vw, 30px); }
.old-search-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 16px; margin-bottom: 24px; }
.old-search-form button { background: var(--primary-soft); color: var(--primary); }
.old-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.old-results { display: grid; gap: 10px; margin-top: 16px; }
.old-result { display: grid; gap: 4px; text-align: start; overflow-wrap: anywhere; }
.old-result[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.old-result small { color: var(--muted); }
.old-review { min-width: 0; }
.old-lines { margin-top: 16px; }
.old-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
#old-ask-cancel { width: 100%; margin-top: 16px; }
.old-outcome { grid-column: 1 / -1; background: var(--primary-soft); border-radius: var(--small-radius); padding: 16px; }
#old-panel-message { margin-top: 20px; }
.screen[data-panel="old"] { padding-bottom: 24px; }
@media (width < 600px) {
  .old-panel { padding: 16px; }
  .old-panel .title-row { gap: 8px; }
  .old-search-form { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .old-columns { grid-template-columns: minmax(0, 1fr); }
  #old-confirm-dialog .dialog-actions { flex-wrap: wrap; gap: 8px; }
}
