.demo-pos-body {
  margin: 0;
  background: #222;
  font-family: Arial, sans-serif;
  color: #111;
  min-height: 100vh;
}

.demo-shell {
  width: min(1500px, calc(100vw - 24px));
  margin: 14px auto;
  background: #fff;
  border-radius: 8px;
  padding: clamp(10px, 1.2vw, 16px);
  box-sizing: border-box;
  min-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.panel {
  border: 2px solid #c7c7c7;
  border-radius: 22px;
  background: #f2f2f2;
}

.demo-top {
  display: grid;
  grid-template-columns: 2fr 1.25fr;
  gap: clamp(8px, 1vw, 12px);
}

.demo-banner {
  padding: 10px;
  background: #d9d9d9;
}

.demo-banner-inner {
  background: #242435;
  color: #fff;
  border-radius: 0;
  min-height: clamp(48px, 6vw, 90px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(8px, 1vw, 12px);
}

.demo-banner-inner h1 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 30px);
  text-align: center;
  line-height: 1.1;
}

.nav-arrow {
  border: none;
  background: transparent;
  color: #b8b8b8;
  font-size: clamp(20px, 2.8vw, 36px);
}

.demo-right-top {
  display: grid;
  gap: 12px;
}

.icon-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 0.8vw, 10px);
}

.icon-btn {
  border: none;
  border-radius: 20px;
  background: #d9d9d9;
  font-size: clamp(26px, 2.8vw, 44px);
  padding: clamp(8px, 1vw, 12px);
}

.icon-link {
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #111;
}

.recommendations {
  display: grid;
  place-items: center;
  min-height: clamp(60px, 8vw, 90px);
  font-size: clamp(30px, 3.4vw, 52px);
  font-weight: 600;
}

.demo-mid {
  display: grid;
  grid-template-columns: 2fr 84px minmax(360px, 1.1fr);
  gap: clamp(8px, 1vw, 12px);
  min-height: 0;
  overflow: auto;
}

.demo-mid.details-collapsed {
  grid-template-columns: 2fr 84px 220px;
}

.cart-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.cart-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.cart-table thead,
.cart-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.cart-table tbody {
  display: table-row-group;
  height: auto;
  overflow: visible;
  max-height: none;
  scrollbar-gutter: stable;
}

.cart-table th,
.cart-table td {
  border: 1px solid #222;
  padding: clamp(4px, 0.7vw, 8px) clamp(6px, 0.8vw, 10px);
  font-size: clamp(18px, 2vw, 33px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-table th {
  background: #f7f7f7;
}

.cart-table th:first-child,
.cart-table td:first-child {
  width: 32%;
}

.cart-table th:not(:first-child),
.cart-table td:not(:first-child) {
  width: 13.6%;
}

.cart-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(10px, 1.4vw, 28px);
  border-top: 1px solid #222;
  padding: 10px;
  font-size: clamp(20px, 2.3vw, 38px);
  font-weight: 600;
}

.actions-col {
  display: grid;
  align-content: start;
  gap: 10px;
}

.action-btn {
  border: none;
  border-radius: 18px;
  background: #d9d9d9;
  height: clamp(54px, 5vw, 74px);
  font-size: clamp(28px, 2.4vw, 40px);
  font-weight: 700;
}

.action-btn.void {
  font-size: clamp(20px, 1.8vw, 28px);
}

.action-btn.complete {
  background: #177a43;
  color: #fff;
  font-size: clamp(20px, 2vw, 30px);
}

.product-panel {
  padding: 16px;
  background: #fbfaf5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.product-panel h2 {
  margin: 0;
  text-align: left;
  font-size: clamp(28px, 2.6vw, 54px);
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-toggle-btn {
  border: none;
  border-radius: 10px;
  background: #d9d9d9;
  width: clamp(42px, 3vw, 54px);
  height: clamp(42px, 3vw, 54px);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 700;
  flex: 0 0 auto;
}

.demo-mid.details-collapsed .product-detail,
.demo-mid.details-collapsed .product-price,
.demo-mid.details-collapsed .checkout-panel {
  display: none;
}

.demo-mid.details-collapsed .product-panel h2 {
  font-size: clamp(22px, 2.3vw, 34px);
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(120px, 178px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.photo-placeholder {
  width: clamp(120px, 14vw, 190px);
  height: clamp(120px, 14vw, 190px);
  background: #cfe0ef;
  border: 1px solid #9ab4c8;
  display: grid;
  place-items: center;
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 700;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.product-detail h3 {
  margin: 0;
  font-size: clamp(16px, 1.35vw, 22px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
}

.product-detail > div:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-detail p {
  margin: 0;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.product-price {
  margin-top: 4px;
  text-align: left;
  color: #177a43;
  font-size: clamp(30px, 3vw, 56px);
  font-weight: 700;
}

.checkout-panel {
  margin-top: 12px;
  border-top: 1px solid #d2d2d2;
  padding-top: 10px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.checkout-grid label {
  font-size: clamp(14px, 1.3vw, 18px);
  font-weight: 600;
}

.demo-bottom {
  padding: 12px;
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: #f2f2f2;
}

.bottom-head {
  display: grid;
  grid-template-columns: minmax(44px, 60px) auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.back-btn {
  border: none;
  border-radius: 14px;
  background: #d9d9d9;
  height: clamp(42px, 4.5vw, 56px);
  font-size: clamp(24px, 2.1vw, 34px);
}

.bottom-head span {
  font-size: clamp(24px, 2.8vw, 42px);
  font-weight: 600;
}

#searchInput,
#liveSearchInput {
  width: 100%;
  border: 2px solid #ccc;
  border-radius: 18px;
  font-size: clamp(18px, 2vw, 34px);
  padding: 6px 14px;
}

.category-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.category-btn {
  border: none;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #bbb;
  font-size: clamp(20px, 1.9vw, 32px);
  padding: 10px 6px;
}

.category-btn.active {
  background: #d9e8ff;
}

.product-grid {
  min-height: 90px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  align-content: start;
}

.product-tile {
  border: 1px solid #b4b4b4;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  text-align: center;
}

.product-tile button {
  width: 100%;
  border: none;
  background: #e9f3ff;
  border-radius: 10px;
  padding: 8px;
  font-size: clamp(18px, 1.5vw, 24px);
}

.cart-row-selected {
  background: #e8f0ff;
}

.demo-login {
  text-align: right;
  flex: 0 0 auto;
}

.sale-message {
  min-height: 30px;
  font-size: clamp(16px, 1.4vw, 24px);
  font-weight: 600;
  color: #177a43;
  flex: 0 0 auto;
}

.sales-history {
  padding: 12px;
  background: #fff;
  flex: 0 0 auto;
  max-height: 200px;
  overflow-y: auto;
}

.sales-history h3 {
  margin: 0 0 8px 0;
  font-size: clamp(22px, 1.8vw, 30px);
}

.sales-history ul {
  margin: 0;
  padding-left: 22px;
}

.sales-history li {
  font-size: clamp(16px, 1.4vw, 22px);
  line-height: 1.4;
}

.sale-entry {
  border-bottom: 1px solid #ddd;
  padding: 6px 0;
}

.sale-entry summary {
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 600;
  cursor: pointer;
}

.sale-entry-customer {
  font-size: clamp(14px, 1.2vw, 18px);
  margin-top: 4px;
}

.sale-entry-items {
  margin: 4px 0 0 0;
  padding-left: 18px;
}

.sale-entry-items li {
  font-size: clamp(14px, 1.2vw, 18px);
  line-height: 1.3;
}

.live-pos-shell #liveRecentSalesList {
  max-height: 260px;
  overflow-y: auto;
}

@media (max-width: 1260px) {
  .demo-top {
    grid-template-columns: 1fr;
  }

  .demo-mid,
  .demo-mid.details-collapsed {
    grid-template-columns: 1fr;
  }

  .actions-col {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-content: stretch;
  }

  .demo-mid {
    overflow: visible;
  }

  .live-pos-shell .checkout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .demo-shell {
    width: calc(100vw - 12px);
    margin: 6px auto;
    padding: 8px;
    min-height: calc(100vh - 12px);
  }

  .cart-table tbody {
    max-height: 180px;
  }

  .cart-footer {
    justify-content: flex-start;
  }

  .product-detail {
    grid-template-columns: 1fr;
  }

  .product-price {
    text-align: center;
  }

  .category-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 200px;
  }

  .live-pos-shell .checkout-grid {
    grid-template-columns: 1fr;
  }
}
