.pos-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

body[data-page="pos"] {
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(180deg, #0a1014 0%, #0b1217 52%, #080d11 100%);
  --pos-grid-color: rgba(68, 219, 119, 0.28);
}

.pos-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.58;
  background-image:
    linear-gradient(var(--pos-grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--pos-grid-color) 1px, transparent 1px);
  background-size: 2.6rem 2.6rem;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18));
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18));
  transition: opacity 700ms ease;
}

.pos-grid-sweep {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.75;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.08) 14%,
    rgba(0, 0, 0, 0.22) 24%,
    rgba(0, 0, 0, 0.5) 34%,
    rgba(0, 0, 0, 0.75) 44%,
    rgba(0, 0, 0, 0.75) 56%,
    rgba(0, 0, 0, 0.5) 66%,
    rgba(0, 0, 0, 0.22) 76%,
    rgba(0, 0, 0, 0.08) 86%,
    transparent 100%
  );
  background-repeat: no-repeat;
  background-size: 100% 42%;
  animation: pos-shadow-sweep 24s ease-in-out infinite;
}

body[data-page="pos"][data-pos-mode="buy"] {
  --pos-grid-color: rgba(239, 83, 80, 0.3);
}

body[data-page="pos"][data-pos-mode="order"] {
  --pos-grid-color: rgba(47, 149, 255, 0.3);
}

@keyframes pos-shadow-sweep {
  0%, 100% {
    background-position: 0 -38%;
    opacity: 0.75;
  }

  50% {
    background-position: 0 138%;
    opacity: 0.75;
  }
}

.pos-header {
  display: grid;
  grid-template-columns: 1.4fr minmax(24rem, 32rem);
  gap: 1rem;
}

.mode-panel {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(19, 26, 32, 0.88);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.mode-panel[data-mode="sell"] {
  border-color: rgba(68, 219, 119, 0.35);
}

.mode-panel[data-mode="buy"] {
  border-color: rgba(239, 83, 80, 0.35);
}

.mode-panel[data-mode="order"] {
  border-color: rgba(47, 149, 255, 0.35);
}

.mode-panel__label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-panel__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.mode-panel__meta {
  margin-top: 0.2rem;
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 600;
}

.mode-panel__mini-led {
  width: 0.8rem;
  height: 0.8rem;
  margin-top: 0.2rem;
  border-radius: 999px;
  background: var(--sell);
  box-shadow: 0 0 10px rgba(68, 219, 119, 0.85);
  animation: mode-led-pulse 2.8s ease-in-out infinite;
}

.mode-panel[data-mode="buy"] .mode-panel__mini-led {
  background: var(--buy);
  box-shadow: 0 0 10px rgba(239, 83, 80, 0.85);
}

.mode-panel[data-mode="order"] .mode-panel__mini-led {
  background: var(--order);
  box-shadow: 0 0 10px rgba(47, 149, 255, 0.9);
}

.mode-panel__footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.mode-panel__divider {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 999px;
  background: var(--border-strong);
}

.mode-panel__hint {
  white-space: nowrap;
}

.mode-indicator {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.05;
}

.mode-indicator[data-mode="sell"] {
  color: var(--sell);
}

.mode-indicator[data-mode="buy"] {
  color: var(--buy);
}

.mode-indicator[data-mode="order"] {
  color: var(--order);
}

.mode-status-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.2rem 0;
}

.mode-led {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
}

.mode-led__halo,
.mode-led__core {
  position: absolute;
  border-radius: 999px;
}

.mode-led__halo {
  width: 3.6rem;
  height: 3.6rem;
  background: rgba(68, 219, 119, 0.18);
  box-shadow: 0 0 30px rgba(68, 219, 119, 0.2);
  animation: mode-led-pulse 2.8s ease-in-out infinite;
}

.mode-led__core {
  width: 1.1rem;
  height: 1.1rem;
  background: var(--sell);
  box-shadow:
    0 0 12px rgba(68, 219, 119, 0.85),
    0 0 28px rgba(68, 219, 119, 0.35);
}

.mode-status-shell[data-mode="buy"] .mode-led__halo {
  background: rgba(239, 83, 80, 0.18);
  box-shadow: 0 0 30px rgba(239, 83, 80, 0.24);
}

.mode-status-shell[data-mode="buy"] .mode-led__core {
  background: var(--buy);
  box-shadow:
    0 0 12px rgba(239, 83, 80, 0.85),
    0 0 28px rgba(239, 83, 80, 0.35);
}

.mode-status-shell[data-mode="order"] .mode-led__halo {
  background: rgba(47, 149, 255, 0.18);
  box-shadow: 0 0 30px rgba(47, 149, 255, 0.24);
}

.mode-status-shell[data-mode="order"] .mode-led__core {
  background: var(--order);
  box-shadow:
    0 0 12px rgba(47, 149, 255, 0.9),
    0 0 28px rgba(47, 149, 255, 0.35);
}

@keyframes mode-led-pulse {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.55;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.pos-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.8rem;
}

.form-grid > * {
  min-width: 0;
}

.catalog-search {
  position: relative;
}

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  display: none;
  max-height: 20rem;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(16, 22, 28, 0.98);
  box-shadow: var(--shadow-card);
  z-index: 30;
}

.suggestions.is-open {
  display: block;
}

.suggestion {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
}

.suggestion:hover,
.suggestion.is-active {
  background: rgba(39, 53, 65, 0.85);
}

.suggestion__meta {
  color: var(--text-secondary);
}

.cart-table td:nth-child(3),
.cart-table td:nth-child(4),
.cart-table td:nth-child(5),
.cart-table th:nth-child(3),
.cart-table th:nth-child(4),
.cart-table th:nth-child(5) {
  text-align: right;
}

.cart-table td:last-child {
  text-align: right;
}

.cart-table .actions-row {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.cart-table .actions-row .button[data-action="add-one"],
.cart-table .actions-row .button[data-action="remove-one"] {
  width: 3.5rem;
  min-width: 3.5rem;
  padding-left: 0;
  padding-right: 0;
}

.cart-qty {
  max-width: 5.2rem;
  margin-left: auto;
}

.summary-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: sticky;
  top: 1rem;
}

.summary-tile {
  padding: 1.1rem;
}

.summary-total {
  font-size: 2rem;
  font-weight: 700;
}

.summary-total[data-mode="sell"] {
  color: var(--sell);
}

.summary-total[data-mode="buy"] {
  color: var(--buy);
}

.summary-total[data-mode="order"] {
  color: var(--order);
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.customer-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customer-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 20rem;
  overflow: auto;
}

.customer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(18, 25, 31, 0.78);
  border: 1px solid var(--border-subtle);
}

.pos-readonly .pos-control {
  display: none !important;
}

@media (max-width: 1200px) {
  .pos-header,
  .pos-grid {
    grid-template-columns: 1fr;
  }

  .mode-status-shell {
    align-items: flex-start;
  }

  .summary-panel {
    position: static;
  }

  .form-grid > * {
    grid-column: span 6;
  }
}
