:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #1d4ed8;
  --primary-2: #1e40af;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 270px;
  background: linear-gradient(180deg, var(--primary-2), #0f2d75);
  color: #fff;
  padding: 14px;
  transition: .25s;
}
.sidebar.collapsed { width: 85px; }
.brand { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.15); padding-bottom: 12px; }
.logo { font-size: 30px; }
.brand h1 { margin: 0; font-size: 22px; }
.brand small { opacity: .8; }
.menu-btn {
  width: 100%; border: 0; border-radius: 10px; margin-top: 8px; padding: 12px;
  background: transparent; color: #fff; text-align: right; cursor: pointer;
}
.menu-btn.active, .menu-btn:hover { background: rgba(255,255,255,.15); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid #e5e7eb; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-info { display: flex; gap: 14px; align-items: center; }
.view { padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 5px 18px rgba(0,0,0,.06);
}
.stat { color: #fff; }
.stat.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat.green { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat.red { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.stat.purple { background: linear-gradient(135deg, #a855f7, #6d28d9); }
h2 { margin: 4px 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.list { max-height: 430px; overflow: auto; }
.product {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; margin-bottom: 8px; cursor: pointer;
}
.product:hover { border-color: var(--primary); }
.cart-item { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid #eee; padding:8px 0; }
input, select, textarea {
  width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 10px; outline: none;
}
label { font-size: 13px; color: var(--muted); margin-bottom: 5px; display:block; }
.form-row { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.btn {
  border: 0; background: var(--primary); color: #fff; padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warning); }
.btn.ghost { background: #eef2ff; color: #111827; }
.btn.small { padding: 6px 9px; font-size: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; background:#fff; border-radius:12px; overflow:hidden; }
th, td { padding: 10px; border-bottom: 1px solid #f1f5f9; text-align: right; white-space: nowrap; }
thead { background: #eff6ff; }
.badge { border-radius: 99px; padding: 3px 10px; font-size: 12px; }
.badge.red { background:#fee2e2; color:#b91c1c; }
.badge.green { background:#dcfce7; color:#166534; }
.badge.blue { background:#dbeafe; color:#1d4ed8; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.42); display: grid; place-items: center; z-index: 30;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(860px, 95vw); max-height: 90vh; overflow: auto; background: #fff; border-radius: 16px; padding: 14px;
}
.modal-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 10px; }
.actions { display:flex; gap:8px; flex-wrap: wrap; }
@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index:20; height:100vh; transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .cards { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: absolute; left:0; top:0; width: 80mm; }
}
