/* Modern Professional UI Theme */
:root {
  --primary: #6366f1; /* Indigo */
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #06b6d4; /* Cyan */
  --secondary-dark: #0891b2;
  --accent: #f59e0b; /* Amber */
  --success: #10b981; /* Emerald */
  --warning: #f59e0b; /* Amber */
  --danger: #ef4444; /* Red */
  --info: #3b82f6; /* Blue */
  
  --bg: #fafbfc; /* Light background */
  --bg-2: #f8fafc; /* Slightly darker background */
  --bg-3: #f1f5f9; /* Card background */
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b; /* Dark text */
  --text-muted: #64748b; /* Muted text */
  --text-light: #94a3b8; /* Light text */
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  --gradient-accent: linear-gradient(135deg, var(--accent) 0%, #f97316 100%);
}

/* Base Styles */
* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

html, body, #root { 
  height: 100%; 
  font-size: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app {
  display: flex;
  height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #1a1d2e 0%, #16192b 100%);
  border-right: 1px solid rgba(99, 102, 241, 0.1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-info {
  flex: 1;
}

.brand h1 {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  margin: 0;
  color: white;
}

.brand p {
  font-size: 11px;
  opacity: 0.85;
  margin: 4px 0 0 0;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

.nav::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 8px;
}

.nav-section-title:first-child {
  margin-top: 0;
}

.nav-section-title .section-icon {
  font-size: 14px;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.12);
  color: rgba(255, 255, 255, 0.95);
  transform: translateX(3px);
  border-color: rgba(99, 102, 241, 0.2);
}

.nav-item:hover::before {
  opacity: 1;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
  border-color: rgba(99, 102, 241, 0.4);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.25s ease;
}

.nav-item:hover .icon,
.nav-item.active .icon {
  transform: scale(1.1);
}

.nav-item .lock {
  color: #fbbf24;
  font-size: 13px;
  margin-left: auto;
  opacity: 0.8;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.header {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: var(--gradient-primary);
  border-bottom: 1px solid rgba(99, 102, 241, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(99, 102, 241, 0.04);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
  color: #fff;
}
.header h1,
.header .subtitle,
.header .time-text,
.header .user-name {
  color: #fff !important;
  text-shadow: 0 1px 4px rgba(44, 51, 73, 0.18);
}

.header-left h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  /* remove gradient text and force white for better contrast */
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: #fff !important;
  color: #fff !important;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.header-left .subtitle {
  color: #fff !important;
  font-size: 14px;
  margin-top: 6px;
  font-weight: 500;
  opacity: 0.7;
  line-height: 1.4;
}

/* Admin / Logout controls styling */
.user-menu-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
}

.user-menu {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(16,24,40,0.06);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.logout-btn {
  background: #fff;
  color: var(--primary-dark);
  border: none;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(16,24,40,0.06);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.logout-text { color: var(--primary-dark); font-weight: 600; }

/* Strong overrides: make profile + logout share one white rounded background
   and ensure internal text is dark for good contrast. Placed at end
   to override earlier button gradient rules. */
.header .header-right .user-menu-wrapper {
  background: #ffffff !important;
  border-radius: 14px !important;
  padding: 6px 10px !important;
  box-shadow: 0 6px 18px rgba(16,24,40,0.06) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.header .header-right .user-menu {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 8px !important;
}

.header .header-right .user-avatar { box-shadow: none !important; }

.header .header-right .user-name,
.header .header-right .user-role,
.header .header-right .avatar-text {
  color: #0f172a !important; /* dark navy */
}

.header .header-right .logout-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(220,38,38,0.18) !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  border: none !important;
  font-weight: 600 !important;
}

.header .header-right .logout-btn .logout-icon { display: none !important; }

/* Ensure logout text is white in all circumstances */
.header .header-right .logout-btn,
.header .header-right .logout-btn .logout-text {
  color: #fff !important;
}


.header-title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.header-right {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-time {
  display: flex;
  align-items: center;
  gap: 10px;2px 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  height: fit-content
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.time-icon {
  font-size: 18px;
  opacity: 0.8;
}

.time-text {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.3px;
}

.user-menu-wrapper {
  display: flex;
  align-items: center;
  gap: 14px10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.12);
  transition: all 0.25s ease;
  height: fit-content 102, 241, 0.12);
  transition: all 0.25s ease;
}

.user-menu-wrapper:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.user-avatar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.user-menu:hover .user-avatar::before {
  opacity: 1;
}

.avatar-text {
  color: white;
  font-weight: 700;
  font-size: 18px;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.user-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.2;
}

.user-role {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  line-height: 1.2;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: white;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
  position: relative;
  overflow: hidden;
}

.logout-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.logout-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.logout-btn:hover::before {
  opacity: 1;
}

.logout-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.logout-icon {
  font-size: 18px;
  line-height: 1;
}

.logout-text {
  letter-spacing: 0.3px;
  font-size: 14px;
}

.content {
  flex: 1;
  padding: 24px;
  background: var(--bg);
  overflow-y: auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
}

.page-description {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
}
/* Cards and Components */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-description {
  color: var(--text-muted);
  font-size: 14px;
  margin: 4px 0 0 0;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.stat-card.secondary::before {
  background: var(--gradient-secondary);
}

.stat-card.accent::before {
  background: var(--gradient-accent);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 8px 0 0 0;
  line-height: 1;
}

.stat-change {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(44,51,73,0.08);
    padding: 8px 16px;
    display: flex;
    align-items: center;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* Modern Table Styles */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-2);
}

.table-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.table-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 4px 0 0 0;
}

.table-scroll {
  overflow-x: auto;
}

.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.modern-table thead th {
  background: var(--bg-2);
  color: var(--text);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.modern-table tbody td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  font-size: 14px;
  vertical-align: middle;
}

.modern-table tbody tr {
  transition: all 0.2s ease;
}

.modern-table tbody tr:hover {
  background: var(--bg-2);
}

.modern-table tbody tr:last-child td {
  border-bottom: none;
}

.serial-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.status-badge.info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.amount-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.cell-strong {
  font-weight: 600;
  color: var(--text);
}

/* Enhanced Table Cell Styles */
.datetime-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-part {
  font-weight: 600;
  color: var(--text);
}

.time-part {
  font-size: 11px;
  color: #fff;
}

.bank-cell, .supplier-cell, .product-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cell-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.reference-cell {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.amount-badge.positive {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.amount-badge.negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.product-code {
  font-family: monospace;
  font-size: 12px;
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.brand-text, .model-text {
  color: var(--text-muted);
  font-size: 13px;
}

.date-cell {
  font-size: 12px;
  color: var(--text-muted);
}

/* WhatsApp Inventory Enhancements */
.toggle-section {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.toggle-pill {
  display: flex;
  background: var(--bg-2);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.toggle-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.toggle-btn:hover:not(.active) {
  background: var(--border-light);
  color: var(--text);
}

.mode-description {
  margin-top: 16px;
}

.info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-2);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.info-icon {
  font-size: 24px;
}

.info-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.info-text {
  font-size: 13px;
  color: var(--text-muted);
}

.content-wrapper {
  margin-top: 20px;
}

.loading-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
}

/* Enhanced Form Elements for Product Price */
.pricing-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}

.supply-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}

.calculated-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 4px;
  text-align: center;
}

.input-group {
  display: flex;
  align-items: center;
}

.input-suffix {
  margin-left: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-input-sm {
  padding: 6px 8px;
  font-size: 12px;
  height: auto;
}

.form-input.error {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

.error-text {
  font-size: 10px;
  color: var(--danger);
  margin-top: 2px;
}

.text-right {
  text-align: right;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}

.table-info {
  font-size: 14px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination-btn {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.pagination-info {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 16px;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-description {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 24px;
}

.empty-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.empty-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Forms */
.form-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.form-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.form-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
  color: var(--text-light);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 4px;
}

.form-help {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-secondary {
  background: var(--gradient-secondary);
  color: white;
}

.btn-accent {
  background: var(--gradient-accent);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-2);
  color: var(--text);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Authentication */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: var(--gradient-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-link:hover {
  text-decoration: underline;
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Loading */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.modal {
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-2);
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

/* Utility Classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }

.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 260px;
    position: fixed;
    left: -260px;
    z-index: 40;
    transition: left 0.3s ease;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .main {
    margin-left: 0;
  }
  
  .content {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
  
  .auth-card {
    padding: 24px;
  }
  
  .table-scroll {
    font-size: 13px;
  }

  .header {
    padding: 0 16px;
    height: 64px;
  }

  .header-left h1 {
    font-size: 20px;
  }

  .header-time {
    display: none;
  }

  .user-menu-wrapper {
    padding: 4px;
  }

  .user-menu {
    padding: 4px 8px;
  }

  .user-info {
    display: none;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
  }

  .logout-text {
    display: none;
  }

  .logout-btn {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  .logout-icon {
    font-size: 18px;
  }
}

/* Legacy compatibility */
.row { display: flex; align-items: center; gap: 12px; }

input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: var(--gradient-primary);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

button.btn.secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.text-danger { color: var(--danger); }

.pretty-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.serial-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  font-size: 12px;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pager-btn {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.empty-sub {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 24px;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
======================================== */

/* Mobile Layout Variables */
:root {
  --mobile-header-height: 68px;
  --mobile-sidebar-width: 320px;
  --mobile-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile App Container */
.mobile-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: var(--bg);
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* ========================================
   MOBILE HEADER STYLES
======================================== */

.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
  height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
  background: var(--gradient-primary);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: calc(env(safe-area-inset-top) + 8px);
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  z-index: 100;
  color: white;
  margin: 0;
  border-radius: 0;
}

.mobile-app.sidebar-open .mobile-header {
  z-index: 0;
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.mobile-menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all var(--mobile-transition);
  position: relative;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.hamburger-line {
  width: 18px;
  height: 2px;
  background: white;
  border-radius: 1px;
  transition: all var(--mobile-transition);
  transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.mobile-header-content {
  flex: 1;
  min-width: 0;
}

.mobile-title {
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.mobile-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.mobile-logout-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.mobile-logout-btn:active {
  transform: scale(0.95);
}

.mobile-logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.mobile-logout-btn svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   MOBILE NAV HEADER STYLES
======================================== */

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 0 0 16px 16px;
  margin-bottom: 16px;
}

.mobile-nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-brand-icon {
  font-size: 24px;
}

.mobile-brand-text {
  display: flex;
  flex-direction: column;
}

.mobile-brand-title {
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}

.mobile-brand-subtitle {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 500;
}

.mobile-nav-stats {
  display: flex;
  align-items: center;
}

.mobile-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  opacity: 0.9;
}

.mobile-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

.mobile-branch-count {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.mobile-branch-icon {
  font-size: 14px;
}

/* ========================================
   MOBILE SIDEBAR STYLES
======================================== */

.mobile-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--mobile-transition);
}

.mobile-sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--mobile-sidebar-width);
  height: 100%;
  background: linear-gradient(180deg, #1a1d2e 0%, #16192b 100%);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  z-index: 1300;
  transform: translateX(-100%);
  transition: transform var(--mobile-transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-sidebar.open {
  transform: translateX(0);
}

.mobile-sidebar-header {
  position: relative;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}

/* Reserve space so header content doesn't sit under the close (X) button */
.mobile-sidebar-header .mobile-nav-header {
  padding-right: 64px;
}

.mobile-sidebar-close {
  position: absolute;
  top: 16px;
  right: 16px;
  /* Opaque background so nothing shows through */
  background: rgba(26, 29, 46, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 20;
  backdrop-filter: none;
}

.mobile-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1) rotate(90deg);
}

.mobile-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.mobile-nav::-webkit-scrollbar {
  width: 6px;
}

.mobile-nav::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-nav::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

.mobile-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

.mobile-nav-section {
  margin-bottom: 28px;
}

.mobile-nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.05);
  border-radius: 8px;
  border-left: 3px solid rgba(99, 102, 241, 0.3);
}

.mobile-nav-section-title .section-icon {
  font-size: 14px;
  opacity: 0.7;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}

.mobile-nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-nav-item:hover {
  background: rgba(99, 102, 241, 0.12);
  color: rgba(255, 255, 255, 0.95);
  transform: translateX(4px);
  border-color: rgba(99, 102, 241, 0.2);
}

.mobile-nav-item:hover::before {
  opacity: 1;
}

.mobile-nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
  border-color: rgba(99, 102, 241, 0.4);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.mobile-nav-item.active::before {
  opacity: 1;
}

.mobile-nav-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.mobile-nav-item.locked:hover {
  transform: none;
  color: rgba(255, 255, 255, 0.5);
  background: transparent;
  border-color: transparent;
}

.mobile-nav-item.locked:hover::before {
  opacity: 0;
}

.mobile-nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  position: relative;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.mobile-nav-item:hover .mobile-nav-item-icon {
  background: rgba(99, 102, 241, 0.15);
  transform: scale(1.05);
}

.mobile-nav-item.active .mobile-nav-item-icon {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.mobile-icon {
  font-size: 20px;
  transition: transform 0.25s ease;
}

.mobile-nav-item:hover .mobile-icon,
.mobile-nav-item.active .mobile-icon {
  transform: scale(1.1);
}
}

.mobile-nav-item.active .mobile-icon {
  filter: grayscale(1) brightness(0) invert(1);
}

.mobile-lock {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 11px;
  background: #fbbf24;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.mobile-nav-item-content {
  flex: 1;
  min-width: 0;
}

.mobile-nav-item-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 3px;
  color: inherit;
}

.mobile-nav-item-desc {
  display: block;
  font-size: 12px;
  opacity: 0.6;
  color: inherit;
  line-height: 1.2;
}
}

.mobile-nav-item-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.2;
}

.mobile-nav-item.active .mobile-nav-item-desc {
  color: var(--primary-light);
}

.mobile-nav-item-arrow {
  color: rgba(255, 255, 255, 0.3);
  font-size: 20px;
  font-weight: 300;
  transition: all 0.25s ease;
}

.mobile-nav-item:hover .mobile-nav-item-arrow {
  color: rgba(255, 255, 255, 0.7);
  transform: translateX(3px);
}

.mobile-nav-item.active .mobile-nav-item-arrow {
  color: white;
}

.mobile-nav-footer {
  padding: 16px;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  margin-top: auto;
  background: rgba(0, 0, 0, 0.1);
}

.mobile-plan-info {
  text-align: center;
}

.mobile-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.mobile-plan-icon {
  font-size: 16px;
}

.mobile-plan-text {
  font-size: 13px;
  font-weight: 600;
  color: white;
  letter-spacing: 0.3px;
}

.mobile-branch-limit {
  margin-top: 10px;
}

.mobile-limit-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}
  background: var(--gradient-accent);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.mobile-plan-icon {
  font-size: 14px;
}

.mobile-branch-limit {
  color: var(--text-muted);
  font-size: 11px;
}

/* ========================================
   MOBILE MAIN CONTENT STYLES
======================================== */

.mobile-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top));
}

.mobile-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
}

/* ========================================
   RESPONSIVE UTILITIES
======================================== */

/* Ensure mobile components are completely hidden on desktop */
@media (min-width: 769px) {
  .mobile-app,
  .mobile-header,
  .mobile-sidebar,
  .mobile-nav,
  .mobile-layout,
  .mobile-auth-container,
  .mobile-dashboard,
  .mobile-quick-actions,
  .mobile-stats-grid {
    display: none !important;
  }
}

/* Hide desktop components on mobile */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overscroll-behavior: none;
  }
  
  #root {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 !important;
    overflow: hidden;
  }
  
  .app {
    display: none !important;
  }
  
  .sidebar,
  .header,
  .auth-container {
    display: none !important;
  }
}

/* ========================================
   MOBILE FORM ADAPTATIONS
======================================== */

@media (max-width: 768px) {
  /* Make cards stack better on mobile */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  /* Better form layouts on mobile */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  .form-input,
  .form-textarea,
  .form-select {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 12px 16px !important;
  }
  
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    padding: 14px 20px !important;
    font-size: 16px !important;
    width: 100%;
    justify-content: center;
  }
  
  /* Card adaptations */
  .card {
    padding: 16px !important;
    margin: 0 0 16px 0 !important;
    border-radius: 12px;
  }
  
  .card-header {
    padding: 16px !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  
  .card-title {
    font-size: 18px !important;
  }
  
  .card-description {
    font-size: 14px !important;
  }
  
  /* Table adaptations */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -16px;
    padding: 16px;
  }
  
  .table,
  .modern-table {
    min-width: 800px;
    font-size: 14px !important;
  }
  
  .table th,
  .table td,
  .modern-table th,
  .modern-table td {
    padding: 10px 8px !important;
    font-size: 13px !important;
  }
  
  /* Modal adaptations */
  .modal {
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh !important;
    bottom: 0 !important;
    top: auto !important;
  }
  
  .modal-overlay {
    align-items: flex-end !important;
  }
  
  .modal-content {
    max-height: 80vh !important;
    overflow-y: auto !important;
    padding: 16px !important;
  }
  
  .modal-header {
    padding: 16px !important;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .modal-title {
    font-size: 18px !important;
  }
  
  .modal-body {
    padding: 16px !important;
  }
  
  .modal-footer {
    padding: 16px !important;
    flex-direction: column;
    gap: 12px;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  /* Pagination on mobile */
  .pager {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
  
  .pager-info {
    order: 3;
    width: 100%;
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
  }
  
  .pager-btn {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  /* Statistics grid */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  /* Action buttons */
  .action-btns {
    flex-direction: column !important;
    width: 100%;
    gap: 12px !important;
  }
  
  .action-btns .btn {
    width: 100% !important;
  }
  
  /* Search and filter sections */
  .filter-section,
  .search-section {
    flex-direction: column !important;
    gap: 12px;
  }
  
  .search-input,
  .filter-input {
    width: 100% !important;
  }
  
  /* Empty states */
  .empty-state {
    padding: 32px 16px !important;
  }
  
  .empty-icon {
    font-size: 48px !important;
  }
  
  .empty-title {
    font-size: 18px !important;
  }
  
  .empty-sub {
    font-size: 14px !important;
  }
}

/* ========================================
   MOBILE CARD LAYOUTS
======================================== */

@media (max-width: 768px) {
  .mobile-card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    border: 1px solid var(--border);
  }
  
  .mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
  }
  
  .mobile-card-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
  }
  
  .mobile-card-action {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--bg-2);
    border: none;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
  }
  
  .mobile-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
  }
  
  .mobile-list-item:last-child {
    border-bottom: none;
  }
  
  .mobile-list-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  
  .mobile-list-content {
    flex: 1;
    min-width: 0;
  }
  
  .mobile-list-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
  }
  
  .mobile-list-subtitle {
    font-size: 12px;
    color: var(--text-muted);
  }
  
  .mobile-list-action {
    flex-shrink: 0;
  }
}

/* ========================================
   MOBILE DASHBOARD STYLES
======================================== */

.mobile-dashboard {
  padding: 0;
}

.mobile-welcome-section {
  background: var(--gradient-primary);
  color: white;
  padding: 24px 20px;
  border-radius: 0 0 24px 24px;
  margin: -16px -16px 24px -16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-welcome-text {
  flex: 1;
}

.mobile-welcome-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.mobile-welcome-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin: 0;
  line-height: 1.3;
}

.mobile-welcome-icon {
  font-size: 32px;
  margin-left: 16px;
}

.mobile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.mobile-stat-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.mobile-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.mobile-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.mobile-stat-change {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}

.mobile-stat-change.positive {
  color: var(--success);
}

.mobile-stat-change.negative {
  color: var(--danger);
}

.mobile-stat-change-icon {
  font-size: 12px;
}

/* ========================================
   MOBILE QUICK ACTIONS STYLES
======================================== */

.mobile-quick-actions {
  margin-bottom: 24px;
}

.mobile-quick-actions-header {
  margin-bottom: 16px;
}

.mobile-quick-actions-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px 0;
}

.mobile-quick-actions-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.mobile-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.mobile-quick-action {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.mobile-quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--action-color, var(--primary));
}

.mobile-quick-action:active {
  transform: translateY(0);
}

.mobile-quick-action-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--action-color, var(--primary)), var(--action-color, var(--primary-dark)));
  filter: grayscale(1) brightness(0) invert(1);
}

.mobile-quick-action:hover .mobile-quick-action-icon {
  filter: none;
}

.mobile-quick-action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

/* ========================================
   MOBILE RECENT ACTIVITY STYLES
======================================== */

.mobile-recent-activity {
  margin-bottom: 24px;
}

.mobile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.mobile-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.mobile-section-action {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.mobile-section-action:hover {
  background: var(--bg-2);
}

.mobile-activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-activity-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.mobile-activity-content {
  flex: 1;
  min-width: 0;
}

.mobile-activity-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.mobile-activity-time {
  font-size: 12px;
  color: var(--text-muted);
}

.mobile-activity-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

/* ========================================
   MOBILE AUTH STYLES
======================================== */

.mobile-auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.mobile-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
}

.mobile-auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.mobile-auth-logo {
  font-size: 48px;
  margin-bottom: 16px;
}

.mobile-auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
}

.mobile-auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.mobile-auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-form-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.mobile-form-input {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  background: var(--card);
  color: var(--text);
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.mobile-form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.mobile-btn {
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  min-height: 50px;
}

.mobile-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mobile-btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow);
}

.mobile-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.mobile-btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.mobile-btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.mobile-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
}

.mobile-alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.mobile-alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.mobile-auth-footer {
  text-align: center;
  margin-top: 24px;
}

.mobile-auth-footer-text {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.mobile-auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.mobile-auth-link:hover {
  text-decoration: underline;
}

/* ========================================
   MOBILE TOUCH OPTIMIZATIONS
======================================== */

/* Ensure minimum touch target size (44px) */
@media (max-width: 768px) {
  button, .btn, .mobile-btn, .nav-item, .mobile-nav-item {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Improve tap targets */
  input, select, textarea {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Smooth scrolling */
  * {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Remove tap highlights */
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  
  /* Custom tap feedback */
  .mobile-nav-item:active,
  .mobile-quick-action:active,
  .mobile-btn:active,
  .mobile-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* Improved scrollbars for mobile */
  ::-webkit-scrollbar {
    width: 2px;
  }
  
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  
  ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 1px;
  }
  
  /* Swipe indicators */
  .mobile-swipe-indicator {
    position: relative;
  }
  
  .mobile-swipe-indicator::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
  }
  
  /* Floating action button */
  .mobile-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: all 0.3s ease;
  }
  
  .mobile-fab:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
  }
  
  .mobile-fab:active {
    transform: scale(0.95);
  }
  
  /* Pull to refresh indicator */
  .mobile-pull-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
  }
  
  /* Loading states optimized for mobile */
  .mobile-skeleton {
    background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
  
  @keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }
  
  /* Safe area for notched devices */
  .mobile-app {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .mobile-header {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  
  /* Dark mode support */
  @media (prefers-color-scheme: dark) {
    .mobile-auth-container {
      background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
    
    .mobile-welcome-section {
      background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .mobile-nav-item,
    .mobile-quick-action,
    .mobile-stat-card {
      border-width: 2px;
    }
  }
  
  /* Reduced motion support */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ========================================
   ANIMATIONS
======================================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
/* ========================================
   MOBILE VIEW-SPECIFIC RESPONSIVE STYLES
======================================== */

@media (max-width: 768px) {
  /* General container and padding adjustments */
  body > div,
  .main-content,
  .content-wrapper {
    padding: 12px !important;
  }
  
  /* Page headers in views */
  h1, .page-title {
    font-size: 24px !important;
    line-height: 1.3 !important;
    margin-bottom: 12px !important;
  }
  
  h2, .section-title {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }
  
  h3, .card-title {
    font-size: 18px !important;
    line-height: 1.3 !important;
  }
  
  h4, .subsection-title {
    font-size: 16px !important;
  }
  
  /* Inline styled tables (used in StockHistory, InStockView, etc.) */
  div[style*="overflowX: 'auto'"],
  div[style*="overflow-x: auto"] {
    margin: -12px !important;
    padding: 12px !important;
  }
  
  table[style*="width: '100%'"],
  table[style*="width: 100%"] {
    font-size: 13px !important;
  }
  
  table th[style*="padding"],
  table td[style*="padding"] {
    padding: 8px 6px !important;
    font-size: 12px !important;
    min-width: 80px !important;
  }
  
  /* Grid layouts in views */
  div[style*="gridTemplateColumns"],
  div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  div[style*="display: grid"] {
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Statistics cards in views */
  div[style*="minmax(250px"] {
    min-width: 100% !important;
  }
  
  /* Form sections with flex layouts */
  div[style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
  
  /* Buttons in flex containers */
  div[style*="display: flex"] button,
  div[style*="display: flex"] .btn {
    min-width: 100% !important;
    margin-bottom: 8px;
  }
  
  /* Input groups and form fields */
  input[style],
  select[style],
  textarea[style] {
    font-size: 16px !important;
    padding: 12px !important;
    width: 100% !important;
  }
  
  /* Product entry rows in InStockView */
  tr[style] td input,
  tr[style] td select {
    min-width: 120px !important;
    font-size: 14px !important;
    padding: 10px 8px !important;
  }
  
  /* Modal dialogs */
  div[style*="position: fixed"][style*="inset"] {
    padding: 12px !important;
  }
  
  div[style*="max-width: 600px"],
  div[style*="max-width: 800px"] {
    max-width: 100% !important;
    width: 100% !important;
  }
  
  /* Summary sections */
  div[style*="background: '#f8fafc'"],
  div[style*="backgroundColor: '#f8fafc'"] {
    padding: 16px !important;
    margin: 12px 0 !important;
  }
  
  /* Action button rows */
  div[style*="justifyContent: 'space-between'"] button {
    flex: 1;
    min-width: auto !important;
  }
  
  /* Card-like containers */
  div[style*="border: '1px solid"],
  div[style*="border: '2px solid"] {
    padding: 12px !important;
    margin-bottom: 12px !important;
  }
  
  /* Improve touch targets for all buttons */
  button,
  .btn,
  a.btn {
    min-height: 44px !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
  }
  
  /* Small icon buttons */
  button[style*="padding: '6px'"],
  button[style*="padding: '8px'"] {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px !important;
  }
  
  /* Date/time inputs */
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"] {
    font-size: 16px !important;
    padding: 12px !important;
  }
  
  /* Select dropdowns */
  select {
    font-size: 16px !important;
    padding: 12px !important;
    background-size: 16px !important;
  }
  
  /* Pagination controls */
  div[style*="pagination"] button,
  .pager button {
    min-width: 44px !important;
    min-height: 44px !important;
  }
  
  /* Table action buttons */
  table button {
    min-width: auto !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
  }
  
  /* Price and currency displays */
  div[style*="fontSize: '18px'"],
  div[style*="font-size: 18px"] {
    font-size: 16px !important;
  }
  
  div[style*="fontSize: '24px'"],
  div[style*="font-size: 24px"] {
    font-size: 20px !important;
  }
  
  /* Reduce horizontal padding in tight spaces */
  div[style*="padding: '24px'"],
  div[style*="padding: 24px"] {
    padding: 16px !important;
  }
  
  div[style*="padding: '32px'"],
  div[style*="padding: 32px"] {
    padding: 20px !important;
  }
  
  /* Fix spacing in header sections */
  div[style*="marginBottom: '32px'"],
  div[style*="margin-bottom: 32px"] {
    margin-bottom: 20px !important;
  }
  
  /* Compact table headers */
  thead tr {
    display: table-row !important;
  }
  
  thead th {
    position: sticky;
    top: 0;
    background: #f8fafc !important;
    z-index: 10;
  }
  
  /* Scrollable content areas */
  .table-scroll,
  .table-container,
  div[style*="overflowY: 'auto'"],
  div[style*="overflow-y: auto"] {
    max-height: 60vh !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Product list items */
  .product-item,
  .seller-product-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 12px !important;
  }
  
  /* Filter sections */
  .filter-row,
  .search-row {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  .filter-row > *,
  .search-row > * {
    width: 100% !important;
  }
  
  /* Summary boxes */
  .summary-box,
  .total-box {
    padding: 16px !important;
    margin: 12px 0 !important;
  }
  
  /* Alert and notification boxes */
  div[style*="backgroundColor: '#fee2e2'"],
  div[style*="background: '#fee2e2'"],
  .alert,
  .notification {
    padding: 12px !important;
    font-size: 14px !important;
    margin: 12px 0 !important;
  }
  
  /* Branch/supplier selection sections */
  .selection-section,
  div[style*="display: 'flex'"][style*="marginBottom: '20px'"] {
    flex-direction: column !important;
  }
  
  .selection-section > div {
    width: 100% !important;
  }
  
  /* IMES input sections */
  .imes-section {
    flex-direction: column !important;
  }
  
  .imes-input {
    width: 100% !important;
    margin-bottom: 8px !important;
  }
  
  /* Purchase history sections */
  .purchase-card,
  div[style*="border: '2px solid #fecaca'"] {
    margin-bottom: 16px !important;
  }
  
  /* Validity popup */
  .validity-popup {
    max-width: 100% !important;
    width: 95% !important;
  }
  
  /* Preview sections */
  .preview-container {
    padding: 12px !important;
    max-height: 70vh !important;
  }
  
  /* WhatsApp and sharing sections */
  .whatsapp-section,
  .share-section {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  /* Amount and balance displays */
  .balance-display,
  .amount-display {
    font-size: 18px !important;
    padding: 12px !important;
  }
  
  /* GST calculator specific */
  .gst-calculator-container {
    padding: 16px !important;
  }
  
  .gst-result-box {
    padding: 12px !important;
    margin: 12px 0 !important;
  }
  
  /* Product sales specific */
  .product-list-container {
    max-height: 50vh !important;
  }
  
  /* Branch supply specific */
  .branch-selector {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  /* Seconds sales specific */
  .seconds-sales-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Sales track/analytics */
  .analytics-grid {
    grid-template-columns: 1fr !important;
  }
  
  .chart-container {
    height: 250px !important;
  }
  
  /* Scrollable modals */
  .modal-scroll-content {
    max-height: 70vh !important;
  }
}

/* ========================================
   MOBILE LANDSCAPE OPTIMIZATIONS
======================================== */

@media (max-width: 768px) and (orientation: landscape) {
  .modal {
    max-height: 85vh !important;
  }
  
  .modal-content,
  .modal-scroll-content {
    max-height: 65vh !important;
  }
  
  .table-scroll,
  .table-container {
    max-height: 50vh !important;
  }
}

/* ========================================
   SMALL MOBILE DEVICES (< 400px)
======================================== */

@media (max-width: 400px) {
  body > div,
  .main-content,
  .content-wrapper {
    padding: 8px !important;
  }
  
  .card {
    padding: 12px !important;
  }
  
  h1, .page-title {
    font-size: 20px !important;
  }
  
  h2, .section-title {
    font-size: 18px !important;
  }
  
  h3, .card-title {
    font-size: 16px !important;
  }
  
  table th,
  table td {
    padding: 6px 4px !important;
    font-size: 11px !important;
    min-width: 70px !important;
  }
  
  button,
  .btn {
    padding: 10px 12px !important;
    font-size: 14px !important;
  }
}
/* ========================================
   MOBILE UTILITY CLASSES
======================================== */

/* Responsive display utilities */
.mobile-only {
  display: none !important;
}

.desktop-only {
  display: block !important;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }
  
  .desktop-only {
    display: none !important;
  }
  
  .mobile-flex {
    display: flex !important;
  }
  
  .mobile-grid {
    display: grid !important;
  }
  
  .mobile-hidden {
    display: none !important;
  }
}

/* Mobile spacing utilities */
@media (max-width: 768px) {
  .mobile-p-0 { padding: 0 !important; }
  .mobile-p-1 { padding: 8px !important; }
  .mobile-p-2 { padding: 12px !important; }
  .mobile-p-3 { padding: 16px !important; }
  .mobile-p-4 { padding: 20px !important; }
  
  .mobile-m-0 { margin: 0 !important; }
  .mobile-m-1 { margin: 8px !important; }
  .mobile-m-2 { margin: 12px !important; }
  .mobile-m-3 { margin: 16px !important; }
  .mobile-m-4 { margin: 20px !important; }
  
  .mobile-mb-1 { margin-bottom: 8px !important; }
  .mobile-mb-2 { margin-bottom: 12px !important; }
  .mobile-mb-3 { margin-bottom: 16px !important; }
  .mobile-mb-4 { margin-bottom: 20px !important; }
  
  .mobile-mt-1 { margin-top: 8px !important; }
  .mobile-mt-2 { margin-top: 12px !important; }
  .mobile-mt-3 { margin-top: 16px !important; }
  .mobile-mt-4 { margin-top: 20px !important; }
  
  .mobile-text-sm { font-size: 14px !important; }
  .mobile-text-base { font-size: 16px !important; }
  .mobile-text-lg { font-size: 18px !important; }
  .mobile-text-xl { font-size: 20px !important; }
  
  .mobile-text-center { text-align: center !important; }
  .mobile-text-left { text-align: left !important; }
  .mobile-text-right { text-align: right !important; }
  
  .mobile-flex-col { flex-direction: column !important; }
  .mobile-flex-row { flex-direction: row !important; }
  .mobile-flex-wrap { flex-wrap: wrap !important; }
  .mobile-justify-center { justify-content: center !important; }
  .mobile-justify-between { justify-content: space-between !important; }
  .mobile-items-center { align-items: center !important; }
  .mobile-items-start { align-items: flex-start !important; }
  .mobile-gap-1 { gap: 8px !important; }
  .mobile-gap-2 { gap: 12px !important; }
  .mobile-gap-3 { gap: 16px !important; }
  
  .mobile-w-full { width: 100% !important; }
  .mobile-w-auto { width: auto !important; }
  .mobile-min-w-full { min-width: 100% !important; }
  .mobile-max-w-full { max-width: 100% !important; }
  
  .mobile-overflow-auto { overflow: auto !important; }
  .mobile-overflow-hidden { overflow: hidden !important; }
  .mobile-overflow-x-auto { 
    overflow-x: auto !important; 
    -webkit-overflow-scrolling: touch;
  }
  .mobile-overflow-y-auto { 
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================
   EXTRA SMALL MOBILE SCREENS (< 400px)
   iPhone SE, smaller Android devices
======================================== */

@media (max-width: 400px) {
  /* Header adjustments for very small screens */
  .mobile-header {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: calc(env(safe-area-inset-top) + 6px);
    padding-bottom: 6px;
    height: calc(62px + env(safe-area-inset-top));
  }
  
  .mobile-title {
    font-size: 16px !important;
  }
  
  .mobile-subtitle {
    font-size: 10px !important;
    display: none; /* Hide subtitle on very small screens to save space */
  }
  
  .mobile-user-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .mobile-logout-btn {
    width: 32px;
    height: 32px;
    padding: 6px;
  }
  
  .mobile-logout-btn svg {
    width: 18px;
    height: 18px;
  }
  
  .mobile-header-right {
    gap: 8px;
  }
  
  .mobile-menu-toggle {
    width: 28px;
    height: 28px;
  }
  
  .hamburger-line {
    width: 16px;
  }
}

/* ========================================
   LANDSCAPE MODE ON MOBILE
======================================== */

@media (max-width: 768px) and (orientation: landscape) {
  .mobile-header {
    padding-top: calc(env(safe-area-inset-top) + 4px);
    padding-bottom: 4px;
    height: calc(56px + env(safe-area-inset-top));
  }
  
  .mobile-title {
    font-size: 16px;
  }
  
  .mobile-subtitle {
    display: none; /* Hide subtitle in landscape for space */
  }
  
  .mobile-user-avatar,
  .mobile-logout-btn {
    width: 32px;
    height: 32px;
  }
}
