@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --border: #e0e0e5;
  --border-light: #f0f0f3;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --accent: #007aff;
  --accent-hover: #0066dd;
  --accent-light: #e8f0fe;
  --green: #34c759;
  --green-light: #e8f8ed;
  --red: #ff3b30;
  --red-light: #fff0ef;
  --orange: #ff9500;
  --orange-light: #fff5e6;
  --purple: #5856d6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'DM Mono', monospace;
  --sidebar-w: 240px;
  --header-h: 60px;
  --transition: 0.18s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── LAYOUT ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
}

.shop-switcher {
  margin: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background var(--transition);
}

.shop-switcher:hover { background: var(--border-light); }

.shop-info { flex: 1; min-width: 0; }
.shop-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-loc { font-size: 11px; color: var(--text-3); }

.sidebar-nav { flex: 1; padding: 8px 10px; overflow-y: auto; }

.nav-section { margin-bottom: 20px; }
.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-light);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-3); }

.btn-logout {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 16px;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--red); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-bar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 20px;
  padding: 4px;
}

.page-title { font-size: 17px; font-weight: 600; color: var(--text); flex: 1; }

.top-bar-actions { display: flex; align-items: center; gap: 10px; }

.page-body { padding: 24px; flex: 1; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }

.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #ffe0de; }

.btn-success { background: var(--green-light); color: var(--green); }
.btn-success:hover { background: #d4f5de; }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: var(--radius); }

.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-icon.btn-secondary { border: 1px solid var(--border); }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--accent-light); }
.stat-icon.green { background: var(--green-light); }
.stat-icon.orange { background: var(--orange-light); }
.stat-icon.red { background: var(--red-light); }
.stat-icon.purple { background: #f0effe; }

.stat-info { flex: 1; }
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 600; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-required { color: var(--red); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,122,255,0.1); }
.form-control::placeholder { color: var(--text-3); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aeaeb2' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; }

.form-row { display: grid; gap: 14px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-grey { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close {
  background: var(--bg); border: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 16px;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 20px 24px 24px; }

/* ── SEARCH ── */
.search-wrap { position: relative; }
.search-wrap input { padding-left: 38px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 16px; pointer-events: none; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-title { font-size: 16px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.empty-text { font-size: 14px; }

/* ── TOAST ── */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease forwards;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  max-width: 340px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.warning { background: var(--orange); }

@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ── POS SCREEN ── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

.pos-products {
  padding: 16px;
  overflow-y: auto;
  background: var(--bg);
}

.pos-cart {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pos-search-bar input {
  flex: 1;
}

.category-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.active { background: var(--accent); border-color: var(--accent); color: white; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.product-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.product-card:active { transform: translateY(0); }
.product-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }

.product-card-name { font-size: 13px; font-weight: 500; margin-bottom: 6px; line-height: 1.3; }
.product-card-cat { font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.product-card-price { font-size: 15px; font-weight: 600; color: var(--accent); }
.product-card-stock { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.product-card-stock.low { color: var(--orange); }
.product-card-stock.out { color: var(--red); }

/* Cart */
.cart-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cart-title { font-size: 15px; font-weight: 600; }
.cart-count { background: var(--accent); color: white; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }

.cart-items { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }

.cart-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cart-item-name { font-size: 13px; font-weight: 500; }
.cart-item-unit { font-size: 11px; color: var(--text-3); }
.cart-item-remove { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 0; flex-shrink: 0; transition: color var(--transition); }
.cart-item-remove:hover { color: var(--red); }

.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qty-control { display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.qty-btn { background: none; border: none; cursor: pointer; width: 30px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text-2); transition: background var(--transition); }
.qty-btn:hover { background: var(--border-light); }
.qty-display { font-size: 13px; font-weight: 600; width: 32px; text-align: center; }
.cart-item-subtotal { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.cart-footer { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }

.cart-total-row { display: flex; justify-content: space-between; align-items: center; }
.cart-total-label { font-size: 13px; color: var(--text-2); }
.cart-total-value { font-size: 13px; font-variant-numeric: tabular-nums; }
.cart-total-row.grand { }
.cart-total-row.grand .cart-total-label { font-size: 15px; font-weight: 600; color: var(--text); }
.cart-total-row.grand .cart-total-value { font-size: 20px; font-weight: 700; color: var(--text); }

.payment-section { display: flex; flex-direction: column; gap: 8px; }

.payment-methods { display: flex; gap: 6px; }
.pay-method {
  flex: 1;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  color: var(--text-2);
}
.pay-method:hover { border-color: var(--accent); color: var(--accent); }
.pay-method.active { background: var(--accent); border-color: var(--accent); color: white; }

.amount-input-wrap { position: relative; }
.amount-input-wrap input { padding-left: 52px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; height: 48px; }
.amount-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 500; color: var(--text-3); pointer-events: none; }

.change-display {
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  display: none;
}
.change-display.visible { display: flex; }
.change-label { font-size: 13px; color: var(--green); font-weight: 500; }
.change-value { font-size: 18px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }

.charge-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.charge-btn:hover { background: var(--accent-hover); }
.charge-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Unit picker modal */
.unit-picker-grid { display: grid; gap: 8px; }
.unit-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.unit-option:hover { border-color: var(--accent); background: var(--accent-light); }
.unit-option-name { font-size: 14px; font-weight: 500; }
.unit-option-qty { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.unit-option-price { font-size: 16px; font-weight: 600; color: var(--accent); }

/* ── LOGIN PAGE ── */
.auth-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.auth-brand { text-align: center; margin-bottom: 32px; }
.auth-logo { width: 56px; height: 56px; background: var(--accent); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: white; margin: 0 auto 14px; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: var(--text-3); }

.auth-tabs { display: flex; gap: 0; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; text-align: center; padding: 8px; font-size: 14px; font-weight: 500; border-radius: 7px; cursor: pointer; transition: all var(--transition); color: var(--text-2); border: none; background: none; font-family: var(--font);
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.auth-form { display: none; }
.auth-form.active { display: block; }

/* ── SHOP SELECTOR ── */
.shop-select-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shop-select-card { background: var(--surface); border-radius: var(--radius-xl); padding: 32px; width: 100%; max-width: 500px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.shop-select-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.shop-select-sub { font-size: 14px; color: var(--text-3); margin-bottom: 24px; }

.shop-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.shop-option {
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; display: flex; align-items: center; gap: 14px; transition: all var(--transition);
}
.shop-option:hover { border-color: var(--accent); background: var(--accent-light); }
.shop-option-icon { width: 40px; height: 40px; background: var(--accent-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.shop-option-name { font-size: 15px; font-weight: 600; }
.shop-option-loc { font-size: 13px; color: var(--text-3); }
.shop-option-arrow { margin-left: auto; color: var(--text-3); }

/* ── INVENTORY ── */
.stock-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.stock-chip.good { background: var(--green-light); color: var(--green); }
.stock-chip.low { background: var(--orange-light); color: var(--orange); }
.stock-chip.out { background: var(--red-light); color: var(--red); }

/* ── REPORTS ── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* ── RESPONSIVE ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition);
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pos-layout { grid-template-columns: 1fr 340px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .page-body { padding: 16px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 18px; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: auto; }
  .pos-cart { max-height: 60vh; border-left: none; border-top: 2px solid var(--border); }
  .pos-products { min-height: 300px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .auth-card { padding: 28px 22px; }
  .modal { max-width: 100%; margin: 0 10px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .payment-methods .pay-method { font-size: 11px; padding: 7px 4px; }
  .top-bar { padding: 0 14px; }
  .page-body { padding: 12px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 13px; }
.font-mono { font-family: var(--mono); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border-light); margin: 14px 0; }

/* ── PRODUCT CARD UNIT HINTS (POS) ── */
.product-card-units {
  font-size: 11px;
  color: var(--text-2);
  margin: 4px 0 6px;
  line-height: 1.5;
}
.product-card-units strong { color: var(--accent); }

/* ── UNIT ROW in product modal ── */
.unit-row {
  display: grid;
  grid-template-columns: 1fr auto auto 28px;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
}
@media (max-width: 560px) {
  .unit-row {
    grid-template-columns: 1fr 28px;
    grid-template-rows: auto auto auto;
  }
  .unit-row > div { grid-column: 1; }
}

/* ── COST PREVIEW ── */
#cost-per-unit-preview {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  margin-top: 3px;
}

/* ── INVENTORY TABLE extra columns ── */
.packet-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  padding: 2px 8px;
}
