:root{
  --bg:#f6f7f9;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --brand:#2563eb;
  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --radius:14px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* ---------- Top Bar ---------- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: #2f2f2f;
  color: #fff;
  padding: 10px 12px;
}
.toprow{
  display:flex;
  align-items:center;
  gap:10px;
}

.btn, .chip, .iconbtn{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color:#fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1;
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
  text-decoration:none;
}
.btn:active, .chip:active, .iconbtn:active{ transform: translateY(1px); }

.btn.primary{
  background: var(--brand);
  border-color: transparent;
}

.caret{
  width:0;height:0;
  border-left:5px solid transparent;
  border-right:5px solid transparent;
  border-top:6px solid rgba(255,255,255,.85);
}

.iconbtn{
  width: 40px;
  height: 40px;
  padding:0;
  justify-content:center;
  border-radius: 999px;
  overflow:hidden;
}
.avatar{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}


/* Inventory rendering helpers */
.thumbImg{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  border-radius: 12px;
}

/* Badge variants (API provides green/yellow/red + out) */
.badge.green{ background:#16a34a; }
.badge.yellow{ background:#f59e0b; }
.badge.red{ background:#ef4444; }
.badge.out{ background:#6b7280; }

/* Optional grouping */
.productGroup{
  margin-bottom: 14px;
}
.productGroupTitle{
  margin: 8px 2px 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}


/* Dropdown base */
.dd{ position: relative; }
.menu{
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(92vw, 320px);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
  display:none;
}
.menu.left{
  left:0;
  right:auto;
  width: min(92vw, 340px);
}
.menu.open{ display:block; }

.menu h4{
  margin: 8px 10px 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.menu a, .menu button{
  width:100%;
  border:0;
  background: transparent;
  text-align:left;
  padding: 10px 10px;
  border-radius: 12px;
  cursor:pointer;
  font-size: 14px;
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  text-decoration:none;
}
.menu a:hover, .menu button:hover{
  background: #f3f4f6;
}
.divider{
  height:1px;
  background: var(--line);
  margin: 6px 8px;
}

/* Categories list */
.catgrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
  padding: 6px;
}
.cat{
  background:#f9fafb;
  border:1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  text-decoration:none;
  display:flex;
  align-items:center;
  justify-content:center;
}
.cat:active{ transform: translateY(1px); }

/* User header inside menu */
.userbox{
  display:flex;
  gap:10px;
  align-items:center;
  padding: 10px;
  border-radius: 12px;
  background:#f9fafb;
  border:1px solid var(--line);
  margin: 6px;
}
.userpic{
  width:44px;height:44px;border-radius:999px;object-fit:cover;
  border:1px solid var(--line);
}
.userinfo{ min-width:0; }
.username{
  font-weight:700;
  font-size: 14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.membersince{
  font-size:12px;
  color: var(--muted);
  margin-top:2px;
}

/* Chips */
.chipRow{
  display:flex;
  gap:10px;
  overflow:auto;
  padding-bottom: 2px;
  flex:1;
  -webkit-overflow-scrolling: touch;
}
.chipRow::-webkit-scrollbar{ display:none; }

/* ---------- Body ---------- */
.wrap{
  padding: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.pageHeader{
  margin: 14px 2px 12px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
}
.pageTitle{
  margin:0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .2px;
}
.pageSub{
  margin:0;
  font-size: 12px;
  color: var(--muted);
}

.contentCard{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

/* Optional: Search row */
.searchRow{
  display:flex;
  gap:10px;
  margin-top: 12px;
}
.search{
  flex:1;
  background: var(--card);
  border:1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  outline:none;
}

/* Optional: Product card example */
.sectionTitle{
  margin: 18px 2px 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .2px;
}
.productCard{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display:flex;
  gap:12px;
  align-items:center;
}
.thumb{
  width:74px;height:74px;
  border-radius: 12px;
  background:#f3f4f6;
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
}
.meta{ flex:1; min-width:0; }
.title{
  font-weight:800;
  font-size:16px;
  margin:0 0 4px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.price{
  font-weight:700;
  margin:0 0 6px;
}
.badge{
  display:inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
}
.addBtn{
  border:0;
  background:#16a34a;
  color:#fff;
  font-weight:800;
  padding: 10px 14px;
  border-radius: 12px;
  cursor:pointer;
  white-space:nowrap;
}

.note{
  margin: 18px 6px 0;
  color: var(--muted);
  text-align:center;
  line-height:1.5;
  font-size: 13px;
}

.badge{font-size:12px;padding:4px 8px;border-radius:999px;border:1px solid rgba(0,0,0,.12);background:rgba(0,0,0,.03)}
.badgePrimary {
  border-color: rgba(0, 0, 0, .18);
  background-color: #1e1eff;
}

/* ---------- Footer ---------- */
footer{
  margin-top: 18px;
  padding: 18px 12px 26px;
  text-align:center;
  color: var(--muted);
  font-size: 12px;
}
