/* ============================================
   نظام إدارة مبيعات السوبر ماركت - v4
   - قائمة منزلقة مغلقة افتراضياً
   - بطاقات أصناف بحدود سوداء وخلفية خضراء فاتحة
   - تخطيط متجاوب مع طي/فتح القائمة
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Tajawal:wght@400;500;700&display=swap');

:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #14b8a6;
  --primary-50: #f0fdfa;
  --primary-100: #ccfbf1;

  --tile-bg: #f0fdf4;        /* خلفية أخضر فاتح للبطاقات */
  --tile-bg-hover: #dcfce7;
  --tile-border: #86efac;    /* حد أخضر فاتح */
  --tile-border-strong: #1e293b; /* حد أسود واضح */

  --accent: #f59e0b;
  --accent-dark: #d97706;

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ea580c;
  --info: #2563eb;
  --purple: #7c3aed;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-soft: #f1f5f9;

  --text: #000000;          /* أسود غامق للنص الأساسي */
  --text-soft: #1e293b;     /* أسود خفيف للنص الثانوي */
  --text-muted: #475569;    /* رمادي داكن للنص الباهت */

  --border: #e2e8f0;
  --border-soft: #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;

  --transition: 0.2s ease;

  --sidebar-w: 220px;
  --topbar-h: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14.5px; }

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.55;
}

button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

input[type="number"], input[type="tel"], input[type="date"] {
  direction: ltr;
  text-align: right;
  font-feature-settings: "tnum"; /* أرقام منتظمة */
}

/* ===== Layout (sidebar collapsed by default) ===== */
.app {
  display: grid;
  grid-template-columns: 0 1fr; /* مغلق افتراضياً */
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.app.sidebar-open {
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ===== Sidebar ===== */
.sidebar {
  background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
  color: white;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease, width 0.25s ease;
  width: var(--sidebar-w);
  z-index: 50;
  transform: translateX(100%); /* مخفي افتراضياً */
}

.app.sidebar-open .sidebar {
  transform: translateX(0);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo {
  width: 32px; height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.brand-text p { font-size: 0.66rem; opacity: 0.7; font-weight: 400; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.55rem;
}

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-section { margin-bottom: 0.55rem; }

.nav-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  padding: 0 0.55rem 0.25rem;
  font-weight: 600;
}

.nav-link {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.08rem;
  transition: var(--transition);
}

.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.nav-link.active { background: rgba(255, 255, 255, 0.15); color: white; font-weight: 600; }

.nav-icon { font-size: 0.92rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 0.55rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.15);
}

.user-card {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255,255,255,0.08);
  border-radius: 7px;
  margin-bottom: 0.4rem;
}

.user-avatar {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.65rem; opacity: 0.7; }

.logout-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.45rem;
  background: rgba(220, 38, 38, 0.2);
  color: white;
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover { background: rgba(220, 38, 38, 0.4); }

/* ===== Main ===== */
.main {
  padding: 0.7rem 1.1rem 1.5rem;
  max-width: 100%;
  overflow-x: hidden;
  min-width: 0;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  gap: 0.5rem;
}

.menu-toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  width: 34px; height: 34px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  color: var(--text-soft);
  transition: var(--transition);
  flex-shrink: 0;
}

.menu-toggle:hover { background: var(--primary); color: white; border-color: var(--primary); }

.page-title { flex: 1; min-width: 0; }
.page-title h2 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-title p {
  color: var(--text-soft);
  font-size: 0.76rem;
  margin-top: 0.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-extra { display: flex; gap: 0.45rem; align-items: center; flex-shrink: 0; }

/* Backdrop */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
  display: none;
}

@media (max-width: 768px) {
  .sidebar { position: fixed; right: 0; }
  .app.sidebar-open .sidebar-backdrop { display: block; }
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  position: relative;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card .icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.55rem;
}

.stat-card .label { color: var(--text-soft); font-size: 0.76rem; margin-bottom: 0.15rem; }
.stat-card .value { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .change { font-size: 0.72rem; margin-top: 0.25rem; color: var(--success); }

.stat-card.green .icon { background: #dcfce7; color: #15803d; }
.stat-card.blue .icon { background: #dbeafe; color: #1d4ed8; }
.stat-card.amber .icon { background: #fef3c7; color: #b45309; }
.stat-card.red .icon { background: #fee2e2; color: #b91c1c; }
.stat-card.purple .icon { background: #ede9fe; color: #6d28d9; }
.stat-card.teal .icon { background: var(--primary-100); color: var(--primary-dark); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 1.1rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #c2410c; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.4rem; font-size: 0.95rem; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 7px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 0.9rem; }
.form-group label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-soft);
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg-card);
  transition: var(--transition);
  font-feature-settings: "tnum";
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea.form-control { resize: vertical; min-height: 70px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }

table th {
  text-align: right;
  padding: 0.7rem 0.85rem;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

table tr:hover td { background: var(--bg-soft); }
table tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 0.3rem; }

.action-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg-soft);
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition);
}

.action-btn:hover { background: var(--border); }
.action-btn.edit:hover { background: #dbeafe; color: var(--info); }
.action-btn.delete:hover { background: #fee2e2; color: var(--danger); }
.action-btn.success:hover { background: #dcfce7; color: var(--success); }

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 30px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-soft { background: var(--bg-soft); color: var(--text-soft); }

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.search-box { position: relative; flex: 1; max-width: 380px; }

.search-box input {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  background: var(--bg-card);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  right: 0.6rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  animation: fadeIn 0.18s ease;
}

.modal-backdrop.active { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: scaleIn 0.18s ease;
}

.modal.sm { max-width: 380px; }
.modal.md { max-width: 620px; }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 950px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h3 { font-size: 1.02rem; font-weight: 700; }

.modal-close {
  background: none; border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 6px;
}

.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-body { padding: 1.1rem; }

.modal-footer {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-soft);
  flex-wrap: wrap;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 1rem; left: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.toast {
  background: white;
  padding: 0.7rem 1rem;
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-right: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 260px;
  animation: slideInLeft 0.22s ease;
  font-weight: 500;
  font-size: 0.88rem;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

@keyframes slideInLeft {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 30%, rgba(20, 184, 166, 0.18), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.12), transparent 50%),
    linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
  padding: 1rem;
}

.login-card {
  background: white;
  padding: 2.2rem;
  border-radius: 18px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 400px;
}

.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  margin: 0 auto 1.1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; color: white;
}

.login-card h1 { text-align: center; font-size: 1.35rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-card .sub { text-align: center; color: var(--text-soft); font-size: 0.85rem; margin-bottom: 1.5rem; }

.demo-creds {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  color: var(--primary-dark);
  margin-bottom: 0.9rem;
}

.demo-creds strong { font-weight: 700; }

/* ============================================
   POS - تخطيط v4 المُحسّن
   - 3 أعمدة افتراضي / 2 عمود عند فتح القائمة
   - السلة عمودية كاملة - بطاقة أصغر
   ============================================ */

.pos-page {
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pos-container {
  display: grid;
  grid-template-columns: 1fr 480px;  /* السلة أعرض - 480px بدلاً من 340px */
  flex: 1;
  min-height: 0;
}

.pos-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 2px solid #000;  /* حد أسود واضح */
  background: white;
  overflow: hidden;
}

/* الشريط العلوي للـ POS - خلفية بيضاء + حدود سوداء */
.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-bottom: 2px solid #000;  /* حد أسود واضح */
  background: white;  /* خلفية بيضاء */
  min-height: 44px;
  gap: 0.45rem;
  flex-shrink: 0;
}

.pos-header .pos-title { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.pos-header h2 { font-size: 0.95rem; font-weight: 700; white-space: nowrap; color: #000; }
.pos-header .info { font-size: 0.7rem; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pos-header-actions { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }

.pos-products {
  padding: 0.45rem 0.7rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* البحث + الكمية */
.pos-search-row {
  display: grid;
  grid-template-columns: 1fr 75px;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
}

.pos-search { position: relative; }

.pos-search input {
  width: 100%;
  padding: 0.4rem 1.7rem 0.4rem 0.6rem;
  border: 1.5px solid #000;  /* حد أسود واضح */
  border-radius: 7px;
  font-size: 0.85rem;
  background: white;  /* خلفية بيضاء */
  color: #000;
  font-weight: 500;
}

.pos-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}

.pos-search::before {
  content: "🔍";
  position: absolute;
  right: 0.45rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.74rem;
  opacity: 0.5;
  pointer-events: none;
}

.pos-qty-input {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  background: white;  /* خلفية بيضاء */
  border: 1.5px solid #000;  /* حد أسود */
  border-radius: 7px;
  padding: 0 0.25rem;
}

.pos-qty-input label {
  font-size: 0.72rem;
  color: #000;
  font-weight: 700;
}

.pos-qty-input input {
  flex: 1;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #000;
  padding: 0.35rem 0;
  width: 100%;
}

.pos-qty-input input:focus { outline: none; }

/* شريط التصنيفات */
.cat-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  flex-shrink: 0;
}

.cat-tabs::-webkit-scrollbar { height: 3px; }
.cat-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cat-tab {
  padding: 0.3rem 0.7rem;
  border: 1.5px solid #000;  /* حد أسود واضح */
  border-radius: 25px;
  background: white;  /* خلفية بيضاء */
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  color: #000;
}

.cat-tab.active {
  background: var(--primary);
  color: white;
  border-color: #000;
}

/* شبكة المنتجات */
.product-grid-wrap { flex: 1; overflow-y: auto; padding-right: 0.15rem; min-height: 0; }
.product-grid-wrap::-webkit-scrollbar { width: 6px; }
.product-grid-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* افتراضي: 3 أعمدة عند طي القائمة */
  gap: 0.4rem;
}

.app.sidebar-open .product-grid {
  grid-template-columns: repeat(2, 1fr); /* عمودان فقط عند فتح القائمة */
}

.product-tile {
  background: var(--tile-bg); /* خلفية أخضر فاتح موحدة */
  border: 1.5px solid var(--tile-border-strong); /* حد أسود واضح */
  border-radius: 9px;
  padding: 0.45rem 0.35rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  user-select: none;
}

.product-tile:hover {
  background: var(--tile-bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.product-tile .emoji { font-size: 1.4rem; margin-bottom: 0.08rem; line-height: 1; }

.product-tile .name {
  font-weight: 700;
  font-size: 0.74rem;
  margin-bottom: 0.12rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  color: #000;
}

.product-tile .price {
  color: #000;
  font-weight: 700;
  font-size: 0.82rem;
  font-feature-settings: "tnum";
}

.product-tile .stock {
  font-size: 0.65rem;
  color: #1e293b;
  margin-top: 0.05rem;
  font-feature-settings: "tnum";
  font-weight: 600;
}

.product-tile.out-of-stock { opacity: 0.5; cursor: not-allowed; }

.products-info {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.3rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.25rem;
  flex-shrink: 0;
}

/* ===== سلة المشتريات ===== */
.pos-cart {
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  border-right: 2.5px solid #000;  /* حد أسود واضح */
}

.pos-cart-header {
  padding: 0.5rem 0.7rem;
  background: var(--primary);
  color: white;
  flex-shrink: 0;
  border-bottom: 2px solid #000;
}

.pos-cart-header .top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.pos-cart-header h3 { font-size: 0.92rem; font-weight: 700; }

.mode-toggle {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 2px;
}

.mode-toggle button {
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.8);
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.mode-toggle button.active {
  background: white;
  color: var(--primary-dark);
}

.cart-customer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem;
}

.cart-customer-row select {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.26rem 0.45rem;
  border-radius: 6px;
  font-size: 0.76rem;
  width: 100%;
}

.cart-customer-row select option { color: var(--text); }

.cart-suspend-btn {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  padding: 0.26rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.cart-suspend-btn:hover { background: rgba(255,255,255,0.28); }

/* عناصر السلة */
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem;
  min-height: 0;
}

.pos-cart-items::-webkit-scrollbar { width: 5px; }
.pos-cart-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  background: white;
  border-radius: 8px;
  margin-bottom: 0.35rem;
  border: 1.5px solid #000;  /* حد أسود واضح */
}

.cart-item-name-block {
  min-width: 0;
}

.cart-item-name {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.12rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #000;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,0.3);
  text-underline-offset: 2px;
}

.cart-item-name:hover {
  color: var(--primary-dark);
  text-decoration-color: var(--primary);
}

.cart-item-price {
  font-size: 0.76rem;
  color: #1e293b;
  font-feature-settings: "tnum";
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline dashed;
  text-decoration-color: rgba(0,0,0,0.4);
  text-underline-offset: 2px;
}

.cart-item-price:hover {
  color: var(--primary-dark);
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #000;  /* حد أسود */
  border-radius: 6px;
  overflow: hidden;
  background: white;
}

.qty-control button {
  width: 26px; height: 28px;
  border: none;
  background: var(--bg-soft);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: #000;
}

.qty-control button:hover { background: var(--primary); color: white; }

.qty-control input {
  width: 42px; height: 28px;
  border: none;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  background: white;
  color: #000;
  -moz-appearance: textfield;
  font-feature-settings: "tnum";  /* أرقام إنجليزية صريحة */
  font-variant-numeric: tabular-nums lining-nums;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item-total {
  font-weight: 800;
  color: #000;
  font-size: 0.92rem;
  white-space: nowrap;
  text-align: left;
  min-width: 80px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
}

.cart-item-remove {
  width: 28px; height: 28px;
  background: #fee2e2;
  border: 1.5px solid #000;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.85rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.cart-item-remove:hover { background: var(--danger); color: white; }

/* ملخص السلة - مدمج */
.pos-cart-summary {
  border-top: 2px solid #000;
  background: #d1fae5;  /* خلفية خضراء فاتحة */
  padding: 0.5rem 0.65rem;
  flex-shrink: 0;
}

.summary-compact {
  background: white;
  border: 1.5px solid #000;
  border-radius: 7px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  color: #000;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
  color: #000;
  font-weight: 600;
}

.summary-row.total {
  font-size: 1.05rem;
  font-weight: 800;
  border-top: 1.5px dashed #000;
  padding-top: 0.32rem;
  margin-top: 0.2rem;
  color: var(--primary-dark);
}

.summary-row .discount-input {
  width: 70px;
  padding: 0.08rem 0.3rem;
  border: 1.5px solid #000;
  border-radius: 4px;
  text-align: center;
  font-size: 0.8rem;
  font-feature-settings: "tnum";
  color: #000;
  font-weight: 600;
}

.cart-buttons {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.3rem;
}

.cart-buttons .btn { padding: 0.55rem; font-size: 0.82rem; }

/* وضع المرتجعات */
body.returns-mode .pos-cart-header { background: var(--danger); }
body.returns-mode .pos-cart {
  border-right-color: var(--danger);
}
body.returns-mode .summary-row.total { color: var(--danger); }
body.returns-mode .cart-item-total { color: #b91c1c; }

/* ============================================
   نافذة الدفع
   ============================================ */
.payment-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.payment-method {
  border: 2px solid var(--border);
  background: white;
  border-radius: 10px;
  padding: 0.65rem 0.4rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.payment-method.active {
  border-color: var(--primary);
  background: var(--primary-50);
}

.payment-method.credit.active {
  border-color: var(--warning);
  background: #fff7ed;
}

.payment-method .pm-icon { font-size: 1.3rem; margin-bottom: 0.18rem; }
.payment-method .pm-name { font-size: 0.76rem; font-weight: 600; }

.payment-quick-amounts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.payment-quick-amounts button {
  padding: 0.35rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-feature-settings: "tnum";
}

.payment-quick-amounts button:hover {
  background: var(--primary-50);
  border-color: var(--primary);
}

.payment-summary {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: 10px;
  padding: 0.7rem;
  margin-bottom: 0.85rem;
}

.payment-summary .row {
  display: flex; justify-content: space-between;
  padding: 0.2rem 0;
  font-size: 0.86rem;
  font-feature-settings: "tnum";
}

.payment-summary .row.big {
  font-size: 1.05rem;
  font-weight: 700;
  border-top: 1px dashed var(--primary-100);
  padding-top: 0.4rem;
  margin-top: 0.3rem;
  color: var(--primary-dark);
}

.payment-summary .row.change { color: var(--success); }
.payment-summary .row.due { color: var(--warning); font-weight: 600; }

.payment-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 700px) {
  .payment-grid-2col { grid-template-columns: 1fr; }
  .payment-quick-amounts { grid-template-columns: repeat(3, 1fr); }
}

/* خيارات الطباعة في فوتر نافذة الدفع */
.print-options {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.print-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.print-options input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.print-options select {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

/* الإيصال - حراري */
.receipt {
  font-family: 'Courier New', monospace;
  background: white;
  padding: 1rem;
  max-width: 320px;
  margin: 0 auto;
  font-size: 0.82rem;
}

.receipt h2 { text-align: center; font-size: 1.15rem; margin-bottom: 0.25rem; }
.receipt .center { text-align: center; }
.receipt hr { border: none; border-top: 1px dashed #999; margin: 0.5rem 0; }

.receipt-line {
  display: flex; justify-content: space-between;
  padding: 0.1rem 0;
  font-feature-settings: "tnum";
}

/* فاتورة A4 */
.receipt-a4 {
  font-family: 'Cairo', sans-serif;
  background: white;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  font-size: 0.95rem;
}

.receipt-a4 h1 { font-size: 1.5rem; text-align: center; margin-bottom: 0.4rem; color: var(--primary-dark); }
.receipt-a4 .a4-header { text-align: center; padding-bottom: 1rem; border-bottom: 2px solid var(--primary); margin-bottom: 1.2rem; }
.receipt-a4 .a4-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1.5rem; margin-bottom: 1.2rem; padding: 0.85rem 1rem; background: var(--bg-soft); border-radius: 8px; }
.receipt-a4 .a4-meta-item { display: flex; gap: 0.3rem; font-size: 0.9rem; }
.receipt-a4 .a4-meta-item strong { color: var(--text-soft); min-width: 90px; }
.receipt-a4 table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-feature-settings: "tnum"; }
.receipt-a4 table th { background: var(--primary); color: white; padding: 0.6rem 0.7rem; text-align: right; font-size: 0.85rem; }
.receipt-a4 table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.receipt-a4 .a4-totals { margin-top: 1rem; padding: 1rem 1.2rem; background: var(--primary-50); border-radius: 10px; }
.receipt-a4 .a4-totals .row { display: flex; justify-content: space-between; padding: 0.3rem 0; font-feature-settings: "tnum"; }
.receipt-a4 .a4-totals .row.big { font-size: 1.2rem; font-weight: 700; color: var(--primary-dark); border-top: 1px dashed var(--primary-100); padding-top: 0.5rem; margin-top: 0.4rem; }
.receipt-a4 .a4-footer { margin-top: 2rem; text-align: center; padding-top: 1rem; border-top: 1px dashed var(--border); color: var(--text-muted); font-size: 0.83rem; }

/* @media print: للطباعة الحرارية أو A5 */
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area {
    position: absolute;
    inset: 0;
    margin: 0;
  }
  .modal-footer, .modal-header, .modal-close, .no-print { display: none !important; }
  @page { margin: 0.5cm; }
}

/* صفحة الصلاحية */
.expiry-card {
  border-right-width: 4px;
  border-right-style: solid;
}

.expiry-card.expired { border-right-color: var(--danger); background: #fef2f2; }
.expiry-card.warning { border-right-color: var(--warning); background: #fff7ed; }
.expiry-card.soon { border-right-color: var(--accent); background: #fefce8; }
.expiry-card.ok { border-right-color: var(--success); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state .emoji { font-size: 2.6rem; margin-bottom: 0.6rem; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* Responsive */
@media (max-width: 1200px) {
  .pos-container { grid-template-columns: 1fr 420px; }
}

@media (max-width: 1000px) {
  .pos-container { grid-template-columns: 1fr 380px; }
}

@media (max-width: 900px) {
  .pos-container { grid-template-columns: 1fr; }
  .pos-cart { height: auto; max-height: 50vh; }
  .pos-cart-items { max-height: 250px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .app.sidebar-open .product-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Utilities */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-bold { font-weight: 700; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.hidden { display: none !important; }

.amount-debt { color: var(--danger); font-weight: 700; }
.amount-credit { color: var(--success); font-weight: 700; }
.amount-zero { color: var(--text-muted); }

/* قائمة الفواتير المعلقة */
.suspended-list { max-height: 400px; overflow-y: auto; }
.suspended-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.suspended-item:hover { background: var(--primary-50); border-color: var(--primary); }
.suspended-item .info h4 { font-size: 0.92rem; font-weight: 700; margin-bottom: 0.2rem; }
.suspended-item .info p { font-size: 0.75rem; color: var(--text-soft); }
.suspended-item .meta { text-align: left; }
.suspended-item .meta .total { font-weight: 700; color: var(--primary-dark); font-size: 0.95rem; font-feature-settings: "tnum"; }
.suspended-item .meta .count { font-size: 0.72rem; color: var(--text-muted); }

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border);
  transition: 0.25s;
  border-radius: 24px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
}

.switch input:checked + .slider { background-color: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(-20px); }

/* Settings rows */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 0.7rem;
}

.setting-row:last-child { border-bottom: none; }
.setting-row .label-block h4 { font-size: 0.92rem; font-weight: 600; margin-bottom: 0.15rem; }
.setting-row .label-block p { font-size: 0.78rem; color: var(--text-soft); }

/* Error log */
.error-log-item {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.4rem;
  font-size: 0.83rem;
  border-right: 4px solid var(--danger);
  background: #fef2f2;
}

.error-log-item.warning { border-right-color: var(--warning); background: #fff7ed; }
.error-log-item.info { border-right-color: var(--info); background: #eff6ff; }
.error-log-item .meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* مكتبة الإيموجي */
.emoji-picker {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.25rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.55rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.emoji-picker button {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: white;
  border-radius: 6px;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.emoji-picker button:hover {
  border-color: var(--primary);
  background: var(--primary-50);
  transform: scale(1.1);
}

.emoji-picker-categories {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.emoji-picker-categories button {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 16px;
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
}

.emoji-picker-categories button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* إيقونة فتح الإيموجي بجانب حقل */
.emoji-input-wrap {
  position: relative;
  display: flex;
  gap: 0.35rem;
}

.emoji-input-wrap input {
  flex: 1;
  text-align: center;
  font-size: 1.4rem;
  padding: 0.4rem;
}

.emoji-pick-btn {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  color: var(--primary-dark);
  border-radius: 7px;
  padding: 0 0.85rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.emoji-pick-btn:hover { background: var(--primary-100); }

/* ===== نافذة تفاصيل المنتج ===== */
.product-details {
  text-align: center;
}

.product-details .big-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.product-details .product-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #000;
  margin-bottom: 0.5rem;
}

.product-details .barcode {
  font-family: 'Courier New', monospace;
  background: var(--bg-soft);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  display: inline-block;
  font-size: 0.85rem;
  color: #000;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  text-align: right;
  margin-top: 0.85rem;
}

.detail-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.detail-item .label {
  font-size: 0.74rem;
  color: var(--text-soft);
  margin-bottom: 0.15rem;
}

.detail-item .value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #000;
  font-feature-settings: "tnum";
}

.detail-item.full-width { grid-column: 1 / -1; }

/* ===== نافذة تعديل السعر ===== */
.price-edit-box {
  text-align: center;
  padding: 0.5rem 0;
}

.price-edit-box .item-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #000;
}

.price-edit-box .original-price {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 1rem;
}

.price-edit-input {
  width: 100%;
  padding: 0.85rem;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid #000;
  border-radius: 10px;
  background: #f0fdf4;
  color: #000;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
}

.price-quick-adjust {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.price-quick-adjust button {
  padding: 0.55rem;
  border: 1.5px solid #000;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: var(--transition);
  color: #000;
}

.price-quick-adjust button:hover {
  background: var(--primary);
  color: white;
}

.price-quick-adjust button.minus { background: #fee2e2; color: var(--danger); }
.price-quick-adjust button.minus:hover { background: var(--danger); color: white; }
.price-quick-adjust button.plus { background: #dcfce7; color: var(--success); }
.price-quick-adjust button.plus:hover { background: var(--success); color: white; }

/* تطبيق الخط الأسود الغامق على الجسم العام */
body {
  color: #000;
}

table td {
  color: #000;
}

.form-control {
  color: #000;
}

/* ===== أزرار الشريط العلوي للـ POS بلون أخضر ===== */
.pos-header .menu-toggle {
  background: var(--primary);
  border: 1.5px solid #000;
  color: white;
  font-weight: 700;
}

.pos-header .menu-toggle:hover {
  background: var(--primary-dark);
  color: white;
  border-color: #000;
}

.pos-header .pos-header-actions .btn-secondary,
.pos-header .pos-header-actions .btn {
  background: var(--primary);
  color: white;
  border: 1.5px solid #000;
  font-weight: 700;
}

.pos-header .pos-header-actions .btn:hover {
  background: var(--primary-dark);
  color: white;
}

/* زر فتح نقطة بيع جديدة (+) - بنفس حجم ولون زر المعلقة */
.new-pos-btn {
  background: var(--primary);
  color: white;
  border: 1.5px solid #000;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.new-pos-btn .plus-sign {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

.new-pos-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* ===== بطاقات المنتجات: خلفية بيضاء + إيموجي ضخم خفيف + توهج أخضر داخلي ===== */
.product-tile {
  background: white !important;  /* خلفية بيضاء */
  border: 1.5px solid #000 !important;
  border-radius: 9px;
  padding: 0.5rem 0.4rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  user-select: none;
  overflow: hidden;
  isolation: isolate;
  /* توهج أخضر داخلي بسيط */
  box-shadow: inset 0 0 12px rgba(15, 118, 110, 0.18),
              inset 0 0 4px rgba(20, 184, 166, 0.15);
}

/* الإيموجي الضخم في الخلفية - شفاف وكبير */
.product-tile::before {
  content: attr(data-bg-emoji);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
  line-height: 1;
}

.product-tile:hover {
  background: #f0fdf4 !important;
  transform: translateY(-1px);
  /* توهج أقوى عند المرور */
  box-shadow: inset 0 0 18px rgba(15, 118, 110, 0.3),
              inset 0 0 6px rgba(20, 184, 166, 0.25),
              0 4px 12px rgba(15, 23, 42, 0.08);
}

.product-tile:hover::before {
  opacity: 0.12;
}

/* جعل المحتوى فوق الإيموجي الضخم */
.product-tile .emoji,
.product-tile .name,
.product-tile .price,
.product-tile .stock {
  position: relative;
  z-index: 1;
}

/* ===== سلة - عدد الأصناف والقطع ===== */
.cart-counts {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  margin-top: 0.15rem;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
}

.cart-counts .badge-count {
  background: rgba(255,255,255,0.22);
  padding: 0.08rem 0.45rem;
  border-radius: 30px;
  margin-left: 0.25rem;
}

/* ===== لوحة الأرقام اللمسية ===== */
.numpad-display {
  background: #f0fdf4;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.75rem;
  color: #000;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.numpad-grid button {
  padding: 0.85rem 0.4rem;
  border: 1.5px solid #000;
  background: white;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  color: #000;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
  user-select: none;
}

.numpad-grid button:hover {
  background: #d1fae5;
}

.numpad-grid button:active {
  background: var(--primary);
  color: white;
  transform: scale(0.96);
}

.numpad-grid button.special {
  background: #fee2e2;
  color: var(--danger);
}

.numpad-grid button.special:hover {
  background: var(--danger);
  color: white;
}

.numpad-grid button.confirm {
  background: var(--success);
  color: white;
  grid-column: span 1;
}

.numpad-grid button.confirm:hover {
  background: #15803d;
}

.numpad-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.numpad-row-actions button {
  padding: 0.7rem;
  border: 1.5px solid #000;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}

.numpad-quick-adjust {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.numpad-quick-adjust button {
  padding: 0.55rem;
  border: 1.5px solid #000;
  background: white;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.84rem;
  color: #000;
  font-feature-settings: "tnum";
}

.numpad-quick-adjust button.minus { background: #fee2e2; color: var(--danger); }
.numpad-quick-adjust button.minus:hover { background: var(--danger); color: white; }
.numpad-quick-adjust button.plus { background: #dcfce7; color: var(--success); }
.numpad-quick-adjust button.plus:hover { background: var(--success); color: white; }

/* ===== نافذة تعديل العنصر (سعر + كمية) - أفقي مدمج ===== */
.cart-edit-modal {
  max-width: 720px !important;
}

.cart-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.4rem;
}

.cart-edit-section {
  background: #f8fafc;
  border: 1.5px solid #000;
  border-radius: 10px;
  padding: 0.7rem;
}

.cart-edit-section .section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #000;
  margin-bottom: 0.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.cart-edit-display {
  background: white;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 0.55rem;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.55rem;
  color: #000;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums lining-nums;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.cart-edit-display.active {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.cart-edit-display:hover {
  border-color: var(--primary);
}

.cart-edit-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.cart-edit-quick button {
  padding: 0.4rem 0.2rem;
  border: 1.5px solid #000;
  background: white;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  color: #000;
  font-feature-settings: "tnum";
}

.cart-edit-quick button.minus { background: #fee2e2; color: var(--danger); }
.cart-edit-quick button.minus:hover { background: var(--danger); color: white; }
.cart-edit-quick button.plus { background: #dcfce7; color: var(--success); }
.cart-edit-quick button.plus:hover { background: var(--success); color: white; }

/* لوحة الأرقام المدمجة في النافذة */
.cart-edit-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.cart-edit-numpad button {
  padding: 0.5rem 0.2rem;
  border: 1.5px solid #000;
  background: white;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  color: #000;
  font-feature-settings: "tnum";
  user-select: none;
  transition: var(--transition);
}

.cart-edit-numpad button:hover {
  background: #d1fae5;
}

.cart-edit-numpad button:active {
  background: var(--primary);
  color: white;
  transform: scale(0.96);
}

.cart-edit-numpad button.special {
  background: #fee2e2;
  color: var(--danger);
}

.cart-edit-numpad button.special:hover {
  background: var(--danger);
  color: white;
}

/* معلومات المنتج المضغوطة في رأس النافذة */
.product-info-compact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: center;
  background: white;
  border: 1.5px solid #000;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.7rem;
}

.product-info-compact .pic {
  width: 56px;
  height: 56px;
  background: #f0fdf4;
  border: 1.5px solid #000;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.product-info-compact .info h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #000;
  margin-bottom: 0.18rem;
}

.product-info-compact .info .meta {
  font-size: 0.76rem;
  color: #1e293b;
  font-feature-settings: "tnum";
}

.product-info-compact .info .meta strong {
  color: var(--primary-dark);
}

/* تفاصيل المنتج - شبكة أفقية مدمجة بدون scroll */
.product-details-modal {
  max-width: 720px !important;
}

.product-details-compact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}

.product-details-compact .left-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem;
  min-width: 160px;
}

.product-details-compact .left-col .big-emoji {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.product-details-compact .left-col .product-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #000;
  margin-bottom: 0.3rem;
}

.product-details-compact .left-col .barcode {
  font-family: 'Courier New', monospace;
  background: #f0fdf4;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #000;
  border: 1px solid var(--border);
  font-feature-settings: "tnum";
}

.product-details-compact .right-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.product-details-compact .detail-cell {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.product-details-compact .detail-cell .label {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin-bottom: 0.08rem;
}

.product-details-compact .detail-cell .value {
  font-size: 0.86rem;
  font-weight: 700;
  color: #000;
  font-feature-settings: "tnum";
}

.product-details-compact .detail-cell.full {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .cart-edit-grid { grid-template-columns: 1fr; }
  .product-details-compact { grid-template-columns: 1fr; }
  .product-details-compact .right-col { grid-template-columns: 1fr 1fr; }
}
