* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Kanit, sans-serif;
  background: #f5f6f8;
  color: #659f48;
}
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 250px;
  background: #659f48;
  color: #fff;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand span {
  font-size: 20px;
  font-weight: 700;
}

.sidebar nav {
  padding: 12px;
}
.sidebar nav a {
  display: block;
  color: #dfe6f2;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.sidebar nav a:hover {
  background: #456b32;
  color: #fff;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 15px;
  border-top: 1px solid #456b32;
}
.user-mini {
  margin-bottom: 10px;
  color: #dfe6f2;
}
.logout {
  color: #ffb3b3;
  text-decoration: none;
}
.main {
  margin-left: 250px;
  width: calc(100% - 250px);
}
.topbar {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid #e4e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.menu-btn {
  display: none;
}
.content {
  padding: 24px;
  max-width: 1500px;
  margin: auto;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.card {
  background: #fff;
  border: 1px solid #e6e9ee;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
}
.stat .label {
  color: #6c7480;
}
.stat .value {
  font-size: 28px;
  font-weight: 600;
  margin-top: 6px;
}
.stat.blue {
  border-left: 5px solid #3578e5;
}
.stat.green {
  border-left: 5px solid #21a366;
}
.stat.orange {
  border-left: 5px solid #f39c12;
}
.stat.red {
  border-left: 5px solid #e74c3c;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  background: #edf1f5;
  color: #222;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary {
  background: #3578e5;
  color: #fff;
}
.btn-success {
  background: #21a366;
  color: #fff;
}
.btn-danger {
  background: #e74c3c;
  color: #fff;
}
.btn-warning {
  background: #f39c12;
  color: #fff;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

/* =========================
   REAL-TIME DATE & TIME
========================= */

.datetime-box {
  text-align: right;
  line-height: 1.3;
  min-width: 150px;
}

.datetime-box #currentDate {
  font-size: 13px;
  color: #659f48;
}

.datetime-box #currentTime {
  font-size: 18px;
  font-weight: 600;
  color: #659f48;
  letter-spacing: 0.5px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.full {
  grid-column: 1/-1;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid #d8dde5;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.field textarea {
  min-height: 100px;
}
.table-wrap {
  overflow: auto;
  background: #fff;
  border-radius: 12px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: auto;
}
.table th,
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  vertical-align: middle;
}
.table th {
  background: #f8f9fb;
  font-weight: 500;
}
.right {
  text-align: right !important;
}
.muted {
  color: #77808c;
}
.badge {
  display: inline-block;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 12px;
  background: #edf1f5;
}
.badge.green {
  background: #dcf5e7;
  color: #18794e;
}
.badge.red {
  background: #fde3e1;
  color: #a32a21;
}
.badge.orange {
  background: #fff0d5;
  color: #996000;
}
.alert {
  padding: 12px 16px;
  margin: 15px 24px 0;
  border-radius: 10px;
}
.alert.success {
  background: #dff6e8;
  color: #176b43;
}
.alert.error {
  background: #ffe4e2;
  color: #9f2d25;
}
.product-thumb {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 10px;
  background: #f5f5f5;
  padding: 5px;
}
.pos-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.product-btn {
  background: #fff;
  border: 1px solid #e2e6eb;
  border-radius: 13px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  min-height: 105px;
}
.product-btn:hover {
  border-color: #3578e5;
  box-shadow: 0 4px 12px rgba(53, 120, 229, 0.12);
}
.product-btn .pname {
  font-weight: 500;
}
.product-btn .price {
  color: #3578e5;
  font-weight: 600;
  margin-top: 8px;
}
.search {
  padding: 11px 13px;
  border: 1px solid #d8dde5;
  border-radius: 9px;
  font: inherit;
  width: 280px;
}
.cart {
  position: sticky;
  top: 88px;
}
.cart-items {
  max-height: 420px;
  overflow: auto;
}
.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid #eee;
}
.qty {
  display: flex;
  gap: 5px;
  align-items: center;
}
.qty button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #edf1f5;
  cursor: pointer;
}
.total-box {
  border-top: 2px solid #222;
  margin-top: 12px;
  padding-top: 14px;
}
.total-line {
  display: flex;
  justify-content: space-between;
  margin: 7px 0;
}
.grand {
  font-size: 24px;
  font-weight: 600;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #659f48, #456b32);
}
.login-card {
  width: min(420px, 92%);
  background: #fff;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.login-card h1 {
  text-align: center;
  margin-top: 0;
}
.logo-big {
  text-align: center;
  margin-bottom: 15px;
}

.logo-big img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.receipt {
  max-width: 700px;
  margin: auto;
  background: #fff;
  padding: 20px;
}
.receipt-head {
  text-align: center;
  border-bottom: 1px dashed #999;
  padding-bottom: 10px;
}
.text-center {
  text-align: center;
}
.no-print {
}
.chartbar {
  height: 12px;
  background: #e8edf3;
  border-radius: 20px;
  overflow: hidden;
}
.chartbar span {
  display: block;
  height: 100%;
  background: #3578e5;
}
.low-stock {
  color: #b42318;
  font-weight: 500;
}
@media (max-width: 1000px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .pos-layout {
    grid-template-columns: 1fr;
  }
  .cart {
    position: static;
  }
}
@media (max-width: 700px) {
  .sidebar {
    transform: translateX(-100%);
    transition: 0.2s;
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
  .menu-btn {
    display: inline-block;
    border: 0;
    background: none;
    font-size: 22px;
    margin-right: 10px;
  }
  .grid-4,
  .grid-3,
  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .content {
    padding: 14px;
  }
  .topbar {
    padding: 0 14px;
  }
  .search {
    width: 100%;
  }
}
@media print {
  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }
  .main {
    margin: 0;
    width: 100%;
  }
  .content {
    padding: 0;
  }
  .receipt {
    box-shadow: none;
  }
  .app {
    display: block;
  }
}

.qrcode img {
  width: 50%;
  height: 50%;
  text-align: center;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.logo-receipt img {
  width: 50%;
  height: 50%;
  text-align: center;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
