.pos-view,
.pos-content { display: grid; min-width: 0; gap: 18px; }
.pos-view .pos-heading { margin-block-end: 0; }
.pos-view h2 { font-size: 18px; }
.pos-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.pos-actions .button { white-space: nowrap; }

.pos-open-panel {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 18px;
}
.pos-open-icon, .pos-product-icon { display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 9px; }
.pos-open-icon { inline-size: 46px; block-size: 46px; }
.pos-open-panel p, .pos-shift-head p, .pos-dialog-hint, .pos-history-note { color: var(--muted); font-size: 13px; }
.pos-open-panel > div:last-of-type p { margin-block-start: 3px; }

.pos-shift-head, .pos-panel-heading, .pos-receipt, .pos-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.pos-shift-head, .pos-receipt { padding: 15px 18px; }
.pos-shift-head p { margin-block-start: 3px; }
.pos-metrics, .pos-history-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.pos-metrics > div { padding: 12px 16px; border-block-start: 1px solid var(--border); }
.pos-metrics > div:not(:last-child) { border-inline-end: 1px solid var(--border); }
.pos-metrics dt, .pos-history-metrics dt { font-size: 12px; color: var(--muted); }
.pos-metrics dd, .pos-history-metrics dd { margin: 2px 0 0; font-weight: 700; }
.pos-metrics dd { font-size: 19px; }

.pos-workspace { display: grid; grid-template-areas: 'cart catalog'; grid-template-columns: minmax(335px, .55fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.pos-catalog-panel { grid-area: catalog; }
.pos-cart-panel { grid-area: cart; }
.pos-catalog-panel, .pos-cart-panel { min-width: 0; padding: 15px; }
.pos-search { display: grid; gap: 6px; margin-block: 12px; }
.pos-search-controls { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(94px, 1fr); gap: 8px; }
.pos-search-input { position: relative; display: block; }
.pos-search-input > svg { position: absolute; inset-inline-start: 10px; inset-block-start: 11px; color: var(--muted); pointer-events: none; }
.pos-search-input input { padding-inline-start: 35px; }
.pos-scan-status { color: var(--brand-deep); font-size: 13px; }
.pos-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 8px; max-block-size: 495px; overflow: auto; padding: 2px; }
.pos-product {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  text-align: start;
}
.pos-product:hover:not(:disabled) { background: #f6faf7; border-color: #a5c9b4; }
.pos-product:disabled { opacity: .62; cursor: default; }
.pos-product-icon { width: 29px; height: 29px; }
.pos-product-name { display: grid; gap: 1px; overflow-wrap: anywhere; }
.pos-product-name strong { font-size: 13px; }
.pos-product small, .pos-cart-product small { color: var(--muted); font-size: 11px; }
.pos-product .pos-stock-out, .pos-stock-out { color: var(--danger); }
.pos-product-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px; }
.pos-product-bottom strong { color: var(--brand-deep); font-size: 14px; }
.pos-empty { grid-column: 1 / -1; padding: 20px 0; text-align: center; color: var(--muted); font-size: 14px; }

.pos-customer { margin-block: 12px; }
.pos-cart-lines { display: grid; }
.pos-cart-line {
  display: grid;
  grid-template-columns: minmax(75px, 1fr) minmax(85px, auto) max-content 28px;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-block-start: 1px solid var(--border);
  font-size: 13px;
}
.pos-cart-product { display: grid; gap: 3px; overflow-wrap: anywhere; }
.pos-quantity-group { display: flex; align-items: center; gap: 3px; }
.pos-quantity-group .button.icon-only, .pos-cart-line .pos-remove { min-width: 27px; min-height: 30px; padding: 2px; }
.pos-quantity-group input { min-width: 0; width: 35px; height: 30px; border: 1px solid var(--border); border-radius: 6px; appearance: textfield; text-align: center; color: var(--ink); }
.pos-quantity-group input::-webkit-inner-spin-button, .pos-quantity-group input::-webkit-outer-spin-button { appearance: none; }
.pos-cart-line .pos-remove { color: var(--danger); }
.pos-cart-line p { grid-column: 1 / -1; font-size: 12px; }
.pos-empty-cart, .pos-history-empty { display: grid; justify-items: center; gap: 8px; padding: 22px 10px; color: var(--muted); text-align: center; }
.pos-empty-cart svg, .pos-history-empty svg { color: var(--brand); }
.pos-cart-total { display: grid; gap: 9px; padding-block-start: 12px; border-block-start: 1px solid var(--border); }
.pos-cart-total > div, .pos-tender-total, .pos-tender-difference { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pos-cart-total strong, .pos-tender-total strong { font-size: 20px; font-weight: 800; }
.pos-cart-warning { margin-block-start: 7px; color: var(--danger); font-size: 12px; }

.pos-receipt { border-color: #add4bc; background: var(--brand-soft); }
.pos-receipt > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--brand-deep); }
.pos-pending { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 15px 18px; border-color: #ecd49b; background: #fffaf0; }
.pos-pending p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.pos-history > header { padding: 13px 17px; }
.pos-history-empty { padding-block: 9px 17px; font-size: 13px; }
.pos-past-shift { border-block-start: 1px solid var(--border); }
.pos-past-shift summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; cursor: pointer; }
.pos-past-shift summary small { display: block; color: var(--muted); font-size: 12px; }
.pos-past-body { padding: 3px 16px 12px; }
.pos-history-metrics { gap: 7px; }
.pos-history-note { margin-block: 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pos-sales-log { margin-block-start: 10px; min-width: 480px; }
.pos-load-error { display: grid; justify-items: start; gap: 10px; padding: 15px; }

.pos-view .pos-dialog { width: min(440px, calc(100% - 24px)); }
.pos-dialog-form { display: grid; gap: 14px; padding: 19px; }
.pos-dialog-heading .icon-only { margin-inline-start: auto; }
.pos-tender-total { padding: 8px 10px; border-radius: 8px; color: var(--brand-deep); background: var(--brand-soft); }
.pos-tender-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pos-tender-split > div { display: grid; align-content: start; gap: 9px; font-size: 13px; }
.pos-error { padding: 8px 10px; border-radius: 8px; color: #8d2225; background: #fff0ef; font-size: 14px; }
.pos-print-receipt { display: none; }

@media (max-width: 860px) {
  .pos-workspace { grid-template-columns: minmax(305px, .8fr) minmax(0, 1fr); gap: 12px; }
  .pos-catalog-panel, .pos-cart-panel { padding: 11px; }
  .pos-catalog { max-block-size: 370px; }
}

@media (max-width: 700px) {
  .pos-workspace { grid-template-areas: 'catalog' 'cart'; grid-template-columns: minmax(0, 1fr); }
  .pos-metrics, .pos-history-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-metrics dd { font-size: 16px; }
  .pos-catalog { max-block-size: 265px; }
  .pos-product { gap: 4px; }
  .pos-open-panel { grid-template-columns: 40px minmax(0, 1fr); }
  .pos-open-panel .button { grid-column: 2; justify-self: start; }
  .pos-open-icon { width: 40px; height: 40px; }
}

@media print {
  body:has(> .pos-print-receipt) { background: white; }
  body:has(> .pos-print-receipt) > :not(.pos-print-receipt) { display: none !important; }
  .pos-print-receipt { display: block; width: min(100%, 75mm); margin: 0 auto; color: #111; font-size: 12px; }
  .pos-print-receipt header { margin-block-end: 10px; text-align: center; }
  .pos-print-receipt h1 { font-size: 19px; }
  .pos-print-receipt table { width: 100%; border-collapse: collapse; text-align: start; }
  .pos-print-receipt th, .pos-print-receipt td { text-align: start; border-block-end: 1px solid #ddd; padding: 4px 3px; }
  .pos-print-receipt dl { display: grid; gap: 4px; margin-block: 8px 0; }
  .pos-print-receipt dl > div { display: flex; justify-content: space-between; }
  .pos-print-receipt dd { margin: 0; font-weight: 700; }
}
