* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fff7ec;
  color: #2b1d10;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
body { min-height: 100vh; }

.totalbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #a3551d;
  color: #fff;
  padding: 18px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.totalbar-label { font-size: 16px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.totalbar-amount { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }

.products {
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product {
  background: #fff;
  border-radius: 14px;
  padding: 14px 14px 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.product-info { display: flex; flex-direction: column; min-width: 0; }
.product-name { font-size: 18px; font-weight: 600; }
.product-price { font-size: 14px; color: #7a5b3d; margin-top: 2px; font-variant-numeric: tabular-nums; }

.qty {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5e7d4;
  border-radius: 999px;
  padding: 4px;
}
.qty-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  font-size: 24px;
  font-weight: 700;
  color: #a3551d;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.qty-btn:active:not(:disabled) { transform: scale(.95); }
.qty-value {
  min-width: 28px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #fff7ec 70%, rgba(255,247,236,0));
  padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #a3551d; color: #fff; }
.btn-primary:disabled { background: #d6b89c; color: #fff; cursor: not-allowed; }
.btn-secondary { background: #fff; color: #a3551d; border: 2px solid #a3551d; }
.btn-danger { background: #b3261e; color: #fff; }
.btn-ghost { background: transparent; color: #a3551d; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(120px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #2b1d10;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 30;
  animation: toast-in .15s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.modal {
  position: fixed;
  inset: 0;
  background: #fff7ec;
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: #a3551d;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.modal-header h2 { margin: 0; font-size: 22px; }
.modal-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  padding: 4px 10px;
  cursor: pointer;
}
.modal-body { flex: 1; overflow-y: auto; padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); }

.aggregates {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.aggregates-total {
  font-size: 22px;
  font-weight: 700;
  color: #a3551d;
  border-bottom: 1px solid #f5e7d4;
  padding-bottom: 10px;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.aggregates-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.sales { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.sale {
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sale-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.sale-time { font-size: 13px; color: #7a5b3d; }
.sale-total { font-size: 17px; font-weight: 700; color: #a3551d; font-variant-numeric: tabular-nums; }
.sale-items { font-size: 14px; color: #2b1d10; margin: 4px 0 10px; line-height: 1.4; }
.sale-actions { display: flex; justify-content: flex-end; }
.sale-undo {
  background: transparent;
  border: 1px solid #b3261e;
  color: #b3261e;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sales-empty { text-align: center; color: #7a5b3d; padding: 30px 16px; }

@media (min-width: 600px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 0 1px rgba(0,0,0,.05); min-height: 100vh; }
}
