#view-pos {
  max-width: none;
  padding: 18px 20px 90px;
}
body:has(#view-pos:not([hidden])) .sidebar {
  display: none;
}
body:has(#view-pos:not([hidden])) #approval-launcher {
  display: none;
}
body:has(#view-pos:not([hidden]) .pos-show-menu) .sidebar {
  display: flex;
}
.pos-page {
  max-width: var(--app-content-max, 1800px);
  margin: auto;
}
.pos-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 14px;
  background: #e0f5e8;
  border: 1px solid #a6dfbb;
  border-radius: 10px;
  color: #14532d;
}
.pos-head h1 {
  margin: 0;
  color: #14532d;
  font-size: var(--text-heading);
}
.pos-head > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 10px;
}
.pos-head .pos-note {
  grid-column: 1 / -1;
  grid-row: 2;
  color: #326b48;
  margin: 0;
}
.pos-head .btn.secondary {
  color: #14532d;
  background: #f5fff8;
  border-color: #9bceac;
}
.pos-head .btn.primary {
  background: #168148;
  border-color: #168148;
}
.pos-head-tools,
.pos-actions,
.pos-price {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.pos-head-tools {
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}
.pos-head .btn {
  min-height: 32px;
  padding: 5px 9px;
  font-size: var(--text-caption);
}
.pos-head-tools > select {
  width: auto;
  max-width: 180px;
  min-height: 32px;
  padding: 4px 28px 4px 9px;
  font-size: var(--text-caption);
}
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(390px, 1fr);
  gap: 16px;
}
.pos-card {
  min-width: 0;
  background: var(--card, #fff);
  border: 1px solid #dde3ec;
  border-radius: 14px;
  padding: 16px;
}
.pos-checkout {
  display: flex;
  flex-direction: column;
  align-self: start;
}
.pos-policy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e3e7ee;
}
.pos-policy select {
  max-width: 65%;
}
.pos-search {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.pos-search input {
  flex: 1;
  min-width: 0;
}
.pos-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 224px;
  align-content: start;
  gap: 10px;
  max-height: min(65vh, 710px);
  overflow: auto;
  padding: 2px;
  scrollbar-gutter: stable;
}
.pos-product {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid #dde3ec;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #13253c;
}
.pos-product img {
  width: 100%;
  height: 92px;
  flex: 0 0 92px;
  object-fit: contain;
}
.pos-product .pos-image-empty {
  height: 92px;
  flex: 0 0 92px;
  display: grid;
  place-items: center;
  background: #f0f2f5;
  border-radius: 8px;
  color: #8290a0;
}
.pos-product:disabled {
  cursor: not-allowed;
  background: #fafbfc;
}
.pos-product:not(:disabled):hover {
  border-color: #168148;
  box-shadow: 0 0 0 1px #168148;
}
.pos-product-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--text-small);
  line-height: 1.4;
  height: 36px;
  flex: 0 0 36px;
}
.pos-product-sku {
  flex-shrink: 0;
  line-height: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos-product strong,
.pos-change {
  color: #147548;
}
.pos-product small {
  font-size: var(--text-caption);
}
.pos-basket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pos-lines {
  min-height: 0;
  max-height: none;
  overflow: visible;
}
.pos-line {
  padding: 8px 0;
  border-bottom: 1px solid #e3e7ee;
}
.pos-line-top,
.pos-line-edit,
.pos-total-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.pos-line-top b {
  flex: 1;
}
.pos-line-top .btn {
  min-height: 24px;
  padding: 0 5px;
}
.pos-line-edit input,
.pos-line-edit select {
  padding: 6px;
}
.pos-line-edit {
  margin-top: 4px;
  flex-wrap: wrap;
}
.pos-line input {
  width: 90px;
}
.pos-line select {
  width: 65px;
}
.pos-line .pos-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pos-line .pos-qty input {
  width: 64px;
  text-align: center;
}
.pos-line button {
  min-height: 38px;
}
.pos-totals {
  padding-top: 12px;
}
.pos-total-row {
  padding: 3px 0;
}
.pos-total {
  font-size: var(--text-heading);
  font-weight: 750;
}
.pos-checkout .pos-total {
  border-top: 1px solid #e3e7ee;
  margin-top: 4px;
  padding-top: 12px;
}
.pos-tender {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0;
}
.pos-tender .pos-field {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
}
.pos-tender .pos-field > span {
  grid-column: 1 / -1;
}
.pos-change {
  display: block;
  font-size: var(--text-heading);
  padding: 8px 0;
}
.pos-checkout > .pos-field:has(input[type='checkbox']) {
  flex-direction: row;
  align-items: center;
}
.pos-checkout input[type='checkbox'] {
  width: auto;
}
.pos-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  align-items: stretch;
}
.pos-actions .btn {
  flex: 1;
  min-height: 48px;
}
.pos-actions .btn.primary {
  background: #168148;
}
/* Chi tiết đơn web: nút chính một dòng riêng, các nút phụ chia đều bên dưới. */
.pos-actions.pos-web-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pos-web-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 8px;
}
.pos-web-actions .btn.pos-web-main {
  flex-basis: 100%;
}
.pos-catalog > .btn {
  margin-top: 12px;
}
.pos-note {
  font-size: var(--text-small);
  color: #66768d;
}
.pos-note.pos-deposit-error { color: #b3261e; }
.pos-warning {
  background: #fff2d9;
  padding: 12px;
  border: 1px solid #ebce91;
  border-radius: 10px;
  margin: 10px 0;
}
.pos-order-board { margin-bottom: 16px; }
.pos-order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pos-order-head h2 { margin: 0 0 4px; }
.pos-order-head select { min-width: 260px; }
.pos-order-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin: 14px 0; }
.pos-order-count { display: flex; flex-direction: column; gap: 3px; padding: 11px; border: 1px solid #d8e0ea; border-radius: 12px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.pos-order-count strong { font-size: var(--text-heading); }
.pos-order-count.active { border-color: #1c65d1; box-shadow: 0 0 0 1px #1c65d1; }
.pos-order-search { width: 100%; margin-bottom: 10px; }
.pos-order-list { display: grid; gap: 7px; max-height: 330px; overflow: auto; }
.pos-order-row { display: grid; grid-template-columns: fit-content(260px) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, .9fr) auto; align-items: center; gap: 16px; width: 100%; padding: 10px 12px; border: 1px solid #d8e0ea; border-radius: 10px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.pos-order-row > * { min-width: 0; overflow-wrap: anywhere; }
.pos-order-row > b { line-height: 1.5; }
.pos-order-row:hover { border-color: #1c65d1; }
.pos-receive-cancelled { white-space: nowrap; }
.pos-order-quick-ghn { white-space: nowrap; min-height: 40px; }
.pos-order-state { font-weight: 700; color: #1c65d1; text-align: right; }
.pos-order-shipping { display: block; margin-top: 3px; color: #334155; line-height: 1.5; }
.pos-danger {
  color: #b61d32;
}
.pos-modal {
  width: min(590px, 95vw);
  max-height: 92vh;
  padding: 0;
  border: 0;
  border-radius: 14px;
}
.pos-modal::backdrop {
  background: #0c172b99;
}
.pos-modal form,
.pos-modal-content {
  padding: 22px;
}
.pos-modal-content { position: relative; }
.pos-modal-close { position: absolute; z-index: 3; top: 12px; right: 12px; width: 40px; height: 40px; border: 1px solid #cfd9d3; border-radius: 10px; background: #fff; color: #4c5e54; font-size: var(--text-heading); }
.pos-modal h2 {
  margin-top: 0;
}
.pos-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.pos-field input,
.pos-field select,
.pos-field textarea {
  width: 100%;
  box-sizing: border-box;
}
.pos-modal .btn {
  min-height: 44px;
}
.pos-count-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
}
.pos-count-row span {
  flex: 1;
}
.pos-count-row input {
  width: 110px;
}
.pos-qr {
  display: block;
  width: min(280px, 100%);
  margin: 12px auto;
}
.pos-cod-row {
  padding: 12px 0;
  border-bottom: 1px solid #ddd;
}
.pos-print-frame {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 80mm;
  height: 120mm;
  border: 0;
}
.pos-customer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
}
.pos-customer-list button {
  text-align: left;
}
.pos-busy {
  opacity: 0.7;
  pointer-events: none;
}
.pos-config-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.pos-open-shift {
  width: min(620px, 94vw);
  background: #fff;
  box-shadow: 0 24px 80px #0c172b40;
}
.pos-open-shift .pos-modal-content,
.pos-open-shift form {
  padding: 0;
}
.pos-shift-heading {
  padding: 24px 26px 20px;
  border-bottom: 1px solid #e3e8ef;
}
.pos-shift-badge {
  display: inline-block;
  padding: 4px 9px;
  background: #e8f6ee;
  color: #147548;
  border-radius: 6px;
  font-size: var(--text-caption);
  font-weight: 750;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.pos-shift-heading h2 {
  font-size: var(--text-heading);
  color: #142036;
  margin: 0 0 6px;
}
.pos-shift-content {
  padding: 20px 26px;
  display: grid;
  gap: 20px;
}
.pos-shift-content .pos-field {
  margin: 0;
}
.pos-shift-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pos-opening-money {
  position: relative;
}
.pos-opening-money input {
  background: #f0f8f4;
  border-color: #b9d9c7;
  padding: 12px 62px 12px 14px;
  font-size: var(--text-heading);
  font-weight: 750;
  color: #142036;
  font-variant-numeric: tabular-nums;
}
.pos-opening-money .pos-money-unit {
  position: absolute;
  right: 16px;
  bottom: 18px;
  color: #507362;
  font-size: var(--text-caption);
}
.pos-shift-opening > .pos-note {
  margin-top: 8px;
  font-size: var(--text-caption);
}
.pos-open-shift .pos-count-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 64px;
  gap: 12px;
  padding: 12px;
  margin: 0;
  border-bottom: 1px solid #e3e8ef;
}
.pos-open-shift .pos-count-row:last-child {
  border-bottom: 0;
}
.pos-open-shift .pos-count-row input {
  width: 100%;
  text-align: center;
  font-weight: 650;
}
.pos-shift-footer {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 16px 26px;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e3e8ef;
}
.pos-shift-footer .btn {
  min-height: 48px;
}
.pos-shift-footer .btn.primary {
  background: #168148;
  border-color: #168148;
}
@media (max-width: 500px) {
  .pos-shift-heading,
  .pos-shift-content {
    padding: 18px;
  }
  .pos-shift-choices {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pos-shift-footer {
    padding: 12px 18px;
  }
  .pos-open-shift .pos-count-row {
    grid-template-columns: minmax(0, 1fr) 72px 56px;
    gap: 8px;
  }
}
@media (min-width: 851px) {
  body:has(#view-pos:not([hidden])) .chat-launcher {
    left: 20px;
    right: auto;
    bottom: 18px;
  }
  body:has(#view-pos:not([hidden]) .pos-show-menu) .chat-launcher {
    left: 260px;
  }
}
@media (max-width: 1050px) {
  .pos-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 850px) {
  .pos-order-head { flex-direction: column; }
  .pos-order-head select { width: 100%; min-width: 0; }
  .pos-order-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-order-row { grid-template-columns: 1fr; gap: 3px; }
  .pos-order-state { text-align: left; }
  .pos-order-quick-ghn { justify-self: end; min-height: 44px; }
  .pos-layout {
    grid-template-columns: 1fr;
  }
  .pos-grid {
    max-height: 43vh;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .pos-head {
    align-items: flex-start;
    flex-direction: column;
  }
  body:has(#view-pos:not([hidden]) .pos-show-menu) .sidebar {
    display: none;
  }
  .pos-menu-toggle {
    display: none;
  }
}
@media (max-width: 500px) {
  #view-pos {
    padding: 12px 12px 110px;
  }
  .pos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pos-card {
    padding: 12px;
  }
  .pos-total {
    font-size: var(--text-heading);
  }
  .pos-head {
    padding: 8px 12px;
  }
  .pos-head h1 {
    font-size: var(--text-heading);
  }
  .pos-config-fields {
    grid-template-columns: 1fr;
  }
}
@media print {
  .pos-print-frame {
    left: 0;
  }
}

/* Customer search: one combobox, with transient suggestions instead of a directory. */
.pos-customer-picker { width: min(560px, 95vw); max-height:90dvh; overflow-y:auto; }
.pos-customer-picker .pos-modal-content { padding: 26px; }
.pos-customer-picker h2 { margin-bottom: 6px; font-size: var(--text-heading); }
.pos-customer-subtitle, .pos-customer-hint { color: #64748b; font-size: var(--text-small); line-height: 1.5; }
.pos-customer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 16px; }
.pos-customer-actions .btn { flex: 1; border-radius: 10px; white-space: nowrap; }
.pos-customer-actions .btn[aria-pressed="true"] { color: #087b48; background: #e8f8ef; border-color: #20a665; box-shadow: 0 0 0 1px #20a665; }
.pos-customer-search { position: relative; }
.pos-customer-input { width: 100%; box-sizing: border-box; min-height: 50px; border: 1px solid #cbd5e1; border-radius: 12px; padding: 12px 15px; font-size: var(--text-body); background: #f8fafc; }
.pos-customer-input:focus { outline: 3px solid #d8f4e5; border-color: #15965b; background: #fff; }
.pos-customer-suggestions { position: relative; margin-top:6px; max-height: min(320px, 35dvh); overflow-y: auto; overscroll-behavior-y:contain; border: 1px solid #dce5df; border-radius: 12px; background: #fff; padding: 5px; }
.pos-customer-suggestions[hidden] { display: none; }
.pos-customer-option { display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; min-height: 58px; border: 0; border-radius: 8px; background: #fff; padding: 10px 12px; cursor: pointer; color: #172b42; }
.pos-customer-option span { font-size: var(--text-small); color: #64748b; }
.pos-customer-option:hover, .pos-customer-option:focus, .pos-customer-option[aria-selected="true"] { background: #eaf8f0; outline: none; }
.pos-customer-hint { margin: 12px 0 16px; }
.pos-customer-footer { border-top: 1px solid #e5eaf0; padding-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 480px) {
  .pos-customer-picker .pos-modal-content { padding: 18px; }
  .pos-customer-actions { gap: 8px; }
  .pos-customer-actions .btn { padding-inline: 10px; font-size: var(--text-small); }
}

.pos-extra-fees { border-top: 1px solid #e3e7ee; padding-top: 12px; margin-top: 8px; }
.pos-service-fee { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(80px, 1fr) auto; align-items: end; gap: 8px; }
.pos-service-fee .pos-field { min-width: 0; margin-bottom: 0; }
.pos-service-fee .btn { min-height: 42px; }
.pos-service-fees { display: grid; gap: 12px; margin-bottom: 8px; }
.pos-service-fees > .pos-service-fee + .pos-service-fee { border-top: 1px solid #e3e7ee; padding-top: 12px; }
.pos-totals > .pos-field { display: grid; grid-template-columns: 1fr minmax(100px, 130px); align-items: center; gap: 8px; margin: 8px 0; }
.pos-totals > .pos-field input { text-align: right; }
.pos-order-board { margin-top: 18px; }
@media (max-width: 480px) { .pos-service-fee { grid-template-columns: minmax(0, 1fr) 110px; } .pos-service-fee .btn { grid-column: 1 / -1; justify-self: end; } }
.pos-basket-head .pos-customer-trigger {
  background: #168148;
  border-color: #168148;
  color: #fff;
  min-width: 170px;
  min-height: 44px;
  max-width: 70%;
  padding: 10px 20px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.pos-basket-head .pos-customer-trigger:hover { background: #116b3b; border-color: #116b3b; }
@media (max-width: 480px) {
  .pos-basket-head .pos-customer-trigger { min-width: 150px; padding-inline: 14px; }
}

/* Voucher nhập tay cho cả đơn (pos.js › drawVoucher). */
.pos-voucher { border-top: 1px solid #e3e7ee; padding-top: 12px; margin-top: 12px; }
.pos-voucher-title { font-size: var(--text-label); margin: 0 0 8px; }
/* Cột giỏ hẹp: mã voucher chiếm cả hàng; số giảm · VNĐ/% · Bỏ voucher ở hàng dưới. */
.pos-voucher-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; align-items: end; gap: 8px; }
.pos-voucher-row .pos-field { min-width: 0; margin-bottom: 0; }
.pos-voucher-row .btn { min-height: 42px; }
.pos-order-note { margin: 12px 0 4px; }
.pos-order-note textarea { min-height: 64px; resize: vertical; }
.pos-return-modal { width:min(760px,calc(100vw - 24px)); max-height:90dvh; }
.pos-return-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; }
.pos-return-head h2 { margin:0; font-size: var(--text-heading); }
.pos-return-summary { display:grid; grid-template-columns:1fr auto; gap:8px 16px; padding:16px; background:#effaf4; border-radius:12px; margin:16px 0; }
.pos-return-card { border:1px solid #dce5e0; border-radius:12px; padding:16px; margin-top:16px; }
.pos-return-card h3 { margin-top:0; }
.pos-return-actions,.pos-return-list,.pos-return-search-results { display:flex; flex-direction:column; gap:10px; }
.pos-return-actions label { margin:0; }
.pos-return-line { display:grid; grid-template-columns:1fr 1fr; align-items:end; gap:12px; margin:12px 0; }
.pos-return-card select { width:100%; min-height:40px; border:1px solid #cad6e3; border-radius:8px; background:white; padding:8px; }
.pos-return-card input[type=checkbox] { width:20px; height:20px; }
@media(max-width:600px){.pos-return-line {grid-template-columns:1fr}.pos-return-head{align-items:flex-start}.pos-return-card{padding:12px}.pos-return-modal .pos-modal-content{padding:16px}}

.pos-cod-remaining {
  padding: 12px;
  border: 1px solid #a6dfbb;
  border-radius: 8px;
  background: #e0f5e8;
  color: #14532d;
  font-weight: 700;
}

.pos-cod-modal form { padding: 0; }
.pos-cod-modal form > button { margin-right: 8px; }
.pos-cod-confirm { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.pos-cod-confirm input[type=checkbox] { width: 18px; min-width: 18px; height: 18px; min-height: 18px; flex: none; padding: 0; margin: 2px 0 0; }

/* POS touch-first layout (2026-10 mockup). */
#view-pos { padding: 0 0 90px; background: #f7f9f8; }
.pos-page { max-width: var(--app-content-max, 1800px); margin: 0 auto; color: #162238; }
.pos-head { position: sticky; top: 0; z-index: 10; min-height: 68px; margin: 0; padding: 0 20px; border: 0; border-bottom: 1px solid #bfd8c8; border-radius: 0; background: #e7f6ec; }
.pos-head > div:first-child { display: flex; grid-template-columns: none; gap: 16px; }
.pos-head h1 { font-size: var(--text-heading); font-weight: 800; }
.pos-register-name { color: #365f47; font-size: var(--text-label); }
.pos-head .pos-menu-toggle { display: none; }
.pos-head-tools { flex-wrap: nowrap; gap: 12px; }
.pos-shift-status { min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border: 1px solid #cddad2; border-radius: 22px; background: #fff; color: #526258; font-weight: 700; white-space: nowrap; }
.pos-shift-status.is-open { color: #155f37; }
.pos-close-shift { min-height: 44px !important; padding-inline: 22px !important; border: 2px solid #ad2733 !important; border-radius: 12px; background: #fff !important; color: #8f1f2a !important; font-size: var(--text-body) !important; font-weight: 800; }
.pos-more-menu { position: relative; }
.pos-more-menu > summary { list-style: none; display: grid; place-items: center; width: 48px; height: 44px; border: 1px solid #c9d5ce; border-radius: 12px; background: #fff; color: #244736; font-size: var(--text-heading); cursor: pointer; }
.pos-more-menu > summary::-webkit-details-marker { display: none; }
.pos-more-panel { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: grid; min-width: 230px; padding: 8px; border: 1px solid #d9e3dd; border-radius: 12px; background: #fff; box-shadow: 0 14px 36px #173b2926; }
.pos-more-panel .btn { justify-content: flex-start; min-height: 44px; border: 0; text-align: left; }
.pos-layout { grid-template-columns: minmax(0, 1fr) 405px; gap: 0; min-height: calc(100vh - 68px); }
.pos-card { border: 0; border-radius: 0; background: #f7f9f8; }
.pos-catalog { padding: 18px 20px 26px; }
.pos-checkout { position: sticky; top: 68px; height: calc(100vh - 68px); box-sizing: border-box; padding: 18px 18px 20px; border-left: 1px solid #dce5df; background: #fff; overflow-y: auto; }
@media (min-width: 851px) {
  .pos-checkout .pos-service-fee { grid-template-columns: 80px minmax(0, 1fr) auto; }
  .pos-checkout .pos-service-fee > .pos-field:nth-child(1) { grid-column: 1 / -1; }
  .pos-checkout .pos-service-fee > .pos-field:nth-child(3) { grid-column: 2 / -1; }
  .pos-checkout .pos-service-fee > .pos-field:nth-child(4) { grid-column: 1 / 3; }
  .pos-checkout .pos-service-fee > .btn { grid-column: 3; }
  .pos-checkout .pos-service-fee .pos-field > span { white-space: nowrap; }
  /* The desktop panel scrolls; its sections must not shrink over visible cart rows. */
  .pos-checkout > * { flex-shrink: 0; }
  .pos-checkout .pos-line-edit { grid-template-columns: auto auto minmax(0, 1fr) 65px; }
  .pos-checkout .pos-line-edit > input,
  .pos-checkout .pos-line-edit > select { width: 100%; min-width: 0; }
}
.pos-search { height: 60px; margin-bottom: 14px; }
.pos-search input { border: 2px solid #19844e; border-radius: 14px; padding: 0 18px; background: #fff; font-size: var(--text-heading); }
.pos-search .btn { min-width: 140px; border-radius: 13px; background: #16884d; border-color: #16884d; color: #fff; font-size: var(--text-body); font-weight: 800; }
.pos-product-filters { display: flex; gap: 10px; margin: 0 0 16px; overflow-x: auto; }
.pos-product-filters[hidden] { display: none; }
.pos-catalog-tools { display: flex; align-items: end; gap: 10px; margin-bottom: 8px; }
.pos-catalog-tools .pos-policy { flex: 1; min-width: 0; margin: 0; }
.pos-catalog-tools .pos-policy select { width: 100%; }
.pos-find-all { flex: none; }
.pos-filter-toggle { margin-bottom: 8px; }
.pos-filter { min-height: 42px; padding: 0 20px; border: 1px solid #bcd3c5; border-radius: 22px; background: #fff; color: #315b43; font-weight: 700; white-space: nowrap; }
.pos-filter.active { border-color: #17844d; background: #17844d; color: #fff; }
.pos-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 200px; max-height: none; gap: 14px; overflow: auto; }
.pos-product { gap: 5px; padding: 12px; border-color: #dce4df; border-radius: 16px; box-shadow: 0 2px 7px #173b2908; }
.pos-product img, .pos-product .pos-image-empty { height: 72px; flex-basis: 72px; border-radius: 10px; background: linear-gradient(135deg,#ecfaf2,#f9fffb); }
.pos-product-name { height: 40px; flex-basis: 40px; font-size: var(--text-label); font-weight: 800; }
.pos-product-sku { color: #7b8580; }
.pos-product-price-stock { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; margin-top: auto; }
.pos-mobile-cart-dock { display: none; }
.pos-product strong { margin-top: auto; font-size: var(--text-heading); }
.pos-product-price-stock .pos-product-price { margin-top: 0; white-space: nowrap; }
.pos-product-price-stock .pos-stock { margin-left: auto; text-align: right; white-space: nowrap; }
.pos-stock { color: #238251; font-weight: 650; }
.pos-stock-low { color: #b66b00; }
.pos-stock-out { color: #b22b37; font-weight: 800; }
.pos-product:disabled { opacity: .72; background: #f5f6f6; }
.pos-product[aria-pressed='true'] { border-color: #16884d; background: #e7f6ec; box-shadow: 0 0 0 2px #16884d33; }
.pos-basket-head { align-items: flex-start; flex-direction: column; padding-bottom: 12px; border-bottom: 1px solid #e7ece9; }
.pos-basket-head > div { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.pos-basket-head h2 { margin: 0; font-size: var(--text-heading); }
.pos-cart-count { color: #6c7771; font-size: var(--text-label); }
.pos-basket-head .pos-customer-trigger { width: 100%; max-width: none; min-height: 50px; justify-content: space-between; border: 1px solid #b8d7c4; border-radius: 12px; background: #f0fbf5; color: #17663c; text-align: left; }
.pos-lines { min-height: 230px; max-height: none; }
.pos-line { padding: 14px 0; }
.pos-line-top { align-items: flex-start; }
.pos-line-top b { font-size: var(--text-body); }
.pos-line-top strong { white-space: nowrap; }
.pos-line-edit { display: grid; grid-template-columns: auto auto 72px 72px; align-items: center; }
.pos-line .pos-qty { gap: 8px; }
.pos-line .pos-qty input { width: 42px; border: 0; font-size: var(--text-heading); font-weight: 800; }
.pos-line .pos-qty .btn { width: 42px; min-height: 42px; padding: 0; border-radius: 10px; font-size: var(--text-heading); }
.pos-extra-fees { font-size: var(--text-small); }
.pos-totals { margin-top: auto; border-top: 1px solid #e5ebe7; }
.pos-total-row { min-height: 30px; }
.pos-total { font-size: var(--text-heading); border-top: 0 !important; }
.pos-total strong { color: #147744; font-size: var(--text-heading); }
.pos-main-actions { display: grid; grid-template-columns: 120px 1fr; gap: 10px; margin-top: 10px; }
.pos-main-actions .btn { min-height: 64px; border-radius: 13px; font-size: var(--text-body); font-weight: 800; }
.pos-open-payment { background: #16884d !important; border-color: #16884d !important; font-size: var(--text-heading) !important; }
.pos-order-board { margin: 18px 20px; border: 1px solid #dce5df; border-radius: 16px; background: #fff; }
.pos-price-choices { display: grid; gap: 10px; margin-bottom: 18px; }
.pos-price-choices .active { border-color: #17844d; background: #eaf8f0; color: #12673a; }

/* Desktop: keep long product details in their own row so they cannot paint over fees/totals. */
@media (min-width: 851px) {
  .pos-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    min-width: 0;
  }
  .pos-line-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content 28px;
    gap: 8px;
  }
  .pos-line-top b {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .pos-line-edit {
    grid-template-columns: minmax(0, 1fr) auto minmax(52px, 64px) minmax(58px, 66px);
    min-width: 0;
  }
  .pos-line-edit > input,
  .pos-line-edit > select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .pos-line .pos-qty {
    min-width: 0;
  }
  .pos-line .pos-qty .btn {
    width: 38px;
  }
  .pos-line .pos-qty input {
    width: 36px;
  }
  .pos-extra-fees {
    position: relative;
    clear: both;
  }
}

.pos-payment-modal { width: min(760px, 94vw); border-radius: 20px; box-shadow: 0 26px 80px #10251a4d; }
.pos-payment-modal .pos-modal-content { padding: 0; }
.pos-payment-modal h2 { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 20px 72px 20px 24px; background: #e7f6ec; color: #145c35; font-size: var(--text-heading); }
.pos-payment-meta { color: #68756e; font-size: var(--text-small); font-weight: 500; }
.pos-payment-due { display: grid; justify-items: center; gap: 3px; padding: 20px 20px 16px; }
.pos-payment-due span { color: #6b746f; }
.pos-payment-due strong { color: #106e3d; font-size: var(--text-heading); line-height: 1.1; }
.pos-payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 24px 18px; }
.pos-payment-method { min-height: 96px; display: grid; place-content: center; gap: 6px; border: 2px solid #dce3df; border-radius: 14px; background: #fff; color: #17251d; }
.pos-payment-method b { font-size: var(--text-heading); }
.pos-payment-method span { color: #77817c; font-size: var(--text-caption); }
.pos-payment-method[aria-pressed='true'] { border-color: #16884d; background: #f0fbf5; color: #12683b; }
.pos-payment-cash, .pos-payment-transfer, .pos-payment-cod { padding: 0 24px 18px; }
.pos-payment-cash .pos-tender { margin: 0; }
.pos-payment-cash .pos-field, .pos-change-card { min-height: 92px; box-sizing: border-box; padding: 15px; border: 1px solid #dce3df; border-radius: 14px; }
.pos-payment-cash .pos-field input { border: 0; padding: 3px 0; font-size: var(--text-heading); font-weight: 800; }
.pos-change-card { display: grid; align-content: center; background: #f0fbf5; }
.pos-change { padding: 3px 0 0; font-size: var(--text-heading); }
.pos-cash-quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.pos-cash-quick .btn { min-height: 48px; padding: 7px; border-radius: 11px; color: #235d3e; font-weight: 750; }
.pos-payment-transfer { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: center; }
.pos-create-qr { min-height: 54px; }
.pos-transfer-confirm { display: flex; gap: 10px; align-items: center; }
.pos-transfer-confirm input { width: 22px; height: 22px; }
.pos-payment-cod { color: #5f6d65; text-align: center; }
.pos-payment-footer { display: grid; grid-template-columns: 190px 1fr; gap: 14px; padding: 18px 24px 22px; border-top: 1px solid #e1e7e3; }
.pos-payment-footer .btn { min-height: 64px; border-radius: 13px; font-size: var(--text-heading); font-weight: 800; }
.pos-payment-footer .primary { background: #16884d; border-color: #16884d; }

@media (max-width: 1200px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 380px; }
  .pos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .pos-head { position: static; padding: 10px 12px; }
  .pos-head-tools { width: 100%; justify-content: space-between; }
  .pos-shift-status { font-size: var(--text-caption); padding-inline: 10px; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-checkout { position: static; height: auto; border-left: 0; border-top: 1px solid #dce5df; }
  .pos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .pos-head > div:first-child { flex-wrap: wrap; gap: 4px 10px; }
  .pos-register-name { width: 100%; }
  .pos-catalog { padding: 12px; }
  .pos-search { height: 52px; }
  .pos-search .btn { min-width: 105px; }
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-payment-methods { grid-template-columns: 1fr; }
  .pos-cash-quick { grid-template-columns: repeat(3, 1fr); }
  .pos-payment-footer { grid-template-columns: 1fr; }
}

/* POS dùng cùng chuẩn gọn của toàn hệ thống trên điện thoại. */
@media (max-width: 850px) {
  #view-pos { font-size: var(--text-caption); }
  .pos-head { min-height: 56px; padding: 6px 10px; }
  .pos-head h1 { font-size: var(--text-body); }
  .pos-register-name, .pos-cart-count, .pos-payment-meta { font-size: var(--text-caption); }
  .pos-head-tools { gap: 6px; }
  .pos-shift-status { min-height: 36px; padding-inline: 9px; font-size: var(--text-caption); }
  .pos-close-shift { min-height: 38px !important; padding-inline: 12px !important; font-size: var(--text-caption) !important; }
  .pos-more-menu > summary { width: 40px; height: 38px; font-size: var(--text-heading); }
  .pos-more-panel .btn { min-height: 36px; font-size: var(--text-caption); }
  .pos-catalog, .pos-checkout { padding: 10px; }
  .pos-checkout { font-size: var(--text-caption); }
  .pos-search { height: 44px; margin-bottom: 9px; }
  .pos-search input { padding-inline: 10px; font-size: var(--text-small) !important; }
  .pos-search .btn { min-width: 92px; min-height: 40px; font-size: var(--text-caption); }
  .pos-product-filters { gap: 6px; margin-bottom: 10px; }
  .pos-catalog-tools { gap: 6px; margin-bottom: 6px; }
  .pos-catalog-tools .pos-policy { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px; }
  .pos-catalog-tools .pos-policy select { min-height: 36px; padding: 5px 7px; font-size: var(--text-caption) !important; }
  .pos-find-all, .pos-filter-toggle { min-height: 36px; padding-inline: 9px; font-size: var(--text-caption); }
  .pos-filter { min-height: 34px; padding-inline: 10px; font-size: var(--text-caption); }
  .pos-grid { grid-auto-rows: 164px; gap: 8px; max-height: calc(164px * 10 + 8px * 9); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .pos-product { padding: 9px; border-radius: 12px; }
  .pos-product img, .pos-product .pos-image-empty { height: 58px; flex-basis: 58px; }
  .pos-product-name { height: 34px; flex-basis: 34px; font-size: var(--text-caption); }
  .pos-product-price-stock { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; width: 100%; margin-top: auto; }
  .pos-product-price-stock strong { margin-top: 0; font-size: var(--text-label); white-space: nowrap; }
  .pos-product-price-stock .pos-stock { margin-left: auto; text-align: right; white-space: nowrap; font-size: var(--text-caption); }
  .pos-product[aria-pressed='true']::after { font-size: var(--text-caption); }
  .pos-basket-head h2 { font-size: var(--text-small); }
  .pos-basket-head .pos-customer-trigger { min-height: 38px; font-size: var(--text-caption); }
  .pos-checkout .pos-cart-count { font-size: var(--text-caption); }
  .pos-line { padding: 9px 0; }
  .pos-line-top b { font-size: var(--text-caption); line-height: 1.35; }
  .pos-line-top strong { font-size: var(--text-caption); }
  .pos-line .pos-note, .pos-line-edit .pos-note { font-size: var(--text-caption); }
  .pos-line-edit input, .pos-line-edit select { font-size: var(--text-caption) !important; }
  .pos-line .pos-qty .btn { width: 34px; min-height: 34px; font-size: var(--text-label); }
  .pos-line .pos-qty input { width: 34px; font-size: var(--text-caption) !important; }
  .pos-extra-fees { font-size: var(--text-caption); }
  .pos-totals, .pos-totals label, .pos-total-row { font-size: var(--text-caption); }
  .pos-totals input, .pos-totals select, .pos-order-note textarea { font-size: var(--text-caption) !important; }
  .pos-total { font-size: var(--text-caption); }
  .pos-total strong { font-size: var(--text-heading); }
  .pos-main-actions .btn { min-height: 42px; font-size: var(--text-caption); }
  .pos-open-payment { font-size: var(--text-caption) !important; }
  .pos-payment-modal h2 { padding: 12px 56px 12px 12px; font-size: var(--text-body); }
  .pos-modal-close { top: 8px; right: 8px; width: 36px; height: 36px; font-size: var(--text-heading); }
  .pos-payment-due { padding: 12px 12px 10px; }
  .pos-payment-due strong { font-size: var(--text-heading); }
  .pos-payment-methods { gap: 7px; padding: 0 12px 10px; }
  .pos-payment-method { min-height: 64px; padding: 6px; }
  .pos-payment-method b { font-size: var(--text-caption); }
  .pos-payment-method span { font-size: var(--text-caption); }
  .pos-payment-cash, .pos-payment-transfer, .pos-payment-cod { padding: 0 12px 10px; }
  .pos-payment-cash .pos-field, .pos-change-card { min-height: 64px; padding: 9px; }
  .pos-payment-cash .pos-field input, .pos-change { font-size: var(--text-heading) !important; }
  .pos-cash-quick { gap: 5px; margin-top: 7px; }
  .pos-cash-quick .btn, .pos-create-qr { min-height: 38px; font-size: var(--text-caption); }
  .pos-payment-footer { grid-template-columns: 120px 1fr; gap: 7px; padding: 10px 12px 12px; }
  .pos-payment-footer .btn { min-height: 44px; font-size: var(--text-caption); }
  .pos-modal .btn { min-height: 38px; font-size: var(--text-caption); }
  .pos-customer-picker h2, .pos-return-head h2 { font-size: var(--text-body); }
  .pos-customer-subtitle, .pos-customer-hint, .pos-customer-option span { font-size: var(--text-caption); }
  .pos-customer-input { min-height: 40px; padding: 7px 9px; font-size: var(--text-small) !important; }
  .pos-customer-option { min-height: 42px; padding: 7px 9px; }
  .pos-mobile-cart-dock { position: fixed; z-index: 35; left: 0; right: 0; bottom: var(--nav-h, calc(62px + env(safe-area-inset-bottom))); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; padding: 7px 10px; border-top: 1px solid #d6e1da; background: #fff; box-shadow: 0 -5px 18px #173b291c; }
  .pos-mobile-cart-info { display: grid; min-width: 0; }
  .pos-mobile-cart-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-caption); }
  .pos-mobile-cart-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #6b786f; font-size: var(--text-caption); }
  .pos-mobile-cart-dock > b { color: #155f37; font-size: var(--text-small); white-space: nowrap; }
  .pos-mobile-cart-open { min-height: 40px; padding-inline: 11px; background: #16884d !important; border-color: #16884d !important; font-size: var(--text-caption); }
}

/* Đơn nhận sau: dùng chung popup, dễ thao tác trên điện thoại. */
.pos-flow-modal{width:min(660px,calc(100vw - 24px));max-height:90dvh}
.pos-flow-head,.pos-flow-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.pos-flow-head{justify-content:space-between;margin-bottom:16px}
.pos-flow-head h2{margin:0;font-size: var(--text-heading)}.pos-flow-list{display:grid;gap:12px}
.pos-flow-card{padding:16px;margin:14px 0;border:1px solid #d9e3ed;border-radius:12px;display:grid;gap:10px}
.pos-flow-card h3{margin:0}.pos-flow-state {font-weight:700;color:#137d49}
.pos-flow-summary{display:grid;grid-template-columns:1fr auto;gap:10px;padding:14px;background:#f0faf5;border-radius:12px}
.pos-flow-summary dd{margin:0;font-weight:700;text-align:right}.pos-flow-order{display:grid;gap:6px;text-align:left;padding:14px;background:white;border:1px solid #d9e3ed;border-radius:10px;color:inherit;cursor:pointer}
.pos-flow-order:hover{background:#effaf3}.pos-flow-card input[type=checkbox]{width:20px;height:20px}
@media(max-width:560px){.pos-flow-actions>.btn{flex:1}.pos-flow-modal .pos-modal-content{padding:16px}.pos-flow-summary{font-size: var(--text-small)}}

/* Customer creation shares directory fields; keep actions separate from the grid. */
.pos-modal.pos-customer-create { width: min(760px, calc(100vw - 24px)); overflow-y: auto; }
.pos-customer-create form { padding: 12px 0 0; }
.pos-customer-create .customer-form-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 18px; }
.pos-customer-create .customer-form-fields label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pos-customer-create .customer-form-fields .span-2 { grid-column: 1 / -1; }
.pos-customer-create .customer-form-fields input,
.pos-customer-create .customer-form-fields textarea { width: 100%; box-sizing: border-box; min-height: 40px; }
.pos-customer-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
@media (max-width: 600px) {
  .pos-customer-create .customer-form-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Saved checkout: clear document identity, amount and separated next actions. */
.pos-modal.pos-saved-modal { width: min(500px, calc(100vw - 24px)); box-shadow: 0 20px 65px #122c2633; }
.pos-saved-modal .pos-modal-content { padding: 28px; }
.pos-saved-modal h2 { font-size: var(--text-heading); line-height: 1.35; padding-right: 38px; margin: 0 0 24px; color: #164e37; }
.pos-saved-summary { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; }
.pos-saved-check { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 50%; background: #e6f6ec; color: #11844d; font-size: var(--text-heading); font-weight: 700; }
.pos-saved-label { display: block; color: #64748b; font-size: var(--text-small); margin-bottom: 4px; }
.pos-saved-order { display: block; font-size: var(--text-heading); color: #172b42; overflow-wrap: anywhere; }
.pos-saved-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px; border: 1px solid #cfe9d9; border-radius: 12px; background: #f1faf5; color: #32624a; font-size: var(--text-label); }
.pos-saved-total strong { color: #087b48; font-size: var(--text-heading); white-space: nowrap; }
.pos-saved-hint { color: #64748b; font-size: var(--text-small); line-height: 1.6; margin: 16px 0 22px; }
.pos-saved-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pos-saved-actions .btn { width: 100%; box-sizing: border-box; min-height: 46px; padding: 10px 12px; font-size: var(--text-label); text-align: center; display: flex; align-items: center; justify-content: center; white-space: normal; }
.pos-saved-actions .pos-saved-next { grid-column:2; grid-row:1; background: #10854e; border-color: #10854e; }
.pos-saved-actions > a { grid-column:1 / -1; }
@media (max-width: 420px) {
  .pos-saved-modal .pos-modal-content { padding: 22px 18px; }
  .pos-saved-modal h2 { font-size: var(--text-heading); }
  .pos-saved-total { flex-direction: column; align-items: flex-start; padding: 16px; gap: 6px; }
  .pos-saved-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pos-order-filters { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:12px; margin:16px 0; align-items:end; }
.pos-order-filters label { display:flex; flex-direction:column; gap:6px; min-width:0; }
.pos-order-filters input, .pos-order-filters select { width:100%; min-width:0; box-sizing:border-box; }
.pos-order-summary { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; border-radius:12px; background:#edf8f2; border:1px solid #cce5d6; }
.pos-order-summary strong { font-size: var(--text-heading); color:#086b43; }
.pos-order-summary p { margin:4px 0 0; }
.pos-order-summary > p { flex-basis:100%; }
@media(max-width:600px) { .pos-order-filters { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Báo cáo ca: lọc + ca đang mở (xanh) / đã kết (xám) + nội dung gom theo mục. */
.pos-shift-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 4px 0 6px; }
.pos-shift-filters label { display: grid; gap: 2px; font-size: var(--text-caption); color: var(--muted, #667085); }
.pos-shift-list .pos-shift-open { background: #e7f6ec; border-color: #2e9e5b; color: #17663a; font-weight: 600; }
.pos-shift-list .pos-shift-open:hover { background: #d3efdd; }
.pos-shift-list .pos-shift-closed { background: #f2f4f7; border-color: #d0d5dd; color: #475467; }

/* Product action and stock actions are sibling buttons: stock remains usable when the item cannot be sold. */
.pos-grid { grid-auto-rows: minmax(276px, auto); }
.pos-product-tile { display:flex; flex-direction:column; min-width:0; overflow:hidden; border:1px solid #dce4df; border-radius:14px; background:white; }
.pos-product-tile > .pos-product { position:relative; flex:1; width:100%; border:0; border-radius:0; box-shadow:none; }
.pos-product-in-cart { background:#eaf8ee; }
.pos-product-selection { position:absolute; top:12px; right:12px; padding:5px 8px; border:1px solid #f2c4be; border-radius:8px; background:#fff; color:#b42318; font-weight:800; font-size:var(--text-caption); box-shadow:0 2px 6px #14233b12; }
.pos-product-selection[hidden] { display:none; }
.pos-product-stocks { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; padding:8px; border-top:1px solid #e1ebe5; }
.pos-source-stock { padding:5px 3px; border:1px solid #dce7e0; border-radius:6px; background:#f6faf7; color:#1e5e44; font-size: var(--text-caption); text-align:left; cursor:pointer; overflow-wrap:anywhere; }
.pos-source-stock:hover, .pos-source-stock:focus-visible { border-color:#087847; background:#e6f5ec; }
.pos-stock-dialog { width:min(560px,calc(100vw - 24px)); max-height:90vh; overflow:auto; }
.pos-stock-dialog .pos-field { margin-top:12px; }
.pos-stock-detail { border-bottom:1px solid #e2e9e5; padding:12px 0; }
.pos-stock-detail p { white-space:pre-wrap; margin:6px 0 0; }
.pos-stock-actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; }
.pos-stock-error { color:#b3261e; }
@media(max-width:1366px) { .pos-grid { grid-auto-rows:minmax(244px,auto); max-height:calc(244px * 10 + 8px * 9); overflow-y:auto; overscroll-behavior:contain; } .pos-product-stocks { padding:6px; } .pos-source-stock { font-size: var(--text-caption); } }

/* Các form mở sau bảng Thanh toán (Ship COD · VietQR · Đặt cọc · Ship trả trước): cùng khung với bảng Thanh toán. */
.pos-step-modal { width: min(760px, 94vw); max-height: 92dvh; padding: 0; border-radius: 20px; box-shadow: 0 26px 80px #10251a4d; }
.pos-step-modal .pos-modal-content { padding: 0; }
.pos-step-modal .pos-modal-content > h2, .pos-step-modal .pos-flow-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 20px 72px 20px 24px; background: #e7f6ec; color: #145c35; font-size: var(--text-heading); }
.pos-step-modal .pos-flow-head { padding-right: 16px; }
.pos-step-modal .pos-flow-head h2 { margin: 0; font-size: var(--text-heading); color: #145c35; }
.pos-step-modal form { display: grid; gap: 0; padding: 0; }
.pos-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; margin: 0; padding: 14px 24px 4px; }
.pos-steps li { display: flex; align-items: center; gap: 8px; color: #8a948f; font-size: var(--text-small); font-weight: 600; }
.pos-steps li b { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #d5ddd8; background: #fff; font-size: var(--text-small); }
.pos-steps li.is-current { color: #12683b; }
.pos-steps li.is-current b { border-color: #16884d; background: #16884d; color: #fff; }
.pos-steps li.is-done { color: #3f6b52; }
.pos-steps li.is-done b { border-color: #9fd3b4; background: #e7f6ec; color: #16884d; }
.pos-step-body { display: grid; gap: 14px; padding: 14px 24px 6px; }
.pos-step-intro { margin: 0; }
.pos-step-section { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid #dce3df; border-radius: 14px; background: #fff; }
.pos-step-section h3 { margin: 0; color: #2b3a31; font-size: var(--text-label); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.pos-step-section .pos-field { margin: 0; }
.pos-step-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.pos-step-summary { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: #f3f8f5; }
.pos-step-summary > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: #4f5d55; }
.pos-step-summary > .is-main { padding-top: 6px; border-top: 1px dashed #c9d8cf; color: #145c35; font-weight: 700; }
.pos-step-summary > .is-main strong { font-size: var(--text-heading); color: #106e3d; }
.pos-step-due { display: grid; justify-items: center; gap: 3px; padding: 18px 20px 6px; }
.pos-step-due span { color: #6b746f; }
.pos-step-due strong { color: #106e3d; font-size: var(--text-heading); line-height: 1.1; }
.pos-step-review .pos-step-due { padding-top: 4px; }
.pos-review-list { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; padding: 14px 16px; border: 1px solid #dce3df; border-radius: 14px; }
.pos-review-list dt { color: #6b746f; }
.pos-review-list dd { margin: 0; font-weight: 600; color: #17251d; overflow-wrap: anywhere; }
.pos-step-footer { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 14px; margin-top: 12px; padding: 16px 24px 20px; border-top: 1px solid #e1e7e3; background: #fff; }
.pos-step-footer:has(> :only-child) { grid-template-columns: 1fr; }
.pos-step-footer .btn { min-height: 60px; margin: 0; border-radius: 13px; font-size: var(--text-body); font-weight: 800; }
.pos-step-footer .primary { background: #16884d; border-color: #16884d; }
.pos-step-modal .error:empty, .pos-step-modal .pos-warning:empty { display: none; }
.pos-step-modal .error { margin: 0 24px; }
.pos-qr-info { display: grid; justify-items: center; gap: 8px; padding: 6px 24px 4px; text-align: center; }
.pos-qr-modal .pos-qr { width: min(280px, 70vw); height: auto; border: 1px solid #dce3df; border-radius: 14px; padding: 8px; background: #fff; }
.pos-qr-content { margin: 0; font-weight: 700; }
.pos-qr-status { margin: 0; padding: 6px 12px; border-radius: 999px; font-size: var(--text-small); font-weight: 700; }
.pos-qr-status.is-waiting { background: #fff6e0; color: #8a5a00; }
.pos-qr-status.is-paid { background: #e7f6ec; color: #12683b; }
/* Trạng thái đang xử lý: nút chính hiện vòng quay + chữ "Đang…", cả form mờ và không bấm được. */
.btn.is-busy { position: relative; cursor: progress; opacity: 1 !important; }
.btn.is-busy::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 10px; vertical-align: -3px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pos-spin .7s linear infinite; }
.pos-modal-busy .pos-step-body, .pos-modal-busy .pos-payment-methods { opacity: .6; pointer-events: none; }
.pos-modal-busy { cursor: progress; }
@keyframes pos-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .pos-step-modal { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .pos-step-modal .pos-modal-content > h2, .pos-step-modal .pos-flow-head { padding: 12px 56px 12px 14px; font-size: var(--text-body); }
  .pos-step-modal .pos-flow-head { padding-right: 10px; }
  .pos-steps { padding: 10px 12px 2px; gap: 4px; }
  .pos-steps li { font-size: var(--text-caption); gap: 5px; }
  .pos-steps li b { width: 22px; height: 22px; font-size: var(--text-caption); }
  .pos-step-body { padding: 10px 12px 4px; gap: 10px; }
  .pos-step-section { padding: 12px; }
  .pos-step-due strong { font-size: var(--text-heading); }
  .pos-review-list { grid-template-columns: 1fr; gap: 2px; }
  .pos-review-list dd { margin-bottom: 8px; }
  .pos-step-footer { grid-template-columns: 1fr 1.6fr; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .pos-step-footer .btn { min-height: 48px; font-size: var(--text-small); }
}
.pos-step-summary .pos-cod-remaining { padding: 0; border: 0; background: none; }
.pos-step-modal .pos-cod-confirm { margin: 0; }
.pos-step-modal .pos-cod-confirm input[type=checkbox] { width: 18px; min-height: 18px; }
.pos-step-modal .pos-step-error { margin: 10px 24px 0; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: #a12a1b; font-weight: 700; }
.pos-step-modal .pos-step-error:empty { display: none; }
@media (max-width: 600px) { .pos-step-modal .pos-step-error { margin: 8px 12px 0; } }
/* Điện thoại: nút thao tác tối thiểu 44px để bấm chính xác bằng ngón tay. */
@media (max-width: 850px) {
  .pos-more-panel .btn { min-height: 44px; font-size: var(--text-caption); }
  .pos-payment-modal .pos-cash-quick .btn, .pos-payment-modal .pos-create-qr { min-height: 44px; font-size: var(--text-caption); }
}
.pos-ghn-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #e1e7f0; }
.pos-ghn-bar small { flex: 1 1 200px; }

/* Thẻ "Đơn web" ở bảng đơn cửa hàng: có đơn website cần xử lý thì số đỏ nhấp nháy (pos.js › renderOrderBoard). */
.pos-order-count.has-alert { border-color: #f1b5b5; }
.pos-order-count .pos-web-badge { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; background: #d92d20; color: #fff; animation: pos-web-blink 1.1s ease-in-out infinite; }
@keyframes pos-web-blink { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(217, 45, 32, .55); } 50% { opacity: .55; box-shadow: 0 0 0 7px rgba(217, 45, 32, 0); } }
@media (prefers-reduced-motion: reduce) { .pos-order-count .pos-web-badge { animation: none; } }

/* Nút cuối biểu mẫu POS: một hàng, cách đều, nút chính bên phải; điện thoại chia đôi bề ngang. */
.pos-form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid #e5eaf0; }
.pos-form-actions .btn { min-height: 44px; margin: 0; }
@media (max-width: 480px) { .pos-form-actions .btn { flex: 1 1 calc(50% - 10px); } }
.pos-payment-cash .pos-field input { border-bottom: 2px dashed #b9d8c6; border-radius: 0; }
.pos-payment-cash .pos-field input:focus { border-bottom-color: #16884d; outline: none; }
/* Nút × bỏ dòng phí / bỏ giảm giá: cao bằng ô nhập. */
.pos-row-remove { width: 36px; height: 42px; align-self: end; }

/* Keep catalog controls in their own flowing block; the product grid owns its capped scrolling at every breakpoint. */
.pos-catalog { display: flex; flex-direction: column; align-self: start; }
.pos-catalog-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 12px; min-width: 0; flex: none; }
.pos-catalog-controls .pos-search { height: auto; min-height: 44px; margin: 0; }
.pos-catalog-controls .pos-scan-status { grid-column: 1 / -1; margin: 0; font-size: var(--text-small); color: #126b4b; overflow-wrap: anywhere; }
.pos-catalog-controls .pos-search [aria-busy="true"] { background: #f0f8f4; }
.pos-catalog-controls .pos-catalog-tools { flex-wrap: wrap; margin: 0; }
.pos-catalog-controls .pos-policy { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 160px; gap: 4px; padding: 0; border: 0; }
.pos-catalog-controls .pos-policy select { width: 100%; max-width: none; min-width: 0; }
.pos-catalog-controls .pos-filter-toggle { justify-self: start; margin: 0; }
.pos-catalog-controls .pos-product-filters { flex-wrap: wrap; overflow: visible; margin: 0; }
.pos-catalog > .pos-grid, .pos-catalog > .btn { flex: none; }
.pos-catalog-pages { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 10px; flex: none; }

/* Reserve the loaded grid height while its first catalog page is pending. */
@media (max-width: 850px) {
  .pos-catalog > .pos-grid:empty { min-height: min(48vh, 420px); min-height: min(48svh, 420px); }
}

/* Mobile: a short product viewport, with page scrolling continuing to the customer/cart. */
@media (max-width: 850px) {
  .pos-catalog > .pos-grid {
    min-height: 0;
    max-height: min(48vh, 420px);
    max-height: min(48svh, 420px);
    overflow-y: auto;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
  }
}

/* Stock sources stay available on demand; give product photography the main space. */
.pos-product-stock-details { flex: none; border-top: 1px solid #e1ebe5; }
.pos-product-stock-details > summary { padding: 7px 10px; cursor: pointer; color: #276047; font-size: var(--text-caption); list-style: none; }
.pos-product-stock-details > summary::-webkit-details-marker { display: none; }
.pos-product-stock-details > summary::before { content: '▸'; display: inline-block; margin-right: 6px; }
.pos-product-stock-details[open] > summary::before { transform: rotate(90deg); }
.pos-product-stock-details > summary:focus-visible { outline: 2px solid #168454; outline-offset: -2px; }
.pos-product-stock-details .pos-product-stocks { border-top: 0; }
.pos-product-tile > .pos-product img, .pos-product-tile > .pos-product .pos-image-empty { height: clamp(108px, 10vw, 160px); flex-basis: clamp(108px, 10vw, 160px); object-fit: contain; }

/* Desktop only: search, scan, policy and full-catalog search share one row. */
@media (min-width: 851px) {
  .pos-catalog-controls { grid-template-columns: minmax(0, 1fr) minmax(290px, .85fr); align-items: center; }
  .pos-catalog-controls .pos-search { min-width: 0; }
  .pos-catalog-controls .pos-search input { width: 0; min-width: 0; flex: 1; }
  .pos-catalog-controls .pos-search .btn { min-width: 88px; padding-inline: 10px; }
  .pos-catalog-controls .pos-catalog-tools { min-width: 0; flex-wrap: nowrap; }
  .pos-catalog-controls .pos-policy { min-width: 0; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .pos-catalog-controls .pos-policy > span { white-space: nowrap; }
  .pos-catalog-controls .pos-find-all { flex: none; white-space: nowrap; padding-inline: 10px; }
  .pos-catalog-controls .pos-filter-toggle, .pos-catalog-controls .pos-product-filters { grid-column: 1 / -1; }
}
@media (min-width: 851px) and (max-width: 1279px) {
  .pos-catalog-controls .pos-policy { grid-template-columns: minmax(0, 1fr); }
  .pos-catalog-controls .pos-policy > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

@media (min-width: 851px) and (max-width: 1099px) {
  .pos-catalog-controls { grid-template-columns: minmax(0, 1fr) minmax(230px, .85fr); }
  .pos-catalog-controls .pos-search .btn { min-width: 64px; padding-inline: 6px; }
}

/* Leave room for the close control even when the order reference wraps. */
.pos-web-order-modal h2 { padding-right: 44px; overflow-wrap: anywhere; }

/* Giỏ "Đơn hiện tại" gọn (24/10/2026): mỗi món 2 dòng – tên (tối đa 2 dòng, chữ nhỏ) + giá, rồi số lượng + giảm giá; bớt khoảng trống. */
.pos-checkout .pos-lines { min-height: 0; }
.pos-checkout .pos-line { padding: 6px 0; gap: 4px; }
.pos-checkout .pos-line-top { align-items: start; gap: 6px; }
.pos-checkout .pos-line-top b.pos-line-name { font-size: var(--text-caption); line-height: 1.3; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-checkout .pos-line-sku { font-weight: 500; color: #7b8580; }
.pos-checkout .pos-line-top strong { font-size: var(--text-caption); line-height: 1.3; }
.pos-checkout .pos-line-top .btn { min-height: 20px; padding: 0 4px; }
.pos-checkout .pos-line-edit { margin-top: 0; gap: 6px; }
.pos-checkout .pos-line-edit { grid-template-columns: auto minmax(44px,56px) 54px minmax(0,1fr); }
.pos-checkout .pos-line-edit[data-discount-type="amount"] { grid-template-columns: auto minmax(64px,90px) 68px minmax(0,1fr); }
.pos-checkout .pos-line-edit > input { appearance: textfield; -moz-appearance: textfield; }
.pos-checkout .pos-line-edit > input::-webkit-inner-spin-button, .pos-checkout .pos-line-edit > input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pos-checkout .pos-line-unit-after { display: grid; min-width: 0; text-align: right; gap: 2px; }
.pos-checkout .pos-line-unit-value { font-size: var(--text-caption); overflow-wrap: anywhere; line-height: 1.3; }
.pos-checkout .pos-line-edit .pos-note { font-size: var(--text-caption); }
.pos-checkout .pos-line .pos-qty { gap: 4px; }
.pos-checkout .pos-line .pos-qty .btn { width: 30px; min-height: 30px; height: 30px; border-radius: 8px; font-size: var(--text-label); }
.pos-checkout .pos-line .pos-qty input { width: 32px; height: 30px; padding: 0; font-size: var(--text-label) !important; }
.pos-checkout .pos-line-edit > input, .pos-checkout .pos-line-edit > select { width: 100%; min-width: 0; box-sizing: border-box; height: 30px; min-height: 30px; padding: 2px 6px; font-size: var(--text-caption) !important; }
@media(max-width:360px) {
 .pos-checkout .pos-line-edit[data-discount-type="amount"] { grid-template-columns: auto minmax(64px,1fr) 68px; }
 .pos-checkout .pos-line-edit[data-discount-type="amount"] .pos-line-unit-after { grid-column: 1/-1; }
}

/* Mobile POS spacing: keep every shift control visible and use content-sized product cards. */
@media (max-width: 850px) {
  #view-pos .pos-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 8px 10px; }
  #view-pos .pos-head > div:first-child { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; min-width: 0; }
  #view-pos .pos-register-name { grid-column: 1 / -1; width: auto; overflow-wrap: anywhere; }
  #view-pos .pos-head-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; gap: 6px; width: 100%; min-width: 0; }
  #view-pos .pos-shift-status { grid-column: 1 / -1; justify-content: center; min-height: 32px; padding: 5px 8px; white-space: normal; box-sizing: border-box; }
  #view-pos .pos-head-tools > select { width: 100%; max-width: none; min-width: 0; height: 38px; box-sizing: border-box; }
  #view-pos .pos-close-shift { grid-column: 2; height: 38px; margin: 0; }
  #view-pos .pos-more-menu { grid-column: 3; justify-self: end; }
  #view-pos .pos-head-tools > .btn.primary { grid-column: 1 / 3; }
  #view-pos .pos-catalog-controls .pos-catalog-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; }
  #view-pos .pos-catalog-controls .pos-policy { min-width: 0; width: 100%; }
  #view-pos .pos-catalog-controls .pos-policy select,
  #view-pos .pos-catalog-controls .pos-find-all { width: 100%; height: 40px; min-height: 40px; margin: 0; padding: 6px 8px; box-sizing: border-box; }
  #view-pos .pos-catalog > .pos-grid { grid-auto-rows: max-content; align-items: start; }
  #view-pos .pos-product-tile > .pos-product { flex: none; min-height: 0; gap: 4px; padding: 8px; }
  #view-pos .pos-product-tile > .pos-product img,
  #view-pos .pos-product-tile > .pos-product .pos-image-empty { height: 104px; flex-basis: 104px; }
  #view-pos .pos-product-name { height: 32px; min-height: 32px; flex-basis: 32px; line-height: 16px; }
  #view-pos .pos-product-price-stock { margin-top: 4px; line-height: 20px; }
  #view-pos .pos-product-stock-details > summary { padding: 6px 8px; }
  #view-pos .pos-order-counts { gap: 6px; margin: 8px 0; }
  #view-pos .pos-order-count { flex-direction: row; align-items: center; gap: 6px; min-height: 42px; padding: 6px 8px; box-sizing: border-box; }
  #view-pos .pos-order-count strong { flex: none; font-size: 18px; line-height: 1.2; }
  #view-pos .pos-order-count > span { min-width: 0; font-size: 12px; line-height: 1.25; }
  #view-pos .pos-order-count .pos-web-badge { min-width: 24px; height: 24px; padding: 0 5px; box-sizing: border-box; }
}

/* Persisted POS order: product replacement stays within the amendment dialog. */
.pos-order-edit-modal .pos-edit-product-search { display:flex;gap:8px;margin:10px 0; }
.pos-order-edit-modal .pos-edit-product-search input { flex:1;min-width:0; }
.pos-order-edit-modal .pos-edit-product-results { display:grid;gap:6px;max-height:240px;overflow:auto;margin-bottom:12px; }
.pos-order-edit-modal .pos-edit-product-choice { display:grid;gap:4px;text-align:left;border:1px solid var(--line);border-radius:8px;background:var(--surface,#fff);padding:10px;cursor:pointer;color:inherit; }
.pos-order-edit-modal .pos-edit-product-choice:hover { background:var(--surface-2,#f3f6fa); }
.pos-order-edit-modal small { display:block;font-size:12px;color:var(--muted); }
.pos-order-edit-modal .pos-edit-lines { overflow-x:auto;max-width:100%;margin-bottom:12px; }
.pos-order-edit-modal table { min-width:720px; }
.pos-order-edit-modal th,.pos-order-edit-modal td { padding:6px;vertical-align:top; }
.pos-order-edit-modal th:first-child { width:36%; }
.pos-order-edit-modal td input { width:100%;min-width:80px; }
.pos-order-edit-modal td select { min-width:92px; }
.pos-order-edit-modal td:last-child { width:40px; }

@media screen and (max-width:600px) {
  .pos-order-edit-modal .pos-edit-lines table,.pos-order-edit-modal .pos-edit-lines tbody { display:block;min-width:0;width:100%; }
  .pos-order-edit-modal .pos-edit-lines thead { display:none; }
  .pos-order-edit-modal .pos-edit-lines tr { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;position:relative;border:1px solid var(--line);border-radius:10px;padding:10px;margin:8px 0; }
  .pos-order-edit-modal .pos-edit-lines td { display:block;min-width:0;padding:0; }
  .pos-order-edit-modal .pos-edit-lines td:first-child { grid-column:1/-1;padding-right:36px;overflow-wrap:anywhere; }
  .pos-order-edit-modal .pos-edit-lines td[data-label]::before { content:attr(data-label);display:block;font-size:12px;color:var(--muted);margin-bottom:4px; }
  .pos-order-edit-modal .pos-edit-lines td input,.pos-order-edit-modal .pos-edit-lines td select { width:100%;min-width:0; }
  .pos-order-edit-modal .pos-edit-lines td:last-child:not(:first-child) { position:absolute;top:6px;right:6px;width:auto; }
}

/* Ô tìm / quét kiểu app bán hàng (style.css .scan-field) thay ô viền xanh + nút "Quét mã" xanh. */
.pos-search.scan-field { height: auto; min-height: 56px; gap: 0; margin-bottom: 14px; }
.pos-search.scan-field input { font-size: var(--text-body) !important; height: 54px; }
@media (max-width: 850px) { .pos-search.scan-field { min-height: 48px; margin-bottom: 9px; } .pos-search.scan-field input { height: 46px; } }

.pos-cancellation-kpis {display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;margin:14px 0;}
.pos-cancellation-kpis > div {display:grid;gap:4px;padding:12px;border:1px solid var(--border,#dbe3ef);border-radius:10px;}
.pos-cancellation-kpis strong {font-size:1.3rem;}

.pos-cancellation-modal h2 {padding-right:32px;overflow-wrap:anywhere;}
.pos-cancellation-modal .data-table td:first-child {white-space:normal;overflow-wrap:anywhere;}

.pos-ad-risk {padding:12px;border:1px solid #cbd5e1;border-radius:10px;margin:12px 0;background:#f8fafc;}
.pos-ad-risk.improve {border-color:#d97706;background:#fffbeb;color:#78350f;}
.pos-ad-risk.budget {border-color:#dc2626;background:#fef2f2;color:#991b1b;}
.pos-ad-risk p {margin:6px 0;overflow-wrap:anywhere;}

/* Stock readiness / refresh labels must not collide with the price on narrow tiles. */
#view-pos .pos-product-price-stock { flex-wrap:wrap; }
#view-pos .pos-product-price-stock .pos-stock { white-space:normal;max-width:100%;overflow-wrap:anywhere; }
.pos-stock-stamp { margin:4px 0 8px; }

.pos-stock-unknown { color:#64748b;font-weight:500; }

/* Order filters respond immediately; product selection and checkout stay usable. */
.pos-order-feedback { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:9px 12px; margin:8px 0; border-radius:8px; background:#eff6ff; color:#174a86; font-size:13px; }
.pos-order-feedback[hidden] { display:none; }
.pos-order-count { position:relative; }
.pos-order-count[aria-busy="true"] { padding-right:29px; border-color:#1c65d1; background:#eff6ff; cursor:wait; opacity:1; }
.pos-order-count[aria-busy="true"]::after { content:''; position:absolute; right:10px; top:12px; width:12px; height:12px; border:2px solid #bdd3f2; border-top-color:#1c65d1; border-radius:50%; animation:pos-order-loading .7s linear infinite; }
.pos-order-board[aria-busy="true"] .pos-order-list { opacity:.45; pointer-events:none; }
@keyframes pos-order-loading { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .pos-order-count[aria-busy="true"]::after { animation:none; } }
/* Override generic busy-container blocking: the search field must stay interactive. */
#view-pos .pos-order-board[aria-busy="true"] { opacity:1; pointer-events:auto; }

/* QR printing is separate from receipt/payment confirmation. */
.pos-qr-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pos-qr-footer > .primary { grid-column: 1 / -1; }
.pos-qr-footer .btn { white-space: normal; }
.pos-promotion{padding:12px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}.pos-promotion p{margin:6px 0}.pos-promotion-head,.pos-promotion-actions{display:flex;align-items:center;justify-content:space-between;gap:8px}.pos-promotion-dialog{width:min(540px,calc(100vw - 24px));max-height:90dvh;overflow:auto}.pos-promotion-dialog form{display:grid;gap:12px;padding:16px}.pos-promotion-fields{display:grid;gap:10px}.pos-promotion-dialog input{max-width:100%}
.pos-bill-link { border:0;background:none;padding:0;font:inherit;font-weight:700;color:#1d4ed8;text-decoration:underline;text-underline-offset:3px;cursor:pointer; }
.pos-bill-link:hover { color:#1e3a8a; }
.pos-bill-preview { width:min(760px,calc(100vw - 16px)); }
.pos-bill-info { display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;margin:12px 0;font-size:14px; }
.pos-bill-info dt { color:var(--muted,#64748b); }
.pos-bill-info dd { margin:0;overflow-wrap:anywhere; }
.pos-bill-lines-wrap { overflow-x:auto; }
.pos-bill-lines { width:100%;border-collapse:collapse;font-size:14px; }
.pos-bill-lines th,.pos-bill-lines td { padding:8px 6px;border-bottom:1px solid #e2e8f0;text-align:left;vertical-align:top; }
.pos-bill-lines td.num,.pos-bill-lines th:nth-child(n+2) { text-align:right;white-space:nowrap; }
.pos-bill-lines td strong,.pos-bill-lines td span { display:block; }
.pos-bill-lines td span { color:var(--muted,#64748b);font-size:13px; }
@media (max-width:600px){ .pos-bill-info { grid-template-columns:1fr; gap:2px; } .pos-bill-info dd { margin-bottom:6px; }
 .pos-bill-lines thead { display:none; } .pos-bill-lines,.pos-bill-lines tbody { display:block; }
 .pos-bill-lines tr { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px;padding:10px 0;border-bottom:1px solid #e2e8f0; }
 .pos-bill-lines td { border:0;padding:0; } .pos-bill-lines td:first-child { grid-column:1/-1; }
 .pos-bill-lines td.num { text-align:left; } .pos-bill-lines td.num::before { content:attr(data-label);display:block;font-size:12px;color:var(--muted,#64748b); } }
.pos-scan-actions { display:flex;flex-wrap:wrap;gap:10px;margin-top:12px; }
.pos-scan-actions .btn { flex:1 1 140px;min-height:44px; }

.pos-contact-warning { display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:12px;border:1px solid #edb354;background:#fff7e5;color:#754700;border-radius:10px; }
.pos-contact-warning[hidden] { display:none; }
.pos-order-row.pos-order-overdue { border-color:#dc930e;background:#fffbef; }
.pos-order-contact-note { color:#875400;font-weight:600; }
.pos-contact-reminder { width:min(1000px,calc(100vw - 28px));max-height:calc(100dvh - 40px); }
.pos-contact-reminder .modal-body { max-height:calc(80dvh - 150px);overflow:auto; }
.pos-contact-reminder-row { padding:12px 0;border-bottom:1px solid var(--line,#dce4ee);overflow-wrap:anywhere; }
.pos-contact-reminder-actions { display:flex;gap:8px;flex-wrap:wrap; }
.pos-contact-reminder .modal-foot { display:flex;justify-content:flex-end; }
@media(max-width:850px) { .pos-contact-reminder-actions .btn { flex:1;min-width:100px;min-height:44px; } }

.pos-qr-send{grid-column:1/-1}.pos-qr-share{padding:0 16px}.pos-qr-share select{width:100%;margin-bottom:8px}.pos-modal.pos-qr-phone{box-sizing:border-box;margin:auto;max-width:calc(100vw - 24px);width:min(460px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;text-align:center;padding:20px;border:0;border-radius:18px}.pos-qr-phone::backdrop{background:rgba(15,30,50,.55)}.pos-qr-phone-amount{display:block;font-size:30px;color:#087944;margin:12px}.pos-qr-phone .pos-qr{max-width:100%;width:300px}.pos-qr-phone p{overflow-wrap:anywhere}

/* POS Mẫu 4 B1: desktop scan workspace. Mobile keeps the existing checkout modal. */
.pos-line-index,.pos-line-code,.pos-line-price{display:none}
@media(min-width:851px){
 #view-pos:has(.pos-workspace){padding:0;overflow:hidden}
 .pos-workspace{display:flex;flex-direction:column;min-height:550px;max-width:none;overflow:hidden}
 .pos-workspace .pos-head{position:static;flex:0 0 auto;min-height:62px;padding:6px 12px;gap:8px}
 .pos-workspace .pos-head h1,.pos-workspace .pos-head .pos-register-name,.pos-workspace .pos-shift-status{font-size:12px}
 .pos-workspace .pos-head>div:first-child{gap:8px;min-width:0;flex-wrap:wrap}
 .pos-workspace .pos-head-tools{gap:6px;flex-wrap:wrap;justify-content:flex-end}
 .pos-workspace .pos-head .btn{min-height:34px;padding:6px 8px;font-size:12px}
 .pos-workspace-modes{display:flex;gap:4px}.pos-workspace-modes button[aria-pressed=true]{background:#143b2a;color:white}.pos-cashier,.pos-current-order{font-size:12px;white-space:nowrap}
 .pos-workspace .pos-layout{flex:1;min-height:0;overflow:hidden;grid-template-columns:minmax(0,1fr) 395px}
 .pos-workspace .pos-catalog{padding:10px 12px;display:flex;flex-direction:column;min-height:0;overflow:hidden;gap:6px}
 .pos-workspace .pos-catalog-tools,.pos-workspace .pos-product-filters,.pos-workspace .pos-filter-toggle,.pos-workspace .pos-find-all{display:none}
 .pos-workspace .pos-checkout{position:static;top:auto;height:auto;padding:10px 12px;display:flex;flex-direction:column;overflow:auto;min-height:0;gap:8px}
 .pos-workspace-search{display:flex;gap:8px;align-items:center;flex:none}.pos-workspace-search .pos-search{flex:1;min-width:0;margin:0;height:50px}.pos-workspace-search .pos-search input{font-size:18px}.pos-workspace-search .scan-field-btn{min-width:48px;width:48px}.pos-scan-quantity{max-width:155px;font-size:12px;min-height:46px}
 .pos-workspace .pos-grid{max-height:160px;flex:none;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));overflow:auto}.pos-workspace .pos-grid[hidden]{display:none}
 .pos-workspace .pos-grid img,.pos-workspace .pos-image-empty{display:none}
 .pos-workspace-quick{font-size:12px;flex:none}.pos-workspace-quick-items{display:flex;gap:6px;overflow:auto;padding:4px 0}.pos-workspace-quick-items button{white-space:nowrap;max-width:220px;overflow:hidden;text-overflow:ellipsis}
 .pos-workspace-cart{flex:1;min-height:90px;display:flex;flex-direction:column;border:1px solid #dce5df;border-radius:8px;overflow:hidden}
 .pos-workspace .pos-lines{flex:1;min-height:0;max-height:none!important;overflow:auto;padding:0;margin:0}
 .pos-cart-table-head,.pos-workspace .pos-line{display:grid;grid-template-columns:22px 75px minmax(100px,1fr) 115px 87px 116px 95px 28px;gap:6px;align-items:center;font-size:12px}
 .pos-cart-table-head{background:#e7eeea;padding:9px 6px;flex:none}.pos-cart-table-head[hidden]{display:none}
 .pos-workspace .pos-line{padding:7px 6px;min-height:62px;border-bottom:1px solid #dce5df;margin:0;border-radius:0;background:white}
 .pos-workspace .pos-line[aria-selected=true]{background:#eef7f1;box-shadow:inset 3px 0 #17804c}
 .pos-workspace .pos-line-top,.pos-workspace .pos-line-edit{display:contents}
 .pos-workspace .pos-line-index{display:block;grid-column:1;grid-row:1}.pos-workspace .pos-line-code{display:block;grid-column:2;grid-row:1;overflow-wrap:anywhere}.pos-workspace .pos-line-name{grid-column:3;grid-row:1;overflow-wrap:anywhere;font-size:12px}.pos-workspace .pos-line-name>.pos-line-sku{display:none}
 .pos-workspace .pos-qty{grid-column:4;grid-row:1;grid-template-columns:25px minmax(0,1fr) 25px;gap:2px}.pos-workspace .pos-qty input{width:100%;min-width:0;padding:4px;font-size:12px}.pos-workspace .pos-qty .btn{min-width:0;min-height:30px;padding:2px}
 .pos-workspace .pos-line-price{display:block;grid-column:5;grid-row:1;text-align:right}.pos-workspace .pos-line-discount{display:flex;grid-column:6;grid-row:1;gap:3px;min-width:0}.pos-workspace .pos-line-discount input{width:58px;min-width:0;padding:5px;font-size:12px}.pos-workspace .pos-line-discount select{width:54px;min-width:0;padding:3px;font-size:11px}
 .pos-workspace .pos-line-top>strong{grid-column:7;grid-row:1;text-align:right;font-size:12px}.pos-workspace .pos-line-top>button{grid-column:8;grid-row:1;padding:2px;width:28px;min-width:0}
 .pos-workspace .pos-line-unit-after{display:none}.pos-workspace .pos-row-warning{color:#a45113}.pos-workspace .pos-row-promotion{color:#137944}
 .pos-workspace .pos-order-note{flex:none;margin:0}.pos-workspace .pos-order-note textarea{min-height:42px;height:42px;font-size:12px}
 .pos-workspace .pos-totals{margin:0;padding:0;gap:3px;flex:none}.pos-workspace .pos-total{display:none}.pos-workspace .pos-total-row{font-size:12px}
 .pos-workspace .pos-workspace-extras{border:1px solid #dce5df;padding:6px;border-radius:6px;font-size:12px}.pos-workspace .pos-workspace-extras summary{cursor:pointer}.pos-workspace .pos-extra-fees{margin:0;padding:0}.pos-workspace .pos-promotion{padding:4px}
 .pos-pc-due{background:#edf7f1;border-radius:8px;padding:10px;text-align:right}.pos-pc-due span{display:block;font-size:12px;font-weight:700}.pos-pc-due strong{display:block;font-size:32px;color:#126337;line-height:1.15}
 .pos-workspace .pos-payment-methods{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin:0}.pos-workspace .pos-payment-method{padding:6px;min-height:45px;font-size:12px}.pos-workspace .pos-payment-method span{font-size:10px}
 .pos-workspace .pos-payment-cash,.pos-workspace .pos-payment-transfer,.pos-workspace .pos-payment-cod{padding:0;margin:0;flex:none}.pos-workspace .pos-payment-cash[hidden],.pos-workspace .pos-payment-transfer[hidden],.pos-workspace .pos-payment-cod[hidden]{display:none}
 .pos-workspace .pos-tender{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:0}.pos-workspace .pos-tender input{font-size:17px;min-height:40px}.pos-workspace .pos-change-card{padding:6px;font-size:12px}.pos-workspace .pos-cash-quick{gap:4px;margin:6px 0}.pos-workspace .pos-cash-quick .btn{min-height:30px;padding:4px;font-size:12px}
 .pos-workspace .pos-payment-footer{position:sticky;bottom:-10px;margin-top:auto;background:white;padding:9px 0;display:grid;grid-template-columns:105px minmax(0,1fr);gap:6px;z-index:3}.pos-workspace .pos-payment-footer .btn{min-height:45px;padding:6px;font-size:13px}
 .pos-workspace .pos-pc-qr{font-size:11px;overflow-wrap:anywhere;text-align:center}.pos-pc-qr-image{width:150px;max-width:100%;height:150px;object-fit:contain}.pos-workspace .pos-transfer-confirm{font-size:11px}
 .pos-keyboard-bar{padding:5px 12px;background:#e7eeea;color:#345342;font-size:11px;flex:none}.pos-workspace .pos-mobile-cart-dock{display:none}.pos-workspace .pos-draft-warning:empty{display:none}
 .pos-workspace>.pos-order-board:not([hidden]){position:absolute;inset:75px 15px 35px;z-index:15;background:white;overflow:auto;border:1px solid #b7caba;padding:14px;box-shadow:0 10px 50px #163a2b33}
 .pos-workspace .pos-draft-warning{margin:0;padding:6px;font-size:12px}
}
@media(min-width:851px){
 .pos-workspace .pos-layout{align-items:stretch}
 .pos-workspace .pos-checkout>.pos-checkout-scroll{flex:1 1 0;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:8px}
 .pos-workspace .pos-checkout>.pos-payment-footer{position:static;flex:0 0 auto;margin:0;padding:6px 0 0}
 .pos-workspace .pos-payment-method>b{font-size:13px;white-space:nowrap;line-height:1.3}
 .pos-workspace .pos-payment-method>span{font-size:10px;line-height:1.2}
 .pos-workspace .pos-payment-methods{padding:0;gap:5px}
 .pos-workspace .pos-payment-method{min-height:48px;height:auto;margin:0}
 .pos-workspace .pos-payment-cash{border:0;padding:0}
 .pos-workspace .pos-tender{margin:0;padding:0}
 .pos-workspace .pos-tender .pos-field{padding:6px;margin:0}
}
@media(min-width:851px){.pos-workspace .pos-checkout,.pos-workspace .pos-catalog{align-self:stretch}}
@media(min-width:851px){.pos-workspace .pos-gift-line{background:#f0f8ec}.pos-workspace .pos-gift-total{grid-column:7;grid-row:1;text-align:right}.pos-workspace .pos-gift-line .pos-qty{display:block;text-align:center}}
@media(min-width:851px){.pos-workspace-quick-items button{flex:0 0 auto;max-width:180px;justify-content:flex-start}.pos-quick-label{display:block;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}}

/* Compact search results in scan mode: horizontal cards, two complete rows. */
@media (min-width:851px) {
 #view-pos .pos-workspace.pos-mode-scan .pos-catalog > .pos-grid {
  grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
  grid-auto-rows:minmax(88px,max-content);
  align-content:start;align-items:start;gap:8px;padding:4px;
  box-sizing:border-box;max-height:192px;overflow-y:auto;overflow-x:hidden;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-tile {
  min-height:88px;border-radius:6px;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product {
  display:grid;grid-template-columns:44px minmax(0,1fr);grid-template-rows:28px 18px;
  align-content:center;align-items:center;gap:2px 8px;
  box-sizing:border-box;flex:none;height:68px;min-height:0;width:100%;padding:6px;
  text-align:left;overflow:hidden;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product img,
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-image-empty {
  display:block;grid-column:1;grid-row:1/3;
  width:44px;height:44px;min-height:0;flex-basis:auto;object-fit:contain;
  margin:0;border-radius:4px;background:#f1f5f9;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-image-empty {
  display:grid;place-items:center;font-size:9px;color:#64748b;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-name {
  grid-column:2;grid-row:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  height:28px;min-height:0;max-height:28px;flex-basis:auto;margin:0;
  overflow:hidden;overflow-wrap:anywhere;line-height:14px;font-size:11px;font-weight:500;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-sku,
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-selection {display:none}
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-price-stock {
  grid-column:2;grid-row:2;display:flex;flex-wrap:nowrap;align-items:center;
  width:100%;min-width:0;gap:4px;margin:0;line-height:18px;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-price {
  flex:none;font-size:11px;line-height:18px;margin:0;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-stock {
  min-width:0;margin-left:auto;font-size:10px;line-height:18px;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;
 }
 #view-pos .pos-workspace.pos-mode-scan .pos-grid .pos-product-stock-details > summary {
  padding:2px 6px;line-height:14px;font-size:10px;
 }
}

/* Keep floating tools clear of the POS mode bar. Other CRM pages retain their launchers. */
body:has(#view-pos:not([hidden])) #chat-launcher,
body:has(#view-pos:not([hidden])) #reminder-launcher { display:none; }

/* Direct transfer actions use the existing QR-sharing and unpaid-bill flows. */

/* Deposit controls are shared by desktop delivery and the mobile form. */
.pos-deposit-controls{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;min-width:0;margin-top:6px}
.pos-deposit-presets{display:contents}
.pos-deposit-controls .btn{min-width:0;min-height:44px;padding:8px 4px;white-space:normal;overflow-wrap:anywhere;line-height:1.3;border-radius:8px}
.pos-deposit-presets .btn{color:#0057b8;background:#eff6ff;border-color:#bfdbfe}
.pos-deposit-presets .btn:hover:not(:disabled){background:#dbeafe;border-color:#60a5fa}
.pos-deposit-controls > .btn{color:#fff;background:#006fee;border-color:#006fee}
.pos-deposit-controls > .btn:hover:not(:disabled){background:#005ac2;border-color:#005ac2}
.pos-deposit-controls .btn:focus-visible{outline:3px solid #93c5fd;outline-offset:2px}
.pos-deposit-controls > .btn:disabled{background:#dbeafe;color:#526b86;border-color:#bfdbfe;opacity:1}
.pos-deposit-controls .pos-note{grid-column:1/-1;font-size:12px;margin:0;white-space:normal}
/* Nested POS actions belong to the header menu's scroll flow, not a clipped flyout. */
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-more-menu {
  flex:1 0 100%;width:100%;min-width:0;grid-column:auto;justify-self:stretch;
}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-more-menu>summary {
  display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;padding:8px 12px;box-sizing:border-box;font-size:16px;
}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-more-menu>summary::after {content:'Thao tác khác';font-size:14px;}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-more-panel {
  position:static;min-width:0;width:100%;box-sizing:border-box;margin-top:8px;box-shadow:none;gap:4px;
}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-more-panel .btn {
  width:100%;min-width:0;min-height:44px;white-space:normal;overflow-wrap:anywhere;text-align:left;
}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-head-tools {min-width:0;gap:8px;}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) .pos-shift-status {max-width:100%;white-space:normal;}
#view-pos :is(.pos-ref-menu-body,.pos-mobile-menu-body) {overscroll-behavior:contain;}

.pos-deposit-controls.is-cash{grid-template-columns:repeat(3,minmax(0,1fr))}
.pos-deposit-controls > .btn[hidden]{display:none}

/* The deposit QR is displayed at its natural proportions in a compact payment dialog. */
dialog.pos-modal.pos-deposit-qr-modal {
  box-sizing: border-box;
  width: min(352px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: auto;
  max-height: calc(100dvh - 24px);
  margin: auto;
  overflow: auto;
  background: #fff;
}
.pos-deposit-qr-modal .pos-modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 16px 20px 20px;
  text-align: center;
}
.pos-deposit-qr-modal .pos-modal-content > h2 {
  margin: 0;
  padding: 0 44px 0 0;
  min-height: 32px;
  text-align: left;
  font-size: 16px;
  line-height: 32px;
}
.pos-deposit-qr-modal .pos-modal-close { top: 8px; right: 8px; width: 44px; height: 44px; }
.pos-deposit-qr-amount { font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pos-deposit-qr-modal .pos-qr { width: min(280px, 100%); height: auto; margin: 0 auto; }
.pos-deposit-qr-modal :is(.pos-deposit-qr-reference, .pos-note) { margin: 0; overflow-wrap: anywhere; }
.pos-deposit-qr-modal select { width: 100%; min-width: 0; }

/* The order identity stays visible while staff review returned goods and refund details. */
dialog.pos-quick-cancel-modal, dialog.pos-return-modal {
  box-sizing:border-box; margin:auto; height:auto; max-height:calc(100dvh - 24px);
  border-radius:14px; padding:0; overflow:auto; overflow-wrap:anywhere;
}
dialog.pos-quick-cancel-modal { width:min(550px,calc(100vw - 24px)); }
dialog.pos-return-modal { width:min(700px,calc(100vw - 24px)); }
.pos-quick-cancel-modal > form, .pos-return-modal > .pos-modal-content { display:block; margin:0; padding:0; }
.pos-quick-cancel-modal .modal-head, .pos-return-modal .pos-return-head {
  position:sticky; top:0; z-index:2; margin:0; padding:12px 18px;
  background:white; border-bottom:1px solid #dce3eb;
}
.pos-quick-cancel-modal .modal-head { display:grid; gap:4px; }
.pos-quick-cancel-modal .modal-head h2, .pos-cancel-order { margin:0; }
.pos-cancel-order { color:#495970; font-size:14px; }
.pos-return-head button { flex:none; }
.pos-return-modal .pos-return-head + div { padding:16px 18px; min-width:0; }
.pos-return-modal .pos-return-summary { grid-template-columns:minmax(0,1fr) auto; background:#f3f6fa; }
.pos-return-summary > strong { text-align:right; font-variant-numeric:tabular-nums; }
.pos-return-modal .pos-return-line { grid-template-columns:repeat(2,minmax(0,1fr)); padding-block:10px; border-bottom:1px solid #dce3eb; }
.pos-return-line > .pos-field { min-width:0; margin:0; }
.pos-return-line :is(input,select), .pos-cancel-body :is(input:not([type=checkbox]),textarea,select) {
  width:100%; min-width:0; box-sizing:border-box; min-height:44px;
}
.pos-quick-cancel-modal .pos-cancel-body { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; padding:16px 18px; }
.pos-cancel-body > :is(p,ul) { margin:0; }
.pos-cancel-body > ul { padding-left:20px; }
.pos-cancel-body > label:not([hidden]) { display:grid; gap:5px; }
.pos-cancel-body textarea { resize:vertical; min-height:64px; }
.pos-cancel-body > .pos-cancel-check:not([hidden]) { grid-template-columns:20px minmax(0,1fr); align-items:start; gap:10px; padding:12px; background:#f3f6fa; border-radius:8px; }
.pos-cancel-check input[type=checkbox] { width:20px; height:20px; margin:0; }
.pos-quick-cancel-modal .modal-foot { position:sticky; bottom:0; z-index:1; display:flex; justify-content:flex-end; gap:8px; padding:12px 18px; background:white; border-top:1px solid #dce3eb; }
.pos-quick-cancel-modal .modal-foot button { min-height:44px; white-space:normal; }
.pos-cancel-body .error:empty { display:none; }
@media(max-width:600px){
 .pos-return-modal .pos-return-line { grid-template-columns:minmax(0,1fr); gap:6px; }
 .pos-quick-cancel-modal .modal-foot { display:grid; grid-template-columns:auto minmax(0,1fr); }
 .pos-quick-cancel-modal :is(select,textarea,input:not([type=checkbox])), .pos-return-modal :is(select,textarea,input:not([type=checkbox])) { font-size:16px; }
}
.pos-return-modal .pos-field:has(> input[type=checkbox]) {
  display:grid; grid-template-columns:20px minmax(0,1fr); align-items:start; column-gap:10px;
}
.pos-return-modal .pos-field > input[type=checkbox] { grid-area:1 / 1; margin:0; }
.pos-return-modal .pos-field:has(> input[type=checkbox]) > span { grid-area:1 / 2; }
