:root {
  --bg:#f4f6f9;
  --card:#ffffff;
  --main:#0b2f5b;
  --main2:#123f75;
  --accent:#d9a441;
  --text:#1f2933;
  --muted:#6b7280;
  --border:#e5e7eb;
  --success:#1f8a4c;
  --danger:#c0392b;
  --shadow:0 12px 35px rgba(0,0,0,.10);
  --radius:22px;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  font-family:Tahoma,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  padding-bottom:105px;
}

header {
  background:linear-gradient(135deg,var(--main),var(--main2));
  color:white;
  padding:18px 14px 26px;
  border-bottom-left-radius:28px;
  border-bottom-right-radius:28px;
  box-shadow:var(--shadow);
  position:sticky;
  top:0;
  z-index:10;
}

.header-inner {
  max-width:1200px;
  margin:auto;
}

.brand-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.brand h1 {
  margin:0;
  font-size:25px;
  font-weight:900;
  letter-spacing:.3px;
}

.brand p {
  margin:7px 0 0;
  color:rgba(255,255,255,.82);
  font-size:13px;
  line-height:1.7;
}

.cart-mini {
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.22);
  border-radius:18px;
  padding:10px 12px;
  min-width:98px;
  text-align:center;
  cursor:pointer;
}

.cart-mini span {
  display:block;
  font-size:11px;
  color:rgba(255,255,255,.78);
  margin-bottom:4px;
}

.cart-mini strong {
  font-size:18px;
  color:white;
}

.container {
  width:100%;
  max-width:1200px;
  margin:-12px auto 0;
  padding:0 12px 18px;
}

.tools-card {
  background:white;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:13px;
  border:1px solid rgba(0,0,0,.03);
  margin-bottom:14px;
}

.search-row {
  display:grid;
  grid-template-columns:1fr;
  gap:9px;
}

@media(min-width:760px) {
  .search-row {
    grid-template-columns:1.3fr .7fr .7fr;
  }
}

input,
select,
textarea {
  width:100%;
  border:1px solid var(--border);
  border-radius:16px;
  padding:13px;
  font-size:15px;
  outline:none;
  background:#fff;
  color:var(--text);
  font-family:Tahoma,Arial,sans-serif;
}

input:focus,
select:focus,
textarea:focus {
  border-color:var(--main);
  box-shadow:0 0 0 3px rgba(11,47,91,.08);
}

.categories {
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:10px 2px 2px;
  scrollbar-width:none;
}

.categories::-webkit-scrollbar {
  display:none;
}

.cat-btn {
  border:none;
  background:#eef2f7;
  color:var(--main);
  padding:10px 13px;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
  white-space:nowrap;
  cursor:pointer;
  font-family:Tahoma,Arial,sans-serif;
}

.cat-btn.active {
  background:var(--main);
  color:white;
}

.status-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin:10px 2px 0;
  color:var(--muted);
  font-size:12px;
  flex-wrap:wrap;
}

.products-grid {
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

@media(min-width:760px) {
  .products-grid {
    grid-template-columns:repeat(3,1fr);
  }
}

@media(min-width:1050px) {
  .products-grid {
    grid-template-columns:repeat(4,1fr);
  }
}

.product-card {
  background:var(--card);
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 8px 24px rgba(0,0,0,.075);
  border:1px solid rgba(0,0,0,.04);
  display:flex;
  flex-direction:column;
  min-height:100%;
}

.image-wrap {
  width:100%;
  aspect-ratio:1/1.14;
  background:#eef2f7;
  position:relative;
  overflow:hidden;
  cursor:pointer;
}

.image-wrap img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transition:.25s ease;
}

.image-wrap:hover img {
  transform:scale(1.04);
}

.availability {
  position:absolute;
  top:9px;
  right:9px;
  background:rgba(255,255,255,.92);
  color:var(--main);
  padding:5px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  box-shadow:0 4px 15px rgba(0,0,0,.10);
}

.product-body {
  padding:11px;
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:1;
}

.product-name {
  margin:0;
  color:var(--main);
  font-size:14px;
  line-height:1.5;
  font-weight:900;
  min-height:42px;
}

.meta {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.pill {
  display:inline-block;
  background:#eef2f7;
  color:var(--main);
  border-radius:999px;
  padding:5px 8px;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
}

.pill.gold {
  background:rgba(217,164,65,.18);
  color:#8a610f;
}

.pill.green {
  background:rgba(31,138,76,.12);
  color:var(--success);
}

.sku {
  color:var(--muted);
  font-size:10.5px;
  direction:ltr;
  text-align:right;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.price-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-top:auto;
}

.price {
  font-size:18px;
  color:var(--main);
  font-weight:900;
}

.stock {
  color:var(--muted);
  font-size:11px;
  font-weight:700;
}

.actions {
  display:grid;
  grid-template-columns:1fr;
  gap:7px;
}

button {
  border:none;
  border-radius:15px;
  padding:11px 12px;
  font-size:13px;
  font-weight:900;
  cursor:pointer;
  background:var(--main);
  color:white;
  min-height:42px;
  font-family:Tahoma,Arial,sans-serif;
}

button.secondary {
  background:#eef2f7;
  color:var(--main);
}

button.gold {
  background:var(--accent);
  color:#1f2933;
}

button.success {
  background:var(--success);
  color:white;
}

button.danger {
  background:var(--danger);
  color:white;
}

button:disabled {
  opacity:.5;
  cursor:not-allowed;
}

.qty-control {
  display:grid;
  grid-template-columns:38px 1fr 38px;
  gap:6px;
  align-items:center;
}

.qty-control button {
  min-height:36px;
  padding:8px;
  border-radius:12px;
}

.qty-control input {
  text-align:center;
  padding:9px 6px;
  border-radius:12px;
  font-weight:900;
}

.empty {
  background:white;
  border:1px dashed var(--border);
  border-radius:22px;
  padding:25px 14px;
  text-align:center;
  color:var(--muted);
  box-shadow:var(--shadow);
}

.cart-bar {
  position:fixed;
  right:0;
  left:0;
  bottom:0;
  background:rgba(255,255,255,.97);
  border-top:1px solid var(--border);
  padding:10px 12px;
  z-index:20;
  box-shadow:0 -10px 30px rgba(0,0,0,.10);
}

.cart-bar-inner {
  max-width:1200px;
  margin:auto;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  align-items:center;
}

.cart-summary {
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:16px;
  padding:9px 11px;
  line-height:1.7;
  font-size:12px;
  color:var(--muted);
}

.cart-summary strong {
  color:var(--main);
  font-size:15px;
}

.modal {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.62);
  z-index:100;
  display:none;
  align-items:center;
  justify-content:center;
  padding:14px;
}

.modal.active {
  display:flex;
}

.modal-card {
  width:100%;
  max-width:760px;
  background:white;
  border-radius:24px;
  overflow:hidden;
  box-shadow:0 20px 50px rgba(0,0,0,.25);
  max-height:92vh;
  display:flex;
  flex-direction:column;
}

.modal-head {
  padding:12px 14px;
  background:var(--main);
  color:white;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.modal-head strong {
  font-size:15px;
  line-height:1.5;
}

.close-btn {
  background:rgba(255,255,255,.15);
  color:white;
  border:1px solid rgba(255,255,255,.22);
  border-radius:12px;
  padding:8px 12px;
  min-height:36px;
}

.image-modal-body {
  background:#111827;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px;
  overflow:auto;
}

.image-modal-body img {
  max-width:100%;
  max-height:78vh;
  object-fit:contain;
  border-radius:16px;
  background:white;
}

.cart-modal-body {
  padding:14px;
  overflow:auto;
}

.cart-item {
  display:grid;
  grid-template-columns:72px 1fr;
  gap:10px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}

.cart-item:last-child {
  border-bottom:none;
}

.cart-item img {
  width:72px;
  height:82px;
  object-fit:cover;
  border-radius:14px;
  background:#eef2f7;
  border:1px solid var(--border);
}

.cart-item h4 {
  margin:0 0 5px;
  color:var(--main);
  font-size:13px;
  line-height:1.5;
}

.cart-item p {
  margin:0;
  color:var(--muted);
  font-size:11.5px;
  line-height:1.7;
}

.customer-form {
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  margin-top:12px;
}

.cart-actions-row {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:12px;
}

@media(min-width:760px) {
  .customer-form {
    grid-template-columns:1fr 1fr;
  }

  .customer-form .full {
    grid-column:1/-1;
  }
}

.toast {
  position:fixed;
  bottom:112px;
  right:12px;
  left:12px;
  max-width:520px;
  margin:auto;
  background:var(--main);
  color:white;
  padding:12px 14px;
  border-radius:16px;
  box-shadow:var(--shadow);
  z-index:200;
  display:none;
  text-align:center;
  font-size:13px;
  font-weight:800;
}

.toast.show {
  display:block;
}