.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
}

.pos-product-head {
  align-items: center;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 8px;
}

.product-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  text-align: left;
}

.product-card:hover {
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.product-card small,
.product-card span {
  color: var(--muted);
  font-size: 12px;
}

.product-card strong {
  color: #111827;
  font-size: 14px;
  line-height: 1.25;
}

.product-card b {
  color: var(--green);
  font-size: 14px;
}

.product-card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f1f5f9;
  object-fit: cover;
}

.cart-panel {
  position: sticky;
  top: 76px;
}

.cart-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
}

.cart-list.empty {
  display: grid;
  min-height: 74px;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.cart-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.cart-item strong,
.order-line strong {
  display: block;
  color: #111827;
}

.cart-item span,
.order-line span {
  color: var(--muted);
  font-size: 12px;
}

.cart-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cart-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #344054;
}

.order-lines {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.order-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 9px;
}

.order-line-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-line-actions input {
  width: 62px;
  text-align: center;
}

.order-action-grid,
.two-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.payment-summary {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 10px;
}

.payment-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.payment-summary span {
  color: var(--muted);
  font-size: 12px;
}

.payment-summary strong {
  color: #101828;
  font-size: 15px;
}

.quick-payments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.quick-payments button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #344054;
}

.segment-tabs,
.product-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.segment-tabs button,
.product-tabs button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 10px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.segment-tabs button.active,
.product-tabs button.active {
  border-color: var(--blue);
  background: #eaf1ff;
  color: var(--blue-strong);
}

.table-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
}

.table-card {
  min-width: 0;
}

.table-card button,
.table-card.readonly {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  color: #111827;
  text-align: left;
}

.table-card.occupied button,
.table-card.occupied.readonly {
  border-color: #8bd7ae;
  background: #e9fbf1;
}

.table-card b,
.table-card small {
  color: var(--muted);
  font-size: 12px;
}

.table-card strong {
  font-size: 15px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.table-actions a,
.table-link {
  color: var(--blue-strong);
  font-weight: 850;
}

body[data-page="pos"] .pos-workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body[data-page="pos"] .pos-operating-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 1.35fr);
  align-items: stretch;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(110deg, #087f74 0%, #0ea5e9 58%, #2563eb 100%);
  color: #fff;
  border-bottom: 4px solid #facc15;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .14);
}

body[data-page="pos"] .pos-operating-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

body[data-page="pos"] .pos-operating-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .32);
}

body[data-page="pos"] .pos-operating-icon img,
body[data-page="pos"] .pos-operating-icon svg {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

body[data-page="pos"] .pos-operating-title small,
body[data-page="pos"] .pos-operating-title strong,
body[data-page="pos"] .pos-operating-title em {
  display: block;
}

body[data-page="pos"] .pos-operating-title small {
  font-size: 12px;
  font-weight: 900;
  color: rgba(255, 255, 255, .9);
}

body[data-page="pos"] .pos-operating-title strong {
  margin-top: 2px;
  font-size: clamp(28px, 2vw, 36px);
  line-height: 1;
  font-weight: 950;
}

body[data-page="pos"] .pos-operating-title em {
  margin-top: 7px;
  font-style: normal;
  font-weight: 800;
  color: rgba(255, 255, 255, .9);
}

body[data-page="pos"] .pos-operating-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 8px;
}

body[data-page="pos"] .pos-operating-stats div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 78px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 10px 12px;
}

body[data-page="pos"] .pos-operating-stats span {
  font-size: 11px;
  font-weight: 900;
  color: rgba(255, 255, 255, .86);
}

body[data-page="pos"] .pos-operating-stats strong {
  font-size: 20px;
  line-height: 1.05;
  font-weight: 950;
  overflow-wrap: anywhere;
}

body[data-page="pos"] .table-board,
body[data-page="pos"] .pos-menu,
body[data-page="pos"] .cart-panel,
body[data-page="pos"] .empty-order-panel,
body[data-page="orders"] .panel,
body[data-page="order_detail"] .panel {
  border-radius: 10px;
  border-color: #d8e0ea;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

body[data-page="pos"] .table-board .panel-head,
body[data-page="pos"] .pos-menu .panel-head,
body[data-page="pos"] .cart-panel .panel-head,
body[data-page="orders"] .panel-head,
body[data-page="order_detail"] .panel-head {
  align-items: center;
  min-height: 54px;
  border-bottom-color: #e5edf5;
}

body[data-page="pos"] .table-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

body[data-page="pos"] .table-card button {
  position: relative;
  min-height: 106px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 12px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
  overflow: hidden;
}

body[data-page="pos"] .table-card button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #10b981;
}

body[data-page="pos"] .table-card.occupied button {
  border-color: #86efac;
  background: #ecfdf5;
}

body[data-page="pos"] .table-card.occupied button::before {
  background: #2563eb;
}

body[data-page="pos"] .table-card span,
body[data-page="pos"] .table-card em {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

body[data-page="pos"] .table-card strong {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.05;
  font-weight: 950;
}

body[data-page="pos"] .table-card em {
  margin-top: 8px;
  color: #0f766e;
  overflow-wrap: anywhere;
}

body[data-page="pos"] .active-order-layout {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
  gap: 14px;
}

body[data-page="pos"] .product-tabs {
  position: sticky;
  top: 61px;
  z-index: 4;
  margin: -6px -2px 12px;
  padding: 8px 2px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
}

body[data-page="pos"] .product-tabs button {
  min-height: 36px;
  border-radius: 9px;
  border-color: #d8e0ea;
  background: #fff;
}

body[data-page="pos"] .product-tabs button.active {
  border-color: #0d6fd6;
  background: #eaf4ff;
  color: #0d47a1;
}

body[data-page="pos"] .product-grid {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

body[data-page="pos"] .product-card {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

body[data-page="pos"] .product-card button {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  width: 100%;
  min-height: 128px;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

body[data-page="pos"] .product-card button:hover {
  transform: translateY(-1px);
  border-color: #0d6fd6;
  box-shadow: 0 12px 24px rgba(13, 111, 214, .14);
}

body[data-page="pos"] .product-card button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

body[data-page="pos"] .product-card span {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #eef6ff;
  color: #0d47a1;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

body[data-page="pos"] .product-card strong {
  color: #0f172a;
  font-size: 15px;
  line-height: 1.22;
  font-weight: 950;
}

body[data-page="pos"] .product-card em {
  color: #059669;
  font-style: normal;
  font-size: 16px;
  font-weight: 950;
}

body[data-page="pos"] .cart-panel {
  top: 70px;
  border-top: 4px solid #087f74;
}

body[data-page="pos"] .server-cart-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  margin-bottom: 12px;
}

body[data-page="pos"] .server-cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
}

body[data-page="pos"] .server-cart-item strong,
body[data-page="pos"] .server-cart-item span,
body[data-page="pos"] .server-cart-item b {
  display: block;
}

body[data-page="pos"] .server-cart-item strong {
  color: #0f172a;
  font-size: 14px;
  line-height: 1.25;
}

body[data-page="pos"] .server-cart-item span {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

body[data-page="pos"] .server-cart-item b {
  grid-column: 1 / -1;
  color: #059669;
  font-size: 15px;
  text-align: right;
}

body[data-page="pos"] .server-cart-controls {
  display: grid;
  justify-items: end;
  gap: 6px;
}

body[data-page="pos"] .server-cart-controls form {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

body[data-page="pos"] .server-cart-controls input {
  width: 56px;
  min-height: 34px;
  text-align: center;
  font-weight: 900;
}

body[data-page="pos"] .payment-summary {
  border-radius: 10px;
  border-color: #d8e0ea;
  background: #f8fbff;
}

body[data-page="pos"] .order-action-grid {
  grid-template-columns: 1fr;
}

body[data-page="pos"] .order-action-grid .pay {
  background: #16a34a;
}

body[data-page="pos"] .order-action-grid .danger {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #ef4444;
  color: #fff;
  font-weight: 900;
}

body[data-page="pos"] .empty-order-panel {
  display: grid;
  place-items: center;
  min-height: 180px;
  text-align: center;
  border-style: dashed;
}

body[data-page="orders"] .metrics-grid.small {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

body[data-page="orders"] .metric {
  min-height: 88px;
  border-radius: 8px;
  border-left-width: 0;
  border-top: 4px solid var(--blue);
}

body[data-page="orders"] .metric-green { border-top-color: var(--green); }
body[data-page="orders"] .metric-orange { border-top-color: var(--orange); }
body[data-page="orders"] .metric-violet { border-top-color: var(--violet); }

body[data-page="orders"] .table-wrap,
body[data-page="order_detail"] .table-wrap {
  border-radius: 10px;
  border-color: #d8e0ea;
}

body[data-page="orders"] th,
body[data-page="order_detail"] th {
  background: #087f74;
  color: #fff;
  height: 34px;
}

body[data-page="orders"] tbody tr:hover td,
body[data-page="order_detail"] tbody tr:hover td {
  background: #eef7ff;
}

body[data-page="order_detail"] .detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

body[data-page="order_detail"] .detail-grid div,
body[data-page="order_detail"] .summary-list div {
  border: 1px solid #d8e0ea;
  border-radius: 9px;
  background: #fff;
  padding: 10px 12px;
}

body[data-page="order_detail"] .detail-grid span,
body[data-page="order_detail"] .summary-list span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

body[data-page="order_detail"] .detail-grid strong,
body[data-page="order_detail"] .summary-list strong {
  display: block;
  margin-top: 5px;
  color: #0f172a;
  font-size: 15px;
}

@media (max-width: 1100px) {
  body[data-page="pos"] .pos-operating-hero,
  body[data-page="pos"] .active-order-layout {
    grid-template-columns: 1fr;
  }

  body[data-page="pos"] .pos-operating-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="pos"] .cart-panel {
    position: static;
  }
}
