﻿/* ============ VTE Express - نظام التصميم العربي RTL ============ */
/* خط Cairo المضمّن للعربية */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/cairo/Cairo-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 500;
  src: url('/fonts/cairo/Cairo-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  src: url('/fonts/cairo/Cairo-SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  src: url('/fonts/cairo/Cairo-Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 800;
  src: url('/fonts/cairo/Cairo-Black.ttf') format('truetype');
}
:root {
  --primary: #1e3a8a;
  --primary-dark: #152a63;
  --primary-light: #3b5bdb;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
  --radius: 14px;
  --radius-sm: 10px;
}

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

html, body {
  height: 100%;
  direction: rtl;
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

#app { height: 100%; }

/* ---------- تسجيل الدخول ---------- */
.login-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 100%);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
}
.login-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 34px; font-weight: 800;
  margin: 0 auto 16px;
}
.login-card h1 { text-align: center; font-size: 22px; color: var(--primary); }
.login-card p.sub { text-align: center; color: var(--muted); margin: 6px 0 24px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--primary-light); }
.login-msg { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 8px; text-align: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; text-decoration: none; transition: .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-accent { background: var(--accent); } .btn-accent:hover { background: #0284c7; }
.btn-success { background: var(--success); } .btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); } .btn-warning:hover { background: #b45309; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary-light); }
.btn-outline:hover { background: #eff6ff; }
.btn-ghost { background: transparent; color: var(--muted); } .btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- الهيكل العام ---------- */
:root {
  --nd-blue:   #3b82f6;
  --nd-green:  #22c55e;
  --nd-pink:   #ec4899;
  --nd-cyan:   #06b6d4;
  --nd-purple: #a855f7;
  --nd-orange: #f97316;
  --nd-yellow: #eab308;
  --nd-red:    #ef4444;
  --nd-teal:   #14b8a6;
  --nd-lime:   #84cc16;
  --nd-indigo: #6366f1;
}
.layout { height: 100vh; }

.main { height: 100%; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: 62px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; flex-shrink: 0; gap: 14px;
}
.topbar .brand-chip { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--primary); }
.topbar .brand-chip .bc-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; font-weight: 800;
}
.topbar .pg-title { font-size: 18px; font-weight: 700; color: var(--primary); }
.topbar .user { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.topbar .user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.content { flex: 1; overflow-y: auto; padding: 22px 22px 120px; }

/* ---------- رصيف الأزرار الطافية الفلورية ---------- */
.dock {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 950;
  display: flex; align-items: flex-end; gap: 4px;
  padding: 10px 9px;
  max-width: calc(100vw - 20px);
  overflow-x: auto;
  background: rgba(15, 23, 42, .72);
  border-radius: 24px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  animation: dockIn .5s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes dockIn {
  from { opacity: 0; transform: translateX(-50%) translateY(40px) scale(.9); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.dock-btn {
  --lift: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; width: auto; min-width: 62px; flex-shrink: 0; padding: 9px 8px;
  background: transparent; color: #e2e8f0;
  border: none; border-radius: 16px; text-decoration: none; cursor: pointer;
  position: relative; font-family: inherit;
  transition: transform .22s cubic-bezier(.2,.9,.3,1.4);
  transform: translateY(calc(var(--lift) * -1 * 6px)) scale(calc(1 + var(--lift) * .06));
  z-index: calc(1 + var(--lift));
}
.dock-btn .db-ic {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--nc) 100%, #fff 8%), var(--nc));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--nc) 55%, transparent),
              inset 0 1px 0 rgba(255,255,255,.35);
  transition: box-shadow .25s, transform .25s;
}
.dock-btn .db-lb { font-size: 12px; font-weight: 600; line-height: 1.15; white-space: nowrap; text-align: center; color: #cbd5e1; transition: color .2s; }
.dock-btn:hover .db-ic {
  box-shadow: 0 10px 26px var(--nc), 0 0 22px 2px color-mix(in srgb, var(--nc) 70%, transparent),
              inset 0 1px 0 rgba(255,255,255,.4);
  transform: scale(1.08);
}
.dock-btn:hover .db-lb { color: #fff; }
.dock-btn.active .db-ic {
  box-shadow: 0 0 0 3px rgba(255,255,255,.28), 0 10px 26px var(--nc),
              0 0 26px 4px var(--nc);
  animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(255,255,255,.26), 0 10px 26px var(--nc), 0 0 20px 3px color-mix(in srgb, var(--nc) 65%, transparent); }
  50%     { box-shadow: 0 0 0 3px rgba(255,255,255,.34), 0 10px 26px var(--nc), 0 0 34px 7px var(--nc); }
}
.dock-btn.dock-out { color: #fda4af; }
.dock-btn.dock-out .db-ic { background: linear-gradient(145deg, #f43f5e, #be123c); }
.dock-btn.dock-out:hover { transform: translateY(-6px) scale(1.1); }
.dock-btn.dock-toggle .db-ic {
  background: linear-gradient(145deg, #94a3b8, #475569);
  transition: box-shadow .25s, transform .3s ease;
  font-weight: 900;
}
.dock-btn.dock-toggle:hover .db-ic { transform: rotate(180deg) scale(1.08); }
.dock.open .dock-btn.dock-toggle .db-ic { transform: rotate(180deg); }
.dock.open .dock-btn.dock-toggle:hover .db-ic { transform: rotate(180deg) scale(1.08); }
.notif-badge {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: #f43f5e; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px rgba(15,23,42,.8);
}

/* ---------- جرس الإشعارات في الشريط العلوي (كل الصفحات) ---------- */
.bell-wrap { position: relative; }
.bell-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card); cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.bell-btn:hover { background: var(--bg); }
.bell-btn.has-unread { background: #fff7ed; border-color: #fdba74; }
.bell-btn .bell-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  background: #f43f5e; color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--card);
  animation: bellPop .3s ease;
}
@keyframes bellPop { 0% { transform: scale(.5); } 100% { transform: scale(1); } }
.bell-panel {
  position: fixed; width: 340px; max-width: 90vw;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.18); z-index: 5000; overflow: hidden;
  transform-origin: top left; transform: scale(.95); opacity: 0;
  visibility: hidden; transition: transform .15s, opacity .15s, visibility .15s;
}
.bell-panel.open { transform: scale(1); opacity: 1; visibility: visible; }
.bell-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.bell-head strong { color: var(--text); }
.bell-list { max-height: 320px; overflow-y: auto; }
.bell-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: default; }
.bell-item.u { background: #f0f9ff; }
.bell-item-title { font-weight: 700; color: var(--text); font-size: 13px; }
.bell-item-msg { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: pre-line; }
.bell-item-meta { color: #94a3b8; font-size: 11px; margin-top: 4px; }
.bell-empty { padding: 24px 14px; text-align: center; color: var(--muted); }
.bell-dl {
  display: inline-block; margin-top: 6px; padding: 4px 10px;
  border: 1px solid var(--accent); border-radius: 8px; color: var(--accent);
  font-size: 12px; font-weight: 700; text-decoration: none;
}
.bell-dl:hover { background: #e0f2fe; }
.bell-foot {
  display: block; text-align: center; padding: 10px; font-weight: 700;
  color: var(--accent); border-top: 1px solid var(--border); background: var(--bg);
  text-decoration: none;
}
.bell-foot:hover { background: #e0f2fe; }

@media (max-width: 900px) {
  .dock { bottom: 10px; gap: 3px; padding: 8px 8px; border-radius: 20px; width: calc(100% - 16px); overflow-x: auto; justify-content: flex-start; }
  .dock-btn { min-width: 56px; width: 64px; }
  .dock-btn .db-lb { display: none; }
}

/* ---------- البطاقات الكبرى للداش بورد ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px; margin-bottom: 22px;
}
.kpi-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border-top: 4px solid var(--primary);
  position: relative; overflow: hidden;
}
.kpi-card h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.kpi-card .value { font-size: 26px; font-weight: 800; color: var(--text); }
.kpi-card .value small { font-size: 14px; color: var(--muted); font-weight: 600; }
.kpi-card .sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.kpi-card .ic {
  position: absolute; top: 16px; left: 16px; width: 44px; height: 44px;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.kpi-card.c-blue { border-top-color: var(--accent); }
.kpi-card.c-green { border-top-color: var(--success); }
.kpi-card.c-orange { border-top-color: var(--warning); }
.kpi-card.c-red { border-top-color: var(--danger); }
.kpi-card .ic.i-blue { background: var(--accent); }
.kpi-card .ic.i-green { background: var(--success); }
.kpi-card .ic.i-orange { background: var(--warning); }
.kpi-card .ic.i-red { background: var(--danger); }
.kpi-card .ic.i-purple { background: #7c3aed; }
/* ---------- الشبكة والألواح ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.card h2 {
  font-size: 15px; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.card h2 .badge { font-size: 11px; background: var(--primary-light); color: #fff; padding: 2px 8px; border-radius: 20px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; color: #fff; }
.badge-ok { background: var(--success); }
.badge-warn { background: var(--warning); color: #fff; }

/* ---------- الجداول ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl th { background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 700; }
table.tbl tr:hover td { background: #f8fafc; }
table.tbl td .pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.pill.ok { background: #dcfce7; color: #15803d; }
.pill.warn { background: #fef3c7; color: #b45309; }
.pill.danger { background: #fee2e2; color: #b91c1c; }
.pill.blue { background: #dbeafe; color: #1d4ed8; }
.pill.red { background: #fee2e2; color: #b91c1c; }
.pill.amber { background: #fef3c7; color: #b45309; }
.pill.green { background: #dcfce7; color: #15803d; }
.pill.gray { background: #e2e8f0; color: #475569; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.row-actions .btn { flex-shrink: 0; }

/* ---------- النماذج ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary-light); }
.sel-plus { display: flex; gap: 6px; align-items: center; }
.sel-plus select { flex: 1; }
.sel-plus .btn { flex-shrink: 0; white-space: nowrap; }
input[readonly] { background: #f1f5f9; color: var(--muted); cursor: default; }
body.vte-dark input[readonly] { background: #1e293b; color: #94a3b8; }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; }

/* ---------- الحوار (Modal) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius); max-width: 620px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: 0 25px 60px rgba(0,0,0,.25);
}
.modal h3 { font-size: 17px; color: var(--primary); margin-bottom: 16px; }
.modal .close-x { float: left; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-wide { max-width: 960px; }
.muted { color: var(--muted); }
.tab-row { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin: 14px 0; flex-wrap: wrap; }
.tab-btn {
  padding: 9px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent; color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border-bottom: none; margin-bottom: -1px;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }


/* ---------- مكونات متنوعة ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] {
  padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-width: 220px; font-family: inherit;
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.stats-bar { display: flex; gap: 20px; font-weight: 600; }
.mt-2 { margin-top: 16px; }

/* ---------- جدول البيع (POS) ---------- */
.pos-cashbar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 16px;
}
.pos-cashbar .pcb-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.pos-cashbar .pcb-item strong { font-size: 16px; color: var(--text); }
.pos-cashbar .pcb-ico { font-size: 18px; }
.pos-cashbar .btn { margin-inline-start: auto; }
.pos-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .pos-layout { grid-template-columns: 1fr; } }
.barcode-input { display: flex; gap: 10px; }
.barcode-input input { flex: 1; font-size: 16px; letter-spacing: 1px; }
.qty-ctl { display: flex; align-items: center; gap: 6px; }
.qty-ctl button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 700; font-size: 17px; line-height: 1; }
.qty-ctl button:hover { background: #eff6ff; }
.qty-ctl span { min-width: 34px; text-align: center; font-size: 18px; font-weight: 800; color: var(--text); }
.num-lg { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; }
.cart-total { font-size: 22px; font-weight: 800; color: var(--primary); }
.cart-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }

.toast {
  position: fixed; bottom: 24px; right: 50%; transform: translateX(50%);
  background: var(--primary-dark); color: #fff; padding: 12px 22px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 6000;
  opacity: 0; transition: .25s; pointer-events: none; font-size: 14px;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }

/* ---------- التقارير والرسوم البيانية ---------- */
.chart-box { position: relative; height: 300px; width: 100%; }
.rfbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.rfbar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.rfbar input[type=date] {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; background: #fff;
}
.rfbar input[type=date]:focus { outline: none; border-color: var(--primary-light); }

/* =================================================================
   داش بورد الداكن (على نمط GrosManager) — يُفعَّل على صفحة الداش بورد فقط
   ================================================================= */
body.vte-dark {
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  color: #fff;
  min-height: 100vh;
}
body.vte-dark .layout { background: transparent; }
body.vte-dark .main { background: transparent; }
body.vte-dark .topbar {
  background: rgba(15, 12, 41, 0.55);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}
body.vte-dark .topbar .brand-chip,
body.vte-dark .topbar .pg-title { color: #fff; }
body.vte-dark .topbar .user { color: rgba(255,255,255,0.6); }
body.vte-dark .bell-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.16); color: #fff; }
body.vte-dark .bell-btn:hover { background: rgba(255,255,255,0.14); }
body.vte-dark .bell-btn.has-unread { background: rgba(251,146,60,0.18); border-color: #fb923c; }
body.vte-dark .bell-panel { background: #1c1a3a; border-color: rgba(255,255,255,0.12); }
body.vte-dark .bell-head { background: rgba(255,255,255,0.06); }
body.vte-dark .bell-item { border-bottom-color: rgba(255,255,255,0.08); }
body.vte-dark .bell-item.u { background: rgba(102,126,234,0.14); }
body.vte-dark .bell-item-title { color: #fff; }
body.vte-dark .bell-foot { background: rgba(255,255,255,0.06); border-top-color: rgba(255,255,255,0.1); }
body.vte-dark .bell-foot:hover { background: rgba(102,126,234,0.18); }
body.vte-dark .content { background: transparent; }

/* =================================================================
   الثيم الداكن الشامل على كل الصفحات
   ================================================================= */
body.vte-dark :root, body.vte-dark {
  --bg: #12102b; --card: rgba(255,255,255,0.06); --border: rgba(255,255,255,0.14);
  --text: #f1f5f9; --muted: rgba(255,255,255,0.6);
}
body.vte-dark .card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25); color: #fff;
  backdrop-filter: blur(8px);
}
body.vte-dark .card h2 { color: #fff; }
body.vte-dark .card h2 .badge { background: rgba(255,255,255,0.18); color: #fff; }
body.vte-dark table.tbl th {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.65);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
body.vte-dark table.tbl td { border-bottom: 1px solid rgba(255,255,255,0.09); color: rgba(255,255,255,0.9); }
body.vte-dark table.tbl tr:hover td { background: rgba(255,255,255,0.06); }
body.vte-dark .field label { color: rgba(255,255,255,0.7); }
body.vte-dark .field input, body.vte-dark .field select, body.vte-dark .field textarea {
  background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.16); color: #fff;
}
body.vte-dark .field input::placeholder { color: rgba(255,255,255,0.35); }
body.vte-dark .field input:focus, body.vte-dark .field select:focus, body.vte-dark .field textarea:focus {
  border-color: #667eea; background: rgba(255,255,255,0.1);
}
body.vte-dark .modal-overlay { background: rgba(5, 5, 20, 0.66); }
body.vte-dark .modal {
  background: #1c1a3a; box-shadow: 0 25px 60px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
}
body.vte-dark .modal h3 { color: #fff; }
body.vte-dark .modal .close-x { color: rgba(255,255,255,0.6); }
body.vte-dark .toolbar input[type=search],
body.vte-dark .toolbar select {
  background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.16); color: #fff;
}
body.vte-dark .stats-bar { color: rgba(255,255,255,0.85); }
body.vte-dark .empty { color: rgba(255,255,255,0.45); }
body.vte-dark .btn-ghost { color: rgba(255,255,255,0.7); }
body.vte-dark .btn-ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }
body.vte-dark .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,0.3); }
body.vte-dark .btn-outline:hover { background: rgba(255,255,255,0.12); }
body.vte-dark .qty-ctl button { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.18); color: #fff; }
body.vte-dark .qty-ctl button:hover { background: rgba(255,255,255,0.2); }
body.vte-dark .barcode-input input { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.16); color: #fff; }
body.vte-dark .cart-total { color: #38ef7d; }
body.vte-dark .pos-layout input#q { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.16); color: #fff; }
/* البطاقات العددية (تستخدم في الداش بورد والتقارير والحالات) */
body.vte-dark .kpi-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
body.vte-dark .kpi-card h3 { color: rgba(255,255,255,0.7); }
body.vte-dark .kpi-card .value { color: #fff; }
body.vte-dark .kpi-card .sub { color: rgba(255,255,255,0.55); }
/* خلايا الجداول الداكنة المخصصة تبقي كما هي */
body.vte-dark .vte-tbl th { background: rgba(255,255,255,0.08); }
/* الحوار (Modal) التاريخ */
body.vte-dark .modal { background: #1c1a3a; }

@media (prefers-reduced-motion: reduce) {
  .vte-counter-card .cc-icon { animation: none; }
}

/* =================================================================
   الثيم الفاتح (يمكن التبديل إليه) — يطابق التصميم الأصلي
   ================================================================= */
body.vte-light {
  background: var(--bg); color: var(--text); min-height: 100vh;
}
body.vte-light .layout { background: transparent; }
body.vte-light .main { background: transparent; }
body.vte-light .topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  backdrop-filter: none;
}
body.vte-light .topbar .brand-chip, body.vte-light .topbar .pg-title { color: var(--primary); }
body.vte-light .topbar .user { color: var(--muted); }
body.vte-light .content { background: transparent; }
body.vte-light .card { background: var(--card); border: none; box-shadow: var(--shadow); }
body.vte-light table.tbl th { background: #f8fafc; color: var(--muted); border-bottom: 1px solid var(--border); }
body.vte-light table.tbl td { border-bottom: 1px solid var(--border); color: var(--text); }
body.vte-light table.tbl tr:hover td { background: #f8fafc; }
body.vte-light .kpi-card { background: var(--card); box-shadow: var(--shadow); border: none; }
body.vte-light .kpi-card .value { color: var(--text); }

/* زر تبديل الثيم في الترويسة */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.12); transition: all 0.2s;
}
body.vte-dark .theme-toggle { background: rgba(255,255,255,0.12); }
body.vte-dark .theme-toggle:hover { background: rgba(255,255,255,0.22); transform: rotate(30deg); }
body.vte-light .theme-toggle { background: var(--border); }
body.vte-light .theme-toggle:hover { background: #cbd5e1; transform: rotate(30deg); }

/* الساعة الرقمية الحية */
@property --vte-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.vte-banner-title {
  text-align: center; font-weight: 800; letter-spacing: 2px; margin: 2px 0 4px;
  font-family: 'Cairo', 'Inter', system-ui, sans-serif; font-size: 2.2em; line-height: 1.6;
  padding: 2px 0 8px;
  overflow: visible;
  background: conic-gradient(
    from var(--vte-angle),
    #11998e 0deg, #38ef7d 60deg, #667eea 120deg, #f093fb 180deg,
    #f45c43 240deg, #38ef7d 300deg, #11998e 360deg
  );
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: vteGradientSpin 5s linear infinite;
}
@keyframes vteGradientSpin {
  to { --vte-angle: 360deg; }
}
.vte-clock { text-align: center; margin: 6px 0 26px; }
.vte-clock .clock-time {
  font-family: 'Consolas', 'Segoe UI', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 3.2em; font-weight: 800; letter-spacing: 6px; line-height: 1.1;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 30%, #667eea 62%, #f093fb 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(102,126,234,0.35));
}
.vte-clock .clock-date {
  font-size: 1.05em; font-weight: 600; letter-spacing: 1px; margin-top: 6px;
  background: linear-gradient(135deg, #38ef7d, #667eea);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* بطاقات العدادات المتحركة */
.vte-counter-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 30px;
}
.vte-counter-card {
  border-radius: 16px; padding: 26px 22px; text-align: center; position: relative; overflow: hidden;
  transition: all 0.3s ease; border: 1px solid rgba(255,255,255,0.12); cursor: default;
}
.vte-counter-card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.vte-counter-card .cc-icon {
  font-size: 2.4em; margin-bottom: 10px; display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  animation: ccPulse 2s ease-in-out infinite;
}
@keyframes ccPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.vte-counter-card .cc-num {
  font-size: 2.7em; font-weight: 900; color: #fff;
  font-family: 'Cairo', 'Inter', system-ui, sans-serif;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2); line-height: 1.1;
  letter-spacing: .5px;
}
.vte-counter-card .cc-num small { font-size: 0.5em; font-weight: 700; color: rgba(255,255,255,0.85); }
.vte-counter-card .cc-label { font-size: 0.95em; color: rgba(255,255,255,0.8); margin-top: 8px; font-weight: 600; }
.vte-counter-card .cc-name { font-size: 1.05em; font-weight: 700; word-break: break-word; line-height: 1.3; }
.vte-counter-card::after {
  content: ''; position: absolute; top: -50%; right: -50%; width: 100%; height: 100%;
  border-radius: 50%; background: rgba(255,255,255,0.06);
}
.vte-counter-card.c-sales    { background: linear-gradient(135deg, #11998e, #38ef7d); box-shadow: 0 8px 32px rgba(17,153,142,0.35); }
.vte-counter-card.c-purchase { background: linear-gradient(135deg, #667eea, #764ba2); box-shadow: 0 8px 32px rgba(102,126,234,0.35); }
.vte-counter-card.c-credit   { background: linear-gradient(135deg, #eb3349, #f45c43); box-shadow: 0 8px 32px rgba(235,51,73,0.35); }
.vte-counter-card.c-profit   { background: linear-gradient(135deg, #f7971e, #ffd200); box-shadow: 0 8px 32px rgba(247,151,30,0.35); }
.vte-counter-card.c-best     { background: linear-gradient(135deg, #ff512f, #dd2476); box-shadow: 0 8px 32px rgba(221,36,118,0.35); }
.vte-counter-card.c-cash     { background: linear-gradient(135deg, #30cfd0, #330867); box-shadow: 0 8px 32px rgba(48,207,208,0.35); }
.vte-counter-card.c-stock    { background: linear-gradient(135deg, #43e97b, #38f9d7); box-shadow: 0 8px 32px rgba(67,233,123,0.3); }

/* بطاقة الرسم البياني */
.vte-chart-card {
  background: rgba(255,255,255,0.06); border-radius: 16px; padding: 24px; margin-bottom: 30px;
  backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.08);
}
.vte-chart-card h3 { color: rgba(255,255,255,0.85); font-size: 1em; margin: 0 0 14px; }
.vte-chart-card .chart-box { height: 300px; }

/* شبكة الوظائف السريعة */
.vte-feature-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px;
}
.vte-feature-card {
  background: rgba(255,255,255,0.06); border-radius: 16px; padding: 22px 14px; text-align: center;
  text-decoration: none; color: #fff; transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.08); position: relative; overflow: hidden;
}
.vte-feature-card:hover {
  transform: translateY(-5px); background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15); box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.vte-feature-card .f-icon { font-size: 2.1em; margin-bottom: 8px; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.vte-feature-card .f-count { font-size: 1.4em; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.vte-feature-card .f-title { font-weight: 600; color: rgba(255,255,255,0.9); font-size: 0.9em; margin-top: 4px; }
.vte-feature-card .f-desc { font-size: 0.75em; color: rgba(255,255,255,0.45); margin-top: 4px; }
.vte-feature-card::before {
  content: ''; position: absolute; bottom: -30px; left: -30px; width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.vte-section-title { color: #fff; font-size: 1.25em; font-weight: 700; margin: 6px 0 18px; text-shadow: 0 2px 4px rgba(0,0,0,0.4); }

/* جداول داكنة داخل الداش بورد */
.vte-tbl th { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); border-bottom: 1px solid rgba(255,255,255,0.1); }
.vte-tbl td { border-bottom: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.vte-tbl tr:hover td { background: rgba(255,255,255,0.05); }
.vte-empty { text-align: center; color: rgba(255,255,255,0.45); padding: 30px 10px; }

@media (max-width: 900px) {
  .vte-counter-grid { grid-template-columns: 1fr; }
}

/* =================================================================
   نقطة البيع — لوحة الدفع (على نمط الداش بورد: أرقام كبيرة وواضحة)
   ================================================================= */
.pos-pay { position: sticky; top: 0; display: flex; flex-direction: column; gap: 16px; }
.pos-pay h2 { margin-bottom: 2px; }

/* رقم الإجمالي الكبير */
.pay-grand-box { text-align: center; padding: 22px 16px; border-radius: 16px; background: linear-gradient(135deg, #667eea, #764ba2); box-shadow: 0 10px 30px rgba(102,126,234,0.35); }
.pay-grand-label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.85); letter-spacing: 0.5px; }
.pay-grand { font-size: 3.4em; font-weight: 800; color: #fff; line-height: 1.05; text-shadow: 0 2px 10px rgba(0,0,0,0.25); }

/* حقل المبلغ المقدَّم */
.pay-paid { }
.pay-paid label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.pay-paid input {
  width: 100%; font-size: 2.1em; font-weight: 800; text-align: center; letter-spacing: 1px;
  padding: 14px 12px; border: 2px solid var(--border); border-radius: 14px; font-family: 'Cairo', 'Inter', system-ui, sans-serif;
  font-variant-numeric: tabular-nums; background: #fff; color: var(--text);
}
.pay-paid input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.2); }
body.vte-dark .pay-paid input { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); color: #fff; }

/* صندوق الباقي للمشتري (كبير ومتحرك حسب الحالة) */
.pay-change {
  border-radius: 16px; padding: 20px 16px; text-align: center; transition: all 0.25s;
  border: 2px dashed var(--border); background: rgba(125,211,252,0.08);
}
.pay-change .change-label { font-size: 14px; font-weight: 700; color: var(--muted); }
.pay-change .change-num {
  font-size: 2.9em; font-weight: 800; line-height: 1.05; margin-top: 4px;
  font-variant-numeric: tabular-nums; font-family: 'Cairo', 'Inter', system-ui, sans-serif;
  color: var(--muted);
}
.pay-change.is-sufficient { border: 2px solid rgba(34,197,94,0.5); background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 10px 30px rgba(22,163,74,0.35); }
.pay-change.is-sufficient .change-label,
.pay-change.is-sufficient .change-num { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.25); }
.pay-change.is-short { border: 2px solid rgba(239,68,68,0.5); background: linear-gradient(135deg, #b91c1c, #ef4444); box-shadow: 0 10px 30px rgba(239,68,68,0.35); }
.pay-change.is-short .change-label,
.pay-change.is-short .change-num { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.25); }

/* أزرار الدفع */
.pay-actions { display: flex; gap: 10px; }
.pay-actions .btn { flex: 1; }
.pay-go { padding: 14px 16px; font-size: 1.05em; font-weight: 700; }
.pay-actions .btn-ghost { flex: 0 0 auto; }

/* نقطة البيع: عمود يسار (بحث ← سلة ← كتالوج قابل للطي) + لوحة دفع ثابتة
   — التدفق الطبيعي للصفحة حتى لا يضيع أي محتوى، والكتالوج يبقى ظاهراً */
.vte-pos .cart-card .tbl-wrap { max-height: 300px; overflow-y: auto; min-height: 60px; }
.vte-pos .cat-card .pos-catalog { padding: 2px 4px 8px; }

@media (max-width: 900px) {
  .pos-pay { position: static; }
  .pay-grand { font-size: 2.6em; }
  .pay-change .change-num { font-size: 2.3em; }
  .vte-pos .cart-card .tbl-wrap { max-height: none; }
}

/* صور المنتجات */
.img-pick { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.img-pick .pi-thumb {
  width: 72px; height: 72px; flex: 0 0 auto; border-radius: 12px;
  overflow: hidden; border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--bg2, #1e293b), var(--bg, #0f172a));
  display: flex; align-items: center; justify-content: center;
}
.img-pick .pi-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.img-pick .pi-thumb .pi-ph { font-size: 26px; opacity: .45; }
.img-pick .pi-controls { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.img-pick .pi-btn { text-align: center; font-size: 13px; padding: 7px 10px; }
.thumb {
  width: 38px; height: 38px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg2, #1e293b); display: block;
}
.thumb-ph {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg2, #1e293b);
  color: var(--muted, #94a3b8); font-size: 16px;
}
.pos-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); background: var(--bg2); display: inline-block; vertical-align: middle; margin-left: 8px; }
.cart-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 9px; border: 1px solid var(--border); background: var(--bg2); display: inline-block; vertical-align: middle; margin-left: 10px; }

/* كتالوج المنتجات (معرض صور) في نقطة البيع */
.pos-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding: 2px;
}
.pos-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.pos-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,23,42,.14); }
.pos-card-out { opacity: .5; }
.pos-card-img {
  height: 110px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  font-size: 34px; color: var(--muted);
  overflow: hidden;
}
.pos-card-img img { width: 100%; height: 100%; object-fit: cover; }
.pos-card-name {
  padding: 8px 10px 0;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pos-card-price { padding: 2px 10px; font-weight: 800; color: var(--accent); font-size: 14px; }
.pos-card-stock { padding: 0 10px 9px; font-size: 11px; color: var(--muted); }
.pos-card-stock.out { color: var(--danger); font-weight: 700; }

/* صورة عائمة كبيرة تتبع مؤشر الفأرة عند التمرير على منتج (كاتالوج أو سلة) */
.cart-row { display: flex; gap: 14px; align-items: flex-start; }
.cart-row .tbl-wrap { flex: 1; min-width: 0; }

.product-preview {
  position: fixed;
  z-index: 9999;
  width: 440px;
  pointer-events: none;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 35px rgba(15,23,42,.28);
  overflow: hidden;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .12s ease, transform .12s ease;
}
.product-preview.show { opacity: 1; transform: scale(1); }
.product-preview img {
  width: 100%; height: 400px; object-fit: cover; display: block;
  background: var(--bg, #f1f5f9);
}
.product-preview .pp-name {
  padding: 9px 12px; font-weight: 800; font-size: 14px; color: var(--text);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--card, #fff);
}
