.pos-shell {
  --pos-bg: #f9fafb;
  --pos-surface: #ffffff;
  --pos-text: #111827;
  --pos-muted: #6b7280;
  --pos-border: #e5e7eb;
  --pos-accent: var(--color-primary-600);
  --pos-input: #111827;
  --pos-chip-bg: #ffffff;
  --pos-chip-text: #4b5563;
  --pos-chip-border: #d1d5db;
  --pos-chip-on-bg: var(--color-primary-50);
  --pos-chip-on-text: var(--color-primary-800);
  --pos-chip-on-border: var(--color-primary-400);
  height: 100vh;
  max-height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--pos-bg);
  color: var(--pos-text);
}
.dark .pos-shell {
  --pos-bg: #09090b;
  --pos-surface: #18181b;
  --pos-text: #f4f4f5;
  --pos-muted: #a1a1aa;
  --pos-border: #27272a;
  --pos-accent: var(--color-primary-400);
  --pos-input: #fafafa;
  --pos-chip-bg: #27272a;
  --pos-chip-text: #e4e4e7;
  --pos-chip-border: #3f3f46;
  --pos-chip-on-bg: color-mix(in srgb, var(--color-primary-900) 78%, #18181b);
  --pos-chip-on-text: var(--color-primary-100);
  --pos-chip-on-border: var(--color-primary-400);
}
html:has(.pos-shell),
body:has(.pos-shell) {
  height: 100%;
  overflow: hidden;
}
.pos-shell-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.pos-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.pos-top {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  padding: .55rem 1rem;
  background: var(--pos-surface);
  border-bottom: 1px solid var(--pos-border);
  flex: 0 0 auto;
}
.pos-top h1 { margin: 0; font-size: 1.15rem; color: var(--pos-text); line-height: 1.2; }
.pos-top .eyebrow { margin: 0 0 .1rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pos-muted); }
.pos-top-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-end; }
.pos-header-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.pos-header-tools .theme-btn { padding: .28rem .4rem; }
.pos-header-tools .theme-switch.is-compact .theme-btn { gap: 0; }
.pos-alert { margin: .75rem 1.25rem 0; }
.pos-alert.is-ok {
  background: color-mix(in srgb, var(--color-success-500, #22c55e) 18%, transparent);
  color: var(--color-success-800, #166534);
}
.dark .pos-alert.is-ok { color: var(--color-success-200, #bbf7d0); }
.pos-grid,
.pos-body {
  display: grid !important;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 1fr) !important;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.pos-catalog {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-height: 0;
  overflow: hidden;
  background: var(--pos-surface);
  border-right: 1px solid var(--pos-border);
}
.pos-scan, .pos-search {
  display: flex;
  gap: .5rem;
  align-items: center;
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: .75rem;
  padding: .5rem .75rem;
}
.pos-scan:focus-within, .pos-search:focus-within {
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary-500) 22%, transparent);
}
.pos-scan-input, .pos-search-input { flex: 1; background: transparent; border: 0; color: var(--pos-input); font-size: 1.05rem; box-shadow: none; outline: none; }
.pos-scan .input, .pos-search .input { box-shadow: none; background: transparent; }
.pos-filters {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.pos-shell .chip,
.pos-filters .chip {
  border: 1px solid var(--pos-chip-border);
  background: var(--pos-chip-bg);
  color: var(--pos-chip-text);
  border-radius: 999px;
  padding: .3rem .75rem;
  cursor: pointer;
  font-weight: 500;
  font-size: .82rem;
  line-height: 1.25;
  white-space: nowrap;
}
.pos-shell .chip:hover:not(.on),
.pos-filters .chip:hover:not(.on) { border-color: var(--pos-chip-on-border); color: var(--pos-chip-on-text); }
.pos-shell .chip.on,
.pos-filters .chip.on {
  background: var(--pos-chip-on-bg);
  color: var(--pos-chip-on-text);
  border-color: var(--pos-chip-on-border);
  font-weight: 500;
}
.pos-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  justify-content: start;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  gap: .6rem;
  overflow: auto;
  padding-bottom: 1rem;
  flex: 1 1 auto;
  min-height: 0;
}
.pos-product {
  text-align: left;
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: .8rem;
  padding: .55rem .7rem .7rem;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  overflow: hidden;
  width: 160px;
  height: auto;
  min-height: 0;
  align-self: start;
  font-size: .88rem;
  line-height: 1.25;
}
.pos-product-photo,
.pos-product-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: -.15rem -.3rem .35rem;
  flex: 0 0 8.5rem;
  height: 8.5rem;
  min-height: 8.5rem;
  max-height: 8.5rem;
  padding: .35rem;
  border-radius: .55rem;
  overflow: hidden;
  background: var(--pos-bg);
}
.pos-product-photo img,
.pos-product-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
}
.pos-line-photo {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: .4rem;
  overflow: hidden;
  background: var(--pos-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .12rem;
}
.pos-line-photo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
}
.pos-product:hover {
  border-color: var(--color-primary-400);
  background: color-mix(in srgb, var(--color-primary-50) 65%, var(--pos-surface));
}
.dark .pos-product:hover {
  background: color-mix(in srgb, var(--color-primary-900) 42%, var(--pos-surface));
}
.pos-product.is-out { opacity: .55; cursor: not-allowed; }
.pos-product.is-low { border-color: var(--color-warning-500); }
.pos-product-name,
.pos-product strong {
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pos-product-price, .pos-product em {
  font-style: normal;
  color: var(--pos-accent);
  font-weight: 700;
  font-size: .95rem;
}
.pos-product .tiny { font-size: .75rem; }
.pos-product-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  opacity: 1;
}
.dark .pos-product-fallback { color: #3f3f46; }
.pos-product-fallback .icon {
  width: 2.15rem;
  height: 2.15rem;
  stroke-width: 1.4;
}
.pos-stock-pill {
  position: absolute;
  left: .4rem;
  bottom: .4rem;
  border-radius: .35rem;
  padding: .1rem .4rem;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
}
.pos-stock-pill.ok { background: #059669; }
.pos-stock-pill.low { background: #d97706; }
.pos-stock-pill.out { background: #e11d48; }
.pos-stock { font-size: .75rem; color: var(--pos-muted); }
.pos-stock.low { color: var(--color-warning-600); font-weight: 600; }
.pos-stock.out { color: var(--color-danger-600); font-weight: 700; }
.pos-cart {
  background: var(--pos-bg);
  border-left: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.pos-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .5rem 1rem;
  flex: 0 0 auto;
  background: var(--pos-surface);
  border-bottom: 1px solid var(--pos-border);
}
.pos-tab {
  border: 1px solid var(--pos-chip-border);
  background: var(--pos-chip-bg);
  color: var(--pos-chip-text);
  border-radius: .55rem;
  padding: .3rem .55rem;
  font-size: .78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: 500;
}
.pos-tab:hover:not(.on) { border-color: var(--pos-chip-on-border); color: var(--pos-chip-on-text); }
.pos-tab.on {
  background: var(--pos-chip-on-bg);
  color: var(--pos-chip-on-text);
  border-color: var(--pos-chip-on-border);
  font-weight: 500;
}
.pos-tab.add { min-width: 1.8rem; justify-content: center; }
.pos-tab-count {
  background: color-mix(in srgb, currentColor 16%, transparent);
  color: inherit;
  border-radius: 999px;
  padding: 0 .35rem;
  font-size: .7rem;
  font-weight: 500;
}
.pos-tab-close {
  margin-left: .1rem;
  width: 1.15rem;
  height: 1.15rem;
  border: 0;
  border-radius: .3rem;
  background: transparent;
  color: var(--pos-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  font-size: 1rem;
}
.pos-tab-close:hover { background: var(--pos-bg); color: var(--pos-text); }
.pos-customer {
  display: flex;
  gap: .4rem;
  align-items: center;
  padding: .55rem 1rem .3rem;
  background: var(--pos-surface);
  flex-wrap: wrap;
  overflow: visible;
  position: relative;
  z-index: 30;
}
.pos-customer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: transparent;
}
.pos-customer-search { position: relative; flex: 1; min-width: 10rem; display: flex; gap: .3rem; z-index: 25; }
.pos-customer-input { width: 100%; font-size: .82rem; }
.pos-customer .chip { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.pos-customer-hits {
  position: absolute;
  left: 0; right: 2.2rem; top: calc(100% + .15rem);
  z-index: 40;
  list-style: none;
  margin: 0;
  padding: .2rem 0;
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: .5rem;
  max-height: 14rem;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}
.pos-customer-hits button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: .4rem .6rem;
  cursor: pointer;
  display: grid;
  gap: .05rem;
  font-size: .8rem;
}
.pos-customer-hits small { color: var(--pos-muted); font-size: .68rem; }
.pos-customer-hits button:hover { background: var(--pos-bg); }
.pos-cart-meta { padding: .15rem 1rem .35rem; background: var(--pos-surface); border-bottom: 1px solid var(--pos-border); }
.pos-customer-current {
  margin: 0 0 .4rem;
  font-size: .85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .55rem;
}
.pos-customer-current .muted { padding: 0; }
.pos-customer-edit {
  margin-left: auto;
  padding: .15rem .55rem;
  font-size: .78rem;
}
.pos-cart-actions { display: flex; gap: .35rem; }
.pos-print-actions { display: grid; gap: .4rem; }
.pos-receipt { background: #fff; color: #111827; padding: 1.25rem; border-radius: .75rem; }
.pos-receipt.is-roll {
  width: var(--pos-roll-width, 80mm);
  max-width: var(--pos-roll-width, 80mm);
  font-size: var(--pos-roll-font, 12px);
  padding: .6rem;
}
.pos-receipt.is-page { max-width: 210mm; }
.pos-receipt h2 { margin: .4rem 0; }
.pos-receipt-thanks { text-align: center; margin-top: .75rem; font-weight: 700; }
.pos-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 0;
}
.pos-cart-head h2 { margin: 0; color: var(--pos-text); font-size: 1.05rem; }
.pos-cart-empty { margin: 0; padding: 2rem 1rem; color: var(--pos-muted); text-align: center; flex: 1; }
.pos-lines {
  list-style: none;
  margin: 0;
  padding: .5rem 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.pos-lines li {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: .6rem;
  align-items: center;
  padding: .7rem 1rem;
  border-top: 1px solid var(--pos-border);
}
.pos-lines li:not(:has(.pos-line-photo)) {
  grid-template-columns: 1fr auto auto auto;
}
.pos-lines li > div:first-child { display: flex; flex-direction: column; gap: .12rem; }
.pos-qty { display: flex; align-items: center; gap: .35rem; }
.pos-qty button {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: .4rem;
  border: 1px solid var(--pos-border);
  background: var(--pos-bg);
  color: var(--pos-text);
  cursor: pointer;
}
.pos-qty button:disabled { opacity: .45; cursor: not-allowed; }
.pos-qty-input {
  width: 3.4rem;
  text-align: center;
  padding: .2rem .35rem;
  font-size: .9rem;
}
.pos-price-edit { display: flex; align-items: center; gap: .35rem; }
.pos-price-input { width: 6.5rem; padding: .2rem .4rem; font-size: .85rem; }
.pos-totals {
  padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--pos-border);
  display: grid;
  gap: .4rem;
  margin-top: auto;
  flex: 0 0 auto;
  background: var(--pos-surface);
}
.pos-totals div { display: flex; justify-content: space-between; }
.pos-grand { font-size: 1.2rem; }
.pos-grand strong { color: var(--pos-accent); }
.pos-preactions { display: flex; flex-wrap: wrap; gap: .35rem; }
.pos-gate { flex: 1; display: grid; place-items: center; padding: 1.5rem; }
.pos-gate-stack {
  width: min(56rem, 100%);
  display: grid;
  gap: .85rem;
}
@media (min-width: 900px) {
  .pos-gate-stack.is-split { grid-template-columns: 1fr 1fr; align-items: start; }
}
.pos-gate-card {
  width: min(28rem, 100%);
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: grid;
  gap: .85rem;
}
.pos-gate-stack .pos-gate-card { width: 100%; }
.pos-gate-card h1, .pos-gate-card h2 { margin: 0; color: var(--pos-text); }
.pos-session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.pos-session-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .35rem 0;
  border-top: 1px solid var(--pos-border);
}
.pos-session-list li:first-child { border-top: 0; padding-top: 0; }
.pos-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.pos-modal { width: min(28rem, 100%); background: var(--pos-surface); color: var(--pos-text); border-radius: 1rem; padding: 1.25rem; display: grid; gap: .75rem; border: 1px solid var(--pos-border); }
.pos-modal-wide { width: min(56rem, 100%); }
.pos-history-list { max-height: min(24rem, 55vh); overflow: auto; }
.pos-history-actions { display: flex; gap: .3rem; justify-content: flex-end; white-space: nowrap; }
.pos-pay-methods { display: flex; flex-wrap: wrap; gap: .4rem; }
.pos-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.pos-receipt { max-width: 28rem; }
.pos-receipt-totals { display: grid; gap: .35rem; }
.pos-receipt-totals div { display: flex; justify-content: space-between; }
.pos-pick-list { max-height: min(24rem, 55vh); overflow: auto; display: grid; gap: .45rem; }
.pos-pick-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .65rem;
  border: 1px solid var(--pos-border);
  border-radius: .65rem;
  background: var(--pos-bg);
  color: inherit;
  cursor: pointer;
}
.pos-pick-item:hover {
  border-color: var(--color-primary-400);
  background: color-mix(in srgb, var(--color-primary-50) 65%, var(--pos-surface));
}
.dark .pos-pick-item:hover {
  background: color-mix(in srgb, var(--color-primary-900) 42%, var(--pos-surface));
}
.pos-pick-meta { min-width: 0; flex: 1; display: grid; gap: .1rem; }
.pos-pick-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-product-thumb.sm {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .45rem;
  overflow: hidden;
  background: var(--pos-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pos-product-thumb.sm img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.pos-pay-qr {
  display: grid;
  justify-items: center;
  gap: .45rem;
  padding: .35rem 0 .15rem;
}
.pos-pay-qr img {
  width: min(16rem, 100%);
  height: auto;
  border-radius: .65rem;
  background: #fff;
  padding: .5rem;
  border: 1px solid var(--pos-border);
}
.pos-pay-qr p { margin: 0; text-align: center; }
.pos-pay-bank {
  margin: 0;
  display: grid;
  gap: .35rem;
  padding: .65rem .75rem;
  border: 1px solid var(--pos-border);
  border-radius: .65rem;
  background: var(--pos-bg);
}
.pos-pay-bank > div { display: grid; gap: .05rem; }
.pos-pay-bank dt { font-size: .72rem; color: var(--pos-muted); }
.pos-pay-bank dd { margin: 0; font-weight: 600; font-size: .9rem; letter-spacing: .01em; }
.pos-pay-notes { margin: 0; white-space: pre-wrap; }
@media (max-width: 720px) {
  .pos-grid,
  .pos-body {
    grid-template-columns: 1fr !important;
    overflow: auto;
  }
  .pos-catalog { border-right: 0; min-height: 55vh; }
  .pos-cart { border-top: 1px solid var(--pos-border); min-height: 45vh; }
}
@media print {
  .no-print, .fi-sidebar, .fi-topbar, .pos-header-tools { display: none !important; }
  .pos-receipt { box-shadow: none; border: 0; }
  .pos-receipt.is-roll {
    width: var(--pos-roll-print-width, 74mm);
    max-width: var(--pos-roll-print-width, 74mm);
  }
}
