* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #edf7f0;
  color: #173a27;
}
button,
input,
select {
  font: inherit;
}
button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  background: #e5eee8;
  color: #173a27;
}
button:hover {
  filter: brightness(0.97);
}
.primary {
  background: #168a45;
  color: #fff;
}
.danger {
  background: #c83b3b;
  color: #fff;
}
.gold {
  background: #e2a72c;
  color: #241d08;
}
.full {
  width: 100%;
}
.hidden {
  display: none !important;
}
.loginScreen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #07552b, #168a45, #63bd69);
}
.loginBox {
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 22px;
  padding: 34px;
  box-shadow: 0 22px 60px #0005;
  text-align: center;
}
.brand {
  font-size: 25px;
  font-weight: 900;
  color: #168a45;
}
.subbrand {
  font-weight: 800;
  margin: 5px 0 25px;
  color: #53675a;
}
.loginBox input {
  display: block;
  width: 100%;
  padding: 13px;
  margin: 10px 0;
  border: 1px solid #b7c9bc;
  border-radius: 9px;
  color: #182b20;
  background: #fff;
}
.hint {
  font-size: 12px;
  color: #6c7b71;
  margin-top: 13px;
}
.error {
  color: #b92e2e;
  min-height: 18px;
  margin-top: 8px;
}
header {
  height: 64px;
  background: #0b5d2f;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}
header span {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 7px;
}
#userBadge {
  font-size: 13px;
}
.headerUser {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logoutBtn {
  background: #fff;
  color: #a52323;
  border: 2px solid #fff;
  padding: 8px 12px;
}
.logoutBtn:hover {
  background: #ffe9e9;
}
main {
  max-width: 1800px;
  margin: auto;
  padding: 18px 18px 100px;
}
.pageTitle {
  margin: 0 0 14px;
}
.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.card,
.panel {
  background: #fff;
  border: 1px solid #d7e7dc;
  border-radius: 15px;
  padding: 17px;
  box-shadow: 0 3px 14px #174c2a10;
  margin-bottom: 14px;
}
.kpi {
  font-size: 28px;
  font-weight: 900;
  color: #168a45;
}
.muted {
  color: #708077;
}
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar input,
.toolbar select,
.field,
.form input,
.form select {
  padding: 10px;
  border: 1px solid #bdcabe;
  border-radius: 8px;
  color: #172a20;
  background: #fff;
}
.toolbar input {
  min-width: 250px;
}
.posGrid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
}
.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.product {
  border: 1px solid #dbe8df;
  border-radius: 11px;
  padding: 12px;
  background: #fbfffc;
}
.productName {
  font-weight: 800;
}
.productPrice {
  font-size: 18px;
  font-weight: 900;
  color: #168a45;
  margin: 7px 0;
}
.stock {
  font-size: 12px;
  color: #66776c;
}
.cartRow {
  display: grid;
  grid-template-columns: 1fr 70px 100px 34px;
  gap: 6px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e2ebe5;
}
.cartRow input {
  width: 100%;
  padding: 7px;
  border: 1px solid #bdcabe;
  border-radius: 7px;
}
.total {
  font-size: 21px;
  font-weight: 900;
  margin-top: 13px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 13px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 9px;
  border-bottom: 1px solid #e3ebe6;
  text-align: left;
}
th {
  background: #eff8f1;
  color: #0d6332;
}
.paid {
  color: #168a45;
  font-weight: 800;
}
.balance {
  color: #bd2929;
  font-weight: 800;
}
.low {
  background: #fff3f3;
}
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #084f28;
  padding: 8px;
  display: flex;
  gap: 6px;
  overflow: auto;
  z-index: 10;
}
nav button {
  background: #116d37;
  color: #fff;
  white-space: nowrap;
}
.modal {
  position: fixed;
  inset: 0;
  background: #0008;
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 30;
}
.modalBox {
  background: #fff;
  border-radius: 18px;
  border-top: 6px solid #168a45;
  padding: 22px;
  width: min(780px, 96vw);
  max-height: 90vh;
  overflow: auto;
}
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form label {
  font-size: 12px;
  font-weight: 800;
}
.form input,
.form select {
  display: block;
  width: 100%;
  margin-top: 5px;
}
.receipt {
  max-width: 520px;
  margin: auto;
}
.receipt h2 {
  text-align: center;
}
.receipt .r {
  display: flex;
  justify-content: space-between;
}
.receipt table {
  margin: 10px 0;
}
@media (max-width: 1000px) {
  .grid4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .products {
    grid-template-columns: repeat(2, 1fr);
  }
  .posGrid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .grid4 {
    grid-template-columns: 1fr;
  }
  .products {
    grid-template-columns: 1fr;
  }
  .form {
    grid-template-columns: 1fr;
  }
}
@media print {
  header,
  nav,
  .noPrint {
    display: none !important;
  }
  main {
    padding: 0;
  }
  .panel,
  .card {
    box-shadow: none;
    border: 0;
  }
}

.modalBox {
  width: min(1100px, 97vw);
}
.form {
  gap: 14px;
}
.form input,
.form select {
  min-height: 42px;
}
.panel {
  overflow-x: auto;
}
.pricePair {
  display: grid;
  gap: 5px;
  margin: 9px 0;
  font-size: 13px;
}
.pricePair span {
  display: flex;
  justify-content: space-between;
  padding: 5px 7px;
  border-radius: 7px;
  background: #eff8f1;
}
.productActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 9px;
}
.productActions button {
  padding: 8px 6px;
  font-size: 11px;
}
.cartRow {
  grid-template-columns: minmax(140px, 1fr) 70px 100px minmax(170px, auto);
}
.cartRow small {
  display: block;
  color: #168a45;
  font-weight: 800;
  margin-top: 3px;
}
.cartButtons,
.tableActions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.cartButtons button,
.tableActions button {
  padding: 7px 8px;
  font-size: 11px;
}
.livePurchase > input {
  width: 100%;
  padding: 13px;
  border: 2px solid #168a45;
  border-radius: 10px;
  font-size: 16px;
}
.purchaseResults {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  max-height: 260px;
  overflow: auto;
  margin: 9px 0;
}
.purchaseResult {
  text-align: left;
  display: grid;
  gap: 4px;
  border: 1px solid #c9ddcf;
  background: #fff;
}
.purchaseResult:hover {
  border-color: #168a45;
  background: #eff8f1;
}
.purchaseResult span {
  font-size: 12px;
  color: #66776c;
}
.purchaseResult strong {
  color: #168a45;
}
.selectedProduct {
  padding: 11px;
  border-radius: 9px;
  background: #eff8f1;
  margin-bottom: 10px;
}
.voided {
  opacity: 0.65;
  background: #f1f1f1;
  text-decoration: line-through;
}
.moneyCounter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.moneyCounter label {
  background: #f5faf6;
  border: 1px solid #cfe0d3;
  border-radius: 10px;
  padding: 9px;
  display: grid;
  gap: 5px;
  text-align: center;
  font-weight: 800;
}
.moneyCounter input {
  width: 100%;
  padding: 9px;
  border: 1px solid #b9cabd;
  border-radius: 7px;
  text-align: center;
}
.moneyCounter small {
  color: #168a45;
}
.drawerTotal {
  background: #0b5d2f;
  color: #fff;
  padding: 14px;
  border-radius: 10px;
  font-size: 20px;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.smallKpi {
  font-size: 18px;
}
@media (max-width: 800px) {
  .moneyCounter {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .purchaseResults {
    grid-template-columns: 1fr;
  }
  .cartRow {
    grid-template-columns: 1fr 60px 85px;
  }
  .cartButtons {
    grid-column: 1/-1;
  }
  .productActions {
    grid-template-columns: 1fr;
  }
}
