/* Store pages (/Stores/{id}/...): the header, Overview, items and inventory forms, devices, options, shifts. */

/* Received / Counted / Lost / Damaged as one row of equal buttons */
.reason-choice .btn {
  flex: 1 1 0;
  padding-inline: .25rem;
}

/* Adjusting stock: what happened, as equal buttons. Five don't fit a phone in one row ("Received" alone needs about 4.5rem),
   so they go in rows of three there, each its own button. A finger's 44px on touch screens and phones. */
.reason-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .375rem;
}

.reason-grid .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: .25rem;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .reason-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .reason-grid .btn {
    min-height: 44px;
  }
}

/* Refunds: each item with a stepper (or a box, by weight) for how much comes back */
.refund-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.refund-line-chosen {
  background: var(--bs-tertiary-bg);
}

.refund-line .min-w-0 {
  min-width: 0;
}

.refund-stepper {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .25rem;
}

.refund-stepper .btn {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.refund-stepper .form-control {
  width: 3.25rem;
  height: 2.75rem;
  padding-inline: .25rem;
  -moz-appearance: textfield;
}

.refund-stepper .form-control::-webkit-outer-spin-button,
.refund-stepper .form-control::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.refund-weight {
  flex: 0 0 auto;
  width: 9.5rem;
}

/* The item drawer (Store > Items): a right-side panel 640px wide, the whole screen on a phone. The form fills its height,
   so the header and the buttons stay put and only the body between them scrolls. */
.item-drawer {
  --bs-offcanvas-width: min(640px, 100vw);
}

.item-drawer-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

/* The body is what the recipe rows measure themselves against (the @container rule below), not the screen. */
.item-drawer .offcanvas-body {
  min-height: 0;
  container: item-drawer / inline-size;
}

/* Only the body gives up height on a short screen (a phone on its side): the title and the edit tabs keep theirs, or
   the tabs would be cut in half. */
.item-drawer-form > .offcanvas-header,
.item-drawer-form > .dialog-tabs {
  flex-shrink: 0;
}

.item-drawer-footer {
  display: flex;
  flex-shrink: 0;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--bs-border-color);
}

/* While the drawer is open, toasts (a category added, inventory that didn't load) must not land on Save, Next and Back.
   Where the screen is wide enough they sit at the top left, over the dimmed page. Where the drawer covers the screen they
   sit just above its footer: at the top they would hide the drawer's title and its close button. */
body:has(#item-modal.show, #item-modal.showing) #admin-toasts {
  bottom: calc(44px + 1.5rem + 1px + env(safe-area-inset-bottom)) !important;
}

@media (min-width: 1024px) {
  body:has(#item-modal.show, #item-modal.showing) #admin-toasts {
    top: 0;
    right: auto !important;
    bottom: auto !important;
    left: 0;
  }
}

/* Fingers: the drawer's buttons, its close and each recipe row's remove are 44px on touch screens and phones. */
@media (any-pointer: coarse), (max-width: 767.98px) {
  .item-drawer-footer .btn,
  .item-component [data-remove],
  .item-for-every .btn {
    min-height: 44px;
  }

  .item-component [data-remove],
  .item-for-every-help {
    min-width: 44px;
  }

  .item-drawer .offcanvas-header .btn-close {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  /* "Show contents on receipt": the whole row is a finger tall, label included. */
  .item-contents-switch {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .item-contents-switch .form-check-input {
    margin-top: 0;
  }

  .item-contents-switch .form-check-label {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-height: 44px;
    padding-left: .5rem;
  }
}

/* Item form (Store > Items): its sections, the inventory it uses and the "More options" fold */
.item-form-section + .item-form-section {
  margin-top: 1.5rem;
}

.item-form-heading {
  margin-bottom: .75rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

/* What the item uses from inventory, set apart from the fields every item has */
.item-stock-panel {
  padding: 1rem;
  border-radius: .75rem;
  background-color: var(--bs-tertiary-bg);
}

/* "Uses" and its "per one {name}" note share a line while both fit; otherwise the note goes underneath, whole. */
.item-stock-panel > div:has(> #item-inventory-per) {
  flex-wrap: wrap;
}

#item-inventory-per {
  margin-bottom: .5rem;
  white-space: normal;
}

/* One row per stock item the item uses: its name, the amount, its cost (room for RM 1,234.56) and Remove. A narrow
   drawer leaves out each row's cost; the item's total cost shows above. */
.item-component {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem 5.5rem auto;
  align-items: center;
  gap: .5rem;
}

.item-component-name {
  font-size: .875rem;
  font-weight: 500;
}

/* A new one's unit (pcs, kg...) is picked in its row, beside the amount */
.input-group > .item-component-unit {
  flex: 0 0 4.75rem;
  width: 4.75rem;
  padding-right: 1.5rem;
  background-position: right .35rem center;
}

/* What the ingredient box finds, in the flow of the dialog so a scrolling dialog doesn't cut it off */
.ingredient-list {
  margin-top: .25rem;
  max-height: 16rem;
  overflow-y: auto;
  font-size: .875rem;
}

.ingredient-list .list-group-item {
  padding: .5rem .75rem;
}

.ingredient-list .list-group-item.active .text-body-secondary {
  color: inherit !important;
}

.item-component-cost {
  text-align: end;
}

/* "for every [5] sold" under a row's amount, for inventory one unit of which is enough for several sold */
.item-component-every {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--bs-secondary-color);
}

.item-component-every .form-control {
  width: 4.5rem;
}

/* Narrow means the drawer's body, not the screen: on a phone the drawer is the whole screen, and below about 32rem the
   cost column would squeeze the name to a few letters. */
@container item-drawer (max-width: 32rem) {
  .item-component {
    grid-template-columns: minmax(0, 1fr) 9.5rem auto;
  }

  .item-component-cost {
    display: none;
  }

  .item-component-every {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* Browsers without container queries go by the screen's width, as the dialog did. */
@supports not (container-type: inline-size) {
  @media (max-width: 575.98px) {
    .item-component {
      grid-template-columns: minmax(0, 1fr) 9.5rem auto;
    }

    .item-component-cost {
      display: none;
    }

    .item-component-every {
      grid-column: 1 / -1;
      justify-content: flex-end;
    }
  }
}

/* Stock entered as "[3] tray + [4] pcs": whole packs and the units left over */
.pack-qty {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.pack-qty > .input-group {
  flex: 1 1 0;
  min-width: 0;
}

.pack-qty-plus {
  color: var(--bs-secondary-color);
}

/* The price paid for stock received */
.adjust-price-input {
  max-width: 18rem;
}

.adjust-price-indented {
  margin-top: .5rem;
  margin-left: 1.5rem;
}

.item-more {
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}

.item-more-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: start;
}

.item-more-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.item-more-chevron {
  transition: transform .15s ease;
}

.item-more-toggle:not(.collapsed) .item-more-chevron {
  transform: rotate(90deg);
}

/* The invoice editor: its lines, and the total with Save and Issue always in reach at the bottom */
.invoice-edit-lines > li {
  padding: .75rem 0;
  border-top: 1px solid var(--bs-border-color);
}

.invoice-edit-lines > li.invoice-edit-line-gone {
  border-left: 3px solid var(--bs-danger);
  padding-left: .75rem;
}

.invoice-edit-qty {
  width: 6.5rem;
}

.invoice-edit-price {
  width: 9rem;
}

.invoice-edit-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0 -.25rem;
  padding: .75rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  background: var(--bs-body-bg);
  box-shadow: 0 -4px 16px rgba(17, 24, 39, .08);
}

.invoice-edit-footer .btn,
#pay-modal .modal-footer .btn,
#issue-modal .modal-footer .btn {
  min-height: 2.75rem;
}

/* Item and inventory lists: a row opens when clicked; the chevron at its end says so */
.item-row-editable {
  cursor: pointer;
}

.item-price-stack {
  display: inline-grid;
  width: 100%;
  min-width: 8rem;
  gap: .25rem;
}

.item-price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  text-align: start;
  font-variant-numeric: tabular-nums;
}

.item-price-line > :first-child {
  overflow-wrap: anywhere;
}

.row-open {
  padding: .25rem .5rem;
}

/* Archived inventory: Restore at the row's end, a finger's 44px on touch screens and phones. */
.row-restore {
  white-space: nowrap;
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .row-restore {
    min-height: 44px;
    min-width: 44px;
  }
}

.item-cell {
  min-width: 11rem;
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
  .item-cell {
    min-width: 8rem;
  }

  .item-price-stack {
    min-width: 6.5rem;
  }
}

.item-label-settings {
  max-width: 39rem;
}

/* Item labels (docs/label-price-plan.md). No size is written here: item-label.js puts the numbers on each label as
   custom properties (--label-w, --label-h, --label-pad-x/-y, --label-gap, --label-gap-x, --label-name-font,
   --label-price-font, --label-code-font, --label-name-lines, --label-symbol-w, --label-symbol-h). */
.item-label-switch {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 44px;
  margin: .25rem 0 0;
  padding-left: 0;
}

.item-label-switch .form-check-input {
  flex: none;
  float: none;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
}

.item-label-switch .form-check-label {
  flex: 1 1 auto;
  min-height: 44px;
  display: flex;
  align-items: center;
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  #item-label-form .form-select,
  #item-label-form .form-control,
  #item-label-form .btn {
    min-height: 44px;
  }
}

/* The preview is the label at its true size; on a narrow screen it scrolls inside its own frame. */
.item-label-preview {
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: .375rem;
  overflow-x: auto;
}

.item-label {
  box-sizing: border-box;
  flex: none;
  width: var(--label-w);
  height: var(--label-h);
  padding: var(--label-pad-y) var(--label-pad-x);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--label-gap);
  overflow: hidden;
  color: #000;
  background: #fff;
  text-align: center;
  font-family: Arial, sans-serif;
}

/* The QR on the left, the words in a column on its right. */
.item-label-side {
  flex-direction: row;
  gap: var(--label-gap-x);
}

.item-label-text {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--label-gap);
}

.item-label-name {
  flex-shrink: 0;
  max-width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--label-name-lines);
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: var(--label-name-font);
  line-height: calc(var(--label-name-font) * 1.07);
  font-weight: 700;
}

.item-label-price {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: var(--label-price-font);
  line-height: calc(var(--label-price-font) * 1.053);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.item-label-code {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: var(--label-code-font);
  line-height: calc(var(--label-code-font) * 1.063);
  font-variant-numeric: tabular-nums;
}

/* The store's name, on one line at the top: a long one ends in "...". */
.item-label-store {
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--label-store-font);
  line-height: calc(var(--label-store-font) * 1.063);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.item-label-symbol {
  flex: none;
  width: var(--label-symbol-w);
  height: var(--label-symbol-h);
}

.item-label-symbol svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Cut lines: a dashed line just inside each printed label, taking no room. Empty positions get none. */
.item-label-cut .item-label {
  outline: .2mm dashed #808080;
  outline-offset: -.2mm;
}

.item-label-sheet {
  display: none;
}

/* The paper: one named page, whose size item-label.js writes into <style id="item-label-page-rule"> (A4 for every
   sheet, the label's own size for a roll), with no margin. A sheet's margins are padding on .item-label-page. */
@media print {
  body:has(#item-label-sheet:not([hidden])) {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body:has(#item-label-sheet:not([hidden])) > :not(#item-label-sheet) {
    display: none !important;
  }

  .item-label-sheet:not([hidden]) {
    display: block;
    page: item-label;
    print-color-adjust: exact;
  }

  .item-label {
    break-inside: avoid;
  }

  .item-label-sheet-roll .item-label:not(:last-child) {
    break-after: page;
  }

  .item-label-page {
    box-sizing: border-box;
    width: 210mm;
    padding: var(--sheet-top) 0 0 var(--sheet-left);
    display: grid;
    grid-template-columns: repeat(var(--sheet-cols), var(--sheet-w));
    grid-auto-rows: var(--sheet-h);
    column-gap: var(--sheet-gap-col);
    row-gap: var(--sheet-gap-row);
    break-inside: avoid;
    overflow: hidden;
  }

  .item-label-page:not(:last-child) {
    break-after: page;
  }
}

/* Store workspace: menu board */
.menu-board-section + .menu-board-section {
  margin-top: 1.5rem;
}

/* Overview's item board folds away: the whole header opens it, and the chevron turns. */
.menu-details > summary {
  cursor: pointer;
  list-style: none;
}

.menu-details > summary::-webkit-details-marker {
  display: none;
}

.menu-details > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
  border-radius: .75rem;
}

.menu-details-chevron {
  transition: transform .15s ease;
  color: var(--bs-secondary-color);
}

.menu-details[open] .menu-details-chevron {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .menu-details-chevron {
    transition: none;
  }
}

.menu-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}

.menu-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .5rem;
  min-height: 88px;
  padding: .75rem;
  border-radius: .6rem;
  border-left: 4px solid var(--category-color, #9ca3af);
  background-color: var(--bs-tertiary-bg);
}

/* Long names wrap inside the tile instead of running past its edge */
.menu-tile-name {
  min-width: 0;
  overflow-wrap: break-word;
}

.menu-tile-out {
  opacity: .6;
}

.store-card-link {
  color: inherit;
  text-decoration: none;
}

/* "My stores" cards, laid out like Santai Repair's: a logo and name, four-column numbers (each opening the page that manages
   them), the links, and a quiet row listing the Santai products the store is in. Cards in a row share their heights, so the
   dividers, numbers and links line up across them. */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  column-gap: 1rem;
}

.store-card.sc {
  grid-row: span 4;
  display: grid;
  grid-template-rows: subgrid;
  margin-bottom: 1rem;
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: none;
}

.store-card.sc .card-body {
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: subgrid;
  padding: 1rem 1rem 0;
}

.sc-top {
  padding-bottom: .875rem;
  container-type: inline-size;
}

.sc-logo {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.sc-title {
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sc-address a {
  overflow-wrap: anywhere;
}

.sc-pill {
  float: right;
  margin-left: .5rem;
  position: relative;
  z-index: 2;
}

.sc-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
  align-content: start;
  padding: .875rem 0 .5rem;
  border-top: 1px solid var(--bs-border-color-translucent);
}

.sc-stat {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  min-height: 2rem;
  color: var(--bs-body-color);
  text-decoration: none;
}

.sc-stat .bi {
  font-size: 1.1rem;
  color: var(--bs-secondary-color);
}

a.sc-stat:hover .sc-stat-count {
  color: var(--bs-link-color);
  text-decoration: underline;
}

.sc-stat-count {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.sc-stat-of {
  font-size: .75rem;
  color: var(--bs-secondary-color);
}

.sc-stat.is-zero .sc-stat-count {
  color: var(--bs-secondary-color);
  font-weight: 600;
}

.sc-stat.is-full .sc-stat-count,
.sc-stat.is-full .bi {
  color: var(--bs-warning-text-emphasis);
}

.sc-foot {
  align-self: end;
  position: relative;
  z-index: 2;
  padding-top: .25rem;
}

.sc-link {
  text-decoration: none;
}

.sc-link:hover {
  text-decoration: underline;
}

.sc-gear {
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  font-size: 1.15rem;
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.sc-gear:hover {
  color: var(--bs-link-color);
  background: var(--bs-tertiary-bg);
}

/* The products row: closed it is one quiet line; open it lists the products in place. */
.sc-acc {
  align-self: start;
  position: relative;
  z-index: 2;
  margin-inline: -1rem;
  padding-inline: 1rem;
  border-top: 1px solid var(--bs-border-color-translucent);
}

.sc-acc-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  text-align: left;
}

.sc-acc-toggle[aria-expanded="true"] {
  color: var(--bs-body-color);
}

.sc-acc-toggle:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
  border-radius: .25rem;
}

.sc-acc-count {
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 .3rem;
  border-radius: .6rem;
  background: var(--bs-success);
  color: #fff;
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
}

.sc-acc-count.is-none {
  background: var(--bs-secondary-color);
}

.sc-acc-chev {
  margin-left: auto;
  transition: transform .2s ease;
}

.sc-acc-toggle[aria-expanded="true"] .sc-acc-chev {
  transform: rotate(180deg);
}

.sc-acc-list {
  padding-bottom: .625rem;
}

.sc-product {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .4rem 0;
  font-size: .875rem;
}

.sc-product-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  color: #fff;
  font-size: 1rem;
}

.sc-product-icon.is-pos {
  background: #0f766e;
}

.sc-product-icon.is-repair {
  background: var(--bs-primary);
}

.sc-product-icon.is-off {
  opacity: .45;
}

.sc-product-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: 1.2;
}

.sc-product-name small {
  display: block;
  margin-top: .05rem;
  font-size: .75rem;
  font-weight: 500;
  color: var(--bs-secondary-color);
}

@media (any-pointer: coarse) {
  .sc-stat {
    min-height: 2.75rem;
  }

  .sc-gear {
    width: 2.75rem;
    height: 2.75rem;
  }

  .sc-acc-toggle {
    min-height: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-acc-chev {
    transition: none;
  }
}

/* A page that isn't Overview gets a slim header: a smaller logo and title, without the type and address lines. */
.store-header-compact .store-header-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .6rem;
}

.store-header-compact .store-header-name {
  font-size: 1.375rem;
}

.store-header-compact .store-header-kind,
.store-header-compact .store-header-address {
  display: none;
}

@media (max-width: 575.98px) {
  .store-header-logo {
    width: 2.75rem;
    height: 2.75rem;
  }

  .store-header-name {
    font-size: 1.25rem;
  }

  .store-header-actions {
    width: 100%;
  }

  /* The store system button takes the row; the "more" menu beside it keeps its own size. */
  .store-header-actions > .btn {
    flex: 1 1 0;
    padding: .375rem .5rem;
    font-size: .9rem;
    white-space: nowrap;
  }
}

/* Store > Receipts on a phone: what was bought, cut to two lines */
.receipt-items-short {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ...which takes the room the hidden columns leave, so it isn't squeezed into a few words a line */
@media (max-width: 767.98px) {
  .receipt-when {
    width: 100%;
  }
}

/* Inventory */
.stock-change-up { color: var(--bs-success-text-emphasis); }
.stock-change-down { color: var(--bs-danger-text-emphasis); }

/* A device pairing code (Store > Settings): big enough to read out across the counter, with its QR code. */
.pairing-code {
  font: 700 2rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
}

.pairing-qr {
  width: min(11rem, 60vw);
  margin: 0 auto;
  padding: .5rem;
  border-radius: .75rem;
  background-color: #fff;
}

.pairing-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.pairing-done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background-color: rgba(var(--bs-success-rgb), .15);
  color: var(--bs-success);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Store > Devices: each device with a phone-shaped icon, and the numbered steps to connect one. */
.device-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .5rem;
  background-color: rgba(var(--bs-primary-rgb), .1);
  color: var(--bs-primary);
}

.device-icon .icon {
  --icon-size: 1.25rem;
}

.device-icon-lg {
  display: flex;
  width: 3.25rem;
  height: 3.25rem;
}

.device-steps {
  padding-left: 1.25rem;
}

.device-steps li + li {
  margin-top: .75rem;
}

/* A new store's "Getting started" steps (store Overview): a number, or a green tick once done */
.getting-started-step {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.getting-started-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 50%;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
}

.getting-started-step.is-done .getting-started-mark {
  border-color: transparent;
  background-color: rgba(var(--bs-success-rgb), .15);
  color: var(--bs-success);
}

.getting-started-step.is-done .fw-semibold {
  color: var(--bs-secondary-color);
}

/* Items > Import: each row's line number in a narrow column of its own. */
.import-line {
  flex: 0 0 3.75rem;
  white-space: nowrap;
}

#import-rows .min-w-0 {
  min-width: 0;
}

/* Focus moves here when the preview opens, for screen readers; it is not something to click. */
#import-summary:focus {
  outline: none;
}

/* The template, one tap away under the file box, and the file's limits beside it. */
.import-get {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin-top: .75rem;
}

/* What the file comes to: a count for each of new, update, no change and skipped. */
.import-counts {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem 1rem;
  margin-bottom: .75rem;
  font-weight: 600;
}

.import-count {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

/* An empty list's ways to fill it (Items, Inventory). */
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-top: 1rem;
}

/* Fingers: 44px, whatever the root size (it's 14px on phones). The file box grows by its padding, and its own
   "Choose File" button with it. */
@media (any-pointer: coarse), (max-width: 767.98px) {
  .import-get .btn,
  .empty-actions .btn,
  #import-modal .modal-footer .btn {
    min-height: 44px;
  }

  #import-file {
    min-height: 44px;
    padding-block: .75rem;
  }

  #import-file::file-selector-button {
    margin-block: -.75rem;
    padding-block: .75rem;
  }
}

/* ---------------- Store > Options: one row per option, its name and what it adds ---------------- */

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem auto auto;
  gap: .5rem;
  align-items: center;
}

.option-row-remove,
.option-row-link-button {
  min-width: 44px;
  min-height: 44px;
}

.option-row-remove {
  margin-left: -.25rem;
}

/* Under a row: the item it is (docs/item-addons.md), who added it, and the search to pick an item, across the row. */
.option-row-link,
.option-row-by,
.option-link-picker {
  grid-column: 1 / -1;
}

.option-row-link {
  display: flex;
  align-items: center;
  gap: .375rem;
  min-width: 0;
  margin-top: -.25rem;
  padding-left: .25rem;
}

.option-row-link > .bi-link-45deg {
  color: var(--console-accent, var(--bs-primary));
}

.option-row-unlink {
  min-width: 36px;
  min-height: 36px;
  margin-left: auto;
  padding: 0;
}

.option-row-by {
  margin-top: -.25rem;
  padding-left: .25rem;
}

.option-link-picker {
  padding: .5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--bs-tertiary-bg);
}

.option-pick-list {
  margin-top: .375rem;
  max-height: 16rem;
  overflow-y: auto;
}

.option-pick {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
}

.option-pick-meta {
  color: var(--bs-secondary-color);
}

.option-pick.active .option-pick-meta {
  color: inherit;
}

/* A phone: the price keeps room for "100.00" beside its "+RM", the name gives way. */
@media (max-width: 400px) {
  .option-row {
    grid-template-columns: minmax(0, 1fr) 7.5rem auto auto;
    gap: .375rem;
  }

  .option-row-price > .input-group-text,
  .option-row-price > .form-control {
    padding-inline: .5rem;
  }
}

/* Store > Items drawer, Add-ons: each set's add-ons as chips, the link mark on the ones that are items. */
.addon-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.addon-chip > .bi-link-45deg {
  margin-right: .125rem;
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .item-addons-add {
    min-height: 44px;
  }

  .item-options-manage {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .item-option-set {
    min-height: 44px;
  }

  .item-ask-options {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: .375rem;
  }

  .option-row-unlink {
    min-width: 44px;
    min-height: 44px;
  }
}

.option-set-summary {
  overflow-wrap: anywhere;
}

/* Store > Settings: a side list of sections and the one that's open (store-settings.js). On a phone the list is the
   page, and a section replaces it, with "Settings" to go back. */
.settings-shell {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 5rem;
  padding: .375rem;
}

.settings-nav-group {
  padding: .75rem .75rem .25rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.settings-nav-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 2.75rem;
  padding: .375rem .75rem;
  border-radius: .5rem;
  font-weight: 550;
  color: var(--bs-body-color);
  text-decoration: none;
}

.settings-nav-link[hidden] {
  display: none;
}

.settings-nav-link:hover {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

.settings-nav-link:focus-visible {
  outline: 3px solid var(--focus-ring, #258cfb);
  outline-offset: 1px;
}

.settings-nav-name {
  flex: 1;
  min-width: 0;
}

.settings-nav-value {
  font-size: .8rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}

.settings-nav-chevron {
  display: none;
  color: var(--bs-secondary-color);
}

.settings-nav-link[aria-current="page"] {
  background-color: var(--console-accent);
  color: #fff;
}

.settings-nav-link[aria-current="page"] .settings-nav-value {
  color: rgba(255, 255, 255, .85);
}

.settings-nav-danger:not([aria-current="page"]) {
  color: var(--bs-danger-text-emphasis);
}

.settings-back {
  display: none;
  align-items: center;
  min-height: 2.75rem;
  margin-bottom: .5rem;
  font-weight: 600;
  text-decoration: none;
}

.settings-pane > .card:last-child {
  margin-bottom: 0 !important;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
}

.settings-saved {
  font-size: .85rem;
  color: var(--bs-secondary-color);
}

/* Switches that save themselves: a round mark, the name and a fact, the switch. */
.settings-row {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: 1rem 1.25rem;
}

.settings-row + .settings-row {
  border-top: 1px solid var(--bs-border-color);
}

.settings-mark {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  font-size: 1.1rem;
}

.settings-row-text {
  flex: 1;
  min-width: 0;
}

.settings-row .form-check-input {
  width: 2.75rem;
  height: 1.5rem;
  cursor: pointer;
}

/* Receipts: the form beside a receipt that follows it. The paper stays black on white in both themes, as it prints. */
.settings-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 1.5rem;
  align-items: start;
}

.settings-receipt {
  padding: .875rem .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .375rem;
  background-color: #fff;
  color: #111;
  font: .72rem/1.4 "Courier New", monospace;
  text-align: center;
}

.settings-receipt hr {
  margin: .4rem 0;
  border: 0;
  border-top: 1px dashed #777;
  opacity: 1;
}

.settings-receipt-line {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  text-align: left;
}

@media (max-width: 1199.98px) {
  .settings-split {
    grid-template-columns: 1fr;
  }

  .settings-preview {
    max-width: 14rem;
  }
}

@media (max-width: 991.98px) {
  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: static;
  }

  .settings-nav-link {
    min-height: 3.25rem;
  }

  .settings-nav-link + .settings-nav-link {
    border-top: 1px solid var(--bs-border-color);
    border-radius: 0;
  }

  .settings-nav-chevron {
    display: block;
  }

  /* The list, or the section that was tapped. */
  .settings-shell:not([data-section=""]) .settings-nav,
  .settings-shell[data-section=""] .settings-panes {
    display: none;
  }

  .settings-back {
    display: inline-flex;
  }
}

/* ---------------- Supplier invoices (Purchases > Add invoice, docs/invoice-upload-plan.md) ---------------- */

.invoice-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--bs-border-color);
  border-radius: .75rem;
  background: var(--bs-tertiary-bg);
  text-align: center;
}

.invoice-drop-over {
  border-color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle);
}

.invoice-drop-icon {
  font-size: 2rem;
  color: var(--bs-primary);
}

@media (any-pointer: coarse) {
  /* Nothing is dropped on a phone. */
  .invoice-drop-hint {
    display: none;
  }

  .invoice-drop .btn,
  .invoice-review-bar .btn {
    min-height: 44px;
  }
}

.invoice-waiting-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  padding: .5rem .25rem;
  border-top: 1px solid var(--bs-border-color);
  color: inherit;
  text-decoration: none;
}

.invoice-waiting-list > li:first-child .invoice-waiting-row {
  border-top: 0;
}

.invoice-waiting-row:hover {
  background: var(--bs-tertiary-bg);
}

/* The review: the invoice beside what was read on a computer, folded above it on a phone. */
.invoice-review-grid {
  display: grid;
  /* minmax(0, ...) so long names truncate instead of widening the page. */
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 992px) {
  .invoice-review-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }

  .invoice-review-preview {
    position: sticky;
    top: 1rem;
  }
}

.invoice-preview-frame {
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  background: var(--bs-body-bg);
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .invoice-preview-frame:not(.is-open) {
    display: none;
  }
}

.invoice-preview-pdf {
  display: block;
  width: 100%;
  height: min(80vh, 60rem);
  border: 0;
}

.invoice-preview-img {
  display: block;
  width: 100%;
  height: auto;
}

.review-line.is-skipped {
  opacity: .65;
}

.review-include {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0;
}

.review-line-fields {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--bs-border-color);
}

.review-qty {
  width: 9.5rem;
}

.review-cost {
  width: 9rem;
}

.invoice-review-totals {
  max-width: 24rem;
  margin: 0 0 1rem auto;
}

.invoice-review-totals > div + div {
  margin-top: .25rem;
}

/* Receive stays in reach at the bottom while the lines scroll. */
.invoice-review-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0 -1rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}

/* On a phone, above the bottom bar, as the toasts are. */
@media (max-width: 991.98px) {
  .has-bottom-nav .invoice-review-bar {
    bottom: calc(3.5rem + env(safe-area-inset-bottom));
  }
}

/* A matched line folded to what it becomes. */
.review-line-summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
}

.review-line-summary .btn {
  min-height: 2.25rem;
}

@media (any-pointer: coarse) {
  .review-line-summary .btn {
    min-height: 44px;
  }
}

/* Keyboard focus never ends up under the Receive bar (or, on a phone, the bottom bar too). */
html:has(#scan-review:not(.d-none)) {
  scroll-padding-bottom: 6rem;
}

@media (max-width: 991.98px) {
  html:has(.has-bottom-nav #scan-review:not(.d-none)) {
    scroll-padding-bottom: 10rem;
  }
}

/* A combined file's invoices: one chip each, the one shown filled. */
.invoice-part {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 16rem;
  min-height: 2.5rem;
  padding: .35rem .85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  text-decoration: none;
}

.invoice-part:hover {
  border-color: var(--bs-primary);
}

.invoice-part.active {
  border-color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
  font-weight: 600;
}

.invoice-part-no {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--bs-secondary-bg);
  font-size: .8rem;
  font-weight: 600;
}

@media (any-pointer: coarse) {
  .invoice-part {
    min-height: 44px;
  }
}

.review-line-other {
  background: var(--bs-tertiary-bg);
}

/* ---- The UI pass of 2026-11-19: credits, several files, the reading steps, calmer lines ---- */

/* A quiet pill that reads in both themes (text-bg-light with text-body doesn't in the dark one). */
.badge-quiet {
  border: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

/* Credits left: a number and a thin bar, amber when a fifth or less is left. */
.invoice-credits {
  margin-bottom: 1rem;
}

.invoice-credits-bar {
  --bs-progress-height: .375rem;
  --bs-progress-bar-bg: var(--console-accent);
  margin-top: .5rem;
}

.invoice-credits-bar.is-low {
  --bs-progress-bar-bg: var(--bs-warning);
}

/* Several files sent at once: a row each. */
.invoice-sent-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  padding: .5rem 0;
  border-top: 1px solid var(--bs-border-color);
}

.invoice-sent-list > li:first-child {
  border-top: 0;
}

.invoice-sent-wait {
  width: 8rem;
  margin-top: .35rem;
}

/* While it's read: Sent, Reading (with the time so far), Review. */
.invoice-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.invoice-steps > li {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.25rem;
  padding: .3rem .85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  font-size: .875rem;
  color: var(--bs-secondary-color);
}

.invoice-steps > .is-done {
  color: var(--bs-body-color);
}

.invoice-steps > .is-done > .bi {
  color: var(--bs-success);
}

.invoice-steps > .is-now {
  border-color: var(--console-accent);
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
  font-weight: 600;
}

.invoice-step-time {
  min-width: 2.25rem;
  font-weight: 400;
}

.invoice-skeleton-page {
  height: min(60vh, 40rem);
  border-radius: .75rem;
}

/* A browser that can't show a PDF in the page gets a button to open it instead. */
.invoice-preview-frame.invoice-preview-link {
  border: 0;
  background: transparent;
  overflow: visible;
}

/* A line that needs a look: an amber edge, and why in words. */
.review-line.review-line-check {
  border-left: .25rem solid var(--bs-warning);
}

.review-line-reason {
  margin-top: .5rem;
}

.review-line-suggest {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin-top: .5rem;
}

.review-kind .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
}

/* A line's inventory list lies over the Receive bar rather than under it. */
.review-line-fields .suggest-list {
  z-index: 6;
}

@media (any-pointer: coarse) {
  .review-kind .btn,
  .review-line-suggest,
  .review-line-fields [data-done],
  .invoice-preview-link .btn,
  #invoice-sent-actions .btn {
    min-height: 44px;
  }

  .invoice-steps > li {
    min-height: 2.5rem;
  }
}

/* Fingers: the review's fields, its "Show invoice" and the dialog's close are 44px too. */
@media (any-pointer: coarse) {
  #scan-review .form-control,
  #scan-review .form-select,
  #scan-review .input-group-text,
  #preview-toggle {
    min-height: 44px;
  }

  #scan-review .field-icon > .field-icon-mark {
    top: .8rem;
  }

  #invoice-modal .btn-close {
    padding: .875rem;
  }
}

/* ---- What suppliers call a stock item: their codes, on its Suppliers tab and under its name on an order ---- */
.supplier-code-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.supplier-code-row:last-child {
    border-bottom: 0;
}

.supplier-code-row .btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
}

.supplier-code {
    font-variant-numeric: tabular-nums;
}

/* Settings > Selling > Cash count: three options that name themselves, each a 44px target. */
.cash-count-options .btn {
  min-height: 44px;
  min-width: 4.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* The Overview's Close day: a 44px target on a touch screen, as a phone beside an old tablet is where it's used. */
@media (pointer: coarse) {
  #money-close-day { min-height: 44px; }
}

/* Transfers and counts (Advanced inventory): fingers get 44px on every field and button of their forms. */
@media (any-pointer: coarse), (max-width: 767.98px) {
  .stock-move-form .btn:not(.btn-close),
  .stock-move-form .form-control,
  .stock-move-form .form-select,
  .stock-move-form .input-group-text {
    min-height: 44px;
  }
}

/* A line of "Send stock": the item across the top on a phone, its amount and remove below; one row from 576px. */
.send-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: start;
}

.send-line-item {
  grid-column: 1 / -1;
  min-width: 0;
}

.send-line-quantity {
  min-width: 0;
  max-width: 12rem;
}

@media (min-width: 576px) {
  .send-line {
    grid-template-columns: minmax(0, 1fr) 10rem auto;
  }

  .send-line-item {
    grid-column: auto;
  }
}

/* A line of "Receive stock": how many arrived, and into which stock item. */
.receive-line-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .5rem;
}

@media (min-width: 576px) {
  .receive-line-fields {
    grid-template-columns: 11rem minmax(0, 1fr);
  }
}

/* Incoming and Outgoing figures double as the list's filters. */
.transfer-figure {
  color: inherit;
  border: 1px solid var(--bs-border-color-translucent);
  cursor: pointer;
  touch-action: manipulation;
}

.transfer-figure:hover {
  border-color: var(--bs-primary-border-subtle);
}

.transfer-figure.active {
  border-color: var(--bs-primary);
  box-shadow: inset 0 0 0 1px var(--bs-primary);
}

/* A count's progress through its lines. */
.count-progress {
  height: .5rem;
}

.count-input {
  width: 9.5rem;
}

.count-line-state {
  width: 2.5rem;
}

/* A count sheet to count on paper: only the sheet prints, as a plain table. */
.count-print-sheet[hidden] {
  display: none;
}

@media print {
  body:has(#count-print-sheet:not([hidden])) > :not(#count-print-sheet) {
    display: none !important;
  }

  body:has(#count-print-sheet:not([hidden])) {
    background: #fff !important;
  }

  .count-print-sheet {
    color: #000;
    font-size: 11pt;
  }

  .count-print-sheet h1 {
    font-size: 14pt;
    margin: 0 0 2mm;
  }

  .count-print-sheet table {
    width: 100%;
    border-collapse: collapse;
  }

  .count-print-sheet th,
  .count-print-sheet td {
    border: 1px solid #000;
    padding: 2mm 3mm;
    text-align: left;
  }

  .count-print-sheet th:last-child,
  .count-print-sheet td:last-child {
    width: 35mm;
  }

  .count-print-sheet tr {
    break-inside: avoid;
  }
}

/* Sell from inventory (docs/sell-from-inventory-plan.md): a tick column on the inventory list, a bar once something is
   ticked, and the Sell items dialog's price lines. The tick's label fills the cell, so the whole cell is the target. */
.select-cell {
  width: 3rem;
  padding: 0 !important;
}

.select-hit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.select-hit .form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  cursor: pointer;
}

.sell-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  box-shadow: 0 -.25rem .75rem rgba(0, 0, 0, .06);
}

.sell-bar .btn {
  min-height: 44px;
}

/* A row ticked with the keyboard scrolls into view above the bar, not under it. */
html:has(#sell-bar:not(.d-none)) {
  scroll-padding-bottom: 5rem;
}

.sell-markup {
  max-width: 9rem;
}

.sell-lines {
  display: grid;
  gap: .75rem;
}

.sell-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.sell-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.sell-line-name {
  flex: 1 1 10rem;
  min-width: 0;
}

.sell-price {
  flex: 0 1 11rem;
  width: auto;
}

.sell-remove {
  flex: none;
  min-width: 44px;
}

/* On a phone the name takes the line, and the price box and its remove button share the next. */
@media (max-width: 575.98px) {
  .sell-line-name {
    flex-basis: 100%;
  }

  .sell-price {
    flex: 1 1 0;
  }
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .sell-price .form-control,
  .sell-price .input-group-text,
  .sell-markup .form-control,
  .sell-markup .input-group-text,
  #sell-fill,
  .sell-remove,
  #sell-modal .modal-footer .btn {
    min-height: 44px;
  }
}

/* Selling a line of a supplier's invoice as it comes in (docs/sell-from-inventory-plan.md, step 2): a switch, and the
   price beside it once it's on. */
.review-sell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px dashed var(--bs-border-color);
}

/* Bootstrap's switch keeps its own left padding; the row is only made a finger tall. */
.review-sell .form-check {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.review-sell .form-check-input {
  margin-top: 0;
}

.review-sell .form-check-label {
  padding-left: .5rem;
}

.review-sell-price {
  flex: 0 1 12rem;
  width: auto;
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .review-sell-price .form-control,
  .review-sell-price .input-group-text,
  #review-fill {
    min-height: 44px;
  }
}

/* Use existing, in the item dialog's "Sold as it is": a finger tall on touch screens and phones. */
@media (any-pointer: coarse), (max-width: 767.98px) {
  .item-as-is-use {
    min-height: 44px;
  }
}

/* Customers: a person or a shop beside the name (customer-form.js kindMark). */
.customer-kind-mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
}

.customer-kind-mark.is-business {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
}

/* The customer form's Individual / Business switch: a finger tall on touch screens and phones. */
.customer-kind .btn {
  flex: 1 1 0;
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .customer-kind .btn,
  #customer-kind-filter .btn,
  #customer-status-filter .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* A customer's dashboard (store-customer.js). */
.customer-flag {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
}

.customer-flag.is-bad {
  background: var(--bs-danger-bg-subtle);
  color: var(--bs-danger-text-emphasis);
}

.customer-flag.is-warn {
  background: var(--bs-warning-bg-subtle);
  color: var(--bs-warning-text-emphasis);
}

.customer-dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.customer-dash-kpi {
  padding: .75rem 1rem;
  border-inline-start: 1px solid var(--bs-border-color-translucent);
}

.customer-dash-kpi:first-child {
  border-inline-start: 0;
}

.customer-dash-kpi-value {
  font-size: 1.25rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.customer-bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: .375rem;
  height: 9rem;
}

.customer-bar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: .25rem;
}

.customer-bar:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.customer-bar-track {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
}

.customer-bar-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--bs-primary) 55%, transparent);
}

.customer-bar-fill.is-now,
.customer-bar:hover .customer-bar-fill {
  background: var(--bs-primary);
}

.customer-bar-label {
  font-size: .6875rem;
  text-align: center;
  color: var(--bs-secondary-color);
  overflow: hidden;
  white-space: nowrap;
}

.customer-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .25rem;
  margin-bottom: .75rem;
  text-align: center;
}

.customer-week-cell {
  height: 1.25rem;
  border-radius: .25rem;
  background: color-mix(in srgb, var(--bs-primary) calc(var(--level) * 85% + 8%), var(--bs-secondary-bg));
}

.customer-fact {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .25rem 0;
}

.customer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 6rem 3.5rem;
  align-items: center;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.customer-item:last-child {
  border-bottom: 0;
}

.customer-item-meter {
  height: 4px;
  margin-top: .25rem;
  border-radius: 999px;
  background: var(--bs-secondary-bg);
  overflow: hidden;
}

.customer-item-meter > div {
  height: 100%;
  background: var(--bs-primary);
}

.customer-item-amount,
.customer-item-trend {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

@media (any-pointer: coarse), (max-width: 767.98px) {
  .customer-dash-range .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 575.98px) {
  .customer-dash-kpi:nth-child(odd) {
    border-inline-start: 0;
  }

  .customer-item {
    grid-template-columns: minmax(0, 1fr) 5.5rem 3rem;
  }

  .customer-item-qty {
    display: none;
  }
}

/* A customer's details: their facts side by side, so the dashboard starts higher. */
.customer-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0 1.5rem;
}
