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

:root {
  --primary: #0f172a;        /* Deep Slate obsidian */
  --primary-light: #f1f5f9;  /* Light slate tint */
  --accent: #10b981;         /* Vibrant Emerald Green */
  --accent-hover: #059669;   /* Hover green */
  --accent-glow: rgba(16, 185, 129, 0.25);
  --bg-main: #f8fafc;        /* Slate 50 ultra-clean background */
  --bg-card: #ffffff;        /* Pure white card */
  --bg-card-glass: rgba(255, 255, 255, 0.85);
  --text-main: #0f172a;      /* Dark slate readable text */
  --text-muted: #64748b;     /* Slate gray text */
  --border: #e2e8f0;         /* Refined subtle border */
  --border-light: #f1f5f9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 16px -2px rgba(15, 23, 42, 0.06), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.08), 0 6px 12px -4px rgba(15, 23, 42, 0.04);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Component specific variables */
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --input-bg: #ffffff;
  --btn-sec-bg: #f8fafc;
  --btn-sec-text: #0f172a;
  --app-font: 'Cairo', 'Tajawal', sans-serif;

  /* Compatibility mappings for HR panels */
  --text-primary: var(--text-main);
  --text-secondary: var(--text-muted);
  --bg-input: var(--input-bg);
}

body.dark-theme {
  --primary: #f8fafc;
  --primary-light: #1e293b;
  --bg-main: #090d16;        /* Deep obsidian space black */
  --bg-card: #111827;        /* Sleek card background */
  --bg-card-glass: rgba(17, 24, 39, 0.85);
  --text-main: #f9fafb;
  --text-muted: #94a3b8;
  --border: #1f2937;
  --border-light: #1e293b;
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 6px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 32px -4px rgba(0, 0, 0, 0.6);

  /* Component specific variables */
  --topbar-bg: rgba(17, 24, 39, 0.88);
  --input-bg: #151e2e;
  --btn-sec-bg: #1e293b;
  --btn-sec-text: #f3f4f6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}

body {
  direction: rtl;
  text-align: right;
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  display: flex;
  font-size: 14.5px;
}

h1, h2, h3, h4, h5, h6, .card-title, .modal-title {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

button, input, select, textarea, .btn, .form-input, .data-table, .badge, .status, td, th {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  font-size: 14px;
}

.number, .stat-value, .metric-number {
  font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
  font-variant-numeric: tabular-nums;
}

/* التنسيق للخطوط المخصصة */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* الهيكل الرئيسي للتطبيق */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* الشريط الجانبي */
aside.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #000000 0%, #04140b 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.4);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--primary-light);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #ffffff;
}

.sidebar-brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
}

nav.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 1px solid transparent;
}

.menu-item:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.015);
}

.menu-item:nth-of-type(even) {
  background-color: rgba(255, 255, 255, 0.045);
}

.menu-item:hover {
  background-color: var(--primary-light);
  color: #f8fafc;
  transform: translateX(-4px);
}

.menu-item.active {
  background: linear-gradient(135deg, var(--accent) 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  font-weight: 600;
}

.menu-item.active::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 25%;
  height: 50%;
  width: 4px;
  background-color: #ffffff;
  border-radius: 2px;
}

.menu-section-header {
  font-size: 12px;
  color: var(--accent); /* اللون الأخضر الزمردي المميز للعلامة التجارية */
  font-weight: 800;
  padding: 18px 16px 6px 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Cairo', sans-serif;
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
  margin-bottom: 6px;
  margin-top: 10px;
}

.menu-item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.85;
}

/* المنطقة الرئيسية */
main.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* الشريط العلوي */
header.topbar {
  height: 72px;
  background-color: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02);
  z-index: 9;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 5px 12px 5px 6px;
  border-radius: 30px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.25));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.system-date {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  background-color: var(--bg-card);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 6px;
}

.alerts-badge-btn {
  position: relative;
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.alerts-badge-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.badge-count {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

/* تبويبات التطبيق */
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: none;
}

.tab-content.active {
  display: block;
}

/* شاشة الإحصائيات (الرئيسية) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(16, 185, 129, 0.3);
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 23px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: var(--transition);
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
}

.stat-card.danger-stat .stat-icon {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* النوافذ والبطاقات */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 22px;
}

/* لوحة التنبيهات ونقص المخزون الفاخرة */
.alert-panel {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.04) 0%, rgba(245, 158, 11, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.06);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.alert-panel::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background: var(--danger);
}

.alert-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #dc2626;
  font-weight: 700;
  font-size: 14.5px;
}

.alert-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding-left: 4px;
}

.alert-item {
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.alert-item:hover {
  transform: translateY(-2px);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: var(--shadow-sm);
}

.alert-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.alert-item-name {
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-item-warehouse {
  font-size: 11px;
  color: var(--text-muted);
}

.alert-item-qty {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #065f46 100%);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--btn-sec-bg);
  border-color: var(--border);
  color: var(--btn-sec-text);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  border-color: var(--border);
}


.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-warning {
  background-color: var(--warning);
  color: white;
}

.btn-warning:hover {
  background-color: #d97706;
}

/* فلاتر البحث والفلترة */
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-group {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background-color: var(--input-bg);
  color: var(--text-main);
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.select-filter {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background-color: var(--input-bg);
  color: var(--text-main);
  min-width: 150px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.select-filter:focus {
  border-color: var(--accent);
}

/* الجداول */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}

table.data-table th {
  background-color: var(--primary-light);
  color: var(--text-main);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

table.data-table tbody tr:nth-child(even) {
  background-color: rgba(128, 128, 128, 0.035);
}

table.data-table tbody tr:hover {
  background-color: var(--primary-light);
}

/* النوافذ المنبثقة (Modals) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* نماذج الإدخال */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-size: 14px;
  background-color: var(--input-bg);
  color: var(--text-main);
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* شاشة الفواتير */
.invoice-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  height: calc(100vh - 170px);
  overflow: hidden;
}

.invoice-sidebar {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.invoice-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.invoice-items-table-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.invoice-summary-bar {
  background-color: var(--primary-light);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.summary-value.net-total {
  color: var(--accent);
  font-size: 22px;
}

/* الإشعارات (Toasts) */
.toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: var(--bg-card);
  border-right: 4px solid var(--accent);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  min-width: 280px;
  max-width: 400px;
  transform: translateX(-50px);
  opacity: 0;
  animation: toastSlideIn 0.3s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success {
  border-right-color: var(--success);
}

.toast.danger {
  border-right-color: var(--danger);
}

.toast.warning {
  border-right-color: var(--warning);
}

@keyframes toastSlideIn {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* تصميم المطبوعات (فواتير وتقارير) */
@media print {
  body {
    background-color: #ffffff;
    color: #000000;
    overflow: visible;
  }

  aside.sidebar,
  header.topbar,
  .btn,
  .filter-row,
  .modal-overlay,
  ::-webkit-scrollbar {
    display: none !important;
  }

  main.main-content {
    overflow: visible;
    display: block;
    width: 100%;
  }

  .tab-content {
    display: none !important;
    padding: 0;
    overflow: visible;
  }

  .tab-content.active {
    display: block !important;
  }

  /* Hide everything during printing except active reports or hidden print-layout template */
  #print-layout {
    display: block !important;
  }

  /* If printLayout is active, we should hide the main application wrapper entirely to avoid printing underlying UI */
  body:has(#print-layout:not(:empty)) #app-container {
    display: none !important;
  }

  .card {
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .card-header {
    border-bottom: 2px solid #000;
    padding: 10px 0;
  }

  .card-body {
    padding: 10px 0;
  }

  .data-table {
    width: 100% !important;
    border: 1px solid #000 !important;
  }

  .data-table th,
  .data-table td {
    border: 1px solid #000 !important;
    padding: 8px !important;
    color: #000 !important;
  }

  /* تصميم خاص لطباعة الفواتير */
  .print-invoice-wrapper {
    display: block !important;
    direction: rtl;
    padding: 20px;
    background-color: #fff;
    width: 100%;
  }

  .print-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000;
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .print-invoice-title {
    font-size: 24px;
    font-weight: bold;
  }

  .print-invoice-meta {
    font-size: 14px;
    line-height: 1.6;
  }

  .print-invoice-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
  }

  .print-invoice-summary {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 15px;
    font-weight: bold;
  }
}

/* تنسيق خاص بمرئية الفاتورة الجاهزة للطباعة على الشاشة/المتصفح قبل الطباعة */
.print-invoice-wrapper {
  display: none;
}

/* تصميم المجموعات وعناصر الإدخال السريعة */
.qty-warning-badge {
  background-color: #fee2e2;
  color: var(--danger);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
}

.badge-payment {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 12px;
}

.badge-payment.paid {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-payment.credit {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-payment.partial {
  background-color: #e0f2fe;
  color: #075985;
}

/* تحسينات إضافية */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-10 {
  gap: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* ==================== LOGIN SCREEN STYLES ==================== */
#login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(4, 20, 11, 0.9) 100%),
    url('bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-card {
  background: rgba(12, 16, 23, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  box-shadow: 
    0 20px 25px -5px rgb(0 0 0 / 0.3), 
    0 8px 10px -6px rgb(0 0 0 / 0.3),
    0 0 30px rgba(16, 185, 129, 0.15);
  animation: loginCardFadeIn 0.5s ease-out forwards;
}

@keyframes loginCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--accent);
  color: white;
  font-size: 36px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.login-header h2 {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-header p {
  color: #94a3b8;
  font-size: 13px;
}

/* ==================== AUTOCOMPLETE DROPDOWN STYLES ==================== */
.autocomplete-dropdown {
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  max-height: 250px;
  overflow-y: auto;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1050;
  margin-top: 4px;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
  direction: rtl;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background-color: rgba(2, 132, 199, 0.08);
}

.autocomplete-item-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 13.5px;
}

.autocomplete-item-code {
  font-size: 11px;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ==================== DETAILS ROW STYLES ==================== */
.details-row {
  background-color: var(--bg-body);
}

.details-content-wrapper {
  background: var(--bg-card);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 10px 16px 15px 16px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  animation: detailsSlideDown 0.25s ease-out forwards;
}

@keyframes detailsSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== ACTIVATION SCREEN STYLES ==================== */
#activation-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(4, 20, 11, 0.92) 100%),
    url('bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.activation-card {
  background: rgba(12, 16, 23, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 40px;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.5), 
    0 0 40px rgba(16, 185, 129, 0.2);
  animation: activationCardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes activationCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.activation-header {
  text-align: center;
  margin-bottom: 30px;
}

.activation-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: white;
  font-size: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
  animation: pulseGold 2s infinite;
}

@keyframes pulseGold {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(234, 179, 8, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0);
  }
}

.activation-header h2 {
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.activation-header p {
  color: #94a3b8;
  font-size: 13px;
}

.activation-alert {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
}

.activation-alert i {
  font-size: 16px;
}

/* ==================== RESPONSIVE & LAYOUT STYLES ==================== */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-2-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Responsive adjustments for smaller screens (e.g. 1024px or 1366px screen width) */
@media (max-width: 1366px) {
  .charts-row {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
  }
  .tables-row {
    gap: 16px;
    margin-bottom: 20px;
  }
  .grid-2-columns {
    gap: 16px;
  }
}

@media (max-width: 1200px) {
  .tab-content {
    padding: 16px;
  }
  .charts-row {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .charts-row > :first-child {
    grid-column: span 2;
  }
  .tables-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .grid-2-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 992px) {
  aside.sidebar {
    width: 220px;
  }
  .sidebar-brand-name {
    font-size: 16px;
  }
  .charts-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .charts-row > :first-child {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .tab-content {
    padding: 12px;
  }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }
}

/* ==================== HR & PAYROLL SYSTEM STYLES ==================== */
.btn-subtab {
  background: var(--bg-input, #1e293b);
  color: var(--text-secondary, #94a3b8);
  border: 1px solid var(--border, #334155);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-subtab:hover {
  background: var(--border, #334155);
  color: var(--text-primary, #f8fafc);
}

.btn-subtab.active {
  background: linear-gradient(135deg, var(--accent, #10b981), #059669);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.badge-hr {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-hr-present { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-hr-absent { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-hr-late { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-hr-leave { background: rgba(99,102,241,0.15); color: #6366f1; }
.badge-hr-paid { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-hr-unpaid { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Payslip Printable Card */
.payslip-card {
  font-family: 'Cairo', sans-serif;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 24px;
  background: #ffffff;
  color: #1e293b;
}

.payslip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #10b981;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.payslip-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.payslip-table th, .payslip-table td {
  border: 1px solid #cbd5e1;
  padding: 10px 12px;
  font-size: 0.9rem;
  text-align: right;
}

.payslip-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #0f172a;
}

/* ==================== POS & THERMAL RECEIPT STYLES ==================== */
.pos-wrapper {
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 20px;
  height: calc(100vh - 120px);
  min-height: 600px;
}

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

@media (max-width: 900px) {
  .pos-wrapper {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Left/Catalog Panel */
.pos-catalog-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.pos-barcode-box {
  flex: 1;
  position: relative;
  min-width: 260px;
}

.pos-barcode-box input {
  width: 100%;
  height: 48px;
  padding: 0 45px 0 16px;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-main);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transition: var(--transition);
}

.pos-barcode-box input:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.pos-barcode-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--accent);
}

.pos-search-box {
  flex: 1;
  min-width: 200px;
}

/* Shortcuts Bar */
.pos-shortcuts-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 6px 0;
  scrollbar-width: none;
}

.pos-shortcuts-bar::-webkit-scrollbar {
  display: none;
}

.pos-shortcut-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  user-select: none;
}

.pos-shortcut-chip:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  transform: translateY(-1px);
}

.pos-shortcut-chip kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

.pos-categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.btn-pos-category {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-pos-category:hover {
  background: var(--border-light);
  border-color: var(--accent);
}

.btn-pos-category.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.pos-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 4px;
  flex: 1;
}

.pos-item-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 105px;
  user-select: none;
}

.pos-item-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.pos-item-card:active {
  transform: scale(0.97);
}

.pos-item-card.out-of-stock {
  opacity: 0.55;
  filter: grayscale(0.7);
}

.pos-item-card-code {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.pos-item-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin: 6px 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pos-item-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 4px;
}

.pos-item-card-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
}

.pos-item-card-price small {
  font-size: 10px;
  font-weight: normal;
}

.pos-item-card-qty-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  font-weight: 700;
}

.pos-item-card-qty-badge.low {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* Right/Cart Panel */
.pos-cart-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pos-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

/* Quick Hold Orders Bar */
.pos-quick-hold-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 5px 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed var(--warning);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  align-items: center;
  scrollbar-width: thin;
}

.pos-quick-hold-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.pos-quick-hold-chip:hover {
  border-color: var(--warning);
  background: #fffbeb;
  transform: translateY(-1px);
}

.pos-quick-hold-chip .chip-price {
  color: var(--accent);
  font-weight: 800;
  margin-right: 2px;
}

.pos-quick-hold-chip .chip-del {
  color: var(--danger);
  margin-left: 2px;
  font-weight: bold;
  padding: 0 4px;
  border-radius: 50%;
  transition: background 0.15s;
}

.pos-quick-hold-chip .chip-del:hover {
  background: rgba(239, 68, 68, 0.2);
}

.pos-cart-table-wrapper {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: var(--bg-main);
}

.pos-qty-control {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.btn-pos-qty {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  font-size: 10px;
  transition: background 0.15s;
}

.btn-pos-qty:hover {
  background: var(--border-light);
  color: var(--accent);
}

.pos-qty-input {
  width: 38px;
  height: 24px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
}

/* Totals and Checkout area */
.pos-checkout-area {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-total-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pos-total-banner-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.pos-total-banner-val {
  font-size: 26px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.pos-payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pos-pay-btn {
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.pos-pay-btn i {
  font-size: 16px;
}

.pos-pay-btn:hover {
  border-color: var(--accent);
  background: var(--border-light);
}

.pos-pay-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.pos-quick-tender-buttons {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.pos-quick-tender-btn {
  flex: 1;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-main);
  transition: var(--transition);
}

.pos-quick-tender-btn:hover {
  background: var(--border-light);
  border-color: var(--accent);
}

.pos-actions-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-top: 6px;
}

.btn-pos-complete {
  height: 48px;
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
}

.btn-pos-complete:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-pos-complete:active {
  transform: translateY(0);
}

/* ==================== THERMAL RECEIPT STYLES (80mm & 58mm) ==================== */
.btn-receipt-width {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-receipt-width.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.thermal-receipt-container {
  width: 320px;
  margin: 0 auto;
  padding: 16px;
  background: #ffffff;
  color: #000000;
  font-family: 'Courier New', Courier, monospace, 'Cairo', sans-serif;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  transition: width 0.2s ease;
}

.thermal-receipt-container.receipt-58mm {
  width: 250px;
  font-size: 10.5px;
  padding: 12px 10px;
}

.thermal-receipt-container.receipt-58mm .store-name {
  font-size: 13px !important;
}

.thermal-receipt-container.receipt-58mm .store-info,
.thermal-receipt-container.receipt-58mm .thermal-receipt-meta,
.thermal-receipt-container.receipt-58mm .thermal-receipt-table {
  font-size: 10px !important;
}

.thermal-receipt-header {
  text-align: center;
}

.thermal-receipt-header .store-name {
  font-size: 16px;
  font-weight: 900;
  margin: 0 0 4px 0;
  color: #000000;
}

.thermal-receipt-header .store-sub {
  font-size: 11px;
  color: #333333;
  margin: 0 0 4px 0;
}

.thermal-receipt-header .store-info {
  font-size: 11px;
  color: #444444;
  margin: 2px 0;
}

.thermal-receipt-divider {
  text-align: center;
  font-size: 11px;
  color: #888888;
  margin: 8px 0;
  overflow: hidden;
}

.thermal-receipt-meta {
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.thermal-receipt-meta div {
  display: flex;
  justify-content: space-between;
}

.thermal-receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 4px 0;
}

.thermal-receipt-table th {
  border-bottom: 1px dashed #666;
  padding: 4px 2px;
  font-weight: 700;
}

.thermal-receipt-table td {
  padding: 4px 2px;
  border-bottom: 1px dotted #ccc;
  vertical-align: top;
}

.thermal-receipt-totals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.thermal-receipt-totals .total-row {
  display: flex;
  justify-content: space-between;
}

.thermal-receipt-totals .total-row.grand-total,
.thermal-receipt-totals .grand-total {
  font-size: 15px;
  font-weight: 900;
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 6px 0;
  margin: 4px 0;
}

.thermal-receipt-qr {
  text-align: center;
  margin: 12px 0 8px 0;
}

.thermal-receipt-qr img {
  width: 120px;
  height: 120px;
  display: inline-block;
}

.thermal-receipt-footer {
  text-align: center;
  font-size: 11px;
  color: #444444;
  margin-top: 8px;
}

/* Print Rules specifically for Thermal Receipts (80mm & 58mm) */
@media print {
  body * {
    visibility: hidden !important;
  }
  #thermal-receipt-print-area,
  #thermal-receipt-print-area * {
    visibility: visible !important;
  }
  #thermal-receipt-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 2mm !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
  #thermal-receipt-print-area.receipt-58mm {
    width: 58mm !important;
    max-width: 58mm !important;
  }
  #thermal-receipt-print-area.receipt-58mm .thermal-receipt-container {
    font-size: 10px !important;
  }
  #thermal-receipt-print-area.receipt-58mm .store-name {
    font-size: 13px !important;
  }
  #thermal-receipt-print-area.receipt-58mm .thermal-receipt-qr img {
    width: 95px !important;
    height: 95px !important;
  }
  #thermal-receipt-print-area .thermal-receipt-container {
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  @page {
    size: 80mm auto;
    margin: 0;
  }
}

/* ==================== Stocktaking & Expiry Styles ==================== */
.stk-metrics-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius, 8px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stk-qty-input {
  border-color: var(--primary) !important;
  transition: all 0.2s ease;
}

.stk-qty-input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
  background-color: var(--bg-card) !important;
}

#stocktake-items-table tr:hover {
  background-color: rgba(59, 130, 246, 0.03);
}

#stocktake-items-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
}

/* ==================== CAMERA SCANNER VIEWFINDER ==================== */
.camera-viewport-container {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #090d16;
  min-height: 280px;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 4px 20px rgba(0, 0, 0, 0.25);
}

.scanner-target-frame {
  position: absolute;
  width: 250px;
  height: 160px;
  pointer-events: none;
  border-radius: 8px;
  transition: all 0.25s ease;
}

.scanner-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #38bdf8;
  border-style: solid;
}

.scanner-corner.tl {
  top: 0;
  left: 0;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 8px;
}

.scanner-corner.tr {
  top: 0;
  right: 0;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 8px;
}

.scanner-corner.bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 8px;
}

.scanner-corner.br {
  bottom: 0;
  right: 0;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 8px;
}

.scanner-laser-line {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 3px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0) 0%, #ef4444 50%, rgba(239, 68, 68, 0) 100%);
  box-shadow: 0 0 10px #ef4444, 0 0 18px rgba(239, 68, 68, 0.8);
  animation: scan-laser 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scan-laser {
  0% {
    top: 10%;
    opacity: 0.7;
  }
  50% {
    top: 90%;
    opacity: 1;
  }
  100% {
    top: 10%;
    opacity: 0.7;
  }
}

/* حالة التقاط الباركود بنجاح */
.scanner-target-frame.detected .scanner-corner {
  border-color: var(--success);
  box-shadow: 0 0 14px var(--success);
}

.scanner-target-frame.detected .scanner-laser-line {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0) 0%, #10b981 50%, rgba(16, 185, 129, 0) 100%);
  box-shadow: 0 0 12px #10b981;
}

/* ==================== MOBILE & TABLET RESPONSIVE SYSTEM ==================== */
.mobile-menu-btn {
  display: none;
}

#mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  transition: opacity 0.3s ease;
}

@media (max-width: 850px) {
  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1.1rem;
    border-radius: 8px;
  }

  .hide-mobile {
    display: none !important;
  }

  /* Drawer Sidebar */
  aside.sidebar {
    position: fixed !important;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.45);
  }

  aside.sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  main.main-content {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  header.topbar {
    padding: 0 14px;
    gap: 8px;
  }

  .topbar-right {
    gap: 8px;
  }

  .topbar-left {
    gap: 8px;
  }

  /* POS Responsiveness on Tablet / Mobile */
  .pos-container {
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  .pos-cart-panel {
    width: 100% !important;
    min-height: 380px;
  }

  /* Search and action bars wrapping */
  .tab-header, .action-bar, .filters-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
}

/* ==================== AUDIT TRAIL & SECURITY CONTROLS ==================== */
.badge-audit-delete {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-audit-price {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-audit-override {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-audit-success {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-audit-user {
  background: rgba(168, 85, 247, 0.12) !important;
  color: #a855f7 !important;
  border: 1px solid rgba(168, 85, 247, 0.3) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.badge-audit-config {
  background: rgba(14, 165, 233, 0.12) !important;
  color: #0ea5e9 !important;
  border: 1px solid rgba(14, 165, 233, 0.3) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.input-error-shake {
  animation: inputShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}
@keyframes inputShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}
.pin-pad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 0 auto;
}
.pin-pad-btn {
  height: 52px;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}
.pin-pad-btn:hover {
  background: var(--primary-light);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.pin-pad-btn:active {
  transform: scale(0.96);
}

/* ==================== 1. COLLAPSIBLE SIDEBAR (DESKTOP & LAPTOPS) ==================== */
aside.sidebar {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed aside.sidebar {
  width: 72px !important;
}

body.sidebar-collapsed .sidebar-brand {
  padding: 18px 10px;
  justify-content: center;
}

body.sidebar-collapsed .sidebar-brand-name {
  display: none !important;
}

body.sidebar-collapsed .menu-section-header {
  font-size: 0;
  height: 1px;
  background: rgba(16, 185, 129, 0.2);
  margin: 10px 8px;
  padding: 0;
  border-bottom: none;
}

body.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 12px 0;
  position: relative;
}

body.sidebar-collapsed .menu-item span {
  display: none !important;
}

body.sidebar-collapsed .menu-item-icon {
  margin: 0;
  font-size: 18px;
  width: auto;
}

body.sidebar-collapsed .menu-item.active::after {
  right: 2px;
  width: 3px;
  height: 60%;
  top: 20%;
}

/* Floating Tooltip when Collapsed */
body.sidebar-collapsed .menu-item:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  right: 78px;
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: tooltipFadeIn 0.15s ease-out;
}

body.sidebar-collapsed.dark-theme .menu-item:hover::before {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateY(-50%) translateX(6px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* ==================== 2. TOPBAR CONTROLS & LIVE STATUS ==================== */
.desktop-sidebar-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  cursor: pointer;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.desktop-sidebar-toggle:hover {
  background: var(--primary-light);
  color: var(--accent);
  border-color: var(--accent);
}

.topbar-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.25);
  user-select: none;
  transition: var(--transition);
}

.topbar-status-badge.offline {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  position: relative;
}

.status-pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background-color: inherit;
  opacity: 0.4;
  animation: pulseAnimation 2s infinite ease-out;
}

.topbar-status-badge.offline .status-pulse-dot {
  background-color: var(--danger);
}

@keyframes pulseAnimation {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ==================== 3. ENHANCED TABLE STYLES & STICKY HEADER ==================== */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
  position: relative;
  max-height: calc(100vh - 270px);
  scrollbar-width: thin;
}

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: right;
  font-size: 13.5px;
}

table.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--primary-light);
  color: var(--text-main);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

body.dark-theme table.data-table thead th {
  background-color: #1e293b;
  border-bottom-color: #334155;
}

table.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

table.data-table tbody tr {
  transition: background-color 0.15s ease;
}

table.data-table tbody tr:hover {
  background-color: rgba(16, 185, 129, 0.05) !important;
}

body.dark-theme table.data-table tbody tr:hover {
  background-color: rgba(16, 185, 129, 0.1) !important;
}

/* ==================== 4. EMPTY STATE DESIGN COMPONENT ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 45px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 44px;
  color: var(--border);
  margin-bottom: 14px;
  opacity: 0.85;
}

body.dark-theme .empty-state-icon {
  color: #334155;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 16px;
}

/* ==================== 5. MODAL LOCK & RESPONSIVENESS ==================== */
body.modal-open {
  overflow: hidden;
}

.modal-box {
  width: 92%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 130px);
}

/* ==================== 6. RESPONSIVE REFINEMENTS (MOBILE & TABLET) ==================== */
@media (max-width: 992px) {
  .invoice-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    overflow: visible !important;
    gap: 16px !important;
  }

  .invoice-sidebar,
  .invoice-main {
    max-height: none !important;
    overflow-y: visible !important;
  }
}

@media (max-width: 850px) {
  .desktop-sidebar-toggle {
    display: none !important;
  }

  .topbar-status-badge {
    display: none !important;
  }

  .system-date {
    display: none !important;
  }

  .user-details {
    display: none !important;
  }

  .user-info {
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .topbar-title {
    font-size: 15px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 10px !important;
  }
}


