:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --glass-bg: rgba(19, 27, 46, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-glow: rgba(99, 102, 241, 0.15);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);
  
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.2);

  --font-ar: 'Cairo', sans-serif;
  --font-en: 'Outfit', sans-serif;
}

/* Light Theme Variables */
body.light-theme {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-glow: rgba(99, 102, 241, 0.25);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --primary: #4f46e5;
  --primary-hover: #3730a3;
  --primary-glow: rgba(79, 70, 229, 0.15);
}

body.light-theme {
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.02) 0%, transparent 40%);
}

body.light-theme .password-input-wrapper input {
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
}

body.light-theme .search-wrapper input {
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
}

body.light-theme .data-table th {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.015);
}

body.light-theme .btn-icon {
  background: rgba(0, 0, 0, 0.03);
  color: #0f172a;
}

body.light-theme .btn-icon:hover {
  color: #ffffff;
}

body.light-theme .topbar {
  background: rgba(241, 245, 249, 0.8);
}

body.light-theme .avatar {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .btn-secondary {
  border-color: rgba(0, 0, 0, 0.08);
}


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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

.hidden {
  display: none !important;
}

/* Glassmorphism Styles */
.glassmorphism {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.glassmorphism:hover {
  border-color: var(--glass-border-glow);
}

/* Login Page */
.glass-overlay {
  position: fixed;
  inset: 0;
  background: #f1f5f9; /* Pure light background */
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  color: #0f172a;
  border-radius: 16px;
}

.logo-badge {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  border-radius: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 20px var(--primary-glow);
}

.logo-badge i {
  width: 32px;
  height: 32px;
  color: white;
}

.login-header h2 {
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 8px;
  color: #0f172a;
}

.login-header p {
  color: #475569;
  font-size: 13px;
  margin-bottom: 30px;
}

.input-group {
  text-align: left;
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 8px;
  font-weight: 600;
}

.password-input-wrapper {
  position: relative;
  display: flex;
}

.password-input-wrapper input {
  width: 100%;
  padding: 14px 40px 14px 16px; /* Extra padding on right for eye icon */
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-en);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.password-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.password-input-wrapper .icon-btn {
  position: absolute;
  right: 12px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
}

.error-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--error-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 12px;
  border-radius: 8px;
  color: var(--error);
  font-size: 13px;
  margin-bottom: 24px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-ar);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* App Container Layout */
#app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  margin-bottom: 40px;
}

.sidebar-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  color: var(--text-primary);
}

.sidebar-header .logo i {
  color: var(--primary);
  width: 28px;
  height: 28px;
}

.badge-online {
  display: inline-block;
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 2px 10px;
  font-size: 11px;
  border-radius: 12px;
  font-weight: 700;
  margin-top: 8px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
  padding-bottom: 30px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.menu-item i {
  width: 20px;
  height: 20px;
  transition: transform 0.2s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.menu-item:hover i {
  transform: translateX(-3px);
}

.menu-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.menu-item.active i {
  transform: none !important;
}

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

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ar);
  font-weight: 600;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(11, 15, 25, 0.5);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title h1 {
  font-weight: 800;
  font-size: 24px;
}

.topbar-title p {
  color: var(--text-secondary);
  font-size: 13px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-role {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
}

.avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-secondary);
}

.content-body {
  padding: 40px;
  flex-grow: 1;
}

/* Stats Widgets Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.stat-icon-wrapper i {
  width: 24px;
  height: 24px;
}

.stat-icon-wrapper.sales {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.stat-icon-wrapper.paid {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.stat-icon-wrapper.outstanding {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.stat-icon-wrapper.stock {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.stat-info h3 {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 20px;
}

.stat-card.highlighted {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 8px 32px 0 rgba(245, 158, 11, 0.08);
}

.stat-card.highlighted:hover {
  border-color: rgba(245, 158, 11, 0.5);
}

/* Action Bar */
.action-bar {
  margin-bottom: 24px;
}

.search-wrapper {
  position: relative;
  max-width: 400px;
  display: flex;
}

.search-wrapper i {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
}

.search-wrapper input {
  width: 100%;
  padding: 12px 48px 12px 16px;
  background: rgba(19, 27, 46, 0.5);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.2s;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Dashboard Content Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.chart-card {
  padding: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 800;
}

.card-header i {
  color: var(--text-muted);
}

/* Custom Table Design */
.table-card {
  overflow: hidden;
}

.table-container {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 10px;
}

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

.data-table th {
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
}

.data-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 14px;
}

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

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.number-cell {
  font-family: var(--font-en);
  font-weight: 600;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 12px;
}

.badge.success {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge.warning {
  background: var(--warning-glow);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge.error {
  background: var(--error-glow);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge.normal {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

/* Modal Window Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-card {
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 800;
}

.modal-header button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

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

/* Client Sheet in Modal */
.client-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.profile-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 14px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}
.light-theme .profile-item {
  background: rgba(0, 0, 0, 0.02);
}
.profile-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.light-theme .profile-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.profile-item label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 700;
}

.profile-item p {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.tabs-header {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
}

.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 6px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Document Printable Styling inside Modal */
.invoice-print {
  background: #ffffff;
  color: #1e293b;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.company-logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: #4f46e5;
}

.invoice-meta {
  text-align: left;
}

.invoice-meta h2 {
  font-size: 18px;
  font-weight: 800;
}

.invoice-party-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
}

.invoice-party {
  flex: 1;
}

.invoice-party.client {
  text-align: left;
}

.invoice-party label {
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.invoice-party p {
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}

.print-table th {
  background: #f8fafc;
  border-bottom: 2px solid #cbd5e1;
  padding: 12px 8px;
  font-weight: 700;
  text-align: right;
  color: #475569;
}

.print-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 8px;
}

.print-table tr:last-child td {
  border-bottom: none;
}

.invoice-summary-row {
  display: flex;
  justify-content: flex-end;
}

.summary-box {
  width: 250px;
  border-top: 2px solid #cbd5e1;
  padding-top: 12px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.summary-line.total {
  font-size: 16px;
  font-weight: 800;
  color: #4f46e5;
  border-top: 1px solid #e2e8f0;
  margin-top: 6px;
  padding-top: 10px;
}

.print-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-print {
  padding: 10px 20px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ar);
}

.btn-print:hover {
  background: #4338ca;
}

@media print {
  body * {
    visibility: hidden;
  }
  #modal-container, #modal-container * {
    visibility: visible;
  }
  #modal-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  .print-actions, .modal-header {
    display: none !important;
  }
  .invoice-print {
    box-shadow: none;
    padding: 0;
  }
}

/* Mobile and Tablet Responsiveness */
.mobile-only {
  display: none !important;
}

@media (max-width: 1024px) {
  .topbar {
    padding: 20px;
  }
  .content-body {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex !important;
  }

  #app-container {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0; /* Since RTL is active, right is the starting edge */
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(100%); /* Hide sidebar offscreen on the right */
    transition: transform 0.3s ease-in-out;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
  }

  /* When page layout is LTR */
  [dir="ltr"] .sidebar {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2);
  }

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

  .main-content {
    height: auto;
    min-height: calc(100vh - 73px);
  }

  .topbar {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
  }

  .topbar-title h1 {
    font-size: 18px;
  }

  .topbar-title p {
    font-size: 11px;
  }

  .content-body {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 16px;
    gap: 12px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  .stat-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .stat-icon-wrapper i {
    width: 20px;
    height: 20px;
  }

  .stat-info h3 {
    font-size: 12px;
  }

  .stat-val {
    font-size: 16px !important;
  }

  /* Table responsiveness */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .data-table th, .data-table td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Modal responsiveness */
  .modal-content {
    width: 95%;
    max-height: 85vh;
    padding: 16px;
  }
  
  .modal-card {
    max-width: 95vw !important;
  }

  .invoice-print {
    padding: 16px;
  }

  .invoice-header-row {
    flex-direction: column;
    gap: 16px;
  }

  .invoice-meta {
    text-align: right;
  }

  .invoice-party-row {
    flex-direction: column;
    gap: 16px;
  }

  .invoice-party.client {
    text-align: right;
  }

  .summary-box {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr; /* 1 column on small phones */
  }

  .user-role {
    display: none; /* Hide admin name to save space */
  }
}

.suggestion-item {
  transition: background-color 0.2s ease;
}

.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.light-theme .suggestion-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* --- Atlas Invoice Print Style --- */
.invoice-print.atlas-style {
  font-family: 'Outfit', 'Cairo', sans-serif !important;
  color: #000000 !important;
  background: #ffffff !important;
  padding: 30px !important;
  border: 1px solid #000000 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  position: relative;
  overflow: hidden;
  max-width: 800px;
  margin: 0 auto;
}

/* Header section */
.atlas-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 8px;
}

/* Real logo image */
.atlas-real-logo {
  width: 100%;
  max-width: 700px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.atlas-logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.atlas-logo-text h1 {
  font-size: 26px;
  font-weight: 800;
  color: #1c4d99 !important;
  margin: 0;
  letter-spacing: 1px;
}

.atlas-logo-text h2 {
  font-size: 16px;
  font-weight: 700;
  color: #1c4d99 !important;
  margin: 0;
  letter-spacing: 5px;
  text-align: center;
}

.atlas-header-subtext {
  font-size: 10px;
  line-height: 1.4;
  color: #333333 !important;
  font-weight: 600;
}

/* Double horizontal line */
.atlas-double-line {
  border-top: 3px double #1c4d99;
  margin: 12px 0 20px;
  width: 100%;
}

/* Party Row (Emetteur vs Destinataire) */
.atlas-party-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  flex-direction: row !important;
}

.atlas-box {
  border: 2px solid #000000 !important;
  border-radius: 12px;
  padding: 16px;
  background: transparent !important;
  color: #000000 !important;
  box-shadow: none !important;
}

.doc-box {
  width: 45%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-title {
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.client-box {
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.client-name {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.client-ice {
  font-size: 12px;
  font-weight: 700;
}

/* Date and Client Code Row */
.atlas-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.meta-left {
  text-align: left;
}

.meta-right {
  text-align: right;
}

/* Atlas Table Styling */
table.atlas-table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin-bottom: 24px !important;
}

table.atlas-table th {
  border: 1px solid #000000 !important;
  background: #f1f5f9 !important;
  color: #000000 !important;
  font-weight: 800;
  font-size: 12px;
  padding: 8px 10px !important;
  text-transform: uppercase;
}

table.atlas-table td {
  border: 1px solid #000000 !important;
  background: transparent !important;
  color: #000000 !important;
  font-size: 12px;
  padding: 8px 10px !important;
  font-family: 'Outfit', sans-serif;
}

table.atlas-table td.designation-cell {
  font-weight: 700;
}

/* Summary container */
.atlas-summary-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  flex-direction: row !important;
}

.atlas-tax-box {
  width: 45%;
}

table.atlas-tax-table {
  width: 100% !important;
  border-collapse: collapse !important;
}

table.atlas-tax-table th {
  border: 1px solid #000000 !important;
  background: #f1f5f9 !important;
  color: #000000 !important;
  font-weight: 800;
  font-size: 11px;
  padding: 6px !important;
  text-align: center;
}

table.atlas-tax-table td {
  border: 1px solid #000000 !important;
  color: #000000 !important;
  font-size: 11px;
  padding: 6px !important;
  text-align: center;
}

.atlas-totals-box {
  width: 50%;
}

table.atlas-totals-table {
  width: 100% !important;
  border-collapse: collapse !important;
}

table.atlas-totals-table th {
  border: 1px solid #000000 !important;
  background: #f1f5f9 !important;
  color: #000000 !important;
  font-weight: 800;
  font-size: 12px;
  padding: 8px 10px !important;
  text-align: left;
}

table.atlas-totals-table td {
  border: 1px solid #000000 !important;
  color: #000000 !important;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px !important;
  text-align: right;
}

table.atlas-totals-table tr.total-row th,
table.atlas-totals-table tr.total-row td {
  background: #e2e8f0 !important;
  font-size: 14px;
}

/* Words representation */
.atlas-amount-words {
  border: 1px solid #000000 !important;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.atlas-amount-words p {
  font-size: 11px;
  margin: 0 0 6px 0;
  color: #555555 !important;
  font-weight: 600;
}

.atlas-amount-words h3 {
  font-size: 13px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.5px;
}

/* Real Cachet Stamp Image */
.atlas-stamp-wrapper {
  position: absolute;
  bottom: 100px;
  left: 40px;
  z-index: 10;
  pointer-events: none;
}

.atlas-real-stamp {
  width: 180px;
  height: auto;
  transform: rotate(-5deg);
  opacity: 0.88;
  mix-blend-mode: multiply;
}

.invoice-print.no-stamp .atlas-stamp-wrapper {
  display: none !important;
}

/* Footer details */
.atlas-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 9px;
  line-height: 1.4;
  color: #333333 !important;
  font-weight: 600;
}

.atlas-footer .atlas-line {
  border-top: 1px solid #000000;
  margin-bottom: 8px;
}

.footer-address, .footer-ids, .footer-email {
  margin: 2px 0;
}

/* Hide light theme custom border for prints */
.light-theme .invoice-print.atlas-style {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #000000 !important;
}

/* Print specific styles overrides */
@media print {
  #app-container, #login-container {
    display: none !important;
  }
  #modal-container {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  #modal-container .modal-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  .invoice-print.atlas-style {
    border: none !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .no-print, .print-actions, .modal-header {
    display: none !important;
  }
  table.atlas-table {
    page-break-inside: auto !important;
  }
  table.atlas-table thead {
    display: table-header-group !important;
  }
  table.atlas-table tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
  .atlas-summary-container,
  .atlas-amount-words,
  .atlas-stamp-wrapper,
  .atlas-footer {
    page-break-inside: avoid !important;
  }
}



/* Switch Toggle Styles for Settings */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid var(--glass-border);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-primary);
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent, #4f46e5);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
